index.vue 14 KB

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