Files
workflow/app/view/page/taskManagement.html
T
2024-05-16 15:40:50 +08:00

355 lines
13 KiB
HTML

{% 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="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="tableData"
: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>
<!--审核状态-->
<template v-slot:item.taskStatus="{ item }">
<v-chip :color="`${taskStatusColor[item.taskStatus]}`" x-small dark >
{{item.taskStatus}}
</v-chip>
</template>
<!--表格行操作按钮-->
<template v-slot:item.action="{ item }">
<div class="d-flex">
<span role="button" class="success--text jh-font-size-3" @click="doUiAction('startUpdateItem', item)">
<v-icon size="16" class="success--text">mdi-text-box-outline</v-icon>
查看
</span>
<span v-if="item.taskStatus == '审核中'" role="button" class="error--text jh-font-size-3 ml-4" @click="doUiAction('revokeTask', item)">
<v-icon size="16" class="error--text">mdi-arrow-u-left-top</v-icon>
撤回
</span>
<span v-if="item.taskStatus == '审核中'" role="button" class="warning--text jh-font-size-3 ml-4" @click="doUiAction('amendTask', item)">
<v-icon size="16" class="warning--text">mdi-wrench-cog-outline</v-icon>
修正
</span>
</div>
</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-model="isViewDrawerShown" v-click-outside="drawerClickOutside" fixed temporary right width="80%"
class="elevation-24">
<v-form v-if="isViewDrawerShown" ref="updateForm" lazy-validation>
<!-- 抽屉标题 -->
<v-row no-gutters>
<span class="text-h7 font-weight-bold pa-4">申请信息详情</span>
</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 viewItem.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>
</v-form>
<v-divider class="jh-divider"></v-divider>
<!-- 审核申请信息 -->
<v-row class="mt-4" v-if="isViewDrawerShown" >
<v-col cols="12" sm="12" md="12">
<div class="text-subtitle-2 mb-2 mx-4 font-weight-bold">历史审核记录</div>
<task-history :task-id="viewItem.taskId" :workflow-history="workflowHistory"></task-history>
</v-col>
</v-row>
<!--抽屉关闭按钮-->
<v-btn elevation="0" color="success" fab absolute top left small tile class="drawer-close-float-btn"
@click="isViewDrawerShown = 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#taskHistory.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' %}
<!-- <<<<<<<<<<<<< 加载页面组件 -->
<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',
],
},
constantObj: {
userGroupRoleList: []
},
searchInput: null,
isTableLoading: true,
tableData: [],
headers: [
{ text: "申请ID", value: "taskId", width: 100 },
{ text: "申请分组", value: "taskTemplateGroup", width: 120 },
{ text: "申请名称", value: "taskTitle", width: 350 },
{ text: "申请状态", value: "taskStatus", width: 150 },
{ text: "申请时间", value: "taskCreateAt", width: 250 },
{ text: "结束时间", value: "taskFinishAt", width: 250 },
{ text: '操作', value: 'action', align: 'center', sortable: false, width: 200, class: 'fixed', cellClass: 'fixed' },
],
isViewDrawerShown: false,
viewItem: {},
userId: '<$ ctx.userInfo.userId $>',
taskStatusColor:{
'已通过': 'primary',
'已拒绝': 'red',
'审核中': 'blue',
"已撤回": 'grey'
},
workflowHistory:[]
},
// 计算
computed: {
isMobile() {
return window.innerWidth < 600;
},
},
watch: {
},
mounted() {
this.doUiAction('getTableData');
this.constantObj.userGroupRoleList = window.userInfo.userGroupRoleList.map(item=>item.groupId)
},
methods: {
async doUiAction(uiActionId, uiActionData) {
switch (uiActionId) {
case 'getTableData':
await this.getTableData();
break;
case 'startUpdateItem':
await this.prepareViewItemData(uiActionData);
await this.getTaskWorkflow(uiActionData)
await this.openViewDrawer();
break;
case 'revokeTask':
await this.confirmRevokeItemDialog();
await this.doRevokeTask(uiActionData);
await this.getTableData();
break;
case 'amendTask':
await this.confirmAmendItemDialog();
await this.doAmendTask(uiActionData);
await this.getTableData();
break;
default:
console.error("[doUiAction] uiActionId not find", { uiActionId });
break;
}
},
async getTableData() {
this.isTableLoading = true;
const result = await window.jianghuAxios({
data: {
appData: {
pageId: 'taskManagement',
actionId: 'selectItemList',
actionData: {},
where:{taskInitUser: this.userId},
orderBy: [{ column: 'operationAt', order: 'desc' }]
}
}
});
const rows = result.data.appData.resultData.rows;
const statusMap = {
'success': '已通过',
'reject': '已拒绝',
'running': '审核中',
'revoke': '已撤回',
};
rows.forEach(row => {
row.taskFormInput = JSON.parse(row.taskFormInput);
row.taskCreateAt = row.taskCreateAt && dayjs(row.taskCreateAt).format('YYYY-MM-DD HH:mm:ss');
row.taskFinishAt = row.taskFinishAt && dayjs(row.taskFinishAt).format('YYYY-MM-DD HH:mm:ss');
row.taskStatus = statusMap[row.taskStatus];
});
this.tableData = rows;
this.isTableLoading = false;
},
// ---------- 查看 uiAction >>>>>>>>>>>> --------
async prepareViewItemData(funObj) {
this.viewItem = _.cloneDeep(funObj);
},
async getTaskWorkflow({ taskId }){
const resultData = (await window.jianghuAxios({
data: {
appData: {
pageId: 'taskManagement',
actionId: 'getTaskWorkflow',
actionData: { taskId },
}
}
})).data.appData.resultData
this.workflowHistory = resultData
},
async openViewDrawer() {
this.isViewDrawerShown = true;
},
// ---------- 查看 uiAction >>>>>>>>>>>> --------
// ---------- 撤回 uiAction >>>>>>>>>>>> --------
async confirmRevokeItemDialog() {
if (await window.confirmDialog({title: "撤回", content: "确定撤回吗?"}) === false) {
throw new Error("[confirmDeleteItemDialog] 否");
}
},
async doRevokeTask({ taskId }) {
await window.vtoast.loading("修改数据");
await window.jianghuAxios({
data: {
appData: {
pageId: 'taskManagement',
actionId: 'revokeItem',
actionData: {
taskStatus: 'revoke',
taskLineType: null,
taskEditUserList: null,
taskEditedUserList: null,
taskFinishAt: dayjs().format('YYYY-MM-DD HH:mm:ss')
},
where: { taskId: taskId }
}
}
})
await window.vtoast.success("修改数据成功");
},
// ---------- 撤回 uiAction >>>>>>>>>>>> --------
// ---------- 修正 uiAction >>>>>>>>>>>> --------
async confirmAmendItemDialog() {
if (await window.confirmDialog({title: "修正", content: "确定修正吗?"}) === false) {
throw new Error("[confirmDeleteItemDialog] 否");
}
},
async doAmendTask(item) {
await window.vtoast.loading("修改数据");
await window.jianghuAxios({
data: {
appData: {
pageId: 'taskManagement',
actionId: 'amendItem',
actionData: item
}
}
})
await window.vtoast.success("修改数据成功");
},
// ---------- 修正 uiAction >>>>>>>>>>>> --------
}
})
</script>
<style scoped>
</style>
{% endblock %}