taskPhotoTaking.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  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. <span>1.</span>
  28. {{ item.collectionName }}
  29. <!-- 操作说明图片和电话 -->
  30. <taskTips
  31. v-if="item.contactPhone || item.examplePhoto"
  32. :contactPhone="item.contactPhone"
  33. :examplePhoto="item.examplePhoto">
  34. </taskTips>
  35. </template>
  36. </van-cell>
  37. <delete-upload-img
  38. :imgs="item.fileInfoList"
  39. :storeGroupId="storeGroupId"
  40. :taskIds="taskIds"
  41. :visitsId="visitsId"
  42. :collectionItemId="item.collectionId"
  43. :putInCode="formData.putInCode"
  44. :photoIdentifyType="formData.photoIdentifyType"
  45. @upDataDetail="getDetaile"
  46. :pictureSource="item.pictureSource"
  47. :continuousShoot="item.continuousShoot"
  48. :insert="insert"
  49. :objectType="objectType"></delete-upload-img>
  50. </div>
  51. </div>
  52. </van-form>
  53. </div>
  54. <div class="dataList" v-if="dataList">
  55. <div class="dataItem" v-for="(item, index) in dataList">
  56. <div class="itemTop">
  57. <div class="itemIndex">
  58. <p>{{ index + 1 }}、</p>
  59. </div>
  60. <div v-html="item.displayInstructions"></div>
  61. </div>
  62. <div class="itemBottom" v-if="insert == '0'">
  63. <img
  64. @click="openDialog(item)"
  65. :src="
  66. item.taskPhotoConditionPassed == 1
  67. ? require('@/assets/taskPhotoSu.png')
  68. : require('@/assets/taskPhotoErr.png')
  69. " />
  70. <!-- <img
  71. v-if="item.taskPhotoConditionPassed == 0"
  72. :src="require('@/assets/taskPhotoErr.png')" /> -->
  73. </div>
  74. </div>
  75. </div>
  76. </div>
  77. <el-dialog
  78. title="识别结果"
  79. :visible.sync="vanPopup"
  80. width="80%"
  81. :append-to-body="true"
  82. :close-on-click-modal="false"
  83. @close="vanPopup == false"
  84. custom-class="identifyResultdialog">
  85. <!-- 识别结果 -->
  86. <div class="identifyResult" v-if="taskPhotoRecognitionResult" style="padding: 0 10px">
  87. <div class="resultContent">
  88. <el-table
  89. :data="taskPhotoRecognitionResult"
  90. border
  91. class="table-headermd1"
  92. style="width: 100%">
  93. <el-table-column label="" type="index" width="50px" align="center" />
  94. <el-table-column label="产品" prop="skuProductName" align="center" />
  95. <el-table-column label="要求" prop="conditionIdentifyNum" align="center" width="60px">
  96. </el-table-column>
  97. <el-table-column
  98. label="识别排面数"
  99. prop="identifyTheNumberOfCards"
  100. width="70px"
  101. align="center"
  102. >meetTheStandard
  103. <template slot-scope="scope">
  104. <span :style="{ color: scope.row.meetTheStandard == 1 ? '#07c160' : 'red' }">
  105. {{ scope.row.identifyTheNumberOfCards }}
  106. </span>
  107. </template>
  108. </el-table-column>
  109. </el-table>
  110. </div>
  111. </div>
  112. </el-dialog>
  113. </div>
  114. </template>
  115. <script>
  116. import { getCollectionInfosBatch, addCollectionAnswerBatch, getVisitsDetail } from '@/api/index';
  117. import taskTips from './taskTips';
  118. import deleteUploadImg from '@/components/deleteUploadImgTaskPhoto';
  119. export default {
  120. name: 'abnortaskPhotoTakingmalVisit',
  121. components: { taskTips, deleteUploadImg },
  122. data() {
  123. return {
  124. isEdit: true,
  125. formData: null,
  126. dataList: null,
  127. taskIds: [],
  128. visitsId: null,
  129. storeGroupId: '',
  130. objectType: '',
  131. insert: '',
  132. vanPopup: false,
  133. taskPhotoRecognitionResult: null,
  134. };
  135. },
  136. activated() {
  137. this.taskIds = this.$route.query.taskIds || [];
  138. this.visitsId = this.$route.query.visitsId || '';
  139. this.storeGroupId = this.$route.query.storeGroupId || '';
  140. this.objectType = this.$route.query.photoType || '';
  141. this.insert = this.$route.query.insert;
  142. if (this.$route.query.source == 'historicalDetails') {
  143. this.getVisitsDetailFun();
  144. } else {
  145. this.getDetaile();
  146. }
  147. },
  148. methods: {
  149. getVisitsDetailFun() {
  150. this.toastLoading(0, '加载中...', true);
  151. getVisitsDetail({ visitsId: this.visitsId }).then((res) => {
  152. this.toastLoading().clear();
  153. if (res.data.sfaTaskList) {
  154. this.dataList = res.data.sfaTaskList.filter((val) => val.taskType == '5');
  155. this.formData = this.dataList[0];
  156. } else {
  157. this.formData = null;
  158. }
  159. });
  160. },
  161. getDetaile() {
  162. console.log(this.$route.query);
  163. getCollectionInfosBatch({
  164. storeCode: this.$route.query.storeCode,
  165. insert: this.insert == '1' ? true : false,
  166. id: this.visitsId,
  167. taskIds: this.taskIds.split(','),
  168. }).then((res) => {
  169. if (res.data && res.data.length) {
  170. this.dataList = res.data;
  171. this.formData = res.data[0];
  172. } else {
  173. this.formData = null;
  174. }
  175. });
  176. },
  177. openDialog(item) {
  178. this.vanPopup = true;
  179. this.taskPhotoRecognitionResult = item.taskPhotoRecognitionResult;
  180. },
  181. onSubmit() {
  182. let formData = {
  183. storeId: this.$route.query.storeId,
  184. storeCode: this.$route.query.storeCode,
  185. storeGroupId: this.$route.query.storeGroupId,
  186. visitsId: this.visitsId,
  187. taskList: this.taskIds.split(',').map((val) => Number(val)),
  188. insert: true,
  189. collectionAnswers: [],
  190. checkUnManage: 'N',
  191. deviceCode: '',
  192. putInCode: '',
  193. equipmentCode: '',
  194. };
  195. addCollectionAnswerBatch(formData).then((res) => {
  196. if (res.code == 200) {
  197. localStorage.setItem('getRequestFlage', 'true');
  198. this.$router.go(-1);
  199. }
  200. });
  201. },
  202. onClickLeft() {
  203. this.$router.go(-1);
  204. },
  205. },
  206. };
  207. </script>
  208. <style lang="scss" scoped>
  209. .taskPhotoTaking {
  210. display: flex;
  211. flex-direction: column;
  212. width: 100%;
  213. height: 100%;
  214. overflow: hidden;
  215. .content {
  216. padding: 10px;
  217. flex: 1;
  218. width: 100%;
  219. height: 100%;
  220. display: flex;
  221. flex-direction: column;
  222. padding-bottom: 46px;
  223. .container {
  224. background: #fff;
  225. width: 100%;
  226. border-radius: 6px;
  227. padding: 10px;
  228. }
  229. .formLabel {
  230. margin-left: 20px;
  231. border-bottom: 1px solid #f1f1f1;
  232. }
  233. .formLabel .van-cell {
  234. padding: 10px 0;
  235. }
  236. .formLabel .van-cell::after {
  237. border: 0;
  238. }
  239. .formLabel .van-field {
  240. border: 1px solid #f1f1f1;
  241. padding: 6px;
  242. width: 100%;
  243. border-radius: 4px;
  244. overflow: hidden;
  245. }
  246. .formLabel .van-field__control {
  247. padding: 0 10px;
  248. }
  249. .formLabel .formLabeltitle {
  250. position: absolute;
  251. top: 8px;
  252. }
  253. .z-cell .van-cell__title {
  254. font-size: 16px;
  255. }
  256. .van-f-red {
  257. color: red;
  258. width: 8px;
  259. display: inline-block;
  260. line-height: 26px;
  261. }
  262. }
  263. .dataList {
  264. width: 100%;
  265. margin-top: 10px;
  266. overflow-y: auto;
  267. .dataItem {
  268. display: flex;
  269. background: #fff;
  270. border-radius: 6px;
  271. flex-direction: column;
  272. margin-bottom: 10px;
  273. padding: 10px;
  274. font-size: 16px;
  275. padding-left: 20px;
  276. .itemIndex {
  277. }
  278. .itemTop {
  279. flex: 1;
  280. }
  281. .itemTop,
  282. .itemBottom {
  283. display: flex;
  284. flex-direction: row;
  285. }
  286. .itemBottom {
  287. justify-content: end;
  288. }
  289. }
  290. }
  291. }
  292. </style>
  293. <style lang="scss">
  294. .identifyResultdialog {
  295. width: vw(690) !important;
  296. margin-top: 1vh !important;
  297. border-radius: 8px !important;
  298. font-size: vw(32) !important;
  299. height: 70% !important;
  300. display: flex;
  301. flex-direction: column;
  302. .el-dialog__headerbtn {
  303. width: vw(44);
  304. height: vw(44);
  305. background-color: #e1e1e1;
  306. border-radius: 50%;
  307. margin-top: -3px;
  308. }
  309. .el-dialog__body {
  310. flex: 1;
  311. overflow-y: auto;
  312. }
  313. }
  314. .table-headermd1 {
  315. font-size: 14px;
  316. text-align: center;
  317. position: initial;
  318. width: 98% !important;
  319. margin: 0 auto;
  320. border-right: 0;
  321. border-radius: 8px;
  322. th {
  323. color: #000;
  324. font-weight: bold;
  325. }
  326. td {
  327. color: #000;
  328. }
  329. .el-table__cell {
  330. padding: 6px 0 !important;
  331. .cell {
  332. padding: 0;
  333. }
  334. }
  335. }
  336. </style>