perfectStoreTask.vue 15 KB

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