feat: 解决批量删除之后选中数据清除问题
This commit is contained in:
@@ -338,6 +338,7 @@
|
|||||||
},
|
},
|
||||||
confirm: true,
|
confirm: true,
|
||||||
isReload: true,
|
isReload: true,
|
||||||
|
isClearCheck: true,
|
||||||
api: origanizemanage.batchDel,
|
api: origanizemanage.batchDel,
|
||||||
dynamicParams: { userIds: 'userId[]' },
|
dynamicParams: { userIds: 'userId[]' },
|
||||||
},
|
},
|
||||||
|
@@ -72,8 +72,11 @@
|
|||||||
},
|
},
|
||||||
setup(props) {
|
setup(props) {
|
||||||
const { columnActions, searchData, data } = toRefs(props);
|
const { columnActions, searchData, data } = toRefs(props);
|
||||||
|
|
||||||
const reload = inject('reload', () => {});
|
const reload = inject('reload', () => {});
|
||||||
const { filterAction, transformAction } = useAction({ reload });
|
const clearCheck = inject('clearCheck', () => {});
|
||||||
|
|
||||||
|
const { filterAction, transformAction } = useAction({ reload, clearCheck });
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const getData = computed(() => {
|
const getData = computed(() => {
|
||||||
return {
|
return {
|
||||||
|
@@ -232,6 +232,10 @@
|
|||||||
loadErrorMessage: '',
|
loadErrorMessage: '',
|
||||||
loadinterval: 0,
|
loadinterval: 0,
|
||||||
});
|
});
|
||||||
|
const clearCheck = () => {
|
||||||
|
tableState.selectedRowKeys = [];
|
||||||
|
tableState.selectedRows = [];
|
||||||
|
};
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { getColumnActionWidth } = useTableColumn({
|
const { getColumnActionWidth } = useTableColumn({
|
||||||
columnActions: Object.assign({}, tableConfig.columnActions, props.columnActions),
|
columnActions: Object.assign({}, tableConfig.columnActions, props.columnActions),
|
||||||
@@ -410,8 +414,6 @@
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(getPagination.value);
|
|
||||||
|
|
||||||
const getTableBindValues = computed(() => {
|
const getTableBindValues = computed(() => {
|
||||||
const { params, dynamicParams } = props;
|
const { params, dynamicParams } = props;
|
||||||
return {
|
return {
|
||||||
@@ -511,7 +513,6 @@
|
|||||||
tableState.loadError = false;
|
tableState.loadError = false;
|
||||||
tableState.loadErrorMessage = '';
|
tableState.loadErrorMessage = '';
|
||||||
dataRef.value = res;
|
dataRef.value = res;
|
||||||
console.log(props.listField);
|
|
||||||
tableData.value = get(unref(dataRef), props.listField);
|
tableData.value = get(unref(dataRef), props.listField);
|
||||||
//saas项目配置
|
//saas项目配置
|
||||||
if (attrs['getPageParams']) {
|
if (attrs['getPageParams']) {
|
||||||
@@ -617,10 +618,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
provide('reload', reload); //提供刷新功能
|
provide('reload', reload); //提供刷新功能
|
||||||
|
provide('clearCheck', clearCheck); //提供清空选中功能
|
||||||
|
|
||||||
return {
|
return {
|
||||||
navigateBack,
|
navigateBack,
|
||||||
reload,
|
reload,
|
||||||
|
clearCheck,
|
||||||
formElRef,
|
formElRef,
|
||||||
tableElRef,
|
tableElRef,
|
||||||
getColumnActions,
|
getColumnActions,
|
||||||
|
@@ -39,6 +39,7 @@ export interface Action {
|
|||||||
type?: string; //按钮 primary | ghost | dashed | link | text | default
|
type?: string; //按钮 primary | ghost | dashed | link | text | default
|
||||||
dynamicDisabled?: boolean | Function;
|
dynamicDisabled?: boolean | Function;
|
||||||
isReload?: boolean;
|
isReload?: boolean;
|
||||||
|
isClearCheck?: boolean; // 清空table选中行数据
|
||||||
state?: String; // edit 为编辑态 其他为编辑中
|
state?: String; // edit 为编辑态 其他为编辑中
|
||||||
extra?: Recordable;
|
extra?: Recordable;
|
||||||
}
|
}
|
||||||
@@ -50,11 +51,12 @@ export interface Action {
|
|||||||
*/
|
*/
|
||||||
interface actionParams {
|
interface actionParams {
|
||||||
reload?: Function;
|
reload?: Function;
|
||||||
|
clearCheck?: Function;
|
||||||
}
|
}
|
||||||
export function useAction(actionParams: actionParams = {}) {
|
export function useAction(actionParams: actionParams = {}) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { reload } = actionParams;
|
const { reload, clearCheck } = actionParams;
|
||||||
const { getPath } = usePath();
|
const { getPath } = usePath();
|
||||||
const { httpRequest } = useApi();
|
const { httpRequest } = useApi();
|
||||||
const authService = authorizationService();
|
const authService = authorizationService();
|
||||||
@@ -169,6 +171,7 @@ export function useAction(actionParams: actionParams = {}) {
|
|||||||
checkDefaultParams,
|
checkDefaultParams,
|
||||||
handle,
|
handle,
|
||||||
isReload = false,
|
isReload = false,
|
||||||
|
isClearCheck = false,
|
||||||
extra,
|
extra,
|
||||||
} = action;
|
} = action;
|
||||||
const { getParams } = useParams();
|
const { getParams } = useParams();
|
||||||
@@ -239,6 +242,7 @@ export function useAction(actionParams: actionParams = {}) {
|
|||||||
api: null,
|
api: null,
|
||||||
handle,
|
handle,
|
||||||
isReload,
|
isReload,
|
||||||
|
isClearCheck,
|
||||||
};
|
};
|
||||||
let modelInstance: Recordable = {};
|
let modelInstance: Recordable = {};
|
||||||
if (name && name.toLowerCase().includes('exports')) {
|
if (name && name.toLowerCase().includes('exports')) {
|
||||||
@@ -332,6 +336,9 @@ export function useAction(actionParams: actionParams = {}) {
|
|||||||
if (isReload) {
|
if (isReload) {
|
||||||
isFunction(reload) && reload();
|
isFunction(reload) && reload();
|
||||||
}
|
}
|
||||||
|
if (isClearCheck) {
|
||||||
|
isFunction(clearCheck) && clearCheck();
|
||||||
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
modeUpdate({
|
modeUpdate({
|
||||||
okButtonProps: {
|
okButtonProps: {
|
||||||
|
Reference in New Issue
Block a user