VisitSummaryDetail.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446
  1. <template>
  2. <div v-if="info">
  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>&nbsp;{{ info.nickName }} - {{ info.postName }}</span>
  30. </div>
  31. <div style="padding: 4px 0">
  32. <van-icon :name="zw" size="16" style="float: left" />
  33. <span>&nbsp;所属部门:{{ info.deptName }}</span>
  34. </div>
  35. <div style="padding: 4px 0">
  36. <van-icon :name="tm" size="16" style="float: left" />
  37. <span>&nbsp;提交时间:{{ info.createTime }}</span>
  38. </div>
  39. </div>
  40. <div class="lineGrey"></div>
  41. <div
  42. class="container linep"
  43. style="background-color: #fff; width: 94%; margin: 0px auto; border-radius: 6px">
  44. <componVisitSummary
  45. :collectionItemLists="collectionItemLists"
  46. :approvalStatus="info.approvalStatus"
  47. ref="componVisitSummary"></componVisitSummary>
  48. </div>
  49. <br />
  50. <div class="approvalRemarh" v-if="source == 'SUPTaskApproval' && approvalType == '1'">
  51. <div class="approvalLabel">审批意见</div>
  52. <div class="remark">
  53. <van-field
  54. v-model="approvalMessage"
  55. rows="3"
  56. type="textarea"
  57. placeholder="请输入审批意见" />
  58. </div>
  59. </div>
  60. <!-- 从查询列表来 -->
  61. <!-- approvalStatus//1-待审批 2-审批通过 3-拒绝待提交 -->
  62. <template v-if="source == 'VisitSummary'">
  63. <div class="tc" style="padding: 0 16px" v-if="writeAgain && !info.approvalStatus">
  64. <van-button class="submitBtn" block type="info" color="#0057ba" @click="onSubmit">
  65. 补填保存
  66. </van-button>
  67. </div>
  68. <div class="tc" style="padding: 0 16px" v-if="info.approvalStatus == '3'">
  69. <van-button class="submitBtn" block type="info" color="#0057ba" @click="onSubmit">
  70. 提交审批
  71. </van-button>
  72. </div>
  73. </template>
  74. <template v-if="source == 'SUPTaskApproval' && approvalType == '1'">
  75. <div class="bottomBtn">
  76. <van-button color="red" round @click="approvalStoreFun('Nopass')">拒绝</van-button>
  77. <van-button type="primary" round @click="approvalStoreFun('pass')">通过</van-button>
  78. </div>
  79. </template>
  80. <br />
  81. <br />
  82. <br />
  83. </div>
  84. </template>
  85. <script>
  86. import history from '@/assets/Icon/history.png';
  87. import tm from '@/assets/Icon/tm.png';
  88. import zw from '@/assets/Icon/zw.png';
  89. import ry from '@/assets/Icon/ry.png';
  90. import { getSummaryMobilo } from '@/api/index';
  91. import { ImagePreview } from 'vant';
  92. import deleteUploadImg from '@/components/deleteUploadImg';
  93. import componVisitSummary from '@/views/week/componVisitSummary';
  94. import { writeAgainCustomAnswer } from '@/api/week';
  95. import { changeApproval } from '@/api/SUPTaskApproval.js';
  96. export default {
  97. name: 'daily',
  98. components: { deleteUploadImg, componVisitSummary },
  99. data() {
  100. return {
  101. info: null,
  102. zw: zw,
  103. tm: tm,
  104. ry: ry,
  105. show: true,
  106. num: 0,
  107. todayGoal: {},
  108. progressWidth: 0,
  109. history: history,
  110. imgArr: [],
  111. activeNames: ['1', '2', '3', '4', '5', '6', '7', '8', '10', '16', '17'],
  112. value: '2',
  113. message: '',
  114. powerGrade: '',
  115. Content: '',
  116. Content2: '',
  117. reportTargetAll: {},
  118. reportContents: [{ dayContent: '' }],
  119. reportTarget: {},
  120. successContent: '',
  121. imgList: [],
  122. type: '-1',
  123. collectionItemLists: [],
  124. writeAgain: false,
  125. approvalMessage: '',
  126. source: '',
  127. approvalType: '',
  128. //
  129. };
  130. },
  131. activated() {
  132. this.source = this.$route.query.source || '';
  133. this.approvalType = this.$route.query.approvalType || '';
  134. this.powerGrade = localStorage.getItem('powerGrade');
  135. this.getDetailById();
  136. this.num = 0;
  137. this.userTodayPlanNum();
  138. },
  139. methods: {
  140. pviewFn(val, imgVal) {
  141. var imgList = [];
  142. var photos = this.reportTarget.photos[val].photos;
  143. for (let i = 0; i < photos.length; i++) {
  144. imgList.push(photos[i].fileUrl);
  145. }
  146. ImagePreview({ images: imgList, startPosition: imgVal });
  147. },
  148. submint() {
  149. this.$router.push({
  150. path: '/daily',
  151. query: { reportId: this.$route.query.reportId, temporaryShow: 'N' },
  152. });
  153. },
  154. getDetailById() {
  155. let loading1 = this.$toast.loading({
  156. duration: 0,
  157. message: '加载中...',
  158. forbidClick: true,
  159. });
  160. getSummaryMobilo({ userSummaryId: this.$route.query.userSummaryId }).then((res) => {
  161. loading1.clear();
  162. this.reportTargetAll = res.data.reportTargetAll;
  163. this.info = res.data;
  164. this.type = res.data.userType;
  165. if (res.data.status == 3) {
  166. this.successContent = res.data.successContent;
  167. } else {
  168. this.successContent = res.data.failContent;
  169. }
  170. if (res.data.reportContents && res.data.reportContents.length > 0) {
  171. this.Content = res.data.reportContents[0].dayContent;
  172. if (res.data.reportContents.length > 1) {
  173. this.Content2 = res.data.reportContents[1].dayContent;
  174. } else {
  175. this.Content2 = '';
  176. }
  177. } else {
  178. this.Content = '';
  179. this.Content2 = '';
  180. }
  181. this.reportContents = res.data.reportContents;
  182. var imgList = [];
  183. if (res.data.photos != null) {
  184. for (var k = 0; k < res.data.photos.length; k++) {
  185. imgList.push(res.data.photos[k].fileUrl + '');
  186. }
  187. }
  188. this.imgList = imgList;
  189. this.writeAgain = res.data.customItemList.some((item) => {
  190. return item.allowWriteAgain;
  191. });
  192. this.collectionItemLists = res.data.customItemList;
  193. });
  194. },
  195. userTodayPlanNum() {
  196. // userTodayPlanNum().then((res) => {
  197. // if (res.code == 200) {
  198. // this.todayGoal = res.data;
  199. // this.progressWidth = (this.todayGoal.finishNum / this.todayGoal.planNum) * 100 + '%';
  200. // localStorage.setItem('nickName', res.data.user.nickName);
  201. // localStorage.setItem('storeType', res.data.user.type);
  202. // } else {
  203. // this.$toast.fail(res.msg);
  204. // }
  205. // });
  206. },
  207. onClickLeft() {
  208. if (this.source == 'SUPTaskApproval') {
  209. this.$router.replace({
  210. path: '/SUPTaskApproval',
  211. query: {
  212. tabVal: this.approvalType,
  213. },
  214. });
  215. } else {
  216. this.$router.replace({
  217. path: '/VisitSummary',
  218. });
  219. }
  220. },
  221. onSubmit() {
  222. let collectionAnswerlisd = this.$refs.componVisitSummary.collectionAnswerlisd;
  223. let collectionItemList = this.$refs.componVisitSummary.collectionItemList;
  224. for (var c = 0; c < collectionAnswerlisd.length; c++) {
  225. for (var b = 0; b < collectionItemList.length; b++) {
  226. if (collectionAnswerlisd[c].id == collectionItemList[b].customId) {
  227. collectionItemList[b].customOptionList = collectionAnswerlisd[c].value;
  228. }
  229. }
  230. }
  231. // 获取所有可以补填的题
  232. let customItemList = collectionItemList.filter((item) => item.allowWriteAgain);
  233. console.log(customItemList);
  234. // // 照片
  235. let zpDataList = customItemList.find((item) => item.answerType == 'zp');
  236. if (zpDataList) {
  237. let fileIdList = [];
  238. zpDataList.fileInfoList.forEach((item) => {
  239. fileIdList.push(item.id);
  240. });
  241. zpDataList.fileIdList = fileIdList;
  242. }
  243. writeAgainCustomAnswer({
  244. userSummaryId: this.$route.query.userSummaryId,
  245. customItemList: customItemList,
  246. })
  247. .then((res) => {
  248. if (res.code == 200) {
  249. this.$toast('操作成功!');
  250. this.$router.replace({
  251. path: '/VisitSummary',
  252. });
  253. } else {
  254. this.$toast(res.msg);
  255. }
  256. })
  257. .catch((err) => {
  258. this.$toast(err.msg);
  259. });
  260. },
  261. approvalStoreFun(type) {
  262. if (type == 'pass') {
  263. this.changeApprovalFun('1');
  264. } else {
  265. if (this.approvalMessage != '') {
  266. this.changeApprovalFun('2');
  267. } else {
  268. this.$notify({ type: 'warning', message: '请输入审批意见' });
  269. }
  270. }
  271. },
  272. changeApprovalFun(approvalStatus) {
  273. this.toastLoading(0, '加载中...', true);
  274. changeApproval({
  275. summaryApprovalId: this.$route.query.summaryApprovalId || '', // Long 主管任务审批id
  276. userSummaryId: this.$route.query.userSummaryId, // Long 主管任务填写主键id
  277. approvalStatus: approvalStatus, // string 审批状态:1-通过 2-拒绝
  278. approvalOpinion: this.approvalMessage, // string 审批意见,如果审批状态为拒绝则不能为空
  279. }).then((res) => {
  280. this.toastLoading().clear();
  281. if (res.code == 200) {
  282. this.$router.replace({
  283. path: '/SUPTaskApproval',
  284. });
  285. }
  286. });
  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>
  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. </style>