perfectStoreTask.vue 15 KB

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