perfectStoreTask.vue 14 KB

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