mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-11-04 00:10:25 +08:00
fix: dbms数据行编辑
This commit is contained in:
@@ -9,12 +9,9 @@
|
|||||||
:required="column.nullable != 'YES' && !column.isPrimaryKey && !column.isIdentity"
|
:required="column.nullable != 'YES' && !column.isPrimaryKey && !column.isIdentity"
|
||||||
>
|
>
|
||||||
<template #label>
|
<template #label>
|
||||||
|
<span class="pointer" :title="`${column.columnType} | ${column.columnComment}`">
|
||||||
{{ column.columnName }}
|
{{ column.columnName }}
|
||||||
<el-tooltip :content="`${column.columnType} | ${column.columnComment}`" placement="top">
|
</span>
|
||||||
<el-icon>
|
|
||||||
<question-filled />
|
|
||||||
</el-icon>
|
|
||||||
</el-tooltip>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<ColumnFormItem
|
<ColumnFormItem
|
||||||
@@ -36,7 +33,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref, watch } from 'vue';
|
import { ref, watch, onMounted } from 'vue';
|
||||||
import ColumnFormItem from './ColumnFormItem.vue';
|
import ColumnFormItem from './ColumnFormItem.vue';
|
||||||
import { DbInst } from '../../db';
|
import { DbInst } from '../../db';
|
||||||
import { ElMessage } from 'element-plus';
|
import { ElMessage } from 'element-plus';
|
||||||
@@ -65,13 +62,23 @@ const dataForm: any = ref(null);
|
|||||||
|
|
||||||
let oldValue = null as any;
|
let oldValue = null as any;
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
setOldValue();
|
||||||
|
});
|
||||||
|
|
||||||
watch(visible, (newValue) => {
|
watch(visible, (newValue) => {
|
||||||
// 空对象则为insert操作,无需记录旧值
|
if (newValue) {
|
||||||
if (newValue && Object.keys(modelValue.value).length > 0) {
|
setOldValue();
|
||||||
oldValue = Object.assign({}, modelValue.value);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const setOldValue = () => {
|
||||||
|
// 空对象则为insert操作,否则为update
|
||||||
|
if (Object.keys(modelValue.value).length > 0) {
|
||||||
|
oldValue = Object.assign({}, modelValue.value);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const closeDialog = () => {
|
const closeDialog = () => {
|
||||||
visible.value = false;
|
visible.value = false;
|
||||||
modelValue.value = {};
|
modelValue.value = {};
|
||||||
|
|||||||
Reference in New Issue
Block a user