index.vue 14 KB

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