index.vue 14 KB

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