index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560
  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="eqOrg(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="chehui(r.row)"
  305. @click="chhuile(r.row)"
  306. v-hasPermi="['system:user:remove']"
  307. >撤回</el-button
  308. >
  309. </template>
  310. </el-table-column>
  311. </el-table>
  312. <pagination
  313. v-show="total > 0"
  314. :total="total"
  315. :page.sync="queryParams.pageNum"
  316. :limit.sync="queryParams.pageSize"
  317. @pagination="getList"
  318. />
  319. </el-col>
  320. </el-row>
  321. <dialog-edit
  322. ref="editDialog"
  323. @success="getList()"
  324. :orgTypeOptions="dict.type.sys_org_type"
  325. :ruleTypeOptions="dict.type.rule_type"
  326. ></dialog-edit>
  327. <DialogDistribute ref="dialogDistribute" @select="sel"></DialogDistribute>
  328. </div>
  329. </template>
  330. <script>
  331. import DialogDistribute from "@/views/resumption/plan/distribute.vue";
  332. import OrgTree from "@/components/orgTree";
  333. import { mapState, mapMutations, mapGetters } from "vuex";
  334. import DialogEdit from "./dialog.edit";
  335. import * as api from "@/api/resumption/plan";
  336. import { statusOptions, getLabel } from "./../../commonOption";
  337. import { allRole } from "@/api/system/role";
  338. export default {
  339. name: "resumptionplan",
  340. dicts: [
  341. "sys_org_type",
  342. "rule_type",
  343. "resumption_plan_type",
  344. "resumption_plan_cycle",
  345. "resumption_plan_status",
  346. "resumption_plan_exec",
  347. ],
  348. components: {
  349. DialogEdit,
  350. OrgTree,
  351. DialogDistribute,
  352. },
  353. data() {
  354. const { params, query } = this.$route;
  355. return {
  356. isShow: false,
  357. loading: false,
  358. ids: [],
  359. // 非单个禁用
  360. single: true,
  361. // 非多个禁用
  362. multiple: true,
  363. // 显示搜索条件
  364. showSearch: true,
  365. resumptionRoles: [],
  366. total: 0,
  367. queryParams: {
  368. orgId: null,
  369. planType: null,
  370. resumptionRole: null,
  371. planCycle: null,
  372. planStatus: null,
  373. planName: null,
  374. pageNum: 1,
  375. pageSize: 10,
  376. checkSub: false,
  377. roleList: [],
  378. ...query,
  379. },
  380. pageData: [],
  381. // 列信息
  382. columns: [
  383. { key: 0, label: `序号`, visible: true },
  384. { key: 1, label: `计划名称`, visible: true },
  385. { key: 2, label: `计划类型`, visible: true },
  386. { key: 3, label: `计划创建机构`, visible: true },
  387. { key: 4, label: `计划所属机构`, visible: true },
  388. { key: 5, label: `履职机构类型`, visible: true },
  389. { key: 6, label: `履职角色`, visible: true },
  390. { key: 7, label: `履职周期`, visible: true },
  391. // { key: 8, label: `履职次数`, visible: true },
  392. { key: 8, label: `履职时间`, visible: true },
  393. { key: 9, label: `修改人`, visible: true },
  394. { key: 10, label: `计划状态`, visible: true },
  395. ],
  396. };
  397. },
  398. props: {},
  399. watch: {},
  400. computed: {
  401. ...mapState([]),
  402. ...mapGetters(["orgId", "orgName"]),
  403. },
  404. methods: {
  405. ...mapMutations([]),
  406. //判断是否跟当前用户同机构
  407. eqOrg(row) {
  408. // console.log(row.planCreateOrgId,"row.planCreateOrgId");
  409. // console.log(this.orgId,"this.orgId");
  410. if (row != null && row != undefined && row.planOfOrgId == this.orgId) {
  411. return true;
  412. }
  413. return false;
  414. },
  415. //已完成下发的计划不显示下发按钮
  416. checkCanPublish(row) {
  417. // console.log(row.planOfOrgType,"row.planOfOrgType")
  418. if (row.planOfOrgType == "1" && (row.distribute == null||row.distribute == 2)) {
  419. return true;
  420. }
  421. return false;
  422. },
  423. chhuile(row) {
  424. this.loading = true;
  425. api.cheHui(row.id).then((response) => {
  426. this.getList();
  427. this.loading = false;
  428. });
  429. },
  430. chehui(row) {
  431. if (row.planOfOrgType == "1" && row.distribute == 1) {
  432. return true;
  433. }
  434. return false;
  435. },
  436. sel(selectList) {
  437. this.loading = true;
  438. api.distribute(selectList).then((response) => {
  439. this.getList();
  440. this.loading = false;
  441. });
  442. },
  443. async getRolesByOrg() {
  444. await allRole().then((res) => {
  445. // console.info(res);
  446. this.resumptionRoles = res.data;
  447. });
  448. },
  449. getList() {
  450. this.loading = true;
  451. this.queryParams.roleList = [];
  452. if (
  453. this.queryParams.resumptionRole != null &&
  454. this.queryParams.resumptionRole != ""
  455. ) {
  456. this.queryParams.roleList.push(this.queryParams.resumptionRole);
  457. }
  458. console.info(this.dict.type);
  459. api
  460. .list(this.queryParams)
  461. .then((response) => {
  462. this.pageData = response.rows;
  463. this.total = response.total;
  464. this.loading = false;
  465. })
  466. .catch(() => {
  467. this.loading = false;
  468. });
  469. },
  470. getDefaultKey(key) {
  471. this.queryParams.orgId = key;
  472. this.getList();
  473. },
  474. handleAdd(id, other = {}) {
  475. this.$refs.editDialog.show(id, other);
  476. },
  477. onEdit(id, other = {}) {
  478. this.$refs.editDialog.show(id, other);
  479. },
  480. showDialogDistribute(row) {
  481. api.cheHui(row.id).then((response) => {
  482. console.log(response.data,"appPlanService.cheHui(id);")
  483. if(response.data!=1){
  484. this.$refs.dialogDistribute.show(row);
  485. }else{
  486. this.getList();
  487. }
  488. })
  489. },
  490. async onDel(id, name) {
  491. this.$modal
  492. .confirm('是否确认删除名称为"' + name + '"的数据项?')
  493. .then(function () {
  494. return api.delelte(id);
  495. })
  496. .then(() => {
  497. this.getList();
  498. this.$modal.msgSuccess("删除成功");
  499. })
  500. .catch(() => {});
  501. // await api.delelte(id);
  502. // this.getList();
  503. },
  504. // 多选框选中数据
  505. handleSelectionChange(selection) {
  506. this.ids = selection.map((item) => item.userId);
  507. this.single = selection.length != 1;
  508. this.multiple = !selection.length;
  509. },
  510. /** 重置按钮操作 */
  511. resetQuery() {
  512. this.resetForm("search");
  513. this.queryParams.orgId = undefined;
  514. // this.$refs.tree.setCurrentKey(null);
  515. this.getList();
  516. },
  517. //单选框状态改变
  518. checkChange(state) {
  519. this.queryParams.checkSub = state;
  520. this.getList();
  521. },
  522. // 节点单击事件
  523. clickTreeNode(data) {
  524. this.queryParams.orgId = data.id;
  525. this.getList();
  526. },
  527. getStatusLabel(value) {
  528. return getLabel(statusOptions, value);
  529. },
  530. getLabel(options, value) {
  531. return getLabel(options, value);
  532. },
  533. //apimark//
  534. },
  535. mounted() {},
  536. };
  537. </script>
  538. <style lang="scss" scoped>
  539. .brand {
  540. }
  541. </style>