Skip to content

Commit

Permalink
fix(projects): fix manage page edit data. fixed #32
Browse files Browse the repository at this point in the history
  • Loading branch information
honghuangdc committed Jun 26, 2024
1 parent 455880b commit 740d6f5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
6 changes: 4 additions & 2 deletions src/views/manage/menu/modules/menu-operate-modal.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="tsx">
import { computed, reactive, ref, watch } from 'vue';
import { computed, nextTick, reactive, ref, watch } from 'vue';
import { SimpleScrollbar } from '@sa/materials';
import { useAntdForm, useFormRules } from '@/hooks/common/form';
import { $t } from '@/locales';
Expand Down Expand Up @@ -206,11 +206,13 @@ function removeButton(index: number) {
model.buttons.splice(index, 1);
}
function handleInitModel() {
async function handleInitModel() {
Object.assign(model, createDefaultModel());
if (!props.rowData) return;
await nextTick();
if (props.operateType === 'addChild') {
const { id } = props.rowData;
Expand Down
5 changes: 3 additions & 2 deletions src/views/manage/role/modules/role-operate-drawer.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { computed, reactive, watch } from 'vue';
import { computed, nextTick, reactive, watch } from 'vue';
import { useBoolean } from '@sa/hooks';
import { useAntdForm, useFormRules } from '@/hooks/common/form';
import { $t } from '@/locales';
Expand Down Expand Up @@ -68,10 +68,11 @@ const roleId = computed(() => props.rowData?.id || -1);
const isEdit = computed(() => props.operateType === 'edit');
function handleInitModel() {
async function handleInitModel() {
Object.assign(model, createDefaultModel());
if (props.operateType === 'edit' && props.rowData) {
await nextTick();
Object.assign(model, props.rowData);
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/views/manage/user/modules/user-operate-drawer.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { computed, reactive, ref, watch } from 'vue';
import { computed, nextTick, reactive, ref, watch } from 'vue';
import { useAntdForm, useFormRules } from '@/hooks/common/form';
import { fetchGetAllRoles } from '@/service/api';
import { $t } from '@/locales';
Expand Down Expand Up @@ -89,10 +89,11 @@ async function getRoleOptions() {
}
}
function handleInitModel() {
async function handleInitModel() {
Object.assign(model, createDefaultModel());
if (props.operateType === 'edit' && props.rowData) {
await nextTick();
Object.assign(model, props.rowData);
}
}
Expand Down

0 comments on commit 740d6f5

Please sign in to comment.