REVIEW 租户套餐

This commit is contained in:
YunaiV 2023-03-30 09:35:35 +08:00
parent 216ad84938
commit 84ab75b475

View File

@ -33,7 +33,6 @@
<el-tree
ref="treeRef"
node-key="id"
:check-strictly="!menuCheckStrictly"
show-checkbox
:props="defaultProps"
:data="menuOptions"
@ -91,7 +90,6 @@ const formRules = reactive({
})
const formRef = ref() // Ref
const menuOptions = ref<any[]>([]) //
const menuCheckStrictly = ref(false) // true
const menuExpand = ref(false) // /
const treeRef = ref<InstanceType<typeof ElTree>>() // Ref
const treeNodeAll = ref(false) // /
@ -102,6 +100,8 @@ const open = async (type: string, id?: number) => {
modelTitle.value = t('action.' + type)
formType.value = type
resetForm()
// Menu setChecked
menuOptions.value = handleTree(await MenuApi.getSimpleMenusList())
//
if (id) {
formLoading.value = true
@ -110,15 +110,13 @@ const open = async (type: string, id?: number) => {
//
formData.value = res
//
res.menuIds?.forEach((item: any) => {
treeRef.value?.setChecked(item, true, false)
res.menuIds.forEach((menuId: number) => {
treeRef.value.setChecked(menuId, true, false)
})
} finally {
formLoading.value = false
}
}
// Menu
menuOptions.value = handleTree(await MenuApi.getSimpleMenusList())
}
defineExpose({ open }) // open
@ -134,8 +132,8 @@ const submitForm = async () => {
try {
const data = formData.value as unknown as TenantPackageApi.TenantPackageVO
data.menuIds = [
...(treeRef.value!.getCheckedKeys(false) as unknown as Array<number>),
...(treeRef.value!.getHalfCheckedKeys() as unknown as Array<number>)
...(treeRef.value!.getCheckedKeys(false) as unknown as Array<number>), //
...(treeRef.value!.getHalfCheckedKeys() as unknown as Array<number>) //
]
if (formType.value === 'create') {
await TenantPackageApi.createTenantPackage(data)
@ -154,6 +152,10 @@ const submitForm = async () => {
/** 重置表单 */
const resetForm = () => {
//
treeNodeAll.value = false
menuExpand.value = false
//
formData.value = {
id: null,
name: null,
@ -162,10 +164,6 @@ const resetForm = () => {
status: CommonStatusEnum.ENABLE
}
treeRef.value?.setCheckedNodes([])
treeNodeAll.value = false
menuExpand.value = false
// 使
menuCheckStrictly.value = false
formRef.value?.resetFields()
}
@ -173,6 +171,7 @@ const resetForm = () => {
const handleCheckedTreeNodeAll = () => {
treeRef.value!.setCheckedNodes(treeNodeAll.value ? menuOptions.value : [])
}
// /TODO:for
const handleCheckedTreeExpand = () => {
const nodes = treeRef.value?.store.nodesMap