index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575
  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. :businessTree="true"
  12. ></org-tree>
  13. </el-col>
  14. <el-col :span="20" :xs="24">
  15. <!-- 搜索条件 -->
  16. <el-form
  17. :model="queryParams"
  18. ref="queryParams"
  19. size="small"
  20. :inline="true"
  21. v-show="showSearch"
  22. label-width="100px"
  23. >
  24. <el-form-item label="任务名称" prop="title">
  25. <el-input
  26. style="width: 200px"
  27. v-model="queryParams.title"
  28. placeholder="请输入任务名称"
  29. clearable
  30. @keyup.enter.native="handleQuery"
  31. :maxlength="50"
  32. @input="inputTitle"
  33. />
  34. </el-form-item>
  35. <el-form-item label="检查人员" prop="roleId">
  36. <el-select
  37. v-model="queryParams.roleId"
  38. placeholder="请选择用户角色"
  39. clearable
  40. >
  41. <el-option
  42. v-for="item in selectRoleOptions"
  43. :key="item.id"
  44. :label="item.roleName"
  45. :value="item.id"
  46. ></el-option>
  47. </el-select>
  48. </el-form-item>
  49. <el-form-item label="受检机构" prop="orgName">
  50. <!-- <el-input
  51. v-model="queryParams.orgName"
  52. placeholder="请输入受检机构"
  53. clearable
  54. @keyup.enter.native="handleQuery"
  55. :maxlength="50" @input="inputRestriction"
  56. /> -->
  57. <div style="width: 200px; height: 30px">
  58. <org-tree-select
  59. size="mini"
  60. v-model="queryParams.checkOrgIds"
  61. ref="checkorgTreeSelect"
  62. :disable="true"
  63. @change="getList"
  64. >
  65. </org-tree-select>
  66. </div>
  67. </el-form-item>
  68. <el-form-item label="任务进度" prop="status">
  69. <el-select
  70. style="width: 200px"
  71. v-model="queryParams.status"
  72. placeHolder="请选择任务进度"
  73. clearable
  74. >
  75. <el-option
  76. v-for="item in dict.type.safety_check_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-form-item label="检查周期" prop="executeCycle">
  84. <el-select
  85. v-model="queryParams.executeCycle"
  86. placeHolder="请选择检查周期"
  87. @change="changeType($event)"
  88. >
  89. <el-option
  90. v-for="item in dict.type.resumption_plan_cycle"
  91. :key="item.value"
  92. :label="item.label"
  93. :value="item.value"
  94. ></el-option>
  95. </el-select>
  96. </el-form-item> -->
  97. <!-- <el-form-item
  98. class="searchTitle"
  99. label="开始日期"
  100. prop="planStartTime"
  101. >
  102. <el-date-picker
  103. style="width: 200px;"
  104. v-model="queryParams.planStartTime"
  105. :clearable="timeClearable"
  106. type="date"
  107. placeholder="选择时间"
  108. value-format="yyyy-MM-dd"
  109. @change="updatePlanStartTime"
  110. >
  111. </el-date-picker>
  112. </el-form-item> -->
  113. <el-form-item
  114. class="searchTitle"
  115. label="任务时间"
  116. prop="planStartTime"
  117. >
  118. <el-date-picker
  119. type="daterange"
  120. value-format="yyyy-MM-dd HH:mm:ss"
  121. :default-time="['00:00:00', '23:59:59']"
  122. start-placeholder="开始日期"
  123. end-placeholder="结束日期"
  124. v-model="queryParams.range"
  125. :picker-options="pickerOptions"
  126. >
  127. </el-date-picker>
  128. </el-form-item>
  129. <el-row>
  130. <el-form-item style="margin-left: 35px">
  131. <el-button
  132. type="primary"
  133. icon="el-icon-search"
  134. size="mini"
  135. @click="getList"
  136. >搜索</el-button
  137. >
  138. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
  139. >重置</el-button
  140. >
  141. <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd"
  142. >临时登记</el-button
  143. >
  144. </el-form-item>
  145. </el-row>
  146. </el-form>
  147. <!-- 按纽 -->
  148. <el-row :gutter="10" class="mb8">
  149. <!-- <el-col :span="1.5">
  150. <el-button
  151. type="primary"
  152. plain
  153. icon="el-icon-download"
  154. size="mini"
  155. @click="exportExcel()"
  156. v-hasPermi="['resumption:taskManager:export']"
  157. >导出</el-button
  158. >
  159. </el-col> -->
  160. <right-toolbar
  161. :showSearch.sync="showSearch"
  162. @queryTable="getList"
  163. :columns="columns"
  164. ></right-toolbar>
  165. </el-row>
  166. <el-table
  167. border
  168. height="600"
  169. size="small"
  170. v-loading="loading"
  171. :data="pageData"
  172. >
  173. <el-table-column
  174. type="index"
  175. fixed
  176. min-width="50"
  177. label="序号"
  178. v-if="columns[0].visible"
  179. >
  180. </el-table-column>
  181. <el-table-column
  182. prop="title"
  183. label="任务名称"
  184. min-width="120"
  185. v-if="columns[1].visible"
  186. >
  187. </el-table-column>
  188. <el-table-column
  189. prop="checkOrgName"
  190. label="检查主体"
  191. min-width="140"
  192. v-if="columns[5].visible"
  193. >
  194. </el-table-column>
  195. <el-table-column
  196. prop="roleName"
  197. label="检查人员"
  198. min-width="150"
  199. v-if="columns[6].visible"
  200. >
  201. <template slot-scope="r">
  202. {{
  203. r.row.roles ? r.row.roles.map((r) => r.roleName).join("||") : ""
  204. }}
  205. </template>
  206. </el-table-column>
  207. <el-table-column
  208. prop="status"
  209. label="任务进度"
  210. width="100px"
  211. v-if="columns[10].visible"
  212. >
  213. <template slot-scope="r">
  214. <span>
  215. <!-- <i class="circle" :style="statusColor(r.row.status, true)" /> -->
  216. <!-- <label :style="statusColor(r.row.status, false)"> -->
  217. <label >
  218. {{
  219. getLabel(dict.type.safety_check_status, r.row.status)
  220. }}</label
  221. >
  222. </span>
  223. </template>
  224. </el-table-column>
  225. <el-table-column
  226. prop="orgName"
  227. label="受检机构"
  228. min-width="140"
  229. v-if="columns[4].visible"
  230. >
  231. </el-table-column>
  232. <el-table-column
  233. prop="planStartTime"
  234. label="任务时间"
  235. min-width="200"
  236. v-if="columns[2].visible"
  237. ><template slot-scope="r">
  238. {{
  239. r.row.planStartTime
  240. ? dayjs(r.row.planStartTime).format("YYYY年-MM月-DD日")
  241. : ""
  242. }}~{{
  243. r.row.planEndTime
  244. ? dayjs(r.row.planEndTime).format("YYYY年-MM月-DD日")
  245. : ""
  246. }}
  247. </template></el-table-column
  248. >
  249. <el-table-column
  250. prop="planEndTime"
  251. label="截止日期"
  252. min-width="100"
  253. v-if="false"
  254. ><template slot-scope="r">
  255. {{
  256. r.row.planEndTime
  257. ? dayjs(r.row.planEndTime).format("YYYY-MM-DD")
  258. : ""
  259. }}
  260. </template></el-table-column
  261. >
  262. <el-table-column
  263. prop="submitBy"
  264. label="检查人"
  265. min-width="100"
  266. v-if="false"
  267. ></el-table-column>
  268. <el-table-column
  269. label="检查时间"
  270. min-width="120"
  271. v-if="false"
  272. >
  273. <template slot-scope="r">{{
  274. r.row.submitTime | dateTime
  275. }}</template>
  276. </el-table-column>
  277. <el-table-column
  278. prop="exceptionCount"
  279. label="隐患问题数"
  280. min-width="80"
  281. v-if="columns[9].visible"
  282. >
  283. </el-table-column>
  284. <el-table-column
  285. prop="des"
  286. label="备注"
  287. min-width="80"
  288. v-if="false"
  289. >
  290. </el-table-column>
  291. <el-table-column label="操作" fixed="right" min-width="200">
  292. <template slot-scope="r">
  293. <!-- <el-button v-if="
  294. r.row.status == 'WAIT' &&
  295. queryParams.type == 'QUARTER'
  296. " type="text" @click="onEdit(r.row.id)">检查</el-button>
  297. <el-button v-else-if="
  298. r.row.status != 'NA' &&
  299. r.row.status != 'NOT' &&
  300. r.row.status != 'WAIT'
  301. " type="text" @click="onEdit(r.row.id, { isRead: true })">查看</el-button> -->
  302. <el-button
  303. type="text"
  304. @click="showDetail(r.row)"
  305. v-hasPermi="['resumption:taskManager:query']"
  306. >详情</el-button
  307. >
  308. <el-button
  309. type="text"
  310. @click="showscanRecord(r.row)"
  311. v-hasPermi="['resumption:taskManager:query']"
  312. >检查登记簿</el-button
  313. >
  314. <el-button
  315. type="text"
  316. @click="showRegister(r.row)"
  317. v-if="showRegisterBtn(r.row)"
  318. >任务登记</el-button
  319. >
  320. </template>
  321. </el-table-column>
  322. </el-table>
  323. <pagination
  324. v-show="total > 0"
  325. :total="total"
  326. :page.sync="queryParams.pageNum"
  327. :limit.sync="queryParams.pageSize"
  328. @pagination="getList"
  329. />
  330. </el-col>
  331. </el-row>
  332. <!-- 详情 -->
  333. <dialog-detail ref="detaildialog"></dialog-detail>
  334. <dialog-scan-record ref="scanrecorddialog"></dialog-scan-record>
  335. <dialog-temporary-task ref="dialogtemporarytask" @success="getList"></dialog-temporary-task>
  336. </div>
  337. </template>
  338. <script>
  339. import { mapGetters } from "vuex";
  340. import { allRole } from "@/api/system/role";
  341. import DialogDetail from "./dialog.detail";
  342. import DialogScanRecord from "./dialog.scanrecord";
  343. import DataRangePicker from "@/components/dateTime/daterange.picker.vue";
  344. import OrgTree from "@/components/orgTree";
  345. import * as api from "@/api/safetycheck/task.js";
  346. import { getLabel } from "@/views/commonOption.js";
  347. import OrgTreeSelect from "@/components/orgTreeSelect";
  348. import { checkPermi } from "@/utils/permission.js";
  349. import dayjs from "dayjs";
  350. import DialogTemporaryTask from "@/views/safetycheck/taskManager/components/dialog.temporarytask.vue"
  351. export default {
  352. name: "checkTaskList",
  353. dicts: ["resumption_plan_cycle", "resumption_status", "safety_check_status"],
  354. components: {
  355. DialogDetail,
  356. DialogScanRecord,
  357. DataRangePicker,
  358. OrgTreeSelect,
  359. OrgTree,
  360. DialogTemporaryTask
  361. },
  362. data() {
  363. return {
  364. loading: false,
  365. showSearch: true,
  366. total: 0,
  367. timeClearable: false,
  368. options: [],
  369. roleOptions: [],
  370. selectRoleOptions: [],
  371. planList: [],
  372. queryParams: {
  373. checkSub: true,
  374. orgId: null,
  375. orgName: null,
  376. status: null,
  377. planId: null,
  378. pageNum: 1,
  379. pageSize: 10,
  380. planStartTime: null,
  381. title: null,
  382. checkOrgIds: null,
  383. range:[],
  384. },
  385. selectedOrgName: null,
  386. pageData: [],
  387. columns: [
  388. { key: 0, label: `序号`, visible: true },
  389. { key: 1, label: `计划名称`, visible: true },
  390. { key: 2, label: `开始时间`, visible: true },
  391. { key: 3, label: `结束时间`, visible: true },
  392. { key: 4, label: `上级机构`, visible: true },
  393. { key: 5, label: `检查机构`, visible: true },
  394. { key: 6, label: `检查角色`, visible: true },
  395. { key: 7, label: `提交人`, visible: true },
  396. { key: 8, label: `提交时间`, visible: true },
  397. { key: 9, label: `异常个数`, visible: true },
  398. { key: 10, label: `任务状态`, visible: true },
  399. ],
  400. };
  401. },
  402. props: {},
  403. watch: {
  404. statusVal(value) {
  405. if (value == undefined) return;
  406. if (value == "all") this.queryParams.status = null;
  407. else this.queryParams.status = value;
  408. },
  409. planVal(value) {
  410. if (value == undefined) return;
  411. if (value == -1) this.queryParams.planId = null;
  412. else this.queryParams.planId = value;
  413. },
  414. $route(v) {
  415. //this.queryParams.type = this.$route.params.type.toUpperCase();
  416. },
  417. // 0每日;1每周;2每月;3每季度;4每半年;5每年
  418. },
  419. computed: {
  420. ...mapGetters(["orgName", "userId", "roleList", "orgId"]),
  421. },
  422. methods: {
  423. dayjs,
  424. updatePlanStartTime(value) {
  425. // console.log(this.queryParams.planStartTime,"前");
  426. this.queryParams.planStartTime = value;
  427. // console.log(this.queryParams.planStartTime,"后");
  428. },
  429. inputRestriction() {
  430. // 限制只允许输入汉字、英文和数字
  431. this.queryParams.orgName = this.queryParams.orgName.replace(
  432. /[^\u4e00-\u9fa5a-zA-Z0-9]/g,
  433. ""
  434. );
  435. },
  436. inputTitle() {
  437. // 限制只允许输入汉字、英文和数字
  438. this.queryParams.title = this.queryParams.title.replace(
  439. /[^\u4e00-\u9fa5a-zA-Z0-9]/g,
  440. ""
  441. );
  442. },
  443. getLabel,
  444. showDetail(row) {
  445. let path = "/core/safetycheck/register/" + row.id;
  446. this.$router.push(path);
  447. },
  448. showscanRecord(row) {
  449. this.$refs.scanrecorddialog.show(row.id, row.orgId);
  450. },
  451. showRegisterBtn(row) {
  452. let userRoleId = this.roleList.map((r) => r.roleId);
  453. let taskRoleId = row.roles.map((r) => r.roleId);
  454. return (
  455. row.status != 3 &&
  456. ((row.checkOrgId == this.orgId &&
  457. userRoleId.find((ur) => taskRoleId.includes(ur)) &&
  458. checkPermi([
  459. "core:safetycheck:register",
  460. "core:safetycheck:grant",
  461. ])) ||
  462. row.grantUserId === this.userId)
  463. );
  464. },
  465. showRegister(row) {
  466. let path = "/core/safetycheck/register/" + row.id + "?mode=register";
  467. this.$router.push(path);
  468. },
  469. getDefaultKey(key) {
  470. this.queryParams.orgId = key;
  471. this.selectedOrgName = this.orgName;
  472. this.getList();
  473. this.loadRoles(key);
  474. // this.loadPlanList();
  475. },
  476. //单选框状态改变
  477. checkChange(state) {
  478. this.queryParams.checkSub = state;
  479. this.getList();
  480. },
  481. // 节点单击事件
  482. clickTreeNode(data) {
  483. this.queryParams.orgId = data.id;
  484. this.selectedOrgName = data.name;
  485. // this.loadPlanList();
  486. this.loadRoles();
  487. this.getList();
  488. },
  489. resetQuery() {
  490. this.queryParams.checkOrgIds = [];
  491. this.queryParams.range=[];
  492. this.resetForm("queryParams");
  493. this.getList();
  494. },
  495. handleAdd(){
  496. this.$refs["dialogtemporarytask"].show();
  497. },
  498. async getList() {
  499. console.log(this.queryParams, "this.queryParams");
  500. this.loading = true;
  501. api
  502. .page(this.queryParams)
  503. .then((r) => {
  504. this.isTableHaveData = r.rows.length > 0;
  505. this.pageData = r.rows;
  506. this.total = r.total;
  507. this.loading = false;
  508. })
  509. .catch((e) => {
  510. this.loading = false;
  511. });
  512. },
  513. loadRoles() {
  514. api
  515. .getRoles({
  516. orgId: this.queryParams.orgId,
  517. planCycle: this.queryParams.executeCycle,
  518. })
  519. .then((r) => (this.roleOptions = r.data));
  520. },
  521. selectLoadRoles() {
  522. allRole().then((r) => (this.selectRoleOptions = r.data));
  523. },
  524. // loadPlanList() {
  525. // api
  526. // .getPlans({
  527. // orgId: this.queryParams.orgId,
  528. // // planCycle: this.queryParams.executeCycle,
  529. // })
  530. // .then((r) => {
  531. // this.planList = r.data;
  532. // });
  533. // },
  534. statusColor(status, isBackground) {
  535. let color = "";
  536. switch (status) {
  537. case "1":
  538. color = "#BFBFBF";
  539. break;
  540. case "2":
  541. color = "#1890FF";
  542. break;
  543. case "3":
  544. color = "#52C41A";
  545. break;
  546. case "4":
  547. color = "#F5222D";
  548. break;
  549. }
  550. if (isBackground) {
  551. return "background-color:" + color;
  552. } else {
  553. return "color:" + color;
  554. }
  555. },
  556. },
  557. async mounted() {
  558. this.selectLoadRoles();
  559. },
  560. };
  561. </script>
  562. <style lang="scss"></style>