update:优化了“添加配置”页面和“修改配置”页面,修复了“添加配置”页面非正常关闭添加对话框时,没有正确重置对话框的状态

This commit is contained in:
CGD
2025-04-09 14:08:05 +08:00
parent 0be5350a1c
commit 0e81a165e4
2 changed files with 84 additions and 48 deletions
@@ -1,5 +1,5 @@
<template>
<el-dialog :visible.sync="visible" width="975px" center custom-class="custom-dialog" :show-close="false"
<el-dialog :visible="dialogVisible" @update:visible="handleVisibleChange" width="975px" center custom-class="custom-dialog" :show-close="false"
class="center-dialog">
<div style="margin: 0 18px; text-align: left; padding: 10px; border-radius: 10px;">
<div style="font-size: 30px; color: #3d4566; margin-top: -10px; margin-bottom: 10px; text-align: center;">
@@ -63,7 +63,7 @@
<div style="font-size: 20px; font-weight: bold; color: #3d4566; margin-bottom: 15px;">调用信息</div>
<div style="height: 2px; background: #e9e9e9; margin-bottom: 22px;"></div>
<el-form :model="formData.configJson" label-width="100px" label-position="left" class="custom-form">
<el-form :model="formData.configJson" label-width="auto" label-position="left" class="custom-form">
<template v-for="(row, rowIndex) in chunkedCallInfoFields">
<div :key="rowIndex" style="display: flex; gap: 20px; margin-bottom: 0;">
<el-form-item
@@ -104,6 +104,7 @@ export default {
data() {
return {
providers: [],
dialogVisible: false,
providersLoaded: false,
providerFields: [],
currentProvider: null,
@@ -122,8 +123,11 @@ export default {
},
watch: {
visible(val) {
this.dialogVisible = val;
if(val) {
this.initConfigJson();
} else {
this.resetForm();
}
},
'formData.supplier'(newVal) {
@@ -171,6 +175,17 @@ export default {
});
this.formData.configJson = { ...defaultConfig };
},
handleVisibleChange(val) {
this.dialogVisible = val;
this.$emit('update:visible', val);
if (!val) {
this.resetForm();
}
},
handleClose() {
this.$emit('update:visible', false);
},
initDynamicConfig() {
const newConfig = {};
this.providerFields.forEach(field => {
@@ -223,10 +238,6 @@ export default {
this.providerFields = [];
this.currentProvider = null;
},
handleClose() {
this.resetForm();
this.$emit('update:visible', false);
}
}
}
</script>