index.vue 9.2 KB

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