feat: 初始化表单数据,重置功能完善
This commit is contained in:
parent
4a81782825
commit
9070333bbc
@ -187,10 +187,17 @@ const single = ref(true);
|
|||||||
const multiple = ref(true);
|
const multiple = ref(true);
|
||||||
const total = ref(0);
|
const total = ref(0);
|
||||||
const title = ref("");
|
const title = ref("");
|
||||||
|
const createEmptyForm = () => ({
|
||||||
|
caseName: "",
|
||||||
|
expectedResult: "",
|
||||||
|
precondition: "",
|
||||||
|
testSteps: "",
|
||||||
|
testDescription: ""
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
const data = reactive({
|
const data = reactive({
|
||||||
form: {},
|
form: createEmptyForm(),
|
||||||
queryParams: {
|
queryParams: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
@ -283,7 +290,8 @@ function handleStatusChange(row) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const reset = () => {
|
const reset = () => {
|
||||||
testCaseRef.value.resetFields()
|
testCaseRef.value?.resetFields()
|
||||||
|
form.value = createEmptyForm()
|
||||||
};
|
};
|
||||||
|
|
||||||
const testCaseRef = ref()
|
const testCaseRef = ref()
|
||||||
@ -291,6 +299,7 @@ const isNew = ref(true)
|
|||||||
|
|
||||||
/** 添加 */
|
/** 添加 */
|
||||||
function handleAdd() {
|
function handleAdd() {
|
||||||
|
reset();
|
||||||
open.value = true;
|
open.value = true;
|
||||||
isNew.value = true
|
isNew.value = true
|
||||||
title.value = "添加";
|
title.value = "添加";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user