review todo.html

This commit is contained in:
yuebenshan committed 2023-02-14 17:02:19 +08:00
1 parent 14cfbf118d
commit 744c55bbf8
1 file changed
+318 -355
+318 -355
View File
@@ -3,201 +3,179 @@
{% block vueTemplate %} {% block vueTemplate %}
<script type="text/html" id="app-template"> <script type="text/html" id="app-template">
<div> <div>
<v-app mobile-breakpoint="sm"> <v-app mobile-breakpoint="sm">
<jh-menu /> <jh-menu />
<v-main class="mt-15"> <v-main class="mt-15">
<!-- 头部内容 >>>>>>>>>>>>> --> <!-- 头部内容 >>>>>>>>>>>>> -->
<div class="jh-page-second-bar px-8"> <div class="jh-page-second-bar px-8">
<div class="pt-3 text-h7 font-weight-bold">我的任务 <div class="pt-3 text-h7 font-weight-bold">我的任务
<!-- 帮助页按钮 --> <!-- 帮助页按钮 -->
<v-icon @click="isHelpPageDrawerShown = true" color="success" small>mdi-help-circle-outline</v-icon> <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>
<!-- <<<<<<<<<<<<< 头部内容 --> <v-breadcrumbs class="pb-3 pt-0 px-0" :items="breadcrumbs" divider="-"></v-breadcrumbs>
</div>
<!-- <<<<<<<<<<<<< 头部内容 -->
<div class="jh-page-body-container px-8"> <div class="jh-page-body-container px-8">
<!-- 页面内容 >>>>>>>>>>>>> --> <!-- 页面内容 >>>>>>>>>>>>> -->
<v-card class="rounded-lg"> <v-card class="rounded-lg">
<v-row class="ma-0 pa-4"> <v-row class="ma-0 pa-4">
<v-spacer></v-spacer> <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-col cols="12" xs="4" sm="4" md="4" xl="4" class="pa-0 pr-2 d-flex justify-end">
<v-btn-toggle <v-btn-toggle
v-model="workflowType" v-model="workflowType"
borderless borderless
color="success" color="success"
> >
<v-btn value="todo" small class="jh-backend-search-btn"> <v-btn value="todo" small class="jh-backend-search-btn">
<v-badge <v-badge v-if="tableData.length" inline :content="tableData.length" color="warning">
v-if="tableData.length" <span class="">待处理</span>
inline </v-badge>
:content="tableData.length" <span v-else class="">待处理</span>
color="warning" </v-btn>
> <v-btn value="history" small class="jh-backend-search-btn">
<span class="">待处理</span> <v-badge v-if="historyData.length" inline :content="historyData.length" color="grey darken-3">
</v-badge> <span class="">已处理</span>
<span v-else 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="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)">
<v-icon size="14" class="success--text">mdi-text-box-outline</v-icon>
查看
</span>
</template>
<!--表格底部右侧功能按钮-->
<template v-slot:footer.prepend>
<v-menu top offset-y :close-on-content-click="false">
<template v-slot:activator="{on, attrs}">
<v-btn icon v-bind="attrs" v-on="on">
<v-icon>mdi-menu</v-icon>
</v-btn> </v-btn>
<v-btn value="history" small class="jh-backend-search-btn"> </template>
<v-badge <v-switch v-model="isTableZebraLineShown" hide-details class="mx-3 my-2" label="显示斑马纹" dense flat></v-switch>
v-if="historyData.length" </v-menu>
inline </template>
:content="historyData.length" <!--没有数据-->
color="grey darken-3" <template v-slot:loading>
> <div class="jh-no-data">数据加载中</div>
<span class="">已处理</span> </template>
</v-badge> <template v-slot:no-data>
<span v-else class="">已处理</span> <div class="jh-no-data">暂无数据</div>
</v-btn> </template>
</v-btn-toggle> <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="isSubmitDrawerShown" v-click-outside="drawerClickOutside" fixed temporary right 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="4" v-for="(formItem, index) in updateItem.taskFormInput.formList" :key="index">
<form-item :form-item="formItem" readonly></form-item>
</v-col> </v-col>
<!--搜索--> <v-col cols="12" sm="12" md="12">
<v-col cols="12" xs="8" sm="4" md="3" xl="2" class="pa-0"> <span class="jh-input-label">备注</span>
<v-text-field v-model="searchInput" color="success" prefix="搜索:" class="jh-v-input" dense filled hide-details <v-textarea
single-line></v-text-field> class="jh-v-input" no-resize dense single-line filled
v-model="updateItem.taskComment" :readonly="workflowType != 'todo'"></v-textarea>
</v-col> </v-col>
</v-row> </v-row>
<!--表格--> <!--抽屉操作按钮-->
<v-data-table <v-row class="justify-end mx-0 mt-8 px-6">
:headers="headers" <v-btn color="success" small class="ml-4" v-for="lineTypeItem in lineTypeList" v-if="lineTypeItem.type" @click="doUiAction('submitNode', lineTypeItem.type)">
:items="tableDataList" {{ lineTypeItem.type }}
:search="searchInput" </v-btn>
:footer-props="{ itemsPerPageOptions: [20, 50, -1], itemsPerPageText: '每页行数', itemsPerPageAllText: '所有'}" </v-row>
:items-per-page="-1" <v-row class="mt-0 px-6">
mobile-breakpoint="0" <v-col cols="12" sm="12" md="12">
:loading="isTableLoading" <span class="jh-input-label">审核历史</span>
:class="{'zebraLine': isTableZebraLineShown }" <task-history :task-id="updateItem.taskId" @line-type-list="setLineTypeList"></task-history>
checkbox-color="success" </v-col>
fixed-header </v-row>
class="jh-fixed-table-height elevation-0 mt-0 mb-xs-4"> </v-form>
<template v-slot:item.taskTitle="{ item }">
<span>{{item.taskTitle}}</span>
<span v-if="workflowType != 'todo'">
<v-chip
v-if="item.taskHandleDesc === '拒绝'"
color="red"
small
dark
>
已{{item.taskHandleDesc}}
</v-chip>
<v-chip
v-else
color="green"
small
dark
>
已{{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)">
<v-icon size="14" class="success--text">mdi-text-box-outline</v-icon>
查看
</span>
</template>
<!--表格底部右侧功能按钮-->
<template v-slot:footer.prepend>
<v-menu top offset-y :close-on-content-click="false">
<template v-slot:activator="{on, attrs}">
<v-btn icon v-bind="attrs" v-on="on">
<v-icon>mdi-menu</v-icon>
</v-btn>
</template>
<v-switch v-model="isTableZebraLineShown" hide-details class="mx-3 my-2" label="显示斑马纹" dense flat></v-switch>
</v-menu>
</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="isSubmitDrawerShown" v-click-outside="drawerClickOutside" fixed temporary right 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="4" v-for="(item, index) in updateItem.taskFormInput.formList" :key="index">
<form-item :form-item="item" readonly></form-item>
</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
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" v-click-outside="drawerClickOutside" fixed temporary right width="80%"
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" <v-btn elevation="0" color="success" fab absolute top left small tile class="drawer-close-float-btn"
@click="isHelpPageDrawerShown = false"> @click="isSubmitDrawerShown = false">
<v-icon>mdi-close</v-icon> <v-icon>mdi-close</v-icon>
</v-btn> </v-btn>
</v-navigation-drawer> </v-navigation-drawer>
<!-- <<<<<<<<<<<<< 帮助页抽屉 --> </div>
</v-main> <!-- 帮助页抽屉 >>>>>>>>>>>>> -->
</v-app> <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#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>
<!-- <<<<<<<<<<<<< 帮助页抽屉 -->
<jh-toast /> </v-main>
<jh-mask /> </v-app>
<jh-confirm-dialog />
</div> <jh-toast />
<jh-mask />
<jh-confirm-dialog />
</div>
</script> </script>
<div id="app"> <div id="app">
@@ -214,189 +192,174 @@
<!-- <<<<<<<<<<<<< 加载页面组件 --> <!-- <<<<<<<<<<<<< 加载页面组件 -->
<script type="module"> <script type="module">
new Vue({ new Vue({
el: '#app', el: '#app',
template: '#app-template', template: '#app-template',
vueComponent: 'page', vueComponent: 'page',
vuetify: new Vuetify(), vuetify: new Vuetify(),
data: { data: {
// 面包屑 // 面包屑
breadcrumbs: [ breadcrumbs: [
{ {text: '首页', disabled: true,},
text: '首页', {text: '待办、已处理的任务', disabled: true,}
disabled: true, ],
}, isHelpPageDrawerShown: false,
{
text: '待办、已处理的任务', // 表格相关数据
disabled: true, isTableZebraLineShown: true,
} // 生日日期选择
validationRules: {
requireRules: [
v => !!v || 'This is required',
], ],
isHelpPageDrawerShown: false, },
searchInput: null,
isTableLoading: true,
tableData: [],
historyData: [],
headers: [
{text: '操作', value: 'action', align: 'center', sortable: false, width: 80, class: 'fixed', cellClass: 'fixed'},
{text: "审批项", value: "taskTitle"},
{text: "操作者", value: "operationByUser", width: 120},
{text: "操作时间", value: "operationAt", width: 250}
],
// 表格相关数据 isSubmitDrawerShown: false,
isTableZebraLineShown: true, updateItem: {},
// 生日日期选择 workflowType: 'todo', // todo, history
validationRules: { lineTypeList: [],
requireRules: [ userId: '<$ ctx.userInfo.userId $>'
v => !!v || 'This is required', },
], // 计算
}, computed: {
searchInput: null, tableDataList() {
isTableLoading: true, return this.workflowType === 'todo' ? this.tableData : this.historyData;
tableData: [], },
historyData: [], },
headers: [ watch: {},
{ text: '操作', value: 'action', align: 'center', sortable: false, width: 120, class: 'fixed', cellClass: 'fixed' }, mounted() {
{ text: "审批项", value: "taskTitle" }, this.doUiAction('getTableData');
{ text: "操作者", value: "operationByUser", width: 120 }, this.doUiAction('getHistoryData');
{ text: "操作时间", value: "operationAt", width: 250 } },
], 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 'startUpdateItem':
await this.prepareUpdateFormData(uiActionData);
await this.openUpdateDrawer();
break;
case 'submitNode':
await this.confirmSubmitDialog();
await this.submitForReview(uiActionData);
await this.closeSubmitDrawer();
await this.clearSubmitData();
this.getTableData();
this.getHistoryData();
break;
default:
console.error("[doUiAction] uiActionId not find", {uiActionId});
break;
}
},
isSubmitDrawerShown: false, async getTableData() {
updateItem: {}, this.isTableLoading = true;
workflowType: 'todo', // todo, history const result = await window.jianghuAxios({
lineTypeList: [], data: {
userId: '<$ ctx.userInfo.userId $>' appData: {
}, pageId: 'todo',
// 计算 actionId: 'selectItemList',
computed: { actionData: {},
tableDataList() { where: {taskStatus: 'running'},
return this.workflowType === 'todo' ? this.tableData : this.historyData; whereLike: {taskEditUserList: this.userId},
}, orderBy: [{column: 'operationAt', order: 'desc'}]
}, }
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 '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() { const rows = result.data.appData.resultData.rows;
this.isTableLoading = true; rows.forEach(row => {
const result = await window.jianghuAxios({ row.taskFormInput = JSON.parse(row.taskFormInput);
data: { row.operationAt = dayjs(row.operationAt).format('YYYY-MM-DD HH:mm:ss');
appData: { });
pageId: 'todo', this.tableData = rows.filter(item => !item.taskEditedUserList || !item.taskEditedUserList.includes(this.userId));
actionId: 'selectItemList', this.isTableLoading = false;
actionData: {}, },
where: {taskStatus: 'running'}, async getHistoryData() {
whereLike: {taskEditUserList: this.userId}, this.isTableLoading = true;
orderBy: [{ column: 'operationAt', order: 'desc' }] 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.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 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() { const rows = result.data.appData.resultData.rows;
this.updateItem = {}; rows.forEach(row => {
}, row.taskFormInput = JSON.parse(row.taskFormInput);
async submitForReview(type) { row.operationAt = dayjs(row.operationAt).format('YYYY-MM-DD HH:mm:ss');
await window.vtoast.loading("提交审核"); });
await window.jianghuAxios({ this.historyData = rows;
data: { },
appData: { // ---------- 审核、查看 uiAction >>>>>>>>>>>> --------
pageId: 'todo', async prepareUpdateFormData(funObj) {
actionId: 'submitNode', this.updateItem = _.cloneDeep(funObj);
actionData: {type, id: this.updateItem.id, taskId: this.updateItem.taskId, taskComment: this.updateItem.taskComment} this.updateItem.taskHistoryList = []; // 审核历史
} this.updateItem.taskComment = ''; // 备注
this.lineTypeList = []; // 所有操作按钮
},
async closeSubmitDrawer() {
this.isSubmitDrawerShown = false;
},
async openUpdateDrawer() {
this.isSubmitDrawerShown = true;
},
async confirmSubmitDialog() {
if (await window.confirmDialog({title: "审核", content: "确定提交审核吗?"}) === false) {
throw new Error("[confirmSubmitDialog] 否");
}
},
async clearSubmitData() {
this.updateItem = {};
},
async submitForReview(lineType) {
await window.vtoast.loading("提交审核");
await window.jianghuAxios({
data: {
appData: {
pageId: 'todo',
actionId: 'submitNode',
actionData: {type: lineType, id: this.updateItem.id, taskId: this.updateItem.taskId, taskComment: this.updateItem.taskComment}
} }
}) }
await window.vtoast.success("提交审核成功"); })
setTimeout(()=> { await window.vtoast.success("提交审核成功");
this.$emit('close-detail-drawer') },
// if (document.referrer) { setLineTypeList(lineTypeList) {
// location.href = document.referrer; this.lineTypeList = _.uniqBy((lineTypeList || '').split(",").map(lineType => ({type: lineType, label: lineType})), 'type');
// } else { },
// history.back(); // ---------- <<<<<<<<<<< 审核、查看 uiAction --------
// } }
}, 1000); })
},
setLineTypeList(lineTypeList) {
this.lineTypeList = _.uniqBy((lineTypeList||'').split(",").map(lineType => ({type: lineType, label: lineType})), 'type');
},
// ---------- <<<<<<<<<<< 审核、查看 uiAction --------
}
})
</script> </script>
<style scoped> <style scoped>