index.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  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. <!-- <el-col :span="1.5">
  93. <el-button
  94. type="success"
  95. plain
  96. icon="el-icon-edit"
  97. size="mini"
  98. :disabled="single"
  99. @click="handleUpdate"
  100. v-hasPermi="['system:user:edit']"
  101. >修改</el-button
  102. >
  103. </el-col>
  104. <el-col :span="1.5">
  105. <el-button
  106. type="danger"
  107. plain
  108. icon="el-icon-delete"
  109. size="mini"
  110. :disabled="multiple"
  111. @click="handleDelete"
  112. v-hasPermi="['system:user:remove']"
  113. >删除</el-button
  114. >
  115. </el-col>-->
  116. <right-toolbar
  117. :showSearch.sync="showSearch"
  118. @queryTable="getList"
  119. :columns="columns"
  120. ></right-toolbar>
  121. </el-row>
  122. <el-table
  123. v-loading="loading"
  124. :data="pageData"
  125. @selection-change="handleSelectionChange"
  126. >
  127. <el-table-column
  128. type="index"
  129. label="序号"
  130. v-if="columns[0].visible"
  131. ></el-table-column>
  132. <el-table-column
  133. prop="name"
  134. label="履职库名称"
  135. v-if="columns[1].visible"
  136. ></el-table-column>
  137. <el-table-column
  138. prop="typeName"
  139. label="履职库类型"
  140. v-if="columns[2].visible"
  141. >
  142. <template slot-scope="r"
  143. >{{ getLabel(dict.type.rule_type, r.row.type) }}
  144. </template>
  145. </el-table-column>
  146. <el-table-column
  147. prop="orgType"
  148. label="履职机构类型"
  149. v-if="columns[3].visible"
  150. >
  151. <template slot-scope="r"
  152. >{{ getLabel(dict.type.sys_org_type, r.row.orgType) }}
  153. </template>
  154. </el-table-column>
  155. <el-table-column
  156. prop="orgName"
  157. label="发布机构"
  158. v-if="columns[4].visible"
  159. ></el-table-column>
  160. <el-table-column prop="status" label="状态" v-if="columns[5].visible">
  161. <template slot-scope="r">
  162. <span>{{ getLabel(dict.type.plan_status, r.row.status) }}</span>
  163. </template>
  164. </el-table-column>
  165. <el-table-column
  166. prop="remark"
  167. label="备注"
  168. v-if="columns[6].visible"
  169. ></el-table-column>
  170. <el-table-column label="操作">
  171. <template slot-scope="r">
  172. <el-button
  173. size="mini"
  174. type="text"
  175. icon="el-icon-edit"
  176. @click="onEdit(r.row.id)"
  177. v-hasPermi="['resumption:rule:edit']"
  178. >修改</el-button
  179. >
  180. <el-popconfirm
  181. title="确定删除履职内容库定义?"
  182. @confirm="onDel(r.row.id)"
  183. >
  184. <el-button type="text" size="small" slot="reference" icon="el-icon-delete" v-hasPermi="['resumption:rule:remove']">删除</el-button>
  185. </el-popconfirm>
  186. </template>
  187. </el-table-column>
  188. </el-table>
  189. <pagination
  190. v-show="total > 0"
  191. :total="total"
  192. :page.sync="queryParams.pageNum"
  193. :limit.sync="queryParams.pageSize"
  194. @pagination="getList"
  195. />
  196. </el-col>
  197. </el-row>
  198. <dialog-edit
  199. ref="editDialog"
  200. @success="getList()"
  201. :orgTypeOptions="dict.type.sys_org_type"
  202. :ruleTypeOptions="dict.type.rule_type"
  203. :statusOptions="dict.type.plan_status"
  204. ></dialog-edit>
  205. </div>
  206. </template>
  207. <script>
  208. import OrgTree from "@/components/orgTree";
  209. import { mapState, mapMutations } from "vuex";
  210. import DialogEdit from "./dialog.edit";
  211. import * as api from "@/api/resumption/rule";
  212. import { getLabel } from "./../../commonOption";
  213. export default {
  214. name: "ruletype",
  215. dicts: ["sys_org_type", "rule_type", "plan_status"],
  216. components: {
  217. DialogEdit,
  218. OrgTree,
  219. },
  220. data() {
  221. const { params, query } = this.$route;
  222. return {
  223. isShow: false,
  224. loading: false,
  225. ids: [],
  226. // 非单个禁用
  227. single: true,
  228. // 非多个禁用
  229. multiple: true,
  230. // 显示搜索条件
  231. showSearch: true,
  232. total: 0,
  233. queryParams: {
  234. orgId: null,
  235. name: null,
  236. type: null,
  237. orgType: null,
  238. pageNum: 1,
  239. pageSize: 10,
  240. ...query,
  241. },
  242. pageData: [],
  243. // 列信息
  244. columns: [
  245. { key: 0, label: `序号`, visible: true },
  246. { key: 1, label: `履职库名称`, visible: true },
  247. { key: 2, label: `履职库类型`, visible: true },
  248. { key: 3, label: `履职机构类型`, visible: true },
  249. { key: 4, label: `发布机构`, visible: true },
  250. { key: 5, label: `状态`, visible: true },
  251. { key: 6, label: `备注`, visible: true },
  252. ],
  253. };
  254. },
  255. props: {},
  256. watch: {},
  257. computed: {
  258. ...mapState([]),
  259. },
  260. methods: {
  261. ...mapMutations([]),
  262. getLabel,
  263. refresh() {
  264. this.queryParams.pageNum = 1;
  265. this.getList();
  266. },
  267. getList() {
  268. this.loading = true;
  269. console.info(this.dict.type);
  270. api
  271. .list(this.queryParams)
  272. .then((response) => {
  273. this.pageData = response.rows;
  274. this.total = response.total;
  275. this.loading = false;
  276. })
  277. .catch(() => {
  278. this.loading = false;
  279. });
  280. },
  281. getDefaultKey(key) {
  282. this.queryParams.orgId = key;
  283. this.getList();
  284. },
  285. handleAdd(id, other = {}) {
  286. this.$refs.editDialog.show(id, other);
  287. },
  288. onEdit(id, other = {}) {
  289. this.$refs.editDialog.show(id, other);
  290. },
  291. async onDel(id) {
  292. await api.remove(id);
  293. this.$message.info("删除成功");
  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. //apimark//
  320. },
  321. mounted() {},
  322. };
  323. </script>
  324. <style lang="scss" scoped>
  325. .brand {
  326. }
  327. </style>