树表的局部刷新改进,删除、停用、启用、修改父节点的情况下完美体验

This commit is contained in:
thinkgem
2023-11-27 10:12:38 +08:00
parent 934821e8d4
commit fe5d61e4a6
2 changed files with 21 additions and 15 deletions

View File

@@ -51,7 +51,7 @@
formKey="${table.optionMap['bpmFormKey']}"
completeText="提交"
:loading="loadingRef"
:auth="'oa:oaLeave:edit'"
:auth="'${permissionPrefix}:edit'"
@complete="handleSubmit"
@success="handleSuccess"
@close="closeDrawer"
@@ -576,17 +576,17 @@ for (c in table.columnList){
async function handleSubmit() {
try {
const data = await validate();
<% if(toBoolean(table.optionMap['isBpmForm'])){ %>
<% if(toBoolean(table.optionMap['isBpmForm'])){ %>
data.bpm = record.value.bpm; // 流程信息
data.status = record.value.status; // 提交状态
loadingRef.value = true;
<% } %>
<% } %>
setDrawerProps({ confirmLoading: true });
const params: any = {
isNewRecord: record.value.isNewRecord,
<%
for (c in table.columnList){
if (c.isPk == '1' || c.showType == 'hidden'){ %>
if (c.isPk == '1' || c.showType == 'hidden'){ %>
${c.attrName}: record.value.${c.attrName},
<%
}
@@ -595,6 +595,9 @@ for (c in table.columnList){
};
<% for (child in table.childList){ %>
data.${@StringUtils.uncap(child.className)}List = await get${child.className}List();
<% } %>
<% if(table.isTreeEntity){ %>
data.oldParentCode = record.value.parentCode;
<% } %>
// console.log('submit', params, data, record);
const res = await ${className}Save(params, data);

View File

@@ -324,7 +324,7 @@ for(c in table.columnList){
title: t('停用${functionNameSimple}'),
popConfirm: {
title: t('是否确认停用${functionNameSimple}'),
confirm: handleDisable.bind(this, { ${idParam} }),
confirm: handleDisable.bind(this, record),
},
auth: '${permissionPrefix}:edit',
ifShow: () => record.status === '0',
@@ -335,7 +335,7 @@ for(c in table.columnList){
title: t('启用${functionNameSimple}'),
popConfirm: {
title: t('是否确认启用${functionNameSimple}'),
confirm: handleEnable.bind(this, { ${idParam} }),
confirm: handleEnable.bind(this, record),
},
auth: '${permissionPrefix}:edit',
ifShow: () => record.status === '2',
@@ -348,7 +348,7 @@ for(c in table.columnList){
title: t('删除${functionNameSimple}'),
popConfirm: {
title: t('是否确认删除${functionNameSimple}'),
confirm: handleDelete.bind(this, { ${idParam} }),
confirm: handleDelete.bind(this, record),
},
auth: '${permissionPrefix}:edit',
<% if(toBoolean(table.optionMap['isBpmForm'])){ %>
@@ -444,26 +444,29 @@ for(c in table.columnList){
<% if(toBoolean(table.optionMap['isHaveDisableEnable'])){ %>
async function handleDisable(record: Recordable) {
const res = await ${className}Disable(record);
const params = { ${idParam} };
const res = await ${className}Disable(params);
showMessage(res.message);
handleSuccess();
handleSuccess(record);
}
async function handleEnable(record: Recordable) {
const res = await ${className}Enable(record);
const params = { ${idParam} };
const res = await ${className}Enable(params);
showMessage(res.message);
handleSuccess();
handleSuccess(record);
}
<% } %>
async function handleDelete(record: Recordable) {
const res = await ${className}Delete(record);
const params = { ${idParam} };
const res = await ${className}Delete(params);
showMessage(res.message);
handleSuccess();
handleSuccess(record);
}
function handleSuccess() {
reload();
function handleSuccess(record: Recordable) {
reload({ record });
}
<% if(toBoolean(table.optionMap['isBpmForm'])){ %>