index.vue 8.3 KB

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