orgdept.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. <!--
  2. * @Title:
  3. * @Description: 盟市机构管理
  4. * @Author: swp
  5. * @Date: 2022-08-24 10:49:21
  6. * @LastEditors:
  7. * @LastEditTime: 2022-08-24 10:49:21
  8. -->
  9. <template>
  10. <div>
  11. <el-row>
  12. <el-col :span="24">
  13. <basic-container>
  14. <avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page"
  15. :before-open="beforeOpen" ref="crud" v-model="form" :permission="permissionList" @row-del="rowDel"
  16. @row-update="rowUpdate" @row-save="rowSave" @search-change="searchChange"
  17. @search-reset="searchReset" @selection-change="selectionChange" @current-change="currentChange"
  18. @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad"
  19. @before-open="beforeOpen" @select-change="selectChange">
  20. </avue-crud>
  21. </basic-container>
  22. </el-col>
  23. </el-row>
  24. </div>
  25. </template>
  26. <script>
  27. import { getPage, getDetail, add, update, remove } from "@/api/baseinfo/org.js";
  28. export default {
  29. components: {
  30. },
  31. data() {
  32. return {
  33. id: "",
  34. editForm: {},
  35. editDialog: false,
  36. form: {},
  37. selectionList: [],
  38. query: {},
  39. loading: true,
  40. page: {
  41. pageSize: 10,
  42. currentPage: 1,
  43. total: 0,
  44. },
  45. option: {
  46. labelWidth: 140,
  47. viewLabelWidth: 140,
  48. searchlabelWidth: 140,
  49. height: "auto",
  50. calcHeight: 80,
  51. align: "center",
  52. headerAlign: "center",
  53. tip: false,
  54. simplePage: true,
  55. searchShow: true,
  56. searchMenuSpan: 6,
  57. border: true,
  58. index: true,
  59. selection: false,
  60. viewBtn: false,
  61. viewTitle: "运维人员信息",
  62. editBtn: true,
  63. delBtn: true,
  64. menuWidth: 220,
  65. dialogType: "drawer",
  66. dialogClickModal: false,
  67. columnBtn: false,
  68. addBtnText: "新增盟市",
  69. column: [
  70. {
  71. label: "盟市全称",
  72. prop: "deptName",
  73. span: 24,
  74. search: true,
  75. rules: [
  76. {
  77. required: true,
  78. message: "请录入盟市全称",
  79. trigger: "click",
  80. },
  81. ],
  82. },
  83. {
  84. label: "运维行政区划",
  85. prop: "adcd",
  86. span: 24,
  87. hide: true,
  88. editDisplay: false,
  89. type: "select",
  90. dicUrl: `./api/galaxy-business/baseinfo/region/children/list`,
  91. props: {
  92. label: "adnm",
  93. value: "adcd",
  94. },
  95. rules: [
  96. {
  97. required: true,
  98. message: "请选择运维的行政区划",
  99. trigger: "click",
  100. },
  101. ],
  102. },
  103. {
  104. label: "运维行政区划",
  105. prop: "adnm",
  106. span: 24,
  107. editDisabled: true,
  108. addDisplay: false,
  109. },
  110. {
  111. label: "备注说明",
  112. prop: "remark",
  113. span: 24,
  114. type: "textarea",
  115. },
  116. ],
  117. },
  118. data: [],
  119. };
  120. },
  121. computed: {
  122. // ...mapGetters(["userInfo", "permission"]),
  123. permissionList() {
  124. return {
  125. // addBtn: this.vaildData(this.permission.docCategory_add, false),
  126. // viewBtn: this.vaildData(this.permission.docCategory_view, false),
  127. // delBtn: this.vaildData(this.permission.docCategory_delete, false),
  128. // editBtn: this.vaildData(this.permission.docCategory_edit, false),
  129. };
  130. },
  131. ids() {
  132. let ids = [];
  133. this.selectionList.forEach((ele) => {
  134. ids.push(ele.id);
  135. });
  136. return ids.join(",");
  137. },
  138. },
  139. mounted() { },
  140. created() {
  141. },
  142. methods: {
  143. rowSave(row, done, loading) {
  144. add(row).then(
  145. () => {
  146. this.onLoad(this.page);
  147. this.$message({
  148. type: "success",
  149. message: "操作成功!",
  150. });
  151. done();
  152. },
  153. (error) => {
  154. window.console.log(error);
  155. loading();
  156. }
  157. );
  158. },
  159. rowUpdate(row, index, done, loading) {
  160. update(row).then(
  161. () => {
  162. this.onLoad(this.page);
  163. this.$message({
  164. type: "success",
  165. message: "操作成功!",
  166. });
  167. done();
  168. },
  169. (error) => {
  170. window.console.log(error);
  171. loading();
  172. }
  173. );
  174. },
  175. rowDel(row) {
  176. this.$confirm("确定将选择数据删除?", {
  177. confirmButtonText: "确定",
  178. cancelButtonText: "取消",
  179. type: "warning",
  180. })
  181. .then(() => {
  182. return remove(row.id);
  183. })
  184. .then(() => {
  185. this.onLoad(this.page);
  186. this.$message({
  187. type: "success",
  188. message: "操作成功!",
  189. });
  190. });
  191. },
  192. searchReset() {
  193. this.query = {};
  194. this.onLoad(this.page);
  195. },
  196. searchChange(params, done) {
  197. this.query = params;
  198. this.page.currentPage = 1;
  199. this.onLoad(this.page, params);
  200. done();
  201. },
  202. selectionChange(list) {
  203. this.selectionList = list;
  204. },
  205. selectChange(item) {
  206. console.log(item)
  207. },
  208. selectionClear() {
  209. this.selectionList = [];
  210. this.$refs.crud.toggleSelection();
  211. },
  212. handleDelete() {
  213. if (this.selectionList.length === 0) {
  214. this.$message.warning("请选择至少一条数据");
  215. return;
  216. }
  217. this.$confirm("确定将选择数据删除?", {
  218. confirmButtonText: "确定",
  219. cancelButtonText: "取消",
  220. type: "warning",
  221. })
  222. .then(() => {
  223. return remove(this.ids);
  224. })
  225. .then(() => {
  226. this.onLoad(this.page);
  227. this.$message({
  228. type: "success",
  229. message: "操作成功!",
  230. });
  231. this.$refs.crud.toggleSelection();
  232. });
  233. },
  234. beforeOpen(done, type) {
  235. if (["edit", "view"].includes(type)) {
  236. getDetail(this.form.id).then((res) => {
  237. this.form = res.data.data;
  238. });
  239. }
  240. done();
  241. },
  242. currentChange(currentPage) {
  243. this.page.currentPage = currentPage;
  244. },
  245. sizeChange(pageSize) {
  246. this.page.pageSize = pageSize;
  247. },
  248. refreshChange() {
  249. this.onLoad(this.page, this.query);
  250. },
  251. onLoad(page, params = {}) {
  252. this.loading = true;
  253. getPage(
  254. page.currentPage,
  255. page.pageSize,
  256. Object.assign(params, this.query)
  257. ).then((res) => {
  258. const data = res.data.data;
  259. this.page.total = data.total;
  260. this.data = data.records;
  261. this.loading = false;
  262. this.selectionClear();
  263. });
  264. },
  265. },
  266. };
  267. </script>