index.vue 31 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033
  1. <template>
  2. <div class="app-container">
  3. <el-row :gutter="20">
  4. <!--机构数据-->
  5. <el-col :span="4" :xs="24">
  6. <org-tree
  7. v-model="queryParams.orgId"
  8. @defaultKey="getDefaultKey"
  9. @checkChange="checkChange"
  10. @click="clickTreeNode"
  11. ></org-tree>
  12. </el-col>
  13. <el-col :span="20" :xs="24">
  14. <!-- 搜索条件 -->
  15. <el-form
  16. :model="queryParams"
  17. ref="queryParams"
  18. size="small"
  19. :inline="true"
  20. v-show="showSearch"
  21. label-width="100px"
  22. >
  23. <el-form-item label="履职计划" prop="planId">
  24. <el-select
  25. v-model="queryParams.planId"
  26. filterable
  27. placeholder="请选择履职计划"
  28. clearable
  29. >
  30. <el-option
  31. v-for="item in planList"
  32. :key="item.id"
  33. :label="item.name"
  34. :value="item.id"
  35. >
  36. </el-option>
  37. </el-select>
  38. </el-form-item>
  39. <el-form-item label="履职角色" prop="executeRole">
  40. <el-select
  41. v-model="queryParams.executeRole"
  42. placeHolder="请选择履职角色"
  43. clearable
  44. >
  45. <el-option
  46. v-for="item in roleList"
  47. :key="item.id"
  48. :label="item.name"
  49. :value="item.id"
  50. ></el-option>
  51. </el-select>
  52. </el-form-item>
  53. <el-form-item label="履职周期" prop="executeCycle">
  54. <el-select
  55. v-model="queryParams.executeCycle"
  56. placeHolder="请选择履职周期"
  57. @change="changeType($event)"
  58. >
  59. <el-option
  60. v-for="item in dict.type.resumption_plan_cycle"
  61. :key="item.value"
  62. :label="item.label"
  63. :value="item.value"
  64. ></el-option>
  65. </el-select>
  66. </el-form-item>
  67. <el-form-item label="任务状态" prop="status">
  68. <el-select
  69. v-model="queryParams.status"
  70. placeHolder="请选择任务状态"
  71. clearable
  72. >
  73. <el-option
  74. v-for="item in dict.type.resumption_status"
  75. :key="item.value"
  76. :label="item.label"
  77. :value="item.value"
  78. ></el-option>
  79. </el-select>
  80. </el-form-item>
  81. <el-form-item
  82. class="searchTitle"
  83. label="计划时间"
  84. v-if="
  85. queryParams.executeCycle == 1 ||
  86. queryParams.executeCycle == 2 ||
  87. queryParams.executeCycle == null
  88. "
  89. >
  90. <DataRangePicker
  91. v-model="queryParams.range"
  92. key="daterange"
  93. type="daterange"
  94. :clearable="timeClearable"
  95. />
  96. </el-form-item>
  97. <el-form-item
  98. class="searchTitle"
  99. label="计划时间"
  100. v-if="queryParams.executeCycle == 3"
  101. >
  102. <!-- :format='weekStart+" 到 "+weekEnd+ 第WW周' format=" yyyy 第 WW 周"-->
  103. <el-date-picker
  104. :picker-options="{ firstDayOfWeek: 1 }"
  105. key="week"
  106. v-model="week"
  107. @change="weekChanged"
  108. :clearable="timeClearable"
  109. type="week"
  110. format=" yyyy 第 WW 周"
  111. placeholder="选择周"
  112. >
  113. </el-date-picker>
  114. </el-form-item>
  115. <el-form-item
  116. class="searchTitle"
  117. label="计划时间"
  118. v-if="queryParams.executeCycle == 4"
  119. >
  120. <el-date-picker
  121. v-model="monthRange"
  122. @change="monthChanged"
  123. type="monthrange"
  124. key="monthRange"
  125. align="right"
  126. :clearable="timeClearable"
  127. unlink-panels
  128. range-separator="-"
  129. start-placeholder="开始月份"
  130. end-placeholder="结束月份"
  131. />
  132. </el-form-item>
  133. <el-form-item
  134. class="searchTitle"
  135. label="计划时间"
  136. v-if="queryParams.executeCycle == 5"
  137. >
  138. <el-date-picker
  139. :clearable="timeClearable"
  140. type="year"
  141. align="right"
  142. key="quarterSyearS"
  143. v-model="yearS"
  144. />
  145. -
  146. <el-select v-model="quarterS" placeholder="请选择">
  147. <el-option
  148. v-for="item in optionsQS"
  149. :key="item.key"
  150. :label="item.text"
  151. :value="item.value"
  152. :clearable="timeClearable"
  153. />
  154. </el-select>
  155. <label
  156. class="el-form-item__label"
  157. style="margin: 0 10px; padding: 0"
  158. >至</label
  159. >
  160. <el-date-picker
  161. :clearable="timeClearable"
  162. type="year"
  163. v-model="yearE"
  164. key="quarterSyearE"
  165. align="right"
  166. />
  167. -
  168. <el-select v-model="quarterE" placeholder="请选择">
  169. <el-option
  170. v-for="item in optionsQE"
  171. :key="item.key"
  172. :label="item.text"
  173. :value="item.value"
  174. :clearable="timeClearable"
  175. />
  176. </el-select>
  177. </el-form-item>
  178. <el-form-item label="计划时间" v-if="queryParams.executeCycle == 6">
  179. <el-date-picker
  180. :clearable="timeClearable"
  181. type="year"
  182. align="right"
  183. key="halfyearS"
  184. v-model="yearS"
  185. />
  186. -
  187. <el-select v-model="halfyearS" placeholder="请选择">
  188. <el-option
  189. v-for="item in optionsHS"
  190. :key="item.key"
  191. :label="item.text"
  192. :value="item.value"
  193. :clearable="timeClearable"
  194. />
  195. </el-select>
  196. <label
  197. class="el-form-item__label"
  198. style="margin: 0 10px; padding: 0"
  199. >至</label
  200. >
  201. <el-date-picker
  202. :clearable="timeClearable"
  203. type="year"
  204. v-model="yearE"
  205. key="halfyearE"
  206. align="right"
  207. />
  208. -
  209. <el-select v-model="halfyearE" placeholder="请选择">
  210. <el-option
  211. v-for="item in optionsHE"
  212. :key="item.key"
  213. :label="item.text"
  214. :value="item.value"
  215. :clearable="timeClearable"
  216. />
  217. </el-select>
  218. </el-form-item>
  219. <el-form-item
  220. class="searchTitle"
  221. label="计划时间"
  222. v-if="queryParams.executeCycle == 7"
  223. >
  224. <el-date-picker
  225. :clearable="timeClearable"
  226. type="year"
  227. align="right"
  228. v-model="yearS"
  229. key="yearS"
  230. />
  231. <label
  232. class="el-form-item__label"
  233. style="margin: 0 10px; padding: 0"
  234. >至</label
  235. >
  236. <el-date-picker
  237. :clearable="timeClearable"
  238. type="year"
  239. v-model="yearE"
  240. align="right"
  241. key="yearE"
  242. />
  243. </el-form-item>
  244. <el-form-item>
  245. <el-button
  246. type="primary"
  247. icon="el-icon-search"
  248. size="mini"
  249. @click="getList"
  250. >搜索</el-button
  251. >
  252. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
  253. >重置</el-button
  254. >
  255. </el-form-item>
  256. </el-form>
  257. <!-- 按纽 -->
  258. <el-row :gutter="10" class="mb8">
  259. <el-col :span="1.5">
  260. <el-button
  261. type="primary"
  262. plain
  263. icon="el-icon-download"
  264. size="mini"
  265. @click="exportExcel()"
  266. v-hasPermi="['resumption:taskManager:export']"
  267. >导出</el-button
  268. >
  269. </el-col>
  270. <right-toolbar
  271. :showSearch.sync="showSearch"
  272. @queryTable="getList"
  273. :columns="columns"
  274. ></right-toolbar>
  275. </el-row>
  276. <el-table v-loading="loading" :data="pageData">
  277. <el-table-column
  278. type="index"
  279. min-width="4%"
  280. label="序号"
  281. v-if="columns[0].visible"
  282. >
  283. </el-table-column>
  284. <el-table-column
  285. prop="name"
  286. label="任务名称"
  287. min-width="20%"
  288. v-if="columns[1].visible"
  289. >
  290. </el-table-column>
  291. <el-table-column
  292. prop="planStartTime"
  293. label="任务开始时间"
  294. min-width="15%"
  295. v-if="columns[2].visible"
  296. />
  297. <el-table-column
  298. prop="planEndTime"
  299. label="任务结束时间"
  300. min-width="15%"
  301. v-if="columns[3].visible"
  302. />
  303. <el-table-column
  304. prop="parentOrgName"
  305. label="上级机构"
  306. min-width="15%"
  307. v-if="columns[4].visible"
  308. >
  309. </el-table-column>
  310. <el-table-column
  311. prop="orgName"
  312. label="履职机构"
  313. min-width="15%"
  314. v-if="columns[5].visible"
  315. >
  316. </el-table-column>
  317. <el-table-column
  318. prop="roleName"
  319. label="履职角色"
  320. min-width="10%"
  321. v-if="columns[6].visible"
  322. >
  323. </el-table-column>
  324. <el-table-column
  325. prop="submitter"
  326. label="提交人"
  327. min-width="10%"
  328. v-if="columns[7].visible"
  329. ></el-table-column>
  330. <el-table-column
  331. label="提交时间"
  332. min-width="15%"
  333. v-if="columns[8].visible"
  334. >
  335. <template slot-scope="r">{{
  336. r.row.submitTime | dateTime
  337. }}</template>
  338. </el-table-column>
  339. <el-table-column
  340. prop="abnormalDataNums"
  341. label="异常个数"
  342. min-width="9%"
  343. v-if="columns[8].visible"
  344. >
  345. </el-table-column>
  346. <el-table-column
  347. prop="status"
  348. label="任务状态"
  349. width="100px"
  350. v-if="columns[9].visible"
  351. >
  352. <template slot-scope="r">
  353. <span>
  354. <i class="circle" :style="statusColor(r.row.status, true)" />
  355. <label :style="statusColor(r.row.status, false)">
  356. {{
  357. getLabel(dict.type.resumption_status, r.row.status)
  358. }}</label
  359. >
  360. </span>
  361. </template>
  362. </el-table-column>
  363. <el-table-column label="操作" min-width="13%">
  364. <template slot-scope="r">
  365. <!-- <el-button v-if="
  366. r.row.status == 'WAIT' &&
  367. queryParams.type == 'QUARTER'
  368. " type="text" @click="onEdit(r.row.id)">履职</el-button>
  369. <el-button v-else-if="
  370. r.row.status != 'NA' &&
  371. r.row.status != 'NOT' &&
  372. r.row.status != 'WAIT'
  373. " type="text" @click="onEdit(r.row.id, { isRead: true })">查看</el-button> -->
  374. <el-button
  375. type="text"
  376. @click="showDetail(r.row)"
  377. v-show="r.row.status == 2 || r.row.status == 3"
  378. v-hasPermi="['resumption:taskManager:query']"
  379. >查看</el-button
  380. >
  381. <el-button
  382. type="text"
  383. @click="showscanRecord(r.row)"
  384. v-show="r.row.status == 2 || r.row.status == 3"
  385. v-hasPermi="['resumption:taskManager:query']"
  386. >扫描记录</el-button
  387. >
  388. </template>
  389. </el-table-column>
  390. </el-table>
  391. <pagination
  392. v-show="total > 0"
  393. :total="total"
  394. :page.sync="queryParams.pageNum"
  395. :limit.sync="queryParams.pageSize"
  396. @pagination="getList"
  397. />
  398. </el-col>
  399. </el-row>
  400. <!-- 详情 -->
  401. <dialog-detail ref="detaildialog"></dialog-detail>
  402. <dialog-scan-record ref="scanrecorddialog"></dialog-scan-record>
  403. </div>
  404. </template>
  405. <script>
  406. import {mapGetters } from "vuex";
  407. // import { Message } from "element-ui";
  408. import DialogDetail from "./dialog.detail";
  409. import DialogScanRecord from "./dialog.scanrecord";
  410. import DataRangePicker from "@/components/dateTime/daterange.picker.vue";
  411. import OrgTree from "@/components/orgTree";
  412. import * as api from "@/api/resumption/taskManger.js";
  413. import { getLabel } from "@/views/commonOption.js";
  414. import dayjs from "dayjs";
  415. export default {
  416. name: "overviewDetialList",
  417. dicts: ["resumption_plan_cycle", "resumption_status"],
  418. components: { DialogDetail, DialogScanRecord, DataRangePicker, OrgTree },
  419. data() {
  420. // const { params, query } = this.$route;
  421. let sDate = new Date();
  422. let eDate = new Date();
  423. // if (query.startDate != undefined) {
  424. // sDate = new Date(query.startDate);
  425. // }
  426. // if (query.endDate != undefined) {
  427. // eDate = new Date(query.endDate);
  428. // }
  429. // let tempType = 1;
  430. // let tempOrgId = 1;
  431. // let tempRole = null;
  432. // let tempstatus = null;
  433. // if (query.executeCycle != undefined) tempType = query.executeCycle;
  434. // if (query.orgId != undefined) tempOrgId = parseInt(query.orgId);
  435. // else {
  436. // if (
  437. // this.loginUser != undefined &&
  438. // this.loginUser.org != undefined &&
  439. // this.loginUser.org.id != undefined
  440. // )
  441. // tempOrgId = parseInt(this.loginUser.org.id);
  442. // }
  443. // if (query.executeRole != undefined && query.executeRole != "all")
  444. // tempRole = query.executeRole;
  445. // if (query.status != undefined && query.status != "all")
  446. // tempstatus = query.status;
  447. let temphalfyearE = 1;
  448. let temphalfyearS = 1;
  449. let tempquarterE = 1;
  450. let tempquarterS = 1;
  451. // if (query.halfyearE != undefined) temphalfyearE = parseInt(query.halfyearE);
  452. // if (query.halfyearS != undefined) temphalfyearS = parseInt(query.halfyearS);
  453. // if (query.quarterE != undefined) tempquarterE = parseInt(query.quarterE);
  454. // if (query.quarterS != undefined) tempquarterS = parseInt(query.quarterS);
  455. return {
  456. loading: false,
  457. showSearch: true,
  458. total: 0,
  459. timeClearable: false,
  460. options: [],
  461. roleList: [],
  462. planList: [],
  463. yearS: sDate,
  464. yearE: eDate,
  465. halfyearE: temphalfyearE,
  466. halfyearS: temphalfyearS,
  467. quarterE: tempquarterE,
  468. quarterS: tempquarterS,
  469. monthRange: [sDate, eDate],
  470. week: sDate,
  471. weekStart: null,
  472. weekEnd: null,
  473. optionsHS: [
  474. { key: "1", value: 1, text: "上半年" },
  475. { key: "2", value: 2, text: "下半年" },
  476. ],
  477. optionsHE: [
  478. { key: "1", value: 1, text: "上半年" },
  479. { key: "2", value: 2, text: "下半年" },
  480. ],
  481. optionsQS: [
  482. { key: "1", value: 1, text: "第一季度" },
  483. { key: "2", value: 2, text: "第二季度" },
  484. { key: "3", value: 3, text: "第三季度" },
  485. { key: "4", value: 4, text: "第四季度" },
  486. ],
  487. optionsQE: [
  488. { key: "1", value: 1, text: "第一季度" },
  489. { key: "2", value: 2, text: "第二季度" },
  490. { key: "3", value: 3, text: "第三季度" },
  491. { key: "4", value: 4, text: "第四季度" },
  492. ],
  493. queryParams: {
  494. executeCycle: "2",
  495. checkSub: true,
  496. orgId: null,
  497. range: [sDate, eDate],
  498. executeRole: null,
  499. status: null,
  500. planId: null,
  501. pageNum: 1,
  502. pageSize: 10,
  503. },
  504. selectedOrgName:null,
  505. pageData: [],
  506. columns: [
  507. { key: 0, label: `序号`, visible: true },
  508. { key: 1, label: `计划名称`, visible: true },
  509. { key: 2, label: `开始时间`, visible: true },
  510. { key: 3, label: `结束时间`, visible: true },
  511. { key: 4, label: `上级机构`, visible: true },
  512. { key: 5, label: `履职机构`, visible: true },
  513. { key: 6, label: `履职角色`, visible: true },
  514. { key: 2, label: `提交人`, visible: true },
  515. { key: 3, label: `提交时间`, visible: true },
  516. { key: 4, label: `异常个数`, visible: true },
  517. { key: 5, label: `任务状态`, visible: true },
  518. ],
  519. };
  520. },
  521. props: {},
  522. watch: {
  523. // org: {
  524. // deep: true,
  525. // immediate: true,
  526. // handler(nOrg) {
  527. // if (nOrg.id) {
  528. // this.queryParams.orgId = nOrg.id;
  529. // } else {
  530. // this.queryParams.orgId = this.loginUser.org.id;
  531. // }
  532. // this.roleVal = "all";
  533. // this.planVal = -1;
  534. // this.loadRoles(this.queryParams.orgId);
  535. // },
  536. // },
  537. statusVal(value) {
  538. if (value == undefined) return;
  539. if (value == "all") this.queryParams.status = null;
  540. else this.queryParams.status = value;
  541. },
  542. planVal(value) {
  543. if (value == undefined) return;
  544. if (value == -1) this.queryParams.planId = null;
  545. else this.queryParams.planId = value;
  546. },
  547. $route(v) {
  548. //this.queryParams.type = this.$route.params.type.toUpperCase();
  549. },
  550. // 0每日;1每周;2每月;3每季度;4每半年;5每年
  551. yearS(val) {
  552. if (this.yearE < val) {
  553. this.yearE = val;
  554. if (this.queryParams.executeCycle == 3) {
  555. if (this.quarterS > this.quarterE) {
  556. this.quarterS = this.quarterE;
  557. } else this.resetRangeParam();
  558. } else if (this.queryParams.executeCycle == 4) {
  559. if (this.halfyearS > this.halfyearE) {
  560. this.halfyearS = this.quarterE;
  561. } else this.resetRangeParam();
  562. }
  563. } else this.resetRangeParam();
  564. },
  565. yearE(val) {
  566. if (val < this.yearS) {
  567. this.yearS = val;
  568. if (this.queryParams.executeCycle == 3) {
  569. if (this.quarterS > this.quarterE) {
  570. this.quarterS = this.quarterE;
  571. } else this.resetRangeParam();
  572. } else if (this.queryParams.executeCycle == 4) {
  573. if (this.halfyearS > this.halfyearE) {
  574. this.halfyearS = this.halfyearE;
  575. } else this.resetRangeParam();
  576. }
  577. } else this.resetRangeParam();
  578. },
  579. quarterS(val) {
  580. if (this.yearS == this.yearE) {
  581. if (val > this.quarterE) this.quarterE = val;
  582. else this.resetRangeParam();
  583. } else this.resetRangeParam();
  584. },
  585. quarterE(val) {
  586. if (this.yearS == this.yearE) {
  587. if (val < this.quarterS) this.quarterS = val;
  588. else this.resetRangeParam();
  589. } else this.resetRangeParam();
  590. },
  591. halfyearS(val) {
  592. console.log("ccccccccc", val);
  593. if (this.yearS == this.yearE) {
  594. if (val > this.halfyearE) this.halfyearE = val;
  595. else this.resetRangeParam();
  596. } else this.resetRangeParam();
  597. },
  598. halfyearE(val) {
  599. console.log("dddddddddd", val);
  600. if (this.yearS == this.yearE) {
  601. if (val < this.halfyearS) this.halfyearS = val;
  602. else this.resetRangeParam();
  603. } else this.resetRangeParam();
  604. },
  605. monthRange(val) {
  606. this.resetRangeParam();
  607. },
  608. },
  609. computed: {
  610. ...mapGetters(["orgName"])
  611. },
  612. methods: {
  613. getLabel,
  614. toName(row) {
  615. // const ymd = row.ymd;
  616. const ymd = new Date(row.ymdDate);
  617. switch (row.executeCycle) {
  618. case 0:
  619. return `${ymd.year}年${ymd.month}月${ymd.day}日-${row.formTypeText}`;
  620. case 1:
  621. return `${ymd.year}年第${ymd.week}周-${row.formTypeText}`;
  622. case 2:
  623. return `${ymd.year}年第${ymd.month}月`;
  624. case 3:
  625. return `${ymd.year}年第${ymd.quarter}季`;
  626. case 4:
  627. let text = ymd.halfyear == 1 ? "上" : "下";
  628. return `${ymd.year}年${text}每半年`;
  629. case 5:
  630. return `${ymd.year}年`;
  631. case 6:
  632. return `${ymd.year}年${ymd.month}月${ymd.day}日${ymd.hour}小时${ymd.minute}分钟-${row.formTypeText}`;
  633. }
  634. },
  635. async exportExcel() {
  636. if (!this.isTableHaveData) {
  637. this.$message.error({
  638. message: `暂无可用数据导出!`,
  639. type: "error",
  640. duration: 2000,
  641. });
  642. return;
  643. }
  644. this.download('/core/resumption/record/export', {
  645. ...this.queryParams
  646. }, `【${this.selectedOrgName}】-履职记录${new Date().getTime()}.xlsx`)
  647. // await api.exportResumptionRecord(this.queryParams);
  648. },
  649. showDetail(row) {
  650. this.$refs.detaildialog.show(row.resumptionId, row.name);
  651. //this.$refs.detaildialog.show("75246a09eba74e018b60ade0b1f336f8", row.planName);
  652. },
  653. showscanRecord(row) {
  654. this.$refs.scanrecorddialog.show(row.resumptionId, row.orgId);
  655. },
  656. getDefaultKey(key) {
  657. this.queryParams.orgId = key;
  658. this.selectedOrgName=this.orgName;
  659. this.getList();
  660. this.loadRoles(key);
  661. this.loadPlanList();
  662. },
  663. //单选框状态改变
  664. checkChange(state) {
  665. this.queryParams.checkSub = state;
  666. this.getList();
  667. },
  668. // 节点单击事件
  669. clickTreeNode(data) {
  670. this.queryParams.orgId = data.id;
  671. this.selectedOrgName=data.name;
  672. this.loadPlanList();
  673. this.loadRoles();
  674. this.getList();
  675. },
  676. resetQuery() {
  677. this.resetForm("queryParams");
  678. this.queryParams.executeCycle = "2";
  679. this.changeType("2");
  680. // this.queryParams.orgId = undefined;
  681. // this.queryParams.checkSub = false;
  682. // this.$refs.tree.setCurrentKey(null);
  683. this.getList();
  684. },
  685. async getList() {
  686. this.loading = true;
  687. api
  688. .page(this.queryParams)
  689. .then((r) => {
  690. this.isTableHaveData = r.rows.length > 0;
  691. this.pageData = r.rows;
  692. this.total = r.total;
  693. this.loading = false;
  694. })
  695. .catch((e) => {
  696. this.loading = false;
  697. });
  698. },
  699. loadRoles() {
  700. api
  701. .getRoles({
  702. orgId: this.queryParams.orgId,
  703. planCycle: this.queryParams.executeCycle,
  704. })
  705. .then((r) => (this.roleList = r.data));
  706. },
  707. loadPlanList() {
  708. api
  709. .getPlans({
  710. orgId: this.queryParams.orgId,
  711. planCycle: this.queryParams.executeCycle,
  712. })
  713. .then((r) => {
  714. this.planList = r.data;
  715. });
  716. },
  717. async changeType(selectValue) {
  718. // console.log("selectValue",selectValue.target.value)
  719. // this.planVal = -1;
  720. this.queryParams.executeCycle = selectValue;
  721. let nowDate = new Date();
  722. let nowMonth = nowDate.getMonth();
  723. if (nowMonth <= 2) {
  724. this.quarterS = 1;
  725. this.quarterE = 1;
  726. this.halfyearS = 1;
  727. this.halfyearE = 1;
  728. } else if (nowMonth <= 5) {
  729. this.quarterS = 2;
  730. this.quarterE = 2;
  731. this.halfyearS = 1;
  732. this.halfyearE = 1;
  733. } else if (nowMonth <= 8) {
  734. this.quarterS = 3;
  735. this.quarterE = 3;
  736. this.halfyearS = 2;
  737. this.halfyearE = 2;
  738. } else if (nowMonth <= 11) {
  739. this.quarterS = 4;
  740. this.quarterE = 4;
  741. this.halfyearS = 2;
  742. this.halfyearE = 2;
  743. }
  744. // 1每小时;2每天.......;3每月;4每季度;4每半年;5每年
  745. if (this.queryParams.executeCycle == 3) {
  746. if (!this.week) this.week = new Date();
  747. this.updateWeekDateRange(this.week);
  748. }
  749. this.resetRangeParam();
  750. this.loadPlanList();
  751. this.loadRoles();
  752. },
  753. weekChanged() {
  754. this.updateWeekDateRange(this.week);
  755. this.resetRangeParam();
  756. },
  757. monthChanged() {
  758. this.resetRangeParam();
  759. },
  760. updateWeekDateRange(week) {
  761. let oneDayLong = 24 * 60 * 60 * 1000;
  762. let c_day = week.getDay();
  763. this.weekStart = new Date(
  764. week.valueOf() - (c_day == 0 ? 6 : c_day - 1) * oneDayLong
  765. );
  766. this.weekEnd = new Date(
  767. week.valueOf() + (c_day == 0 ? 0 : 7 - c_day) * oneDayLong
  768. );
  769. },
  770. async resetRangeParam() {
  771. if (this.queryParams.executeCycle == 5) {
  772. let yearSval = this.yearS.getFullYear();
  773. let yearEval = this.yearE.getFullYear();
  774. let sQDate = yearSval + "-";
  775. let eQData = yearEval + "-";
  776. switch (this.quarterS) {
  777. case 1:
  778. sQDate += "01-01";
  779. break;
  780. case 2:
  781. sQDate += "04-01";
  782. break;
  783. case 3:
  784. sQDate += "07-01";
  785. break;
  786. case 4:
  787. sQDate += "10-01";
  788. break;
  789. }
  790. switch (this.quarterE) {
  791. case 1:
  792. eQData += "03-31";
  793. break;
  794. case 2:
  795. eQData += "06-30";
  796. break;
  797. case 3:
  798. eQData += "09-30";
  799. break;
  800. case 4:
  801. eQData += "12-31";
  802. break;
  803. }
  804. this.queryParams.range = [new Date(sQDate), new Date(eQData)];
  805. } else if (this.queryParams.executeCycle == 6) {
  806. let yearSval = this.yearS.getFullYear();
  807. let yearEval = this.yearE.getFullYear();
  808. let sHDate = yearSval + "-";
  809. let eHData = yearEval + "-";
  810. switch (this.halfyearS) {
  811. case 1:
  812. sHDate += "01-01";
  813. break;
  814. case 2:
  815. sHDate += "07-01";
  816. break;
  817. }
  818. switch (this.halfyearE) {
  819. case 1:
  820. eHData += "06-30";
  821. break;
  822. case 2:
  823. eHData += "12-31";
  824. break;
  825. }
  826. this.queryParams.range = [new Date(sHDate), new Date(eHData)];
  827. } else if (this.queryParams.executeCycle == 7) {
  828. let yearSval = this.yearS.getFullYear();
  829. let yearEval = this.yearE.getFullYear();
  830. let sYDate = yearSval + "-01-01";
  831. let eYData = yearEval + "-12-31";
  832. this.queryParams.range = [new Date(sYDate), new Date(eYData)];
  833. } else if (this.queryParams.executeCycle == 4) {
  834. if (!this.monthRange || this.monthRange.length != 2) {
  835. this.queryParams.range = null;
  836. } else {
  837. let dateObjS = this.monthRange[0];
  838. let dateObjE = this.monthRange[1];
  839. if (dateObjS.getFullYear == undefined) {
  840. dateObjS = new Date(dateObjS);
  841. dateObjE = new Date(dateObjE);
  842. }
  843. let sMDate =
  844. dateObjS.getFullYear() + "-" + (dateObjS.getMonth() + 1) + "-1";
  845. let eMData =
  846. dateObjE.getFullYear() + "-" + (dateObjE.getMonth() + 1) + "-1";
  847. let tempDate = new Date(
  848. dateObjE.getFullYear(),
  849. dateObjE.getMonth(),
  850. 29
  851. );
  852. if (dateObjE.getMonth() == 1 && tempDate.getDate() === 29) {
  853. eMData =
  854. dateObjE.getFullYear() + "-" + (dateObjE.getMonth() + 1) + "-29";
  855. } else {
  856. switch (dateObjE.getMonth()) {
  857. case 0:
  858. eMData =
  859. dateObjE.getFullYear() +
  860. "-" +
  861. (dateObjE.getMonth() + 1) +
  862. "-31";
  863. break;
  864. case 1:
  865. eMData =
  866. dateObjE.getFullYear() +
  867. "-" +
  868. (dateObjE.getMonth() + 1) +
  869. "-28";
  870. break;
  871. case 2:
  872. eMData =
  873. dateObjE.getFullYear() +
  874. "-" +
  875. (dateObjE.getMonth() + 1) +
  876. "-31";
  877. break;
  878. case 3:
  879. eMData =
  880. dateObjE.getFullYear() +
  881. "-" +
  882. (dateObjE.getMonth() + 1) +
  883. "-30";
  884. break;
  885. case 4:
  886. eMData =
  887. dateObjE.getFullYear() +
  888. "-" +
  889. (dateObjE.getMonth() + 1) +
  890. "-31";
  891. break;
  892. case 5:
  893. eMData =
  894. dateObjE.getFullYear() +
  895. "-" +
  896. (dateObjE.getMonth() + 1) +
  897. "-30";
  898. break;
  899. case 6:
  900. eMData =
  901. dateObjE.getFullYear() +
  902. "-" +
  903. (dateObjE.getMonth() + 1) +
  904. "-31";
  905. break;
  906. case 7:
  907. eMData =
  908. dateObjE.getFullYear() +
  909. "-" +
  910. (dateObjE.getMonth() + 1) +
  911. "-31";
  912. break;
  913. case 8:
  914. eMData =
  915. dateObjE.getFullYear() +
  916. "-" +
  917. (dateObjE.getMonth() + 1) +
  918. "-30";
  919. break;
  920. case 9:
  921. eMData =
  922. dateObjE.getFullYear() +
  923. "-" +
  924. (dateObjE.getMonth() + 1) +
  925. "-31";
  926. break;
  927. case 10:
  928. eMData =
  929. dateObjE.getFullYear() +
  930. "-" +
  931. (dateObjE.getMonth() + 1) +
  932. "-30";
  933. break;
  934. case 11:
  935. eMData =
  936. dateObjE.getFullYear() +
  937. "-" +
  938. (dateObjE.getMonth() + 1) +
  939. "-31";
  940. break;
  941. }
  942. }
  943. this.queryParams.range = [new Date(sMDate), new Date(eMData)];
  944. }
  945. } else if (this.queryParams.executeCycle == 3) {
  946. this.queryParams.range = [this.weekStart, this.weekEnd];
  947. } else if (
  948. this.queryParams.executeCycle === 1 ||
  949. this.queryParams.executeCycle == 2
  950. ) {
  951. this.queryParams.range = this.$dateRange.before(0);
  952. }
  953. },
  954. statusColor(status, isBackground) {
  955. let color = "";
  956. switch (status) {
  957. case "1":
  958. color = "#BFBFBF";
  959. break;
  960. case "2":
  961. color = "#1890FF";
  962. break;
  963. case "3":
  964. color = "#52C41A";
  965. break;
  966. case "4":
  967. color = "#F5222D";
  968. break;
  969. }
  970. if (isBackground) {
  971. return "background-color:" + color;
  972. } else {
  973. return "color:" + color;
  974. }
  975. },
  976. },
  977. async mounted() {
  978. // const { params, query } = this.$route;
  979. // if (this.loginUser && this.loginUser.org && this.loginUser.org.id) {
  980. // if (query == undefined || query.orgId == undefined) {
  981. // this.queryParams.orgId = this.loginUser.org.id;
  982. // }
  983. // }
  984. // this.loadRoles(this.queryParams.orgId);
  985. // await this.loadtypes();
  986. // this.loadPlanList();
  987. // await this.refresh();
  988. },
  989. };
  990. </script>
  991. <style lang="scss">
  992. // .searchItem {
  993. // margin-right: 10px;
  994. // margin-top: 5px;
  995. // margin-bottom: 5px;
  996. // }
  997. // .searchTitle {
  998. // margin-right: 10px !important;
  999. // margin-bottom: 0 !important;
  1000. // margin-top: 0 !important;
  1001. // }
  1002. </style>