fix(项目管理): 修复项目管理环境管理bug

This commit is contained in:
xinxin.wu 2025-01-21 15:35:23 +08:00 committed by Craftsman
parent 728ce4d5df
commit 1adeeead3f
2 changed files with 16 additions and 7 deletions

View File

@ -89,7 +89,7 @@
const innerInputValue = defineModel<string>('inputValue', {
default: '',
});
const tagsLength = ref(props.modelValue.length); // tagstag
const tagsLength = ref((props.modelValue || []).length); // tagstag
const isError = computed(
() =>

View File

@ -28,6 +28,7 @@
:add-type-text="t('project.environmental.env.constantBatchAddTip')"
:params="innerParams"
no-param-type
:default-param-item="defaultParamItem"
@apply="handleBatchParamApply"
/>
</template>
@ -40,6 +41,8 @@
import { TableKeyEnum } from '@/enums/tableEnum';
import { filterKeyValParams } from '@/views/api-test/components/utils';
defineOptions({ name: 'EnvManagementAllParams' });
const props = withDefaults(
@ -144,13 +147,11 @@
* 批量参数代码转换为参数表格数据
*/
function handleBatchParamApply(resultArr: any[]) {
resultArr.forEach((item) => {
item.paramType = 'CONSTANT';
});
if (resultArr.length < innerParams.value.length) {
innerParams.value.splice(0, innerParams.value.length - 1, ...resultArr);
const filterResult = filterKeyValParams(innerParams.value, defaultParamItem);
if (filterResult.lastDataIsDefault) {
innerParams.value = [...resultArr, innerParams.value[innerParams.value.length - 1]].filter(Boolean);
} else {
innerParams.value = [...resultArr, innerParams.value[innerParams.value.length - 1]];
innerParams.value = resultArr.filter(Boolean);
}
emit('change');
}
@ -186,6 +187,14 @@
}
}
);
onBeforeMount(() => {
searchValue.value = '';
});
onBeforeUnmount(() => {
innerParams.value = [...backupParams.value];
});
</script>
<style lang="less" scoped></style>