index.vue 19 KB

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