fix bug:自动审批
This commit is contained in:
1 parent
cf99cb74e1
commit
697918321c
3 files changed
+38
-33
No files matched your search
+19
-17
@@ -57,7 +57,7 @@ class TaskService extends Service {
|
|||||||
taskFormInput: JSON.parse(taskFormInput),
|
taskFormInput: JSON.parse(taskFormInput),
|
||||||
}
|
}
|
||||||
// 往下走
|
// 往下走
|
||||||
await this.submitNode(data, '同意', 1)
|
await this.submitNode(data, '同意', 1, 'createTask')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,12 +65,12 @@ class TaskService extends Service {
|
|||||||
const { actionData } = this.ctx.request.body.appData;
|
const { actionData } = this.ctx.request.body.appData;
|
||||||
const { updateItem, type } = actionData;
|
const { updateItem, type } = actionData;
|
||||||
|
|
||||||
await this.submitNode(updateItem, type, 0)
|
await this.submitNode(updateItem, type, 0, 'updateTask')
|
||||||
}
|
}
|
||||||
|
|
||||||
async submitNode(taskData, type, times) {
|
async submitNode(taskData, type, times, action) {
|
||||||
const { jianghuKnex } = this.app;
|
const { jianghuKnex } = this.app;
|
||||||
const { updateTaskData, historyInsertData, noticeInsertData } = await this.buildNext1({ taskData: taskData, type: type, times: times })
|
const { updateTaskData, historyInsertData, noticeInsertData } = await this.buildNext1({ taskData: taskData, type: type, times: times, action: action })
|
||||||
|
|
||||||
console.log('updateTaskData------', updateTaskData);
|
console.log('updateTaskData------', updateTaskData);
|
||||||
console.log('historyInsertData------', historyInsertData);
|
console.log('historyInsertData------', historyInsertData);
|
||||||
@@ -82,7 +82,7 @@ class TaskService extends Service {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async buildNext1({ taskData, type, times }) {
|
async buildNext1({ taskData, type, times, action }) {
|
||||||
const { jianghuKnex } = this.app;
|
const { jianghuKnex } = this.app;
|
||||||
const { userId, username } = this.ctx.userInfo;
|
const { userId, username } = this.ctx.userInfo;
|
||||||
const { taskId, taskInfo, taskWorkflow, taskConfigId, taskEditUserList, taskEditedUserList } = taskData;
|
const { taskId, taskInfo, taskWorkflow, taskConfigId, taskEditUserList, taskEditedUserList } = taskData;
|
||||||
@@ -95,8 +95,9 @@ class TaskService extends Service {
|
|||||||
curNode = taskWorkflow.nodeList.find(node => node.id == taskConfigId),
|
curNode = taskWorkflow.nodeList.find(node => node.id == taskConfigId),
|
||||||
curNodeType = curNode?.properties.type,
|
curNodeType = curNode?.properties.type,
|
||||||
taskStatus = "running",
|
taskStatus = "running",
|
||||||
taskHistoryUser = [userId, ...taskHistory.map(h => h.createHistoryBy)];
|
taskHistoryUser = [...taskHistory.map(h => h.createHistoryBy)];
|
||||||
|
|
||||||
|
if (action == 'update') taskHistoryUser.push(userId)
|
||||||
// 插入上一次节点历史
|
// 插入上一次节点历史
|
||||||
if (!taskData?.createHistoryBy) taskData.createHistoryBy = [userId]
|
if (!taskData?.createHistoryBy) taskData.createHistoryBy = [userId]
|
||||||
taskStatus = curNodeType == 'end' ? 'end' : 'running'
|
taskStatus = curNodeType == 'end' ? 'end' : 'running'
|
||||||
@@ -120,6 +121,7 @@ class TaskService extends Service {
|
|||||||
taskHandleDesc: '结束',
|
taskHandleDesc: '结束',
|
||||||
createHistoryBy: [userId]
|
createHistoryBy: [userId]
|
||||||
}
|
}
|
||||||
|
// 插入任务的结束记录
|
||||||
historyInsertData.push(...await this.createTaskHistory({ taskData, taskStatus, type }))
|
historyInsertData.push(...await this.createTaskHistory({ taskData, taskStatus, type }))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -180,7 +182,7 @@ class TaskService extends Service {
|
|||||||
operationAt: dayjs().format("YYYY-MM-DD HH:mm:ss")
|
operationAt: dayjs().format("YYYY-MM-DD HH:mm:ss")
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await this.buildNext1({ taskData, type: '同意', times: 1 })
|
const result = await this.buildNext1({ taskData, type: '同意', times: 1, action })
|
||||||
updateTaskData = result.updateTaskData
|
updateTaskData = result.updateTaskData
|
||||||
historyInsertData.push(...result.historyInsertData)
|
historyInsertData.push(...result.historyInsertData)
|
||||||
noticeInsertData.push(...result.noticeInsertData)
|
noticeInsertData.push(...result.noticeInsertData)
|
||||||
@@ -212,7 +214,7 @@ class TaskService extends Service {
|
|||||||
operationAt: dayjs().format("YYYY-MM-DD HH:mm:ss")
|
operationAt: dayjs().format("YYYY-MM-DD HH:mm:ss")
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await this.buildNext1({ taskData, type: '同意', times: 1 })
|
const result = await this.buildNext1({ taskData, type: '同意', times: 1, action })
|
||||||
updateTaskData = result.updateTaskData
|
updateTaskData = result.updateTaskData
|
||||||
historyInsertData.push(...result.historyInsertData)
|
historyInsertData.push(...result.historyInsertData)
|
||||||
noticeInsertData.push(...result.noticeInsertData)
|
noticeInsertData.push(...result.noticeInsertData)
|
||||||
@@ -252,7 +254,7 @@ class TaskService extends Service {
|
|||||||
operationAt: dayjs().format("YYYY-MM-DD HH:mm:ss")
|
operationAt: dayjs().format("YYYY-MM-DD HH:mm:ss")
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await this.buildNext1({ taskData, type: '同意', times: 1 })
|
const result = await this.buildNext1({ taskData, type: '同意', times: 1, action })
|
||||||
updateTaskData = result.updateTaskData
|
updateTaskData = result.updateTaskData
|
||||||
historyInsertData.push(...result.historyInsertData)
|
historyInsertData.push(...result.historyInsertData)
|
||||||
noticeInsertData.push(...result.noticeInsertData)
|
noticeInsertData.push(...result.noticeInsertData)
|
||||||
@@ -293,7 +295,7 @@ class TaskService extends Service {
|
|||||||
operationAt: dayjs().format("YYYY-MM-DD HH:mm:ss")
|
operationAt: dayjs().format("YYYY-MM-DD HH:mm:ss")
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await this.buildNext1({ taskData, type: '同意', times: 1 })
|
const result = await this.buildNext1({ taskData, type: '同意', times: 1, action })
|
||||||
updateTaskData = result.updateTaskData
|
updateTaskData = result.updateTaskData
|
||||||
historyInsertData.push(...result.historyInsertData)
|
historyInsertData.push(...result.historyInsertData)
|
||||||
noticeInsertData.push(...result.noticeInsertData)
|
noticeInsertData.push(...result.noticeInsertData)
|
||||||
@@ -337,7 +339,7 @@ class TaskService extends Service {
|
|||||||
operationAt: dayjs().format("YYYY-MM-DD HH:mm:ss")
|
operationAt: dayjs().format("YYYY-MM-DD HH:mm:ss")
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await this.buildNext1({ taskData, type: '同意', times: 1 })
|
const result = await this.buildNext1({ taskData, type: '同意', times: 1, action })
|
||||||
updateTaskData = result.updateTaskData
|
updateTaskData = result.updateTaskData
|
||||||
historyInsertData.push(...result.historyInsertData)
|
historyInsertData.push(...result.historyInsertData)
|
||||||
noticeInsertData.push(...result.noticeInsertData)
|
noticeInsertData.push(...result.noticeInsertData)
|
||||||
@@ -386,16 +388,15 @@ class TaskService extends Service {
|
|||||||
operationAt: dayjs().format("YYYY-MM-DD HH:mm:ss")
|
operationAt: dayjs().format("YYYY-MM-DD HH:mm:ss")
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await this.buildNext1({ taskData, type: '同意', times: 1 })
|
const result = await this.buildNext1({ taskData, type: '同意', times: 1, action })
|
||||||
updateTaskData = result.updateTaskData
|
updateTaskData = result.updateTaskData
|
||||||
historyInsertData.push(...result.historyInsertData)
|
historyInsertData.push(...result.historyInsertData)
|
||||||
noticeInsertData.push(...result.noticeInsertData)
|
noticeInsertData.push(...result.noticeInsertData)
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 'end':
|
case 'end':
|
||||||
taskStatus = "end"
|
|
||||||
updateTaskData = {
|
updateTaskData = {
|
||||||
taskStatus: taskStatus,
|
taskStatus: "success",
|
||||||
taskConfigId: null,
|
taskConfigId: null,
|
||||||
taskLineType: null,
|
taskLineType: null,
|
||||||
taskEditUserList: null,
|
taskEditUserList: null,
|
||||||
@@ -408,17 +409,18 @@ class TaskService extends Service {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
// 插入该条审批记录
|
||||||
|
historyInsertData.push(...await this.createTaskHistory({ taskData, taskStatus: 'end', type }))
|
||||||
// 直接结束任务
|
// 直接结束任务
|
||||||
taskStatus = "end"
|
|
||||||
updateTaskData = {
|
updateTaskData = {
|
||||||
taskStatus: taskStatus,
|
taskStatus: 'reject',
|
||||||
taskConfigId: null,
|
taskConfigId: null,
|
||||||
taskLineType: null,
|
taskLineType: null,
|
||||||
taskEditUserList: null,
|
taskEditUserList: null,
|
||||||
taskEditedUserList: null,
|
taskEditedUserList: null,
|
||||||
taskFinishAt: dayjs().format("YYYY-MM-DD HH:mm:ss")
|
taskFinishAt: dayjs().format("YYYY-MM-DD HH:mm:ss")
|
||||||
}
|
}
|
||||||
// historyInsertData.push(await this.createTaskHistory({ taskData, taskStatus, type: '拒绝' }))
|
// historyInsertData.push(...await this.createTaskHistory({ taskData, taskStatus, type: '拒绝' }))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -208,7 +208,6 @@
|
|||||||
|
|
||||||
// 表格相关数据
|
// 表格相关数据
|
||||||
isTableZebraLineShown: true,
|
isTableZebraLineShown: true,
|
||||||
// 生日日期选择
|
|
||||||
validationRules: {
|
validationRules: {
|
||||||
requireRules: [
|
requireRules: [
|
||||||
v => !!v || 'This is required',
|
v => !!v || 'This is required',
|
||||||
@@ -219,8 +218,8 @@
|
|||||||
tableData: [],
|
tableData: [],
|
||||||
historyData: [],
|
historyData: [],
|
||||||
headers: [
|
headers: [
|
||||||
{ text: "审批ID", value: "taskId", width: 120 },
|
{ text: "审批ID", value: "taskId", width: 90 },
|
||||||
{ text: "分组", value: "taskTemplateGroup", width: 120 },
|
{ text: "分组", value: "taskTemplateGroup", width: 100 },
|
||||||
{ text: "审批项", value: "taskTitle", width: 200 },
|
{ text: "审批项", value: "taskTitle", width: 200 },
|
||||||
{ text: "创建者", value: "taskInitUser", width: 120 },
|
{ text: "创建者", value: "taskInitUser", width: 120 },
|
||||||
{ text: "创建时间", value: "taskCreateAt", width: 150 },
|
{ text: "创建时间", value: "taskCreateAt", width: 150 },
|
||||||
@@ -363,7 +362,7 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
await window.vtoast.success("提交审核成功");
|
await window.vtoast.success("提交审核成功");
|
||||||
this.isSubmitNodeLoading = true
|
this.isSubmitNodeLoading = false
|
||||||
},
|
},
|
||||||
async closeSubmitDrawer() {
|
async closeSubmitDrawer() {
|
||||||
this.isSubmitDrawerShown = false;
|
this.isSubmitDrawerShown = false;
|
||||||
|
|||||||
@@ -52,10 +52,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<!--审核状态-->
|
<!--审核状态-->
|
||||||
<template v-slot:item.taskStatus="{ item }">
|
<template v-slot:item.taskStatus="{ item }">
|
||||||
<v-chip v-if="item.taskStatus === '已结束'" color="red" x-small dark>
|
<v-chip :color="`${taskStatusColor[item.taskStatus]}`" x-small dark >
|
||||||
{{item.taskStatus}}
|
|
||||||
</v-chip>
|
|
||||||
<v-chip v-else color="green" x-small dark >
|
|
||||||
{{item.taskStatus}}
|
{{item.taskStatus}}
|
||||||
</v-chip>
|
</v-chip>
|
||||||
</template>
|
</template>
|
||||||
@@ -66,7 +63,7 @@
|
|||||||
<v-icon size="16" class="success--text">mdi-text-box-outline</v-icon>
|
<v-icon size="16" class="success--text">mdi-text-box-outline</v-icon>
|
||||||
查看
|
查看
|
||||||
</span>
|
</span>
|
||||||
<span v-if="item.taskStatus !== '已结束'" role="button" class="error--text jh-font-size-3 ml-2" @click="doUiAction('revokeTask', item)">
|
<span v-if="item.taskStatus == '审核中'" role="button" class="error--text jh-font-size-3 ml-2" @click="doUiAction('revokeTask', item)">
|
||||||
<v-icon size="16" class="error--text">mdi-arrow-u-left-top</v-icon>
|
<v-icon size="16" class="error--text">mdi-arrow-u-left-top</v-icon>
|
||||||
撤回
|
撤回
|
||||||
</span>
|
</span>
|
||||||
@@ -184,16 +181,22 @@
|
|||||||
tableData: [],
|
tableData: [],
|
||||||
headers: [
|
headers: [
|
||||||
{ text: "申请ID", value: "taskId", width: 100 },
|
{ text: "申请ID", value: "taskId", width: 100 },
|
||||||
|
{ text: "申请分组", value: "taskTemplateGroup", width: 120 },
|
||||||
{ text: "申请名称", value: "taskTitle", width: 350 },
|
{ text: "申请名称", value: "taskTitle", width: 350 },
|
||||||
{ text: "申请状态", value: "taskStatus" },
|
{ text: "申请状态", value: "taskStatus", width: 150 },
|
||||||
{ text: "申请时间", value: "taskCreateAt", width: 300 },
|
{ text: "申请时间", value: "taskCreateAt", width: 250 },
|
||||||
{ text: "结束时间", value: "taskFinishAt", width: 300 },
|
{ text: "结束时间", value: "taskFinishAt", width: 250 },
|
||||||
{ text: '操作', value: 'action', align: 'center', sortable: false, width: 150, class: 'fixed', cellClass: 'fixed' },
|
{ text: '操作', value: 'action', align: 'center', sortable: false, width: 200, class: 'fixed', cellClass: 'fixed' },
|
||||||
],
|
],
|
||||||
|
|
||||||
isViewDrawerShown: false,
|
isViewDrawerShown: false,
|
||||||
viewItem: {},
|
viewItem: {},
|
||||||
userId: '<$ ctx.userInfo.userId $>'
|
userId: '<$ ctx.userInfo.userId $>',
|
||||||
|
taskStatusColor:{
|
||||||
|
'已通过': 'primary',
|
||||||
|
'已拒绝': 'red',
|
||||||
|
'审核中': 'blue'
|
||||||
|
}
|
||||||
},
|
},
|
||||||
// 计算
|
// 计算
|
||||||
computed: {
|
computed: {
|
||||||
@@ -243,8 +246,9 @@
|
|||||||
|
|
||||||
const rows = result.data.appData.resultData.rows;
|
const rows = result.data.appData.resultData.rows;
|
||||||
const statusMap = {
|
const statusMap = {
|
||||||
'running': '审核中',
|
'success': '已通过',
|
||||||
'end': '已结束',
|
'reject': '已拒绝',
|
||||||
|
'running': '审核中'
|
||||||
};
|
};
|
||||||
rows.forEach(row => {
|
rows.forEach(row => {
|
||||||
row.taskFormInput = JSON.parse(row.taskFormInput);
|
row.taskFormInput = JSON.parse(row.taskFormInput);
|
||||||
|
|||||||
Reference in new issue
Block a user