|
@@ -224,6 +224,10 @@ const pageParams = ref<PageParams>({
|
|
|
],
|
|
|
});
|
|
|
|
|
|
+const paramTableDataSource = computed(() => {
|
|
|
+ return props.info.id ? paramList.value : filteredLocalParams.value;
|
|
|
+});
|
|
|
+
|
|
|
const { isLoading, handleRequest } = useRequest();
|
|
|
let recognizeResult: string[] = [];
|
|
|
|
|
@@ -366,10 +370,25 @@ const changeToStandardParams = (params: ProtocolParamInfo) => {
|
|
|
selectStandardParamsRef.value?.showView();
|
|
|
};
|
|
|
|
|
|
+const localParamList = ref<ProtocolParamInfo[]>([]);
|
|
|
+
|
|
|
+const filteredLocalParams = computed(() => {
|
|
|
+ const paramInput = paramNameOrCode.value.toLowerCase();
|
|
|
+
|
|
|
+ return localParamList.value.filter((item) => {
|
|
|
+ return (
|
|
|
+ item.platformParamName?.toLowerCase().indexOf(paramInput) >= 0 ||
|
|
|
+ item.platformParamCode?.toLowerCase().indexOf(paramInput) >= 0 ||
|
|
|
+ item.gatewayParamName?.toLowerCase().indexOf(paramInput) >= 0 ||
|
|
|
+ item.gatewayParamCode?.toLowerCase().indexOf(paramInput) >= 0
|
|
|
+ );
|
|
|
+ });
|
|
|
+});
|
|
|
+
|
|
|
const addLocalStandardParams = (params: ProtocolStandardParam[]) => {
|
|
|
- const allParamIds = paramList.value.map((item) => item.id);
|
|
|
+ const allParamIds = localParamList.value.map((item) => item.id);
|
|
|
const nonRepeatingParams = params.filter((item) => !allParamIds.includes(item.id));
|
|
|
- paramList.value.push(...(nonRepeatingParams as unknown as ProtocolParamInfo[]));
|
|
|
+ localParamList.value.push(...(nonRepeatingParams as unknown as ProtocolParamInfo[]));
|
|
|
|
|
|
if (nonRepeatingParams.length < params.length) {
|
|
|
message.info(t('setupProtocol.paramsHaveFilteredOut'));
|
|
@@ -377,31 +396,31 @@ const addLocalStandardParams = (params: ProtocolStandardParam[]) => {
|
|
|
};
|
|
|
|
|
|
const editLocalStandardParam = (param: ProtocolStandardParam) => {
|
|
|
- const allParamIds = paramList.value.map((item) => item.id);
|
|
|
+ const allParamIds = localParamList.value.map((item) => item.id);
|
|
|
|
|
|
if (allParamIds.includes(param.id)) {
|
|
|
message.error(t('setupProtocol.paramAlreadyExists'));
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- const selectedParamIndex = paramList.value.findIndex((item) => item.id === selectedParamId.value);
|
|
|
- paramList.value.splice(selectedParamIndex, 1, param as unknown as ProtocolParamInfo);
|
|
|
+ const selectedParamIndex = localParamList.value.findIndex((item) => item.id === selectedParamId.value);
|
|
|
+ localParamList.value.splice(selectedParamIndex, 1, param as unknown as ProtocolParamInfo);
|
|
|
};
|
|
|
|
|
|
const addLocalCustomParam = (param: Partial<ProtocolParamInfo>) => {
|
|
|
- paramList.value.push({
|
|
|
+ localParamList.value.push({
|
|
|
...param,
|
|
|
id: Date.now(),
|
|
|
} as ProtocolParamInfo);
|
|
|
};
|
|
|
|
|
|
const deleteLocalParams = () => {
|
|
|
- paramList.value = paramList.value.filter((item) => !selectedParamIds.value.includes(item.id));
|
|
|
+ localParamList.value = localParamList.value.filter((item) => !selectedParamIds.value.includes(item.id));
|
|
|
};
|
|
|
|
|
|
const submitLocalParams = async () => {
|
|
|
if (props.info.id) {
|
|
|
- for (const item of paramList.value) {
|
|
|
+ for (const item of localParamList.value) {
|
|
|
await addProtocolParam({
|
|
|
...item,
|
|
|
baseInfoId: props.info.id,
|
|
@@ -419,7 +438,7 @@ const isAtLeastOneParam = () => {
|
|
|
if (props.info.id) {
|
|
|
isAtLeastOne = paramTotal.value > 0;
|
|
|
} else {
|
|
|
- isAtLeastOne = paramList.value.length > 0;
|
|
|
+ isAtLeastOne = localParamList.value.length > 0;
|
|
|
}
|
|
|
|
|
|
if (!isAtLeastOne) {
|
|
@@ -633,7 +652,7 @@ defineExpose({
|
|
|
</div>
|
|
|
</div>
|
|
|
<ATable
|
|
|
- :data-source="paramList"
|
|
|
+ :data-source="paramTableDataSource"
|
|
|
row-key="id"
|
|
|
:row-selection="{ selectedRowKeys: selectedParamIds, onChange: handleParamSelectChange }"
|
|
|
:scroll="{ x: 2800 }"
|