审核相关按钮增加loading

main
刘妍 2026-02-25 13:17:23 +08:00
parent 1388f729bd
commit 8ba2998fd2
2 changed files with 32 additions and 15 deletions

View File

@ -3,15 +3,15 @@
<template #footer v-if="type == 'detail'"> </template>
<template #footer v-else>
<template v-if="modelNodeType == NodeType.Parallel">
<a-button type="primary" @click="audit('Pass')"></a-button>
<a-button type="primary" danger @click="audit('Reject')">退</a-button>
<a-button type="primary" :loading="iconLoading" @click="audit('Pass')"></a-button>
<a-button type="primary" :loading="iconLoading" danger @click="audit('Reject')">退</a-button>
</template>
<template v-else-if="modelNodeType == NodeType.Common">
<a-button v-if="transpondvisible" type="primary" @click="transpond"></a-button>
</template>
<template v-else-if="modelNodeType == NodeType.Branch">
<a-button type="primary" @click="audit('Pass')"></a-button>
<a-button type="primary" danger @click="audit('Reject')">退</a-button>
<a-button type="primary" :loading="iconLoading" @click="audit('Pass')"></a-button>
<a-button type="primary" :loading="iconLoading" danger @click="audit('Reject')">退</a-button>
</template>
</template>
<div class="container">
@ -90,6 +90,7 @@ enum NodeType {
}
const modelNodeType = ref(NodeType.Other);
const [registerTranspondModel, { openModal: openAregisterTranspondModel }] = useModal();
const iconLoading = ref(false);
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
setModalProps({ confirmLoading: false });
@ -161,14 +162,19 @@ async function audit(val) {
workitemId: obj.value.workitemId,
auditResult: val,
};
iconLoading.value = true;
handleWorkitem(query).then((data) => {
if (data) {
setTimeout(() => {
setModalProps({ confirmLoading: true });
// TODO custom api
closeModal();
emit('success');
iconLoading.value = false;
return createMessage.success('审核成功');
}, 2000);
} else {
iconLoading.value = false;
return createMessage.error('审核失败');
}
});

View File

@ -7,8 +7,12 @@
@ok="handleSubmit"
:okText="okTextVal"
:destroyOnClose="true"
:confirmLoading="iconLoading"
width="1000px"
>
<template #footer>
<a-button type="primary" :loading="iconLoading" @click="handleSubmit"></a-button>
</template>
<!-- 部门选择界面 -->
<div class="dept-box" v-if="okTextVal === '确认'">
<!-- 左侧部门树 -->
@ -74,7 +78,7 @@ const defaultOrg = ref([]); // 默认选中的部门
const expandedKeys = ref<any>([]); //
const orgList = ref<any[]>([]); //
const rowId = ref(''); // ID
const iconLoading = ref(false); //
/**
* 展开节点处理函数
@ -167,26 +171,33 @@ async function handleSubmit() {
orgList.value.forEach((element) => {
orgIds.push(element.id);
});
if(orgIds.length == 0){
return createMessage.warning('请先选择转发部门');
}
//
const query = {
workitemId: props.workItemId,
orgIds: orgIds,
};
iconLoading.value = true;
//
handleWorkitem(query).then((data) => {
if (data) {
//
setModalProps({ confirmLoading: true });
//
closeModal();
//
emit('success');
//
return createMessage.success('转发成功');
setTimeout(() => {
iconLoading.value = false;
//
setModalProps({ confirmLoading: true });
//
closeModal();
//
emit('success');
//
return createMessage.success('转发成功');
}, 2000);
} else {
//
iconLoading.value = false;
return createMessage.error('转发失败');
}
});