hcDetails.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427
  1. <template>
  2. <view class="details">
  3. <view class="search">
  4. <uni-icons type="bars" size="30" @click="returnList"></uni-icons>
  5. </view>
  6. <scroll-view class="top-menu-view" scroll-x="true">
  7. <view class="menu-topic-view" v-for="(item, key) in tabOptions" :key="key" @click="active=key">
  8. <view :class="active==key ? 'menu-topic-act' : 'menu-topic'">
  9. <text class="menu-topic-text">{{item}}</text>
  10. <view class="menu-topic-bottom">
  11. <view class="menu-topic-bottom-color"></view>
  12. </view>
  13. </view>
  14. </view>
  15. </scroll-view>
  16. <!-- <van-sticky :offset-top="-10">
  17. <van-tabs sticky v-model="active" class="tabs">
  18. <van-tab v-for="(item, key) in tabOptions" :key="key" :title="item">
  19. </van-tab>
  20. </van-tabs>
  21. </van-sticky> -->
  22. <view>
  23. <view class="hclist" v-if="active==0">
  24. <view class="menu-list">
  25. <view class="list-cell list-cell-arrow" v-for="(item, i) in jbxxs" :key="i">
  26. <view class="menu-item-box">
  27. <view>{{item.name}}</view>
  28. <view class="text-right">{{infoObj[item.prop]}}</view>
  29. </view>
  30. </view>
  31. <view class="list-cell list-cell-arrow" v-if="infoObj.qsxtif">
  32. <view>前期影像</view>
  33. {{infoObj.qsxtifimg}}
  34. <image class="yximage" :src="infoObj.qsxtifimg" mode="widthFix"></image>
  35. </view>
  36. <view class="list-cell list-cell-arrow" v-if="infoObj.hsxtif">
  37. <view>后期影像</view>
  38. <image class="yximage" :src="infoObj.hsxtifimg" mode="widthFix"></image>
  39. </view>
  40. </view>
  41. <!-- <van-cell v-for="(item, i) in jbxxs" :key="i" :title="item.name" :value="infoObj[item.prop]" /> -->
  42. </view>
  43. <view class="hclist" v-if="active==1">
  44. <scroll-view v-if="sheets.length" class="top-menu-view" scroll-x="true">
  45. <view class="menu-topic-view" v-for="ypitem in sheets" :key="ypitem.sheet"
  46. @click="ywyptab=ypitem.sheet">
  47. <view :class="ywyptab==ypitem.sheet ? 'menu-topic-act' : 'menu-topic'">
  48. <text class="menu-topic-text">{{ypitem.type}}</text>
  49. <view class="menu-topic-bottom">
  50. <view class="menu-topic-bottom-color"></view>
  51. </view>
  52. </view>
  53. </view>
  54. </scroll-view>
  55. <!-- <van-tabs sticky v-if="sheets.length" v-model="ywyptab">
  56. <van-tab v-for="ypitem in sheets" :key="ypitem.sheet" :title="ypitem.type" :name="ypitem.sheet">
  57. </van-tab>
  58. </van-tabs> -->
  59. <view class="swiper-item" v-for="ypitem in sheets" :key="ypitem.sheet">
  60. <view v-if="ywyptab==ypitem.sheet">
  61. <img :src="ypitem.photo" width="100%" />
  62. 压占{{ ypitem.type }}面积共{{ ypitem.mjj }}平方米
  63. <view class="list-cell">
  64. <uni-row>
  65. <uni-col :span="8" v-for="(item, i) in tdxzTable" :key="i">{{item.label}}</uni-col>
  66. </uni-row>
  67. </view>
  68. <view class="list-cell">
  69. <uni-row v-for="(row, index) in ypitem.data_list" :key="index">
  70. <uni-col :span="8" v-for="(item, i) in tdxzTable" :key="i">
  71. <div v-if="item.slot == 'ratio'">
  72. {{ ((row.yzmj / ypitem.yzmj) * 100).toFixed(2) }}%
  73. </div>
  74. <span v-else>{{ row[item.prop] }}</span>
  75. </uni-col>
  76. </uni-row>
  77. </view>
  78. </view>
  79. </view>
  80. </view>
  81. <view class="hclist" v-show="active==2">
  82. <view class="example-body">
  83. <uni-file-picker ref="upsgfjsRef" limit="9" title="最多选择9张图片" v-model="fileList.sdfjs"
  84. :sizeType="['original']" @select="e=>selectfile(e,'sdfjs')"
  85. @delete="e=>fileDelete(e,'sdfjs')"></uni-file-picker>
  86. </view>
  87. </view>
  88. <view class="hclist" v-show="active==3">
  89. <uni-forms ref="checkRef" :model="checkform" labelWidth="80px">
  90. <uni-forms-item label="实际地类" name="dlbm">
  91. <uni-data-select v-model="checkform.dlbm" :localdata="decList"></uni-data-select>
  92. </uni-forms-item>
  93. <uni-forms-item label="核查初判" name="decide">
  94. <uni-data-select v-model="checkform.decide" :localdata="hgxList"></uni-data-select>
  95. </uni-forms-item>
  96. <uni-forms-item label="其它材料" name="fjs">
  97. <uni-file-picker ref="upfjsRef" title="添加照片或文件" v-model="fileList.fjs"
  98. @select="e=>selectfile(e,'fjs')" @delete="e=>fileDelete(e,'fjs')"></uni-file-picker>
  99. </uni-forms-item>
  100. <uni-forms-item label="其它说明" name="notes" required>
  101. <uni-easyinput v-model="checkform.notes" type="textarea" placeholder="请输入其它说明" />
  102. </uni-forms-item>
  103. <!-- <uni-forms-item label="数字签名" name="notes" required>
  104. <img v-if="checkform.dataUrl" :url="checkform.dataUrl"></img>
  105. <view style="width: 100% ;height: 250rpx;" v-else>
  106. <l-signature disableScroll ref="signatureRef" penColor="red" :penSize="5"
  107. :openSmooth="true"></l-signature>
  108. <button size="mini" @click="$refs.signatureRef.clear()">撤消</button>
  109. <button size="mini" @click="savesign">保存</button>
  110. </view>
  111. </uni-forms-item> -->
  112. </uni-forms>
  113. </view>
  114. </view>
  115. <div class="btns">
  116. <button type="primary" size="mini" @click=" toggle">举证说明</button>
  117. <button type="primary" size="mini" :disabled=" !qrdis" @click="affirm(0)">确认</button>
  118. <button type="primary" size="mini" :disabled=" !qrdis" @click="affirm(1)">退回</button>
  119. <button type="primary" size="mini" :disabled="!steps.find(x => x.auditflowStep=='WYDC')"
  120. @click="save">保存</button>
  121. <button type="primary" size="mini" :disabled=" !tjdis" @click="tj">提交</button>
  122. </div>
  123. <uni-popup ref="popup" background-color="#fff">
  124. <uni-popup-dialog type="info" title="举证说明" :content="nowobj.notes"></uni-popup-dialog>
  125. </uni-popup>
  126. </view>
  127. </template>
  128. <script>
  129. import {
  130. TIFF
  131. }
  132. from 'tiff.js';
  133. import {
  134. uploadFile
  135. } from '@/utils/choose.js'
  136. import {
  137. getDkjbxx,
  138. getDkjbywy,
  139. getStep,
  140. hcWork,
  141. getHcInfo,
  142. getdecTree,
  143. } from "@/api/dkjbxx.js";
  144. import {
  145. getdict
  146. } from "@/api/apis.js";
  147. import {
  148. jbxxs,
  149. tdxzTable,
  150. } from "../config";
  151. export default {
  152. name: "list",
  153. data() {
  154. return {
  155. nowobj: {},
  156. active: 0,
  157. tabOptions: ['基本信息', '业务研判', '实地拍照', '核查信息'],
  158. loading: false,
  159. steps: [],
  160. qrdis: false,
  161. tjdis: false,
  162. jbxxs: jbxxs,
  163. tdxzTable: tdxzTable,
  164. activeName: "jbxx",
  165. infoObj: {},
  166. activities: [],
  167. //业务研判
  168. ywyptab: "1",
  169. sheets: [],
  170. //上传拍照
  171. fileList: {},
  172. checkform: {},
  173. decList: [],
  174. hgxList: []
  175. };
  176. },
  177. mounted() {
  178. // this.getsteps()
  179. },
  180. methods: {
  181. handleClick(val) {
  182. if (val) this.nowobj = val
  183. this.getsteps();
  184. this.reset();
  185. this.getInfos(this.nowobj);
  186. this.getdict()
  187. },
  188. getInfos(val) {
  189. let id = val.dkjdxxId
  190. getDkjbxx(id).then((res) => {
  191. this.infoObj = res.data;
  192. // this.loadAndConvertTIFF(this.infoObj.qsxtif, 'qsxtif')
  193. // this.loadAndConvertTIFF(this.infoObj.hsxtif, 'hsxtif')
  194. console.log(this.infoObj, 'this.infoObj')
  195. });
  196. getDkjbywy(id).then((res) => {
  197. if (res.data) {
  198. this.sheets = JSON.parse(res.data.sheetJson);
  199. this.ywyptab = this.sheets[0].sheet;
  200. }
  201. });
  202. getHcInfo({
  203. dkid: this.nowobj.dkjdxxId,
  204. auditflowStep: 'WYDC',
  205. auditflowId: this.nowobj.auditflowId,
  206. // fieldworkId: this.nowobj.id,
  207. }).then((res) => {
  208. if (res.data) {
  209. this.checkform = res.data[0]
  210. this.checkform.fieldworkId = this.nowobj.id
  211. this.checkform.fjs.map(f =>
  212. this.fileList.fjs.push({
  213. name: 'fjsimg',
  214. url: f.fjPreview
  215. })
  216. )
  217. this.checkform.sdfjs.map(f =>
  218. this.fileList.sdfjs.push({
  219. name: 'sgfjsimg',
  220. url: f.fjPreview
  221. })
  222. )
  223. }
  224. });
  225. },
  226. getdict() {
  227. this.decList = [];
  228. this.hgxList = [];
  229. getdecTree({
  230. dictType: '3DDLBM'
  231. }).then((res) => {
  232. res.data.map(di => {
  233. this.decList.push({
  234. value: di.dictValue,
  235. text: di.dictLabel
  236. })
  237. })
  238. });
  239. getdict({
  240. dictType: 'hgx_decide'
  241. }).then((res) => {
  242. res.rows.map(di => {
  243. this.hgxList.push({
  244. value: di.dictValue,
  245. text: di.dictLabel
  246. })
  247. })
  248. });
  249. },
  250. returnList() {
  251. this.$emit('returnList')
  252. },
  253. getsteps() {
  254. this.steps = [];
  255. getStep({
  256. dkjdxxId: this.nowobj.dkjdxxId
  257. }).then((res) => {
  258. this.steps = res.data;
  259. this.qrdis = this.steps.find((x) => x.auditflowStep.includes('WYQR'))
  260. // this.tjdis = this.steps.find((x) => x.auditflowStep=='WYDC')
  261. this.tjdis = this.steps.find((x) => x.auditflowStep.includes('WYTJ'))
  262. });
  263. },
  264. loadAndConvertTIFF(url, name) {
  265. if (!url) return
  266. // console.log(TIFF, 'TIFF')
  267. fetch(url).then(function(tiff) {
  268. var image = tiff.toRGBAImage(); // 转换为RGBA格式的图像数据
  269. var canvas = document.createElement('canvas');
  270. var ctx = canvas.getContext('2d');
  271. var imageData = ctx.createImageData(image.getWidth(), image.getHeight());
  272. imageData.data.set(image.getData().buffer);
  273. ctx.putImageData(imageData, 0, 0);
  274. this.infoObj[name + img] = canvas.toDataURL('image/png'); // 转换为PNG格式以便显示
  275. }.bind(this));
  276. },
  277. reset() {
  278. this.checkform = {
  279. fieldworkId: this.nowobj.id,
  280. dlbm: "",
  281. dlmc: "",
  282. decide: "",
  283. notes: "",
  284. auditflowStep: "WYDC",
  285. fjs: [],
  286. sdfjs: []
  287. }
  288. this.fileList = {
  289. fjs: [],
  290. sdfjs: []
  291. }
  292. },
  293. afterRead(files, detail) {
  294. // files.forEach(element => {
  295. // setTimeout(() => {
  296. // element.status = null;
  297. // }, 2000);
  298. // });
  299. },
  300. toggle() {
  301. this.$refs.popup.open('center')
  302. },
  303. affirm(confirmState) {
  304. uni.$globalData = this.nowobj
  305. this.$tab.navigateTo('/pages/index/common/affirm?confirmState=' + confirmState)
  306. },
  307. save() {
  308. let a = this.decList.find(d => d.value == this.checkform.dlbm)
  309. if (a) this.checkform.dlmc = a.text;
  310. console.log(this.checkform, 'fjs')
  311. this.$refs.checkRef.validate().then(res => {
  312. hcWork(this.checkform).then(response => {
  313. this.$modal.msgSuccess("保存成功")
  314. this.getsteps()
  315. })
  316. })
  317. },
  318. savesign() {
  319. this.$refs.signatureRef.canvasToTempFilePath({
  320. success: (res) => {
  321. console.log(res, '---')
  322. uploadFile(res.tempFilePath, (data) => {
  323. this.checkform.dataUrl = data.path
  324. })
  325. }
  326. })
  327. },
  328. tj() {
  329. uni.$globalData = this.nowobj
  330. console.log('[zzxxzzzx]', uni.$globalData, )
  331. console.log('[zzxxx]', this.nowobj, )
  332. this.$tab.navigateTo('/pages/index/common/tjDialog')
  333. },
  334. selectfile(e, fname) {
  335. let _this = this
  336. //e.tempFilePaths
  337. e.tempFiles.map(item => {
  338. _this.fileList[fname].push({
  339. name: fname + 'img',
  340. url: item.path
  341. })
  342. uploadFile(item.path, (data) => {
  343. console.log(data, 'data')
  344. if (data) {
  345. _this.checkform[fname].push({
  346. fjPath: data.path,
  347. fjSize: Number((item.size / 1024 / 1024).toFixed(2)),
  348. fjType: item.fileType
  349. });
  350. } else _this.fileList[fname].pop()
  351. })
  352. })
  353. },
  354. fileDelete(e, fname) {
  355. let index = this.fileList[fname].findInex(f => f.url == e.tempFilePath)
  356. this.fileList[fname].splice(index, 1)
  357. this.checkform[fname].splice(index, 1);
  358. }
  359. },
  360. };
  361. </script>
  362. <style lang="scss">
  363. .details {
  364. width: 100%;
  365. .uni-icons {
  366. position: absolute;
  367. right: 20rpx;
  368. top: 70rpx;
  369. }
  370. // position: relative;
  371. .tabs {
  372. margin-bottom: 20rpx;
  373. }
  374. .hclist {
  375. height: 40vh;
  376. overflow-x: hidden;
  377. overflow-y: auto;
  378. background: #fff;
  379. padding: 10rpx;
  380. .yximage {
  381. width: 200rpx;
  382. height: 200rpx;
  383. }
  384. }
  385. .btns {
  386. width: 100%;
  387. position: absolute;
  388. bottom: 20rpx;
  389. display: flex;
  390. }
  391. }
  392. </style>
  393. <style scoped lang="scss">
  394. @import "./tabs.scss";
  395. .menu-list {
  396. margin: 0;
  397. }
  398. .custom-image-box {
  399. /* #ifndef APP-NVUE */
  400. display: flex;
  401. /* #endif */
  402. flex-direction: row;
  403. justify-content: space-between;
  404. align-items: center;
  405. }
  406. </style>