fix(测试规划): 资源池不存在提示
This commit is contained in:
parent
c93580b591
commit
a53f332650
|
@ -126,11 +126,13 @@
|
|||
</a-form-item>
|
||||
<template v-if="configForm.type !== PlanMinderCollectionType.FUNCTIONAL">
|
||||
<a-form-item :label="t('system.project.resourcePool')">
|
||||
<a-select
|
||||
<MsSelect
|
||||
v-model:model-value="configForm.testResourcePoolId"
|
||||
:options="resourcePoolOptions"
|
||||
:disabled="configForm.level === 2 && configForm.extended"
|
||||
></a-select>
|
||||
:option-not-exits-text="t('system.resourcePool.notExit')"
|
||||
>
|
||||
</MsSelect>
|
||||
</a-form-item>
|
||||
<a-form-item :label="t('project.environmental.env')">
|
||||
<a-select
|
||||
|
@ -181,6 +183,7 @@
|
|||
mode="button"
|
||||
:step="1"
|
||||
:min="1"
|
||||
:max="10"
|
||||
:precision="0"
|
||||
:disabled="configForm.level === 2 && configForm.extended"
|
||||
size="small"
|
||||
|
@ -239,6 +242,7 @@
|
|||
MinderJsonNodeData,
|
||||
} from '@/components/pure/ms-minder-editor/props';
|
||||
import { setCustomPriorityView } from '@/components/pure/ms-minder-editor/script/tool/utils';
|
||||
import MsSelect from '@/components/business/ms-select';
|
||||
import caseAssociate from './associateDrawer.vue';
|
||||
|
||||
import { getPoolOption } from '@/api/modules/api-test/management';
|
||||
|
@ -452,6 +456,7 @@
|
|||
|
||||
// 优先级与串行/并行文本映射
|
||||
const priorityTextMap: Record<number, string> = {
|
||||
1: '!',
|
||||
2: t('ms.minders.serial'),
|
||||
3: t('ms.minders.parallel'),
|
||||
};
|
||||
|
@ -470,7 +475,7 @@
|
|||
|
||||
const configFormRef = ref<FormInstance>();
|
||||
const configForm = ref<PlanMinderNodeData>();
|
||||
const resourcePoolOptions = ref<SelectOptionData[]>();
|
||||
const resourcePoolOptions = ref<SelectOptionData[]>([]);
|
||||
const environmentOptions = computed(() => [
|
||||
{
|
||||
label: t('testPlan.testPlanIndex.defaultEnv'),
|
||||
|
@ -786,6 +791,7 @@
|
|||
level,
|
||||
isNew: false,
|
||||
changed: false,
|
||||
priority: node.data.priority === 0 ? 1 : node.data.priority,
|
||||
disabled: level !== 2, // 只有测试点能改文本
|
||||
};
|
||||
return node;
|
||||
|
|
|
@ -36,6 +36,7 @@ export interface MsSearchSelectProps {
|
|||
triggerProps?: TriggerProps; // 触发器属性
|
||||
loading?: boolean; // 加载状态
|
||||
fallbackOption?: boolean | ((value: string | number | boolean | Record<string, unknown>) => SelectOptionData); // 自定义值中不存在的选项
|
||||
optionNotExitsText?: string; // 选项不存在时的提示文案
|
||||
shouldCalculateMaxTag?: boolean; // 是否需要计算最大展示选项数量
|
||||
disabled?: boolean; // 是否禁用
|
||||
size?: 'mini' | 'small' | 'medium' | 'large'; // 尺寸
|
||||
|
@ -68,7 +69,7 @@ export default defineComponent(
|
|||
const inputValue = ref('');
|
||||
const tempInputValue = ref('');
|
||||
const filterOptions = ref<SelectOptionData[]>([...props.options]); // 实际渲染的 options,会根据搜索关键字进行过滤
|
||||
const remoteOriginOptions = ref<SelectOptionData[]>([...props.options]); // 远程模式下的原始 options,接口返回的数据会存储在这里
|
||||
const remoteOriginOptions = ref<SelectOptionData[]>([...props.options]); // 远程模式下的原始 options,接口返回的数据会存储在这里;静态模式下,默认为 options
|
||||
|
||||
const selectRef = ref();
|
||||
const { maxTagCount, getOptionComputedStyle, singleTagMaxWidth, calculateMaxTag } = useSelect({
|
||||
|
@ -445,6 +446,19 @@ export default defineComponent(
|
|||
return props.allowClear;
|
||||
});
|
||||
|
||||
function checkOptionExit(label?: string) {
|
||||
const option = remoteOriginOptions.value.find((e) => e[props.labelKey || 'label'] === label);
|
||||
return option ? option[props.labelKey || 'label'] : props.optionNotExitsText || t('ms.select.optionsNotExits');
|
||||
}
|
||||
|
||||
function fallbackNotExitOption(value: string | number | boolean | Record<string, any>) {
|
||||
return {
|
||||
label: checkOptionExit(typeof value === 'object' ? value[props.labelKey || 'label'] : value),
|
||||
value,
|
||||
disabled: true,
|
||||
};
|
||||
}
|
||||
|
||||
return () => (
|
||||
<div class="w-full">
|
||||
<a-tooltip
|
||||
|
@ -471,7 +485,7 @@ export default defineComponent(
|
|||
value-key={props.valueKey || 'value'}
|
||||
popup-container={props.popupContainer || document.body}
|
||||
trigger-props={props.triggerProps}
|
||||
fallback-option={props.fallbackOption}
|
||||
fallback-option={props.fallbackOption || fallbackNotExitOption}
|
||||
disabled={props.disabled}
|
||||
size={props.size}
|
||||
onChange={handleChange}
|
||||
|
@ -510,7 +524,7 @@ export default defineComponent(
|
|||
class="one-line-text"
|
||||
style={singleTagMaxWidth.value > 0 ? { maxWidth: `${singleTagMaxWidth.value}px` } : {}}
|
||||
>
|
||||
{slots.label ? slots.label(data) : data.label}
|
||||
{slots.label ? slots.label(data) : checkOptionExit(data.label)}
|
||||
</div>
|
||||
</a-tooltip>
|
||||
),
|
||||
|
@ -550,6 +564,7 @@ export default defineComponent(
|
|||
'atLeastOne',
|
||||
'objectValue',
|
||||
'remoteFilterFunc',
|
||||
'optionNotExitsText',
|
||||
'shouldCalculateMaxTag',
|
||||
'disabled',
|
||||
'size',
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
export default {
|
||||
'ms.select.optionsNotExits': 'Options not exist',
|
||||
};
|
|
@ -0,0 +1,3 @@
|
|||
export default {
|
||||
'ms.select.optionsNotExits': '选项不存在',
|
||||
};
|
|
@ -130,4 +130,5 @@ export default {
|
|||
'The community edition only supports 1 resource, if you need to add more resources, you can apply',
|
||||
'system.resourcePool.concurrentNumberMinToolTip':
|
||||
'The maximum number of concurrent requests for a single node in the Community version is 10. If you want more, you can apply',
|
||||
'system.resourcePool.notExit': 'Resource pool does not exist',
|
||||
};
|
||||
|
|
|
@ -121,4 +121,5 @@ export default {
|
|||
'system.resourcePool.addAndContinue': '保存并继续添加',
|
||||
'system.resourcePool.supportMultiResource': '社区版仅支持 1 个资源,如需添加更多资源,可申请',
|
||||
'system.resourcePool.concurrentNumberMinToolTip': '社区版单个节点最大并发数为 10,如需更大并发数,可申请',
|
||||
'system.resourcePool.notExit': '资源池不存在',
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue