weeklyApproval.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579
  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 style="height: 4px"></div>
  14. <van-collapse v-model="activeNames">
  15. <template v-if="!YFQuota">
  16. <!-- YFQuota:应用服务平台 不显示各项指标 -->
  17. <template v-if="reportTarget.postType == 'GZ' || reportTarget.BMDType == 'BMD'">
  18. <!-- 0-历史指标 1-动态指标,String类型 -->
  19. <template v-if="reportTarget.targetType == '1'">
  20. <target :homePageIndicatorDate="homePageIndicatorList"></target>
  21. </template>
  22. <template v-if="reportTarget.targetType == '0'">
  23. <Atarget :reportInfo="reportTarget"></Atarget>
  24. <Btarget :reportInfo="reportTarget"></Btarget>
  25. </template>
  26. </template>
  27. <template v-else>
  28. <Atarget :reportInfo="reportTarget"></Atarget>
  29. <Btarget :reportInfo="reportTarget"></Btarget>
  30. </template>
  31. </template>
  32. <div class="contentContainer" v-if="reportTarget.isHistory == '0'">
  33. <!-- isHistory 是否为历史汇报:0-新汇报 1-历史汇报 -->
  34. <reportCustom
  35. ref="reportCustom"
  36. :disabled="true"
  37. :reportCustomData="reportTarget.customTaskList"></reportCustom>
  38. </div>
  39. <template v-else>
  40. <van-collapse-item title="上周工作成果" name="8">
  41. <div style="margin-top: -10px">
  42. <div v-for="(item2, index2) in reportContentsList2" :key="index2">
  43. <div v-if="index2 < 7">
  44. <p class="texttitle">
  45. <span class="opint"></span
  46. ><span v-if="!reportTarget.hideWeekDate">{{
  47. weeklyTimeDivision(item2.contentTime, 0)
  48. }}</span
  49. ><span>{{ weeklyTimeDivision(item2.contentTime, 1) }}</span>
  50. </p>
  51. <p>
  52. <span class="colorbalck">上午:</span
  53. >{{ reportContentsList1[index2].weekContentAm }}
  54. </p>
  55. <p>
  56. <span class="colorbalck">下午:</span
  57. >{{ reportContentsList1[index2].weekContentPm }}
  58. </p>
  59. <p class="texttitle texttitle2">实际工作进度</p>
  60. <p><span class="colorbalck">上午:</span>{{ item2.weekContentAm }}</p>
  61. <p><span class="colorbalck">下午:</span>{{ item2.weekContentPm }}</p>
  62. </div>
  63. <p v-if="index2 == 7" class="texttitle"><span class="opint"></span>上周工作重点</p>
  64. <div v-if="index2 == 7" style="padding: 10px 0" class="contentContainer">
  65. <van-field
  66. v-model="reportContentsList1[index2].weekContentSummary"
  67. rows="4"
  68. autosize
  69. readonly
  70. type="textarea" />
  71. </div>
  72. <p v-if="index2 == 7" class="texttitle"><span class="opint"></span>上周工作成果</p>
  73. <div v-if="index2 == 7" style="padding: 10px 0" class="contentContainer">
  74. <van-field
  75. v-model="item2.weekContentSummary"
  76. rows="4"
  77. autosize
  78. readonly
  79. type="textarea" />
  80. </div>
  81. </div>
  82. </div>
  83. </van-collapse-item>
  84. <van-collapse-item title="本周工作规划" name="9">
  85. <div style="margin-top: -10px">
  86. <div v-for="(item, index) in reportContentsList3" :key="index">
  87. <p v-if="index < 7" class="texttitle">
  88. <span class="opint"></span
  89. ><span v-if="!reportTarget.hideWeekDate">{{
  90. weeklyTimeDivision(item.contentTime, 0)
  91. }}</span
  92. ><span>{{ weeklyTimeDivision(item.contentTime, 1) }}</span>
  93. </p>
  94. <p v-if="index < 7">
  95. <span class="colorbalck">上午:</span>{{ item.weekContentAm }}
  96. </p>
  97. <p v-if="index < 7">
  98. <span class="colorbalck">下午:</span>{{ item.weekContentPm }}
  99. </p>
  100. <p v-if="index == 7" class="texttitle"><span class="opint"></span>本周工作重点</p>
  101. <div v-if="index == 7" style="padding: 10px 0" class="contentContainer">
  102. <van-field
  103. v-model="item.weekContentSummary"
  104. rows="4"
  105. autosize
  106. readonly
  107. type="textarea" />
  108. </div>
  109. </div>
  110. </div>
  111. </van-collapse-item>
  112. </template>
  113. </van-collapse>
  114. <div class="contentContainer">
  115. <p class="contentContainerTitle">打分 <span>请点亮小星星,一颗小星星代表1分</span></p>
  116. <div style="padding: 10px 0">
  117. <van-rate
  118. v-model="number"
  119. :size="25"
  120. color="#ffd21e"
  121. void-icon="star"
  122. void-color="#eee" />
  123. <span class="rateText">&nbsp;&nbsp;&nbsp;&nbsp;{{ number }}分</span>
  124. </div>
  125. </div>
  126. <div class="contentContainer">
  127. <p class="contentContainerTitle">评语</p>
  128. <div style="padding: 10px 0">
  129. <van-field
  130. v-model="Content"
  131. rows="4"
  132. autosize
  133. :formatter="formatter"
  134. maxlength="800"
  135. show-word-limit
  136. type="textarea" />
  137. </div>
  138. </div>
  139. <br />
  140. <br />
  141. <van-row>
  142. <van-col span="12">
  143. <van-button type="info" size="small" plain class="Btn" @click="submit"
  144. >确认审批</van-button
  145. >
  146. </van-col>
  147. <van-col span="12">
  148. <van-button type="info" size="small" plain class="BtnBorder" @click="reject"
  149. >退回重写</van-button
  150. >
  151. </van-col>
  152. </van-row>
  153. </div>
  154. <br />
  155. <br />
  156. </div>
  157. </template>
  158. <script>
  159. import { updateReport, getDetailById } from '@/api/index';
  160. import createStoreBJ from '@/views/componentsTarget/createStoreBJ';
  161. import ZYPlaceOrder from '@/views/componentsTarget/ZYPlaceOrder';
  162. import performanceSAP from '@/views/componentsTarget/performanceSAP';
  163. import ZYSAP from '@/views/componentsTarget/ZYSAP';
  164. import veryGoodPlaceOrder from '@/views/componentsTarget/veryGoodPlaceOrder';
  165. import neiwaiqiangpingtu from '@/views/componentsTarget/neiwaiqiangpingtu';
  166. import zhiganwaiqiangSAP from '@/views/componentsTarget/zhiganwaiqiangSAP';
  167. import cizhuanjiaoSAP from '@/views/componentsTarget/cizhuanjiaoSAP';
  168. import neiqiangzhonggaoduanSAP from '@/views/componentsTarget/neiqiangzhonggaoduanSAP';
  169. import moshouqiSAP from '@/views/componentsTarget/moshouqiSAP';
  170. import fangshuiSAP from '@/views/componentsTarget/fangshuiSAP';
  171. import Atarget from '@/views/home/Atarget.vue';
  172. import Btarget from '@/views/home/Btarget.vue';
  173. import reportCustom from './reportCustom.vue';
  174. import target from './target.vue';
  175. export default {
  176. name: 'weeklyApproval',
  177. components: {
  178. createStoreBJ,
  179. ZYPlaceOrder,
  180. performanceSAP,
  181. ZYSAP,
  182. veryGoodPlaceOrder,
  183. neiwaiqiangpingtu,
  184. zhiganwaiqiangSAP,
  185. cizhuanjiaoSAP,
  186. neiqiangzhonggaoduanSAP,
  187. moshouqiSAP,
  188. fangshuiSAP,
  189. Atarget,
  190. Btarget,
  191. reportCustom,
  192. target,
  193. },
  194. data() {
  195. return {
  196. show: true,
  197. num: 0,
  198. form: { rate: 0, message: '' },
  199. list: [],
  200. todayGoal: {},
  201. progressWidth: 0,
  202. activeNames: [
  203. '1',
  204. '2',
  205. '3',
  206. '4',
  207. '5',
  208. '6',
  209. '7',
  210. '8',
  211. '9',
  212. '11',
  213. '12',
  214. '16',
  215. '17',
  216. '27',
  217. '28',
  218. '29',
  219. ],
  220. powerGrade: '',
  221. value: '2',
  222. Content: '',
  223. number: 0,
  224. timeList: [],
  225. reportTargetAll: {},
  226. reportContentsList1: [],
  227. reportContentsList2: [],
  228. reportContentsList3: [],
  229. updateReport: {},
  230. reportTarget: {},
  231. type: '-1',
  232. JZQuota: false,
  233. YFQuota: false, //应用服务
  234. GZdata: false,
  235. homePageIndicatorList: null,
  236. };
  237. },
  238. created() {
  239. this.powerGrade = localStorage.getItem('powerGrade');
  240. // this.type=localStorage.getItem("storeType")
  241. this.getDetailById();
  242. },
  243. watch: {
  244. $route(to, from) {
  245. this.powerGrade = localStorage.getItem('powerGrade');
  246. // this.type=localStorage.getItem("storeType")
  247. this.timeList = this.parseTimeParagraph();
  248. if (to.path == '/weeklyApproval') {
  249. this.getDetailById();
  250. this.number == 0;
  251. this.Content = '';
  252. }
  253. },
  254. },
  255. methods: {
  256. formatter(value) {
  257. return value.replace(
  258. /[\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,
  259. '',
  260. );
  261. },
  262. reject() {
  263. let loading1 = this.$toast.loading({
  264. duration: 0,
  265. message: '数据提交中...',
  266. forbidClick: true,
  267. });
  268. if (this.Content.trim() == '') {
  269. this.$toast('评语未填写');
  270. return false;
  271. }
  272. if (this.Content.length > 800) {
  273. this.$toast('评语内容超过800字');
  274. return false;
  275. }
  276. this.reportTarget.number = this.number;
  277. this.reportTarget.failContent = this.Content;
  278. this.reportTarget.failContent = this.reportTarget.failContent;
  279. this.reportTarget.status = 2;
  280. updateReport(this.reportTarget).then((res) => {
  281. loading1.clear();
  282. if (res.code == 200) {
  283. this.$dialog
  284. .alert({
  285. title: '系统提示',
  286. message: '提交成功',
  287. })
  288. .then(() => {
  289. window.location.replace(window.location.origin + '/mobile/dailyApprovalList');
  290. });
  291. } else {
  292. this.$toast.fail(res.msg);
  293. }
  294. });
  295. },
  296. submit() {
  297. let loading1 = this.$toast.loading({
  298. duration: 0,
  299. message: '数据提交中...',
  300. forbidClick: true,
  301. });
  302. if (this.number == 0) {
  303. this.$toast('评分未选择');
  304. return false;
  305. }
  306. if (this.Content.trim() == '') {
  307. this.$toast('评语未填写');
  308. return false;
  309. }
  310. if (this.Content.length > 800) {
  311. this.$toast('评语未填写');
  312. return false;
  313. }
  314. this.reportTarget.number = this.number;
  315. this.reportTarget.successContent = this.Content;
  316. this.reportTarget.successContent = this.reportTarget.successContent;
  317. this.reportTarget.status = 3;
  318. updateReport(this.reportTarget).then((res) => {
  319. loading1.clear();
  320. if (res.code == 200) {
  321. this.$dialog
  322. .alert({
  323. title: '系统提示',
  324. message: '保存成功',
  325. })
  326. .then(() => {
  327. window.location.replace(window.location.origin + '/mobile/dailyApprovalList');
  328. });
  329. } else {
  330. this.$toast.fail(res.msg);
  331. }
  332. });
  333. },
  334. getDetailById() {
  335. let loading1 = this.$toast.loading({
  336. duration: 0,
  337. message: '加载中...',
  338. forbidClick: true,
  339. });
  340. getDetailById({ reportId: this.$route.query.reportId }).then((res) => {
  341. loading1.clear();
  342. if (res.code == 200) {
  343. this.YFQuota = res.data.postType == 'YF' ? true : false;
  344. this.JZQuota = false;
  345. if (res.data.postType == 'JZ') {
  346. this.JZQuota = true;
  347. }
  348. if (res.data.postType == 'GZ') {
  349. this.GZdata = true;
  350. } else {
  351. this.GZdata = false;
  352. }
  353. this.homePageIndicatorList = res.data.homePageIndicatorList;
  354. var dayTime = res.data.date;
  355. this.type = res.data.userType;
  356. this.timeList = this.parseTimeParagraph(
  357. dayTime.slice(0, 4) + '-' + dayTime.slice(4, 6) + '-' + dayTime.slice(6, 8),
  358. );
  359. if (res.data.status != '1') {
  360. this.$dialog
  361. .alert({
  362. title: '系统提示',
  363. message: '周报已提交或过期',
  364. })
  365. .then(() => {
  366. window.location.replace(window.location.origin + '/mobile/home');
  367. });
  368. } else {
  369. this.reportTargetAll = res.data.reportTargetAll;
  370. this.reportTarget = res.data;
  371. this.reportContents = res.data.reportContents;
  372. var reportContentsList1 = [];
  373. var reportContentsList2 = [];
  374. var reportContentsList3 = [];
  375. var reportContentsdata = res.data.reportContents;
  376. for (var i = 0; i < reportContentsdata.length; i++) {
  377. if (
  378. reportContentsdata[i].type == '1' &&
  379. reportContentsdata[i].contentTime.split(' ')[1] != undefined
  380. ) {
  381. reportContentsList1.push(reportContentsdata[i]);
  382. }
  383. if (
  384. reportContentsdata[i].type == '2' &&
  385. reportContentsdata[i].contentTime.split(' ')[1] != undefined
  386. ) {
  387. reportContentsList2.push(reportContentsdata[i]);
  388. }
  389. if (
  390. reportContentsdata[i].type == '3' &&
  391. reportContentsdata[i].contentTime.split(' ')[1] != undefined
  392. ) {
  393. reportContentsList3.push(reportContentsdata[i]);
  394. }
  395. }
  396. for (var p = 0; p < reportContentsdata.length; p++) {
  397. if (
  398. reportContentsdata[p].type == '2' &&
  399. reportContentsdata[p].contentTime.split(' ')[1] == undefined
  400. ) {
  401. reportContentsList2.push(reportContentsdata[p]);
  402. }
  403. if (
  404. reportContentsdata[p].type == '1' &&
  405. reportContentsdata[p].contentTime.split(' ')[1] == undefined
  406. ) {
  407. reportContentsList1.push(reportContentsdata[p]);
  408. }
  409. if (
  410. reportContentsdata[p].type == '3' &&
  411. reportContentsdata[p].contentTime.split(' ')[1] == undefined
  412. ) {
  413. reportContentsList3.push(reportContentsdata[p]);
  414. }
  415. }
  416. var ln1 = reportContentsList1.length;
  417. var ln2 = reportContentsList2.length;
  418. if (reportContentsList1.length > reportContentsList2.length) {
  419. var len = ln1 - ln2;
  420. for (var x = 0; x < len; x++) {
  421. reportContentsList2.push({
  422. contentTime: this.timeList[5 + x],
  423. weekContentAm: '',
  424. weekContentPm: '',
  425. weekContentSummary: null,
  426. });
  427. }
  428. }
  429. if (reportContentsList1.length < reportContentsList2.length) {
  430. var len2 = ln2 - ln1;
  431. for (var x = 0; x < len2; x++) {
  432. reportContentsList1.push({
  433. contentTime: '',
  434. weekContentAm: '',
  435. weekContentPm: '',
  436. weekContentSummary: null,
  437. });
  438. }
  439. }
  440. this.reportContentsList1 = reportContentsList1;
  441. this.reportContentsList2 = reportContentsList2;
  442. this.reportContentsList3 = reportContentsList3;
  443. }
  444. } else {
  445. this.$toast(res.msg);
  446. }
  447. });
  448. },
  449. backFn() {
  450. this.$dialog
  451. .confirm({
  452. title: '提示',
  453. message: '是否确认退回重写?',
  454. })
  455. .then(() => {
  456. // on confirm
  457. });
  458. },
  459. approvalFn() {
  460. if (this.form.message.trim() == '') {
  461. this.$toast('评语未填写');
  462. return;
  463. }
  464. this.$router.go(-1);
  465. },
  466. onClickLeft() {
  467. this.$router.go(-1);
  468. },
  469. },
  470. };
  471. </script>
  472. <style scoped>
  473. .container {
  474. margin: 10px;
  475. }
  476. .container .van-collapse-item {
  477. margin-bottom: 10px;
  478. border-radius: 6px;
  479. overflow: hidden;
  480. }
  481. .linep p {
  482. margin: 14px 0 0 0;
  483. font-size: 14px;
  484. color: #666;
  485. padding-left: 6px;
  486. }
  487. .linep .texttitle {
  488. color: #0057ba;
  489. position: relative;
  490. padding-left: 10px;
  491. margin-top: 16px;
  492. }
  493. .linep .texttitle2 {
  494. padding-left: 6px;
  495. }
  496. .linep .texttitle .opint {
  497. position: absolute;
  498. left: 0px;
  499. top: 6px;
  500. margin-right: 6px;
  501. display: inline-block;
  502. width: 6px;
  503. height: 6px;
  504. border-radius: 10px;
  505. background-color: #0057ba;
  506. }
  507. .leftTitle {
  508. background-color: #a6c9f1;
  509. color: #fff;
  510. display: inline-block;
  511. padding: 0 4px;
  512. border-radius: 2px;
  513. }
  514. .rightTitle {
  515. background-color: #ffb5bb;
  516. color: #fff;
  517. display: inline-block;
  518. padding: 0 4px;
  519. border-radius: 2px;
  520. }
  521. </style>
  522. <style>
  523. .van-dialog__confirm,
  524. .van-dialog__confirm:active {
  525. color: #0057ba;
  526. }
  527. .van-button--info {
  528. border: 1px solid #0057ba;
  529. border-radius: 5px;
  530. }
  531. .linep .van-cell__title {
  532. color: #1e5398;
  533. font-weight: 500;
  534. }
  535. .Btn {
  536. margin: 0 auto 10px;
  537. display: block;
  538. width: 90%;
  539. border-radius: 5px;
  540. color: #fff !important;
  541. background-color: #0057ba;
  542. border: 1px solid #0057ba;
  543. height: 36px;
  544. }
  545. .BtnBorder {
  546. margin: 0 auto 10px;
  547. display: block;
  548. width: 90%;
  549. border-radius: 5px;
  550. border: 1px solid #0057ba;
  551. color: #0057ba;
  552. height: 36px;
  553. }
  554. .linep .contentContainer {
  555. background-color: white;
  556. border-radius: 8px;
  557. padding: 10px 16px;
  558. margin-bottom: 10px;
  559. }
  560. .linep .contentContainer .contentContainerTitle {
  561. color: #222;
  562. margin-top: 10px;
  563. }
  564. .linep .contentContainer .contentContainerTitle span {
  565. font-size: 12px;
  566. color: #333;
  567. }
  568. .linep .contentContainer .van-field__control {
  569. background-color: #ebf4ff;
  570. padding: 10px;
  571. border-radius: 8px;
  572. }
  573. .linep .contentContainer .van-cell {
  574. padding: 0;
  575. }
  576. </style>