dev-cl
qsh 4 months ago
parent 08ada50d1a
commit e1285ed9c3
  1. 5
      src/api/system/menu/index.ts
  2. 24
      src/views/Basic/Menu/MenuForm.vue

@ -17,7 +17,10 @@ export interface MenuVO {
alwaysShow?: boolean alwaysShow?: boolean
createTime: Date createTime: Date
} }
// 获取服务列表
export const getServiceAppList = () => {
return request.get({ url: '/admin-api/system/service/list' })
}
// 查询菜单(精简)列表 // 查询菜单(精简)列表
export const getSimpleMenusList = () => { export const getSimpleMenusList = () => {
return request.get({ url: '/admin-api/system/menu/list-all-simple' }) return request.get({ url: '/admin-api/system/menu/list-all-simple' })

@ -7,6 +7,16 @@
:rules="formRules" :rules="formRules"
label-width="100px" label-width="100px"
> >
<el-form-item label="服务类型" prop="serviceId">
<el-select v-model="formData.serviceId" placeholder="选择服务类型" filterable>
<el-option
v-for="item in appList"
:key="item.serviceId"
:label="item.serviceName"
:value="item.serviceId"
/>
</el-select>
</el-form-item>
<el-form-item label="上级菜单"> <el-form-item label="上级菜单">
<el-tree-select <el-tree-select
v-model="formData.parentId" v-model="formData.parentId"
@ -132,7 +142,8 @@ const formData = ref({
status: CommonStatusEnum.ENABLE, status: CommonStatusEnum.ENABLE,
visible: true, visible: true,
keepAlive: true, keepAlive: true,
alwaysShow: true alwaysShow: true,
serviceId: undefined
}) })
const formRules = reactive({ const formRules = reactive({
name: [{ required: true, message: '菜单名称不能为空', trigger: 'blur' }], name: [{ required: true, message: '菜单名称不能为空', trigger: 'blur' }],
@ -148,6 +159,7 @@ const open = async (type: string, id?: number, parentId?: number) => {
dialogTitle.value = t('action.' + type) dialogTitle.value = t('action.' + type)
formType.value = type formType.value = type
resetForm() resetForm()
getOptions()
if (parentId) { if (parentId) {
formData.value.parentId = parentId formData.value.parentId = parentId
} }
@ -165,6 +177,13 @@ const open = async (type: string, id?: number, parentId?: number) => {
} }
defineExpose({ open }) // open defineExpose({ open }) // open
const appList = ref([])
const getOptions = () => {
MenuApi.getServiceAppList().then((data) => {
appList.value = data
})
}
/** 提交表单 */ /** 提交表单 */
const emit = defineEmits(['success']) // success const emit = defineEmits(['success']) // success
const submitForm = async () => { const submitForm = async () => {
@ -233,7 +252,8 @@ const resetForm = () => {
status: CommonStatusEnum.ENABLE, status: CommonStatusEnum.ENABLE,
visible: true, visible: true,
keepAlive: true, keepAlive: true,
alwaysShow: true alwaysShow: true,
serviceId: undefined
} }
formRef.value?.resetFields() formRef.value?.resetFields()
} }

Loading…
Cancel
Save