index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526
  1. <template>
  2. <div class="app-container">
  3. <el-row :gutter="10">
  4. <!--机构数据-->
  5. <!-- <el-col :span="4" :xs="24">
  6. <org-tree
  7. v-model="queryParams.orgId"
  8. @defaultOrg="getDefaultOrg"
  9. @checkChange="checkChange"
  10. @click="clickTreeNode"
  11. ></org-tree>
  12. </el-col> -->
  13. <el-col :span="24" :xs="24">
  14. <div class="main-right-box">
  15. <!-- 搜索条件 -->
  16. <div class="main-search-box">
  17. <el-form
  18. :model="queryParams"
  19. ref="queryParams"
  20. size="small"
  21. :inline="true"
  22. v-show="showSearch"
  23. >
  24. <el-form-item label="履职机构">
  25. <org-tree
  26. v-model="queryParams.orgId"
  27. @defaultOrg="getDefaultOrg"
  28. @checkChange="checkChange"
  29. @click="clickTreeNode"
  30. ref="orgTree"
  31. ></org-tree>
  32. </el-form-item>
  33. <!-- <el-row>
  34. <el-col :span="5"> -->
  35. <el-form-item label="任务名称" prop="planId">
  36. <el-select
  37. v-model="queryParams.planId"
  38. filterable
  39. placeholder="请选择任务名称"
  40. clearable
  41. >
  42. <el-option
  43. v-for="item in planList"
  44. :key="item.id"
  45. :label="item.name"
  46. :value="item.id"
  47. >
  48. </el-option>
  49. </el-select>
  50. </el-form-item>
  51. <!-- </el-col>
  52. <el-col :span="5"> -->
  53. <el-form-item label="履职人员" prop="executeRole">
  54. <el-select
  55. v-model="queryParams.executeRole"
  56. placeholder="请选择履职人员"
  57. clearable
  58. >
  59. <el-option
  60. v-for="item in roleList"
  61. :key="item.id"
  62. :label="item.name"
  63. :value="item.id"
  64. ></el-option>
  65. </el-select>
  66. </el-form-item>
  67. <!-- </el-col>
  68. <el-col :span="5"> -->
  69. <el-form-item label="任务进度" prop="status">
  70. <el-select
  71. v-model="queryParams.status"
  72. placeholder="请选择任务进度"
  73. clearable
  74. >
  75. <el-option
  76. v-for="item in dict.type.resumption_status"
  77. :key="item.value"
  78. :label="item.label"
  79. :value="item.value"
  80. ></el-option>
  81. </el-select>
  82. </el-form-item>
  83. <!-- </el-col>
  84. <el-col :span="9"> -->
  85. <el-form-item class="searchTitle" label="任务时间">
  86. <DataRangePicker
  87. v-model="queryParams.range"
  88. key="daterange"
  89. type="daterange"
  90. :clearable="timeClearable"
  91. range-separator="至"
  92. start-placeholder="开始日期"
  93. end-placeholder="结束日期"
  94. />
  95. </el-form-item>
  96. <!-- </el-col>
  97. </el-row> -->
  98. </el-form>
  99. <!-- 按纽 -->
  100. <el-row :gutter="10" >
  101. <el-col :span="1.5">
  102. <el-button
  103. type="primary"
  104. icon="el-icon-search"
  105. size="mini"
  106. @click="getList"
  107. >搜索</el-button
  108. >
  109. <el-button
  110. type="primary"
  111. icon="el-icon-refresh"
  112. size="mini"
  113. @click="resetQuery"
  114. >重置</el-button
  115. >
  116. <el-button
  117. type="primary"
  118. icon="el-icon-download"
  119. size="mini"
  120. @click="exportExcel()"
  121. v-hasPermi="['resumption:taskManager:export']"
  122. >导出数据</el-button
  123. >
  124. </el-col>
  125. <right-toolbar
  126. :showSearch.sync="showSearch"
  127. @queryTable="getList"
  128. ></right-toolbar>
  129. </el-row>
  130. </div>
  131. <el-table
  132. border
  133. height="594"
  134. size="small"
  135. v-loading="loading"
  136. :data="pageData"
  137. >
  138. <el-table-column
  139. align="center"
  140. fixed
  141. width="60px"
  142. label="序号"
  143. v-if="columns[0].visible"
  144. >
  145. <template slot-scope="scope">
  146. {{
  147. (queryParams.pageNum - 1) * queryParams.pageSize +
  148. scope.$index +
  149. 1
  150. }}
  151. </template>
  152. </el-table-column>
  153. <el-table-column
  154. align="center"
  155. prop="name"
  156. label="任务名称"
  157. min-width="120"
  158. v-if="columns[1].visible"
  159. >
  160. </el-table-column>
  161. <el-table-column
  162. align="center"
  163. prop="orgName"
  164. label="履职机构"
  165. min-width="120"
  166. v-if="columns[2].visible"
  167. >
  168. </el-table-column>
  169. <el-table-column
  170. align="center"
  171. prop="roleName"
  172. label="履职人员"
  173. width="150"
  174. v-if="columns[3].visible"
  175. >
  176. </el-table-column>
  177. <el-table-column
  178. align="center"
  179. prop="status"
  180. label="任务进度"
  181. width="100px"
  182. v-if="columns[4].visible"
  183. >
  184. <template slot-scope="r">
  185. {{ getLabel(dict.type.resumption_status, r.row.status) }}
  186. </template>
  187. </el-table-column>
  188. <el-table-column
  189. align="center"
  190. prop="planStartTime"
  191. label="任务时间"
  192. width="270px"
  193. v-if="columns[5].visible"
  194. >
  195. <template slot-scope="r">
  196. {{ dayjs(r.row.planStartTime).format("YYYY年MM月DD日") }}-{{
  197. dayjs(r.row.planEndTime).format("YYYY年MM月DD日")
  198. }}
  199. </template>
  200. </el-table-column>
  201. <el-table-column
  202. align="center"
  203. prop="abnormalDataNums"
  204. label="隐患问题数"
  205. width="110"
  206. v-if="columns[6].visible"
  207. >
  208. <template slot-scope="r">
  209. <span v-if="r.row.status == 2 || r.row.status == 3">{{
  210. r.row.abnormalDataNums
  211. }}</span>
  212. </template>
  213. </el-table-column>
  214. <el-table-column
  215. align="center"
  216. label="操作"
  217. fixed="right"
  218. min-width="120px"
  219. >
  220. <template slot-scope="r">
  221. <!-- <el-button v-if="
  222. r.row.status == 'WAIT' &&
  223. queryParams.type == 'QUARTER'
  224. " type="text" @click="onEdit(r.row.id)">履职</el-button>
  225. <el-button v-else-if="
  226. r.row.status != 'NA' &&
  227. r.row.status != 'NOT' &&
  228. r.row.status != 'WAIT'
  229. " type="text" @click="onEdit(r.row.id, { isRead: true })">查看</el-button> -->
  230. <el-button
  231. type="text"
  232. icon="el-icon-view"
  233. @click="showDetail(r.row)"
  234. v-show="r.row.status == 2 || r.row.status == 3"
  235. v-hasPermi="['resumption:taskManager:query']"
  236. >详情</el-button
  237. >
  238. <el-button
  239. type="text"
  240. icon="el-icon-tickets"
  241. @click="showscanRecord(r.row)"
  242. v-show="r.row.status == 2 || r.row.status == 3"
  243. v-hasPermi="['resumption:taskManager:query']"
  244. >扫描记录</el-button
  245. >
  246. </template>
  247. </el-table-column>
  248. </el-table>
  249. <pagination
  250. v-show="total > 0"
  251. :total="total"
  252. :page.sync="queryParams.pageNum"
  253. :limit.sync="queryParams.pageSize"
  254. @pagination="getList"
  255. />
  256. </div>
  257. </el-col>
  258. </el-row>
  259. <!-- 详情 -->
  260. <dialog-detail
  261. ref="detaildialog"
  262. :statusOptions="dict.type.resumption_status"
  263. ></dialog-detail>
  264. <dialog-scan-record ref="scanrecorddialog"></dialog-scan-record>
  265. </div>
  266. </template>
  267. <script>
  268. import { mapGetters } from "vuex";
  269. // import { Message } from "element-ui";
  270. import DialogDetail from "./dialog.detail";
  271. import DialogScanRecord from "./dialog.scanrecord";
  272. import DataRangePicker from "@/components/dateTime/daterange.picker.vue";
  273. // import OrgTree from "@/components/orgTree";
  274. import OrgTree from "@/components/orgTree/orgQuerySelector.vue";
  275. import * as api from "@/api/resumption/taskManger.js";
  276. import { getLabel } from "@/views/commonOption.js";
  277. import dayjs from "dayjs";
  278. export default {
  279. name: "overviewDetialList",
  280. dicts: ["resumption_plan_cycle", "resumption_status"],
  281. components: {
  282. DialogDetail,
  283. DialogScanRecord,
  284. DataRangePicker,
  285. OrgTree
  286. },
  287. data() {
  288. let sDate = new Date();
  289. let eDate = new Date();
  290. return {
  291. loading: false,
  292. showSearch: true,
  293. total: 0,
  294. timeClearable: false,
  295. options: [],
  296. roleList: [],
  297. planList: [],
  298. queryParams: {
  299. checkSub: true,
  300. orgId: null,
  301. range: [sDate, eDate],
  302. executeRole: null,
  303. status: null,
  304. planId: null,
  305. pageNum: 1,
  306. pageSize: 10,
  307. },
  308. selectedOrgName: null,
  309. pageData: [],
  310. columns: [
  311. { key: 0, label: `序号`, visible: true },
  312. { key: 1, label: `任务名称`, visible: true },
  313. { key: 2, label: `履职机构`, visible: true },
  314. { key: 3, label: `履职人员`, visible: true },
  315. { key: 4, label: `任务进度`, visible: true },
  316. { key: 5, label: `任务时间`, visible: true },
  317. { key: 6, label: `隐患问题数`, visible: true },
  318. ],
  319. };
  320. },
  321. props: {},
  322. watch: {
  323. // org: {
  324. // deep: true,
  325. // immediate: true,
  326. // handler(nOrg) {
  327. // if (nOrg.id) {
  328. // this.queryParams.orgId = nOrg.id;
  329. // } else {
  330. // this.queryParams.orgId = this.loginUser.org.id;
  331. // }
  332. // this.roleVal = "all";
  333. // this.planVal = -1;
  334. // this.loadRoles(this.queryParams.orgId);
  335. // },
  336. // },
  337. statusVal(value) {
  338. if (value == undefined) return;
  339. if (value == "all") this.queryParams.status = null;
  340. else this.queryParams.status = value;
  341. },
  342. planVal(value) {
  343. if (value == undefined) return;
  344. if (value == -1) this.queryParams.planId = null;
  345. else this.queryParams.planId = value;
  346. },
  347. $route(v) {
  348. //this.queryParams.type = this.$route.params.type.toUpperCase();
  349. },
  350. },
  351. computed: {
  352. ...mapGetters(["orgName","orgId"]),
  353. },
  354. methods: {
  355. getLabel,
  356. dayjs,
  357. async exportExcel() {
  358. this.$tab.getCurrentTabName();
  359. if (!this.isTableHaveData) {
  360. this.$message.error({
  361. message: `无可用数据导出!`,
  362. type: "error",
  363. duration: 2000,
  364. });
  365. return;
  366. }
  367. this.download(
  368. "/core/resumption/record/export",
  369. {
  370. ...this.queryParams,
  371. },
  372. `${this.selectedOrgName}-${this.$tab.getCurrentTabName()}-${dayjs(
  373. new Date()
  374. ).format("YYYYMMDD")}.xlsx`
  375. );
  376. // await api.exportResumptionRecord(this.queryParams);
  377. },
  378. showDetail(row) {
  379. this.$refs.detaildialog.show(row.resumptionId, row.name);
  380. //this.$refs.detaildialog.show("75246a09eba74e018b60ade0b1f336f8", row.planName);
  381. },
  382. showscanRecord(row) {
  383. this.$refs.scanrecorddialog.show(row.resumptionId, row.orgId);
  384. },
  385. getDefaultOrg(node) {
  386. this.queryParams.orgId = node.id;
  387. this.selectedOrgName = node.shortName;
  388. this.getList();
  389. this.loadRoles(node.id);
  390. this.loadPlanList();
  391. },
  392. //单选框状态改变
  393. checkChange(state) {
  394. this.queryParams.checkSub = state;
  395. this.getList();
  396. },
  397. // 节点单击事件
  398. clickTreeNode(data) {
  399. if(data==null){
  400. return;
  401. }
  402. this.queryParams.orgId = data.id;
  403. this.selectedOrgName = data.shortName;
  404. this.loadPlanList();
  405. this.loadRoles(data.id);
  406. this.getList();
  407. },
  408. resetQuery() {
  409. this.resetForm("queryParams");
  410. this.queryParams.range=[new Date(),new Date()]
  411. this.queryParams.orgId = this.orgId;
  412. this.selectedOrgName = this.orgName;
  413. this.queryParams.checkSub = true;
  414. this.$refs["orgTree"].setCheckSub(this.queryParams.checkSub)
  415. // this.$refs.tree.setCurrentKey(null);
  416. this.getList();
  417. },
  418. async getList() {
  419. this.loading = true;
  420. api
  421. .page(this.queryParams)
  422. .then((r) => {
  423. this.isTableHaveData = r.rows.length > 0;
  424. this.pageData = r.rows;
  425. this.total = r.total;
  426. this.loading = false;
  427. })
  428. .catch((e) => {
  429. this.loading = false;
  430. });
  431. },
  432. loadRoles() {
  433. api
  434. .getRoles({ orgId: this.queryParams.orgId })
  435. .then((r) => (this.roleList = r.data));
  436. },
  437. loadPlanList() {
  438. api
  439. .getPlans({
  440. orgId: this.queryParams.orgId,
  441. })
  442. .then((r) => {
  443. this.planList = r.data;
  444. if (!this.planList.find((p) => p.id == this.queryParams.planId)) {
  445. this.queryParams.planId = null;
  446. }
  447. });
  448. },
  449. weekChanged() {
  450. this.updateWeekDateRange(this.week);
  451. this.resetRangeParam();
  452. },
  453. monthChanged() {
  454. this.resetRangeParam();
  455. },
  456. updateWeekDateRange(week) {
  457. let oneDayLong = 24 * 60 * 60 * 1000;
  458. let c_day = week.getDay();
  459. this.weekStart = new Date(
  460. week.valueOf() - (c_day == 0 ? 6 : c_day - 1) * oneDayLong
  461. );
  462. this.weekEnd = new Date(
  463. week.valueOf() + (c_day == 0 ? 0 : 7 - c_day) * oneDayLong
  464. );
  465. },
  466. statusColor(status, isBackground) {
  467. let color = "";
  468. switch (status) {
  469. case "1":
  470. color = "#00B0F0";
  471. break;
  472. case "2":
  473. color = "#FFC000";
  474. break;
  475. case "3":
  476. color = "#00B050";
  477. break;
  478. case "4":
  479. color = "#FF0000";
  480. break;
  481. }
  482. if (isBackground) {
  483. return "background-color:" + color;
  484. } else {
  485. return "color:" + color;
  486. }
  487. },
  488. },
  489. async mounted() {
  490. this.queryParams.orgId=this.orgId
  491. console.info("this.queryParams.orgId",this.queryParams.orgId)
  492. // let tabs=this.$tab;
  493. // debugger
  494. // const { params, query } = this.$route;
  495. // if (this.loginUser && this.loginUser.org && this.loginUser.org.id) {
  496. // if (query == undefined || query.orgId == undefined) {
  497. // this.queryParams.orgId = this.loginUser.org.id;
  498. // }
  499. // }
  500. // this.loadRoles(this.queryParams.orgId);
  501. // await this.loadtypes();
  502. // this.loadPlanList();
  503. // await this.refresh();
  504. },
  505. };
  506. </script>
  507. <style lang="scss" scoped>
  508. .el-form--inline .el-form-item {
  509. display: inline-flex;
  510. }
  511. </style>