fix: 修复部门新增上级部门回显bug
This commit is contained in:
parent
f88f462b5d
commit
be7585d856
@ -158,6 +158,11 @@ async function addInRow(row: TableDataWithIndex<Api.System.Dept>) {
|
|||||||
editingData.value = jsonClone(row);
|
editingData.value = jsonClone(row);
|
||||||
handleAdd();
|
handleAdd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function handleAddOperate() {
|
||||||
|
editingData.value = null;
|
||||||
|
handleAdd();
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@ -170,7 +175,7 @@ async function addInRow(row: TableDataWithIndex<Api.System.Dept>) {
|
|||||||
:loading="loading"
|
:loading="loading"
|
||||||
:show-add="hasAuth('system:dept:add')"
|
:show-add="hasAuth('system:dept:add')"
|
||||||
:show-delete="false"
|
:show-delete="false"
|
||||||
@add="handleAdd"
|
@add="handleAddOperate"
|
||||||
@refresh="getData"
|
@refresh="getData"
|
||||||
>
|
>
|
||||||
<template #prefix>
|
<template #prefix>
|
||||||
|
@ -55,7 +55,7 @@ const model: Model = reactive(createDefaultModel());
|
|||||||
|
|
||||||
function createDefaultModel(): Model {
|
function createDefaultModel(): Model {
|
||||||
return {
|
return {
|
||||||
parentId: props.rowData?.deptId,
|
parentId: '',
|
||||||
deptName: '',
|
deptName: '',
|
||||||
deptCategory: '',
|
deptCategory: '',
|
||||||
orderNum: null,
|
orderNum: null,
|
||||||
@ -80,6 +80,7 @@ const rules: Record<RuleKey, App.Global.FormRule> = {
|
|||||||
function handleUpdateModelWhenEdit() {
|
function handleUpdateModelWhenEdit() {
|
||||||
if (props.operateType === 'add') {
|
if (props.operateType === 'add') {
|
||||||
Object.assign(model, createDefaultModel());
|
Object.assign(model, createDefaultModel());
|
||||||
|
model.parentId = props.rowData?.deptId || 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (props.operateType === 'edit' && props.rowData) {
|
if (props.operateType === 'edit' && props.rowData) {
|
||||||
@ -185,7 +186,7 @@ watch(visible, () => {
|
|||||||
<NDrawer v-model:show="visible" :title="title" display-directive="show" :width="800" class="max-w-90%">
|
<NDrawer v-model:show="visible" :title="title" display-directive="show" :width="800" class="max-w-90%">
|
||||||
<NDrawerContent :title="title" :native-scrollbar="false" closable>
|
<NDrawerContent :title="title" :native-scrollbar="false" closable>
|
||||||
<NForm ref="formRef" :model="model" :rules="rules">
|
<NForm ref="formRef" :model="model" :rules="rules">
|
||||||
<NFormItem :label="$t('page.system.dept.parentId')" path="parentId">
|
<NFormItem v-if="model.parentId != 0" :label="$t('page.system.dept.parentId')" path="parentId">
|
||||||
<NTreeSelect
|
<NTreeSelect
|
||||||
v-model:value="model.parentId"
|
v-model:value="model.parentId"
|
||||||
:loading="deptLoading"
|
:loading="deptLoading"
|
||||||
|
Loading…
Reference in New Issue
Block a user