调整页面,v4

This commit is contained in:
xueyuan committed 2023-02-09 23:38:35 +08:00
1 parent f3bed51eef
commit f695923685
16 files changed
+1913 -349

No files matched your search

+283
View File
@@ -0,0 +1,283 @@
{% 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">
<div class="pt-3 text-h7 font-weight-bold">审批列表
<!-- 帮助页按钮 -->
<v-icon @click="isHelpPageDrawerShown = true" color="success" small>mdi-help-circle-outline</v-icon>
</div>
<v-breadcrumbs class="pb-3 pt-0 px-0" :items="breadcrumbs" divider="-"></v-breadcrumbs>
</div>
<!-- <<<<<<<<<<<<< 头部内容 -->
<div class="jh-page-body-container px-8">
<!-- 页面内容 >>>>>>>>>>>>> -->
<v-card class="rounded-lg">
<v-row class="ma-0 py-0 px-4">
<v-spacer></v-spacer>
<!--搜索-->
<v-col cols="12" xs="8" sm="4" md="3" xl="2" class="px-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
v-if="item.taskStatus === '已结束'" label outlined
color="red"
small
>
{{item.taskStatus}}
</v-chip>
<v-chip
v-else label outlined
color="green"
small
>
{{item.taskStatus}}
</v-chip>
</template>
<!--表格行操作按钮-->
<template v-slot:item.action="{ item }">
<span role="button" class="success--text jh-font-size-3 pr-2"
@click="doUiAction('startUpdateItem', item)">
查看
</span>
</template>
<!--表格底部右侧功能按钮-->
<template v-slot:footer.prepend>
<v-btn icon @click="doUiAction('openTableZebraLineMenu', $event)">
<v-icon>mdi-menu</v-icon>
</v-btn>
<v-menu top offset-y :close-on-content-click="false" v-model="isTableZebraLineMenuShown" :position-x="tableZebraLineMenuPosition.x" :position-y="tableZebraLineMenuPosition.y">
<v-list>
<v-list-item>
<v-switch v-model="isTableZebraLineShown" hide-details class="ma-0" label="显示斑马纹" dense flat></v-switch>
</v-list-item>
</v-list>
</v-menu>
</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" :permanent="isViewDrawerShown" fixed temporary right hide-overlay width="80%"
class="elevation-24">
<v-form v-if="isViewDrawerShown" ref="updateForm" lazy-validation>
<!--抽屉标题-->
<v-row>
<span class="title pa-6 pl-8">历史审核记录</span>
</v-row>
<!--抽屉表单-->
<v-row class="mt-0 px-6">
<v-col cols="12" sm="12" md="12">
<span class="jh-input-label">审核申请信息</span>
<task-history :task-id="updateItem.taskId"></task-history>
</v-col>
</v-row>
</v-form>
<!--抽屉关闭按钮-->
<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" fixed temporary right width="80%" hide-overlay
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 'common/fixedTableHeightV4.html' %}
{% include 'component/taskHistory.html' %}
<!-- <<<<<<<<<<<<< 加载页面组件 -->
<script type="module">
new Vue({
el: '#app',
template: '#app-template',
vueComponent: 'page',
vuetify: new Vuetify(),
data: {
// 面包屑
breadcrumbs: [
{
text: '首页',
disabled: true,
},
{
text: '所有审批',
disabled: true,
}
],
isHelpPageDrawerShown: false,
// 表格相关数据
isTableZebraLineMenuShown: false,
tableZebraLineMenuPosition: {x: null, y: null},
isTableZebraLineShown: true,
// 生日日期选择
validationRules: {
requireRules: [
v => !!v || 'This is required',
],
},
searchInput: null,
isTableLoading: true,
tableData: [],
historyData: [],
headers: [
{ text: '操作', value: 'action', align: 'center', sortable: false, width: 120, class: 'fixed', cellClass: 'fixed' },
{ text: "审批项", value: "taskTitle" },
{ text: "审核状态", value: "taskStatus" },
{ text: "操作者", value: "operationByUser", width: 120 },
{ text: "操作时间", value: "operationAt", width: 250 }
],
isViewDrawerShown: false,
updateItem: {},
workflowType: 'todo', // todo, history
lineTypeList: [],
userId: '<$ ctx.userInfo.userId $>'
},
// 计算
computed: {
},
watch: {
},
mounted() {
this.doUiAction('getTableData');
},
methods: {
async doUiAction(uiActionId, uiActionData) {
switch (uiActionId) {
case 'getTableData':
await this.getTableData();
break;
case 'openDataPicker':
await this.openDataPicker(uiActionData);
break;
case 'openTableZebraLineMenu':
await this.openTableZebraLineMenu(uiActionData);
break;
case 'startUpdateItem':
await this.prepareUpdateFormData(uiActionData);
await this.openUpdateDrawer();
break;
default:
console.error("[doUiAction] uiActionId not find", { uiActionId });
break;
}
},
async getTableData() {
this.isTableLoading = true;
const result = await window.jianghuAxios({
data: {
appData: {
pageId: 'taskHistory',
actionId: 'selectItemList',
actionData: {},
orderBy: [{ column: 'operationAt', order: 'desc' }]
}
}
});
const rows = result.data.appData.resultData.rows;
const statusMap = {
'running': '审核中',
'end': '已结束',
};
rows.forEach(row => {
row.taskFormInput = JSON.parse(row.taskFormInput);
row.operationAt = dayjs(row.operationAt).format('YYYY-MM-DD HH:mm:ss');
row.taskStatus = statusMap[row.taskStatus];
});
this.tableData = rows;
this.isTableLoading = false;
},
// ---------- 斑马纹开关 uiAction >>>>>>>>>> --------
async openTableZebraLineMenu(funObj) {
this.tableZebraLineMenuPosition.x = funObj.x -funObj.offsetX + 10;
this.tableZebraLineMenuPosition.y = window.innerHeight - 50;
this.isTableZebraLineMenuShown = !this.isTableZebraLineMenuShown;
},
// ---------- <<<<<<<<<< 斑马纹开关 uiAction --------
// ---------- 审核、查看 uiAction >>>>>>>>>>>> --------
async prepareUpdateFormData(funObj) {
this.updateItem = _.cloneDeep(funObj);
},
async closeSubmitDrawer() {
this.isViewDrawerShown = false;
},
async openUpdateDrawer() {
this.isViewDrawerShown = true;
},
// ---------- 审核、查看 uiAction >>>>>>>>>>>> --------
}
})
</script>
<style scoped>
</style>
{% endblock %}
s
+412
View File
@@ -0,0 +1,412 @@
{% 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">
<div class="pt-3 text-h7 font-weight-bold">待办审批
<!-- 帮助页按钮 -->
<v-icon @click="isHelpPageDrawerShown = true" color="success" small>mdi-help-circle-outline</v-icon>
</div>
<v-breadcrumbs class="pb-3 pt-0 px-0" :items="breadcrumbs" divider="-"></v-breadcrumbs>
</div>
<!-- <<<<<<<<<<<<< 头部内容 -->
<div class="jh-page-body-container px-8">
<!-- 页面内容 >>>>>>>>>>>>> -->
<v-card class="rounded-lg">
<v-row class="ma-0 py-0 px-4">
<v-spacer></v-spacer>
<!--切换状态-->
<v-col cols="12" xs="4" sm="4" md="4" xl="4" class="pl-0 d-flex justify-end">
<v-btn-toggle
v-model="workflowType"
borderless
color="success"
>
<v-btn value="todo" small>
<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>
<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-toggle>
</v-col>
<!--搜索-->
<v-col cols="12" xs="8" sm="4" md="3" xl="2" class="px-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>
<span v-if="workflowType != 'todo'">
<v-chip
v-if="item.taskHandleDesc === '拒绝'" label outlined
color="red"
small
>
已{{item.taskHandleDesc}}
</v-chip>
<v-chip
v-else label outlined
color="green"
small
>
已{{item.taskHandleDesc}}
</v-chip>
</span>
</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="14" 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)">
查看
</span>
</template>
<!--表格底部右侧功能按钮-->
<template v-slot:footer.prepend>
<v-btn icon @click="doUiAction('openTableZebraLineMenu', $event)">
<v-icon>mdi-menu</v-icon>
</v-btn>
<v-menu top offset-y :close-on-content-click="false" v-model="isTableZebraLineMenuShown" :position-x="tableZebraLineMenuPosition.x" :position-y="tableZebraLineMenuPosition.y">
<v-list>
<v-list-item>
<v-switch v-model="isTableZebraLineShown" hide-details class="ma-0" label="显示斑马纹" dense flat></v-switch>
</v-list-item>
</v-list>
</v-menu>
</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="isSubmitDrawerShown" :permanent="isSubmitDrawerShown" fixed temporary right hide-overlay width="80%"
class="elevation-24">
<v-form v-if="isSubmitDrawerShown" ref="updateForm" lazy-validation>
<!--抽屉标题-->
<v-row>
<span class="title pa-6 pl-8">审核信息</span>
</v-row>
<!--抽屉表单-->
<v-row class="mt-0 px-6">
<v-col cols="12" sm="12" md="12">
<span class="jh-input-label">审核申请信息</span>
<v-card class="rounded-lg px-4" outlined>
<v-row class="my-0">
<v-col cols="12" sm="12" md="6" v-for="(item, key, index) in updateItem.taskFormInput.input">
<span class="jh-input-label" style="color: gray">{{key}}:</span>
<span>{{item}}</span>
</v-col>
</v-row>
</v-card>
</v-col>
<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 label="备注"
v-model="updateItem.taskComment" :readonly="workflowType != 'todo'"></v-textarea>
</v-col>
</v-row>
<!--抽屉操作按钮-->
<v-row class="justify-end mx-0 mt-8 px-6">
<v-btn color="success" class="mx-4" v-for="item in lineTypeList" v-if="item.type" @click="doUiAction('submitNode', item.type)">
{{ item.type }}
</v-btn>
</v-row>
<v-row class="mt-0 px-6">
<v-col cols="12" sm="12" md="12">
<span class="jh-input-label">审核历史</span>
<task-history :task-id="updateItem.taskId" @line-type-list="setLineTypeList"></task-history>
</v-col>
</v-row>
</v-form>
<!--抽屉关闭按钮-->
<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" fixed temporary right width="80%" hide-overlay
class="elevation-24">
<iframe style="border: 0" :src="`/${appInfo.appId}/pageDoc#todo.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/fixedTableHeightV4.html' %}
{% include 'component/taskHistory.html' %}
<!-- <<<<<<<<<<<<< 加载页面组件 -->
<script type="module">
new Vue({
el: '#app',
template: '#app-template',
vueComponent: 'page',
vuetify: new Vuetify(),
data: {
// 面包屑
breadcrumbs: [
{
text: '首页',
disabled: true,
},
{
text: '我的相关、待办',
disabled: true,
}
],
isHelpPageDrawerShown: false,
// 表格相关数据
isTableZebraLineMenuShown: false,
tableZebraLineMenuPosition: {x: null, y: null},
isTableZebraLineShown: true,
// 生日日期选择
validationRules: {
requireRules: [
v => !!v || 'This is required',
],
},
searchInput: null,
isTableLoading: true,
tableData: [],
historyData: [],
headers: [
{ text: '操作', value: 'action', align: 'center', sortable: false, width: 120, class: 'fixed', cellClass: 'fixed' },
{ text: "审批项", value: "taskTitle" },
{ text: "操作者", value: "operationByUser", width: 120 },
{ text: "操作时间", value: "operationAt", width: 250 }
],
isSubmitDrawerShown: false,
updateItem: {},
workflowType: 'todo', // todo, history
lineTypeList: [],
userId: '<$ ctx.userInfo.userId $>'
},
// 计算
computed: {
tableDataList() {
return this.workflowType === 'todo' ? this.tableData : this.historyData;
},
},
watch: {
},
mounted() {
this.doUiAction('getTableData');
this.doUiAction('getHistoryData');
},
methods: {
async doUiAction(uiActionId, uiActionData) {
switch (uiActionId) {
case 'getTableData':
await this.getTableData();
break;
case 'getHistoryData':
await this.getHistoryData();
break;
case 'openDataPicker':
await this.openDataPicker(uiActionData);
break;
case 'openTableZebraLineMenu':
await this.openTableZebraLineMenu(uiActionData);
break;
case 'startUpdateItem':
await this.prepareUpdateFormData(uiActionData);
await this.openUpdateDrawer();
break;
case 'submitNode':
await this.confirmSumitDialog();
await this.submitForReview(uiActionData);
await this.closeSubmitDrawer();
await this.clearSubmitData();
this.getTableData();
this.getHistoryData();
break;
default:
console.error("[doUiAction] uiActionId not find", { uiActionId });
break;
}
},
async getTableData() {
this.isTableLoading = true;
const result = await window.jianghuAxios({
data: {
appData: {
pageId: 'todo',
actionId: 'selectItemList',
actionData: {},
where: {taskStatus: 'running'},
whereLike: {taskEditUserList: this.userId},
orderBy: [{ column: 'operationAt', order: 'desc' }]
}
}
});
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() {
this.isTableLoading = true;
const result = await window.jianghuAxios({
data: {
appData: {
pageId: 'todo',
actionId: 'selectHistoryList',
actionData: {},
where: {taskStatus: 'running'},
whereLike: {taskEditUserList: '<$ ctx.userInfo.userId $>', taskConfigId: 'userTask-'},
orderBy: [{ column: 'id', order: 'desc' }]
}
}
});
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 openTableZebraLineMenu(funObj) {
this.tableZebraLineMenuPosition.x = funObj.x -funObj.offsetX + 10;
this.tableZebraLineMenuPosition.y = window.innerHeight - 50;
this.isTableZebraLineMenuShown = !this.isTableZebraLineMenuShown;
},
// ---------- <<<<<<<<<< 斑马纹开关 uiAction --------
// ---------- 审核、查看 uiAction >>>>>>>>>>>> --------
async prepareUpdateFormData(funObj) {
this.updateItem = _.cloneDeep(funObj);
this.updateItem.taskHistoryList = []; // 审核历史
this.updateItem.taskComment = ''; // 备注
this.lineTypeList = []; // 所有操作按钮
},
async closeSubmitDrawer() {
this.isSubmitDrawerShown = false;
},
async openUpdateDrawer() {
this.isSubmitDrawerShown = true;
},
async confirmSumitDialog() {
if (await window.confirmDialog({title: "审核", content: "确定提交审核吗?"}) === false) {
throw new Error("[confirmSumitDialog] 否");
}
},
async clearSubmitData() {
this.updateItem = {};
},
async submitForReview(type) {
await window.vtoast.loading("提交审核");
await window.jianghuAxios({
data: {
appData: {
pageId: 'todo',
actionId: 'submitNode',
actionData: {type, id: this.updateItem.id, taskId: this.updateItem.taskId, taskComment: this.updateItem.taskComment}
}
}
})
await window.vtoast.success("提交审核成功");
setTimeout(()=> {
this.$emit('close-detail-drawer')
// if (document.referrer) {
// location.href = document.referrer;
// } else {
// history.back();
// }
}, 1000);
},
setLineTypeList(lineTypeList) {
this.lineTypeList = _.uniqBy((lineTypeList||'').split(",").map(lineType => ({type: lineType, label: lineType})), 'type');
},
// ---------- <<<<<<<<<<< 审核、查看 uiAction --------
}
})
</script>
<style scoped>
</style>
{% endblock %}
+40 -13
View File
@@ -12,31 +12,36 @@
</template>
<template slot-scope="props">
<v-card class="mt-3 mb-12" :class="{'pa-8': !props.ismobile, 'pa-4': props.ismobile}">
<v-card class="mt-3 mb-3" :class="{'pa-8': !props.ismobile, 'pa-4': props.ismobile}">
<v-row>
<v-col cols="12" sm="12" md="3" xl="3" class=" pb-3">
<v-text-field class="cus-v-input mr-2" dense filled single-line color="success" prefix="流程名:" v-model="editItem['workflowName']" :rules="requireRules">
</v-text-field>
</v-col>
<v-col cols="12" sm="12" md="3" xl="3" class=" pb-3">
<!-- <v-col cols="12" sm="12" md="3" xl="3" class=" pb-3">
<v-text-field class="cus-v-input mr-2" dense filled single-line color="success" prefix="分类:" v-model="editItem['workflowCategory']" :rules="requireRules">
</v-text-field>
</v-col>
</v-col> -->
<v-col cols="12" sm="12" md="3" xl="3" class=" pb-3">
<v-text-field class="cus-v-input mr-2" dense filled single-line color="success" prefix="备注:"
v-model="editItem['workflowRemark']">
</v-text-field>
</v-col>
<v-col cols="12" sm="12" md="3" xl="3" class=" pb-3">
<v-select class="cus-v-input mr-2" dense filled single-line color="success" prefix="审批模式:"
v-model="editItem['mode']" :items="constantCollection.modeList" />
</v-col>
</v-row>
</v-card>
<div class=" pb-4" style="font-size: 18px; font-weight: bold">模板设置</div>
<!-- <div class=" pb-4" style="font-size: 18px; font-weight: bold">模板设置</div>
<tpl-form-design :form="editItem.workflowForm" v-if="!loading">
</tpl-form-design>
</tpl-form-design> -->
<div class="pt-8 pb-4" style="font-size: 18px; font-weight: bold">流程设置</div>
<process-flow v-if="!loading" ref="processFlow" :data="editItem.workflowConfig" :user="constantCollection.userList"
:group="constantCollection.groupList" :tpl="constantCollection.workflowFormList">
:group="constantCollection.groupList" :tpl="constantCollection.workflowFormList"
:mode="editItem.mode">
</process-flow>
<v-overlay :value="loading" absolute>
@@ -66,12 +71,16 @@ new Vue({
vuetify: new Vuetify(),
data: () => ({
requireRules: [
v => !!v || 'This is required',
v => !!v || '必填',
],
constantCollection: {
userList: [],
groupList: [],
workflowFormList: []
workflowFormList: [],
modeList: [
{ text: '串行', value: 'serial'},
{ text: '并行', value: 'parallel'},
]
},
editItem: {},
dialogSaveInfoAction: 'createItem',
@@ -123,8 +132,17 @@ new Vue({
},
buildEditItem() {
const { id, workflowId, workflowName, workflowRemark, workflowCategory, workflowForm } = this.editItem;
const { id, workflowId, workflowName, workflowRemark, workflowCategory, mode, workflowForm } = this.editItem;
const workflowConfig = this.$refs.processFlow.getData();
workflowConfig.mode = mode
// TODO: 清除不存在的用户
workflowConfig.nodeList.forEach(node => {
if (node.type === 'userTask') {
node.assignValue = node.assignValue || [];
node.assignValue = node.assignValue.filter(userId => this.constantCollection.userList.findIndex(u => u.userId === userId) > -1);
node.origin.properties.assignValue = node.assignValue;
}
});
let item = {
workflowName,
workflowRemark,
@@ -159,7 +177,6 @@ new Vue({
}
}
config.formId = formId
console.log(config.outline, config.formId)
}
},
@@ -178,7 +195,7 @@ new Vue({
}
})).data.appData.resultData;
this.constantCollection.userList = rows.map(e => {
return {text: e.username, value: e.userId}
return {text: e.username, value: e.userId, userId: e.userId }
})
},
/**
@@ -202,7 +219,7 @@ new Vue({
async clearItemData() {
this.dialogSaveInfoAction = 'createItem';
this.editItem = {workflowForm: [], workflowConfig: {lineList: [], nodeList: []}};
this.editItem = {workflowForm: [], workflowConfig: {lineList: [], nodeList: []}, mode: 'serial'};
},
async syncEditItem() {
@@ -223,6 +240,7 @@ new Vue({
const item = rows[0];
item.workflowConfig = item.workflowConfig ? JSON.parse(item.workflowConfig) : null;
item.workflowForm = item.workflowForm ? JSON.parse(item.workflowForm) : [];
item.mode = item.workflowConfig.mode || 'serial';
this.editItem = item;
}
setTimeout(() => {
@@ -285,7 +303,16 @@ new Vue({
})
</script>
<style scoped>
<style>
.theme--light.v-data-table > .v-data-table__wrapper > table > tbody > tr > td:not(.v-data-table__mobile-row) {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
max-width: 500px;
}
.theme--light.v-data-table > .v-data-table__wrapper > table > tbody > tr {
cursor: pointer;
}
</style>
{% endblock %}
+187
View File
@@ -0,0 +1,187 @@
{% extends 'template/jhTemplateV3.html'%}
{% block vue_template %}
<jh-layout-v3>
<!-- 页面主要内容 -->
<v-card :class="{'px-2': isMobile}">
<v-row class="ma-0 align-center flex-none pt-0 " :class="{'pa-4': !isMobile, 'pb-0': !isMobile, 'pa-2': isMobile}">
<v-col cols="12" xs="12" sm="4" md="4" xl="4" class="pl-0">
<v-btn color="success" dark class="elevation-0 mr-2" @click="doUiAction('createItem')">新增</v-btn>
<span class="body-2">共{{ tableDataFromBackend.length }}条记录</span>
</v-col>
<v-spacer></v-spacer>
<v-col cols="12" xs="12" sm="4" md="3" xl="3" class="px-0">
<v-text-field v-model="searchInput" prefix="表格过滤:" color="success" class="cus-v-input" dense filled
single-line></v-text-field>
</v-col>
</v-row>
<v-data-table
fixed-header
:headers="headers"
:items="tableDataFromBackend"
:search="searchInput"
:footer-props="{ itemsPerPageOptions: [20, 40, 60, 100, -1] }"
height="600"
:items-per-page="100"
mobile-breakpoint="0"
:loading="isTableLoading"
checkbox-color="success"
:class="{'mx-2': isMobile}"
color="success"
class="elevation-0 mt-0 flex-fill d-flex flex-column">
<template v-slot:item.action="{ item }">
<v-btn small class="mr-2" :class="tableButton.color" v-for="tableButton of tableButtonList"
@click="doUiAction(tableButton.action, {item})">
{{ tableButton.text }}
</v-btn>
</template>
<template v-slot:item.operationAt="{ item }">
{{ item.operationAt && dayjs(item.operationAt).format('YYYY-MM-DD HH:mm:ss') }}
</template>
</v-data-table>
</v-card>
</jh-layout-v3>
{% endblock %}
{% block vue_body %}
<script type="module">
new Vue({
el: '#app',
template: '#app-template',
vuetify: new Vuetify(),
data: () => ({
isMobile: window.innerWidth < 600,
searchInput: null,
isTableLoading: true,
tableDataFromBackend: [],
headers: [
// {text: "ID", value: "id", width: 120, class: 'fixed', cellClass: 'fixed'},
{text: "流程名", value: "workflowName", width: 200, class: 'fixed', cellClass: 'fixed'},
{text: "流程ID", value: "workflowId", width: 120},
// {text: "分类ID", value: "workflowCategory", width: 120},
{text: "备注", value: "workFlowRemark", width: 120},
{text: "操作者", value: "operationByUser", width: 120},
{text: "操作时间", value: "operationAt", width: 250},
{text: '操作', value: 'action', align: 'center', sortable: false, width: 160, class: 'fixed', cellClass: 'fixed'},
],
tableButtonList: [
{text: '编辑', buttonType: 'edit', color: 'success', action: 'updateItem'},
{text: '删除', buttonType: 'delete', color: 'error', action: 'deleteItem'},
]
}),
async created() {
await this.doUiAction('refreshTableData');
},
mounted() {
},
methods: {
async doUiAction(uiActionId, uiActionData) {
switch (uiActionId) {
case 'refreshTableData':
await this.refreshTableData(uiActionData);
break;
case 'createItem':
await this.prepareValidate(uiActionData);
await this.doCreateItem(uiActionData);
break;
case 'updateItem':
await this.prepareValidate(uiActionData);
await this.doUpdateItem(uiActionData);
break;
case 'deleteItem':
await this.confirmDeleteItemDialog(uiActionData);
await this.doDeleteItem(uiActionData);
await this.refreshTableData(uiActionData);
break;
default:
console.error("[doUiAction] uiActionId not find", { uiActionId });
break;
}
},
/**
* 获取表格数据
*/
async refreshTableData() {
this.isTableLoading = true;
const {rows} = (await window.jianghuAxios({
data: {
appData: {
pageId: 'workflowManagement',
actionId: 'selectItemList',
orderBy: [{column: 'id', order: 'asc'}]
}
}
})).data.appData.resultData;
for (const item of rows) {
item.workflowConfig = item.workflowConfig ? JSON.parse(item.workflowConfig) : null;
item.workflowForm = item.workflowForm ? JSON.parse(item.workflowForm) : [];
item.operationAt = dayjs(item.operationAt).format();
}
this.tableDataFromBackend = rows;
this.isTableLoading = false;
},
async prepareValidate() {
if(this.isMobile) {
window.vtoast.fail({message: '该功能只能在电脑使用'})
return false;
}
},
// CreateItem
async doCreateItem() {
window.location.href = `/${window.appInfo.appId}/page/workflowEditor`;
},
// UpdateItem
async doUpdateItem({item}) {
sessionStorage.setItem('workflowEditItem', JSON.stringify(item))
window.location.href = `/${window.appInfo.appId}/page/workflowEditor?id=${item.id}`;
},
async confirmDeleteItemDialog() {
if (await window.confirmDialog({title: "删除", content: "确定删除吗?"}) === false) {
throw new Error("[confirmDeleteItemDialog] 否");
}
},
/**
* 删除数据
*/
async doDeleteItem({item}) {
const {id} = item;
await window.vtoast.loading("删除数据");
await window.jianghuAxios({
data: {
appData: {
pageId: 'workflowManagement',
actionId: 'deleteItem',
actionData: {},
where: {id: id}
}
}
});
await window.vtoast.success("删除数据成功");
},
}
})
</script>
<style>
.theme--light.v-data-table > .v-data-table__wrapper > table > tbody > tr > td:not(.v-data-table__mobile-row) {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
max-width: 500px;
}
.theme--light.v-data-table > .v-data-table__wrapper > table > tbody > tr {
cursor: pointer;
}
</style>
{% endblock %}
+416 -145
View File
@@ -1,173 +1,444 @@
{% extends 'template/jhTemplateV3.html'%}
{% extends 'template/jhTemplateV4.html'%}
{% block vue_template %}
{% block vueTemplate %}
<jh-layout-v3>
<!-- 页面主要内容 -->
<v-card :class="{'px-2': isMobile}">
<v-row class="ma-0 align-center flex-none pt-0 " :class="{'pa-4': !isMobile, 'pb-0': !isMobile, 'pa-2': isMobile}">
<v-col cols="12" xs="12" sm="4" md="4" xl="4" class="pl-0">
<v-btn color="success" dark class="elevation-0 mr-2" @click="doUiAction('createItem')">新增</v-btn>
<span class="body-2">共{{ tableDataFromBackend.length }}条记录</span>
</v-col>
<v-spacer></v-spacer>
<v-col cols="12" xs="12" sm="4" md="3" xl="3" class="px-0">
<v-text-field v-model="searchInput" prefix="表格过滤:" color="success" class="cus-v-input" dense filled
single-line></v-text-field>
</v-col>
</v-row>
<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">
<div class="pt-3 text-h7 font-weight-bold">新申请审批
<!-- 帮助页按钮 -->
<v-icon @click="isHelpPageDrawerShown = true" color="success" small>mdi-help-circle-outline</v-icon>
</div>
<v-breadcrumbs class="pb-3 pt-0 px-0" :items="breadcrumbs" divider="-"></v-breadcrumbs>
</div>
<!-- <<<<<<<<<<<<< 头部内容 -->
<v-data-table
fixed-header
:headers="headers"
:items="tableDataFromBackend"
:search="searchInput"
:footer-props="{ itemsPerPageOptions: [20, 40, 60, 100, -1] }"
:items-per-page="20"
mobile-breakpoint="0"
:loading="isTableLoading"
checkbox-color="success"
:class="{'mx-2': isMobile}"
color="success"
class="elevation-0 mt-0 flex-fill d-flex flex-column">
<template v-slot:item.action="{ item }">
<v-btn small class="mr-2" :class="tableButton.color" v-for="tableButton of tableButtonList"
@click="doUiAction(tableButton.action, {item})">
{{ tableButton.text }}
<div class="jh-page-body-container px-8">
<!-- 页面内容 >>>>>>>>>>>>> -->
<v-card class="rounded-lg mb-4">
<v-row class="ma-0 py-0 px-4">
<!--新增按钮-->
<v-col cols="12" xs="4" sm="4" md="4" xl="4" class="pl-0">
<v-btn color="success" small class="elevation-0 mr-2"
@click="doUiAction('jumpToCreateWorkflow')">新增</v-btn>
</v-col>
<v-spacer></v-spacer>
<!--搜索-->
<v-col cols="12" xs="8" sm="4" md="3" xl="2" class="px-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 }">
<span role="button" class="success--text jh-font-size-3 pr-2"
@click="doUiAction('startCreateWorkflow', {formItemList: item.formItemList, group: item.name})">
<v-icon size="14" class="success--text">mdi-note-edit-outline</v-icon>申请
</span>
</template>
<!--表格底部右侧功能按钮-->
<template v-slot:footer.prepend>
<v-btn icon @click="doUiAction('openTableZebraLineMenu', $event)">
<v-icon>mdi-menu</v-icon>
</v-btn>
<v-menu top offset-y :close-on-content-click="false" v-model="isTableZebraLineMenuShown" :position-x="tableZebraLineMenuPosition.x" :position-y="tableZebraLineMenuPosition.y">
<v-list>
<v-list-item>
<v-switch v-model="isTableZebraLineShown" hide-details class="ma-0" label="显示斑马纹" dense flat></v-switch>
</v-list-item>
</v-list>
</v-menu>
</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>
<!-- <<<<<<<<<<<<< 创建审批抽屉 -->
<v-navigation-drawer v-model="isCreateDrawerShown" :permanent="isCreateDrawerShown" fixed temporary right width="80%"
class="elevation-24">
<v-form v-if="isCreateDrawerShown" ref="createForm" lazy-validation>
<!--抽屉标题-->
<v-row>
<span class="title pa-6 pl-8">创建审批</span>
</v-row>
<!--抽屉表单主体-->
<v-row class="mt-0 px-6">
<v-col cols="12" sm="12" md="4" v-for="(item, index) in createFormList" :key="index">
<form-item :form-item="item"></form-item>
</v-col>
<v-col cols="12" sm="12" md="4">
<span class="jh-input-label">附件</span>
xxx
</v-col>
<v-col cols="12" sm="12" md="12">
<span class="jh-input-label">审批流程 - 添加审批人</span>
<v-row v-for="item in workflowPersonList">
<v-col cols="2">
<v-text-field class="cus-v-input " dense filled single-line v-model="item.label" disabled></v-text-field>
</v-col>
<v-col cols="4">
<v-autocomplete
class="cus-v-input mr-2"
dense filled single-line clearable
:items="userList"
item-text="username"
item-value="userId"
multiple
:rules="validationRules.requireRules"
v-model="item.assignValue">
</v-autocomplete>
</v-col>
<v-col cols="4">
<v-checkbox dense filled v-model="item.isNeedAllApproval" label="是否需要所有人审批" hide-details ></v-checkbox>
</v-col>
</v-row>
</v-col>
</v-row>
<!--抽屉操作按钮-->
<v-row class="justify-end mx-0 mt-8 px-6">
<v-btn color="success" @click="doUiAction('createWorkflow')" small>保存</v-btn>
<v-btn class="ml-2" @click="isCreateDrawerShown = false" small>取消</v-btn>
</v-row>
</v-form>
<!--抽屉关闭按钮-->
<v-btn elevation="0" color="success" fab absolute top left small tile class="drawer-close-float-btn"
@click="isCreateDrawerShown = false">
<v-icon>mdi-close</v-icon>
</v-btn>
</template>
</v-data-table>
</v-card>
</jh-layout-v3>
</v-navigation-drawer>
<!-- 创建审批抽屉 >>>>>>>>>>>>> -->
<!-- 帮助页抽屉 >>>>>>>>>>>>> -->
<v-navigation-drawer v-model="isHelpPageDrawerShown" fixed temporary right width="80%" hide-overlay
class="elevation-24">
<iframe style="border: 0" :src="`/${appInfo.appId}/pageDoc#workflowManagement.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 vue_body %}
{% block vueScript %}
<!-- 加载页面组件 >>>>>>>>>>>>> -->
{% include 'component/formItem.html' %}
<!-- <<<<<<<<<<<<< 加载页面组件 -->
<script type="module">
new Vue({
el: '#app',
template: '#app-template',
vuetify: new Vuetify(),
data: () => ({
isMobile: window.innerWidth < 600,
searchInput: null,
isTableLoading: true,
tableDataFromBackend: [],
headers: [
{text: "ID", value: "id", width: 120, class: 'fixed', cellClass: 'fixed'},
{text: "流程ID", value: "workflowId", width: 120},
{text: "流程名", value: "workflowName", width: 200},
{text: "分类ID", value: "workflowCategory", width: 120},
{text: "备注", value: "workFlowRemark", width: 120},
{text: "操作者", value: "operationByUser", width: 120},
{text: "操作时间", value: "operationAt", width: 250},
{text: '操作', value: 'action', align: 'center', sortable: false, width: 160, class: 'fixed', cellClass: 'fixed'},
],
tableButtonList: [
{text: '编辑', buttonType: 'edit', color: 'success', action: 'updateItem'},
{text: '删除', buttonType: 'delete', color: 'error', action: 'deleteItem'},
]
}),
async created() {
await this.doUiAction('refreshTableData');
},
mounted() {
},
methods: {
async doUiAction(uiActionId, uiActionData) {
new Vue({
el: '#app',
template: '#app-template',
vueComponent: 'page',
vuetify: new Vuetify(),
data: {
// 面包屑
breadcrumbs: [
{
text: '首页',
disabled: true,
},
{
text: '申请模板',
disabled: true,
}
],
validationRules: {
requireRules: [
v => !!v || 'This is required',
],
},
isTableLoading: false,
userList: [],
tableData: [
{ name: '请假', desc: '正常工作日请假', id: 'leave', icon: 'mdi-calendar-range', color: 'orange darken-2', formItemList: [
{
type: 'single',
typeName: '单选',
statement: '请假类型',
answer: '',
optionList: ['年假', '事假', '病假', '婚假', '产假', '其他']
},
{
type: 'date',
typeName: '时间',
statement: '开始时间',
answer: '',
},
{
type: 'date',
typeName: '时间',
statement: '结束时间',
answer: '',
},
{
type: 'input',
typeName: '文本',
statement: '请假时长',
answer: '',
},
{
type: 'short',
typeName: '文本框',
statement: '请假事由',
answer: '',
},
] },
{ name: '加班', desc: '工作日早晚加班', id: 'overtime', icon: 'mdi-account-clock', color: 'blue darken-2', formItemList: [
{
type: 'date',
typeName: '时间',
statement: '开始时间',
answer: '',
},
{
type: 'date',
typeName: '时间',
statement: '结束时间',
answer: '',
},
{
type: 'input',
typeName: '文本',
statement: '加班时长',
answer: '',
},
{
type: 'short',
typeName: '文本框',
statement: '加班事由',
answer: '',
},
] },
{ name: '出差', desc: '外地往返公干', desc: '外出公干', id: 'businessTrip', icon: 'mdi-airplane-takeoff', color: 'blue darken-2' },
{ name: '补卡', desc: '工作日忘记打卡', id: 'makeUpCard', icon: 'mdi-account-clock', color: 'blue darken-2' },
{ name: '调休', desc: '某节假日紧急工作后调换休息日期', id: 'adjustRest', icon: 'mdi-account-clock', color: 'teal darken-2' },
{ name: '调班', desc: '因个人事务和同事调换工作时间', id: 'adjustClass', icon: 'mdi-account-clock', color: 'blue darken-2' },
],
headers: [
{ text: '操作', value: 'action', align: 'center', sortable: false, width: 120, class: 'fixed', cellClass: 'fixed' },
{ text: '审批名称', value: 'name' },
{ text: '审批名称', value: 'desc' },
],
searchInput: '',
isHelpPageDrawerShown: false,
isTableZebraLineShown: true,
isTableZebraLineMenuShown: false,
tableZebraLineMenuPosition: {x: null, y: null},
isCreateDrawerShown: false,
createFormList: [],
createItem: {
group: '',
},
workflowPersonList: [],
workflowId: '6D7HV6Twfer_xtmbqUsDO'
},
watch: {},
created() {
this.getUserList();
this.getWorkflow();
},
methods: {
async doUiAction(uiActionId, uiActionData) {
switch (uiActionId) {
case 'refreshTableData':
await this.refreshTableData(uiActionData);
case 'getTableData':
await this.getTableData();
break;
case 'createItem':
await this.prepareValidate(uiActionData);
await this.doCreateItem(uiActionData);
case 'openTableZebraLineMenu':
await this.openTableZebraLineMenu(uiActionData);
break;
case 'updateItem':
await this.prepareValidate(uiActionData);
await this.doUpdateItem(uiActionData);
case 'startCreateWorkflow':
await this.prepareCreateFormData(uiActionData);
await this.openCreateDrawer();
break;
case 'deleteItem':
await this.confirmDeleteItemDialog(uiActionData);
await this.doDeleteItem(uiActionData);
await this.refreshTableData(uiActionData);
case 'createWorkflow':
await this.prepareCreateValidate();
await this.confirmCreateWorkDialog();
await this.prepareDoWorkItem();
await this.doCreateWork();
await this.closeCreateDrawer();
break;
case 'jumpToCreateWorkflow':
await this.jumpToCreateWorkflow();
break;
default:
console.error("[doUiAction] uiActionId not find", { uiActionId });
break;
}
},
/**
* 获取表格数据
*/
async refreshTableData() {
this.isTableLoading = true;
const {rows} = (await window.jianghuAxios({
data: {
appData: {
pageId: 'workflowManagement',
actionId: 'selectItemList',
orderBy: [{column: 'operationAt', order: 'desc'}]
},
async getUserList() {
const result = await window.jianghuAxios({
data: {
appData: {
pageId: 'workflowManagement',
actionId: 'selectUserList',
actionData: {},
orderBy: [{ column: 'userId', order: 'asc' }]
}
}
}
})).data.appData.resultData;
for (const item of rows) {
item.workflowConfig = item.workflowConfig ? JSON.parse(item.workflowConfig) : null;
item.workflowForm = item.workflowForm ? JSON.parse(item.workflowForm) : [];
item.operationAt = dayjs(item.operationAt).format('YYYY-MM-DD HH:mm:ss');
}
this.tableDataFromBackend = rows;
this.isTableLoading = false;
},
});
async prepareValidate() {
if(this.isMobile) {
window.vtoast.fail({message: '该功能只能在电脑使用'})
return false;
}
},
// CreateItem
async doCreateItem() {
window.location.href = `/${window.appInfo.appId}/page/workflowEditor`;
},
// UpdateItem
async doUpdateItem({item}) {
sessionStorage.setItem('workflowEditItem', JSON.stringify(item))
window.location.href = `/${window.appInfo.appId}/page/workflowEditor?id=${item.id}`;
},
async confirmDeleteItemDialog() {
if (await window.confirmDialog({title: "删除", content: "确定删除吗?"}) === false) {
throw new Error("[confirmDeleteItemDialog] 否");
}
},
/**
* 删除数据
*/
async doDeleteItem({item}) {
const {id} = item;
await window.vtoast.loading("删除数据");
await window.jianghuAxios({
data: {
appData: {
pageId: 'workflowManagement',
actionId: 'deleteItem',
actionData: {},
where: {id: id}
const userList = result.data.appData.resultData.rows;
this.userList = userList;
},
async getWorkflow() {
const result = await window.jianghuAxios({
data: {
appData: {
pageId: 'workflowManagement',
actionId: 'selectItemList',
where: {workflowId: this.workflowId}
}
}
});
const workflowList = result.data.appData.resultData.rows;
if (!workflowList.length) {
throw new Error('缺少默认流程');
}
});
await window.vtoast.success("删除数据成功");
},
}
})
const workflowNodeList = JSON.parse(workflowList[0].workflowConfig).nodeList;
workflowNodeList.forEach(node => {
node.isNeedAllApproval = true;
});
this.workflowPersonList = workflowNodeList.filter(node => node.id.includes('userTask-'));
},
// ---------- <<<<<<<<<< 斑马纹开关 uiAction --------
async openTableZebraLineMenu(funObj) {
this.tableZebraLineMenuPosition.x = funObj.x -funObj.offsetX + 10;
this.tableZebraLineMenuPosition.y = window.innerHeight - 50;
this.isTableZebraLineMenuShown = !this.isTableZebraLineMenuShown;
},
// ---------- 斑马纹开关 uiAction >>>>>>>>>> --------
// ---------- <<<<<<<<<< 申请项目审核 --------
async prepareCreateFormData({formItemList, group}) {
if (!formItemList) {
await window.confirmDialog({title: "温馨提示", content: "该项目尚未开放"});
throw new Error("formItemList is null");
}
this.createFormList = formItemList;
this.createItem.group = group;
},
async openCreateDrawer() {
this.isCreateDrawerShown = true;
},
async prepareCreateValidate() {
if(!await this.$refs.createForm.validate()) {
throw new Error("请完善表单信息")
}
this.workflowPersonList.forEach(workflowPerson => {
workflowPerson.assignValue = workflowPerson.assignValue || [];
workflowPerson.assignValue = workflowPerson.assignValue.filter(userId => this.userList.find(u => u.userId === userId));
workflowPerson.origin.properties.assignValue = workflowPerson.assignValue;
if (workflowPerson.assignValue.length === 0) {
window.vtoast.fail({ message: `${workflowPerson.label}必填!` });
throw new Error("[prepareValidate] 审批人 false");
}
});
},
async confirmCreateWorkDialog() {
if (await window.confirmDialog({title: "新增", content: "确定新增吗?"}) === false) {
throw new Error("[confirmCreateFormDialog] 否");
}
},
prepareDoWorkItem() {
console.log('create', this.createFormList);
},
async doCreateWork() {
await window.jhMask.show();
await window.jianghuAxios({
data: {
appData: {
pageId: 'workflowManagement',
actionId: 'insertItem',
actionData: {
formItemList: this.createFormList,
group: this.createItem.group,
workflowId: this.workflowId,
workflowConfigCustom: JSON.stringify({ nodeListOfUserTaskNode: this.workflowPersonList })
}
}
}
})
await window.jhMask.hide();
await window.vtoast.success("申请成功");
},
async closeCreateDrawer() {
this.isCreateDrawerShown = false;
},
// ---------- 申请项目审核 >>>>>>>>>> --------
jumpToCreateWorkflow() {
window.location.href = '/<$ ctx.app.config.appId $>/page/workflowEditor';
}
}
})
</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 %}