parent
77cb17b7c3
commit
ffc79bc469
|
@ -30,30 +30,13 @@
|
||||||
|
|
||||||
// get inherit binding value
|
// get inherit binding value
|
||||||
const getBindValues = computed(() => {
|
const getBindValues = computed(() => {
|
||||||
// update-begin--author:liaozhiyang---date:20231228---for:【issues/936】表格操作栏删除当接口失败时,气泡确认框不会消失
|
return Object.assign(
|
||||||
const result: any = Object.assign(
|
|
||||||
{
|
{
|
||||||
okText: t('common.okText'),
|
okText: t('common.okText'),
|
||||||
cancelText: t('common.cancelText'),
|
cancelText: t('common.cancelText'),
|
||||||
},
|
},
|
||||||
{ ...props, ...unref(attrs) }
|
{ ...props, ...unref(attrs) }
|
||||||
);
|
);
|
||||||
if (result.onConfirm) {
|
|
||||||
const confirm = result.confirm;
|
|
||||||
result.onConfirm = () => {
|
|
||||||
return new Promise<void>((resolve) => {
|
|
||||||
confirm()
|
|
||||||
?.finally(() => {
|
|
||||||
resolve();
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
console.log(err);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
// update-end--author:liaozhiyang---date:20231228---for:【issues/936】表格操作栏删除当接口失败时,气泡确认框不会消失
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
|
|
|
@ -102,7 +102,9 @@
|
||||||
size: 'small',
|
size: 'small',
|
||||||
...action,
|
...action,
|
||||||
...(popConfirm || {}),
|
...(popConfirm || {}),
|
||||||
onConfirm: popConfirm?.confirm,
|
// update-begin--author:liaozhiyang---date:20240108---for:【issues/936】表格操作栏删除当接口失败时,气泡确认框不会消失
|
||||||
|
onConfirm: handelConfirm(popConfirm?.confirm),
|
||||||
|
// update-end--author:liaozhiyang---date:20240108---for:【issues/936】表格操作栏删除当接口失败时,气泡确认框不会消失
|
||||||
onCancel: popConfirm?.cancel,
|
onCancel: popConfirm?.cancel,
|
||||||
enable: !!popConfirm,
|
enable: !!popConfirm,
|
||||||
};
|
};
|
||||||
|
@ -122,17 +124,46 @@
|
||||||
popConfirm.overlayClassName = `${overlayClassName ? overlayClassName : ''} ${prefixCls}-popconfirm`;
|
popConfirm.overlayClassName = `${overlayClassName ? overlayClassName : ''} ${prefixCls}-popconfirm`;
|
||||||
}
|
}
|
||||||
// update-end--author:liaozhiyang---date:20240105---for:【issues/951】table删除记录时按钮显示错位
|
// update-end--author:liaozhiyang---date:20240105---for:【issues/951】table删除记录时按钮显示错位
|
||||||
|
// update-begin--author:liaozhiyang---date:20240108---for:【issues/936】表格操作栏删除当接口失败时,气泡确认框不会消失
|
||||||
|
if (popConfirm) {
|
||||||
|
popConfirm.confirm = handelConfirm(popConfirm?.confirm);
|
||||||
|
}
|
||||||
|
// update-end--author:liaozhiyang---date:20240108---for:【issues/936】表格操作栏删除当接口失败时,气泡确认框不会消失
|
||||||
return {
|
return {
|
||||||
...action,
|
...action,
|
||||||
...popConfirm,
|
...popConfirm,
|
||||||
onConfirm: popConfirm?.confirm,
|
onConfirm: handelConfirm(popConfirm?.confirm),
|
||||||
onCancel: popConfirm?.cancel,
|
onCancel: popConfirm?.cancel,
|
||||||
text: label,
|
text: label,
|
||||||
divider: index < list.length - 1 ? props.divider : false,
|
divider: index < list.length - 1 ? props.divider : false,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
/*
|
||||||
|
2023-01-08
|
||||||
|
liaozhiyang
|
||||||
|
给传进来的函数包一层promise
|
||||||
|
*/
|
||||||
|
const handelConfirm = (fn) => {
|
||||||
|
if (typeof fn !== 'function') return fn;
|
||||||
|
const anyc = () => {
|
||||||
|
return new Promise<void>((resolve) => {
|
||||||
|
const result = fn();
|
||||||
|
if (Object.prototype.toString.call(result) === '[object Promise]') {
|
||||||
|
result
|
||||||
|
.finally(() => {
|
||||||
|
resolve();
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.log(err);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
return anyc;
|
||||||
|
};
|
||||||
const getDropdownSlotList = computed((): any[] => {
|
const getDropdownSlotList = computed((): any[] => {
|
||||||
return unref(getDropdownList).filter((item) => item.slot);
|
return unref(getDropdownList).filter((item) => item.slot);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue