VisitSummaryStorageDetail.vue 11 KB

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