weekly.vue 31 KB

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