fix(全局): 表格跨页选择&接口部分 bug 修复
This commit is contained in:
parent
ac6a0ef43a
commit
c287f5d607
|
@ -227,6 +227,7 @@
|
|||
:select-row-count="selectedCount"
|
||||
:action-config="props.actionConfig"
|
||||
wrapper-id="ms-table-footer-wrapper"
|
||||
:size="props.paginationSize"
|
||||
@batch-action="handleBatchAction"
|
||||
@clear="emit('clearSelector')"
|
||||
/>
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
'ml-[8px]': idx === 0,
|
||||
}"
|
||||
type="outline"
|
||||
:size="props.size"
|
||||
@click="handleSelect(element)"
|
||||
>{{ t(element.label as string) }}</a-button
|
||||
>
|
||||
|
@ -18,6 +19,7 @@
|
|||
<a-dropdown
|
||||
v-if="!element.isDivider && element.children && hasAllPermission(element.permission as string[]) && hasAnyPermission(element.anyPermission as string[])"
|
||||
position="tr"
|
||||
:size="props.size"
|
||||
@select="handleSelect"
|
||||
>
|
||||
<a-button
|
||||
|
@ -27,6 +29,7 @@
|
|||
'ml-[8px]': idx === 0,
|
||||
}"
|
||||
type="outline"
|
||||
:size="props.size"
|
||||
@click="handleSelect"
|
||||
>{{ t(element.label as string) }}</a-button
|
||||
>
|
||||
|
@ -43,7 +46,7 @@
|
|||
</template>
|
||||
<div v-if="moreActionLength > 0" class="drop-down relative ml-[8px] inline-block">
|
||||
<a-dropdown position="tr" @select="handleSelect">
|
||||
<a-button type="outline"><MsIcon type="icon-icon_more_outlined" /></a-button>
|
||||
<a-button type="outline" :size="props.size"><MsIcon type="icon-icon_more_outlined" /></a-button>
|
||||
<template #content>
|
||||
<template v-for="element in moreAction" :key="element.label">
|
||||
<a-divider v-if="element.isDivider" margin="4px" />
|
||||
|
@ -58,7 +61,9 @@
|
|||
</template>
|
||||
</a-dropdown>
|
||||
</div>
|
||||
<a-button class="clear-btn ml-[8px]" type="text" @click="emit('clear')">{{ t('msTable.batch.clear') }}</a-button>
|
||||
<a-button class="clear-btn ml-[8px]" type="text" :size="props.size" @click="emit('clear')">
|
||||
{{ t('msTable.batch.clear') }}
|
||||
</a-button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -80,6 +85,7 @@
|
|||
selectRowCount?: number;
|
||||
actionConfig?: BatchActionConfig;
|
||||
wrapperId: string;
|
||||
size?: 'mini' | 'small' | 'medium' | 'large';
|
||||
}>();
|
||||
const emit = defineEmits<{
|
||||
(e: 'batchAction', value: BatchActionParams): void;
|
||||
|
|
|
@ -293,26 +293,24 @@ export default function useTableProps<T>(
|
|||
|
||||
// 重置选择器
|
||||
const resetSelector = (isNone = true) => {
|
||||
if (propsRes.value.selectorStatus === SelectAllEnum.ALL) {
|
||||
// 当前是跨页全部选中状态,则取消当前页的选中项
|
||||
if (isNone) {
|
||||
propsRes.value.selectorStatus = SelectAllEnum.NONE;
|
||||
// 清空选中项
|
||||
propsRes.value.selectedKeys.clear();
|
||||
propsRes.value.excludeKeys.clear();
|
||||
} else {
|
||||
// 取消当前页的选中项
|
||||
propsRes.value.data.forEach((item) => {
|
||||
propsRes.value.selectedKeys.delete(item.id);
|
||||
propsRes.value.excludeKeys.delete(item.id);
|
||||
});
|
||||
} else {
|
||||
// 当前是当前页选中状态,则清空选中项
|
||||
propsRes.value.selectedKeys.clear();
|
||||
propsRes.value.excludeKeys.clear();
|
||||
}
|
||||
if (isNone) {
|
||||
propsRes.value.selectorStatus = SelectAllEnum.NONE;
|
||||
}
|
||||
};
|
||||
|
||||
// 重置筛选
|
||||
const clearSelector = () => {
|
||||
propsRes.value.selectorStatus = SelectAllEnum.NONE; // 重置选择器状态
|
||||
resetSelector();
|
||||
resetSelector(true);
|
||||
};
|
||||
|
||||
// 获取当前表格的选中项数量
|
||||
|
@ -408,20 +406,19 @@ export default function useTableProps<T>(
|
|||
|
||||
// 表格SelectAll change
|
||||
selectAllChange: (v: SelectAllEnum) => {
|
||||
propsRes.value.selectorStatus = v;
|
||||
const { data, rowKey } = propsRes.value;
|
||||
if (v === SelectAllEnum.NONE) {
|
||||
// 清空选中项
|
||||
resetSelector();
|
||||
resetSelector(false);
|
||||
} else if (v === SelectAllEnum.CURRENT) {
|
||||
// 先清空选中项,再选中当前页面所有数据
|
||||
resetSelector();
|
||||
// 选中当前页面所有数据
|
||||
collectIds(data as MsTableDataItem<T>[], rowKey);
|
||||
} else if (v === SelectAllEnum.ALL) {
|
||||
// 全选所有页的时候先清空排除项,再选中所有数据
|
||||
propsRes.value.excludeKeys.clear();
|
||||
collectIds(data as MsTableDataItem<T>[], rowKey);
|
||||
}
|
||||
propsRes.value.selectorStatus = v;
|
||||
},
|
||||
|
||||
// 表格行的选中/取消事件
|
||||
|
|
|
@ -248,7 +248,7 @@
|
|||
JSONPath({
|
||||
json: parseJson.value,
|
||||
path: expressionForm.value.expression,
|
||||
})?.map((e) => `${e}`.replace(/Number\(([^)]+)\)/g, '$1')) || [];
|
||||
})?.map((e) => JSON.stringify(e).replace(/Number\(([^)]+)\)/g, '$1')) || [];
|
||||
} catch (error) {
|
||||
matchResult.value = JSONPath({ json: props.response || '', path: expressionForm.value.expression }) || [];
|
||||
}
|
||||
|
|
|
@ -279,7 +279,7 @@
|
|||
...node,
|
||||
copyFromStepId: node.id,
|
||||
originProjectId: node.projectId,
|
||||
id: node.stepType === ScenarioStepType.API_SCENARIO ? id : node.id, // 引用场景节点生成新的步骤 id
|
||||
id: node.isQuoteScenarioStep ? node.id : id, // 引用场景下的步骤 id 不变,其他情况的步骤生成新的 id
|
||||
uniqueId: id,
|
||||
};
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue