perfectStoreTask.vue 13 KB

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