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