VisitSummaryDetail.vue 13 KB

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