- );
- };
- return (
-
- {renderCheckbox()}
+ onChange={handleWholeSelect}
+ />
(
{t('本页全选')}
-
{t('跨页全选')}
+
handleWholeSelect(!isWholeChecked.value)}>{t('跨页全选')}
),
}}>
- );
- },
+ )
+ ,
render: ({ data }: {data: any}) => {
const selectDisabled = props.disableSelectMethod(data);
const tips = {
@@ -231,19 +235,19 @@
...props.paginationExtra,
});
// 是否本页全选
- const isCurrentPageAllSelected = computed(() => {
- const list = tableData.value.results;
- if (list.length < 1) {
- return false;
- }
- const selectMap = { ...rowSelectMemo.value };
- for (let i = 0; i < list.length; i++) {
- if (!selectMap[_.get(list[i], props.primaryKey)]) {
- return false;
- }
- }
- return true;
- });
+ // const isCurrentPageAllSelected = computed(() => {
+ // const list = tableData.value.results;
+ // if (list.length < 1) {
+ // return false;
+ // }
+ // const selectMap = { ...rowSelectMemo.value };
+ // for (let i = 0; i < list.length; i++) {
+ // if (!selectMap[_.get(list[i], props.primaryKey)]) {
+ // return false;
+ // }
+ // }
+ // return true;
+ // });
const localColumns = computed(() => {
if (!props.selectable || !props.columns) {
@@ -370,21 +374,21 @@
};
// 切换当前页全选
- const handleTogglePageSelect = (checked: boolean) => {
- const selectMap = { ...rowSelectMemo.value };
- tableData.value.results.forEach((dataItem: any) => {
- if (checked) {
- selectMap[_.get(dataItem, props.primaryKey)] = dataItem;
- } else {
- delete selectMap[_.get(dataItem, props.primaryKey)];
- }
- });
- if (!checked) {
- isWholeChecked.value = false;
- }
- rowSelectMemo.value = selectMap;
- triggerSelection();
- };
+ // const handleTogglePageSelect = (checked: boolean) => {
+ // const selectMap = { ...rowSelectMemo.value };
+ // tableData.value.results.forEach((dataItem: any) => {
+ // if (checked) {
+ // selectMap[_.get(dataItem, props.primaryKey)] = dataItem;
+ // } else {
+ // delete selectMap[_.get(dataItem, props.primaryKey)];
+ // }
+ // });
+ // if (!checked) {
+ // isWholeChecked.value = false;
+ // }
+ // rowSelectMemo.value = selectMap;
+ // triggerSelection();
+ // };
// 清空选择
const handleClearWholeSelect = () => {
@@ -394,24 +398,30 @@
};
// 跨页全选
- const handleWholeSelect = () => {
- props.dataSource({
- offset: (pagination.current - 1) * pagination.limit,
- limit: -1,
- ...paramsMemo,
- ...sortParams,
- }).then((data) => {
- const selectMap = { ...rowSelectMemo.value };
- data.results.forEach((dataItem: any) => {
- if (props.disableSelectMethod(dataItem)) {
- return;
- }
- selectMap[_.get(dataItem, props.primaryKey)] = dataItem;
+ const handleWholeSelect = (value: boolean) => {
+ if (value) {
+ props.dataSource({
+ offset: (pagination.current - 1) * pagination.limit,
+ limit: -1,
+ ...paramsMemo,
+ ...sortParams,
+ }).then((data) => {
+ const selectMap = { ...rowSelectMemo.value };
+ data.results.forEach((dataItem: any) => {
+ if (props.disableSelectMethod(dataItem)) {
+ return;
+ }
+ selectMap[_.get(dataItem, props.primaryKey)] = dataItem;
+ });
+ rowSelectMemo.value = selectMap;
+ isWholeChecked.value = true;
+ triggerSelection();
});
- rowSelectMemo.value = selectMap;
- isWholeChecked.value = true;
+ } else {
+ rowSelectMemo.value = {};
+ isWholeChecked.value = false;
triggerSelection();
- });
+ }
};
// 选中单行
diff --git a/dbm-ui/frontend/src/views/resource-manage/pool/host-list/components/import-host/components/select-host-panel/Index.vue b/dbm-ui/frontend/src/views/resource-manage/pool/host-list/components/import-host/components/select-host-panel/Index.vue
index 24f42dbc8b..3cd3b585f2 100644
--- a/dbm-ui/frontend/src/views/resource-manage/pool/host-list/components/import-host/components/select-host-panel/Index.vue
+++ b/dbm-ui/frontend/src/views/resource-manage/pool/host-list/components/import-host/components/select-host-panel/Index.vue
@@ -145,6 +145,7 @@
};
const handleSearch = () => {
+ tableRef.value!.clearSelected();
fetchData();
};
diff --git a/dbm-ui/frontend/src/views/resource-manage/spec/components/SpecList.vue b/dbm-ui/frontend/src/views/resource-manage/spec/components/SpecList.vue
index 4efb8549c5..65d9c908ed 100644
--- a/dbm-ui/frontend/src/views/resource-manage/spec/components/SpecList.vue
+++ b/dbm-ui/frontend/src/views/resource-manage/spec/components/SpecList.vue
@@ -423,6 +423,7 @@
props.machineType,
searchKey.value,
], () => {
+ tableRef.value!.clearSelected();
fetchData();
});
diff --git a/dbm-ui/frontend/src/views/temporary-paassword-modify/components/render-passwrod-instance/RenderInstance.vue b/dbm-ui/frontend/src/views/temporary-paassword-modify/components/render-passwrod-instance/RenderInstance.vue
index 27d889e7ee..f93d5f75d4 100644
--- a/dbm-ui/frontend/src/views/temporary-paassword-modify/components/render-passwrod-instance/RenderInstance.vue
+++ b/dbm-ui/frontend/src/views/temporary-paassword-modify/components/render-passwrod-instance/RenderInstance.vue
@@ -51,14 +51,13 @@
format="yyyy-MM-dd HH:mm:ss"
:placeholder="t('请选择')"
type="datetimerange"
- @change="getDataSource"
- @clear="getDataSource" />
+ @change="handleSearchValueChange" />
+ @change="handleSearchValueChange" />