|
|
|
@ -7,6 +7,16 @@ |
|
|
|
|
:rules="formRules" |
|
|
|
|
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-tree-select |
|
|
|
|
v-model="formData.parentId" |
|
|
|
@ -132,7 +142,8 @@ const formData = ref({ |
|
|
|
|
status: CommonStatusEnum.ENABLE, |
|
|
|
|
visible: true, |
|
|
|
|
keepAlive: true, |
|
|
|
|
alwaysShow: true |
|
|
|
|
alwaysShow: true, |
|
|
|
|
serviceId: undefined |
|
|
|
|
}) |
|
|
|
|
const formRules = reactive({ |
|
|
|
|
name: [{ required: true, message: '菜单名称不能为空', trigger: 'blur' }], |
|
|
|
@ -148,6 +159,7 @@ const open = async (type: string, id?: number, parentId?: number) => { |
|
|
|
|
dialogTitle.value = t('action.' + type) |
|
|
|
|
formType.value = type |
|
|
|
|
resetForm() |
|
|
|
|
getOptions() |
|
|
|
|
if (parentId) { |
|
|
|
|
formData.value.parentId = parentId |
|
|
|
|
} |
|
|
|
@ -165,6 +177,13 @@ const open = async (type: string, id?: number, parentId?: number) => { |
|
|
|
|
} |
|
|
|
|
defineExpose({ open }) // 提供 open 方法,用于打开弹窗 |
|
|
|
|
|
|
|
|
|
const appList = ref([]) |
|
|
|
|
const getOptions = () => { |
|
|
|
|
MenuApi.getServiceAppList().then((data) => { |
|
|
|
|
appList.value = data |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** 提交表单 */ |
|
|
|
|
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调 |
|
|
|
|
const submitForm = async () => { |
|
|
|
@ -233,7 +252,8 @@ const resetForm = () => { |
|
|
|
|
status: CommonStatusEnum.ENABLE, |
|
|
|
|
visible: true, |
|
|
|
|
keepAlive: true, |
|
|
|
|
alwaysShow: true |
|
|
|
|
alwaysShow: true, |
|
|
|
|
serviceId: undefined |
|
|
|
|
} |
|
|
|
|
formRef.value?.resetFields() |
|
|
|
|
} |
|
|
|
|