weeklyApproval.vue 20 KB

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