diff --git a/frontend/src/components/pure/ms-form-create/form-create.ts b/frontend/src/components/pure/ms-form-create/form-create.ts index 54fa0e0e0f..3c23389fa9 100644 --- a/frontend/src/components/pure/ms-form-create/form-create.ts +++ b/frontend/src/components/pure/ms-form-create/form-create.ts @@ -68,9 +68,10 @@ export const MEMBER = { value: '', options: [], props: { - multiple: false, + 'multiple': false, // 'placeholder': t('formCreate.PleaseSelect'), - modelValue: '', + 'modelValue': '', + 'allow-clear': true, }, }; @@ -81,10 +82,11 @@ export const MULTIPLE_MEMBER = { value: [], options: [], props: { - multiple: true, + 'multiple': true, // 'placeholder': t('formCreate.PleaseSelect'), - options: [], - modelValue: [], + 'options': [], + 'modelValue': [], + 'allow-clear': true, }, }; diff --git a/frontend/src/components/pure/ms-form-create/searchSelect.vue b/frontend/src/components/pure/ms-form-create/searchSelect.vue index e6db1a97e0..046b5d11d9 100644 --- a/frontend/src/components/pure/ms-form-create/searchSelect.vue +++ b/frontend/src/components/pure/ms-form-create/searchSelect.vue @@ -4,6 +4,7 @@ v-model:model-value="selectValue" :placeholder="t(props.placeholder || 'common.pleaseSelect')" allow-search + allow-clear :multiple="props.multiple" @search="searchHandler" > diff --git a/frontend/src/store/modules/setting/useProjectEnvStore.ts b/frontend/src/store/modules/setting/useProjectEnvStore.ts index 1560f0b552..39dd469b22 100644 --- a/frontend/src/store/modules/setting/useProjectEnvStore.ts +++ b/frontend/src/store/modules/setting/useProjectEnvStore.ts @@ -55,6 +55,14 @@ const envParamsDefaultConfig: EnvConfig = { }, }; +const defaultAllParams = { + projectId: '', + globalParams: { + headers: [], + commonVariables: [], + }, +}; + const useProjectEnvStore = defineStore( 'projectEnv', () => { @@ -75,7 +83,9 @@ const useProjectEnvStore = defineStore( description: '', config: cloneDeep(envParamsDefaultConfig), }); - const allParamDetailInfo = ref(); // 全局参数详情 + const allParamDetailInfo = ref(defaultAllParams); // 全局参数详情 + + const backupAllParamDetailInfo = ref(defaultAllParams); const httpNoWarning = ref(true); const getHttpNoWarning = computed(() => httpNoWarning.value); @@ -112,7 +122,11 @@ const useProjectEnvStore = defineStore( config: cloneDeep(envParamsDefaultConfig), }; } else if (id === ALL_PARAM) { - allParamDetailInfo.value = await getGlobalParamDetail(appStore.currentProjectId); + const res = await getGlobalParamDetail(appStore.currentProjectId); + allParamDetailInfo.value = cloneDeep(res || defaultAllParams); + nextTick(() => { + backupAllParamDetailInfo.value = cloneDeep(allParamDetailInfo.value); + }); } else if (id !== ALL_PARAM && id) { const tmpObj = await getDetailEnv(id); currentEnvDetailInfo.value = { ...tmpObj }; @@ -187,6 +201,7 @@ const useProjectEnvStore = defineStore( setCurrentGroupId, setHttpNoWarning, setAllParamDetailInfo, + backupAllParamDetailInfo, initEnvDetail, initContentTabList, getContentTabList, diff --git a/frontend/src/views/api-test/debug/locale/zh-CN.ts b/frontend/src/views/api-test/debug/locale/zh-CN.ts index 309dbec8f5..81dddd5cac 100644 --- a/frontend/src/views/api-test/debug/locale/zh-CN.ts +++ b/frontend/src/views/api-test/debug/locale/zh-CN.ts @@ -185,7 +185,7 @@ export default { 'apiTestDebug.importByCURLTip': '支持快速导入 Chrome、Charles 或 Fiddler 等工具中的抓包数据', 'apiTestDebug.noPluginTip': '该插件已卸载,无法查看插件详情', 'apiTestDebug.noPlugin': '插件已卸载', - 'apiTestDebug.unsavedLeave': '有标签页的内容未保存,离开后后未保存的内容将丢失,确定要离开吗?', + 'apiTestDebug.unsavedLeave': '有标签页的内容未保存,离开后未保存的内容将丢失,确定要离开吗?', 'apiTestDebug.testSuccess': '测试成功', 'apiTestDebug.searchByDataBaseName': '按数据源名称搜索', 'apiTestDebug.regexMatchRules': '表达式匹配规则', diff --git a/frontend/src/views/case-management/caseManagementFeature/components/tableFilter.vue b/frontend/src/views/case-management/caseManagementFeature/components/tableFilter.vue index bde264243e..f51bcda1b0 100644 --- a/frontend/src/views/case-management/caseManagementFeature/components/tableFilter.vue +++ b/frontend/src/views/case-management/caseManagementFeature/components/tableFilter.vue @@ -28,7 +28,7 @@ -
+
import { Message } from '@arco-design/web-vue'; + import { cloneDeep } from 'lodash-es'; import RequestHeader from './requestHeader/index.vue'; @@ -34,7 +35,6 @@ const appStore = useAppStore(); const activeKey = ref('requestHeader'); - const headerParams = ref([]); const GlobalVariable = ref([]); const { t } = useI18n(); const { setIsSave } = useLeaveUnSaveTip(); @@ -54,25 +54,35 @@ }, ]; + const headerParams = computed({ + get() { + return projectEnvStore.allParamDetailInfo?.globalParams.headers || []; + }, + set(val) { + projectEnvStore.allParamDetailInfo.globalParams.headers = val; + }, + }); + function initEnvDetail() { - projectEnvStore.initEnvDetail().then(() => { - headerParams.value = projectEnvStore.allParamDetailInfo?.globalParams.headers || []; - GlobalVariable.value = projectEnvStore.allParamDetailInfo?.globalParams.commonVariables || []; - }); + projectEnvStore.initEnvDetail(); + headerParams.value = projectEnvStore.allParamDetailInfo.globalParams.headers || []; } function change() { canSave.value = true; + projectEnvStore.allParamDetailInfo.globalParams.headers = cloneDeep(headerParams.value); setIsSave(false); } + const handleSave = async () => { try { loading.value = true; + const headerParamsFilter = headerParams.value.filter((item) => item.key); const params = { id: projectEnvStore.allParamDetailInfo?.id, projectId: appStore.currentProjectId, globalParams: { - headers: headerParams.value, + headers: headerParamsFilter, commonVariables: GlobalVariable.value.map((item) => { return { key: item.key, diff --git a/frontend/src/views/project-management/environmental/components/envParams/preAndPost.vue b/frontend/src/views/project-management/environmental/components/envParams/preAndPost.vue index 91b1dff449..6ed768e42b 100644 --- a/frontend/src/views/project-management/environmental/components/envParams/preAndPost.vue +++ b/frontend/src/views/project-management/environmental/components/envParams/preAndPost.vue @@ -5,7 +5,13 @@
- {{ t('project.environmental.sceneAlertDesc') }} + + {{ + props.activeType === EnvTabTypeEnum.ENVIRONMENT_PRE + ? t('project.environmental.scenePreAlertDesc') + : t('project.environmental.scenePostAlertDesc') + }} + - {{ t('project.environmental.requestAlertDesc') }} + + {{ + props.activeType === EnvTabTypeEnum.ENVIRONMENT_PRE + ? t('project.environmental.requestPreAlertDesc') + : t('project.environmental.requestPostAlertDesc') + }} + { const selectFieldIds = selectData.value.map((e) => e.id); const newData = dataList.filter((item) => !selectFieldIds.includes(item.id)); - selectData.value = [...selectData.value, ...newData]; + const newIds = dataList.map((item) => item.id); + // @desc 原先已经选择过的选项value值不能再次添加的时候置空 + const selectDataValue = selectData.value.filter((item) => newIds.includes(item.id)); + selectData.value = [...selectDataValue, ...newData]; }; function changeState(value: boolean | (string | number | boolean)[], formItem) {