VisitSummaryAdd.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916
  1. <template>
  2. <div class="bgcolor">
  3. <!-- 顶部条-->
  4. <!-- 顶部条-->
  5. <div class="navBarTOP">
  6. <van-nav-bar class="navBar" left-arrow :title="title" @click-left="onClickLeft" />
  7. </div>
  8. <!-- 主体内容-->
  9. <div class="lineGrey"></div>
  10. <div class="lineGrey"></div>
  11. <div class="lineGrey"></div>
  12. <div class="lineGrey"></div>
  13. <div class="lineGrey"></div>
  14. <div class="lineGrey" style="height: 6px"></div>
  15. <div class="container" style="width: 94%; margin: 0px auto; border-radius: 6px">
  16. <van-form ref="tabstoreVal">
  17. <div v-for="(item, index) in collectionItemList" :key="index">
  18. <div v-if="item.answerType == 'sz'" class="formLabel z-cell">
  19. <van-cell>
  20. <template #title>
  21. <span v-if="item.isMust == 0" class="van-f-red">*</span>{{ item.customName
  22. }}<span style="font-size: 12px; color: #888">{{ item.remark }}</span>
  23. </template>
  24. </van-cell>
  25. <van-field
  26. v-model="item.answerValue"
  27. :placeholder="item.customName"
  28. type="number"
  29. @input="numberFn(item, index)"></van-field>
  30. </div>
  31. <div v-if="item.answerType == 'rq'" class="formLabel z-cell">
  32. <van-cell>
  33. <template #title>
  34. <span v-if="item.isMust == 0" class="van-f-red">*</span>{{ item.customName
  35. }}<span style="font-size: 14px; color: #ccc">{{ item.remark }}</span>
  36. </template>
  37. </van-cell>
  38. <van-field
  39. v-model="item.answerValue"
  40. clickable
  41. name="calendar"
  42. placeholder="点击选择日期"
  43. readonly
  44. @click="showCalendarClick(index)" />
  45. <p
  46. style="
  47. color: #444;
  48. font-size: 12px;
  49. margin: 0;
  50. padding: 10px 0;
  51. text-align: right;
  52. "></p>
  53. </div>
  54. <div v-if="item.answerType == 'zp'" class="formLabel z-cell">
  55. <van-cell>
  56. <template #title>
  57. <span v-if="item.isMust == 0" class="van-f-red">*</span>{{ item.customName }}
  58. </template>
  59. </van-cell>
  60. <van-row gutter="10" style="margin-bottom: 10px">
  61. <p style="margin-top: 0">
  62. <span style="font-size: 12px; color: #888">{{ item.remark }}</span>
  63. </p>
  64. <delete-upload-img :imgs="item.fileInfoList" :isDelete="false"></delete-upload-img>
  65. <upload-img
  66. :uploadid="uploadid2"
  67. @newimgarr="newimgarr1"
  68. imgText="上传照片"
  69. :indexImg="index"
  70. :customId="item.customId"
  71. :summaryId="item.summaryId"
  72. @click="imgClick(item, index)"></upload-img>
  73. </van-row>
  74. </div>
  75. <div v-if="item.answerType == 'wb'" class="formLabel z-cell">
  76. <van-cell>
  77. <template #title>
  78. <span v-if="item.isMust == 0" class="van-f-red">*</span>{{ item.customName }}
  79. </template>
  80. </van-cell>
  81. <van-field
  82. v-model="item.answerValue"
  83. :formatter="formatter"
  84. :placeholder="item.customName"></van-field>
  85. <p style="color: #444; font-size: 12px; margin: 0; padding: 10px 0; text-align: right">
  86. {{ item.remark }}
  87. </p>
  88. </div>
  89. <div v-if="item.answerType == 'gs'" class="formLabel z-cell" @click="regionClick(index)">
  90. <van-cell>
  91. <template #title>
  92. <span v-if="item.isMust == 0" class="van-f-red">*</span>{{ item.customName }}
  93. </template>
  94. </van-cell>
  95. <van-field
  96. readonly
  97. v-model="item.answerName"
  98. :formatter="formatter"
  99. :placeholder="item.customName"></van-field>
  100. <p style="color: #444; font-size: 12px; margin: 0; padding: 10px 0; text-align: right">
  101. {{ item.remark }}
  102. </p>
  103. </div>
  104. <div
  105. v-if="item.answerType == 'dq'"
  106. class="formLabel z-cell"
  107. @click="SalesRegionClick(index)">
  108. <van-cell>
  109. <template #title>
  110. <span v-if="item.isMust == 0" class="van-f-red">*</span>{{ item.customName }}
  111. </template>
  112. </van-cell>
  113. <van-field
  114. readonly
  115. v-model="item.answerName"
  116. :formatter="formatter"
  117. :placeholder="item.customName"></van-field>
  118. <p style="color: #444; font-size: 12px; margin: 0; padding: 10px 0; text-align: right">
  119. {{ item.remark }}
  120. </p>
  121. </div>
  122. <div
  123. v-if="item.answerType == 'xsb'"
  124. class="formLabel z-cell"
  125. @click="SalesDepartmentClick(index)">
  126. <van-cell>
  127. <template #title>
  128. <span v-if="item.isMust == 0" class="van-f-red">*</span>{{ item.customName }}
  129. </template>
  130. </van-cell>
  131. <van-field
  132. readonly
  133. v-model="item.answerName"
  134. :formatter="formatter"
  135. :placeholder="item.customName"></van-field>
  136. <p style="color: #444; font-size: 12px; margin: 0; padding: 10px 0; text-align: right">
  137. {{ item.remark }}
  138. </p>
  139. </div>
  140. <div v-if="item.answerType == 'duox'" class="formLabel z-cell">
  141. <van-cell>
  142. <template #title>
  143. <span v-if="item.isMust == 0" class="van-f-red">*</span>{{ item.customName }}
  144. </template>
  145. </van-cell>
  146. <z-checkbox
  147. :answerType="item.answerType"
  148. :checkboxval="item.answerValue"
  149. :collectionType="item.customOptionList"
  150. :textc="item.customId"
  151. :zCheckboxcolumns="item.customOptionList"
  152. @zSelectVal="zSelectVal"></z-checkbox>
  153. </div>
  154. <div v-if="item.answerType == 'dx'" class="formLabel z-cell">
  155. <van-cell>
  156. <template #title>
  157. <span v-if="item.isMust == 0" class="van-f-red">*</span>{{ item.customName }}
  158. </template>
  159. </van-cell>
  160. <z-radio
  161. :answerType="item.answerType"
  162. :collectionType="item.collectionType"
  163. :radio="item.answerValue"
  164. :textc="item.customId"
  165. :zRadiocolumns="item.customOptionList"
  166. @zSelectVal="zSelectVal"></z-radio>
  167. </div>
  168. <br />
  169. </div>
  170. </van-form>
  171. </div>
  172. <br />
  173. <div class="tc" style="padding: 0 16px">
  174. <van-button class="submitBtn" block type="info" color="#0057ba" @click="onSubmit"
  175. >提交汇报</van-button
  176. >
  177. </div>
  178. <br />
  179. <van-calendar
  180. v-model="showCalendar"
  181. @confirm="onConfirm"
  182. color="#0057ba"
  183. :min-date="minDate"
  184. :max-date="maxDate"
  185. :show-confirm="false" />
  186. <van-popup v-model="RegionShow" capture position="bottom">
  187. <van-picker
  188. :columns="companyList"
  189. show-toolbar
  190. value-key="deptName"
  191. @cancel="RegionShow = false"
  192. @confirm="onregionConfirm" />
  193. </van-popup>
  194. <van-popup v-model="SalesRegionShow" capture position="bottom">
  195. <van-picker
  196. :columns="regionList"
  197. show-toolbar
  198. value-key="deptName"
  199. @cancel="SalesRegionShow = false"
  200. @confirm="onSalesRegionConfirm" />
  201. </van-popup>
  202. <van-popup v-model="SalesDepartmentShow" capture position="bottom">
  203. <van-picker
  204. :columns="deptList"
  205. show-toolbar
  206. value-key="deptName"
  207. @cancel="SalesDepartmentShow = false"
  208. @confirm="onSalesDepartmentConfirm" />
  209. </van-popup>
  210. <van-popup v-model="StartTimeShow" capture position="bottom">
  211. <van-datetime-picker
  212. v-model="strtcurrentDate"
  213. :max-date="strtmaxDate"
  214. :min-date="strtminDate"
  215. title="选择查找开始时间"
  216. type="date"
  217. @cancel="StartTimeShow = false"
  218. @confirm="onStartTimeConfirm" />
  219. </van-popup>
  220. <van-popup v-model="EndTimeShow" capture position="bottom">
  221. <van-datetime-picker
  222. v-model="endcurrentDate"
  223. :max-date="endmaxDate"
  224. :min-date="endminDate"
  225. title="选择查找结束时间"
  226. type="date"
  227. @cancel="EndTimeShow = false"
  228. @confirm="onEndTimeConfirm" />
  229. </van-popup>
  230. </div>
  231. </template>
  232. <script>
  233. import timeico from '@/assets/Icon/datatims.png';
  234. import {
  235. insertCustomAnswer,
  236. getSummaryDetailById,
  237. getDeptInfo,
  238. getSummaryMobileDeptInfo,
  239. } from '@/api/index';
  240. import zRadio from '@/components/zRadio2';
  241. import zCheckbox from '@/components/zCheckbox2';
  242. // import uploadImg from "@/components/uo";
  243. import uploadImg from '@/components/uploadVTask';
  244. import deleteUploadImg from '@/components/deleteUploadImg2';
  245. export default {
  246. name: 'MyHistoricalWeekly',
  247. components: { zRadio, zCheckbox, uploadImg, deleteUploadImg },
  248. data() {
  249. return {
  250. timeico: timeico,
  251. RegionShow: false,
  252. SalesRegionShow: false,
  253. SalesDepartmentShow: false,
  254. StaffShow: false,
  255. StartTimeShow: false,
  256. dateIndex: '',
  257. EndTimeShow: false,
  258. uploadid2: 'uploadid2',
  259. PhotoTypeList: [{ text: '009', value: '09' }],
  260. strtminDate: new Date(2022, 0, 1),
  261. endminDate: new Date(2022, 0, 1),
  262. minDate: new Date(2020, 0, 1),
  263. maxDate: new Date(2090, 0, 31),
  264. strtmaxDate: new Date(),
  265. endmaxDate: new Date(),
  266. strtcurrentDate: new Date(),
  267. endcurrentDate: new Date(),
  268. companyName: '全部公司',
  269. deptName: '全部销售部',
  270. regionName: '全部大区',
  271. userName: '全部',
  272. companyCode: '',
  273. deptCode: '',
  274. regionCode: '',
  275. userCode: '',
  276. companyList: [],
  277. title: '',
  278. deptList: [],
  279. regionList: [],
  280. userList: [],
  281. deptForm: { type: '', parentId: '' },
  282. list: [],
  283. loading: false,
  284. finished: true,
  285. showCalendar: false,
  286. formData: {
  287. type: '2', // 汇报类型或入口 1-下属业务员日报 2-下属销售部主管周报 3-下属大区主管半月报
  288. companyId: '', // 公司id,必传 Long类型
  289. regionId: '', // 大区id,必传 Long类型
  290. deptId: '', // 部门id,如果为周报或日报为必传 Long类型
  291. userId: '', // 业务员id,如果为日报为必传 Long类型
  292. startTime: '', // 开始时间,必传 格式:yyyy-MM-dd String类型
  293. endTime: '', // 结束时间,必传 格式:yyyy-MM-dd String类型
  294. pageNum: 1, // 当前页码 int类型
  295. pageSize: 10, // 当前每页条数 int类型
  296. },
  297. tableList: [],
  298. collectionItemList: [],
  299. collectionAnswerlisd: [],
  300. flagclick: true,
  301. index: '',
  302. };
  303. },
  304. created() {
  305. // this.formData.startTime = this.GetPreMonthDay(this.parseTime(new Date(), '{y}-{m}-{d}'),2)
  306. this.formData.startTime = this.getThreeDaysAgo();
  307. // this.strtcurrentDate=new Date(this.GetPreMonthDay(this.parseTime(new Date(), '{y}-{m}-{d}'),2))
  308. this.strtcurrentDate = new Date(this.getThreeDaysAgo());
  309. this.formData.endTime = this.parseTime(new Date(), '{y}-{m}-{d}') + '';
  310. this.endminDate = new Date(this.GetPreMonthDay(this.parseTime(new Date(), '{y}-{m}-{d}'), 2));
  311. this.powerGrade = localStorage.getItem('powerGrade');
  312. this.title = this.$route.query.title;
  313. this.getReportInfo();
  314. this.regionCode = '';
  315. },
  316. watch: {
  317. $route(to, from) {
  318. if (to.path == '/VisitSummaryAdd') {
  319. this.title = this.$route.query.title;
  320. this.getReportInfo();
  321. this.regionCode = '';
  322. }
  323. },
  324. },
  325. methods: {
  326. showCalendarClick(val) {
  327. this.dateIndex = val;
  328. this.showCalendar = true;
  329. },
  330. formatDate(date) {
  331. var Month = date.getMonth() + 1;
  332. var Day = date.getDate();
  333. if (Month < 10) {
  334. Month = '0' + Month;
  335. }
  336. if (Day < 10) {
  337. Day = '0' + Day;
  338. }
  339. return `${date.getFullYear()}-${Month}-${Day}`;
  340. },
  341. onConfirm(date) {
  342. this.showCalendar = false;
  343. this.collectionItemList[this.dateIndex].answerValue = this.formatDate(date);
  344. },
  345. formatter(value) {
  346. return value.replace(
  347. /[\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,
  348. ''
  349. );
  350. },
  351. numberFn(val, index) {
  352. if (!/^[+-]?\d*\.{0,1}\d{0,1}$/.test(this.collectionItemList[index].answerValue)) {
  353. this.collectionItemList[index].answerValue = this.collectionItemList[
  354. index
  355. ].answerValue.replace(
  356. /\.\d{2,}$/,
  357. this.collectionItemList[index].answerValue.substr(
  358. this.collectionItemList[index].answerValue.indexOf('.'),
  359. 3
  360. )
  361. );
  362. }
  363. },
  364. zSelectVal(value) {
  365. var collectionAnswerlisd = this.collectionAnswerlisd;
  366. if (collectionAnswerlisd.length > 0) {
  367. var num = 0;
  368. for (var a = 0; a < collectionAnswerlisd.length; a++) {
  369. if (collectionAnswerlisd[a].id == value.id) {
  370. collectionAnswerlisd[a] = value;
  371. num = 0;
  372. } else {
  373. num = 1;
  374. }
  375. }
  376. if (num > 0) {
  377. collectionAnswerlisd.push(value);
  378. }
  379. } else {
  380. collectionAnswerlisd.push(value);
  381. }
  382. this.collectionAnswerlisd = collectionAnswerlisd;
  383. },
  384. imgClick(val, index) {
  385. this.collectionId = val.collectionId + '';
  386. this.indeximg = index;
  387. this.show = true;
  388. },
  389. newimgarr1(val) {
  390. if (
  391. this.collectionItemList[val.index].fileInfoList == null ||
  392. this.collectionItemList[val.index].fileInfoList == undefined
  393. ) {
  394. this.collectionItemList[val.index].fileInfoList = [];
  395. this.collectionItemList[val.index].fileIdList = [];
  396. }
  397. this.collectionItemList[val.index].fileInfoList.push(val);
  398. this.collectionItemList[val.index].fileIdList.push(val.id);
  399. },
  400. dateFn(val) {
  401. return val.slice(0, 4) + '-' + val.slice(4, 6) + '-' + val.slice(6, 8);
  402. },
  403. onLoad() {},
  404. onSubmit() {
  405. for (var c = 0; c < this.collectionAnswerlisd.length; c++) {
  406. for (var b = 0; b < this.collectionItemList.length; b++) {
  407. if (this.collectionAnswerlisd[c].id == this.collectionItemList[b].customId) {
  408. this.collectionItemList[b].customOptionList = this.collectionAnswerlisd[c].value;
  409. }
  410. }
  411. }
  412. // // 照片
  413. let zpDataList = this.collectionItemList.find((item) => item.answerType == 'zp');
  414. if (zpDataList && zpDataList.fileInfoList) {
  415. let fileIdList = [];
  416. zpDataList.fileInfoList.forEach((item) => {
  417. fileIdList.push(item.id);
  418. });
  419. zpDataList.fileIdList = fileIdList;
  420. }
  421. if (this.flagclick) {
  422. this.flagclick = false;
  423. this.timer = null;
  424. this.timer = setTimeout(() => {
  425. this.flagclick = true;
  426. }, 2000);
  427. insertCustomAnswer(this.collectionItemList)
  428. .then((res) => {
  429. if (res.code == 200) {
  430. this.$router.go(-1);
  431. } else {
  432. this.$toast(res.msg);
  433. }
  434. })
  435. .catch((err) => {
  436. this.$toast(err.msg);
  437. });
  438. }
  439. },
  440. getReportInfo() {
  441. let loading1 = this.$toast.loading({
  442. duration: 0,
  443. message: '加载中...',
  444. forbidClick: true,
  445. });
  446. this.collectionItemList = [];
  447. this.collectionAnswerlisd = [];
  448. getSummaryDetailById({ summaryId: this.$route.query.summaryId }).then((res) => {
  449. loading1.clear();
  450. if (res.code == 200) {
  451. var collectionItemLists = res.data;
  452. for (var q = 0; q < collectionItemLists.length; q++) {
  453. collectionItemLists[q].answerName = undefined;
  454. // 公司
  455. if (collectionItemLists[q].answerType == 'gs') {
  456. this.getDeptInfo('dept', 'gs', collectionItemLists[q].answerValue);
  457. }
  458. // 单选
  459. if (
  460. collectionItemLists[q].answerType == 'dx' &&
  461. collectionItemLists[q].showHistory == '1'
  462. ) {
  463. let findCustom = collectionItemLists[q].customOptionList.find((item) => item.checked);
  464. if (findCustom) {
  465. collectionItemLists[q].answerValue = findCustom.customOptionId + '';
  466. }
  467. }
  468. // 多选
  469. if (
  470. collectionItemLists[q].answerType == 'duox' &&
  471. collectionItemLists[q].showHistory == '1'
  472. ) {
  473. let findCustom = [];
  474. collectionItemLists[q].customOptionList.forEach((item) => {
  475. if (item.checked) {
  476. findCustom.push(item.customOptionId + '');
  477. }
  478. });
  479. if (findCustom) {
  480. collectionItemLists[q].answerValue = findCustom.join(',');
  481. }
  482. }
  483. // 照片
  484. if (collectionItemLists[q].answerType == 'zp' && collectionItemLists[q].fileInfoList) {
  485. let fileIdList = [];
  486. collectionItemLists[q].fileInfoList.forEach((item) => {
  487. fileIdList.push(item.id);
  488. });
  489. collectionItemLists[q].fileIdList = fileIdList;
  490. }
  491. }
  492. this.collectionItemList = collectionItemLists;
  493. }
  494. });
  495. },
  496. getThreeDaysAgo() {
  497. let myDate = new Date();
  498. let lw = new Date(myDate - 1000 * 60 * 60 * 24 * 14); //最后一个数字30可改,30天的意思
  499. let lastY = lw.getFullYear();
  500. let lastM = lw.getMonth() + 1;
  501. let lastD = lw.getDate();
  502. let startData =
  503. lastY + '-' + (lastM < 10 ? '0' + lastM : lastM) + '-' + (lastD < 10 ? '0' + lastD : lastD); //三十天之前日期
  504. return startData;
  505. },
  506. GetPreMonthDay(date, monthNum, type) {
  507. var dateArr = date.split('-');
  508. var year = dateArr[0]; //获取当前日期的年份
  509. var month = dateArr[1]; //获取当前日期的月份
  510. var day = dateArr[2]; //获取当前日期的日
  511. var days = new Date(year, month, 0);
  512. days = days.getDate(); //获取当前日期中月的天数
  513. var year2 = year;
  514. var month2 = parseInt(month) - monthNum;
  515. if (month2 <= 0) {
  516. var absM = Math.abs(month2);
  517. year2 = parseInt(year2) - Math.ceil(absM / 12 == 0 ? 1 : parseInt(absM) / 12);
  518. month2 = 12 - (absM % 12);
  519. }
  520. var day2 = day;
  521. var days2 = new Date(year2, month2, 0);
  522. days2 = days2.getDate();
  523. if (day2 > days2) {
  524. day2 = days2;
  525. }
  526. if (month2 < 10) {
  527. month2 = '0' + month2;
  528. }
  529. var t2 = '';
  530. if (monthNum > 0) {
  531. t2 = year2 + '-' + month2 + '-01';
  532. } else {
  533. if (type == 'end') {
  534. var Months = new Date().getMonth() + 1;
  535. var days111 = new Date().getDate();
  536. if (Months < 10) {
  537. Months = '0' + Months;
  538. }
  539. if (days111 < 10) {
  540. days111 = '0' + days111;
  541. }
  542. if (parseInt(month2) >= new Date().getMonth() + 1) {
  543. t2 = year2 + '-' + Months + '-' + days111;
  544. } else {
  545. var daysd = this.getMonthDays(year2, month2);
  546. t2 = year2 + '-' + month2 + '-' + daysd;
  547. }
  548. } else {
  549. t2 = year2 + '-' + month2 + '-' + day2;
  550. }
  551. }
  552. return t2;
  553. },
  554. getMonthDays(year, month) {
  555. var stratDate = new Date(year, month - 1, 1),
  556. endData = new Date(year, month, 1);
  557. var days = (endData - stratDate) / (1000 * 60 * 60 * 24);
  558. return days;
  559. },
  560. getDeptInfo(type, grade, answerValue) {
  561. this.deptForm.type = type;
  562. if (grade == '1') {
  563. this.deptForm.parentId = this.companyCode;
  564. } else if (grade == '2') {
  565. this.deptForm.parentId = this.regionCode;
  566. } else {
  567. this.deptForm.type = '';
  568. this.deptForm.parentId = '';
  569. }
  570. getSummaryMobileDeptInfo(this.deptForm).then((res) => {
  571. if (grade == 'dq') {
  572. if (res.data.region != null) {
  573. this.regionList = res.data.region;
  574. // for (var k = 0; k < this.collectionItemList.length; k++) {
  575. // if (this.collectionItemList[k].answerType == 'dq') {
  576. // this.collectionItemList[k].answerName = res.data.region[0].deptName;
  577. // this.collectionItemList[k].answerValue = res.data.region[0].deptCode;
  578. // }
  579. // }
  580. if (answerValue) {
  581. let findCompany = this.regionList.find((item) => item.deptCode == answerValue);
  582. this.onSalesRegionConfirm(findCompany);
  583. } else {
  584. this.onSalesRegionConfirm(this.regionList[0]);
  585. }
  586. }
  587. } else if (grade == 'xsb') {
  588. if (res.data.dept != null) {
  589. this.deptList = res.data.dept;
  590. if (answerValue) {
  591. let findCompany = this.deptList.find((item) => item.deptCode == answerValue);
  592. this.onSalesDepartmentConfirm(findCompany);
  593. } else {
  594. this.onSalesDepartmentConfirm(this.deptList[0]);
  595. }
  596. }
  597. } else if (grade == 'gs') {
  598. this.companyList = res.data.company;
  599. if (answerValue) {
  600. let findCompany = this.companyList.find((item) => item.deptCode == answerValue);
  601. this.onregionConfirm(findCompany);
  602. } else {
  603. this.onregionConfirm(this.companyList[0]);
  604. }
  605. if (res.data.dept != null) {
  606. this.deptList = res.data.dept;
  607. }
  608. if (res.data.region != null) {
  609. this.regionList = res.data.region;
  610. }
  611. }
  612. });
  613. },
  614. dailyFn(row) {
  615. if (row.status != '0') {
  616. if (row.status == -1) {
  617. var dayTime = row.showDate;
  618. var times = new Date(
  619. dayTime.slice(0, 4) + '-' + dayTime.slice(4, 6) + '-' + dayTime.slice(6, 8)
  620. ).getTime();
  621. var time = new Date('2022-08-25').getTime();
  622. if (times < time) {
  623. this.$dialog.alert({
  624. title: '系统提示',
  625. message: '非常抱歉,8月25日前历史报告数据不存在',
  626. });
  627. } else {
  628. this.$router.push({
  629. path: '/weeklyHistoricalDetils',
  630. query: { reportId: row.id },
  631. });
  632. }
  633. } else {
  634. this.$router.push({
  635. path: '/weeklyHistoricalDetils',
  636. query: { reportId: row.id },
  637. });
  638. }
  639. }
  640. },
  641. onClickLeft() {
  642. this.$router.go(-1);
  643. },
  644. regionClick(val) {
  645. // if(this.powerGrade>4){
  646. this.index = val;
  647. this.RegionShow = true;
  648. // }
  649. },
  650. SalesRegionClick(val) {
  651. this.index = val;
  652. this.SalesRegionShow = true;
  653. },
  654. SalesDepartmentClick(val) {
  655. this.index = val;
  656. this.SalesDepartmentShow = true;
  657. },
  658. StaffClick() {
  659. this.StaffShow = true;
  660. },
  661. StartTimeClick() {
  662. this.StartTimeShow = true;
  663. },
  664. EndTimeClick() {
  665. this.EndTimeShow = true;
  666. },
  667. onSalesRegionConfirm(val) {
  668. this.SalesRegionShow = false;
  669. this.regionCode = val.deptId;
  670. if (this.index != '') {
  671. this.collectionItemList[this.index].answerName = val.deptName;
  672. this.collectionItemList[this.index].answerValue = val.deptCode;
  673. } else {
  674. for (var k1 = 0; k1 < this.collectionItemList.length; k1++) {
  675. if (this.collectionItemList[k1].answerType == 'xsb') {
  676. this.collectionItemList[k1].answerName = '';
  677. this.collectionItemList[k1].answerValue = '';
  678. }
  679. if (this.collectionItemList[k1].answerType == 'dq') {
  680. this.collectionItemList[k1].answerName = val.deptName;
  681. this.collectionItemList[k1].answerValue = val.deptCode;
  682. }
  683. if (this.collectionItemList[k1].answerType == 'xsb' && val.deptId != '') {
  684. this.getDeptInfo('dept', 'xsb', this.collectionItemList[k1].answerValue);
  685. }
  686. }
  687. }
  688. // if (val.deptId != '') {
  689. // this.getDeptInfo('dept', 'xsb');
  690. // }
  691. },
  692. onregionConfirm(val) {
  693. this.RegionShow = false;
  694. this.companyCode = val.deptId;
  695. if (this.index != '') {
  696. this.collectionItemList[this.index].answerName = val.deptName;
  697. this.collectionItemList[this.index].answerValue = val.deptCode;
  698. } else {
  699. for (var k1 = 0; k1 < this.collectionItemList.length; k1++) {
  700. if (
  701. this.collectionItemList[k1].answerType == 'xsb' ||
  702. this.collectionItemList[k1].answerType == 'dq'
  703. ) {
  704. this.collectionItemList[k1].answerName = '';
  705. this.collectionItemList[k1].answerValue = '';
  706. }
  707. if (this.collectionItemList[k1].answerType == 'gs') {
  708. this.collectionItemList[k1].answerName = val.deptName;
  709. this.collectionItemList[k1].answerValue = val.deptCode;
  710. }
  711. if (this.collectionItemList[k1].answerType == 'dq') {
  712. this.getDeptInfo('dept', 'dq', this.collectionItemList[k1].answerValue);
  713. }
  714. }
  715. }
  716. },
  717. onSalesDepartmentConfirm(val) {
  718. this.SalesDepartmentShow = false;
  719. if (this.index != '') {
  720. this.collectionItemList[this.index].answerName = val.deptName;
  721. this.collectionItemList[this.index].answerValue = val.deptCode;
  722. } else {
  723. for (var k1 = 0; k1 < this.collectionItemList.length; k1++) {
  724. if (this.collectionItemList[k1].answerType == 'xsb') {
  725. this.collectionItemList[k1].answerName = val.deptName;
  726. this.collectionItemList[k1].answerValue = val.deptCode;
  727. }
  728. }
  729. }
  730. },
  731. onStartTimeConfirm(val) {
  732. this.formData.startTime = this.parseTime(new Date(val), '{y}-{m}-{d}') + '';
  733. this.StartTimeShow = false;
  734. this.endminDate = new Date(val);
  735. this.endmaxDate = new Date(this.GetPreMonthDay(this.formData.startTime, -2, 'end'));
  736. if (
  737. new Date(this.formData.startTime).getTime() > new Date(this.formData.endTime).getTime() ||
  738. new Date(this.endmaxDate).getTime() < new Date(this.formData.endTime).getTime()
  739. ) {
  740. this.formData.endTime = this.parseTime(new Date(val), '{y}-{m}-{d}') + '';
  741. this.endcurrentDate = this.GetPreMonthDay(this.formData.startTime, -2);
  742. }
  743. this.list = [];
  744. this.formData.pageNum = 1;
  745. },
  746. onEndTimeConfirm(val) {
  747. this.formData.endTime = this.parseTime(new Date(val), '{y}-{m}-{d}');
  748. this.strtmaxDate = new Date(val);
  749. if (new Date(this.formData.startTime).getTime() > new Date(this.formData.endTime).getTime()) {
  750. this.formData.startTime = this.formData.endTime;
  751. }
  752. this.list = [];
  753. this.formData.pageNum = 1;
  754. this.EndTimeShow = false;
  755. },
  756. },
  757. };
  758. </script>
  759. <style scoped>
  760. .container {
  761. background-color: white;
  762. }
  763. .van-f-red {
  764. color: red;
  765. width: 8px;
  766. display: inline-block;
  767. line-height: 26px;
  768. }
  769. .formLabel {
  770. margin: 0 16px;
  771. border-bottom: 1px solid #f1f1f1;
  772. }
  773. .formLabel .van-cell {
  774. padding: 10px 0;
  775. }
  776. .formLabel .van-cell::after {
  777. border: 0;
  778. }
  779. .formLabel .van-field {
  780. border: 1px solid #f1f1f1;
  781. padding: 6px;
  782. width: 100%;
  783. border-radius: 4px;
  784. overflow: hidden;
  785. }
  786. .formLabel .van-field__control {
  787. padding: 0 10px;
  788. }
  789. .formLabel .formLabeltitle {
  790. position: absolute;
  791. top: 8px;
  792. }
  793. .lineGrey {
  794. height: 10px;
  795. width: 100%;
  796. background: #f1f1f1;
  797. }
  798. .z-checkbox .van-radio {
  799. padding: 6px 0;
  800. }
  801. .z-cell .van-cell__title {
  802. font-size: 16px;
  803. }
  804. </style>
  805. <style>
  806. .table-headermd {
  807. font-size: 12px;
  808. text-align: center;
  809. position: initial;
  810. width: 98% !important;
  811. margin: 0 auto;
  812. border-right: 0;
  813. }
  814. .table-headermd .el-table__header,
  815. .table-headermd .el-table__body {
  816. width: 100% !important;
  817. }
  818. /*.table-headermd col {width: 6.8rem;}*/
  819. .table-headermd col:nth-child(4) {
  820. width: 5.6rem;
  821. }
  822. .table-headermd col:nth-child(2),
  823. .table-headermd col:nth-child(3) {
  824. width: 4.6rem;
  825. }
  826. .table-headermd .van-cell {
  827. padding: 0 4px;
  828. height: 100%;
  829. }
  830. .table-headermd th.el-table__cell > .cell {
  831. padding: 0 4px;
  832. text-align: center;
  833. }
  834. .table-headermd th.el-table__cell:first-child > .cell {
  835. text-align: left;
  836. }
  837. .table-headermd th.el-table__cell {
  838. background-color: #1989fa;
  839. color: #fff;
  840. }
  841. .table-headermd .el-table__cell {
  842. padding: 4px 0;
  843. }
  844. .table-headermd.el-table .cell {
  845. padding: 0;
  846. }
  847. .table-headermd .tipTitle {
  848. overflow: hidden;
  849. text-overflow: ellipsis;
  850. display: -webkit-box;
  851. -webkit-box-orient: vertical;
  852. -webkit-line-clamp: 2;
  853. }
  854. .table-headermd::before {
  855. height: 0;
  856. }
  857. .xing {
  858. color: red;
  859. padding-left: 4px;
  860. }
  861. .formLabel .van-radio__label,
  862. .formLabel .van-checkbox__label {
  863. font-size: 1.4rem;
  864. }
  865. .table-headermd .cell,
  866. .el-table--border .el-table__cell:first-child .cell {
  867. padding: 0 4px;
  868. }
  869. .van-dialog__confirm,
  870. .van-dialog__confirm:active {
  871. color: #1989fa;
  872. }
  873. .navBarTOP {
  874. position: fixed;
  875. width: 100%;
  876. z-index: 2;
  877. top: 0;
  878. }
  879. .isTableMust {
  880. padding: 4px;
  881. color: #999;
  882. margin: 0;
  883. margin-top: -10px;
  884. }
  885. </style>