taskPhotoTaking.vue 12 KB

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