Commit 76d53af9 by yangzhi

菜单

parent 2a38679b
...@@ -21,3 +21,9 @@ export function updateMenu(data) { ...@@ -21,3 +21,9 @@ export function updateMenu(data) {
export function deleteMenu(id) { export function deleteMenu(id) {
return axios.post(`sysSaasMenu/delete/${id}`) return axios.post(`sysSaasMenu/delete/${id}`)
} }
export function getSimpleByPage() {
return axios.post('sys/domain/getSimpleByPage', {
currentPage: 1,
pageSize: 100,
})
}
...@@ -35,12 +35,12 @@ ...@@ -35,12 +35,12 @@
:visible.sync="dialogVisible" :visible.sync="dialogVisible"
:close-on-click-modal="false" :close-on-click-modal="false"
:before-close="beforeClose" :before-close="beforeClose"
width="620px" width="820px"
> >
<el-form <el-form
size="mini" size="mini"
:inline="true" :inline="true"
label-width="100px" label-width="120px"
:rules="rules" :rules="rules"
ref="editForm" ref="editForm"
:model="editForm" :model="editForm"
...@@ -143,6 +143,42 @@ ...@@ -143,6 +143,42 @@
v-model="editForm.describe" v-model="editForm.describe"
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item label="包含的namespace">
<el-select
v-model="editForm.includeNamespace"
multiple
style="width: 400px"
clearable
placeholder="请选择"
>
<el-option
v-for="(item, index) in simpleList"
:key="index"
filterable
:label="item.companyName"
:value="item.apiName"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="排除的namespace">
<el-select
v-model="editForm.excludeNamespace"
multiple
style="width: 400px"
clearable
filterable
placeholder="请选择"
>
<el-option
v-for="(item, index) in simpleList"
:key="index"
:label="item.companyName"
:value="item.apiName"
>
</el-option>
</el-select>
</el-form-item>
</el-form> </el-form>
<div slot="footer"> <div slot="footer">
<el-button size="small" @click="clone" <el-button size="small" @click="clone"
...@@ -167,6 +203,7 @@ import { ...@@ -167,6 +203,7 @@ import {
updateMenu, updateMenu,
addMenu, addMenu,
deleteMenu, deleteMenu,
getSimpleByPage,
} from '../common/api/sys' } from '../common/api/sys'
export default { export default {
...@@ -189,6 +226,8 @@ export default { ...@@ -189,6 +226,8 @@ export default {
title: '', title: '',
describe: '', describe: '',
enable: true, enable: true,
includeNamespace: '',
excludeNamespace: '',
}, },
rules: { rules: {
type: [ type: [
...@@ -200,6 +239,7 @@ export default { ...@@ -200,6 +239,7 @@ export default {
], ],
}, },
isEdit: false, isEdit: false,
simpleList: [],
} }
}, },
computed: { computed: {
...@@ -313,8 +353,16 @@ export default { ...@@ -313,8 +353,16 @@ export default {
}, },
mounted() { mounted() {
this.getlist() this.getlist()
this.getSimpleByPage()
}, },
methods: { methods: {
getSimpleByPage() {
getSimpleByPage().then(res => {
if (res.code === 200) {
this.simpleList = res.data.records
}
})
},
async enableChange(item, v) { async enableChange(item, v) {
try { try {
const res = await updateSysmenu({ const res = await updateSysmenu({
...@@ -359,6 +407,22 @@ export default { ...@@ -359,6 +407,22 @@ export default {
this.isEdit = false this.isEdit = false
} else { } else {
this.isEdit = true this.isEdit = true
if (
item.excludeNamespace &&
item.excludeNamespace.length > 0
) {
item.excludeNamespace = item.excludeNamespace.split(
',',
)
}
if (
item.includeNamespace &&
item.includeNamespace.length > 0
) {
item.includeNamespace = item.includeNamespace.split(
',',
)
}
this.editForm = { ...item, enable: true } this.editForm = { ...item, enable: true }
} }
this.$nextTick(() => { this.$nextTick(() => {
...@@ -376,6 +440,26 @@ export default { ...@@ -376,6 +440,26 @@ export default {
const api = this.isEdit ? updateMenu : addMenu const api = this.isEdit ? updateMenu : addMenu
delete this.editForm.children delete this.editForm.children
try { try {
if (
this.editForm.includeNamespace &&
this.editForm.includeNamespace.length > 0
) {
this.editForm.includeNamespace = this.editForm.includeNamespace.join(
',',
)
} else {
this.editForm.includeNamespace = ''
}
if (
this.editForm.excludeNamespace &&
this.editForm.excludeNamespace.length > 0
) {
this.editForm.excludeNamespace = this.editForm.excludeNamespace.join(
',',
)
} else {
this.editForm.excludeNamespace = ''
}
const res = await api({ ...this.editForm }) const res = await api({ ...this.editForm })
if (res.code === 200) { if (res.code === 200) {
this.$message.success(res.message) this.$message.success(res.message)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment