index.vue 22 KB

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