perfectStoreTask.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530
  1. <template>
  2. <div class="perfectStoreTask" v-if="formData">
  3. <van-nav-bar class="navBar" left-arrow :title="formData.taskName" @click-left="onClickLeft">
  4. <template #right>
  5. <!-- <span
  6. v-if="isEdit && insert == '1'"
  7. @click="onSubmit"
  8. style="
  9. color: white;
  10. background: rgb(0, 87, 186);
  11. display: block;
  12. padding: 6px 10px;
  13. border-radius: 6px;
  14. "
  15. >保存</span
  16. > -->
  17. </template>
  18. </van-nav-bar>
  19. <div class="content" v-if="formData">
  20. <div class="container">
  21. <van-form ref="tabstoreVal">
  22. <div v-for="(item, index) in formData.collectionItemList" :key="index">
  23. <div v-if="item.answerType == 'zp'" class="formLabel z-cell">
  24. <van-cell>
  25. <template #title>
  26. <!-- <span v-if="item.isMust == 0" class="van-f-red">*</span> -->
  27. <div class="headline">
  28. <span class="headlineIcon"></span>
  29. <span class="headlineTitle">任务相关照片</span>
  30. </div>
  31. <!-- 操作说明图片和电话 -->
  32. <taskTips
  33. v-if="item.contactPhone || item.examplePhoto"
  34. :contactPhone="item.contactPhone"
  35. :examplePhoto="item.examplePhoto">
  36. </taskTips>
  37. </template>
  38. </van-cell>
  39. <template
  40. v-if="
  41. formData.taskPhotoSkuImageUrlList && formData.taskPhotoSkuImageUrlList.length
  42. ">
  43. <div
  44. class="imgBox"
  45. v-for="(urls, index) in formData.taskPhotoSkuImageUrlList"
  46. :key="index">
  47. <img
  48. :src="urls.skuImageUrl"
  49. @click="previewsImg(formData.taskPhotoSkuImageUrlList, index)" />
  50. </div>
  51. </template>
  52. <!-- <deleteUploadImg
  53. :imgs="item.fileInfoList"
  54. :storeGroupId="storeGroupId"
  55. :taskIds="taskIds"
  56. :visitsId="visitsId"
  57. :collectionItemId="item.collectionId"
  58. :putInCode="formData.putInCode"
  59. :photoIdentifyType="formData.photoIdentifyType"
  60. :pictureSource="item.pictureSource"
  61. :continuousShoot="item.continuousShoot"
  62. :insert="insert"
  63. :objectType="objectType"
  64. v-if="item.fileInfoList.length"></deleteUploadImg> -->
  65. <span style="font-size: 16px" v-else>暂未识别到产品照片</span>
  66. </div>
  67. </div>
  68. </van-form>
  69. </div>
  70. <div class="skuDeatil">
  71. <div class="headline" style="margin-top: 10px">
  72. <span class="headlineIcon"></span>
  73. <span class="headlineTitle">SKU图像识别结果</span>
  74. </div>
  75. <el-table
  76. :data="formData.taskPhotoRecognitionResult"
  77. :span-method="taskObjectSpanMethod"
  78. border
  79. class="table-headermd1"
  80. style="width: 100%">
  81. <el-table-column label="序号" type="index" align="center" width="40"> </el-table-column>
  82. <el-table-column
  83. label="品类"
  84. prop="skuProductType"
  85. align="center"
  86. width="60"></el-table-column>
  87. <el-table-column label="SKU名称" prop="skuProductName" align="center">
  88. <template slot-scope="scope">
  89. <span class="tipTitle">{{ scope.row.skuProductName }}</span>
  90. </template>
  91. </el-table-column>
  92. <el-table-column
  93. label="排面数"
  94. prop="identifyTheNumberOfCards"
  95. align="center"
  96. width="50"></el-table-column>
  97. <el-table-column label="要求" prop="conditionIdentifyNum" align="center" width="60px">
  98. <template slot-scope="scope">
  99. <span
  100. v-if="scope.row.meetTheStandard != null"
  101. :style="{ color: scope.row.meetTheStandard == 1 ? '#07c160' : 'red' }">
  102. {{ scope.row.conditionIdentifyNum }}
  103. </span>
  104. <span v-else>{{ scope.row.conditionIdentifyNum }}</span>
  105. </template>
  106. </el-table-column>
  107. </el-table>
  108. </div>
  109. <div class="dataList" v-if="formData">
  110. <div class="headline" style="margin-top: 10px">
  111. <span class="headlineIcon"></span>
  112. <span class="headlineTitle">陈列任务要求</span>
  113. </div>
  114. <div class="dataItem">
  115. <div class="itemTop">
  116. <div class="itemIndex">
  117. <p>1、</p>
  118. </div>
  119. <div class="itemHtml" v-html="formData.displayInstructions"></div>
  120. </div>
  121. <div class="itemBottom" v-if="insert == '0'">
  122. <van-button round type="primary" v-if="formData.taskPhotoConditionPassed == 1"
  123. >通过</van-button
  124. >
  125. <van-button round type="danger" v-if="formData.taskPhotoConditionPassed == 0"
  126. >不通过</van-button
  127. >
  128. </div>
  129. </div>
  130. </div>
  131. </div>
  132. <el-dialog
  133. title="识别结果"
  134. :visible.sync="vanPopup"
  135. width="80%"
  136. :append-to-body="true"
  137. :close-on-click-modal="false"
  138. @close="vanPopup == false"
  139. custom-class="identifyResultdialog">
  140. <!-- 识别结果 -->
  141. <div
  142. class="identifyResult"
  143. v-if="formData.taskPhotoRecognitionResult"
  144. style="padding: 0 10px">
  145. <div class="resultContent">
  146. <el-table
  147. :data="formData.taskPhotoRecognitionResult"
  148. :span-method="taskObjectSpanMethod"
  149. border
  150. class="table-headermd1"
  151. style="width: 100%">
  152. <el-table-column label="" type="index" width="50px" align="center" />
  153. <el-table-column label="产品" prop="skuProductName" align="center" />
  154. <el-table-column
  155. label="识别排面数"
  156. prop="identifyTheNumberOfCards"
  157. width="70px"
  158. align="center">
  159. </el-table-column>
  160. <el-table-column label="要求" prop="conditionIdentifyNum" align="center" width="60px">
  161. <template slot-scope="scope">
  162. <span :style="{ color: scope.row.meetTheStandard == 1 ? '#07c160' : 'red' }">
  163. {{ scope.row.conditionIdentifyNum }}
  164. </span>
  165. </template>
  166. </el-table-column>
  167. </el-table>
  168. </div>
  169. </div>
  170. </el-dialog>
  171. </div>
  172. </template>
  173. <script>
  174. import {
  175. addCollectionAnswerBatch,
  176. getVisitsDetailPerfectStore,
  177. getVisitsDetailPerfectStoreByTaskId,
  178. } from '@/api/index';
  179. import taskTips from '@/views/deviceWithin/taskTips';
  180. import deleteUploadImg from '@/components/deleteUploadImgTaskPhoto';
  181. import { ImagePreview } from 'vant';
  182. export default {
  183. name: 'abnortaskPhotoTakingmalVisit',
  184. components: { taskTips, deleteUploadImg },
  185. data() {
  186. return {
  187. isEdit: true,
  188. formData: null,
  189. dataList: null,
  190. taskIds: [],
  191. visitsId: null,
  192. storeGroupId: '',
  193. objectType: '',
  194. insert: '',
  195. vanPopup: false,
  196. taskPhotoRecognitionResult: null,
  197. spanArr: [],
  198. };
  199. },
  200. activated() {
  201. this.taskIds = this.$route.query.taskIds || [];
  202. this.visitsId = this.$route.query.visitsId || '';
  203. this.storeGroupId = this.$route.query.storeGroupId || '';
  204. this.objectType = this.$route.query.photoType || '';
  205. this.insert = this.$route.query.insert;
  206. this.formData = null;
  207. this.getVisitsDetailFun();
  208. },
  209. methods: {
  210. taskObjectSpanMethod({ row, column, rowIndex, columnIndex }) {
  211. const cellValue = row[column.property];
  212. if (cellValue && ['conditionIdentifyNum'].includes(column.property)) {
  213. const _row = this.spanArr[rowIndex]; // 合并行数
  214. const _col = this.spanArr[rowIndex] > 0 ? 1 : 0; // 合并的列数
  215. return {
  216. rowspan: _row,
  217. colspan: _col,
  218. };
  219. }
  220. },
  221. getSpanArr(data) {
  222. if (!data) return;
  223. this.spanArr = []; // tip: 后台获取完成数据后,一定要重置spanArr=[],避免出现合并混乱!!!!!
  224. for (let i = 0; i < data.length; i++) {
  225. // 当为第一行时
  226. if (i === 0) {
  227. this.spanArr.push(1);
  228. this.pos = 0;
  229. } else {
  230. // 判断当前值是否与上一行的【名称】相等,相等则进行合并
  231. if (data[i].conditionDetailId === data[i - 1].conditionDetailId) {
  232. this.spanArr[this.pos] += 1; // 合并单元格:合并的行数 +1
  233. this.spanArr.push(0); // 0代表单元格是不需要显示, 已经被合并的单元格
  234. } else {
  235. this.spanArr.push(1); // 1代表当前这行的数据需要被显示
  236. this.pos = i;
  237. }
  238. }
  239. }
  240. },
  241. getVisitsDetailFun() {
  242. this.toastLoading(0, '加载中...', true);
  243. getVisitsDetailPerfectStoreByTaskId({
  244. visitsId: this.visitsId,
  245. taskId: this.$route.query.taskId,
  246. }).then((res) => {
  247. this.toastLoading().clear();
  248. if (res.code == 200 && res.data) {
  249. this.formData = res.data;
  250. console.log(this.formData.taskPhotoRecognitionResult);
  251. this.getSpanArr(this.formData.taskPhotoRecognitionResult);
  252. console.log(this.formData);
  253. } else {
  254. this.formData = null;
  255. }
  256. });
  257. },
  258. openDialog(item) {
  259. this.vanPopup = true;
  260. },
  261. onSubmit() {
  262. let formData = {
  263. storeId: this.$route.query.storeId,
  264. storeCode: this.$route.query.storeCode,
  265. storeGroupId: this.$route.query.storeGroupId,
  266. visitsId: this.visitsId,
  267. taskList: this.taskIds.split(',').map((val) => Number(val)),
  268. insert: true,
  269. collectionAnswers: [],
  270. checkUnManage: 'N',
  271. deviceCode: '',
  272. putInCode: '',
  273. equipmentCode: '',
  274. };
  275. addCollectionAnswerBatch(formData).then((res) => {
  276. if (res.code == 200) {
  277. localStorage.setItem('getRequestFlage', 'true');
  278. this.$router.go(-1);
  279. }
  280. });
  281. },
  282. previewsImg(fileInfoList, index) {
  283. var arrimg = [];
  284. for (var imgi = 0; imgi < fileInfoList.length; imgi++) {
  285. arrimg.push(fileInfoList[imgi].skuImageUrl);
  286. }
  287. ImagePreview({
  288. images: arrimg,
  289. startPosition: index,
  290. });
  291. },
  292. onClickLeft() {
  293. this.$router.go(-1);
  294. },
  295. },
  296. };
  297. </script>
  298. <style lang="scss" scoped>
  299. .perfectStoreTask {
  300. display: flex;
  301. flex-direction: column;
  302. width: 100%;
  303. height: 100%;
  304. // overflow: hidden;
  305. .content {
  306. padding: 10px;
  307. flex: 1;
  308. width: 100%;
  309. height: 100%;
  310. display: flex;
  311. flex-direction: column;
  312. padding-bottom: 46px;
  313. .container {
  314. background: #fff;
  315. width: 100%;
  316. border-radius: 6px;
  317. // padding: 10px;
  318. padding: 0 10px 10px 0px;
  319. }
  320. .formLabel {
  321. // margin-left: 20px;
  322. // border-bottom: 1px solid #f1f1f1;
  323. }
  324. .formLabel .van-cell {
  325. padding: 10px 0;
  326. }
  327. .formLabel .van-cell::after {
  328. border: 0;
  329. }
  330. .formLabel .van-field {
  331. border: 1px solid #f1f1f1;
  332. padding: 6px;
  333. width: 100%;
  334. border-radius: 4px;
  335. overflow: hidden;
  336. }
  337. .formLabel .van-field__control {
  338. padding: 0 10px;
  339. }
  340. .formLabel .formLabeltitle {
  341. position: absolute;
  342. top: 8px;
  343. }
  344. .z-cell .van-cell__title {
  345. font-size: 16px;
  346. }
  347. .van-f-red {
  348. color: red;
  349. width: 8px;
  350. display: inline-block;
  351. line-height: 26px;
  352. }
  353. .headline {
  354. font-weight: 600;
  355. font-size: 16px;
  356. position: relative;
  357. display: flex;
  358. align-items: center;
  359. .headlineIcon {
  360. display: inline-block;
  361. position: absolute;
  362. width: 3px;
  363. height: 60%;
  364. background: #3875c6;
  365. border-radius: 5px;
  366. }
  367. .headlineTitle {
  368. display: inline-block;
  369. padding: 0px 20px;
  370. background: #eef5ff;
  371. border-radius: 0 18px 18px 0;
  372. height: 36px;
  373. line-height: 36px;
  374. }
  375. }
  376. }
  377. .dataList {
  378. width: 100%;
  379. margin-top: 10px;
  380. // overflow-y: auto;
  381. background: #fff;
  382. .dataItem {
  383. display: flex;
  384. // border-radius: 6px;
  385. flex-direction: row;
  386. margin-bottom: 10px;
  387. // padding: 10px;
  388. font-size: 16px;
  389. margin-left: 20px;
  390. border-bottom: 1px solid #e2e1e1;
  391. .itemIndex {
  392. }
  393. .itemTop {
  394. flex: 1;
  395. overflow: hidden;
  396. padding-bottom: 10px;
  397. .itemHtml {
  398. overflow-x: auto;
  399. }
  400. }
  401. .itemTop,
  402. .itemBottom {
  403. display: flex;
  404. flex-direction: row;
  405. }
  406. .itemBottom {
  407. align-items: center;
  408. width: 60px;
  409. margin-left: 5px;
  410. img {
  411. width: 100%;
  412. height: 30px;
  413. }
  414. button {
  415. width: 55px;
  416. height: 25px;
  417. padding: 0;
  418. font-size: 12px;
  419. }
  420. }
  421. }
  422. }
  423. .tableTitle {
  424. padding: 10px 0;
  425. font-size: 16px;
  426. font-weight: bold;
  427. background: #f5f5f5;
  428. margin: 15px 0;
  429. }
  430. .imgBox {
  431. width: 22%;
  432. height: 80px;
  433. position: relative;
  434. display: inline-block;
  435. border-radius: 6px;
  436. overflow: hidden;
  437. margin: 3px 1.5%;
  438. img {
  439. width: 100%;
  440. height: 100%;
  441. }
  442. }
  443. }
  444. </style>
  445. <style lang="scss">
  446. .perfectStoreTask {
  447. .van-button--danger {
  448. background-color: #ee0a24 !important;
  449. border: 1px solid #ee0a24 !important;
  450. }
  451. }
  452. .identifyResultdialog {
  453. width: vw(690) !important;
  454. margin-top: 1vh !important;
  455. border-radius: 8px !important;
  456. font-size: vw(32) !important;
  457. height: 70% !important;
  458. display: flex;
  459. flex-direction: column;
  460. .el-dialog__headerbtn {
  461. width: vw(44);
  462. height: vw(44);
  463. background-color: #e1e1e1;
  464. border-radius: 50%;
  465. margin-top: -3px;
  466. }
  467. .el-dialog__body {
  468. flex: 1;
  469. overflow-y: auto;
  470. }
  471. }
  472. .table-headermd1 {
  473. font-size: 14px;
  474. text-align: center;
  475. position: initial;
  476. width: 98% !important;
  477. margin: 0 auto;
  478. border-right: 0;
  479. border-radius: 8px;
  480. th {
  481. color: #000;
  482. font-weight: bold;
  483. }
  484. td {
  485. color: #000;
  486. }
  487. .el-table__cell {
  488. padding: 6px 0 !important;
  489. .cell {
  490. padding: 0;
  491. }
  492. }
  493. }
  494. .skuDeatil {
  495. width: 100%;
  496. margin-top: 10px;
  497. background: #fff;
  498. border-radius: 6px;
  499. .table-headermd1 {
  500. font-size: 14px;
  501. text-align: center;
  502. position: initial;
  503. width: 98% !important;
  504. margin: 0 auto;
  505. border-right: 0;
  506. border-radius: 8px;
  507. margin-top: 10px;
  508. th {
  509. color: #000;
  510. font-weight: bold;
  511. }
  512. td {
  513. color: #000;
  514. }
  515. .el-table__cell {
  516. padding: 6px 0 !important;
  517. .cell {
  518. padding: 0;
  519. }
  520. }
  521. }
  522. .table-headermd1 th.el-table__cell {
  523. background-color: #f5f5f5;
  524. }
  525. }
  526. .el-table::before {
  527. height: 0;
  528. }
  529. </style>