VisitSummaryDetail.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361
  1. <template>
  2. <div>
  3. <!-- 顶部条-->
  4. <div class="navBarTOP">
  5. <van-nav-bar
  6. class="navBar"
  7. :title="info.summaryTaskName"
  8. left-arrow
  9. @click-left="onClickLeft" />
  10. <!-- <p style="text-align: right;margin-right: 16px;color: #1e5398;">{{title}}</p>-->
  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>&nbsp;{{ info.nickName }} - {{ info.postName }}</span>
  31. </div>
  32. <div style="padding: 4px 0">
  33. <van-icon :name="zw" size="16" style="float: left" />
  34. <span>&nbsp;所属部门:{{ info.deptName }}</span>
  35. </div>
  36. <div style="padding: 4px 0">
  37. <van-icon :name="tm" size="16" style="float: left" />
  38. <span>&nbsp;提交时间:{{ info.createTime }}</span>
  39. </div>
  40. </div>
  41. <div class="lineGrey"></div>
  42. <div
  43. class="container linep"
  44. style="background-color: #fff; width: 94%; margin: 0px auto; border-radius: 6px">
  45. <componVisitSummary
  46. :collectionItemLists="collectionItemLists"
  47. ref="componVisitSummary"></componVisitSummary>
  48. </div>
  49. <br />
  50. <div class="tc" style="padding: 0 16px" v-if="writeAgain">
  51. <van-button class="submitBtn" block type="info" color="#0057ba" @click="onSubmit">
  52. 补填保存
  53. </van-button>
  54. </div>
  55. <br />
  56. <br />
  57. <br />
  58. </div>
  59. </template>
  60. <script>
  61. import history from '@/assets/Icon/history.png';
  62. import tm from '@/assets/Icon/tm.png';
  63. import zw from '@/assets/Icon/zw.png';
  64. import ry from '@/assets/Icon/ry.png';
  65. import { getSummaryMobilo } from '@/api/index';
  66. import { ImagePreview } from 'vant';
  67. import deleteUploadImg from '@/components/deleteUploadImg';
  68. import componVisitSummary from '@/views/week/componVisitSummary';
  69. import { writeAgainCustomAnswer } from '@/api/week';
  70. export default {
  71. name: 'daily',
  72. components: { deleteUploadImg, componVisitSummary },
  73. data() {
  74. return {
  75. info: {},
  76. zw: zw,
  77. tm: tm,
  78. ry: ry,
  79. show: true,
  80. num: 0,
  81. todayGoal: {},
  82. progressWidth: 0,
  83. history: history,
  84. imgArr: [],
  85. activeNames: ['1', '2', '3', '4', '5', '6', '7', '8', '10', '16', '17'],
  86. value: '2',
  87. message: '',
  88. powerGrade: '',
  89. Content: '',
  90. Content2: '',
  91. reportTargetAll: {},
  92. reportContents: [{ dayContent: '' }],
  93. reportTarget: {},
  94. successContent: '',
  95. imgList: [],
  96. type: '-1',
  97. collectionItemLists: [],
  98. writeAgain: false,
  99. //
  100. };
  101. },
  102. created() {
  103. this.powerGrade = localStorage.getItem('powerGrade');
  104. this.getDetailById();
  105. },
  106. watch: {
  107. $route(to, from) {
  108. this.powerGrade = localStorage.getItem('powerGrade');
  109. if (to.path == '/dailyDetails') {
  110. this.getDetailById();
  111. }
  112. // &&from.path=="/dailyApprovalList"
  113. // if(to.path=="/dailyDetails"&&from.path=="/myHistoricalDaily"){
  114. // this.getDetailById()
  115. // }
  116. },
  117. },
  118. activated() {
  119. this.num = 0;
  120. this.userTodayPlanNum();
  121. },
  122. methods: {
  123. pviewFn(val, imgVal) {
  124. var imgList = [];
  125. var photos = this.reportTarget.photos[val].photos;
  126. for (let i = 0; i < photos.length; i++) {
  127. imgList.push(photos[i].fileUrl);
  128. }
  129. ImagePreview({ images: imgList, startPosition: imgVal });
  130. },
  131. submint() {
  132. this.$router.push({
  133. path: '/daily',
  134. query: { reportId: this.$route.query.reportId, temporaryShow: 'N' },
  135. });
  136. },
  137. getDetailById() {
  138. let loading1 = this.$toast.loading({
  139. duration: 0,
  140. message: '加载中...',
  141. forbidClick: true,
  142. });
  143. getSummaryMobilo({ userSummaryId: this.$route.query.userSummaryId }).then((res) => {
  144. loading1.clear();
  145. this.reportTargetAll = res.data.reportTargetAll;
  146. this.info = res.data;
  147. this.type = res.data.userType;
  148. if (res.data.status == 3) {
  149. this.successContent = res.data.successContent;
  150. } else {
  151. this.successContent = res.data.failContent;
  152. }
  153. if (res.data.reportContents && res.data.reportContents.length > 0) {
  154. this.Content = res.data.reportContents[0].dayContent;
  155. if (res.data.reportContents.length > 1) {
  156. this.Content2 = res.data.reportContents[1].dayContent;
  157. } else {
  158. this.Content2 = '';
  159. }
  160. } else {
  161. this.Content = '';
  162. this.Content2 = '';
  163. }
  164. this.reportContents = res.data.reportContents;
  165. var imgList = [];
  166. if (res.data.photos != null) {
  167. for (var k = 0; k < res.data.photos.length; k++) {
  168. imgList.push(res.data.photos[k].fileUrl + '');
  169. }
  170. }
  171. this.imgList = imgList;
  172. this.writeAgain = res.data.customItemList.some((item) => {
  173. return item.writeAgain === '1';
  174. });
  175. this.collectionItemLists = res.data.customItemList;
  176. });
  177. },
  178. userTodayPlanNum() {
  179. // userTodayPlanNum().then((res) => {
  180. // if (res.code == 200) {
  181. // this.todayGoal = res.data;
  182. // this.progressWidth = (this.todayGoal.finishNum / this.todayGoal.planNum) * 100 + '%';
  183. // localStorage.setItem('nickName', res.data.user.nickName);
  184. // localStorage.setItem('storeType', res.data.user.type);
  185. // } else {
  186. // this.$toast.fail(res.msg);
  187. // }
  188. // });
  189. },
  190. onClickLeft() {
  191. this.$router.go(-1);
  192. },
  193. onSubmit() {
  194. let collectionAnswerlisd = this.$refs.componVisitSummary.collectionAnswerlisd;
  195. let collectionItemList = this.$refs.componVisitSummary.collectionItemList;
  196. for (var c = 0; c < collectionAnswerlisd.length; c++) {
  197. for (var b = 0; b < collectionItemList.length; b++) {
  198. if (collectionAnswerlisd[c].id == collectionItemList[b].customId) {
  199. collectionItemList[b].customOptionList = collectionAnswerlisd[c].value;
  200. }
  201. }
  202. }
  203. // 获取所有可以补填的题
  204. let customItemList = collectionItemList.filter((item) => item.writeAgain == '1');
  205. console.log(customItemList);
  206. // // 照片
  207. // let zpDataList = customItemList.find((item) => item.answerType == 'zp');
  208. // if (zpDataList) {
  209. // let fileIdList = [];
  210. // zpDataList.fileInfoList.forEach((item) => {
  211. // fileIdList.push(item.id);
  212. // });
  213. // zpDataList.fileIdList = fileIdList;
  214. // }
  215. writeAgainCustomAnswer({
  216. userSummaryId: this.$route.query.userSummaryId,
  217. customItemList: customItemList,
  218. }).then((res) => {
  219. if (res.code == 200) {
  220. this.$toast('操作成功!');
  221. this.$router.replace({
  222. path: '/VisitSummary',
  223. });
  224. }
  225. });
  226. },
  227. },
  228. };
  229. </script>
  230. <style scoped>
  231. .container {
  232. background-color: white;
  233. }
  234. .van-f-red {
  235. color: red;
  236. width: 8px;
  237. display: inline-block;
  238. line-height: 26px;
  239. }
  240. .formLabel {
  241. margin: 0 16px;
  242. border-bottom: 1px solid #f1f1f1;
  243. }
  244. .formLabel .van-cell {
  245. padding: 10px 0;
  246. }
  247. .formLabel .van-cell::after {
  248. border: 0;
  249. }
  250. .formLabel .van-field {
  251. border: 1px solid #f1f1f1;
  252. padding: 6px;
  253. width: 100%;
  254. border-radius: 4px;
  255. overflow: hidden;
  256. }
  257. .formLabel .van-field__control {
  258. padding: 0 10px;
  259. }
  260. .formLabel .formLabeltitle {
  261. position: absolute;
  262. top: 8px;
  263. }
  264. .z-checkbox .van-radio {
  265. padding: 6px 0;
  266. }
  267. .z-celly .van-cell__title {
  268. font-weight: initial;
  269. font-size: 14px;
  270. }
  271. </style>
  272. <style>
  273. .table-headermd {
  274. font-size: 1.2rem;
  275. text-align: center;
  276. position: initial;
  277. width: 94% !important;
  278. margin: 0 auto;
  279. border-right: 0;
  280. }
  281. .table-headermd .el-table__header,
  282. .table-headermd .el-table__body {
  283. width: 100% !important;
  284. }
  285. .table-headermd col {
  286. width: 5.8rem;
  287. }
  288. .table-headermd col:nth-child(2),
  289. .table-headermd col:nth-child(4),
  290. .table-headermd col:nth-child(3) {
  291. width: 5rem;
  292. }
  293. .table-headermd .van-cell {
  294. padding: 0 4px;
  295. height: 100%;
  296. }
  297. .table-headermd th.el-table__cell > .cell {
  298. padding: 0 4px;
  299. }
  300. .table-headermd th.el-table__cell {
  301. background-color: #1989fa;
  302. color: #fff;
  303. }
  304. .table-headermd .el-table__cell {
  305. padding: 4px 0;
  306. }
  307. .table-headermd .tipTitle {
  308. overflow: hidden;
  309. text-overflow: ellipsis;
  310. display: -webkit-box;
  311. -webkit-box-orient: vertical;
  312. -webkit-line-clamp: 2;
  313. }
  314. .table-headermd::before {
  315. height: 0;
  316. }
  317. .f-right {
  318. text-align: right;
  319. margin: 0;
  320. }
  321. .mg0 {
  322. margin: 6px 10px;
  323. color: #909090;
  324. font-size: 14px;
  325. }
  326. .selesetText {
  327. margin-bottom: 16px;
  328. }
  329. .z-cells .van-cell__title {
  330. font-weight: bold;
  331. color: #4a4a4a;
  332. }
  333. .z-cells .van-cell {
  334. padding-bottom: 0;
  335. }
  336. </style>