微调
This commit is contained in:
@@ -3,13 +3,12 @@
|
||||
<el-form :model="formContent" ref='dialogFormRef' :rules='rules' >
|
||||
<el-form-item label="上级菜单" prop="pid" :label-width="100">
|
||||
<el-tree-select
|
||||
v-model="value"
|
||||
:data="data"
|
||||
v-model="formContent.pid"
|
||||
:data="functionList"
|
||||
check-strictly
|
||||
:render-after-expand="false"
|
||||
show-checkbox
|
||||
check-on-click-node
|
||||
|
||||
:props="defaultProps"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="名称" prop="name" :label-width="100">
|
||||
@@ -64,79 +63,15 @@
|
||||
import {addFunction,updateFunction,getFunctionListNoButton} from '@/api/function/index.ts'
|
||||
import IconSelect from '@/components/SelectIcon/index.vue'
|
||||
import { functionList } from '@/api/function/functionExample.ts'
|
||||
import { min } from 'lodash';
|
||||
import { min } from 'lodash';
|
||||
import { Console } from 'console';
|
||||
const value = ref()
|
||||
// 树形节点配置
|
||||
const defaultProps = {
|
||||
children: 'children',
|
||||
label: 'name',
|
||||
};
|
||||
|
||||
const data = [
|
||||
{
|
||||
value: '1',
|
||||
label: 'Level one 1',
|
||||
children: [
|
||||
{
|
||||
value: '1-1',
|
||||
label: 'Level two 1-1',
|
||||
children: [
|
||||
{
|
||||
value: '1-1-1',
|
||||
label: 'Level three 1-1-1',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
value: '2',
|
||||
label: 'Level one 2',
|
||||
children: [
|
||||
{
|
||||
value: '2-1',
|
||||
label: 'Level two 2-1',
|
||||
children: [
|
||||
{
|
||||
value: '2-1-1',
|
||||
label: 'Level three 2-1-1',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
value: '2-2',
|
||||
label: 'Level two 2-2',
|
||||
children: [
|
||||
{
|
||||
value: '2-2-1',
|
||||
label: 'Level three 2-2-1',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
value: '3',
|
||||
label: 'Level one 3',
|
||||
children: [
|
||||
{
|
||||
value: '3-1',
|
||||
label: 'Level two 3-1',
|
||||
children: [
|
||||
{
|
||||
value: '3-1-1',
|
||||
label: 'Level three 3-1-1',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
value: '3-2',
|
||||
label: 'Level two 3-2',
|
||||
children: [
|
||||
{
|
||||
value: '3-2-1',
|
||||
label: 'Level three 3-2-1',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
]
|
||||
const dictStore = useDictStore()
|
||||
// 定义弹出组件元信息
|
||||
const dialogFormRef = ref()
|
||||
@@ -190,7 +125,9 @@ const resetFormContent = () => {
|
||||
const rules : Ref<Record<string, Array<FormItemRule>>> = ref({
|
||||
name :[{required:true,trigger:'blur',message:'菜单名称必填!'}],
|
||||
path :[{required:true,trigger:'blur',message:'菜单路径必填!'}],
|
||||
type :[{required:true,trigger:'change',message:'菜单类型必选!'}]
|
||||
type :[{required:true,trigger:'change',message:'菜单类型必选!'}],
|
||||
component :[{required:true,trigger:'blur',message:'组件地址必填!'}],
|
||||
code :[{required:true,trigger:'blur',message:'编码必填!'}]
|
||||
})
|
||||
|
||||
// 关闭弹窗
|
||||
@@ -207,7 +144,7 @@ const close = () => {
|
||||
try {
|
||||
console.log(formContent.value)
|
||||
dialogFormRef.value?.validate(async (valid: boolean) => {
|
||||
console.log(valid)
|
||||
|
||||
if (valid) {
|
||||
if (formContent.value.id) {
|
||||
await updateFunction(formContent.value);
|
||||
@@ -225,8 +162,11 @@ const close = () => {
|
||||
}
|
||||
}
|
||||
|
||||
const functionList = ref<Function.ResFunction[]>([])
|
||||
// 打开弹窗,可能是新增,也可能是编辑
|
||||
const open = async (sign: string, data: Function.ResFunction) => {
|
||||
const response = await getFunctionListNoButton()
|
||||
functionList.value = response.data as unknown as Function.ResFunction[]
|
||||
titleType.value = sign
|
||||
dialogVisible.value = true
|
||||
if (data.id) {
|
||||
|
||||
Reference in New Issue
Block a user