VisitSummaryStorageDetail.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513
  1. <template>
  2. <div v-if="info" class="VisitSummaryStorageDetail">
  3. <div class="navBarTOP">
  4. <van-nav-bar
  5. class="navBar"
  6. :title="info.summaryTaskName"
  7. left-arrow
  8. @click-left="onClickLeft"
  9. right-text="删除"
  10. @click-right="onDelete" />
  11. </div>
  12. <div class="lineGrey"></div>
  13. <div class="lineGrey"></div>
  14. <div class="lineGrey"></div>
  15. <div class="lineGrey"></div>
  16. <div class="lineGrey"></div>
  17. <div class="lineGrey" style="height: 6px"></div>
  18. <!-- 主体内容-->
  19. <div
  20. class="container linep"
  21. style="
  22. background-color: #fff;
  23. width: 94%;
  24. margin: 0px auto;
  25. border-radius: 6px;
  26. padding: 10px;
  27. ">
  28. <div style="padding: 4px 0">
  29. <van-icon :name="ry" size="16" style="float: left" />
  30. <span style="font-size: 13px; margin-left: 8px"
  31. >&nbsp;{{ info.nickName }} - {{ info.postName }}</span
  32. >
  33. </div>
  34. <div style="padding: 4px 0">
  35. <van-icon :name="zw" size="16" style="float: left" />
  36. <span style="font-size: 13px; margin-left: 8px">&nbsp;所属部门:{{ info.deptName }}</span>
  37. </div>
  38. <div style="padding: 4px 0">
  39. <van-icon :name="tm" size="16" style="float: left" />
  40. <span style="font-size: 13px; margin-left: 8px">&nbsp;提交时间:{{ info.createTime }}</span>
  41. </div>
  42. </div>
  43. <div class="lineGrey"></div>
  44. <div class="container linep" style="width: 94%; margin: 0px auto; border-radius: 6px">
  45. <!-- 编辑 -->
  46. <componVisitSummary
  47. :collectionItemLists="collectionItemLists"
  48. :approvalStatus="info.approvalStatus"
  49. ref="componVisitSummary">
  50. <!-- 活动扫码 -->
  51. <ActivityQRCode
  52. v-if="info.qrCodeCheck == '1'"
  53. @onSubmit="onStorage"
  54. ref="ActivityQRCode"
  55. :ActivityQRCodeData="ActivityQRCodeData"
  56. :qrUuid="qrUuid"></ActivityQRCode>
  57. </componVisitSummary>
  58. </div>
  59. <br />
  60. <div class="tc" style="padding: 0 16px">
  61. <van-button class="submitBtn" block type="primary" @click="onStorage(null)">
  62. 暂存
  63. </van-button>
  64. <van-button class="submitBtn" block type="info" color="#0057ba" @click="onSubmit">
  65. 提交汇报
  66. </van-button>
  67. </div>
  68. <br />
  69. <br />
  70. <br />
  71. </div>
  72. </template>
  73. <script>
  74. import history from '@/assets/Icon/history.png';
  75. import tm from '@/assets/Icon/tm.png';
  76. import zw from '@/assets/Icon/zw.png';
  77. import ry from '@/assets/Icon/ry.png';
  78. import {
  79. getSummaryMobilo,
  80. insertCustomAnswer,
  81. temporarilyCustomAnswer,
  82. deleteSummaryMobile,
  83. } from '@/api/index';
  84. import { ImagePreview } from 'vant';
  85. import deleteUploadImg from '@/components/deleteUploadImg';
  86. import componVisitSummary from '@/views/week/componVisitSummary';
  87. import ActivityQRCode from './ActivityQRCode';
  88. export default {
  89. name: 'daily',
  90. components: { deleteUploadImg, componVisitSummary, ActivityQRCode },
  91. data() {
  92. return {
  93. info: null,
  94. zw: zw,
  95. tm: tm,
  96. ry: ry,
  97. show: true,
  98. num: 0,
  99. todayGoal: {},
  100. progressWidth: 0,
  101. history: history,
  102. imgArr: [],
  103. activeNames: ['1', '2', '3', '4', '5', '6', '7', '8', '10', '16', '17'],
  104. value: '2',
  105. message: '',
  106. powerGrade: '',
  107. Content: '',
  108. Content2: '',
  109. reportTargetAll: {},
  110. reportContents: [{ dayContent: '' }],
  111. reportTarget: {},
  112. successContent: '',
  113. imgList: [],
  114. type: '-1',
  115. collectionItemLists: [],
  116. writeAgain: false,
  117. approvalMessage: '',
  118. source: '',
  119. ActivityQRCodeData: {},
  120. qrUuid: null,
  121. };
  122. },
  123. activated() {
  124. this.ActivityQRCodeData = {};
  125. this.source = this.$route.query.source || '';
  126. this.powerGrade = localStorage.getItem('powerGrade');
  127. this.getDetailById();
  128. this.num = 0;
  129. this.userTodayPlanNum();
  130. },
  131. methods: {
  132. setApprovalStatus(status) {
  133. if (status == '1') {
  134. return '通过';
  135. } else if (status == '2') {
  136. return '拒绝';
  137. }
  138. },
  139. pviewFn(val, imgVal) {
  140. var imgList = [];
  141. var photos = this.reportTarget.photos[val].photos;
  142. for (let i = 0; i < photos.length; i++) {
  143. imgList.push(photos[i].fileUrl);
  144. }
  145. ImagePreview({ images: imgList, startPosition: imgVal });
  146. },
  147. submint() {
  148. this.$router.push({
  149. path: '/daily',
  150. query: { reportId: this.$route.query.reportId, temporaryShow: 'N' },
  151. });
  152. },
  153. getDetailById() {
  154. let loading1 = this.$toast.loading({
  155. duration: 0,
  156. message: '加载中...',
  157. forbidClick: true,
  158. });
  159. getSummaryMobilo({ userSummaryId: this.$route.query.userSummaryId }).then((res) => {
  160. loading1.clear();
  161. this.ActivityQRCodeData = {
  162. summaryEventName: res.data.summaryEventName || '',
  163. summaryEventDate: res.data.summaryEventDate || '',
  164. qrStartTime: res.data.qrStartTime || '',
  165. qrEndTime: res.data.qrEndTime || '',
  166. };
  167. this.qrUuid = res.data.qrUuid;
  168. this.reportTargetAll = res.data.reportTargetAll;
  169. this.info = res.data;
  170. this.type = res.data.userType;
  171. if (res.data.status == 3) {
  172. this.successContent = res.data.successContent;
  173. } else {
  174. this.successContent = res.data.failContent;
  175. }
  176. if (res.data.reportContents && res.data.reportContents.length > 0) {
  177. this.Content = res.data.reportContents[0].dayContent;
  178. if (res.data.reportContents.length > 1) {
  179. this.Content2 = res.data.reportContents[1].dayContent;
  180. } else {
  181. this.Content2 = '';
  182. }
  183. } else {
  184. this.Content = '';
  185. this.Content2 = '';
  186. }
  187. this.reportContents = res.data.reportContents;
  188. var imgList = [];
  189. if (res.data.photos != null) {
  190. for (var k = 0; k < res.data.photos.length; k++) {
  191. imgList.push(res.data.photos[k].fileUrl + '');
  192. }
  193. }
  194. this.imgList = imgList;
  195. this.writeAgain = res.data.customItemList.some((item) => {
  196. return item.allowWriteAgain;
  197. });
  198. this.collectionItemLists = res.data.customItemList;
  199. });
  200. },
  201. userTodayPlanNum() {
  202. // userTodayPlanNum().then((res) => {
  203. // if (res.code == 200) {
  204. // this.todayGoal = res.data;
  205. // this.progressWidth = (this.todayGoal.finishNum / this.todayGoal.planNum) * 100 + '%';
  206. // localStorage.setItem('nickName', res.data.user.nickName);
  207. // localStorage.setItem('storeType', res.data.user.type);
  208. // } else {
  209. // this.$toast.fail(res.msg);
  210. // }
  211. // });
  212. },
  213. onClickLeft() {
  214. this.$router.go(-1);
  215. },
  216. // 暂存 不校验答案是否必填
  217. onStorage(callback) {
  218. let ActivityQRCodeData = this.$refs.ActivityQRCode ? this.$refs.ActivityQRCode.activityForm : {} || {};
  219. this.setParams((collectionItemList) => {
  220. temporarilyCustomAnswer({
  221. userSummaryId: this.info.userSummaryId,
  222. summaryId: this.info.summaryId, //Long 主管任务id
  223. customItemList: collectionItemList, //List<Object> 答案列表
  224. ...ActivityQRCodeData, //任务名称、活动日期、签到时间
  225. getQrCode: callback ? true : false, //是否需要反馈二维码(是:任务名称、活动日期、签到时间必填)
  226. qrUuid: this.qrUuid || null,
  227. })
  228. .then((res) => {
  229. if (res.code == 200) {
  230. this.$toast('操作成功!');
  231. if (callback) {
  232. // 回传二维码
  233. callback(res);
  234. } else {
  235. this.$router.replace({
  236. path: this.source,
  237. });
  238. }
  239. } else {
  240. this.$toast(res.msg);
  241. }
  242. })
  243. .catch((err) => {
  244. this.$toast(err.msg);
  245. });
  246. });
  247. },
  248. onSubmit() {
  249. if (this.info.qrCodeCheck == '1') {
  250. // 执行 ActivityQRCode from表单验证触发
  251. this.$refs.ActivityQRCode.$refs.tabstoreVal
  252. .validate()
  253. .then(() => {
  254. // 验证通过
  255. let ActivityQRCodeData = this.$refs.ActivityQRCode ? this.$refs.ActivityQRCode.activityForm : {} || {};
  256. this.onSubmitFun(ActivityQRCodeData);
  257. })
  258. .catch((errors) => {
  259. //验证失败
  260. window.scrollTo(0, 0);
  261. return;
  262. });
  263. } else {
  264. this.onSubmitFun();
  265. }
  266. },
  267. onSubmitFun(ActivityQRCodeData = {}) {
  268. this.setParams((collectionItemList) => {
  269. insertCustomAnswer({
  270. userSummaryId: this.info.userSummaryId, // Long 用户总结id,如果为新增则不填,编辑则必填
  271. summaryId: this.info.summaryId, //Long 主管任务id
  272. customItemList: collectionItemList,
  273. ...ActivityQRCodeData,
  274. qrUuid: this.qrUuid,
  275. })
  276. .then((res) => {
  277. if (res.code == 200) {
  278. this.$toast('操作成功!');
  279. this.$router.replace({
  280. path: this.source,
  281. });
  282. } else {
  283. this.$toast(res.msg);
  284. }
  285. })
  286. .catch((err) => {
  287. this.$toast(err.msg);
  288. });
  289. });
  290. },
  291. setParams(callback) {
  292. let collectionAnswerlisd = this.$refs.componVisitSummary.collectionAnswerlisd;
  293. let collectionItemList = this.$refs.componVisitSummary.collectionItemList;
  294. for (var c = 0; c < collectionAnswerlisd.length; c++) {
  295. for (var b = 0; b < collectionItemList.length; b++) {
  296. if (collectionAnswerlisd[c].id == collectionItemList[b].customId) {
  297. collectionItemList[b].customOptionList = collectionAnswerlisd[c].value;
  298. }
  299. }
  300. }
  301. // // 照片
  302. let zpDataList = collectionItemList.find((item) => item.answerType == 'zp');
  303. if (zpDataList) {
  304. let fileIdList = [];
  305. zpDataList.fileInfoList.forEach((item) => {
  306. fileIdList.push(item.id);
  307. });
  308. zpDataList.fileIdList = fileIdList;
  309. }
  310. callback && callback(collectionItemList);
  311. },
  312. // 删除
  313. onDelete() {
  314. this.$dialog
  315. .confirm({
  316. title: '提示',
  317. message: '确定要删除吗?',
  318. showCancelButton: true,
  319. })
  320. .then(() => {
  321. deleteSummaryMobile({ userSummaryId: this.$route.query.userSummaryId })
  322. .then((res) => {
  323. if (res.code == 200) {
  324. this.$toast('操作成功!');
  325. this.$router.replace({
  326. path: this.source,
  327. });
  328. } else {
  329. this.$toast(res.msg);
  330. }
  331. })
  332. .catch((err) => {
  333. this.$toast(err.msg);
  334. });
  335. })
  336. .catch(() => {});
  337. },
  338. },
  339. };
  340. </script>
  341. <style scoped lang="scss">
  342. .container {
  343. // background-color: white;
  344. }
  345. .van-f-red {
  346. color: red;
  347. width: 8px;
  348. display: inline-block;
  349. line-height: 26px;
  350. }
  351. .formLabel {
  352. margin: 0 16px;
  353. border-bottom: 1px solid #f1f1f1;
  354. }
  355. .formLabel .van-cell {
  356. padding: 10px 0;
  357. }
  358. .formLabel .van-cell::after {
  359. border: 0;
  360. }
  361. .formLabel .van-field {
  362. border: 1px solid #f1f1f1;
  363. padding: 6px;
  364. width: 100%;
  365. border-radius: 4px;
  366. overflow: hidden;
  367. }
  368. .formLabel .van-field__control {
  369. padding: 0 10px;
  370. }
  371. .formLabel .formLabeltitle {
  372. position: absolute;
  373. top: 8px;
  374. }
  375. .z-checkbox .van-radio {
  376. padding: 6px 0;
  377. }
  378. .z-celly .van-cell__title {
  379. font-weight: initial;
  380. font-size: 14px;
  381. }
  382. .bottomBtn {
  383. position: fixed;
  384. bottom: 0;
  385. z-index: 10;
  386. height: 50px;
  387. width: 100%;
  388. display: flex;
  389. flex-direction: row;
  390. justify-content: space-around;
  391. .van-button {
  392. /* flex: 1; */
  393. width: 40%;
  394. }
  395. }
  396. .approvalRemarh {
  397. width: 94%;
  398. margin: 0px auto;
  399. border-radius: 6px;
  400. margin-bottom: 40px;
  401. .approvalLabel {
  402. font-size: 14px;
  403. padding: 5px 0;
  404. }
  405. }
  406. </style>
  407. <style lang="scss">
  408. .table-headermd {
  409. font-size: 1.2rem;
  410. text-align: center;
  411. position: initial;
  412. width: 94% !important;
  413. margin: 0 auto;
  414. border-right: 0;
  415. }
  416. .table-headermd .el-table__header,
  417. .table-headermd .el-table__body {
  418. width: 100% !important;
  419. }
  420. .table-headermd col {
  421. width: 5.8rem;
  422. }
  423. .table-headermd col:nth-child(2),
  424. .table-headermd col:nth-child(4),
  425. .table-headermd col:nth-child(3) {
  426. width: 5rem;
  427. }
  428. .table-headermd .van-cell {
  429. padding: 0 4px;
  430. height: 100%;
  431. }
  432. .table-headermd th.el-table__cell > .cell {
  433. padding: 0 4px;
  434. }
  435. .table-headermd th.el-table__cell {
  436. background-color: #1989fa;
  437. color: #fff;
  438. }
  439. .table-headermd .el-table__cell {
  440. padding: 4px 0;
  441. }
  442. .table-headermd .tipTitle {
  443. overflow: hidden;
  444. text-overflow: ellipsis;
  445. display: -webkit-box;
  446. -webkit-box-orient: vertical;
  447. -webkit-line-clamp: 2;
  448. }
  449. .table-headermd::before {
  450. height: 0;
  451. }
  452. .f-right {
  453. text-align: right;
  454. margin: 0;
  455. }
  456. .mg0 {
  457. margin: 6px 10px;
  458. color: #909090;
  459. font-size: 14px;
  460. }
  461. .selesetText {
  462. margin-bottom: 16px;
  463. }
  464. .z-cells .van-cell__title {
  465. font-weight: bold;
  466. color: #4a4a4a;
  467. }
  468. .z-cells .van-cell {
  469. padding-bottom: 0;
  470. }
  471. .VisitSummaryStorageDetail {
  472. .tc {
  473. display: flex;
  474. justify-content: space-between;
  475. .submitBtn {
  476. width: 45%;
  477. border-radius: 20px;
  478. }
  479. }
  480. .linep .van-cell__title {
  481. color: #646566;
  482. font-weight: 500;
  483. font-size: 14px;
  484. }
  485. }
  486. </style>