fix(项目管理): 添加误报规则后,再次点开抽屉未清空上次数据

--bug=1035862 --user=王旭 新增误报规则时,关闭抽屉再次新增时没有清空已添加的数据 https://www.tapd.cn/55049933/s/1465424
This commit is contained in:
WangXu10 2024-02-27 11:22:26 +08:00 committed by 刘瑞斌
parent 31854f01cd
commit d5b497d38d
2 changed files with 51 additions and 48 deletions

View File

@ -288,8 +288,10 @@
* 添加表单项
*/
function addField() {
const item = [{ ...formItem }];
item[0].type = []
formValidate(() => {
form.value.list.push({ ...formItem }); //
form.value.list.push(item[0]); //
}, false);
}

View File

@ -174,6 +174,51 @@
return `${header} ${relation} ${record.expression}`;
};
const batchFormModels: Ref<FormItemModel[]> = ref([
{
filed: 'name',
type: 'input',
label: 'project.menu.rule.ruleName',
rules: [
{ required: true, message: t('project.menu.rule.ruleNameNotNull') },
{ notRepeat: true, message: 'project.menu.rule.ruleNameRepeat' },
],
},
{
filed: 'type',
type: 'tagInput',
label: 'project.menu.rule.label',
},
{
filed: 'rule',
type: 'multiple',
label: 'project.menu.rule.rule',
hasRedStar: true,
children: [
{
filed: 'respType', // -/header/data/body
type: 'select',
options: headerOptions.value,
className: 'w-[205px]',
defaultValue: 'RESPONSE_HEADERS',
},
{
filed: 'relation', // -
type: 'select',
options: relationOptions.value,
className: 'w-[120px]',
defaultValue: 'equal',
},
{
filed: 'expression', // -
type: 'input',
rules: [{ required: true, message: t('project.menu.rule.expressionNotNull') }],
className: 'w-[301px]',
},
],
},
]);
const rulesColumn: MsTableColumn = [
{
title: 'project.menu.rule.name',
@ -369,9 +414,9 @@
if (shouldSearch) {
fetchData();
}
if (isClose) {
addVisible.value = false;
}
addVisible.value = false;
batchFormRef.value.resetForm();
currentList.value = [];
};
const handleConfirm = () => {
@ -426,50 +471,6 @@
}
}
const batchFormModels: Ref<FormItemModel[]> = ref([
{
filed: 'name',
type: 'input',
label: 'project.menu.rule.ruleName',
rules: [
{ required: true, message: t('project.menu.rule.ruleNameNotNull') },
{ notRepeat: true, message: 'project.menu.rule.ruleNameRepeat' },
],
},
{
filed: 'type',
type: 'tagInput',
label: 'project.menu.rule.label',
},
{
filed: 'rule',
type: 'multiple',
label: 'project.menu.rule.rule',
hasRedStar: true,
children: [
{
filed: 'respType', // -/header/data/body
type: 'select',
options: headerOptions.value,
className: 'w-[205px]',
defaultValue: 'RESPONSE_HEADERS',
},
{
filed: 'relation', // -
type: 'select',
options: relationOptions.value,
className: 'w-[120px]',
defaultValue: 'equal',
},
{
filed: 'expression', // -
type: 'input',
rules: [{ required: true, message: t('project.menu.rule.expressionNotNull') }],
className: 'w-[301px]',
},
],
},
]);
onMounted(() => {
setLoadListParams({ projectId: currentProjectId.value });