doubleWeeklyApproval.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449
  1. <template>
  2. <div>
  3. <!-- 顶部条-->
  4. <div class="navBarTOP">
  5. <van-nav-bar class="navBar" title="半月报审批" left-arrow @click-left="onClickLeft" />
  6. </div>
  7. <!-- 主体内容-->
  8. <div class="container linep">
  9. <div class="lineGrey"></div>
  10. <div class="lineGrey"></div>
  11. <div class="lineGrey"></div>
  12. <div class="lineGrey"></div>
  13. <div class="lineGrey"></div>
  14. <van-collapse v-model="activeNames">
  15. <Atarget :reportInfo="reportTarget"></Atarget>
  16. <Btarget :reportInfo="reportTarget"></Btarget>
  17. <div class="contentContainer" v-if="reportTarget.isHistory == '0'">
  18. <!-- isHistory 是否为历史汇报:0-新汇报 1-历史汇报 -->
  19. <reportCustom
  20. ref="reportCustom"
  21. :disabled="true"
  22. :reportCustomData="reportTarget.customTaskList"></reportCustom>
  23. </div>
  24. <template v-else>
  25. <van-collapse-item title="上期工作成果" name="7">
  26. <div style="margin-top: -10px">
  27. <div v-for="(item, index) in reportContentsList2" :key="index">
  28. <!-- <p class="texttitle"><span class="opint"></span><span>{{selectDictLabel(weekType,item.doubleWeekType)}}</span></p>-->
  29. <p class="texttitle texttitle2">计划工作进度</p>
  30. <div style="padding: 10px 0; min-height: 32px" class="contentContainer">
  31. <van-field
  32. v-model="reportContentsList1[index].doubleWeekContent"
  33. rows="4"
  34. autosize
  35. readonly
  36. type="textarea" />
  37. </div>
  38. <p class="texttitle texttitle2">实际工作进度</p>
  39. <div style="padding: 10px 0; min-height: 32px" class="contentContainer">
  40. <van-field
  41. v-model="item.doubleWeekContent"
  42. rows="4"
  43. autosize
  44. readonly
  45. type="textarea" />
  46. </div>
  47. </div>
  48. </div>
  49. </van-collapse-item>
  50. <van-collapse-item title="本期工作规划" name="8">
  51. <div style="margin-top: -10px">
  52. <div v-for="(item2, index2) in reportContentsList3" :key="index2">
  53. <!-- <p class="texttitle"><span class="opint"></span><span>{{selectDictLabel(weekType,item2.doubleWeekType)}}</span></p>-->
  54. <div style="padding: 10px 0; min-height: 32px" class="contentContainer">
  55. <van-field
  56. v-model="item2.doubleWeekContent"
  57. rows="4"
  58. autosize
  59. readonly
  60. type="textarea" />
  61. </div>
  62. </div>
  63. </div>
  64. </van-collapse-item>
  65. </template>
  66. </van-collapse>
  67. <div class="contentContainer">
  68. <p class="contentContainerTitle">打分 <span>请点亮小星星,一颗小星星代表1分</span></p>
  69. <div style="padding: 10px 0">
  70. <van-rate
  71. v-model="number"
  72. :size="25"
  73. color="#ffd21e"
  74. void-icon="star"
  75. void-color="#eee" />
  76. <span class="rateText">&nbsp;&nbsp;&nbsp;&nbsp;{{ number }}分</span>
  77. </div>
  78. </div>
  79. <div class="contentContainer">
  80. <p class="contentContainerTitle">评语</p>
  81. <div style="padding: 10px 0">
  82. <van-field
  83. v-model="Content"
  84. rows="4"
  85. autosize
  86. type="textarea"
  87. maxlength="800"
  88. show-word-limit
  89. :formatter="formatter" />
  90. </div>
  91. </div>
  92. <br />
  93. <br />
  94. <van-row>
  95. <van-col span="12">
  96. <van-button type="info" size="small" plain class="Btn" @click="submit"
  97. >确认审批</van-button
  98. >
  99. </van-col>
  100. <van-col span="12">
  101. <van-button type="info" size="small" plain class="BtnBorder" @click="reject"
  102. >退回重写</van-button
  103. >
  104. </van-col>
  105. </van-row>
  106. </div>
  107. <br />
  108. <br />
  109. <br />
  110. <br />
  111. </div>
  112. </template>
  113. <script>
  114. import { double_week_type, updateReport, getDetailById, getReportInfo } from '@/api/index';
  115. import createStoreBJ from '@/views/componentsTarget/createStoreBJ';
  116. import ZYPlaceOrder from '@/views/componentsTarget/ZYPlaceOrder';
  117. import performanceSAP from '@/views/componentsTarget/performanceSAP';
  118. import ZYSAP from '@/views/componentsTarget/ZYSAP';
  119. import veryGoodPlaceOrder from '@/views/componentsTarget/veryGoodPlaceOrder';
  120. import neiwaiqiangpingtu from '@/views/componentsTarget/neiwaiqiangpingtu';
  121. import zhiganwaiqiangSAP from '@/views/componentsTarget/zhiganwaiqiangSAP';
  122. import Atarget from '@/views/home/Atarget.vue';
  123. import Btarget from '@/views/home/Btarget.vue';
  124. import reportCustom from './reportCustom.vue';
  125. export default {
  126. name: 'home',
  127. components: {
  128. createStoreBJ,
  129. ZYPlaceOrder,
  130. performanceSAP,
  131. ZYSAP,
  132. veryGoodPlaceOrder,
  133. neiwaiqiangpingtu,
  134. zhiganwaiqiangSAP,
  135. Atarget,
  136. Btarget,
  137. reportCustom,
  138. },
  139. data() {
  140. return {
  141. form: { rate: 0, message: '' },
  142. activeNames: [
  143. '1',
  144. '2',
  145. '3',
  146. '4',
  147. '5',
  148. '6',
  149. '7',
  150. '8',
  151. '11',
  152. '12',
  153. '16',
  154. '17',
  155. '27',
  156. '28',
  157. '29',
  158. ],
  159. powerGrade: '',
  160. value: '2',
  161. Content: '',
  162. number: 0,
  163. timeList: [],
  164. reportTargetAll: {},
  165. reportContentsList1: [],
  166. reportContentsList2: [],
  167. reportContentsList3: [],
  168. updateReport: {},
  169. weekType: [],
  170. type: '-1',
  171. JZQuota: false,
  172. reportTarget: {},
  173. };
  174. },
  175. created() {
  176. this.powerGrade = localStorage.getItem('powerGrade');
  177. this.getReportInfo();
  178. double_week_type().then((res) => {
  179. this.weekType = res.data;
  180. });
  181. },
  182. watch: {
  183. $route(to, from) {
  184. this.powerGrade = localStorage.getItem('powerGrade');
  185. if (to.path == '/doubleWeeklyApproval') {
  186. this.getDetailById();
  187. this.number == 0;
  188. this.Content = '';
  189. }
  190. },
  191. },
  192. methods: {
  193. formatter(value) {
  194. return value.replace(
  195. /[\uD83C|\uD83D|\uD83E][\uDC00-\uDFFF][\u200D|\uFE0F]|[\uD83C|\uD83D|\uD83E][\uDC00-\uDFFF]|[0-9|*|#]\uFE0F\u20E3|[0-9|#]\u20E3|[\u203C-\u3299]\uFE0F\u200D|[\u203C-\u3299]\uFE0F|[\u2122-\u2B55]|\u303D|[\A9|\AE]\u3030|\uA9|\uAE|\u3030/gi,
  196. '',
  197. );
  198. },
  199. reject() {
  200. let loading1 = this.$toast.loading({
  201. duration: 0,
  202. message: '数据提交中...',
  203. forbidClick: true,
  204. });
  205. if (this.Content.trim() == '') {
  206. this.$toast('评语未填写');
  207. return false;
  208. }
  209. if (this.Content.length > 800) {
  210. this.$toast('评语内容不能超过800字');
  211. return false;
  212. }
  213. this.reportTarget.number = this.number;
  214. this.reportTarget.failContent = this.Content;
  215. this.reportTarget.failContent = this.reportTarget.failContent;
  216. this.reportTarget.status = 2;
  217. updateReport(this.reportTarget).then((res) => {
  218. loading1.clear();
  219. if (res.code == 200) {
  220. this.$dialog
  221. .alert({
  222. title: '系统提示',
  223. message: '提交成功',
  224. })
  225. .then(() => {
  226. window.location.replace(window.location.origin + '/mobile/dailyApprovalList');
  227. });
  228. } else {
  229. this.$toast.fail(res.msg);
  230. }
  231. });
  232. },
  233. submit() {
  234. let loading1 = this.$toast.loading({
  235. duration: 0,
  236. message: '数据提交中...',
  237. forbidClick: true,
  238. });
  239. if (this.number == '0') {
  240. this.$toast('评分未选择');
  241. return false;
  242. }
  243. if (this.Content.trim() == '') {
  244. this.$toast('评语未填写');
  245. return false;
  246. }
  247. if (this.Content.length > 800) {
  248. this.$toast('评语内容超过800字');
  249. return false;
  250. }
  251. this.reportTarget.number = this.number;
  252. this.reportTarget.successContent = this.Content;
  253. this.reportTarget.successContent = this.reportTarget.successContent;
  254. this.reportTarget.status = 3;
  255. updateReport(this.reportTarget).then((res) => {
  256. loading1.clear();
  257. if (res.code == 200) {
  258. this.$dialog
  259. .alert({
  260. title: '系统提示',
  261. message: '提交成功',
  262. })
  263. .then(() => {
  264. window.location.replace(window.location.origin + '/mobile/dailyApprovalList');
  265. });
  266. } else {
  267. this.$toast.fail(res.msg);
  268. }
  269. });
  270. },
  271. getReportInfo() {
  272. let loading1 = this.$toast.loading({
  273. duration: 0,
  274. message: '加载中...',
  275. forbidClick: true,
  276. });
  277. getDetailById({ reportId: this.$route.query.reportId }).then((res) => {
  278. loading1.clear();
  279. if (res.code == 200) {
  280. if (res.data.status != '1') {
  281. this.$dialog
  282. .alert({
  283. title: '系统提示',
  284. message: '半月报已审批',
  285. })
  286. .then(() => {
  287. window.location.replace(window.location.origin + '/mobile/home');
  288. });
  289. } else {
  290. this.reportTargetAll = res.data.reportTargetAll;
  291. this.reportTarget = res.data;
  292. this.type = res.data.userType;
  293. this.reportContents = res.data.reportContents;
  294. var reportContentsList1 = [];
  295. var reportContentsList2 = [];
  296. var reportContentsList3 = [];
  297. var reportContentsdata = res.data.reportContents;
  298. for (var i = 0; i < res.data.reportContents.length; i++) {
  299. if (res.data.reportContents[i].type == '1') {
  300. reportContentsList1.push(reportContentsdata[i]);
  301. }
  302. if (res.data.reportContents[i].type == '2') {
  303. reportContentsList2.push(reportContentsdata[i]);
  304. }
  305. if (res.data.reportContents[i].type == '3') {
  306. reportContentsList3.push(reportContentsdata[i]);
  307. }
  308. }
  309. var ln1 = reportContentsList1.length;
  310. var ln2 = reportContentsList2.length;
  311. if (reportContentsList2.length > reportContentsList1.length) {
  312. var len = ln2 - ln1;
  313. for (var x = 0; x < len; x++) {
  314. reportContentsList1.push({
  315. doubleWeekContent: '',
  316. });
  317. }
  318. }
  319. this.reportContentsList1 = reportContentsList1;
  320. this.reportContentsList2 = reportContentsList2;
  321. this.reportContentsList3 = reportContentsList3;
  322. }
  323. } else {
  324. this.$toast(res.msg);
  325. }
  326. });
  327. },
  328. onClickLeft() {
  329. this.$router.go(-1);
  330. },
  331. },
  332. };
  333. </script>
  334. <style scoped>
  335. .container {
  336. margin: 10px;
  337. }
  338. .container .van-collapse-item {
  339. margin-bottom: 16px;
  340. }
  341. .linep p {
  342. margin: 6px 0 0 0;
  343. font-size: 14px;
  344. color: #666;
  345. padding-left: 6px;
  346. }
  347. .linep .texttitle {
  348. color: #0057ba;
  349. position: relative;
  350. padding-left: 10px;
  351. }
  352. .linep .texttitle2 {
  353. padding-left: 10px;
  354. }
  355. .linep .texttitle .opint {
  356. position: absolute;
  357. left: 0px;
  358. top: 6px;
  359. margin-right: 6px;
  360. display: inline-block;
  361. width: 6px;
  362. height: 6px;
  363. border-radius: 10px;
  364. background-color: #004d8c;
  365. }
  366. .leftTitle {
  367. background-color: #74a4d9;
  368. color: #fff;
  369. display: inline-block;
  370. padding: 0 4px;
  371. border-radius: 2px;
  372. }
  373. .rightTitle {
  374. background-color: #e7b4bb;
  375. color: #fff;
  376. display: inline-block;
  377. padding: 0 4px;
  378. border-radius: 2px;
  379. }
  380. </style>
  381. <style>
  382. .linep .van-cell__title {
  383. color: #1e5398;
  384. font-weight: 500;
  385. }
  386. .Btn {
  387. margin: 0 auto 10px;
  388. display: block;
  389. width: 90%;
  390. border-radius: 5px;
  391. color: #fff !important;
  392. background-color: #0057ba;
  393. border: 1px solid #0057ba;
  394. height: 36px;
  395. }
  396. .BtnBorder {
  397. margin: 0 auto 10px;
  398. display: block;
  399. width: 90%;
  400. border-radius: 5px;
  401. border: 1px solid #0057ba;
  402. color: #0057ba;
  403. height: 36px;
  404. }
  405. .linep .contentContainer {
  406. background-color: white;
  407. border-radius: 8px;
  408. padding: 10px 16px;
  409. margin-bottom: 10px;
  410. }
  411. .linep .contentContainer .contentContainerTitle {
  412. color: #222;
  413. }
  414. .linep .contentContainer .contentContainerTitle span {
  415. font-size: 12px;
  416. color: #666;
  417. }
  418. .linep .contentContainer .van-field__control,
  419. .linep .contentContainerp .van-field__control {
  420. background-color: #f8f8f8;
  421. padding: 10px;
  422. border-radius: 8px;
  423. }
  424. .linep .contentContainer .van-cell,
  425. .linep .contentContainerp .van-cell {
  426. padding: 0;
  427. }
  428. .van-dialog__confirm,
  429. .van-dialog__confirm:active {
  430. color: #0057ba;
  431. }
  432. </style>