taskPhotoTaking.vue 12 KB

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