detailItem.vue 28 KB

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