diff --git a/src/api/organization.js b/src/api/organization.js index db072271a82ef7a7efc203aa2da47329b1a38857..a7ba9d7e74af3a54ff5bff6f289539a81fc137eb 100644 --- a/src/api/organization.js +++ b/src/api/organization.js @@ -1,17 +1,5 @@ import { delReq, getReq, postReq, putReq } from '@/utils'; -// export function delMenuApi(id) { -// return delReq(`/api/v1/menus/${id}`); -// } - -// export function getMenuDataApi() { -// return getReq('/api/v1/menus'); -// } - -// export function addMenuApi(data) { -// return postReq('/api/v1/menus', data); -// } - function addJobsApi(data) { return postReq('/api/v1/jobs', data); } diff --git a/src/components/FormMixin/index.js b/src/components/FormMixin/index.js new file mode 100644 index 0000000000000000000000000000000000000000..cb43e98877977485a7ee537778533d9b57e9bd19 --- /dev/null +++ b/src/components/FormMixin/index.js @@ -0,0 +1,34 @@ +export default { + data() { + return { + type: 0, + form: {}, + }; + }, + computed: { + isAdd() { + return this.type === 0; + }, + isEdit() { + return this.type === 1; + }, + isView() { + return this.type === 2; + }, + }, + methods: { + async submit() { + await this.$refs.DrawerForm.validate(); + if (this.isAdd) { + return this?.add(); + } + if (this.isEdit) { + return this?.edit(); + } + }, + setData(data, type) { + this.form = data; + this.type = type; + }, + }, +}; diff --git a/src/components/table/index.vue b/src/components/table/index.vue index 3092465fbf0df4936c8f1efb12d775eea7da446c..5ad87090baeb4d7ec07cc0c087a246116095b1e1 100644 --- a/src/components/table/index.vue +++ b/src/components/table/index.vue @@ -30,13 +30,12 @@
- +
@@ -78,6 +77,7 @@ export default { pageSize: 10, }; return { + title: '新增', data: [], queryForm: { ...this.initQuery, @@ -147,7 +147,19 @@ export default { } this.submitLoading = false; }, - showAdd() { + show({ type, title } = {}) { + if (type === 0) { + this.title = '新增'; + } + if (type === 1) { + this.title = '编辑'; + } + if (type === 2) { + this.title = '查看'; + } + if (title) { + this.title = title; + } this.addVisible = true; }, }, diff --git a/src/pages/system/view/organization/jobmanagement/JobManagement.vue b/src/pages/system/view/organization/jobmanagement/JobManagement.vue index 55c4e51dd4bcaf41568e819b49315076c8faaeb2..4bd4e9360ddecb05b1d33f39ef3f770b06f60f0e 100644 --- a/src/pages/system/view/organization/jobmanagement/JobManagement.vue +++ b/src/pages/system/view/organization/jobmanagement/JobManagement.vue @@ -1,21 +1,21 @@