index.vue 19 KB

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