Files
workflow/app/view/page/workflowManagement.html
T
2024-05-20 15:39:52 +08:00

295 lines
9.9 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-btn color="success" small class="elevation-0 mr-2" @click="doUiAction('openWorkflowEditorDrawer')">新增
</v-btn>
<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 single-line hide-details></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.action="{ item }">
<template>
<!-- pc端 -->
<template v-if="!isMobile">
<span role="button" class="success--text font-weight-medium font-size-2 mr-2" @click="doUiAction('openWorkflowEditorDrawer', item)">
<v-icon size="16" class="success--text">mdi-note-edit-outline</v-icon>编辑
</span>
<span role="button" class="error--text font-weight-medium font-size-2" @click="doUiAction('deleteWorkflow', item)">
<v-icon size="16" class="error--text">mdi-trash-can-outline</v-icon>删除
</span>
</template>
<!-- 手机端 -->
<v-menu offset-y v-if="isMobile">
<template v-slot:activator="{ on, attrs }">
<span role="button" class="success--text font-weight-medium font-size-2"
v-bind="attrs" v-on="on">
操作<v-icon size="14" class="success--text">mdi-chevron-down</v-icon>
</span>
</template>
<v-list dense>
<v-list-item @click="doUiAction('openWorkflowEditorDrawer', item)">
<v-list-item-title>编辑</v-list-item-title>
</v-list-item>
<v-list-item @click="doUiAction('deleteWorkflow', item)">
<v-list-item-title>删除</v-list-item-title>
</v-list-item>
</v-list>
</v-menu>
</template>
</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>
<!-- <<<<<<<<<<<<< 页面内容 -->
</div>
<!-- <<<<<<<<<<<<< 创建审批抽屉 -->
<create-task-drawer ref="createTaskDrawer"></create-task-drawer>
<!-- <<<<<<<<<<<<< 创建审批抽屉 -->
<!-- 编辑流程抽屉 >>>>>>>>>>>>> -->
<workflow-editor-drawer ref="workflowEditorDrawer" @success="doUiAction('getTableData')"/>
<!-- <<<<<<<<<<<<< 编辑流程抽屉 -->
<!-- 帮助页抽屉 >>>>>>>>>>>>> -->
<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 'common/constantUtil.html' %}
{% include 'component/workflowEditorDrawer.html' %}
{% include 'common/jianghuJs/fixedTableHeightV4.html' %}
<!-- <<<<<<<<<<<<< 加载页面组件 -->
<script type="module">
new Vue({
el: '#app',
template: '#app-template',
vueComponent: 'page',
vuetify: new Vuetify(),
data: {
isMobile: window.innerWidth < 500,
validationRules: {
requireRules: [
v => !!v || 'This is required',
],
},
isTableLoading: false,
userList: [],
tableDataFromBackend: [],
tableData: [],
headers: [
{ text: '流程ID', value: 'workflowId' },
{ text: '流程名称', value: 'workflowName' },
{ text: '操作', value: 'action', align: 'left', sortable: false, width: window.innerWidth < 500 ? 80 : 120, class: 'fixed', cellClass: 'fixed' },
],
searchInput: '',
isHelpPageDrawerShown: false,
isTableZebraLineShown: true,
isCreateDrawerShown: false,
currentWorkflowForm: [],
currentWorkflowId: {},
currentWorkflowPersonList: [],
},
watch: {},
created() {
this.doUiAction('getTableData');
this.getUserList();
},
methods: {
async doUiAction(uiActionId, uiActionData) {
switch (uiActionId) {
case 'getTableData':
await this.getTableData();
await this.parseTableData();
break;
case 'openWorkflowEditorDrawer':
await this.openWorkflowEditorDrawer(uiActionData);
break;
case 'deleteWorkflow':
await this.confirmDeleteItemDialog();
await this.deleteWorkflow(uiActionData);
await this.doUiAction('getTableData')
break;
default:
console.error("[doUiAction] uiActionId not find", { uiActionId });
break;
}
},
async getTableData() {
this.isTableLoading = true;
const result = await window.jianghuAxios({
data: {
appData: {
pageId: 'workflowManagement',
actionId: 'selectItemList',
actionData: {},
orderBy: [{ column: 'id', order: 'desc'}]
}
}
});
this.tableDataFromBackend = result.data.appData.resultData.rows;
this.isTableLoading = false;
},
async parseTableData() {
const rows = _.cloneDeep(this.tableDataFromBackend);
rows.forEach(row => {
const workflowNodeList = JSON.parse(row.workflowConfig).nodeList;
workflowNodeList.forEach(node => {
node.isNeedAllApproval = true;
});
row.workflowPersonList = workflowNodeList.filter(node => node.id.includes('userTask-'));
row.workflowForm = JSON.parse(row.workflowForm);
});
this.tableData = rows;
},
async getUserList() {
const result = await window.jianghuAxios({
data: {
appData: {
pageId: 'workflowManagement',
actionId: 'selectUserList',
actionData: {},
orderBy: [{ column: 'userId', order: 'asc' }]
}
}
});
const userList = result.data.appData.resultData.rows;
this.userList = userList;
},
openWorkflowEditorDrawer(item) {
this.$refs.workflowEditorDrawer.doUiAction('open', item);
},
async confirmDeleteItemDialog() {
if (await window.confirmDialog({title: "删除", content: "确定删除吗?"}) === false) {
throw new Error("[confirmDeleteItemDialog] 否");
}
},
async deleteWorkflow({workflowId}){
await window.vtoast.loading("删除数据");
await window.jianghuAxios({
data: {
appData: {
pageId: 'workflowManagement',
actionId: 'deleteItem',
actionData: {},
where: {workflowId: workflowId}
}
}
})
await window.vtoast.success("删除数据成功");
}
}
})
</script>
<style scoped>
.work-item-box {
padding: 50% 0;
position: relative;
}
.work-item-content {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
}
@media (max-width: 500px) {
body [xs='4'] {
flex: auto;
}
}
</style>
{% endblock %}