index.vue 14 KB

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