index.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654
  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. hangsheTree
  12. :defaultCheckSub="false"
  13. ></org-tree>
  14. </el-col>
  15. <el-col :span="20" :xs="24">
  16. <!-- 搜索条件 -->
  17. <el-form
  18. :model="queryParams"
  19. ref="search"
  20. size="small"
  21. :inline="true"
  22. v-show="showSearch"
  23. label-width="70px"
  24. >
  25. <el-form-item prop="checkType" label="任务类型" >
  26. <el-select
  27. prop="checkType"
  28. label="任务类型"
  29. v-model="queryParams.checkType"
  30. placeholder="请选择任务类型"
  31. clearable
  32. >
  33. <el-option
  34. v-for="dict in dict.type.check_type"
  35. :key="dict.value"
  36. :label="dict.label"
  37. :value="dict.value"
  38. />
  39. </el-select>
  40. </el-form-item>
  41. <el-form-item prop="execOrgType" label="检查机构类型" v-if="false">
  42. <el-select
  43. prop="execOrgType"
  44. label="检查机构类型"
  45. v-model="queryParams.execOrgType"
  46. placeholder="请选择检查机构类型"
  47. clearable
  48. >
  49. <el-option
  50. v-for="dict in dict.type.sys_org_type"
  51. :key="dict.value"
  52. :label="dict.label"
  53. :value="dict.value"
  54. />
  55. </el-select>
  56. </el-form-item>
  57. <el-form-item prop="checkOrgType" label="受检机构类型" v-if="false">
  58. <el-select
  59. prop="checkOrgType"
  60. label="受检机构类型"
  61. v-model="queryParams.checkOrgType"
  62. placeholder="请选择受检机构类型"
  63. clearable
  64. >
  65. <el-option
  66. v-for="dict in dict.type.sys_org_type"
  67. :key="dict.value"
  68. :label="dict.label"
  69. :value="dict.value"
  70. />
  71. </el-select>
  72. </el-form-item>
  73. <el-form-item prop="checkRole" label="检查人员">
  74. <el-select
  75. @visible-change="getRolesByOrg"
  76. prop="checkRole"
  77. label="检查人员"
  78. v-model="queryParams.checkRole"
  79. placeholder="请选择用户角色"
  80. clearable
  81. >
  82. <el-option
  83. v-for="dict in resumptionRoles"
  84. :key="dict.index"
  85. :label="dict.roleName"
  86. :value="dict.id"
  87. />
  88. </el-select>
  89. </el-form-item>
  90. <el-form-item prop="planCycle" label="任务周期">
  91. <el-select
  92. prop="planCycle"
  93. label="任务周期"
  94. v-model="queryParams.planCycle"
  95. placeholder="请选择任务周期"
  96. clearable
  97. >
  98. <el-option
  99. v-for="item in dict.type.check_cycle"
  100. :key="item.value"
  101. :label="item.label"
  102. :value="item.value"
  103. >
  104. </el-option>
  105. </el-select>
  106. </el-form-item>
  107. <el-form-item prop="planStatus" label="任务状态">
  108. <el-select
  109. prop="planStatus"
  110. label="任务状态"
  111. v-model="queryParams.planStatus"
  112. placeholder="请选择任务状态"
  113. clearable
  114. >
  115. <el-option
  116. v-for="item in dict.type.check_status"
  117. :key="item.value"
  118. :label="item.label"
  119. :value="item.value"
  120. >
  121. </el-option>
  122. </el-select>
  123. </el-form-item>
  124. <el-form-item prop="planName" label="任务名称">
  125. <el-input
  126. v-model="queryParams.planName"
  127. :maxlength="50"
  128. name="planName"
  129. placeholder="请输入关键字"
  130. clearable
  131. />
  132. </el-form-item>
  133. <el-form-item>
  134. <el-button
  135. type="primary"
  136. icon="el-icon-search"
  137. size="mini"
  138. @click="getList"
  139. >搜索</el-button
  140. >
  141. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
  142. >重置</el-button
  143. ><el-button
  144. type="primary"
  145. icon="el-icon-plus"
  146. size="mini"
  147. @click="handleAdd()"
  148. v-hasPermi="['core:checkplan:add']"
  149. >新增任务</el-button
  150. >
  151. </el-form-item>
  152. </el-form>
  153. <!-- 按纽 -->
  154. <el-row :gutter="10" class="mb8">
  155. <el-col :span="1.5">
  156. </el-col>
  157. <right-toolbar
  158. :showSearch.sync="showSearch"
  159. @queryTable="getList"
  160. :columns="columns"
  161. ></right-toolbar>
  162. </el-row>
  163. <el-table
  164. border
  165. height="600"
  166. size="small"
  167. v-loading="loading"
  168. :data="pageData"
  169. @selection-change="handleSelectionChange"
  170. row-key="id"
  171. :tree-props="{ children: 'children' }"
  172. >
  173. <el-table-column
  174. type="index"
  175. label="序号"
  176. width="80px"
  177. v-if="columns[0].visible"
  178. ></el-table-column>
  179. <el-table-column
  180. prop="planName"
  181. label="计划名称"
  182. v-if="columns[1].visible"
  183. ></el-table-column>
  184. <el-table-column
  185. prop="planOfOrgName"
  186. label="计划所属机构"
  187. v-if="columns[4].visible"
  188. >
  189. </el-table-column>
  190. <el-table-column
  191. prop="planCreateOrgName"
  192. label="计划创建机构"
  193. v-if="columns[3].visible"
  194. >
  195. </el-table-column>
  196. <el-table-column
  197. prop="checkType"
  198. label="检查类型"
  199. v-if="columns[2].visible"
  200. >
  201. <template slot-scope="r"
  202. >{{ getLabel(dict.type.check_type, `${r.row.checkType}`) }}
  203. </template>
  204. </el-table-column>
  205. <el-table-column
  206. prop="execOrgType"
  207. label="检查机构类型"
  208. v-if="columns[2].visible"
  209. >
  210. <template slot-scope="r"
  211. >{{ getLabel(dict.type.sys_org_type, `${r.row.execOrgType}`) }}
  212. </template>
  213. </el-table-column>
  214. <el-table-column
  215. prop="checkOrgType"
  216. label="受检机构类型"
  217. width="120px"
  218. v-if="columns[6].visible"
  219. >
  220. <template slot-scope="r"
  221. >{{ getLabel(dict.type.sys_org_type, `${r.row.checkOrgType}`) }}
  222. </template>
  223. </el-table-column>
  224. <el-table-column
  225. prop="roleNames"
  226. label="检查角色"
  227. v-if="columns[6].visible"
  228. >
  229. <template slot-scope="scope">
  230. <template v-for="item in splitRoleNames(scope.row.roleNames)">
  231. {{ item }}
  232. <br />
  233. </template> </template
  234. ></el-table-column>
  235. <el-table-column
  236. prop="planCycle"
  237. label="检查周期"
  238. width="80px"
  239. v-if="columns[6].visible"
  240. >
  241. <template slot-scope="r"
  242. >{{ getLabel(dict.type.check_cycle, `${r.row.planCycle}`) }}
  243. </template>
  244. </el-table-column>
  245. <el-table-column
  246. prop="count"
  247. label="检查次数"
  248. v-if="columns[6].visible"
  249. ></el-table-column>
  250. <el-table-column
  251. prop="planStatus"
  252. label="状态"
  253. width="80px"
  254. v-if="columns[6].visible"
  255. >
  256. <template slot-scope="r"
  257. >{{ getLabel(dict.type.check_status, `${r.row.planStatus}`) }}
  258. </template>
  259. </el-table-column>
  260. <el-table-column
  261. prop="modifiedName"
  262. label="修改人"
  263. v-if="columns[6].visible"
  264. ></el-table-column>
  265. <el-table-column
  266. prop="updateTime"
  267. label="修改时间"
  268. width="80px"
  269. v-if="columns[6].visible"
  270. >
  271. <template slot-scope="scope">
  272. <span>{{ formatTime(scope.row.updateTime, "YYYY-MM-DD") }}</span>
  273. </template>
  274. </el-table-column>
  275. <el-table-column label="操作" min-width="200">
  276. <template slot-scope="r">
  277. <el-button
  278. v-if="eqOrg(r.row)"
  279. size="mini"
  280. type="text"
  281. icon="el-icon-edit-outline"
  282. @click="onEdit(r.row.id)"
  283. v-hasPermi="['core:checkplan:edit']"
  284. >编辑</el-button
  285. >
  286. <el-button
  287. v-if="eqOrg2(r.row)"
  288. size="mini"
  289. type="text"
  290. icon="el-icon-delete"
  291. @click="onDel(r.row.id, r.row.planName)"
  292. v-hasPermi="['core:checkplan:remove']"
  293. >删除</el-button
  294. >
  295. <el-button
  296. size="mini"
  297. type="text"
  298. icon="el-icon-arrow-down"
  299. v-if="checkCanPublish(r.row)"
  300. @click="showDialogDistribute(r.row)"
  301. v-hasPermi="['core:checkplan:distribute']"
  302. >下发</el-button
  303. >
  304. <el-button
  305. size="mini"
  306. type="text"
  307. icon="el-icon-arrow-down"
  308. v-if="newcheckCanPublish(r.row)"
  309. @click="newshowDialogDistribute(r.row)"
  310. v-hasPermi="['core:checkplan:distribute']"
  311. >下发</el-button
  312. >
  313. <el-button
  314. size="mini"
  315. type="text"
  316. icon="el-icon-arrow-down"
  317. v-if="chehui(r.row)"
  318. @click="chhuile(r.row)"
  319. v-hasPermi="['core:checkplan:distribute']"
  320. >撤回</el-button
  321. >
  322. </template>
  323. </el-table-column>
  324. </el-table>
  325. <pagination
  326. v-show="total > 0"
  327. :total="total"
  328. :page.sync="queryParams.pageNum"
  329. :limit.sync="queryParams.pageSize"
  330. @pagination="getList"
  331. />
  332. </el-col>
  333. </el-row>
  334. <dialog-edit
  335. ref="editDialog"
  336. @success="getList()"
  337. :orgTypeOptions="dict.type.sys_org_type"
  338. :ruleTypeOptions="dict.type.rule_type"
  339. ></dialog-edit>
  340. <DialogDistribute ref="dialogDistribute" @select="sel"></DialogDistribute>
  341. </div>
  342. </template>
  343. <script>
  344. import DialogDistribute from "./distribute.vue";
  345. import OrgTree from "@/components/orgTree";
  346. import { mapState, mapMutations, mapGetters } from "vuex";
  347. import DialogEdit from "./dialog.edit";
  348. import * as api from "@/api/safetycheck/plan";
  349. import { statusOptions, getLabel } from "@/views/commonOption";
  350. import { listRole } from "@/api/system/role";
  351. export default {
  352. name: "resumptionplan",
  353. dicts: [
  354. "sys_org_type",
  355. "rule_type",
  356. "check_cycle",
  357. "check_status",
  358. "check_type",
  359. ],
  360. components: {
  361. DialogEdit,
  362. OrgTree,
  363. DialogDistribute,
  364. },
  365. data() {
  366. const { params, query } = this.$route;
  367. return {
  368. isShow: false,
  369. loading: false,
  370. ids: [],
  371. // 非单个禁用
  372. single: true,
  373. // 非多个禁用
  374. multiple: true,
  375. // 显示搜索条件
  376. showSearch: true,
  377. resumptionRoles: [],
  378. total: 0,
  379. queryParams: {
  380. id: null,
  381. planName: null,
  382. checkRole: null,
  383. planCycle: null,
  384. planCreateOrgId: null,
  385. checkType: null,
  386. planOfOrgId: null,
  387. execOrgType: null,
  388. checkOrgType: null,
  389. planStatus: null,
  390. pageSize: 10,
  391. pageNum: 1,
  392. checkSub: false,
  393. orgId: null,
  394. ...query,
  395. },
  396. pageData: [],
  397. // 列信息
  398. columns: [
  399. { key: 0, label: `序号`, visible: true },
  400. { key: 1, label: `计划名称`, visible: true },
  401. { key: 2, label: `计划类型`, visible: true },
  402. { key: 3, label: `计划创建机构`, visible: true },
  403. { key: 4, label: `计划所属机构`, visible: true },
  404. { key: 5, label: `履职机构类型`, visible: true },
  405. { key: 6, label: `履职角色`, visible: true },
  406. { key: 7, label: `履职周期`, visible: true },
  407. { key: 8, label: `履职次数`, visible: true },
  408. { key: 9, label: `履职时间`, visible: true },
  409. { key: 10, label: `修改人`, visible: true },
  410. { key: 11, label: `计划状态`, visible: true },
  411. ],
  412. };
  413. },
  414. props: {},
  415. watch: {},
  416. computed: {
  417. ...mapState([]),
  418. ...mapGetters(["orgId", "orgName"]),
  419. },
  420. methods: {
  421. ...mapMutations([]),
  422. //判断是否跟当前用户同机构
  423. eqOrg(row) {
  424. // console.log(row.planOfOrgId,"row.planOfOrgId");
  425. // console.log(this.orgId,"this.orgId");
  426. if (
  427. row != null &&
  428. row != undefined &&
  429. (row.planCreateOrgId == this.orgId ||
  430. (row.planOfOrgType == 3 && row.planOfOrgId == this.orgId))
  431. ) {
  432. return true;
  433. }
  434. return false;
  435. },
  436. eqOrg2(row) {
  437. // console.log(row.planCreateOrgId,"row.planCreateOrgId");
  438. // console.log(this.orgId,"this.orgId");
  439. if (
  440. row != null &&
  441. row != undefined &&
  442. row.planCreateOrgId == this.orgId &&
  443. row.planOfOrgId == this.orgId
  444. ) {
  445. return true;
  446. }
  447. return false;
  448. },
  449. newcheckCanPublish(row) {
  450. //如果计划所属机构类型为行社并且计划不为进行中并且计划创建机构为当前机构或者
  451. //计划状态为停用并且不属于子计划并且计划所属机构类型为省联社
  452. if (
  453. (row.planOfOrgType == 3 &&
  454. row.planStatus != 1 &&
  455. row.planCreateOrgId == this.orgId) ||
  456. (row.planStatus == 2 && row.parentId != -1 && row.planOfOrgType == 1)
  457. ) {
  458. return true;
  459. }
  460. return false;
  461. },
  462. newshowDialogDistribute(row) {
  463. this.$modal
  464. .confirm("是否下发!", "提示")
  465. .then(() => {
  466. // 用户点击了确认按钮
  467. console.log("执行操作...");
  468. this.loading = true;
  469. api
  470. .distributeCheHui(row.id)
  471. .then((response) => {
  472. // console.log(response, "then");
  473. if (response.data == 0) {
  474. this.loading = false;
  475. } else {
  476. this.getList();
  477. this.loading = false;
  478. }
  479. })
  480. .catch((response) => {
  481. // console.log(response, "catch");
  482. this.getList();
  483. this.loading = false;
  484. });
  485. })
  486. .catch(() => {
  487. // 用户点击了取消按钮
  488. console.log("取消操作...");
  489. });
  490. },
  491. //已完成下发的计划不显示下发按钮
  492. checkCanPublish(row) {
  493. // console.log(row.planOfOrgType == "1","row.planOfOrgType")
  494. // console.log(row.planOfOrgType == "1"&& row.distribute==null,"row.distribute")
  495. //如果计划所属机构为省联社并且计划下发状态为0并且计划检查机构类型不为省联社和办事处(只有一个无法下发)
  496. if (
  497. row.planOfOrgType == "1" &&
  498. row.distribute == 0 &&
  499. row.execOrgType != "1" &&
  500. row.execOrgType != "2"
  501. ) {
  502. return true;
  503. }
  504. return false;
  505. },
  506. splitRoleNames(val) {
  507. if (val != null && val != undefined) {
  508. return val.split(",");
  509. } else {
  510. return [];
  511. }
  512. // 使用逗号分割字符串,得到角色名称的数组
  513. },
  514. sel(selectList) {
  515. this.loading = true;
  516. api.distribute(selectList).then((response) => {
  517. this.getList();
  518. this.loading = false;
  519. });
  520. },
  521. getRolesByOrg() {
  522. let params = {
  523. // orgId:this.queryParams.orgId
  524. };
  525. listRole(params).then((res) => {
  526. // console.info(res);
  527. this.resumptionRoles = res.rows;
  528. });
  529. },
  530. getList() {
  531. this.loading = true;
  532. console.info(this.dict.type);
  533. api
  534. .list(this.queryParams)
  535. .then((response) => {
  536. this.pageData = response.rows;
  537. this.total = response.total;
  538. this.loading = false;
  539. })
  540. .catch(() => {
  541. this.loading = false;
  542. });
  543. },
  544. getDefaultKey(key) {
  545. this.queryParams.orgId = key;
  546. this.getList();
  547. },
  548. handleAdd(id, other = {}) {
  549. id = null;
  550. this.$refs.editDialog.show(id, other);
  551. },
  552. onEdit(id, other = {}) {
  553. this.$refs.editDialog.show(id, other);
  554. },
  555. //开始撤回
  556. chhuile(row) {
  557. this.loading = true;
  558. api.cheHui(row.id).then((response) => {
  559. this.getList();
  560. this.loading = false;
  561. });
  562. },
  563. //已下发的显示撤回
  564. chehui(row) {
  565. if (row.distribute == 1 && row.planCreateOrgId == this.orgId) {
  566. return true;
  567. }
  568. return false;
  569. },
  570. showDialogDistribute(row) {
  571. console.log(row, "qqq");
  572. this.$refs.dialogDistribute.show(row);
  573. },
  574. async onDel(id, name) {
  575. this.$modal
  576. .confirm('是否确认删除名称为"' + name + '"的数据项?')
  577. .then(() => {
  578. // 用户点击了确认按钮
  579. console.log("执行操作...");
  580. this.loading = true;
  581. api
  582. .delelte(id)
  583. .then(() => {
  584. this.getList();
  585. this.loading = false;
  586. this.$modal.msgSuccess("删除成功");
  587. })
  588. .catch(() => {
  589. this.loading = false;
  590. });
  591. })
  592. .catch(() => {
  593. // 用户点击了取消按钮
  594. console.log("取消操作...");
  595. });
  596. },
  597. // 多选框选中数据
  598. handleSelectionChange(selection) {
  599. this.ids = selection.map((item) => item.userId);
  600. this.single = selection.length != 1;
  601. this.multiple = !selection.length;
  602. },
  603. /** 重置按钮操作 */
  604. resetQuery() {
  605. this.resetForm("search");
  606. // this.queryParams.orgId = undefined;
  607. // this.$refs.tree.setCurrentKey(null);
  608. this.getList();
  609. },
  610. //单选框状态改变
  611. checkChange(state) {
  612. this.queryParams.checkSub = state;
  613. this.getList();
  614. },
  615. // 节点单击事件
  616. clickTreeNode(data) {
  617. this.queryParams.orgId = data.id;
  618. this.getList();
  619. },
  620. getStatusLabel(value) {
  621. return getLabel(statusOptions, value);
  622. },
  623. getLabel(options, value) {
  624. return getLabel(options, value);
  625. },
  626. //apimark//
  627. },
  628. mounted() {},
  629. };
  630. </script>
  631. <style lang="scss" scoped>
  632. .brand {
  633. }
  634. </style>