weeklyApproval.vue 19 KB

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