index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494
  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. ></org-tree>
  12. </el-col>
  13. <el-col :span="20" :xs="24">
  14. <!-- 搜索条件 -->
  15. <el-form
  16. :model="queryParams"
  17. ref="search"
  18. size="small"
  19. :inline="true"
  20. v-show="showSearch"
  21. label-width="100px"
  22. >
  23. <el-form-item prop="planType" label="计划类型">
  24. <el-select
  25. prop="planType"
  26. label="计划类型"
  27. v-model="queryParams.planType"
  28. placeholder="请选择计划类型"
  29. clearable
  30. >
  31. <el-option
  32. v-for="dict in dict.type.resumption_plan_type"
  33. :key="dict.value"
  34. :label="dict.label"
  35. :value="dict.value"
  36. />
  37. </el-select>
  38. </el-form-item>
  39. <el-form-item prop="resumptionRole" label="履职角色">
  40. <el-select
  41. @visible-change="getRolesByOrg"
  42. prop="resumptionRole"
  43. label="履职角色"
  44. v-model="queryParams.resumptionRole"
  45. placeholder="请选择履职角色"
  46. clearable
  47. >
  48. <el-option
  49. v-for="dict in resumptionRoles"
  50. :key="dict.index"
  51. :label="dict.roleName"
  52. :value="dict.id"
  53. />
  54. </el-select>
  55. </el-form-item>
  56. <el-form-item prop="planCycle" label="履职周期">
  57. <el-select
  58. prop="planCycle"
  59. label="履职周期"
  60. v-model="queryParams.planCycle"
  61. placeholder="请选择履职周期"
  62. clearable
  63. >
  64. <el-option
  65. v-for="item in dict.type.resumption_plan_cycle"
  66. :key="item.value"
  67. :label="item.label"
  68. :value="item.value"
  69. >
  70. </el-option>
  71. </el-select>
  72. </el-form-item>
  73. <el-form-item prop="planStatus" label="计划状态">
  74. <el-select
  75. prop="planStatus"
  76. label="任务状态"
  77. v-model="queryParams.planStatus"
  78. placeholder="请选择任务状态"
  79. clearable
  80. >
  81. <el-option
  82. v-for="item in dict.type.resumption_plan_status"
  83. :key="item.value"
  84. :label="item.label"
  85. :value="item.value"
  86. >
  87. </el-option>
  88. </el-select>
  89. </el-form-item>
  90. <el-form-item prop="planName" label="计划名称">
  91. <el-input
  92. v-model="queryParams.planName"
  93. :maxlength="50"
  94. name="planName"
  95. placeholder="请输入"
  96. clearable
  97. />
  98. </el-form-item>
  99. <el-form-item>
  100. <el-button
  101. type="primary"
  102. icon="el-icon-search"
  103. size="mini"
  104. @click="getList"
  105. >搜索</el-button
  106. >
  107. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
  108. >重置</el-button
  109. >
  110. </el-form-item>
  111. </el-form>
  112. <!-- 按纽 -->
  113. <el-row :gutter="10" class="mb8">
  114. <el-col :span="1.5">
  115. <el-button
  116. type="primary"
  117. plain
  118. icon="el-icon-plus"
  119. size="mini"
  120. @click="handleAdd()"
  121. v-hasPermi="['system:user:add']"
  122. >新增</el-button
  123. >
  124. </el-col>
  125. <!-- <el-col :span="1.5">
  126. <el-button
  127. type="success"
  128. plain
  129. icon="el-icon-edit"
  130. size="mini"
  131. :disabled="single"
  132. @click="handleUpdate"
  133. v-hasPermi="['system:user:edit']"
  134. >修改</el-button
  135. >
  136. </el-col>
  137. <el-col :span="1.5">
  138. <el-button
  139. type="danger"
  140. plain
  141. icon="el-icon-delete"
  142. size="mini"
  143. :disabled="multiple"
  144. @click="handleDelete"
  145. v-hasPermi="['system:user:remove']"
  146. >删除</el-button
  147. >
  148. </el-col>-->
  149. <right-toolbar
  150. :showSearch.sync="showSearch"
  151. @queryTable="getList"
  152. :columns="columns"
  153. ></right-toolbar>
  154. </el-row>
  155. <el-table
  156. v-loading="loading"
  157. :data="pageData"
  158. @selection-change="handleSelectionChange"
  159. row-key="id"
  160. :tree-props="{ children: 'children' }"
  161. >
  162. <el-table-column
  163. type="index"
  164. label="序号"
  165. v-if="columns[0].visible"
  166. :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
  167. ></el-table-column>
  168. <el-table-column
  169. prop="planName"
  170. label="计划名称"
  171. v-if="columns[1].visible"
  172. ></el-table-column>
  173. <el-table-column
  174. prop="planType"
  175. label="计划类型"
  176. v-if="columns[2].visible"
  177. >
  178. <template slot-scope="r"
  179. >{{
  180. getLabel(dict.type.resumption_plan_type, `${r.row.planType}`)
  181. }}
  182. </template>
  183. </el-table-column>
  184. <el-table-column
  185. prop="planCreateOrgName"
  186. label="计划创建机构"
  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. v-if="columns[4].visible"
  197. ></el-table-column>
  198. <el-table-column
  199. prop="execOrgType"
  200. label="履职机构类型"
  201. v-if="columns[6].visible"
  202. >
  203. <template slot-scope="r"
  204. >{{ getLabel(dict.type.sys_org_type, `${r.row.execOrgType}`) }}
  205. </template>
  206. </el-table-column>
  207. <el-table-column
  208. prop="roleNames"
  209. label="履职角色"
  210. v-if="columns[6].visible"
  211. ></el-table-column>
  212. <el-table-column
  213. prop="planCycle"
  214. label="履职周期"
  215. v-if="columns[6].visible"
  216. >
  217. <template slot-scope="r"
  218. >{{
  219. getLabel(dict.type.resumption_plan_cycle, `${r.row.planCycle}`)
  220. }}
  221. </template>
  222. </el-table-column>
  223. <el-table-column
  224. prop="count"
  225. label="履职次数"
  226. v-if="columns[6].visible"
  227. ></el-table-column>
  228. <el-table-column
  229. prop="planExec"
  230. label="履职时间"
  231. v-if="columns[6].visible"
  232. >
  233. <template slot-scope="r"
  234. >{{
  235. getLabel(dict.type.resumption_plan_exec, `${r.row.planExec}`)
  236. }}
  237. </template>
  238. </el-table-column>
  239. <el-table-column
  240. prop="modifiedName"
  241. label="修改人"
  242. v-if="columns[6].visible"
  243. ></el-table-column>
  244. <el-table-column
  245. prop="planStatus"
  246. label="计划状态"
  247. v-if="columns[6].visible"
  248. >
  249. <template slot-scope="r"
  250. >{{
  251. getLabel(
  252. dict.type.resumption_plan_status,
  253. `${r.row.planStatus}`
  254. )
  255. }}
  256. </template>
  257. </el-table-column>
  258. <el-table-column label="操作">
  259. <template slot-scope="r">
  260. <el-button
  261. size="mini"
  262. type="text"
  263. icon="el-icon-edit"
  264. @click="onEdit(r.row.id)"
  265. v-hasPermi="['system:user:edit']"
  266. >修改</el-button
  267. >
  268. <el-button
  269. size="mini"
  270. type="text"
  271. icon="el-icon-delete"
  272. @click="onDel(r.row.id, r.row.planName)"
  273. v-hasPermi="['system:user:remove']"
  274. >删除</el-button
  275. >
  276. <el-button
  277. size="mini"
  278. type="text"
  279. icon="el-icon-delete"
  280. v-if="checkCanPublish(r.row)"
  281. @click="showDialogDistribute(r.row)"
  282. v-hasPermi="['system:user:remove']"
  283. >下发</el-button>
  284. </template>
  285. </el-table-column>
  286. </el-table>
  287. <pagination
  288. v-show="total > 0"
  289. :total="total"
  290. :page.sync="queryParams.pageNum"
  291. :limit.sync="queryParams.pageSize"
  292. @pagination="getList"
  293. />
  294. </el-col>
  295. </el-row>
  296. <dialog-edit
  297. ref="editDialog"
  298. @success="getList()"
  299. :orgTypeOptions="dict.type.sys_org_type"
  300. :ruleTypeOptions="dict.type.rule_type"
  301. ></dialog-edit>
  302. <DialogDistribute ref="dialogDistribute" @select="sel"></DialogDistribute>
  303. </div>
  304. </template>
  305. <script>
  306. import DialogDistribute from "@/views/resumption/plan/distribute.vue";
  307. import OrgTree from "@/components/orgTree";
  308. import { mapState, mapMutations } from "vuex";
  309. import DialogEdit from "./dialog.edit";
  310. import * as api from "@/api/resumption/plan";
  311. import { statusOptions, getLabel } from "./../../commonOption";
  312. import { listRole } from "@/api/system/role";
  313. export default {
  314. name: "resumptionplan",
  315. dicts: [
  316. "sys_org_type",
  317. "rule_type",
  318. "resumption_plan_type",
  319. "resumption_plan_cycle",
  320. "resumption_plan_status",
  321. "resumption_plan_exec",
  322. ],
  323. components: {
  324. DialogEdit,
  325. OrgTree,
  326. DialogDistribute,
  327. },
  328. data() {
  329. const { params, query } = this.$route;
  330. return {
  331. isShow: false,
  332. loading: false,
  333. ids: [],
  334. // 非单个禁用
  335. single: true,
  336. // 非多个禁用
  337. multiple: true,
  338. // 显示搜索条件
  339. showSearch: true,
  340. resumptionRoles: [],
  341. total: 0,
  342. queryParams: {
  343. orgId: null,
  344. planType: null,
  345. resumptionRole: null,
  346. planCycle: null,
  347. planStatus: null,
  348. planName: null,
  349. pageNum: 1,
  350. pageSize: 10,
  351. ...query,
  352. },
  353. pageData: [],
  354. // 列信息
  355. columns: [
  356. { key: 0, label: `序号`, visible: true },
  357. { key: 1, label: `计划名称`, visible: true },
  358. { key: 2, label: `计划类型`, visible: true },
  359. { key: 3, label: `计划创建机构`, visible: true },
  360. { key: 4, label: `计划所属机构`, visible: true },
  361. { key: 5, label: `履职机构类型`, visible: true },
  362. { key: 6, label: `履职角色`, visible: true },
  363. { key: 7, label: `履职周期`, visible: true },
  364. { key: 8, label: `履职次数`, visible: true },
  365. { key: 9, label: `履职时间`, visible: true },
  366. { key: 10, label: `修改人`, visible: true },
  367. { key: 11, label: `计划状态`, visible: true },
  368. ],
  369. };
  370. },
  371. props: {},
  372. watch: {},
  373. computed: {
  374. ...mapState([]),
  375. },
  376. methods: {
  377. ...mapMutations([]),
  378. //已完成下发的计划不显示下发按钮
  379. checkCanPublish(row) {
  380. if (row.orgType === 1) {
  381. return true
  382. }
  383. return false;
  384. },
  385. sel(selectList){
  386. this.loading = true;
  387. api.distribute(selectList).then((response) => {
  388. this.getList();
  389. this.loading = false;
  390. })
  391. },
  392. getRolesByOrg() {
  393. let params = {
  394. // orgId:this.queryParams.orgId
  395. };
  396. listRole(params).then((res) => {
  397. // console.info(res);
  398. this.resumptionRoles = res.rows;
  399. });
  400. },
  401. getList() {
  402. this.loading = true;
  403. console.info(this.dict.type);
  404. api
  405. .list(this.queryParams)
  406. .then((response) => {
  407. this.pageData = response.data.records;
  408. this.total = response.data.total;
  409. this.loading = false;
  410. })
  411. .catch(() => {
  412. this.loading = false;
  413. });
  414. },
  415. getDefaultKey(key) {
  416. this.queryParams.orgId = key;
  417. this.getList();
  418. },
  419. handleAdd(id, other = {}) {
  420. this.$refs.editDialog.show(id, other);
  421. },
  422. onEdit(id, other = {}) {
  423. this.$refs.editDialog.show(id, other);
  424. },
  425. showDialogDistribute(row){
  426. this.$refs.dialogDistribute.show(row);
  427. },
  428. async onDel(id, name) {
  429. this.$modal
  430. .confirm('是否确认删除名称为"' + name + '"的数据项?')
  431. .then(function () {
  432. return api.delelte(id);
  433. })
  434. .then(() => {
  435. this.getList();
  436. this.$modal.msgSuccess("删除成功");
  437. })
  438. .catch(() => {});
  439. // await api.delelte(id);
  440. // this.getList();
  441. },
  442. // 多选框选中数据
  443. handleSelectionChange(selection) {
  444. this.ids = selection.map((item) => item.userId);
  445. this.single = selection.length != 1;
  446. this.multiple = !selection.length;
  447. },
  448. /** 重置按钮操作 */
  449. resetQuery() {
  450. this.resetForm("queryForm");
  451. this.queryParams.orgId = undefined;
  452. this.$refs.tree.setCurrentKey(null);
  453. this.getList();
  454. },
  455. //单选框状态改变
  456. checkChange(state) {
  457. this.queryParams.checkSub = state;
  458. this.getList();
  459. },
  460. // 节点单击事件
  461. clickTreeNode(data) {
  462. this.queryParams.orgId = data.id;
  463. this.getList();
  464. },
  465. getStatusLabel(value) {
  466. return getLabel(statusOptions, value);
  467. },
  468. getLabel(options, value) {
  469. return getLabel(options, value);
  470. },
  471. //apimark//
  472. },
  473. mounted() {},
  474. };
  475. </script>
  476. <style lang="scss" scoped>
  477. .brand {
  478. }
  479. </style>