doubleWeekly.vue 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976
  1. <template>
  2. <div>
  3. <!-- 顶部条-->
  4. <div class="navBarTOP">
  5. <van-nav-bar class="navBar" title="填写半月报" left-arrow @click-left="onClickLeft">
  6. <template #right>
  7. <span
  8. v-if="temporaryShow != 'N'"
  9. @click="tsContentsFn"
  10. style="
  11. color: white;
  12. background: #74a4d9;
  13. display: block;
  14. padding: 6px 10px;
  15. border-radius: 6px;
  16. "
  17. >暂存</span
  18. >
  19. </template>
  20. </van-nav-bar>
  21. </div>
  22. <!-- 主体内容-->
  23. <div class="container linepAdd">
  24. <div class="lineGrey"></div>
  25. <div class="lineGrey"></div>
  26. <div class="lineGrey"></div>
  27. <div class="lineGrey"></div>
  28. <div class="lineGrey"></div>
  29. <van-collapse v-model="activeNames">
  30. <van-collapse-item title="建店布机" name="2">
  31. <createStoreBJ :reportTargetAll="reportTargetAll"></createStoreBJ>
  32. </van-collapse-item>
  33. <van-collapse-item name="16" title="专业时时丽分销店下单">
  34. <ZYPlaceOrder :reportTargetAll="reportTargetAll"></ZYPlaceOrder>
  35. </van-collapse-item>
  36. <van-collapse-item title="业绩目标SAP(千元)" name="1" v-if="type != 3 && type != 4">
  37. <performanceSAP :reportTargetAll="reportTargetAll" :JZQuota="JZQuota"></performanceSAP>
  38. </van-collapse-item>
  39. <van-collapse-item name="27" title="内墙中高端SAP(千元)">
  40. <van-row>
  41. <van-col span="12"><span class="leftTitle">本月业绩</span></van-col>
  42. <van-col span="12"><span class="rightTitle">本季业绩</span></van-col>
  43. <van-col span="12"
  44. ><p>
  45. 实际:<span class="colorbalck">{{
  46. Micrometer(reportTargetAll.rjqSapMonthAct)
  47. }}</span>
  48. </p></van-col
  49. >
  50. <van-col span="12"
  51. ><p>
  52. 实际:<span class="colorbalck">{{
  53. Micrometer(reportTargetAll.rjqSapQuarterAct)
  54. }}</span>
  55. </p></van-col
  56. >
  57. <van-col span="12"
  58. ><p>
  59. 达成率:<span class="colorbalck">{{ reportTargetAll.rjqSapMonthSuccessRate }}%</span>
  60. </p></van-col
  61. >
  62. <van-col span="12"
  63. ><p>
  64. 达成率:<span class="colorbalck"
  65. >{{ reportTargetAll.rjqSapQuarterSuccessRate }}%</span
  66. >
  67. </p></van-col
  68. >
  69. <van-col span="12"
  70. ><p>
  71. 成长率:<span class="colorbalck">{{ reportTargetAll.rjqSapMonthGrowRate }}%</span>
  72. </p></van-col
  73. >
  74. <van-col span="12"
  75. ><p>
  76. 成长率:<span class="colorbalck">{{ reportTargetAll.rjqSapQuarterGrowRate }}%</span>
  77. </p></van-col
  78. >
  79. </van-row>
  80. </van-collapse-item>
  81. <!-- 内外墙平涂SAP -->
  82. <van-collapse-item name="2" title="内外墙平涂SAP(千元)">
  83. <neiwaiqiangpingtu :reportTargetAll="reportTargetAll"></neiwaiqiangpingtu>
  84. </van-collapse-item>
  85. <van-collapse-item name="11" title="专业时时丽SAP(千元)">
  86. <ZYSAP :reportTargetAll="reportTargetAll"></ZYSAP>
  87. </van-collapse-item>
  88. <van-collapse-item name="28" title="防水+背胶SAP(千元)">
  89. <van-row>
  90. <van-col span="12"><span class="leftTitle">本月业绩</span></van-col
  91. ><van-col span="12"><span class="rightTitle">本季业绩</span></van-col>
  92. <van-col span="12"
  93. ><p>
  94. 实际:<span class="colorbalck">{{
  95. Micrometer(reportTargetAll.fsbjSapMonthAct)
  96. }}</span>
  97. </p></van-col
  98. >
  99. <van-col span="12"
  100. ><p>
  101. 实际:<span class="colorbalck">{{
  102. Micrometer(reportTargetAll.fsbjSapQuarterAct)
  103. }}</span>
  104. </p></van-col
  105. >
  106. <van-col span="12"
  107. ><p>
  108. 达成率:<span class="colorbalck"
  109. >{{ reportTargetAll.fsbjSapMonthSuccessRate }}%</span
  110. >
  111. </p></van-col
  112. >
  113. <van-col span="12"
  114. ><p>
  115. 达成率:<span class="colorbalck"
  116. >{{ reportTargetAll.fsbjSapQuarterSuccessRate }}%</span
  117. >
  118. </p></van-col
  119. >
  120. <van-col span="12"
  121. ><p>
  122. 成长率:<span class="colorbalck">{{ reportTargetAll.fsbjSapMonthGrowRate }}%</span>
  123. </p></van-col
  124. >
  125. <van-col span="12"
  126. ><p>
  127. 成长率:<span class="colorbalck">{{ reportTargetAll.fsbjSapQuarterGrowRate }}%</span>
  128. </p></van-col
  129. >
  130. </van-row>
  131. </van-collapse-item>
  132. <van-collapse-item name="29" title="瓷砖胶SAP(千元)">
  133. <van-row>
  134. <van-col span="12"><span class="leftTitle">本月业绩</span></van-col
  135. ><van-col span="12"><span class="rightTitle">本季业绩</span></van-col>
  136. <van-col span="12"
  137. ><p>
  138. 实际:<span class="colorbalck">{{
  139. Micrometer(reportTargetAll.czjSapMonthAct)
  140. }}</span>
  141. </p></van-col
  142. >
  143. <van-col span="12"
  144. ><p>
  145. 实际:<span class="colorbalck">{{
  146. Micrometer(reportTargetAll.czjSapQuarterAct)
  147. }}</span>
  148. </p></van-col
  149. >
  150. <van-col span="12"
  151. ><p>
  152. 达成率:<span class="colorbalck">{{ reportTargetAll.czjSapMonthSuccessRate }}%</span>
  153. </p></van-col
  154. >
  155. <van-col span="12"
  156. ><p>
  157. 达成率:<span class="colorbalck"
  158. >{{ reportTargetAll.czjSapQuarterSuccessRate }}%</span
  159. >
  160. </p></van-col
  161. >
  162. <van-col span="12"
  163. ><p>
  164. 成长率:<span class="colorbalck">{{ reportTargetAll.czjSapMonthGrowRate }}%</span>
  165. </p></van-col
  166. >
  167. <van-col span="12"
  168. ><p>
  169. 成长率:<span class="colorbalck">{{ reportTargetAll.czjSapQuarterGrowRate }}%</span>
  170. </p></van-col
  171. >
  172. </van-row>
  173. </van-collapse-item>
  174. <van-collapse-item title="魔术漆SAP(千元)" name="3">
  175. <van-row>
  176. <van-col span="12"><span class="leftTitle">本月业绩</span></van-col>
  177. <van-col span="12"><span class="rightTitle">本季业绩</span></van-col>
  178. <van-col span="12"
  179. ><p>
  180. 实际:<span class="colorbalck">{{ Micrometer(reportTargetAll.ysqMonthAct) }}</span>
  181. </p></van-col
  182. >
  183. <van-col span="12"
  184. ><p>
  185. 实际:<span class="colorbalck">{{ Micrometer(reportTargetAll.ysqQuarterAct) }}</span>
  186. </p></van-col
  187. >
  188. <van-col span="12"
  189. ><p>
  190. 达成率:<span class="colorbalck">{{ reportTargetAll.ysqMonthSuccessRate }}%</span>
  191. </p></van-col
  192. >
  193. <van-col span="12"
  194. ><p>
  195. 达成率:<span class="colorbalck">{{ reportTargetAll.ysqQuarterSuccessRate }}%</span>
  196. </p></van-col
  197. >
  198. <van-col span="12"
  199. ><p>
  200. 成长率:<span class="colorbalck">{{ reportTargetAll.ysqMonthGrowRate }}%</span>
  201. </p></van-col
  202. >
  203. <van-col span="12"
  204. ><p>
  205. 成长率:<span class="colorbalck">{{ reportTargetAll.ysqQuarterGrowRate }}%</span>
  206. </p></van-col
  207. >
  208. </van-row>
  209. </van-collapse-item>
  210. <van-collapse-item title="质感外墙SAP(千元)" name="4">
  211. <zhiganwaiqiangSAP :reportTargetAll="reportTargetAll"></zhiganwaiqiangSAP>
  212. </van-collapse-item>
  213. <van-collapse-item name="17" title="超好贴分销店下单">
  214. <veryGoodPlaceOrder :reportTargetAll="reportTargetAll"></veryGoodPlaceOrder>
  215. </van-collapse-item>
  216. <van-collapse-item title="客户开拓" name="6">
  217. <van-row>
  218. <van-col span="24"><span class="leftTitle">非片客户开发</span></van-col>
  219. <van-col span="24"
  220. ><p>
  221. 全年开发数:<span class="colorbalck">{{
  222. Micrometer(reportTargetAll.customerAct)
  223. }}</span>
  224. </p></van-col
  225. >
  226. <van-col span="24"
  227. ><p>
  228. 全年进度率:<span class="colorbalck">{{ reportTargetAll.customerYearRate }}%</span>
  229. </p></van-col
  230. >
  231. </van-row>
  232. </van-collapse-item>
  233. <!-- isHistory 是否为历史汇报:0-新汇报 1-历史汇报 -->
  234. <div class="contentContainer" v-if="reportTargetAll.isHistory == '0'">
  235. <reportCustom
  236. ref="reportCustom"
  237. :reportCustomData="reportTargetAll.customTaskList"></reportCustom>
  238. </div>
  239. <template v-else>
  240. <van-collapse-item title="上期工作成果" name="7" class="collapsettitle">
  241. <template #title>
  242. <div>上期工作成果 <span class="colorRed">(必填)</span></div>
  243. </template>
  244. <div style="margin-top: -10px">
  245. <div class="weekContent" v-for="(item2, index2) in reportContentsList2" :key="index2">
  246. <p class="texttitle texttitle2">计划工作进度</p>
  247. <p class="contentContainerp1">
  248. <van-field
  249. v-model="reportContentsList3[index2].doubleWeekContent"
  250. rows="4"
  251. autosize
  252. readonly
  253. :formatter="formatter"
  254. type="textarea" />
  255. </p>
  256. <p class="texttitle texttitle2">实际工作进度</p>
  257. <p class="contentContainerp">
  258. <van-field
  259. v-model="item2.doubleWeekContent"
  260. rows="4"
  261. autosize
  262. maxlength="800"
  263. :formatter="formatter"
  264. type="textarea"
  265. show-word-limit />
  266. </p>
  267. </div>
  268. </div>
  269. </van-collapse-item>
  270. <van-collapse-item title="本期工作规划" name="8" class="collapsettitle">
  271. <template #title>
  272. <div>本期工作规划 <span class="colorRed">(必填)</span></div>
  273. </template>
  274. <div style="margin-top: -10px">
  275. <div class="weekContent" v-for="(item, index) in reportContentsList1" :key="index">
  276. <p class="contentContainerp">
  277. <van-field
  278. v-model="item.doubleWeekContent"
  279. rows="4"
  280. autosize
  281. maxlength="800"
  282. type="textarea"
  283. show-word-limit
  284. :formatter="formatter" />
  285. </p>
  286. </div>
  287. </div>
  288. </van-collapse-item>
  289. </template>
  290. </van-collapse>
  291. <br />
  292. <br />
  293. <van-button type="info" size="small" plain class="Btn100" @click="submint"
  294. >提交半月报</van-button
  295. >
  296. </div>
  297. <br />
  298. <br />
  299. </div>
  300. </template>
  301. <script>
  302. import {
  303. getDetailById,
  304. double_week_type,
  305. updateReport,
  306. getReportInfo,
  307. tsContents,
  308. } from '@/api/index';
  309. import createStoreBJ from '@/views/componentsTarget/createStoreBJ';
  310. import ZYPlaceOrder from '@/views/componentsTarget/ZYPlaceOrder';
  311. import performanceSAP from '@/views/componentsTarget/performanceSAP';
  312. import ZYSAP from '@/views/componentsTarget/ZYSAP';
  313. import veryGoodPlaceOrder from '@/views/componentsTarget/veryGoodPlaceOrder';
  314. import neiwaiqiangpingtu from '@/views/componentsTarget/neiwaiqiangpingtu';
  315. import zhiganwaiqiangSAP from '@/views/componentsTarget/zhiganwaiqiangSAP';
  316. import reportCustom from './reportCustom';
  317. export default {
  318. name: 'home',
  319. components: {
  320. createStoreBJ,
  321. ZYPlaceOrder,
  322. performanceSAP,
  323. ZYSAP,
  324. veryGoodPlaceOrder,
  325. neiwaiqiangpingtu,
  326. zhiganwaiqiangSAP,
  327. reportCustom,
  328. },
  329. data() {
  330. return {
  331. activeNames: [
  332. '1',
  333. '2',
  334. '3',
  335. '4',
  336. '5',
  337. '6',
  338. '7',
  339. '8',
  340. '11',
  341. '12',
  342. '16',
  343. '17',
  344. '27',
  345. '28',
  346. '29',
  347. ],
  348. powerGrade: '',
  349. value: '2',
  350. isclick: true,
  351. reportTargetAll: {},
  352. reportTarget: {},
  353. reportContentsList1: [],
  354. reportContentsList2: [],
  355. reportContentsList3: [],
  356. weekType: [],
  357. temporaryShow: '',
  358. type: '-1',
  359. };
  360. },
  361. created() {
  362. this.powerGrade = localStorage.getItem('powerGrade');
  363. this.temporaryShow = this.$route.query.temporaryShow;
  364. double_week_type().then((res) => {
  365. this.weekType = res.data;
  366. });
  367. if (this.$route.query.reportId != undefined) {
  368. this.getDetailById();
  369. } else {
  370. this.getReportInfo();
  371. }
  372. },
  373. watch: {
  374. $route(to, from) {
  375. this.powerGrade = localStorage.getItem('powerGrade');
  376. this.getReportInfo();
  377. this.temporaryShow = this.$route.query.temporaryShow;
  378. if (to.path == '/doubleWeekly') {
  379. if (this.$route.query.reportId != undefined) {
  380. this.getDetailById();
  381. } else {
  382. this.getReportInfo();
  383. }
  384. }
  385. // &&from.path=="/home"
  386. // if(to.path=="/doubleWeekly"&&from.path=="/myHistoricalDaily"){
  387. // if(this.$route.query.reportId!=undefined){
  388. // this.getDetailById()
  389. // }else{
  390. // this.getReportInfo()
  391. // }
  392. // }
  393. },
  394. },
  395. methods: {
  396. formatter(value) {
  397. return value.replace(
  398. /[\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,
  399. '',
  400. );
  401. },
  402. getDetailById() {
  403. let loading1 = this.$toast.loading({
  404. duration: 0,
  405. message: '加载中...',
  406. forbidClick: true,
  407. });
  408. getDetailById({ reportId: this.$route.query.reportId }).then((res) => {
  409. loading1.clear();
  410. if (res.code == 200) {
  411. if (res.data.status != '0' && res.data.status != '2') {
  412. this.$dialog
  413. .alert({
  414. title: '系统提示',
  415. message: '半月报已提交或过期',
  416. })
  417. .then(() => {
  418. window.location.replace(window.location.origin + '/mobile/home');
  419. });
  420. } else {
  421. this.reportTargetAll = res.data.reportTargetAll;
  422. this.reportTarget = res.data;
  423. this.type = res.data.userType;
  424. this.reportContents = res.data.reportContents;
  425. var reportContentsList1 = [];
  426. var reportContentsList2 = [];
  427. var reportContentsList3 = [];
  428. var reportContentsdata = res.data.reportContents;
  429. for (var i = 0; i < res.data.reportContents.length; i++) {
  430. reportContentsdata[i].title = this.selectDictLabel(
  431. this.weekType,
  432. res.data.reportContents[i].doubleWeekType,
  433. );
  434. if (res.data.reportContents[i].type == '2') {
  435. reportContentsList1.push(reportContentsdata[i]);
  436. }
  437. if (res.data.reportContents[i].type == '3') {
  438. reportContentsList2.push(reportContentsdata[i]);
  439. }
  440. if (res.data.reportContents[i].type == '1') {
  441. reportContentsList3.push(reportContentsdata[i]);
  442. }
  443. }
  444. // var ln1 = reportContentsList1.length
  445. // var ln2 = reportContentsList3.length
  446. // if (reportContentsList1.length > reportContentsList3.length) {
  447. // var len = ln1 - ln2
  448. // for (var x = 0; x < len; x++) {
  449. // reportContentsList3.push({
  450. // // contentTime: "",
  451. // // weekContentAm: "",
  452. // doubleWeekContent: "",
  453. // })
  454. // }
  455. // }
  456. if (reportContentsdata.length == 0) {
  457. // for (var i = 0; i < 6; i++) {
  458. // var doubleWeekType = ""
  459. // var title = ""
  460. // if (i == "0") {
  461. // doubleWeekType = "cpm"
  462. // title = "产品"
  463. //
  464. // }
  465. // if (i == "1") {
  466. // doubleWeekType = "qdm"
  467. // title = "渠道"
  468. // }
  469. // if (i == "2") {
  470. // doubleWeekType = "yym"
  471. // title = "运营"
  472. // }
  473. // if (i == "3") {
  474. // doubleWeekType = "jpm"
  475. // title = "竞品"
  476. // }
  477. // if (i == "4") {
  478. // doubleWeekType = "cwm"
  479. // title = "财务"
  480. // }
  481. // if (i == "5") {
  482. // doubleWeekType = "rlm"
  483. // title = "人力"
  484. // }
  485. reportContentsList1.push({
  486. title: '',
  487. doubleWeekContent: '',
  488. doubleWeekType: '',
  489. contentTime: this.parseTime(new Date(), '{y}-{m}-{d}'),
  490. type: 2,
  491. });
  492. reportContentsList3.push({
  493. title: '',
  494. doubleWeekContent: '',
  495. doubleWeekType: '',
  496. contentTime: this.parseTime(new Date(), '{y}-{m}-{d}'),
  497. type: 1,
  498. });
  499. reportContentsList2.push({
  500. title: '',
  501. doubleWeekContent: '',
  502. doubleWeekType: '',
  503. contentTime: this.parseTime(new Date(), '{y}-{m}-{d}'),
  504. type: 3,
  505. });
  506. } else {
  507. if (reportContentsList1.length < 1) {
  508. reportContentsList1.push({
  509. title: '',
  510. doubleWeekContent: '',
  511. doubleWeekType: '',
  512. contentTime: this.parseTime(new Date(), '{y}-{m}-{d}'),
  513. type: 2,
  514. });
  515. }
  516. if (reportContentsList3.length < 1) {
  517. reportContentsList3.push({
  518. title: '',
  519. doubleWeekContent: '',
  520. doubleWeekType: '',
  521. contentTime: this.parseTime(new Date(), '{y}-{m}-{d}'),
  522. type: 1,
  523. });
  524. }
  525. if (reportContentsList2.length < 1) {
  526. reportContentsList2.push({
  527. title: '',
  528. doubleWeekContent: '',
  529. doubleWeekType: '',
  530. contentTime: this.parseTime(new Date(), '{y}-{m}-{d}'),
  531. type: 3,
  532. });
  533. }
  534. }
  535. // }
  536. this.reportContentsList1 = reportContentsList2; // 1 2 2 3 3 1
  537. this.reportContentsList2 = reportContentsList1;
  538. this.reportContentsList3 = reportContentsList3;
  539. }
  540. } else {
  541. this.$toast(res.msg);
  542. }
  543. });
  544. },
  545. tsContentsFn() {
  546. if (this.isclick) {
  547. if (this.reportTarget.isHistory == '1') {
  548. this.reportTarget.reportContents = [];
  549. this.reportTarget.reportContents = this.reportContentsList2
  550. .concat(this.reportContentsList1)
  551. .concat(this.reportContentsList3);
  552. this.tsContentsFun(null);
  553. } else {
  554. // 新的
  555. if (this.reportTarget.customTaskList && this.reportTarget.customTaskList.length) {
  556. // 配置任务
  557. this.filterReportCustomData((reportCustomAnswers) => {
  558. this.tsContentsFun(reportCustomAnswers);
  559. });
  560. } else {
  561. // 没有配置任务
  562. this.tsContentsFun(null);
  563. }
  564. }
  565. }
  566. },
  567. tsContentsFun(reportCustomAnswers) {
  568. let loading1 = this.$toast.loading({
  569. duration: 0,
  570. message: '数据提交中...',
  571. forbidClick: true,
  572. });
  573. if (reportCustomAnswers) this.reportTarget.reportCustomAnswers = reportCustomAnswers;
  574. this.reportTarget.status = '1';
  575. this.isclick = false;
  576. tsContents(this.reportTarget).then((res) => {
  577. loading1.clear();
  578. this.isclick = true;
  579. if (res.code == 200) {
  580. this.$dialog
  581. .alert({
  582. title: '系统提示',
  583. message: '暂存成功',
  584. })
  585. .then(() => {
  586. // if(this.$route.query.reportId!=undefined){
  587. // window.location.replace(window.location.origin+"/mobile/myHistoricalDaily")
  588. // }else{
  589. // window.location.replace(window.location.origin+"/mobile/home")
  590. // }
  591. });
  592. } else {
  593. this.$toast.fail(res.msg);
  594. }
  595. });
  596. },
  597. reportCustomTabstoreVal(callback) {
  598. // 必填校验
  599. this.$refs.reportCustom.$refs.tabstoreVal
  600. .validate()
  601. .then(() => {
  602. // 验证通过
  603. this.filterReportCustomData(callback);
  604. })
  605. .catch((errors) => {
  606. this.toastLoading().clear();
  607. return;
  608. });
  609. },
  610. filterReportCustomData(callback) {
  611. let reportCustomData = this.$refs.reportCustom ? this.$refs.reportCustom.fromData : {} || {};
  612. let reportCustomAnswers = [];
  613. for (let i = 0; i < reportCustomData.length; i++) {
  614. let customData = reportCustomData[i].sfaReportCustomCollections
  615. ? reportCustomData[i].sfaReportCustomCollections
  616. : [];
  617. for (let x = 0; x < customData.length; x++) {
  618. if (
  619. customData[x].reportCustomCollectionType == 'dx' ||
  620. customData[x].reportCustomCollectionType == 'duox'
  621. ) {
  622. let optionData = customData[x].sfaReportCustomOptions;
  623. for (let y = 0; y < optionData.length; y++) {
  624. if (optionData[y].answerValue == 'Y') {
  625. reportCustomAnswers.push({
  626. reportCustomTaskId: customData[x].reportCustomTaskId,
  627. reportCustomCollectionId: optionData[y].reportCustomCollectionId,
  628. reportCustomOptionId: optionData[y].reportCustomOptionId,
  629. answerValue: 'Y',
  630. });
  631. }
  632. }
  633. } else {
  634. if (customData[x].answerValue)
  635. reportCustomAnswers.push({
  636. reportCustomTaskId: customData[x].reportCustomTaskId,
  637. reportCustomCollectionId: customData[x].reportCustomCollectionId,
  638. answerValue: customData[x].answerValue,
  639. });
  640. }
  641. }
  642. }
  643. console.log(reportCustomAnswers);
  644. callback && callback(reportCustomAnswers);
  645. },
  646. // 提交日报
  647. submint() {
  648. if (this.isclick) {
  649. // 旧的
  650. if (this.reportTarget.isHistory == '1') {
  651. this.reportTarget.reportContents = [];
  652. for (var x = 0; x < this.reportContentsList2.length; x++) {
  653. if (this.reportContentsList2[x].doubleWeekContent.trim() == '') {
  654. this.$toast('请完善上期半月报内容!');
  655. return false;
  656. }
  657. }
  658. for (var j = 0; j < this.reportContentsList1.length; j++) {
  659. if (this.reportContentsList1[j].doubleWeekContent.trim() == '') {
  660. this.$toast('请完善本期半月报内容!');
  661. return false;
  662. }
  663. }
  664. if (this.reportContentsList2[0].doubleWeekContent.length > 800) {
  665. this.$toast('上期半月报内容超过800字!');
  666. return false;
  667. }
  668. if (this.reportContentsList1[0].doubleWeekContent.length > 800) {
  669. this.$toast('本期半月报内容超过800字!');
  670. return false;
  671. }
  672. this.reportTarget.reportContents = this.reportContentsList2
  673. .concat(this.reportContentsList1)
  674. .concat(this.reportContentsList3);
  675. this.submintFun();
  676. } else {
  677. // 新的
  678. if (this.reportTarget.customTaskList && this.reportTarget.customTaskList.length) {
  679. // 配置任务
  680. this.reportCustomTabstoreVal((reportCustomAnswers) => {
  681. this.submintFun(reportCustomAnswers);
  682. });
  683. } else {
  684. // 没有配置任务
  685. this.submintFun(null);
  686. }
  687. }
  688. }
  689. },
  690. submintFun(reportCustomAnswers) {
  691. let loading1 = this.$toast.loading({
  692. duration: 0,
  693. message: '数据提交中...',
  694. forbidClick: true,
  695. });
  696. if (reportCustomAnswers) this.reportTarget.reportCustomAnswers = reportCustomAnswers;
  697. this.reportTarget.status = '1';
  698. this.isclick = false;
  699. updateReport(this.reportTarget).then((res) => {
  700. loading1.clear();
  701. this.isclick = true;
  702. if (res.code == 200) {
  703. this.$dialog
  704. .alert({
  705. title: '系统提示',
  706. message: '提交成功',
  707. })
  708. .then(() => {
  709. if (this.$route.query.reportId != undefined) {
  710. window.location.replace(window.location.origin + '/mobile/myHistoricalDaily');
  711. } else {
  712. this.onClickLeft();
  713. // window.location.replace(window.location.origin + '/mobile/home');
  714. }
  715. });
  716. } else {
  717. this.$toast.fail(res.msg);
  718. }
  719. });
  720. },
  721. getReportInfo() {
  722. let loading1 = this.$toast.loading({
  723. duration: 0,
  724. message: '加载中...',
  725. forbidClick: true,
  726. });
  727. getReportInfo({ isContent: true }).then((res) => {
  728. loading1.clear();
  729. localStorage.setItem('powerGrade', res.data.positionId);
  730. localStorage.setItem('userDeptLevel', res.data.userDeptLevel);
  731. this.powerGrade = res.data.positionId;
  732. this.showButton = res.data.showButton;
  733. this.reportTargetAll = res.data.reportTargetAll;
  734. this.reportTarget = res.data;
  735. this.type = res.data.userType;
  736. var reportContentsList1 = [];
  737. var reportContentsList2 = [];
  738. var reportContentsList3 = [];
  739. if (res.data.reportContents.length == '0') {
  740. // for (var i = 0; i < 6; i++) {
  741. // var doubleWeekType = ""
  742. // var title = ""
  743. // if (i == "0") {
  744. // doubleWeekType = "cpm"
  745. // title = "产品"
  746. // }
  747. // if (i == "1") {
  748. // doubleWeekType = "qdm"
  749. // title = "渠道"
  750. // }
  751. // if (i == "2") {
  752. // doubleWeekType = "yym"
  753. // title = "运营"
  754. // }
  755. // if (i == "3") {
  756. // doubleWeekType = "jpm"
  757. // title = "竞品"
  758. // }
  759. // if (i == "4") {
  760. // doubleWeekType = "cwm"
  761. // title = "财务"
  762. // }
  763. // if (i == "5") {
  764. // doubleWeekType = "rlm"
  765. // title = "人力"
  766. // }
  767. reportContentsList1.push({
  768. title: '',
  769. doubleWeekContent: '',
  770. doubleWeekType: '',
  771. contentTime: this.parseTime(new Date(), '{y}-{m}-{d}'),
  772. type: 3,
  773. });
  774. reportContentsList3.push({
  775. title: '',
  776. doubleWeekContent: '',
  777. doubleWeekType: '',
  778. contentTime: this.parseTime(new Date(), '{y}-{m}-{d}'),
  779. type: 1,
  780. });
  781. reportContentsList2.push({
  782. title: '',
  783. doubleWeekContent: '',
  784. doubleWeekType: '',
  785. contentTime: this.parseTime(new Date(), '{y}-{m}-{d}'),
  786. type: 2,
  787. });
  788. // }
  789. this.reportContentsList2 = reportContentsList2;
  790. this.reportContentsList1 = reportContentsList1;
  791. this.reportContentsList3 = reportContentsList3;
  792. } else {
  793. var reportContentsdata = res.data.reportContents;
  794. for (var i = 0; i < res.data.reportContents.length; i++) {
  795. // reportContentsdata[i].title = this.selectDictLabel(this.weekType, res.data.reportContents[i].doubleWeekType)
  796. if (res.data.reportContents[i].type == '2') {
  797. reportContentsList2.push(reportContentsdata[i]);
  798. }
  799. if (res.data.reportContents[i].type == '3') {
  800. reportContentsList1.push(reportContentsdata[i]);
  801. }
  802. if (res.data.reportContents[i].type == '1') {
  803. reportContentsList3.push(reportContentsdata[i]);
  804. }
  805. }
  806. if (reportContentsList2.length > 0) {
  807. this.reportContentsList2 = reportContentsList2;
  808. } else {
  809. reportContentsList2.push({
  810. title: '',
  811. doubleWeekContent: '',
  812. doubleWeekType: '',
  813. contentTime: this.parseTime(new Date(), '{y}-{m}-{d}'),
  814. type: 2,
  815. });
  816. this.reportContentsList2 = reportContentsList2;
  817. }
  818. if (reportContentsList1.length > 0) {
  819. this.reportContentsList1 = reportContentsList1;
  820. } else {
  821. reportContentsList1.push({
  822. title: '',
  823. doubleWeekContent: '',
  824. doubleWeekType: '',
  825. contentTime: this.parseTime(new Date(), '{y}-{m}-{d}'),
  826. type: 3,
  827. });
  828. this.reportContentsList1 = reportContentsList1;
  829. }
  830. if (reportContentsList3.length > 0) {
  831. this.reportContentsList3 = reportContentsList3;
  832. } else {
  833. reportContentsList3.push({
  834. title: '',
  835. doubleWeekContent: '',
  836. doubleWeekType: '',
  837. contentTime: this.parseTime(new Date(), '{y}-{m}-{d}'),
  838. type: 1,
  839. });
  840. this.reportContentsList3 = reportContentsList3;
  841. }
  842. }
  843. });
  844. },
  845. onClickLeft() {
  846. this.$router.go(-1);
  847. },
  848. },
  849. };
  850. </script>
  851. <style scoped>
  852. .container {
  853. margin: 10px;
  854. }
  855. .container .van-collapse-item {
  856. margin-bottom: 10px;
  857. border-radius: 6px;
  858. overflow: hidden;
  859. }
  860. .linepAdd p {
  861. margin: 10px 0 0 0;
  862. font-size: 14px;
  863. color: #666;
  864. }
  865. .linepAdd .weekContent {
  866. padding-top: 5px;
  867. }
  868. .linepAdd .weekContent p {
  869. padding: 5px 0;
  870. margin: 0;
  871. padding-left: 10px;
  872. }
  873. .linepAdd .weekContent .texttitle {
  874. color: #0057ba;
  875. position: relative;
  876. padding-left: 10px;
  877. }
  878. .linepAdd .weekContent .texttitle .opint {
  879. position: absolute;
  880. left: 0px;
  881. top: 10px;
  882. margin-right: 6px;
  883. display: inline-block;
  884. width: 6px;
  885. height: 6px;
  886. border-radius: 10px;
  887. background-color: #004d8c;
  888. }
  889. .leftTitle {
  890. background-color: #74a4d9;
  891. color: #fff;
  892. display: inline-block;
  893. padding: 0 4px;
  894. border-radius: 2px;
  895. }
  896. .rightTitle {
  897. background-color: #e7b4bb;
  898. color: #fff;
  899. display: inline-block;
  900. padding: 0 4px;
  901. border-radius: 2px;
  902. }
  903. </style>
  904. <style>
  905. .linepAdd .van-cell__title {
  906. color: #1e5398;
  907. font-weight: 500;
  908. font-size: 16px;
  909. }
  910. .Btn100 {
  911. display: block;
  912. width: 100%;
  913. border-radius: 6px;
  914. color: #fff !important;
  915. background-color: #0057ba;
  916. border: 1px solid #0057ba;
  917. height: 44px;
  918. }
  919. .linepAdd .contentContainer {
  920. background-color: white;
  921. border-radius: 8px;
  922. padding: 10px 16px;
  923. margin-bottom: 10px;
  924. }
  925. .linepAdd .contentContainer .contentContainerTitle {
  926. color: #222;
  927. }
  928. .linepAdd .contentContainer .contentContainerTitle span {
  929. font-size: 12px;
  930. color: #666;
  931. }
  932. .linepAdd .contentContainer .van-field__control,
  933. .linepAdd .contentContainerp .van-field__control {
  934. background-color: #f8f8f8;
  935. padding: 10px;
  936. border-radius: 8px;
  937. }
  938. .linepAdd .contentContainer .van-cell,
  939. .linepAdd .contentContainerp .van-cell {
  940. padding: 0;
  941. }
  942. .colorbalck {
  943. color: #333333;
  944. }
  945. .collapsettitle .van-cell__title {
  946. color: #333;
  947. }
  948. .van-dialog__confirm,
  949. .van-dialog__confirm:active {
  950. color: #0057ba;
  951. }
  952. .colorRed {
  953. color: red;
  954. }
  955. </style>