VisitSummaryDetail.vue 15 KB

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