Files
workflow/app/view/page/approvalManagement.html
T
2024-05-21 13:40:42 +08:00

466 lines
17 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{% extends 'template/jhTemplateV4.html'%}
{% block vueTemplate %}
<script type="text/html" id="app-template">
<div>
<v-app mobile-breakpoint="sm">
<jh-menu />
<v-main class="mt-15">
<!-- 头部内容 >>>>>>>>>>>>> -->
<div class="jh-page-second-bar px-8">
<v-row class="align-center">
<v-col cols="12" xs="12" sm="12" md="4" xl="3">
<div class="py-4 text-body-1 font-weight-bold">我收到的
<!-- 帮助页按钮 -->
<span role="button" class="success--text font-weight-regular jh-font-size-13 ml-2" @click="isHelpPageDrawerShown = true">
<v-icon size="13" class="success--text">mdi-help-circle-outline</v-icon>帮助
</span>
</div>
</v-col>
</v-row>
</div>
<!-- <<<<<<<<<<<<< 头部内容 -->
<div class="jh-page-body-container px-8">
<!-- 页面内容 >>>>>>>>>>>>> -->
<v-card class="rounded-lg">
<v-row class="ma-0 pa-4">
<v-spacer></v-spacer>
<!--切换状态-->
<v-col cols="12" xs="4" sm="4" md="4" xl="4" class="pa-0 pr-2 d-flex justify-end">
<v-btn-toggle
v-model="workflowType"
borderless
color="success"
>
<v-btn value="todo" small class="jh-backend-search-btn">
<v-badge v-if="tableData.length" inline :content="tableData.length" color="warning">
<span class="">待处理</span>
</v-badge>
<span v-else class="">待处理</span>
</v-btn>
<v-btn value="history" small class="jh-backend-search-btn">
<!-- <v-badge v-if="historyData.length" inline :content="historyData.length" color="grey darken-3"> -->
<span class="">已处理</span>
<!-- </v-badge>
<span v-else class="">已处理</span> -->
</v-btn>
<v-btn value="notice" small class="jh-backend-search-btn">
<!-- <v-badge v-if="noticeData.length" inline :content="noticeData.length" color="grey darken-3"> -->
<span class="">已抄送</span>
<!-- </v-badge>
<span v-else class="">已抄送</span> -->
</v-btn>
</v-btn-toggle>
</v-col>
<!--搜索-->
<v-col cols="12" xs="8" sm="4" md="3" xl="2" class="pa-0">
<v-text-field v-model="searchInput" color="success" prefix="搜索:" class="jh-v-input" dense filled hide-details single-line></v-text-field>
</v-col>
</v-row>
<!--表格-->
<v-data-table
:headers="headers"
:items="tableDataList"
:search="searchInput"
:footer-props="{ itemsPerPageOptions: [20, 50, -1], itemsPerPageText: '每页行数', itemsPerPageAllText: '所有'}"
:items-per-page="-1"
mobile-breakpoint="0"
:loading="isTableLoading"
:class="{'zebraLine': isTableZebraLineShown }"
checkbox-color="success"
fixed-header
class="jh-fixed-table-height elevation-0 mt-0 mb-xs-4">
<template v-slot:item.taskTitle="{ item }">
<span>{{item.taskTitle}}</span>
<template v-if="workflowType != 'todo'">
<v-chip v-if="item.taskHandleDesc === '拒绝'" color="red" x-small dark>
已{{item.taskHandleDesc}}
</v-chip>
<v-chip v-else color="green" x-small dark>
已{{item.taskHandleDesc}}
</v-chip>
</template>
</template>
<!--表格行操作按钮-->
<template v-slot:item.action="{ item }">
<span v-if="workflowType === 'todo'" role="button" class="success--text jh-font-size-3 pr-2"
@click="doUiAction('startUpdateItem', item)">
<v-icon size="16" class="success--text">mdi-note-edit-outline</v-icon>
审核
</span>
<span v-else role="button" class="success--text jh-font-size-3 pr-2"
@click="doUiAction('startUpdateItem', item)">
<v-icon size="16" class="success--text">mdi-text-box-outline</v-icon>
查看
</span>
</template>
<!--没有数据-->
<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:footer.page-text="pagination">
<span>{{pagination.pageStart}}-{{pagination.pageStop}}</span>
<span class="ml-1">共{{pagination.itemsLength}}条</span>
</template>
</v-data-table>
</v-card>
<!-- <<<<<<<<<<<<< 页面内容 -->
<!--审核抽屉-->
<v-navigation-drawer v-if="isSubmitDrawerShown" :permanent="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-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">
<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>
<!-- 抽屉操作按钮 -->
<div class="d-flex justify-end my-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)" :loading="isSubmitNodeLoading">
{{ lineTypeItem.text }}
</v-btn>
</div>
</template>
<v-divider class="jh-divider"></v-divider>
<!-- 审核历史 -->
<v-row class="mt-4">
<v-col cols="12" sm="12" md="12">
<div class="text-subtitle-2 mb-2 mx-4 font-weight-bold">审批流程</div>
<task-history :workflow-history="workflowHistory" :task-config-id="updateItem.taskConfigId"></task-history>
</v-col>
</v-row>
<!-- 评论列表 -->
<v-row class="mt-4" v-if="isSubmitDrawerShown" >
<v-col cols="12" sm="12" md="12">
<div class="text-subtitle-2 mb-2 mx-4 font-weight-bold">
评论列表
<v-tooltip bottom>
<template v-slot:activator="{ on, attrs }">
<v-icon
color="grey"
dark
v-bind="attrs"
v-on="on"
small
>
mdi-alert-circle-outline
</v-icon>
</template>
<span>如果是审批单申请人添加的备注,就只给当前审批人发送(已经通过审批人的不会收到提醒);
如果是已经审批了的审批人添加的备注,就给其他当前节点未审批的审批人和申请人发送消息提醒。</span>
</v-tooltip>
</div>
<task-comment-list :comments.sync="updateItem.taskCommentList" @confirm="doUiAction('postComment')" />
</v-col>
</v-row>
<!--抽屉关闭按钮-->
<v-btn elevation="0" color="success" fab absolute top left small tile class="drawer-close-float-btn"
@click="isSubmitDrawerShown = false">
<v-icon>mdi-close</v-icon>
</v-btn>
</v-navigation-drawer>
</div>
<!-- 帮助页抽屉 >>>>>>>>>>>>> -->
<v-navigation-drawer
v-model="isHelpPageDrawerShown" v-click-outside="drawerClickOutside" fixed temporary right width="80%"
class="elevation-24">
<iframe style="border: 0" :src="`/${appInfo.appId}/pageDoc#notfound.md`" width="100%"
height="100%"></iframe>
<v-btn elevation="0" color="success" fab absolute top left small tile class="drawer-close-float-btn"
@click="isHelpPageDrawerShown = false">
<v-icon>mdi-close</v-icon>
</v-btn>
</v-navigation-drawer>
<!-- <<<<<<<<<<<<< 帮助页抽屉 -->
</v-main>
</v-app>
<jh-toast />
<jh-mask />
<jh-confirm-dialog />
</div>
</script>
<div id="app">
</div>
{% endblock %}
{% block vueScript %}
<!-- 加载页面组件 >>>>>>>>>>>>> -->
{% include 'component/tpl/formComponentList.html' %}
{% include 'component/taskHistory.html' %}
{% include 'common/jianghuJs/fixedTableHeightV4.html' %}
{% include 'component/taskCommentList.html' %}
<!-- <<<<<<<<<<<<< 加载页面组件 -->
<script type="module">
new Vue({
el: '#app',
template: '#app-template',
vueComponent: 'page',
vuetify: new Vuetify(),
data: {
isHelpPageDrawerShown: false,
// 表格相关数据
isTableZebraLineShown: true,
validationRules: {
requireRules: [
v => !!v || 'This is required',
],
},
searchInput: null,
isTableLoading: true,
tableData: [],
historyData: [],
noticeData:[],
headers: [
{ text: "审批ID", value: "taskId", width: 90 },
{ text: "分组", value: "taskTemplateGroup", width: 100 },
{ 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,
workflowType: 'todo', // todo, history
lineTypeList: [{
text: "同意",
value: "同意",
},{
text: "拒绝",
value: "拒绝",
}],
userId: '<$ ctx.userInfo.userId $>',
updateItem: {},
updateItemId: null,
isSubmitNodeLoading: false,
workflowHistory:[]
},
// 计算
computed: {
tableDataList() {
var data = [];
switch (this.workflowType) {
case 'todo':
data = this.tableData;
break;
case 'history':
data = this.historyData;
break;
case 'notice':
data = this.noticeData;
break;
default:
break;
}
return data;
},
},
watch: {},
mounted() {
this.doUiAction('getTableData');
this.doUiAction('getTaskHistoryData');
},
methods: {
async doUiAction(uiActionId, uiActionData) {
switch (uiActionId) {
case 'getTableData':
await this.getTableData();
break;
case 'getTaskHistoryData':
await this.getTaskHistoryData();
break;
case 'startUpdateItem':
await this.prepareUpdateFormData(uiActionData);
await this.getTaskWorkflow(uiActionData)
await this.openUpdateDrawer();
break;
case 'submitNode':
await this.prepareSubmitValidate();
await this.confirmSubmitDialog();
await this.submitForReview(uiActionData);
await this.closeSubmitDrawer();
this.getTableData();
this.getTaskHistoryData();
break;
case 'postComment':
await this.doPostComment();
this.getTableData();
this.getTaskHistoryData();
break;
default:
console.error("[doUiAction] uiActionId not find", { uiActionId });
break;
}
},
async getTableData() {
this.isTableLoading = true;
const result = await window.jianghuAxios({
data: {
appData: {
pageId: 'approvalManagement',
actionId: 'selectItemList',
actionData: {},
}
}
});
this.tableData = result.data.appData.resultData;
this.isTableLoading = false;
},
async getTaskHistoryData() {
this.isTableLoading = true;
const result = await window.jianghuAxios({
data: {
appData: {
pageId: 'approvalManagement',
actionId: 'selectHistoryList',
actionData: {},
where: { createHistoryBy: '<$ ctx.userInfo.userId $>'},
whereOrOptions: [['taskConfigId', 'like', 'approvalTask-%'], ['taskConfigId', 'like', 'noticeTask-%']],
orderBy: [{ column: 'operationAt', order: 'desc' }]
}
}
});
var rows = result.data.appData.resultData.rows;
// 根据taskId去重
rows = _.uniqBy(rows, 'taskId')
rows.forEach(row => {
row.operationAt = dayjs(row.operationAt).format('YYYY-MM-DD HH:mm:ss');
});
this.historyData = rows.filter(data => data.taskConfigId.startsWith('approvalTask-') );
this.noticeData = rows.filter(data => data.taskConfigId.startsWith('noticeTask-') );
},
// ---------- 审核、查看 uiAction >>>>>>>>>>>> --------
async prepareUpdateFormData(funObj) {
this.updateItem = _.cloneDeep(funObj);
this.updateItemId = this.updateItem.taskId
this.updateItem.taskInfo = JSON.parse(funObj.taskInfo);
this.updateItem.taskWorkflow = JSON.parse(funObj.taskWorkflow);
this.updateItem.taskFormInput = JSON.parse(funObj.taskFormInput);
this.updateItem.taskCommentList = funObj.taskCommentList && JSON.parse(funObj.taskCommentList) || [];
},
async getTaskWorkflow({ taskId }){
const resultData = (await window.jianghuAxios({
data: {
appData: {
pageId: 'approvalManagement',
actionId: 'getTaskWorkflow',
actionData: {taskId},
}
}
})).data.appData.resultData
this.workflowHistory = resultData
},
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] 否");
}
},
async submitForReview(lineType) {
this.isSubmitNodeLoading = true
await window.vtoast.loading("提交审核");
await window.jianghuAxios({
data: {
appData: {
pageId: 'approvalManagement',
actionId: 'submitNode',
actionData: {
updateItem: this.updateItem,
type: lineType
}
}
}
})
await window.vtoast.success("提交审核成功");
this.isSubmitNodeLoading = false
},
async closeSubmitDrawer() {
this.isSubmitDrawerShown = false;
this.updateItem = {};
this.updateItemId = null;
},
// ---------- <<<<<<<<<<< 审核、查看 uiAction --------
// ---------- 保存评论 uiAction >>>>>>>>>>>> --------
async doPostComment() {
const { taskId, taskCommentList, taskInitUser, taskEditUserList,...data } = this.updateItem
await window.jianghuAxios({
data: {
appData: {
pageId: 'approvalManagement',
actionId: 'updateComment',
actionData: { taskCommentList, taskInitUser, taskEditUserList },
where: { taskId },
}
}
})
},
// ---------- 保存评论 uiAction >>>>>>>>>>>> --------
}
})
</script>
<style scoped>
</style>
{% endblock %}