index.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  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="name" label="履职库名称">
  25. <el-input
  26. v-model="queryParams.name"
  27. :maxlength="50"
  28. placeholder="请输入履职库名称"
  29. clearable
  30. />
  31. </el-form-item>
  32. <el-form-item prop="type" label="履职类型">
  33. <el-select
  34. prop="ruleTypeId"
  35. label="履职类型"
  36. v-model="queryParams.type"
  37. placeholder="请选择履职类型"
  38. clearable
  39. >
  40. <el-option
  41. v-for="dict in dict.type.rule_type"
  42. :key="dict.value"
  43. :label="dict.label"
  44. :value="dict.value"
  45. />
  46. </el-select>
  47. </el-form-item>
  48. <el-form-item prop="orgType" label="履职机构类型">
  49. <el-select
  50. prop="orgType"
  51. label="履职机构类型"
  52. v-model="queryParams.orgType"
  53. placeholder="请选择履职机构类型"
  54. clearable
  55. >
  56. <el-option
  57. v-for="item in dict.type.sys_org_type"
  58. :key="item.value"
  59. :label="item.label"
  60. :value="item.value"
  61. >
  62. </el-option>
  63. </el-select>
  64. </el-form-item>
  65. <el-form-item>
  66. <el-button
  67. type="primary"
  68. icon="el-icon-search"
  69. size="mini"
  70. @click="refresh"
  71. v-hasPermi="['resumption:rule:query']"
  72. >搜索</el-button
  73. >
  74. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
  75. >重置</el-button
  76. >
  77. </el-form-item>
  78. </el-form>
  79. <!-- 按纽 -->
  80. <el-row :gutter="10" class="mb8">
  81. <el-col :span="1.5">
  82. <el-button
  83. type="primary"
  84. plain
  85. icon="el-icon-plus"
  86. size="mini"
  87. @click="handleAdd()"
  88. v-hasPermi="['resumption:rule:add']"
  89. >新增</el-button
  90. >
  91. </el-col>
  92. <right-toolbar
  93. :showSearch.sync="showSearch"
  94. @queryTable="getList"
  95. :columns="columns"
  96. ></right-toolbar>
  97. </el-row>
  98. <el-table
  99. v-loading="loading"
  100. :data="pageData"
  101. @selection-change="handleSelectionChange"
  102. >
  103. <el-table-column
  104. type="index"
  105. label="序号"
  106. v-if="columns[0].visible"
  107. ></el-table-column>
  108. <el-table-column
  109. prop="name"
  110. label="履职库名称"
  111. v-if="columns[1].visible"
  112. ></el-table-column>
  113. <el-table-column
  114. prop="typeName"
  115. label="履职类型"
  116. v-if="columns[2].visible"
  117. >
  118. <template slot-scope="r"
  119. >{{ getLabel(dict.type.rule_type, r.row.type) }}
  120. </template>
  121. </el-table-column>
  122. <el-table-column
  123. prop="orgType"
  124. label="履职机构类型"
  125. v-if="columns[3].visible"
  126. >
  127. <template slot-scope="r"
  128. >{{ getLabel(dict.type.sys_org_type, r.row.orgType) }}
  129. </template>
  130. </el-table-column>
  131. <el-table-column
  132. prop="orgName"
  133. label="发布机构"
  134. v-if="columns[4].visible"
  135. ></el-table-column>
  136. <el-table-column prop="status" label="状态" v-if="columns[5].visible">
  137. <template slot-scope="r">
  138. <span>{{ getLabel(dict.type.plan_status, r.row.status) }}</span>
  139. </template>
  140. </el-table-column>
  141. <el-table-column
  142. prop="remark"
  143. label="备注"
  144. v-if="columns[6].visible"
  145. ></el-table-column>
  146. <el-table-column label="操作">
  147. <template slot-scope="r">
  148. <el-button
  149. size="mini"
  150. type="text"
  151. icon="el-icon-edit"
  152. @click="onEdit(r.row.id)"
  153. v-hasPermi="['resumption:rule:edit']"
  154. >修改</el-button
  155. >
  156. <el-popconfirm
  157. title="确定删除履职内容库定义?"
  158. @confirm="onDel(r.row.id)"
  159. >
  160. <el-button type="text" size="small" slot="reference" icon="el-icon-delete" v-hasPermi="['resumption:rule:remove']">删除</el-button>
  161. </el-popconfirm>
  162. </template>
  163. </el-table-column>
  164. </el-table>
  165. <pagination
  166. v-show="total > 0"
  167. :total="total"
  168. :page.sync="queryParams.pageNum"
  169. :limit.sync="queryParams.pageSize"
  170. @pagination="getList"
  171. />
  172. </el-col>
  173. </el-row>
  174. <dialog-edit
  175. ref="editDialog"
  176. @success="getList()"
  177. :orgTypeOptions="dict.type.sys_org_type"
  178. :ruleTypeOptions="dict.type.rule_type"
  179. :statusOptions="dict.type.plan_status"
  180. ></dialog-edit>
  181. </div>
  182. </template>
  183. <script>
  184. import OrgTree from "@/components/orgTree";
  185. import { mapState, mapMutations } from "vuex";
  186. import DialogEdit from "./dialog.edit";
  187. import * as api from "@/api/resumption/rule";
  188. import { getLabel } from "./../../commonOption";
  189. export default {
  190. name: "ruletype",
  191. dicts: ["sys_org_type", "rule_type", "plan_status"],
  192. components: {
  193. DialogEdit,
  194. OrgTree,
  195. },
  196. data() {
  197. const { params, query } = this.$route;
  198. return {
  199. isShow: false,
  200. loading: false,
  201. ids: [],
  202. // 非单个禁用
  203. single: true,
  204. // 非多个禁用
  205. multiple: true,
  206. // 显示搜索条件
  207. showSearch: true,
  208. total: 0,
  209. queryParams: {
  210. orgId: null,
  211. name: null,
  212. type: null,
  213. orgType: null,
  214. checkSub:true,
  215. pageNum: 1,
  216. pageSize: 10,
  217. ...query,
  218. },
  219. pageData: [],
  220. // 列信息
  221. columns: [
  222. { key: 0, label: `序号`, visible: true },
  223. { key: 1, label: `履职库名称`, visible: true },
  224. { key: 2, label: `履职库类型`, visible: true },
  225. { key: 3, label: `履职机构类型`, visible: true },
  226. { key: 4, label: `发布机构`, visible: true },
  227. { key: 5, label: `状态`, visible: true },
  228. { key: 6, label: `备注`, visible: true },
  229. ],
  230. };
  231. },
  232. props: {},
  233. watch: {},
  234. computed: {
  235. ...mapState([]),
  236. },
  237. methods: {
  238. ...mapMutations([]),
  239. getLabel,
  240. refresh() {
  241. this.queryParams.pageNum = 1;
  242. this.getList();
  243. },
  244. getList() {
  245. this.loading = true;
  246. console.info(this.dict.type);
  247. api
  248. .list(this.queryParams)
  249. .then((response) => {
  250. this.pageData = response.rows;
  251. this.total = response.total;
  252. this.loading = false;
  253. })
  254. .catch(() => {
  255. this.loading = false;
  256. });
  257. },
  258. getDefaultKey(key) {
  259. this.queryParams.orgId = key;
  260. this.getList();
  261. },
  262. handleAdd(id, other = {}) {
  263. this.$refs.editDialog.show(id, other);
  264. },
  265. onEdit(id, other = {}) {
  266. this.$refs.editDialog.show(id, other);
  267. },
  268. async onDel(id) {
  269. await api.remove(id);
  270. this.$message.info("删除成功");
  271. this.getList();
  272. },
  273. // 多选框选中数据
  274. handleSelectionChange(selection) {
  275. this.ids = selection.map((item) => item.userId);
  276. this.single = selection.length != 1;
  277. this.multiple = !selection.length;
  278. },
  279. /** 重置按钮操作 */
  280. resetQuery() {
  281. this.resetForm("search");
  282. // this.queryParams.orgId = undefined;
  283. // this.$refs.tree.setCurrentKey(null);
  284. this.getList();
  285. },
  286. //单选框状态改变
  287. checkChange(state) {
  288. this.queryParams.checkSub = state;
  289. this.getList();
  290. },
  291. // 节点单击事件
  292. clickTreeNode(data) {
  293. this.queryParams.orgId = data.id;
  294. this.getList();
  295. },
  296. //apimark//
  297. },
  298. mounted() {},
  299. };
  300. </script>
  301. <style lang="scss" scoped>
  302. .brand {
  303. }
  304. </style>