Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
H
hr-admin-view
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
anjia-hr
hr-admin-view
Commits
60fc2adf
Commit
60fc2adf
authored
Nov 21, 2025
by
刘斌
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修复表单修改和新增
parent
a0af350f
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
175 additions
and
115 deletions
+175
-115
form.vue
apps/web-antd/src/views/auth/dept/form.vue
+14
-11
form.vue
apps/web-antd/src/views/auth/menu/form.vue
+15
-9
form.vue
apps/web-antd/src/views/auth/post/form.vue
+15
-8
form.vue
apps/web-antd/src/views/auth/role/form.vue
+17
-12
form.vue
apps/web-antd/src/views/auth/user/form.vue
+12
-7
form.vue
apps/web-antd/src/views/system/client/form.vue
+13
-8
form.vue
apps/web-antd/src/views/system/config/form.vue
+15
-8
form.vue
apps/web-antd/src/views/system/dict/data/form.vue
+8
-9
model.vue
apps/web-antd/src/views/system/dict/type/model.vue
+15
-8
form.vue
apps/web-antd/src/views/system/job/form.vue
+15
-8
modal.vue
apps/web-antd/src/views/system/notice/modal.vue
+15
-8
form.vue
apps/web-antd/src/views/system/tenant/form.vue
+6
-8
form.vue
apps/web-antd/src/views/system/tenantPackage/form.vue
+15
-11
No files found.
apps/web-antd/src/views/auth/dept/form.vue
View file @
60fc2adf
...
...
@@ -16,7 +16,7 @@ import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
const
emit
=
defineEmits
<
{
success
:
[];
}
>
();
const
formData
=
ref
<
SysDeptApi
.
Dept
>
({}
);
const
isUpdate
=
ref
(
false
);
function
genDeptTree
(
deptList
:
SysDeptApi
.
Dept
[]):
SysDeptApi
.
Dept
[]
{
const
top
:
SysDeptApi
.
Dept
=
{
...
...
@@ -37,6 +37,15 @@ function genDeptTree(deptList: SysDeptApi.Dept[]): SysDeptApi.Dept[] {
}
const
formSchema
:
VbenFormSchema
[]
=
[
{
component
:
'Input'
,
dependencies
:
{
show
:
()
=>
false
,
triggerFields
:
[
''
],
},
fieldName
:
'id'
,
label
:
'id'
,
},
{
component
:
'ApiTreeSelect'
,
componentProps
:
{
...
...
@@ -131,12 +140,8 @@ const [Drawer, drawerApi] = useVbenDrawer({
return
null
;
}
const
data
=
drawerApi
.
getData
<
SysDeptApi
.
Dept
>
();
if
(
data
)
{
formData
.
value
=
data
;
await
formApi
.
setValues
(
formData
.
value
);
}
else
{
await
formApi
.
resetForm
();
}
isUpdate
.
value
=
!!
data
.
id
;
await
(
isUpdate
.
value
?
formApi
.
setValues
(
data
)
:
formApi
.
resetForm
());
await
markInitialized
();
},
});
...
...
@@ -147,9 +152,7 @@ async function onSubmit() {
drawerApi
.
lock
();
const
data
=
await
formApi
.
getValues
<
SysDeptApi
.
Dept
>
();
try
{
await
(
formData
.
value
?.
id
?
apiUpdate
({
id
:
formData
.
value
.
id
,
...
data
})
:
apiAdd
(
data
));
await
(
isUpdate
.
value
?
apiUpdate
(
data
)
:
apiAdd
(
data
));
resetInitialized
();
emit
(
'success'
);
drawerApi
.
close
();
...
...
@@ -165,7 +168,7 @@ async function handleClosed() {
}
const
getDrawerTitle
=
computed
(()
=>
formData
.
value
?.
id
?
'修改部门'
:
'新增部门'
,
isUpdate
.
value
?
'修改部门'
:
'新增部门'
,
);
</
script
>
<
template
>
...
...
apps/web-antd/src/views/auth/menu/form.vue
View file @
60fc2adf
...
...
@@ -20,7 +20,7 @@ import { getMenuTypeOptions } from './data';
const
emit
=
defineEmits
<
{
success
:
[];
}
>
();
const
formData
=
ref
<
SysMenuApi
.
menu
>
({}
);
const
isUpdate
=
ref
(
false
);
const
loading
=
ref
(
false
);
function
filterMenuTree
(
menuList
:
SysMenuApi
.
menu
[]):
SysMenuApi
.
menu
[]
{
...
...
@@ -39,6 +39,15 @@ function filterMenuTree(menuList: SysMenuApi.menu[]): SysMenuApi.menu[] {
}
const
formSchema
:
VbenFormSchema
[]
=
[
{
component
:
'Input'
,
dependencies
:
{
show
:
()
=>
false
,
triggerFields
:
[
''
],
},
fieldName
:
'id'
,
label
:
'id'
,
},
{
component
:
'ApiTreeSelect'
,
componentProps
:
{
...
...
@@ -225,9 +234,9 @@ const [Drawer, drawerApi] = useVbenDrawer({
loading
.
value
=
true
;
const
data
=
drawerApi
.
getData
<
SysMenuApi
.
menu
>
();
i
f
(
data
)
{
formData
.
value
=
data
;
await
formApi
.
setValues
(
formData
.
value
);
i
sUpdate
.
value
=
!!
data
.
id
;
if
(
isUpdate
.
value
)
{
await
formApi
.
setValues
(
data
);
}
else
{
formApi
.
resetForm
();
}
...
...
@@ -244,10 +253,7 @@ async function onSubmit() {
const
data
=
await
formApi
.
getValues
<
Omit
<
SysMenuApi
.
menu
,
'children'
|
'id'
>>
();
try
{
// await saveOne({ id: formData.value.id || 0, ...data });
await
(
formData
.
value
?.
id
?
apiUpdate
({
id
:
formData
.
value
.
id
,
...
data
})
:
apiAdd
(
data
));
await
(
isUpdate
.
value
?
apiUpdate
(
data
)
:
apiAdd
(
data
));
resetInitialized
();
emit
(
'success'
);
drawerApi
.
close
();
...
...
@@ -263,7 +269,7 @@ async function handleClosed() {
}
const
getDrawerTitle
=
computed
(()
=>
formData
.
value
?.
id
?
'修改菜单'
:
'新增菜单'
,
isUpdate
.
value
?
'修改菜单'
:
'新增菜单'
,
);
</
script
>
<
template
>
...
...
apps/web-antd/src/views/auth/post/form.vue
View file @
60fc2adf
...
...
@@ -18,7 +18,7 @@ import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
const
emit
=
defineEmits
<
{
success
:
[];
}
>
();
const
formData
=
ref
<
PostApi
.
Post
>
(
);
const
isUpdate
=
ref
(
false
);
function
genDeptTree
(
deptList
:
SysDeptApi
.
Dept
[]):
SysDeptApi
.
Dept
[]
{
const
top
:
SysDeptApi
.
Dept
=
{
...
...
@@ -39,6 +39,15 @@ function genDeptTree(deptList: SysDeptApi.Dept[]): SysDeptApi.Dept[] {
}
const
formSchema
:
VbenFormSchema
[]
=
[
{
component
:
'Input'
,
dependencies
:
{
show
:
()
=>
false
,
triggerFields
:
[
''
],
},
fieldName
:
'id'
,
label
:
'id'
,
},
{
component
:
'ApiTreeSelect'
,
componentProps
:
{
...
...
@@ -137,9 +146,9 @@ const [Drawer, drawerApi] = useVbenDrawer({
return
null
;
}
const
data
=
drawerApi
.
getData
<
PostApi
.
Post
>
();
i
f
(
data
)
{
formData
.
value
=
data
;
await
formApi
.
setValues
(
formData
.
value
);
i
sUpdate
.
value
=
!!
data
.
id
;
if
(
isUpdate
.
value
)
{
await
formApi
.
setValues
(
data
);
}
else
{
formApi
.
resetForm
();
}
...
...
@@ -153,9 +162,7 @@ async function onSubmit() {
drawerApi
.
lock
();
const
data
=
await
formApi
.
getValues
<
PostApi
.
Post
>
();
try
{
await
(
formData
.
value
?.
id
?
apiUpdate
({
id
:
formData
.
value
.
id
,
...
data
})
:
apiAdd
(
data
));
await
(
isUpdate
.
value
?
apiUpdate
(
data
)
:
apiAdd
(
data
));
resetInitialized
();
emit
(
'success'
);
drawerApi
.
close
();
...
...
@@ -171,7 +178,7 @@ async function handleClosed() {
}
const
getDrawerTitle
=
computed
(()
=>
formData
.
value
?.
id
?
'修改岗位信息'
:
'新增岗位信息'
,
isUpdate
.
value
?
'修改岗位信息'
:
'新增岗位信息'
,
);
</
script
>
<
template
>
...
...
apps/web-antd/src/views/auth/role/form.vue
View file @
60fc2adf
...
...
@@ -20,9 +20,18 @@ type MenuOption = SysMenuApi.MenuOption;
const
emit
=
defineEmits
<
{
success
:
[];
}
>
();
const
formData
=
ref
<
SysRoleApi
.
Role
>
({}
);
const
isUpdate
=
ref
(
false
);
const
formSchema
:
VbenFormSchema
[]
=
[
{
component
:
'Input'
,
dependencies
:
{
show
:
()
=>
false
,
triggerFields
:
[
''
],
},
fieldName
:
'id'
,
label
:
'id'
,
},
{
component
:
'Input'
,
fieldName
:
'name'
,
...
...
@@ -120,12 +129,14 @@ const [Drawer, drawerApi] = useVbenDrawer({
}
drawerApi
.
drawerLoading
(
true
);
const
{
id
}
=
drawerApi
.
getData
()
as
{
id
?:
number
};
isUpdate
.
value
=
!!
id
;
let
checkedKeys
:
number
[]
=
[];
if
(
id
)
{
if
(
i
sUpdate
.
value
&&
i
d
)
{
const
data
=
await
getRoleDetail
(
id
);
checkedKeys
=
data
.
menuIds
;
formData
.
value
=
data
;
await
formApi
.
setValues
(
formData
.
value
);
await
formApi
.
setValues
(
data
);
}
else
{
formApi
.
resetForm
();
}
await
setupMenuTree
(
checkedKeys
);
await
markInitialized
();
...
...
@@ -166,13 +177,7 @@ async function onSubmit() {
const
data
=
await
formApi
.
getValues
<
SysRoleApi
.
Role
>
();
data
.
menuIds
=
menuIds
;
try
{
await
(
formData
.
value
?.
id
?
apiUpdate
({
id
:
formData
.
value
.
id
,
...
data
})
:
apiAdd
(
data
));
// await saveRole({
// sysRole: { id: formData.value.id || 0, ...data },
// menuIds,
// });
await
(
isUpdate
.
value
?
apiUpdate
(
data
)
:
apiAdd
(
data
));
resetInitialized
();
emit
(
'success'
);
drawerApi
.
close
();
...
...
@@ -188,7 +193,7 @@ async function handleClosed() {
}
const
getDrawerTitle
=
computed
(()
=>
formData
.
value
?.
id
?
'修改角色'
:
'新增角色'
,
isUpdate
.
value
?
'修改角色'
:
'新增角色'
,
);
/**
...
...
apps/web-antd/src/views/auth/user/form.vue
View file @
60fc2adf
...
...
@@ -25,7 +25,6 @@ import { authScopeOptions } from '#/views/auth/role/data';
const
emit
=
defineEmits
<
{
success
:
[];
}
>
();
const
formData
=
ref
<
SysUserApi
.
User
>
({});
const
isUpdate
=
ref
(
false
);
function
genDeptTree
(
deptList
:
SysDeptApi
.
Dept
[]):
SysDeptApi
.
Dept
[]
{
const
top
:
SysDeptApi
.
Dept
=
{
...
...
@@ -46,6 +45,15 @@ function genDeptTree(deptList: SysDeptApi.Dept[]): SysDeptApi.Dept[] {
}
const
formSchema
:
VbenFormSchema
[]
=
[
{
component
:
'Input'
,
dependencies
:
{
show
:
()
=>
false
,
triggerFields
:
[
''
],
},
fieldName
:
'id'
,
label
:
'id'
,
},
{
component
:
'Input'
,
fieldName
:
'name'
,
...
...
@@ -210,8 +218,7 @@ const [Drawer, drawerApi] = useVbenDrawer({
isUpdate
.
value
=
!!
id
;
if
(
id
)
{
const
data
=
await
getUserDetail
(
id
);
formData
.
value
=
data
;
formApi
.
setValues
(
formData
.
value
);
formApi
.
setValues
(
data
);
// 更新时不会触发onSelect 需要手动调用
await
setupPostOptions
(
data
.
deptId
);
}
else
{
...
...
@@ -290,9 +297,7 @@ async function onSubmit() {
drawerApi
.
lock
();
const
data
=
await
formApi
.
getValues
<
SysUserApi
.
User
>
();
try
{
await
(
formData
.
value
?.
id
?
apiUpdate
({
id
:
formData
.
value
.
id
,
...
data
})
:
apiAdd
(
data
));
await
(
isUpdate
.
value
?
apiUpdate
(
data
)
:
apiAdd
(
data
));
resetInitialized
();
emit
(
'success'
);
drawerApi
.
close
();
...
...
@@ -308,7 +313,7 @@ async function handleClosed() {
}
const
getDrawerTitle
=
computed
(()
=>
formData
.
value
?.
id
?
'修改系统用户'
:
'新增系统用户'
,
isUpdate
.
value
?
'修改系统用户'
:
'新增系统用户'
,
);
</
script
>
<
template
>
...
...
apps/web-antd/src/views/system/client/form.vue
View file @
60fc2adf
...
...
@@ -18,10 +18,18 @@ import SecretInput from './secret-input.vue';
const
emit
=
defineEmits
<
{
success
:
[];
}
>
();
const
formData
=
ref
<
SysClientApi
.
Client
>
({});
const
isUpdate
=
ref
(
false
);
const
formSchema
:
VbenFormSchema
[]
=
[
{
component
:
'Input'
,
dependencies
:
{
show
:
()
=>
false
,
triggerFields
:
[
''
],
},
fieldName
:
'id'
,
label
:
'id'
,
},
{
component
:
'Input'
,
fieldName
:
'clientId'
,
...
...
@@ -143,9 +151,8 @@ const [Drawer, drawerApi] = useVbenDrawer({
fieldName
:
'status'
,
},
]);
if
(
data
)
{
formData
.
value
=
data
;
await
formApi
.
setValues
(
formData
.
value
);
if
(
isUpdate
.
value
)
{
await
formApi
.
setValues
(
data
);
}
else
{
formApi
.
resetForm
();
}
...
...
@@ -184,9 +191,7 @@ async function onSubmit() {
const
data
=
await
formApi
.
getValues
<
SysClientApi
.
Client
>
();
try
{
// await apiSave({ id: formData.value.id || 0, ...data });
await
(
formData
.
value
?.
id
?
apiUpdate
({
id
:
formData
.
value
.
id
,
...
data
})
:
apiAdd
(
data
));
await
(
isUpdate
.
value
?
apiUpdate
(
data
)
:
apiAdd
(
data
));
resetInitialized
();
emit
(
'success'
);
drawerApi
.
close
();
...
...
@@ -202,7 +207,7 @@ async function handleClosed() {
}
const
getDrawerTitle
=
computed
(()
=>
formData
.
value
?.
id
?
'修改终端信息'
:
'新增终端信息'
,
isUpdate
.
value
?
'修改终端信息'
:
'新增终端信息'
,
);
</
script
>
<
template
>
...
...
apps/web-antd/src/views/system/config/form.vue
View file @
60fc2adf
...
...
@@ -15,9 +15,18 @@ import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
const
emit
=
defineEmits
<
{
success
:
[];
}
>
();
const
formData
=
ref
<
SysConfigApi
.
Config
>
(
);
const
isUpdate
=
ref
(
false
);
const
formSchema
:
VbenFormSchema
[]
=
[
{
component
:
'Input'
,
dependencies
:
{
show
:
()
=>
false
,
triggerFields
:
[
''
],
},
fieldName
:
'id'
,
label
:
'id'
,
},
{
component
:
'Input'
,
fieldName
:
'configName'
,
...
...
@@ -85,9 +94,9 @@ const [Drawer, drawerApi] = useVbenDrawer({
return
null
;
}
const
data
=
drawerApi
.
getData
<
SysConfigApi
.
Config
>
();
i
f
(
data
)
{
formData
.
value
=
data
;
await
formApi
.
setValues
(
formData
.
value
);
i
sUpdate
.
value
=
!!
data
?.
id
;
if
(
isUpdate
.
value
)
{
await
formApi
.
setValues
(
data
);
}
else
{
formApi
.
resetForm
();
}
...
...
@@ -101,9 +110,7 @@ async function onSubmit() {
drawerApi
.
lock
();
const
data
=
await
formApi
.
getValues
<
SysConfigApi
.
Config
>
();
try
{
await
(
formData
.
value
?.
id
?
apiUpdate
({
id
:
formData
.
value
.
id
,
...
data
})
:
apiAdd
(
data
));
await
(
isUpdate
.
value
?
apiUpdate
(
data
)
:
apiAdd
(
data
));
drawerApi
.
close
();
emit
(
'success'
);
}
finally
{
...
...
@@ -118,7 +125,7 @@ async function handleClosed() {
}
const
getDrawerTitle
=
computed
(()
=>
formData
.
value
?.
id
?
'修改参数配置'
:
'新增参数配置'
,
isUpdate
.
value
?
'修改参数配置'
:
'新增参数配置'
,
);
</
script
>
<
template
>
...
...
apps/web-antd/src/views/system/dict/data/form.vue
View file @
60fc2adf
...
...
@@ -20,7 +20,7 @@ import { tagSelectOptions } from './data';
const
emit
=
defineEmits
<
{
success
:
[];
}
>
();
const
formData
=
ref
<
DictDataApi
.
DictData
>
(
);
const
isUpdate
=
ref
(
false
);
const
tagSelectList
=
ref
(
tagSelectOptions
());
const
newTag
=
ref
(
''
);
...
...
@@ -33,7 +33,8 @@ const formSchema: VbenFormSchema[] = [
show
:
()
=>
false
,
triggerFields
:
[
''
],
},
fieldName
:
'dictId'
,
fieldName
:
'id'
,
label
:
'id'
,
},
{
component
:
'Input'
,
...
...
@@ -111,9 +112,9 @@ const [Drawer, drawerApi] = useVbenDrawer({
return
null
;
}
const
data
=
drawerApi
.
getData
<
DictDataApi
.
DictData
>
();
i
f
(
data
)
{
formData
.
value
=
data
;
await
formApi
.
setValues
(
formData
.
value
);
i
sUpdate
.
value
=
!!
data
?.
id
;
if
(
isUpdate
.
value
)
{
await
formApi
.
setValues
(
data
);
}
else
{
formApi
.
resetForm
();
}
...
...
@@ -127,9 +128,7 @@ async function onSubmit() {
drawerApi
.
lock
();
const
data
=
await
formApi
.
getValues
<
DictDataApi
.
DictData
>
();
try
{
await
(
formData
.
value
?.
id
?
apiUpdate
({
id
:
formData
.
value
.
id
,
...
data
})
:
apiAdd
(
data
));
await
(
isUpdate
.
value
?
apiUpdate
(
data
)
:
apiAdd
(
data
));
resetInitialized
();
emit
(
'success'
);
drawerApi
.
close
();
...
...
@@ -166,7 +165,7 @@ async function handleClosed() {
}
const
getDrawerTitle
=
computed
(()
=>
formData
.
value
?.
id
?
'修改字典明细'
:
'新增字典明细'
,
isUpdate
.
value
?
'修改字典明细'
:
'新增字典明细'
,
);
</
script
>
<
template
>
...
...
apps/web-antd/src/views/system/dict/type/model.vue
View file @
60fc2adf
...
...
@@ -13,9 +13,18 @@ import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
const
emit
=
defineEmits
<
{
success
:
[];
}
>
();
const
formData
=
ref
<
DictTypeApi
.
DictType
>
(
);
const
isUpdate
=
ref
(
false
);
const
formSchema
:
VbenFormSchema
[]
=
[
{
component
:
'Input'
,
dependencies
:
{
show
:
()
=>
false
,
triggerFields
:
[
''
],
},
fieldName
:
'id'
,
label
:
'id'
,
},
{
component
:
'Input'
,
fieldName
:
'dictName'
,
...
...
@@ -73,9 +82,9 @@ const [BasicModal, modalApi] = useVbenModal({
modalApi
.
modalLoading
(
true
);
const
data
=
modalApi
.
getData
<
DictTypeApi
.
DictType
>
();
i
f
(
data
)
{
formData
.
value
=
data
;
await
formApi
.
setValues
(
formData
.
value
);
i
sUpdate
.
value
=
!!
data
?.
id
;
if
(
isUpdate
.
value
)
{
await
formApi
.
setValues
(
data
);
}
await
markInitialized
();
...
...
@@ -89,9 +98,7 @@ async function onSubmit() {
modalApi
.
lock
();
const
data
=
await
formApi
.
getValues
<
DictTypeApi
.
DictType
>
();
try
{
await
(
formData
.
value
?.
id
?
apiUpdate
({
id
:
formData
.
value
.
id
,
...
data
})
:
apiAdd
(
data
));
await
(
isUpdate
.
value
?
apiUpdate
(
data
)
:
apiAdd
(
data
));
resetInitialized
();
emit
(
'success'
);
modalApi
.
close
();
...
...
@@ -107,7 +114,7 @@ async function handleClosed() {
}
const
getModalTitle
=
computed
(()
=>
formData
.
value
?.
id
?
'修改字典类型'
:
'新增字典类型'
,
isUpdate
.
value
?
'修改字典类型'
:
'新增字典类型'
,
);
</
script
>
<
template
>
...
...
apps/web-antd/src/views/system/job/form.vue
View file @
60fc2adf
...
...
@@ -16,9 +16,18 @@ import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
const
emit
=
defineEmits
<
{
success
:
[];
}
>
();
const
formData
=
ref
<
SysJobApi
.
SysJob
>
(
);
const
isUpdate
=
ref
(
false
);
const
formSchema
:
VbenFormSchema
[]
=
[
{
component
:
'Input'
,
dependencies
:
{
show
:
()
=>
false
,
triggerFields
:
[
''
],
},
fieldName
:
'id'
,
label
:
'id'
,
},
{
component
:
'Select'
,
componentProps
:
{
...
...
@@ -109,9 +118,9 @@ const [Drawer, drawerApi] = useVbenDrawer({
return
null
;
}
const
data
=
drawerApi
.
getData
<
SysJobApi
.
SysJob
>
();
i
f
(
data
)
{
formData
.
value
=
data
;
await
formApi
.
setValues
(
formData
.
value
);
i
sUpdate
.
value
=
!!
data
?.
id
;
if
(
isUpdate
.
value
)
{
await
formApi
.
setValues
(
data
);
}
else
{
formApi
.
resetForm
();
}
...
...
@@ -125,9 +134,7 @@ async function onSubmit() {
drawerApi
.
lock
();
const
data
=
await
formApi
.
getValues
<
SysJobApi
.
SysJob
>
();
try
{
await
(
formData
.
value
?.
id
?
apiUpdate
({
id
:
formData
.
value
.
id
,
...
data
})
:
apiAdd
(
data
));
await
(
isUpdate
.
value
?
apiUpdate
(
data
)
:
apiAdd
(
data
));
resetInitialized
();
emit
(
'success'
);
drawerApi
.
close
();
...
...
@@ -143,7 +150,7 @@ async function handleClosed() {
}
const
getDrawerTitle
=
computed
(()
=>
formData
.
value
?.
id
?
'修改定时任务'
:
'新增定时任务'
,
isUpdate
.
value
?
'修改定时任务'
:
'新增定时任务'
,
);
</
script
>
<
template
>
...
...
apps/web-antd/src/views/system/notice/modal.vue
View file @
60fc2adf
...
...
@@ -16,9 +16,18 @@ import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
const
emit
=
defineEmits
<
{
success
:
[];
}
>
();
const
formData
=
ref
<
NoticeApi
.
Notice
>
(
);
const
isUpdate
=
ref
(
false
);
const
formSchema
:
VbenFormSchema
[]
=
[
{
component
:
'Input'
,
dependencies
:
{
show
:
()
=>
false
,
triggerFields
:
[
''
],
},
fieldName
:
'id'
,
label
:
'id'
,
},
{
component
:
'Input'
,
fieldName
:
'noticeTitle'
,
...
...
@@ -103,9 +112,9 @@ const [BasicModal, modalApi] = useVbenModal({
modalApi
.
modalLoading
(
true
);
const
data
=
modalApi
.
getData
<
NoticeApi
.
Notice
>
();
i
f
(
data
)
{
formData
.
value
=
data
;
await
formApi
.
setValues
(
formData
.
value
);
i
sUpdate
.
value
=
!!
data
?.
id
;
if
(
isUpdate
.
value
)
{
await
formApi
.
setValues
(
data
);
}
await
markInitialized
();
...
...
@@ -119,9 +128,7 @@ async function onSubmit() {
modalApi
.
lock
();
const
data
=
await
formApi
.
getValues
<
NoticeApi
.
Notice
>
();
try
{
await
(
formData
.
value
?.
id
?
apiUpdate
({
id
:
formData
.
value
.
id
,
...
data
})
:
apiAdd
(
data
));
await
(
isUpdate
.
value
?
apiUpdate
(
data
)
:
apiAdd
(
data
));
resetInitialized
();
emit
(
'success'
);
modalApi
.
close
();
...
...
@@ -137,7 +144,7 @@ async function handleClosed() {
}
const
getModalTitle
=
computed
(()
=>
formData
.
value
?.
id
?
'修改通知公告'
:
'新增通知公告'
,
isUpdate
.
value
?
'修改通知公告'
:
'新增通知公告'
,
);
</
script
>
<
template
>
...
...
apps/web-antd/src/views/system/tenant/form.vue
View file @
60fc2adf
...
...
@@ -21,7 +21,7 @@ import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
const
emit
=
defineEmits
<
{
success
:
[];
}
>
();
const
formData
=
ref
<
SysTenantApi
.
Tenant
>
(
);
const
isUpdate
=
ref
(
false
);
const
loading
=
ref
(
false
);
const
tenantStore
=
useTenantStore
();
const
router
=
useRouter
();
...
...
@@ -289,9 +289,9 @@ const [Drawer, drawerApi] = useVbenDrawer({
loading
.
value
=
true
;
const
data
=
drawerApi
.
getData
<
SysTenantApi
.
Tenant
>
();
i
f
(
data
)
{
formData
.
value
=
data
;
await
formApi
.
setValues
(
formData
.
value
);
i
sUpdate
.
value
=
!!
data
?.
id
;
if
(
isUpdate
.
value
)
{
await
formApi
.
setValues
(
data
);
}
else
{
formApi
.
resetForm
();
}
...
...
@@ -307,9 +307,7 @@ async function onSubmit() {
drawerApi
.
lock
();
const
data
=
await
formApi
.
getValues
<
SysTenantApi
.
Tenant
>
();
try
{
await
(
formData
.
value
?.
id
?
apiUpdate
({
id
:
formData
.
value
.
id
,
...
data
})
:
apiAdd
(
data
));
await
(
isUpdate
.
value
?
apiUpdate
(
data
)
:
apiAdd
(
data
));
resetInitialized
();
emit
(
'success'
);
drawerApi
.
close
();
...
...
@@ -327,7 +325,7 @@ async function handleClosed() {
}
const
getDrawerTitle
=
computed
(()
=>
formData
.
value
?.
id
?
'修改租户'
:
'新增租户'
,
isUpdate
.
value
?
'修改租户'
:
'新增租户'
,
);
</
script
>
<
template
>
...
...
apps/web-antd/src/views/system/tenantPackage/form.vue
View file @
60fc2adf
<
script
lang=
"ts"
setup
>
import
type
{
VbenFormSchema
}
from
'#/adapter/form'
;
import
type
{
SysMenuApi
}
from
'#/api/auth/menu'
;
import
type
{
TenantPackageApi
}
from
'#/api/system/sysTenantPackage'
;
import
{
computed
,
nextTick
,
ref
}
from
'vue'
;
import
{
useVbenDrawer
}
from
'@vben/common-ui'
;
import
{
cloneDeep
}
from
'@vben/utils'
;
import
{
omit
}
from
'lodash-es'
;
import
{
useVbenForm
}
from
'#/adapter/form'
;
import
{
apiMenuTree
}
from
'#/api/auth/menu'
;
import
{
apiAdd
,
apiDetail
,
apiUpdate
}
from
'#/api/system/sysTenantPackage'
;
...
...
@@ -21,9 +18,18 @@ type MenuOption = SysMenuApi.MenuOption;
const
emit
=
defineEmits
<
{
success
:
[];
}
>
();
const
formData
=
ref
<
TenantPackageApi
.
TenantPackage
>
(
);
const
isUpdate
=
ref
(
false
);
const
formSchema
:
VbenFormSchema
[]
=
[
{
component
:
'Input'
,
dependencies
:
{
show
:
()
=>
false
,
triggerFields
:
[
''
],
},
fieldName
:
'id'
,
label
:
'id'
,
},
{
component
:
'Input'
,
fieldName
:
'packageName'
,
...
...
@@ -85,11 +91,11 @@ const [Drawer, drawerApi] = useVbenDrawer({
return
null
;
}
const
{
id
}
=
drawerApi
.
getData
()
as
{
id
:
number
};
isUpdate
.
value
=
!!
id
;
let
checkedKeys
:
number
[]
=
[];
if
(
id
)
{
if
(
i
sUpdate
.
value
&&
i
d
)
{
const
data
=
await
apiDetail
(
id
);
formData
.
value
=
omit
(
data
,
[
'menuIds'
]);
await
formApi
.
setValues
(
formData
.
value
);
await
formApi
.
setValues
(
data
);
checkedKeys
=
data
.
menuIds
?
data
.
menuIds
.
split
(
','
).
map
(
Number
)
:
[];
}
else
{
formApi
.
resetForm
();
...
...
@@ -127,9 +133,7 @@ async function onSubmit() {
const
data
=
cloneDeep
(
await
formApi
.
getValues
());
data
.
menuIds
=
menuIds
;
try
{
await
(
formData
.
value
?.
id
?
apiUpdate
({
id
:
formData
.
value
.
id
,
...
data
})
:
apiAdd
(
data
));
await
(
isUpdate
.
value
?
apiUpdate
(
data
)
:
apiAdd
(
data
));
resetInitialized
();
emit
(
'success'
);
drawerApi
.
close
();
...
...
@@ -145,7 +149,7 @@ async function handleClosed() {
}
const
getDrawerTitle
=
computed
(()
=>
formData
.
value
?.
id
?
'修改租户套餐'
:
'新增租户套餐'
,
isUpdate
.
value
?
'修改租户套餐'
:
'新增租户套餐'
,
);
/**
* 通过回调更新 无法通过v-model
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment