|
|
@@ -23,6 +23,7 @@
|
|
|
type="success"
|
|
|
size="mini"
|
|
|
v-click-once
|
|
|
+ :loading="auditLoading"
|
|
|
@click="handleAudit(1)"
|
|
|
>通过
|
|
|
</el-button>
|
|
|
@@ -32,6 +33,7 @@
|
|
|
type="danger"
|
|
|
size="mini"
|
|
|
v-click-once
|
|
|
+ :loading="auditLoading"
|
|
|
@click="handleAudit(0)"
|
|
|
v-if="!['starter'].includes(taskDefinitionKey)"
|
|
|
>驳回
|
|
|
@@ -80,7 +82,8 @@
|
|
|
return {
|
|
|
form: {
|
|
|
reason: '同意'
|
|
|
- }
|
|
|
+ },
|
|
|
+ auditLoading: false // 审批按钮 loading 状态
|
|
|
};
|
|
|
},
|
|
|
created() {},
|
|
|
@@ -95,14 +98,21 @@
|
|
|
},
|
|
|
|
|
|
async handleAudit(status, type) {
|
|
|
- if (!!status) {
|
|
|
- let value = await this.getTableValue();
|
|
|
- if (!value) {
|
|
|
- return;
|
|
|
+ this.auditLoading = true;
|
|
|
+ try {
|
|
|
+ if (!!status) {
|
|
|
+ let value = await this.getTableValue();
|
|
|
+ if (!value) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- this._approveTaskWithVariables(status);
|
|
|
+ await this._approveTaskWithVariables(status);
|
|
|
+ } catch (err) {
|
|
|
+ console.error('审批失败:', err);
|
|
|
+ } finally {
|
|
|
+ this.auditLoading = false;
|
|
|
+ }
|
|
|
},
|
|
|
async _approveTaskWithVariables(status) {
|
|
|
let variables = {
|
|
|
@@ -110,7 +120,7 @@
|
|
|
};
|
|
|
|
|
|
let API = !!status ? approveTaskWithVariables : rejectTask;
|
|
|
- API({
|
|
|
+ return API({
|
|
|
id: this.taskId,
|
|
|
reason: this.form.reason,
|
|
|
variables
|
|
|
@@ -121,6 +131,7 @@
|
|
|
title: status === 0 ? '驳回' : ''
|
|
|
});
|
|
|
}
|
|
|
+ return res;
|
|
|
});
|
|
|
},
|
|
|
|