index.vue 21 KB

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