VisitSummaryAdd.vue 30 KB

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