Commit 76d53af9 by yangzhi

菜单

parent 2a38679b
......@@ -21,3 +21,9 @@ export function updateMenu(data) {
export function deleteMenu(id) {
return axios.post(`sysSaasMenu/delete/${id}`)
}
export function getSimpleByPage() {
return axios.post('sys/domain/getSimpleByPage', {
currentPage: 1,
pageSize: 100,
})
}
......@@ -35,12 +35,12 @@
:visible.sync="dialogVisible"
:close-on-click-modal="false"
:before-close="beforeClose"
width="620px"
width="820px"
>
<el-form
size="mini"
:inline="true"
label-width="100px"
label-width="120px"
:rules="rules"
ref="editForm"
:model="editForm"
......@@ -143,6 +143,42 @@
v-model="editForm.describe"
></el-input>
</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>
<div slot="footer">
<el-button size="small" @click="clone"
......@@ -167,6 +203,7 @@ import {
updateMenu,
addMenu,
deleteMenu,
getSimpleByPage,
} from '../common/api/sys'
export default {
......@@ -189,6 +226,8 @@ export default {
title: '',
describe: '',
enable: true,
includeNamespace: '',
excludeNamespace: '',
},
rules: {
type: [
......@@ -200,6 +239,7 @@ export default {
],
},
isEdit: false,
simpleList: [],
}
},
computed: {
......@@ -313,8 +353,16 @@ export default {
},
mounted() {
this.getlist()
this.getSimpleByPage()
},
methods: {
getSimpleByPage() {
getSimpleByPage().then(res => {
if (res.code === 200) {
this.simpleList = res.data.records
}
})
},
async enableChange(item, v) {
try {
const res = await updateSysmenu({
......@@ -359,6 +407,22 @@ export default {
this.isEdit = false
} else {
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.$nextTick(() => {
......@@ -376,6 +440,26 @@ export default {
const api = this.isEdit ? updateMenu : addMenu
delete this.editForm.children
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 })
if (res.code === 200) {
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