审批处理样式处理

This commit is contained in:
ChenXinXin committed 2024-04-29 15:54:17 +08:00
1 parent e751661fc9
commit 5f7e5a038f
3 files changed
+262 -127

No files matched your search

+98 -50
View File
@@ -1,41 +1,55 @@
<!-- taskHistory.html >>>>>>>>>>>>> -->
<script type="text/html" id="task-history">
<div>
<v-data-table
:headers="headers"
:items="tableData"
:items-per-page="-1"
mobile-breakpoint="0"
:loading="isTableLoading"
checkbox-color="success"
fixed-header
hide-default-footer
class="jh-fixed-table-height elevation-0 mt-0 mb-xs-4">
<!--没有数据-->
<template v-slot:loading>
<div class="jh-no-data">数据加载中</div>
</template>
<template v-slot:no-data>
<div class="jh-no-data">暂无数据</div>
</template>
<template v-slot:no-results>
<div class="jh-no-data">暂无数据</div>
</template>
<!-- 节点说明 -->
<template v-slot:item.taskHandleDesc="{ item }">
<template v-if="item.taskConfigId.includes('userTask-')">
<v-chip :color="item.taskHandleDesc === '拒绝' ? 'red' : 'green'" x-small dark>
{{item.taskExplain}}:{{item.taskHandleDesc}}
</v-chip>
</template>
<template v-else>
<v-chip color="grey lighten-1" x-small dark>
{{item.taskHandleDesc}}
</v-chip>
</template>
<!-- <div>111---{{taskId}}</div> -->
<div class="history-box">
<div class="node-box d-flex mb-2" v-for="(nodeItem, nodeIndex) in workflowHistory" :key="nodeIndex">
<div class="node-box-stepper">
<template v-if="nodeItem.nodeStatus == '已同意'">
<v-icon v-if="nodeItem.id.startsWith('approvalTask')" color="#4caf50">mdi-account-circle</v-icon>
<v-icon v-if="nodeItem.id.startsWith('noticeTask')" color="#4caf50">mdi-send-circle</v-icon>
</template>
<template v-if="nodeItem.nodeStatus == '已拒绝'">
<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>
<template v-if="nodeItem.nodeStatus == '审批中'">
<v-icon v-if="nodeItem.id.startsWith('approvalTask')" color="#cdcfd1">mdi-account-circle</v-icon>
<v-icon v-if="nodeItem.id.startsWith('noticeTask')" color="#cdcfd1">mdi-send-circle</v-icon>
</template>
<div v-if="nodeIndex < workflowHistory.length - 1" class="vertical-line" :style="{ borderColor: nodeItem['nodeStatus'] === '已同意' ? '#4caf50' : '#cdcfd1' }"></div>
</div>
<div class="node-box-item">
<div class="node-label font-weight-bold">
{{nodeItem.label}}
<template v-if="nodeItem.approvalType && (nodeItem.nodeStatus != '审批中' || nodeItem.id == taskConfigId)"> · {{nodeItem.nodeStatus}}</template>
<v-chip class="ml-1 px-1 py-2" x-small v-if="nodeItem.approvalType" label outlined color="#4caf50">
{{nodeItem.approvalType}}
</v-chip>
</div>
<div class="node-user-box">
<template v-for="(user, index) in nodeItem.userList" :key="index">
<div class="user-box-item d-flex align-center mt-2" >
<div class="text-center">
<span class="ml-1">{{user.username}}</span>
</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>
</v-data-table>
</div>
</div>
</div>
</script>
@@ -49,17 +63,21 @@
type: String,
default: '',
},
taskConfigId: {
type: String,
default: '',
},
workflowConfig: {
type: Object,
default: ()=>{
return {}
},
},
},
data() {
return {
isTableLoading: false,
headers: [
{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: [],
workflowHistory: [],
};
},
watch: {
@@ -75,21 +93,16 @@
// ---------- 获取列表 >>>>>>>>>> --------
async getTableData() {
this.isTableLoading = true;
const result = await window.jianghuAxios({
const resultData = (await window.jianghuAxios({
data: {
appData: {
pageId: 'todo',
actionId: 'getTaskHistory',
actionId: 'getTaskWorkflow',
actionData: {taskId: this.taskId},
}
}
})
const {taskHistoryList, lineTypeList} = result.data.appData.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);
})).data.appData.resultData
this.workflowHistory = resultData
this.isTableLoading = false;
},
// ---------- <<<<<<<<<< 获取列表 --------
@@ -98,5 +111,40 @@
</script>
<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>
<!-- <<<<<<<<<<<<< taskHistory.html -->
+70 -53
View File
@@ -110,40 +110,45 @@
<!-- <<<<<<<<<<<<< 页面内容 -->
<!--编辑抽屉-->
<v-navigation-drawer v-model="isSubmitDrawerShown" v-click-outside="drawerClickOutside" 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">
<span class="text-h7 font-weight-bold pa-4">审核信息</span>
<v-spacer></v-spacer>
<!-- 抽屉操作按钮 -->
<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-navigation-drawer v-if="isSubmitDrawerShown" v-model="isSubmitDrawerShown" fixed temporary right width="80%" class="elevation-24">
<!-- 抽屉标题 -->
<v-row no-gutters class="align-center justify-end">
<span class="text-h7 font-weight-bold pa-4">审核信息【{{updateItemId}}】</span>
<v-spacer></v-spacer>
</v-row>
<!--抽屉表单-->
<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">
<form-item :form-item="formItem" :readonly="updateItem.readonlyFormIdList"></form-item>
</v-col>
<v-divider class="jh-divider"></v-divider>
<v-row class="my-2 px-4">
<v-col cols="12" v-for="(formItem, index) in updateItem.taskFormInput" :key="index" class="px-2 py-1 ma-0">
<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">
<span class="jh-input-label">备注</span>
<v-textarea
class="jh-v-input" no-resize dense single-line filled
v-model="updateItem.taskComment" :readonly="workflowType != 'todo'"></v-textarea>
<div class="text-subtitle-2 mb-1">审批意见</div>
<v-textarea class="jh-v-input" dense filled counter="250" v-model="updateItem.taskComment" :readonly="workflowType != 'todo'"></v-textarea>
</v-col>
</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-col cols="12" sm="12" md="12">
<div class="text-subtitle-2 mb-2 mx-4">审核历史</div>
<task-history :task-id="updateItem.taskId" @line-type-list="setLineTypeList"></task-history>
<div class="text-subtitle-2 mb-2 mx-4 font-weight-bold">审批流程</div>
<task-history :workflow-config="updateItem.taskWorkflow" :task-id="updateItem.taskId" :task-config-id="updateItem.taskConfigId"></task-history>
</v-col>
</v-row>
@@ -186,7 +191,7 @@
{% block vueScript %}
<!-- 加载页面组件 >>>>>>>>>>>>> -->
{% include 'component/formItem.html' %}
{% include 'component/tpl/formComponentList.html' %}
{% include 'component/taskHistory.html' %}
{% include 'common/jianghuJs/fixedTableHeightV4.html' %}
<!-- <<<<<<<<<<<<< 加载页面组件 -->
@@ -213,17 +218,29 @@
tableData: [],
historyData: [],
headers: [
{ text: "审批项", value: "taskTitle" },
{ text: "操作者", value: "operationByUser", width: 120 },
{ text: "操作时间", value: "operationAt", width: 250 },
{ text: "审批ID", value: "taskId", width: 120 },
{ text: "分组", value: "taskTemplateGroup", width: 120 },
{ 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'},
],
isSubmitDrawerShown: false,
updateItem: {},
workflowType: 'todo', // todo, history
lineTypeList: [],
userId: '<$ ctx.userInfo.userId $>'
lineTypeList: [{
text: "同意",
value: "同意",
},{
text: "拒绝",
value: "拒绝",
}],
userId: '<$ ctx.userInfo.userId $>',
updateItem: {},
updateItemId: null,
},
// 计算
computed: {
@@ -245,14 +262,12 @@
case 'getHistoryData':
await this.getHistoryData();
break;
case 'openDataPicker':
await this.openDataPicker(uiActionData);
break;
case 'startUpdateItem':
await this.prepareUpdateFormData(uiActionData);
await this.openUpdateDrawer();
break;
case 'submitNode':
await this.prepareSubmitValidate();
await this.confirmSubmitDialog();
await this.submitForReview(uiActionData);
await this.closeSubmitDrawer();
@@ -279,13 +294,10 @@
}
}
});
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.isTableLoading = false;
},
async getHistoryData() {
@@ -296,8 +308,7 @@
pageId: 'todo',
actionId: 'selectHistoryList',
actionData: {},
where: { taskStatus: 'running' },
whereLike: { taskEditUserList: '<$ ctx.userInfo.userId $>', taskConfigId: 'userTask-' },
whereLike: { taskEditUserList: '<$ ctx.userInfo.userId $>', taskConfigId: 'approvalTask-' },
orderBy: [{ column: 'id', order: 'desc' }]
}
}
@@ -305,26 +316,31 @@
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.historyData = rows;
},
// ---------- 审核、查看 uiAction >>>>>>>>>>>> --------
async prepareUpdateFormData(funObj) {
this.updateItem = _.cloneDeep(funObj);
this.updateItem.workflowConfig = JSON.parse(funObj.workflowConfig);
this.updateItem.currentNode = this.updateItem.workflowConfig.nodeList.find(e => e.id === this.updateItem.taskConfigId);
this.updateItem.readonlyFormIdList = this.updateItem.taskFormInput.formList.map(form => form.id).filter(formId => (this.updateItem.currentNode.formIdEdit || '').indexOf(formId) === -1);
this.updateItem.taskHistoryList = []; // 审核历史
this.updateItemId = this.updateItem.taskId
this.updateItem.taskWorkflow = JSON.parse(funObj.taskWorkflow);
this.updateItem.taskFormInput = JSON.parse(funObj.taskFormInput);
this.updateItem.taskComment = ''; // 备注
this.lineTypeList = []; // 所有操作按钮
},
async openUpdateDrawer() {
this.isSubmitDrawerShown = true;
},
prepareSubmitValidate(){
if(this.updateItem.taskComment.length > 250){
window.vtoast.fail("审批意见不能超过250个字!")
throw new Error("审批意见不能超过250个字!")
}
},
async confirmSubmitDialog() {
if (await window.confirmDialog({ title: "审核", content: "确定提交审核吗?" }) === false) {
throw new Error("[confirmSubmitDialog] 否");
@@ -338,7 +354,10 @@
appData: {
pageId: 'todo',
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() {
this.isSubmitDrawerShown = false;
this.updateItem = {};
},
setLineTypeList(lineTypeList) {
this.lineTypeList = _.uniqBy((lineTypeList || '').split(",").map(lineType => ({ type: lineType, label: lineType })), 'type');
this.updateItemId = null;
},
// ---------- <<<<<<<<<<< 审核、查看 uiAction --------
}