审批处理样式处理
This commit is contained in:
1 parent
e751661fc9
commit
5f7e5a038f
3 files changed
+262
-127
No files matched your search
+94
-24
@@ -57,15 +57,13 @@ class TaskService extends Service {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async buildNext({ taskData, type }) {
|
async buildNext({ taskData, type }) {
|
||||||
|
|
||||||
const { userId, username } = this.ctx.userInfo;
|
const { userId, username } = this.ctx.userInfo;
|
||||||
|
const { taskId, taskWorkflow, taskConfigId, taskEditUserList, taskEditedUserList } = taskData;
|
||||||
const { taskId, workflowConfig, taskConfigId, taskEditUserList, taskEditedUserList } = taskData;
|
|
||||||
|
|
||||||
var updateTaskData = null
|
var updateTaskData = null
|
||||||
var historyInsertData = []
|
var historyInsertData = []
|
||||||
var noticeInsertData = []
|
var noticeInsertData = []
|
||||||
var curNode = workflowConfig.nodeList.find(node => node.id == taskConfigId)
|
var curNode = taskWorkflow.nodeList.find(node => node.id == taskConfigId)
|
||||||
var taskStatus = "running"
|
var taskStatus = "running"
|
||||||
|
|
||||||
// 1、更新task状态
|
// 1、更新task状态
|
||||||
@@ -87,8 +85,8 @@ class TaskService extends Service {
|
|||||||
} else {// 流转搭配下一节点
|
} else {// 流转搭配下一节点
|
||||||
|
|
||||||
// 找下一个节点
|
// 找下一个节点
|
||||||
var nextNode = await this.getNextNode(workflowConfig, curNode)
|
var nextNode = await this.getNextNode(taskWorkflow, curNode)
|
||||||
var nextLine = workflowConfig.lineList.find(line => line.sourceNodeId == nextNode.id)
|
var nextLine = taskWorkflow.lineList.find(line => line.sourceNodeId == nextNode.id)
|
||||||
|
|
||||||
// 下一个节点是审批节点
|
// 下一个节点是审批节点
|
||||||
if (nextNode.properties.type === "approvalTask") {
|
if (nextNode.properties.type === "approvalTask") {
|
||||||
@@ -106,17 +104,17 @@ class TaskService extends Service {
|
|||||||
noticeInsertData.push({
|
noticeInsertData.push({
|
||||||
noticeId: await idGenerateUtil.uuid(),
|
noticeId: await idGenerateUtil.uuid(),
|
||||||
noticeName: "通知-审批-" + taskId,
|
noticeName: "通知-审批-" + taskId,
|
||||||
noticeContent: '{}',
|
noticeContent: nextNode.properties.userIdList.join(','),
|
||||||
pushContent: '{}',
|
pushContent: '{}',
|
||||||
pushStatus: "success",
|
pushStatus: "success",
|
||||||
pushAt: dayjs().format("YYYY-MM-DD HH:mm:ss")
|
pushAt: dayjs().format("YYYY-MM-DD HH:mm:ss")
|
||||||
})
|
})
|
||||||
historyInsertData.push(await this.createTaskHistory({ taskData, taskStatus, type }))
|
historyInsertData.push(await this.createTaskHistory({ taskData, taskStatus, type }))
|
||||||
nextNode = await this.getNextNode(workflowConfig, curNode)
|
nextNode = await this.getNextNode(taskWorkflow, curNode)
|
||||||
taskData = {
|
taskData = {
|
||||||
...taskData,
|
...taskData,
|
||||||
taskConfigId: nextNode.id,
|
taskConfigId: nextNode.id,
|
||||||
taskEditUserList: null,
|
// taskEditUserList: nextNode.properties.userIdList.join(','),
|
||||||
taskEditedUserList: null,
|
taskEditedUserList: null,
|
||||||
taskComment: null,
|
taskComment: null,
|
||||||
operationAt: dayjs().format("YYYY-MM-DD HH:mm:ss")
|
operationAt: dayjs().format("YYYY-MM-DD HH:mm:ss")
|
||||||
@@ -165,8 +163,9 @@ class TaskService extends Service {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getNextNode(workflow, curNode) {
|
async getNextNode(workflow, curNode) {
|
||||||
var line = workflow.lineList.find(l => l.sourceNodeId == curNode.id)
|
const { lineList, nodeList } = workflow
|
||||||
var nextNode = workflow.nodeList.find(n => n.id == line.targetNodeId)
|
var line = lineList.find(l => l.sourceNodeId == curNode.id),
|
||||||
|
nextNode = nodeList.find(n => n.id == line.targetNodeId);
|
||||||
|
|
||||||
if (nextNode.properties.type === "conditionTask") {
|
if (nextNode.properties.type === "conditionTask") {
|
||||||
nextNode = this.getNextNode(workflow, nextNode)
|
nextNode = this.getNextNode(workflow, nextNode)
|
||||||
@@ -176,25 +175,96 @@ class TaskService extends Service {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async createTaskHistory({ taskData, taskStatus, type }) {
|
async createTaskHistory({ taskData, taskStatus, type }) {
|
||||||
|
const { userId, username } = this.ctx.userInfo;
|
||||||
|
|
||||||
|
// 解构 taskData 对象以简化访问
|
||||||
|
const { taskId, taskFormInput, taskConfigId, taskNextConfigList,
|
||||||
|
taskLineType, taskEditUserList, taskViewUserList,
|
||||||
|
taskComment, taskWorkflow, operationAt } = taskData;
|
||||||
|
|
||||||
|
// 计算任务持续时间
|
||||||
|
const taskCostDuration = Math.round(dayjs().diff(dayjs(operationAt)) / 1000);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
taskId: taskData.taskId,
|
taskId,
|
||||||
taskStatus: taskStatus,
|
taskStatus,
|
||||||
taskTitle: taskData.taskTitle,
|
taskFormInput: JSON.stringify(taskFormInput),
|
||||||
taskFormInput: JSON.stringify(taskData.taskFormInput),
|
taskConfigId,
|
||||||
taskConfigId: taskData.taskConfigId,
|
taskNextConfigList,
|
||||||
taskNextConfigList: taskData.taskNextConfigList,
|
taskLineTypeList: taskLineType,
|
||||||
taskLineTypeList: taskData.taskLineType,
|
taskEditUserList,
|
||||||
taskInitUser: taskData.taskInitUser,
|
taskViewUserList,
|
||||||
taskEditUserList: taskData.taskEditUserList,
|
taskComment,
|
||||||
taskViewUserList: taskData.taskViewUserList,
|
taskWorkflow: JSON.stringify(taskWorkflow),
|
||||||
taskComment: taskData.taskComment,
|
|
||||||
workflowConfig: JSON.stringify(taskData.taskWorkflow),
|
|
||||||
taskExplain: type,
|
taskExplain: type,
|
||||||
taskHandleDesc: type,
|
taskHandleDesc: type,
|
||||||
taskCostDuration: Math.round(dayjs().diff(dayjs(taskData.operationAt)) / 1000)
|
taskCostDuration,
|
||||||
|
createHistoryBy: userId,
|
||||||
|
createHistoryAt: dayjs().format('YYYY-MM-DD HH:mm:ss')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
async getTaskWorkflow() {
|
||||||
|
const { jianghuKnex } = this.app;
|
||||||
|
const { userId } = this.ctx.userInfo;
|
||||||
|
const { taskId } = this.ctx.request.body.appData.actionData;
|
||||||
|
|
||||||
|
// 获取当前审批
|
||||||
|
const task = await jianghuKnex('task').where({ taskId }).first();
|
||||||
|
const { taskWorkflow, taskConfigId } = task
|
||||||
|
|
||||||
|
// 获取审批流历史
|
||||||
|
const taskHistory = await jianghuKnex('task_history').where({ taskId }).select();
|
||||||
|
// 获取人员
|
||||||
|
const userList = await jianghuKnex('enterprise_user').select()
|
||||||
|
|
||||||
|
var workflowHistory = JSON.parse(taskWorkflow).nodeList.filter(n => !['start', 'end', 'conditionTask'].includes(n.properties.type))
|
||||||
|
.map(node => {
|
||||||
|
const { id, label, userIdList, approvalType } = node.properties
|
||||||
|
|
||||||
|
const userConfig = userIdList?.map(appUserId => {
|
||||||
|
var username = userList.find(u => u.userId == appUserId)?.username,
|
||||||
|
historyRecord = taskHistory.find(h => h.taskConfigId == node.id && h.createHistoryBy == appUserId);
|
||||||
|
|
||||||
|
if (historyRecord) {
|
||||||
|
const { taskComment, taskHandleDesc, createHistoryAt, taskStatus } = historyRecord
|
||||||
|
|
||||||
|
return {
|
||||||
|
userId: userId,
|
||||||
|
username: username,
|
||||||
|
comment: taskComment,
|
||||||
|
handleDesc: taskHandleDesc,
|
||||||
|
createHistoryAt: dayjs(createHistoryAt || '').format('YYYY-MM-DD HH:mm:ss'),
|
||||||
|
taskStatus: taskStatus,
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
userId: userId,
|
||||||
|
username: username,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
var nodeStatus = '审批中'
|
||||||
|
if (approvalType == "或签") {
|
||||||
|
nodeStatus = _.some(userConfig, ['handleDesc', '拒绝']) ? '已拒绝' : _.some(userConfig, ['handleDesc', '同意']) ? '已同意' : '审批中'
|
||||||
|
} else {
|
||||||
|
var nodeStatus = _.some(userConfig, ['handleDesc', '拒绝']) ? '已拒绝' : _.every(userConfig, ['handleDesc', '同意']) ? '已同意' : '审批中'
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
id,
|
||||||
|
label,
|
||||||
|
approvalType: approvalType, // 是审批节点就取审批形式
|
||||||
|
userList: userConfig,
|
||||||
|
nodeStatus: nodeStatus
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
return workflowHistory
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = TaskService;
|
module.exports = TaskService;
|
||||||
@@ -1,41 +1,55 @@
|
|||||||
<!-- taskHistory.html >>>>>>>>>>>>> -->
|
<!-- taskHistory.html >>>>>>>>>>>>> -->
|
||||||
<script type="text/html" id="task-history">
|
<script type="text/html" id="task-history">
|
||||||
<div>
|
<div>
|
||||||
<v-data-table
|
<!-- <div>111---{{taskId}}</div> -->
|
||||||
:headers="headers"
|
<div class="history-box">
|
||||||
:items="tableData"
|
<div class="node-box d-flex mb-2" v-for="(nodeItem, nodeIndex) in workflowHistory" :key="nodeIndex">
|
||||||
:items-per-page="-1"
|
<div class="node-box-stepper">
|
||||||
mobile-breakpoint="0"
|
<template v-if="nodeItem.nodeStatus == '已同意'">
|
||||||
:loading="isTableLoading"
|
<v-icon v-if="nodeItem.id.startsWith('approvalTask')" color="#4caf50">mdi-account-circle</v-icon>
|
||||||
checkbox-color="success"
|
<v-icon v-if="nodeItem.id.startsWith('noticeTask')" color="#4caf50">mdi-send-circle</v-icon>
|
||||||
fixed-header
|
</template>
|
||||||
hide-default-footer
|
<template v-if="nodeItem.nodeStatus == '已拒绝'">
|
||||||
class="jh-fixed-table-height elevation-0 mt-0 mb-xs-4">
|
<v-icon v-if="nodeItem.id.startsWith('approvalTask')" color="#f4807b">mdi-account-circle</v-icon>
|
||||||
<!--没有数据-->
|
<v-icon v-if="nodeItem.id.startsWith('noticeTask')" color="#f4807b">mdi-send-circle</v-icon>
|
||||||
<template v-slot:loading>
|
</template>
|
||||||
<div class="jh-no-data">数据加载中</div>
|
<template v-if="nodeItem.nodeStatus == '审批中'">
|
||||||
</template>
|
<v-icon v-if="nodeItem.id.startsWith('approvalTask')" color="#cdcfd1">mdi-account-circle</v-icon>
|
||||||
<template v-slot:no-data>
|
<v-icon v-if="nodeItem.id.startsWith('noticeTask')" color="#cdcfd1">mdi-send-circle</v-icon>
|
||||||
<div class="jh-no-data">暂无数据</div>
|
</template>
|
||||||
</template>
|
<div v-if="nodeIndex < workflowHistory.length - 1" class="vertical-line" :style="{ borderColor: nodeItem['nodeStatus'] === '已同意' ? '#4caf50' : '#cdcfd1' }"></div>
|
||||||
<template v-slot:no-results>
|
</div>
|
||||||
<div class="jh-no-data">暂无数据</div>
|
<div class="node-box-item">
|
||||||
</template>
|
<div class="node-label font-weight-bold">
|
||||||
<!-- 节点说明 -->
|
{{nodeItem.label}}
|
||||||
<template v-slot:item.taskHandleDesc="{ item }">
|
<template v-if="nodeItem.approvalType && (nodeItem.nodeStatus != '审批中' || nodeItem.id == taskConfigId)"> · {{nodeItem.nodeStatus}}</template>
|
||||||
<template v-if="item.taskConfigId.includes('userTask-')">
|
<v-chip class="ml-1 px-1 py-2" x-small v-if="nodeItem.approvalType" label outlined color="#4caf50">
|
||||||
<v-chip :color="item.taskHandleDesc === '拒绝' ? 'red' : 'green'" x-small dark>
|
{{nodeItem.approvalType}}
|
||||||
{{item.taskExplain}}:{{item.taskHandleDesc}}
|
</v-chip>
|
||||||
</v-chip>
|
</div>
|
||||||
</template>
|
<div class="node-user-box">
|
||||||
<template v-else>
|
<template v-for="(user, index) in nodeItem.userList" :key="index">
|
||||||
<v-chip color="grey lighten-1" x-small dark>
|
<div class="user-box-item d-flex align-center mt-2" >
|
||||||
{{item.taskHandleDesc}}
|
<div class="text-center">
|
||||||
</v-chip>
|
<span class="ml-1">{{user.username}}</span>
|
||||||
</template>
|
</div>
|
||||||
|
<div class="d-flex align-center ml-4" v-if="nodeItem.id.startsWith('approvalTask') && user.handleDesc">
|
||||||
|
<v-icon v-if="user.handleDesc == '同意'" size="16" color="green">mdi-check-circle-outline</v-icon>
|
||||||
|
<v-icon v-if="user.handleDesc == '拒绝'" size="16" color="red">mdi-close-circle-outline</v-icon>
|
||||||
|
<span class="ml-1">已{{user.handleDesc}} · {{user.createHistoryAt}}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div v-if="user.comment" class="user-box-comment">
|
||||||
|
{{user.comment}}
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</template>
|
</div>
|
||||||
</v-data-table>
|
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -49,17 +63,21 @@
|
|||||||
type: String,
|
type: String,
|
||||||
default: '',
|
default: '',
|
||||||
},
|
},
|
||||||
|
taskConfigId: {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
workflowConfig: {
|
||||||
|
type: Object,
|
||||||
|
default: ()=>{
|
||||||
|
return {}
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
isTableLoading: false,
|
isTableLoading: false,
|
||||||
headers: [
|
workflowHistory: [],
|
||||||
{text: "名称", value: "taskTitle", width: 230, class: 'fixed', cellClass: 'fixed'},
|
|
||||||
{text: "节点说明", value: "taskHandleDesc", width: 120},
|
|
||||||
{text: "操作人", value: "operationByUser", width: 120},
|
|
||||||
{text: "操作时间", value: "operationAt", width: 250},
|
|
||||||
],
|
|
||||||
tableData: [],
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
@@ -75,21 +93,16 @@
|
|||||||
// ---------- 获取列表 >>>>>>>>>> --------
|
// ---------- 获取列表 >>>>>>>>>> --------
|
||||||
async getTableData() {
|
async getTableData() {
|
||||||
this.isTableLoading = true;
|
this.isTableLoading = true;
|
||||||
const result = await window.jianghuAxios({
|
const resultData = (await window.jianghuAxios({
|
||||||
data: {
|
data: {
|
||||||
appData: {
|
appData: {
|
||||||
pageId: 'todo',
|
pageId: 'todo',
|
||||||
actionId: 'getTaskHistory',
|
actionId: 'getTaskWorkflow',
|
||||||
actionData: {taskId: this.taskId},
|
actionData: {taskId: this.taskId},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})).data.appData.resultData
|
||||||
const {taskHistoryList, lineTypeList} = result.data.appData.resultData;
|
this.workflowHistory = resultData
|
||||||
taskHistoryList.forEach(task => {
|
|
||||||
task.operationAt = task.taskStatus != 'end' ? dayjs(task.operationAt).format('YYYY-MM-DD HH:mm:ss') : ''
|
|
||||||
})
|
|
||||||
this.tableData = taskHistoryList;
|
|
||||||
this.$emit('line-type-list', lineTypeList);
|
|
||||||
this.isTableLoading = false;
|
this.isTableLoading = false;
|
||||||
},
|
},
|
||||||
// ---------- <<<<<<<<<< 获取列表 --------
|
// ---------- <<<<<<<<<< 获取列表 --------
|
||||||
@@ -98,5 +111,40 @@
|
|||||||
|
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
|
.history-box{
|
||||||
|
padding: 5px 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.node-user-box .user-box-comment{
|
||||||
|
position:relative;
|
||||||
|
margin-top: 10px;
|
||||||
|
padding: 2px;
|
||||||
|
border: 1px solid #4caf50;
|
||||||
|
border-radius: 1%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.node-user-box .user-box-comment::before{
|
||||||
|
content: "";
|
||||||
|
width: 8px;
|
||||||
|
height: 8px;
|
||||||
|
border: solid #4caf50;
|
||||||
|
border-width: 1px 0 0 1px;
|
||||||
|
position: absolute;
|
||||||
|
transform: translate(-50%, -50%) rotate(45deg);
|
||||||
|
left: 12px;
|
||||||
|
top: 0;
|
||||||
|
background: linear-gradient(to right bottom, white 50%, transparent 50%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.node-box .node-box-item{
|
||||||
|
margin: 2px 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.node-box-stepper .vertical-line {
|
||||||
|
height: 80%;
|
||||||
|
width: 0px;
|
||||||
|
margin: 0 auto 1px;
|
||||||
|
border: #cdcfd1 solid 1px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
<!-- <<<<<<<<<<<<< taskHistory.html -->
|
<!-- <<<<<<<<<<<<< taskHistory.html -->
|
||||||
+70
-53
@@ -110,40 +110,45 @@
|
|||||||
<!-- <<<<<<<<<<<<< 页面内容 -->
|
<!-- <<<<<<<<<<<<< 页面内容 -->
|
||||||
|
|
||||||
<!--编辑抽屉-->
|
<!--编辑抽屉-->
|
||||||
<v-navigation-drawer v-model="isSubmitDrawerShown" v-click-outside="drawerClickOutside" fixed temporary right width="80%" class="elevation-24">
|
<v-navigation-drawer v-if="isSubmitDrawerShown" v-model="isSubmitDrawerShown" fixed temporary right width="80%" class="elevation-24">
|
||||||
<v-form v-if="isSubmitDrawerShown" ref="updateForm" lazy-validation>
|
<!-- 抽屉标题 -->
|
||||||
<!-- 抽屉标题 -->
|
<v-row no-gutters class="align-center justify-end">
|
||||||
<v-row no-gutters class="align-center justify-end">
|
<span class="text-h7 font-weight-bold pa-4">审核信息【{{updateItemId}}】</span>
|
||||||
<span class="text-h7 font-weight-bold pa-4">审核信息</span>
|
<v-spacer></v-spacer>
|
||||||
<v-spacer></v-spacer>
|
</v-row>
|
||||||
<!-- 抽屉操作按钮 -->
|
|
||||||
<div class="d-flex justify-end pr-4">
|
|
||||||
<v-btn :color="lineTypeItem.type === '拒绝' ? 'error' : 'success'" small class="ml-2" v-for="lineTypeItem in lineTypeList" v-if="lineTypeItem.type" @click="doUiAction('submitNode', lineTypeItem.type)">
|
|
||||||
{{ lineTypeItem.type }}
|
|
||||||
</v-btn>
|
|
||||||
</div>
|
|
||||||
</v-row>
|
|
||||||
<v-divider class="jh-divider"></v-divider>
|
|
||||||
|
|
||||||
<!--抽屉表单-->
|
<v-divider class="jh-divider"></v-divider>
|
||||||
<v-row class="mt-0 px-4" >
|
|
||||||
<v-col cols="12" sm="12" md="4" v-for="(formItem, index) in updateItem.taskFormInput.formList" :key="index">
|
<v-row class="my-2 px-4">
|
||||||
<form-item :form-item="formItem" :readonly="updateItem.readonlyFormIdList"></form-item>
|
<v-col cols="12" v-for="(formItem, index) in updateItem.taskFormInput" :key="index" class="px-2 py-1 ma-0">
|
||||||
</v-col>
|
<span class="jh-input-label">{{ index + 1 }}. {{ formItem.statement }}<span v-show="formItem.isRequire" class="red--text ml-1">*</span></span>
|
||||||
|
<form-component-list :form-item="formItem" :disabled='true' ></form-component-list>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
|
||||||
|
<template v-if="workflowType == 'todo'">
|
||||||
|
<v-divider class="jh-divider"></v-divider>
|
||||||
|
<v-row class="mt-0 px-4">
|
||||||
<v-col cols="12" sm="12" md="12">
|
<v-col cols="12" sm="12" md="12">
|
||||||
<span class="jh-input-label">备注</span>
|
<div class="text-subtitle-2 mb-1">审批意见</div>
|
||||||
<v-textarea
|
<v-textarea class="jh-v-input" dense filled counter="250" v-model="updateItem.taskComment" :readonly="workflowType != 'todo'"></v-textarea>
|
||||||
class="jh-v-input" no-resize dense single-line filled
|
|
||||||
v-model="updateItem.taskComment" :readonly="workflowType != 'todo'"></v-textarea>
|
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
</v-form>
|
<!-- 抽屉操作按钮 -->
|
||||||
|
<div class="d-flex justify-end mt-2 mr-4">
|
||||||
|
<v-btn :color="lineTypeItem.value === '拒绝' ? 'error' : 'success'" small class="ml-2" v-for="lineTypeItem in lineTypeList" v-if="lineTypeItem.value" @click="doUiAction('submitNode', lineTypeItem.value)">
|
||||||
|
{{ lineTypeItem.text }}
|
||||||
|
</v-btn>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<v-divider class="jh-divider"></v-divider>
|
||||||
|
|
||||||
<!-- 审核历史 -->
|
<!-- 审核历史 -->
|
||||||
<v-row class="mt-8">
|
<v-row class="mt-8">
|
||||||
<v-col cols="12" sm="12" md="12">
|
<v-col cols="12" sm="12" md="12">
|
||||||
<div class="text-subtitle-2 mb-2 mx-4">审核历史</div>
|
<div class="text-subtitle-2 mb-2 mx-4 font-weight-bold">审批流程</div>
|
||||||
<task-history :task-id="updateItem.taskId" @line-type-list="setLineTypeList"></task-history>
|
<task-history :workflow-config="updateItem.taskWorkflow" :task-id="updateItem.taskId" :task-config-id="updateItem.taskConfigId"></task-history>
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
|
|
||||||
@@ -186,7 +191,7 @@
|
|||||||
{% block vueScript %}
|
{% block vueScript %}
|
||||||
|
|
||||||
<!-- 加载页面组件 >>>>>>>>>>>>> -->
|
<!-- 加载页面组件 >>>>>>>>>>>>> -->
|
||||||
{% include 'component/formItem.html' %}
|
{% include 'component/tpl/formComponentList.html' %}
|
||||||
{% include 'component/taskHistory.html' %}
|
{% include 'component/taskHistory.html' %}
|
||||||
{% include 'common/jianghuJs/fixedTableHeightV4.html' %}
|
{% include 'common/jianghuJs/fixedTableHeightV4.html' %}
|
||||||
<!-- <<<<<<<<<<<<< 加载页面组件 -->
|
<!-- <<<<<<<<<<<<< 加载页面组件 -->
|
||||||
@@ -213,17 +218,29 @@
|
|||||||
tableData: [],
|
tableData: [],
|
||||||
historyData: [],
|
historyData: [],
|
||||||
headers: [
|
headers: [
|
||||||
{ text: "审批项", value: "taskTitle" },
|
{ text: "审批ID", value: "taskId", width: 120 },
|
||||||
{ text: "操作者", value: "operationByUser", width: 120 },
|
{ text: "分组", value: "taskTemplateGroup", width: 120 },
|
||||||
{ text: "操作时间", value: "operationAt", width: 250 },
|
{ text: "审批项", value: "taskTitle", width: 200 },
|
||||||
|
{ text: "创建者", value: "taskInitUser", width: 120 },
|
||||||
|
{ text: "创建时间", value: "taskCreateAt", width: 150 },
|
||||||
|
{ text: "结束时间", value: "taskFinishAt", width: 150 },
|
||||||
{text: '操作', value: 'action', align: 'center', sortable: false, width: 80, class: 'fixed', cellClass: 'fixed'},
|
{text: '操作', value: 'action', align: 'center', sortable: false, width: 80, class: 'fixed', cellClass: 'fixed'},
|
||||||
],
|
],
|
||||||
|
|
||||||
isSubmitDrawerShown: false,
|
isSubmitDrawerShown: false,
|
||||||
updateItem: {},
|
|
||||||
workflowType: 'todo', // todo, history
|
workflowType: 'todo', // todo, history
|
||||||
lineTypeList: [],
|
lineTypeList: [{
|
||||||
userId: '<$ ctx.userInfo.userId $>'
|
text: "同意",
|
||||||
|
value: "同意",
|
||||||
|
},{
|
||||||
|
text: "拒绝",
|
||||||
|
value: "拒绝",
|
||||||
|
}],
|
||||||
|
userId: '<$ ctx.userInfo.userId $>',
|
||||||
|
|
||||||
|
updateItem: {},
|
||||||
|
updateItemId: null,
|
||||||
|
|
||||||
},
|
},
|
||||||
// 计算
|
// 计算
|
||||||
computed: {
|
computed: {
|
||||||
@@ -245,14 +262,12 @@
|
|||||||
case 'getHistoryData':
|
case 'getHistoryData':
|
||||||
await this.getHistoryData();
|
await this.getHistoryData();
|
||||||
break;
|
break;
|
||||||
case 'openDataPicker':
|
|
||||||
await this.openDataPicker(uiActionData);
|
|
||||||
break;
|
|
||||||
case 'startUpdateItem':
|
case 'startUpdateItem':
|
||||||
await this.prepareUpdateFormData(uiActionData);
|
await this.prepareUpdateFormData(uiActionData);
|
||||||
await this.openUpdateDrawer();
|
await this.openUpdateDrawer();
|
||||||
break;
|
break;
|
||||||
case 'submitNode':
|
case 'submitNode':
|
||||||
|
await this.prepareSubmitValidate();
|
||||||
await this.confirmSubmitDialog();
|
await this.confirmSubmitDialog();
|
||||||
await this.submitForReview(uiActionData);
|
await this.submitForReview(uiActionData);
|
||||||
await this.closeSubmitDrawer();
|
await this.closeSubmitDrawer();
|
||||||
@@ -279,13 +294,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const rows = result.data.appData.resultData.rows;
|
const rows = result.data.appData.resultData.rows;
|
||||||
rows.forEach(row => {
|
|
||||||
row.taskFormInput = JSON.parse(row.taskFormInput);
|
|
||||||
row.operationAt = dayjs(row.operationAt).format('YYYY-MM-DD HH:mm:ss');
|
|
||||||
});
|
|
||||||
this.tableData = rows.filter(item => !item.taskEditedUserList || !item.taskEditedUserList.includes(this.userId));
|
this.tableData = rows.filter(item => !item.taskEditedUserList || !item.taskEditedUserList.includes(this.userId));
|
||||||
|
|
||||||
this.isTableLoading = false;
|
this.isTableLoading = false;
|
||||||
},
|
},
|
||||||
async getHistoryData() {
|
async getHistoryData() {
|
||||||
@@ -296,8 +308,7 @@
|
|||||||
pageId: 'todo',
|
pageId: 'todo',
|
||||||
actionId: 'selectHistoryList',
|
actionId: 'selectHistoryList',
|
||||||
actionData: {},
|
actionData: {},
|
||||||
where: { taskStatus: 'running' },
|
whereLike: { taskEditUserList: '<$ ctx.userInfo.userId $>', taskConfigId: 'approvalTask-' },
|
||||||
whereLike: { taskEditUserList: '<$ ctx.userInfo.userId $>', taskConfigId: 'userTask-' },
|
|
||||||
orderBy: [{ column: 'id', order: 'desc' }]
|
orderBy: [{ column: 'id', order: 'desc' }]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -305,26 +316,31 @@
|
|||||||
|
|
||||||
const rows = result.data.appData.resultData.rows;
|
const rows = result.data.appData.resultData.rows;
|
||||||
rows.forEach(row => {
|
rows.forEach(row => {
|
||||||
row.taskFormInput = JSON.parse(row.taskFormInput);
|
|
||||||
row.operationAt = dayjs(row.operationAt).format('YYYY-MM-DD HH:mm:ss');
|
row.operationAt = dayjs(row.operationAt).format('YYYY-MM-DD HH:mm:ss');
|
||||||
});
|
});
|
||||||
this.historyData = rows;
|
this.historyData = rows;
|
||||||
},
|
},
|
||||||
// ---------- 审核、查看 uiAction >>>>>>>>>>>> --------
|
// ---------- 审核、查看 uiAction >>>>>>>>>>>> --------
|
||||||
async prepareUpdateFormData(funObj) {
|
async prepareUpdateFormData(funObj) {
|
||||||
|
|
||||||
this.updateItem = _.cloneDeep(funObj);
|
this.updateItem = _.cloneDeep(funObj);
|
||||||
this.updateItem.workflowConfig = JSON.parse(funObj.workflowConfig);
|
this.updateItemId = this.updateItem.taskId
|
||||||
this.updateItem.currentNode = this.updateItem.workflowConfig.nodeList.find(e => e.id === this.updateItem.taskConfigId);
|
this.updateItem.taskWorkflow = JSON.parse(funObj.taskWorkflow);
|
||||||
this.updateItem.readonlyFormIdList = this.updateItem.taskFormInput.formList.map(form => form.id).filter(formId => (this.updateItem.currentNode.formIdEdit || '').indexOf(formId) === -1);
|
this.updateItem.taskFormInput = JSON.parse(funObj.taskFormInput);
|
||||||
this.updateItem.taskHistoryList = []; // 审核历史
|
|
||||||
this.updateItem.taskComment = ''; // 备注
|
this.updateItem.taskComment = ''; // 备注
|
||||||
this.lineTypeList = []; // 所有操作按钮
|
|
||||||
},
|
},
|
||||||
|
|
||||||
async openUpdateDrawer() {
|
async openUpdateDrawer() {
|
||||||
this.isSubmitDrawerShown = true;
|
this.isSubmitDrawerShown = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
prepareSubmitValidate(){
|
||||||
|
if(this.updateItem.taskComment.length > 250){
|
||||||
|
window.vtoast.fail("审批意见不能超过250个字!")
|
||||||
|
throw new Error("审批意见不能超过250个字!")
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
async confirmSubmitDialog() {
|
async confirmSubmitDialog() {
|
||||||
if (await window.confirmDialog({ title: "审核", content: "确定提交审核吗?" }) === false) {
|
if (await window.confirmDialog({ title: "审核", content: "确定提交审核吗?" }) === false) {
|
||||||
throw new Error("[confirmSubmitDialog] 否");
|
throw new Error("[confirmSubmitDialog] 否");
|
||||||
@@ -338,7 +354,10 @@
|
|||||||
appData: {
|
appData: {
|
||||||
pageId: 'todo',
|
pageId: 'todo',
|
||||||
actionId: 'submitNode',
|
actionId: 'submitNode',
|
||||||
actionData: { type: lineType, id: this.updateItem.id, taskId: this.updateItem.taskId, taskComment: this.updateItem.taskComment, taskFormInput: JSON.stringify(this.updateItem.taskFormInput) }
|
actionData: {
|
||||||
|
updateItem: this.updateItem,
|
||||||
|
type: lineType
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -347,9 +366,7 @@
|
|||||||
async closeSubmitDrawer() {
|
async closeSubmitDrawer() {
|
||||||
this.isSubmitDrawerShown = false;
|
this.isSubmitDrawerShown = false;
|
||||||
this.updateItem = {};
|
this.updateItem = {};
|
||||||
},
|
this.updateItemId = null;
|
||||||
setLineTypeList(lineTypeList) {
|
|
||||||
this.lineTypeList = _.uniqBy((lineTypeList || '').split(",").map(lineType => ({ type: lineType, label: lineType })), 'type');
|
|
||||||
},
|
},
|
||||||
// ---------- <<<<<<<<<<< 审核、查看 uiAction --------
|
// ---------- <<<<<<<<<<< 审核、查看 uiAction --------
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user