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