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

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']}" formKey="${table.optionMap['bpmFormKey']}"
completeText="提交" completeText="提交"
:loading="loadingRef" :loading="loadingRef"
:auth="'oa:oaLeave:edit'" :auth="'${permissionPrefix}:edit'"
@complete="handleSubmit" @complete="handleSubmit"
@success="handleSuccess" @success="handleSuccess"
@close="closeDrawer" @close="closeDrawer"
@@ -595,6 +595,9 @@ for (c in table.columnList){
}; };
<% for (child in table.childList){ %> <% for (child in table.childList){ %>
data.${@StringUtils.uncap(child.className)}List = await get${child.className}List(); 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); // console.log('submit', params, data, record);
const res = await ${className}Save(params, data); const res = await ${className}Save(params, data);

View File

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