|
@@ -13,10 +13,10 @@ import { DictCode, ProtocolRecognitionResult, ProtocolType } from '@/constants';
|
|
import CustomParams from './CustomParams.vue';
|
|
import CustomParams from './CustomParams.vue';
|
|
import SelectStandardParams from './SelectStandardParams.vue';
|
|
import SelectStandardParams from './SelectStandardParams.vue';
|
|
|
|
|
|
-import type { FormInstance } from 'ant-design-vue';
|
|
|
|
|
|
+import type { FormInstance, TableProps } from 'ant-design-vue';
|
|
import type { DefaultOptionType, SelectValue } from 'ant-design-vue/es/select';
|
|
import type { DefaultOptionType, SelectValue } from 'ant-design-vue/es/select';
|
|
-import type { Key } from 'ant-design-vue/es/table/interface';
|
|
|
|
-import type { CheckedType, FormRules, PageParams, ProtocolBaseInfo, ProtocolParamInfo } from '@/types';
|
|
|
|
|
|
+import type { Key, SorterResult } from 'ant-design-vue/es/table/interface';
|
|
|
|
+import type { CheckedType, FormRules, PageParams, PageSorts, ProtocolBaseInfo, ProtocolParamInfo } from '@/types';
|
|
|
|
|
|
interface Props {
|
|
interface Props {
|
|
info: Partial<ProtocolBaseInfo>;
|
|
info: Partial<ProtocolBaseInfo>;
|
|
@@ -224,9 +224,34 @@ const handleParamNameOrCodeChange = debounce(() => {
|
|
getCurrentProtocolParams();
|
|
getCurrentProtocolParams();
|
|
}, 300);
|
|
}, 300);
|
|
|
|
|
|
-const handlePageChange = (page: number, pageSize: number) => {
|
|
|
|
- pageParams.value.pageIndex = page;
|
|
|
|
- pageParams.value.pageSize = pageSize;
|
|
|
|
|
|
+const handleParamTableChange: TableProps['onChange'] = (pagination, filters, sorter) => {
|
|
|
|
+ pageParams.value.pageIndex = pagination.current || 1;
|
|
|
|
+ pageParams.value.pageSize = pagination.pageSize || 10;
|
|
|
|
+
|
|
|
|
+ let sorts: SorterResult[];
|
|
|
|
+
|
|
|
|
+ if (Array.isArray(sorter)) {
|
|
|
|
+ sorts = sorter;
|
|
|
|
+ } else {
|
|
|
|
+ sorts = [sorter];
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ sorts = sorts.filter((item) => item.field !== undefined && item.order !== undefined);
|
|
|
|
+
|
|
|
|
+ if (sorts.length) {
|
|
|
|
+ pageParams.value.pageSorts = sorts.map<PageSorts>((item) => ({
|
|
|
|
+ column: item.field as string,
|
|
|
|
+ asc: item.order === 'ascend',
|
|
|
|
+ }));
|
|
|
|
+ } else {
|
|
|
|
+ pageParams.value.pageSorts = [
|
|
|
|
+ {
|
|
|
|
+ column: 'id',
|
|
|
|
+ asc: true,
|
|
|
|
+ },
|
|
|
|
+ ];
|
|
|
|
+ }
|
|
|
|
+
|
|
selectedParamIds.value = [];
|
|
selectedParamIds.value = [];
|
|
getCurrentProtocolParams();
|
|
getCurrentProtocolParams();
|
|
};
|
|
};
|
|
@@ -475,8 +500,8 @@ defineExpose({
|
|
showSizeChanger: true,
|
|
showSizeChanger: true,
|
|
hideOnSinglePage: false,
|
|
hideOnSinglePage: false,
|
|
showTotal: (total) => $t('common.pageTotal', { total }),
|
|
showTotal: (total) => $t('common.pageTotal', { total }),
|
|
- onChange: handlePageChange,
|
|
|
|
}"
|
|
}"
|
|
|
|
+ @change="handleParamTableChange"
|
|
>
|
|
>
|
|
<ATableColumn
|
|
<ATableColumn
|
|
:title="$t('setupProtocol.protocolParamFields.customParamName')"
|
|
:title="$t('setupProtocol.protocolParamFields.customParamName')"
|
|
@@ -484,7 +509,12 @@ defineExpose({
|
|
:width="180"
|
|
:width="180"
|
|
fixed="left"
|
|
fixed="left"
|
|
/>
|
|
/>
|
|
- <ATableColumn :title="$t('setupProtocol.protocolParamFields.result')" data-index="recognizeResult" :width="110">
|
|
|
|
|
|
+ <ATableColumn
|
|
|
|
+ :title="$t('setupProtocol.protocolParamFields.result')"
|
|
|
|
+ data-index="recognizeResult"
|
|
|
|
+ :width="110"
|
|
|
|
+ :sorter="true"
|
|
|
|
+ >
|
|
<template #default="{ record }">
|
|
<template #default="{ record }">
|
|
<div
|
|
<div
|
|
:class="[
|
|
:class="[
|