dailyApproval.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546
  1. <template>
  2. <div class="dailyApproval">
  3. <!-- 顶部条-->
  4. <div class="navBarTOP">
  5. <van-nav-bar class="navBar" title="日报审批" left-arrow @click-left="onClickLeft" />
  6. </div>
  7. <div class="lineGrey"></div>
  8. <div class="lineGrey"></div>
  9. <div class="lineGrey"></div>
  10. <div class="lineGrey"></div>
  11. <div style="height: 4px"></div>
  12. <!-- 主体内容-->
  13. <div class="container linep" v-if="reportTargetAll">
  14. <template v-if="postName == '质感销售负责人' || postName == '质感销售专员'">
  15. <target :homePageIndicatorDate="homePageIndicatorList"></target>
  16. </template>
  17. <template v-else>
  18. <van-collapse v-model="activeNames" style="margin-top: -3px">
  19. <template v-if="!YFQuota">
  20. <!-- YFQuota:应用服务平台 不显示各项指标 -->
  21. <Atarget :reportInfo="reportTarget"></Atarget>
  22. <Btarget :reportInfo="reportTarget"></Btarget>
  23. </template>
  24. </van-collapse>
  25. </template>
  26. <div class="contentContainer">
  27. <!-- isHistory 是否为历史汇报:0-新汇报 1-历史汇报 -->
  28. <reportCustom
  29. ref="reportCustom"
  30. v-if="reportTarget.isHistory == '0'"
  31. :disabled="true"
  32. :reportCustomData="reportTarget.customTaskList"></reportCustom>
  33. <template v-else>
  34. <div v-if="GZQuota">
  35. <p class="contentContainerTitle">今日项目跟进数</p>
  36. <div style="padding: 10px 0">
  37. <van-field readonly v-model="projectFollowNum" type="digit" />
  38. </div>
  39. <p class="contentContainerTitle">今日TUC成功报备数量</p>
  40. <div style="padding: 10px 0">
  41. <van-field readonly v-model="tucReportingSuccessNum" type="digit" />
  42. </div>
  43. </div>
  44. <!-- 今日未拜访原因 如果不为空则展示,为空则不展示 -->
  45. <div v-if="reportTarget.notVisitReason && reportTarget.notVisitReason != ''">
  46. <p class="contentContainerTitle">截至日报提交时间,今日拜访0家店的原因</p>
  47. <div style="padding: 10px 0">
  48. <van-field
  49. readonly
  50. v-model="reportTarget.notVisitReason"
  51. rows="4"
  52. autosize
  53. type="textarea" />
  54. </div>
  55. </div>
  56. <p class="contentContainerTitle">今日机会与挑战总结</p>
  57. <div style="padding: 10px 0">
  58. <van-field v-model="Contents" rows="4" autosize readonly type="textarea" />
  59. </div>
  60. <p class="contentContainerTitle">明日工作规划</p>
  61. <div style="padding: 10px 0">
  62. <van-field v-model="Content2" rows="4" autosize readonly type="textarea" />
  63. </div>
  64. </template>
  65. </div>
  66. <div class="contentContainer">
  67. <p class="contentContainerTitle">打分 <span>请点亮小星星,一颗小星星代表1分</span></p>
  68. <div style="padding: 10px 0">
  69. <van-rate
  70. v-model="number"
  71. :size="25"
  72. color="#ffd21e"
  73. void-icon="star"
  74. void-color="#eee" /><span class="rateText">&nbsp;&nbsp;&nbsp;&nbsp;{{ number }}分</span>
  75. </div>
  76. </div>
  77. <div class="contentContainer">
  78. <p class="contentContainerTitle">评语</p>
  79. <div style="padding: 10px 0">
  80. <van-field
  81. v-model="Content"
  82. rows="4"
  83. autosize
  84. maxlength="800"
  85. show-word-limit
  86. :formatter="formatter"
  87. type="textarea" />
  88. </div>
  89. </div>
  90. <br />
  91. <br />
  92. <van-row>
  93. <van-col span="12">
  94. <van-button type="info" size="small" plain class="Btn" @click="submit"
  95. >确认审批</van-button
  96. >
  97. </van-col>
  98. <van-col span="12">
  99. <van-button type="info" size="small" plain class="BtnBorder" @click="reject"
  100. >退回重写</van-button
  101. >
  102. </van-col>
  103. </van-row>
  104. </div>
  105. <br />
  106. <br />
  107. </div>
  108. </template>
  109. <script>
  110. import history from '@/assets/Icon/history.png';
  111. import { ImagePreview } from 'vant';
  112. import {
  113. userTodayPlanNum,
  114. updateReport,
  115. getDetailById,
  116. getReportInfo,
  117. buryingPoint,
  118. } from '@/api/index';
  119. import visitedRealTime from '@/views/componentsTarget/visitedRealTime';
  120. import createStoreBJ from '@/views/componentsTarget/createStoreBJ';
  121. import placeOrder from '@/views/componentsTarget/placeOrder';
  122. import ZYPlaceOrder from '@/views/componentsTarget/ZYPlaceOrder';
  123. import performanceSAP from '@/views/componentsTarget/performanceSAP';
  124. import ZYSAP from '@/views/componentsTarget/ZYSAP';
  125. import veryGoodPlaceOrder from '@/views/componentsTarget/veryGoodPlaceOrder';
  126. import reportCustom from './reportCustom';
  127. import target from './target.vue';
  128. import Atarget from '@/views/home/Atarget.vue';
  129. import Btarget from '@/views/home/Btarget.vue';
  130. export default {
  131. name: 'daily',
  132. components: {
  133. visitedRealTime,
  134. createStoreBJ,
  135. placeOrder,
  136. ZYPlaceOrder,
  137. performanceSAP,
  138. ZYSAP,
  139. veryGoodPlaceOrder,
  140. reportCustom,
  141. target,
  142. Atarget,
  143. Btarget,
  144. },
  145. data() {
  146. return {
  147. show: true,
  148. num: 0,
  149. todayGoal: {},
  150. progressWidth: 0,
  151. downloadShow: false,
  152. history: history,
  153. imgArr: [],
  154. imgList: [],
  155. activeNames: [
  156. '1',
  157. '2',
  158. '3',
  159. '4',
  160. '5',
  161. '6',
  162. '7',
  163. '8',
  164. '10',
  165. '16',
  166. '17',
  167. '20',
  168. '21',
  169. '22',
  170. '23',
  171. '11',
  172. '29',
  173. '33',
  174. '40',
  175. '41',
  176. '42',
  177. '43',
  178. ],
  179. Content: '',
  180. Content2: '',
  181. number: 0,
  182. powerGrade: '',
  183. reportTargetAll: null,
  184. saptitle: '业绩目标SAP(千元)',
  185. failContent: '',
  186. successContent: '',
  187. reportContents: [{ dayContent: '' }],
  188. projectFollowNum: '',
  189. tucReportingSuccessNum: '',
  190. reportTarget: {},
  191. Contents: '',
  192. type: '-1',
  193. JZQuota: false,
  194. GZQuota: false,
  195. YFQuota: false,
  196. titlejz: '',
  197. visitIMG1Flag: false,
  198. postName: '',
  199. homePageIndicatorList: null,
  200. //
  201. };
  202. },
  203. created() {
  204. this.powerGrade = localStorage.getItem('powerGrade');
  205. this.getDetailById();
  206. },
  207. watch: {
  208. $route(to, from) {
  209. this.powerGrade = localStorage.getItem('powerGrade');
  210. if (to.path == '/dailyApproval') {
  211. this.getDetailById();
  212. this.number == 0;
  213. this.Content = '';
  214. }
  215. },
  216. },
  217. methods: {
  218. setVisitIMG1Flag(item) {
  219. this.$set(item, 'visitIMG1Flag', !item.visitIMG1Flag);
  220. this.$forceUpdate();
  221. },
  222. buryingPoint(val) {
  223. buryingPoint(val);
  224. },
  225. pviewFn(index) {
  226. var imgList = [];
  227. var photos = this.reportTarget.photoSummary;
  228. for (let i = 0; i < photos.length; i++) {
  229. imgList.push(photos[i].fileUrl);
  230. }
  231. ImagePreview({ images: imgList, startPosition: index });
  232. this.buryingPoint({
  233. systemModel: '日报审核',
  234. buryingPointType: 2,
  235. buryingPointValue: datai.taskName,
  236. buryingPointName: '拜访照片',
  237. buryingPointPosition: '日报照片',
  238. });
  239. },
  240. formatter(value) {
  241. return value.replace(
  242. /[\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,
  243. '',
  244. );
  245. },
  246. reject() {
  247. let loading1 = this.$toast.loading({
  248. duration: 0,
  249. message: '数据提交中...',
  250. forbidClick: true,
  251. });
  252. if (this.Content.trim() == '') {
  253. this.$toast('评语未填写');
  254. return false;
  255. }
  256. this.reportTarget.number = this.number;
  257. this.reportTarget.failContent = this.Content;
  258. this.reportTarget.failContent = this.reportTarget.failContent;
  259. this.reportTarget.status = 2;
  260. updateReport(this.reportTarget).then((res) => {
  261. loading1.clear();
  262. if (res.code == 200) {
  263. this.$dialog
  264. .alert({
  265. title: '系统提示',
  266. message: '提交成功',
  267. })
  268. .then(() => {
  269. window.location.replace(window.location.origin + '/mobile/dailyApprovalList');
  270. });
  271. } else {
  272. this.$toast.fail(res.msg);
  273. }
  274. });
  275. },
  276. submit() {
  277. let loading1 = this.$toast.loading({
  278. duration: 0,
  279. message: '数据提交中...',
  280. forbidClick: true,
  281. });
  282. if (this.number == '0') {
  283. this.$toast('评分未选择');
  284. return false;
  285. }
  286. if (this.Content.trim() == '') {
  287. this.$toast('评语未填写');
  288. return false;
  289. }
  290. if (this.Content.length > 800) {
  291. this.$toast('评语内容超过800字');
  292. return false;
  293. }
  294. this.reportTarget.number = this.number;
  295. this.reportTarget.successContent = this.Content;
  296. this.reportTarget.status = 3;
  297. this.reportTarget.successContent = this.reportTarget.successContent;
  298. updateReport(this.reportTarget).then((res) => {
  299. loading1.clear();
  300. if (res.code == 200) {
  301. this.$dialog
  302. .alert({
  303. title: '系统提示',
  304. message: '提交成功',
  305. })
  306. .then(() => {
  307. window.location.replace(window.location.origin + '/mobile/dailyApprovalList');
  308. });
  309. } else {
  310. this.$toast.fail(res.msg);
  311. }
  312. });
  313. },
  314. getDetailById() {
  315. let loading1 = this.$toast.loading({
  316. duration: 0,
  317. message: '加载中...',
  318. forbidClick: true,
  319. });
  320. getDetailById({ reportId: this.$route.query.reportId }).then((res) => {
  321. this.postName = res.data.postName;
  322. if (res.data.postName == '质感销售负责人' || res.data.postName == '质感销售专员') {
  323. this.homePageIndicatorList = res.data.homePageIndicatorList;
  324. } else {
  325. this.homePageIndicatorList = null;
  326. }
  327. this.GZQuota = false;
  328. this.JZQuota = false;
  329. this.YFQuota = res.data.postType == 'YF' ? true : false;
  330. if (res.data.postType == 'JZ') {
  331. this.JZQuota = true;
  332. } else if (res.data.postType == 'GZ') {
  333. this.GZQuota = true;
  334. this.saptitle = '公裝业绩SAP(千元)';
  335. } else {
  336. this.saptitle = '业绩目标SAP(千元)';
  337. }
  338. loading1.clear();
  339. if (res.code == 200) {
  340. if (res.data.status != '1') {
  341. this.$dialog
  342. .alert({
  343. title: '系统提示',
  344. message: '日报已审批',
  345. })
  346. .then(() => {
  347. window.location.replace(window.location.origin + '/mobile/home');
  348. });
  349. } else {
  350. this.reportTargetAll = res.data.reportTargetAll;
  351. this.reportTarget = res.data;
  352. this.reportContents = res.data.reportContents;
  353. this.type = res.data.userType;
  354. if (res.data.reportContents.length > 0) {
  355. this.Contents = res.data.reportContents[0].dayContent;
  356. if (res.data.reportContents.length > 1) {
  357. this.Content2 = res.data.reportContents[1].dayContent;
  358. } else {
  359. this.Content2 = '';
  360. }
  361. if (res.data.reportContents.length > 2) {
  362. this.projectFollowNum = res.data.reportContents[2].projectFollowNum;
  363. this.tucReportingSuccessNum = res.data.reportContents[3].tucReportingSuccessNum;
  364. }
  365. } else {
  366. this.Contents = '';
  367. this.Content2 = '';
  368. }
  369. }
  370. var imgList = [];
  371. if (res.data.photoSummary != null) {
  372. for (var k = 0; k < res.data.photoSummary.length; k++) {
  373. imgList.push(res.data.photoSummary[k].fileUrl + '');
  374. }
  375. }
  376. this.imgList = imgList;
  377. } else {
  378. this.$toast(res.msg);
  379. }
  380. });
  381. },
  382. userTodayPlanNum() {
  383. userTodayPlanNum().then((res) => {
  384. if (res.code == 200) {
  385. this.todayGoal = res.data;
  386. this.progressWidth = (this.todayGoal.finishNum / this.todayGoal.planNum) * 100 + '%';
  387. localStorage.setItem('nickName', res.data.user.nickName);
  388. localStorage.setItem('storeType', res.data.user.type);
  389. } else {
  390. this.$toast.fail(res.msg);
  391. }
  392. });
  393. },
  394. onClickLeft() {
  395. this.$router.go(-1);
  396. },
  397. },
  398. };
  399. </script>
  400. <style scoped lang="scss">
  401. .container {
  402. margin: 10px;
  403. }
  404. .container .van-collapse-item {
  405. margin-bottom: 10px;
  406. border-radius: 6px;
  407. overflow: hidden;
  408. }
  409. .linep p {
  410. margin: 10px 0 0 0;
  411. font-size: 14px;
  412. color: #666;
  413. }
  414. .linep .texttitle {
  415. color: #0057ba;
  416. position: relative;
  417. padding-left: 10px;
  418. }
  419. .linep .texttitle2 {
  420. padding-left: 0;
  421. }
  422. .linep .texttitle .opint {
  423. position: absolute;
  424. left: 0px;
  425. top: 6px;
  426. margin-right: 6px;
  427. display: inline-block;
  428. width: 6px;
  429. height: 6px;
  430. border-radius: 10px;
  431. background-color: #004d8c;
  432. }
  433. .leftTitle {
  434. background-color: #74a4d9;
  435. color: #fff;
  436. display: inline-block;
  437. padding: 0 4px;
  438. border-radius: 2px;
  439. }
  440. .rightTitle {
  441. background-color: #e7b4bb;
  442. color: #fff;
  443. display: inline-block;
  444. padding: 0 4px;
  445. border-radius: 2px;
  446. }
  447. </style>
  448. <style lang="scss">
  449. .linep .van-cell__title {
  450. color: #1e5398;
  451. font-weight: 500;
  452. }
  453. .Btn {
  454. margin: 0 auto 10px;
  455. display: block;
  456. width: 90%;
  457. border-radius: 5px;
  458. color: #fff !important;
  459. background-color: #0057ba;
  460. border: 1px solid #0057ba;
  461. height: 36px;
  462. }
  463. .BtnBorder {
  464. margin: 0 auto 10px;
  465. display: block;
  466. width: 90%;
  467. border-radius: 5px;
  468. border: 1px solid #0057ba;
  469. color: #0057ba;
  470. height: 36px;
  471. }
  472. .linep .contentContainer {
  473. background-color: white;
  474. border-radius: 8px;
  475. padding: 10px 16px;
  476. margin-bottom: 10px;
  477. }
  478. .linep .contentContainer .contentContainerTitle {
  479. color: #222;
  480. }
  481. .linep .contentContainer .contentContainerTitle span {
  482. font-size: 12px;
  483. color: #666;
  484. }
  485. .linep .contentContainer .van-field__control {
  486. background-color: #f8f8f8;
  487. padding: 10px;
  488. border-radius: 8px;
  489. }
  490. .linep .contentContainer .van-cell {
  491. padding: 0;
  492. }
  493. .colorbalck {
  494. color: #333;
  495. }
  496. .van-dialog__confirm,
  497. .van-dialog__confirm:active {
  498. color: #0057ba;
  499. }
  500. .visitIMG img {
  501. display: block;
  502. width: 100%;
  503. height: 148px;
  504. border-radius: 6px;
  505. }
  506. .visitIMG1 img {
  507. display: block;
  508. width: 100%;
  509. height: 75px;
  510. border-radius: 6px;
  511. }
  512. .table-headermd {
  513. font-size: 12px;
  514. text-align: center;
  515. position: initial;
  516. width: 98% !important;
  517. margin: 0 auto;
  518. border-right: 0;
  519. border-radius: 10px;
  520. .el-table__cell {
  521. padding: 6px 0 !important;
  522. }
  523. }
  524. .table-headermd th.el-table__cell {
  525. background-color: #1989fa;
  526. color: #fff;
  527. }
  528. </style>