Files
workflow/app/view/page/taskHistoryManagement.html
T
2022-11-27 01:05:41 +08:00

307 lines
11 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/jhTemplateV3.html'%}
{% block vue_template %}
<jh-layout-v3>
<!-- 页面主要内容 -->
<v-card :class="{'px-2': isMobile}" class="pb-10 mb-10">
<!-- <v-row class="pa-0 ma-0 pt-8" :class="{'px-10': !isMobile, 'px-3': isMobile}">
<v-col cols="12 d-flex align-center" style="justify-content: space-between;">
<template v-for="(item, index) in taskStepperList">
<div>
<div v-for="e in item" class="d-flex align-center ">
<v-icon v-if="e.type === 'history' && e.id !== currentNode.id" color="primary">mdi-check-circle</v-icon>
<v-icon v-else-if="e.id === currentNode.id" color="primary">mdi-send-circle</v-icon>
<v-icon v-else >mdi-circle</v-icon>
{{e.text}}
</div>
</div>
<v-divider class="mx-8" v-if="index < (taskStepperList.length - 1)"></v-divider>
</template>
</v-col>
</v-row> -->
<v-row class="pa-0 ma-0" :class="{'px-10': !isMobile, 'px-3': isMobile}">
<v-col cols="6">
<v-subheader>流程预览</v-subheader>
<process-flow
v-if="taskHistoryConfigList"
:data="taskHistoryConfigList"
:current-node-id="currentNode.id"
readonly
style="height: 450px;border: 1px solid rgb(240, 240, 240); border-radius: 6px;">
</process-flow>
</v-col>
<v-col cols="6" v-if="isAccess">
<v-subheader>表单信息</v-subheader>
<v-row>
<v-col cols="12" class=" pb-3" v-for="(formItem, index) in taskTpl.formList" :key="index"
v-if="taskTpl.input && !(currentNode.formIdHidden || []).includes(formItem.id)">
<span class="inputLabel">{{formItem.component.outline}}</span>
<template v-if="formItem.component.type === 'singleSelect'">
<v-list-item-title class="formItem-title">{{ formTitlePrefix(formItem.component.outline, 'input') }}
</v-list-item-title>
<v-radio-group v-model="taskTpl.input[formItem.id]">
<v-radio hide-details v-for="(option, optionIndex) in formItem.component.property.selectOptionList"
:disabled="!(currentNode.formId || []).includes(formItem.id)"
:key="optionIndex"></v-radio>
</v-radio-group>
</template>
<template v-if="formItem.component.type === 'multipleSelect'">
<v-list-item-title class="formItem-title">{{ formTitlePrefix(formItem.component.outline, 'input') }}
</v-list-item-title>
<div v-for="(option, optionIndex) in formItem.component.property.selectOptionList" :key="optionIndex">
<v-checkbox style="margin-top: 0px;"
:disabled="!(currentNode.formId || []).includes(formItem.id)"
:value="option.value"
v-model="taskTpl.input[formItem.id]" hide-details
color="red"></v-checkbox>
</div>
</template>
<template v-if="formItem.component.type === 'textarea'">
<v-textarea hide-details dense filled single-line placeholder="请输入"
:disabled="!(currentNode.formId || []).includes(formItem.id)"
v-model="taskTpl.input[formItem.id]" :rows="4"/>
</template>
<template v-if="formItem.component.type === 'input'">
<v-text-field class="cus-v-input" placeholder="请输入" dense filled single-line
:disabled="!(currentNode.formId || []).includes(formItem.id)"
v-model="taskTpl.input[formItem.id]"></v-text-field>
</template>
</v-col>
<v-col cols="12" v-if="isAccess">
<span class="inputLabel">备注信息</span>
<v-textarea dense filled single-line placeholder="请输入备注信息" hide-details v-model="editItem.taskComment" color="success"
:disabled="currentNode && currentNode.id && currentNode.id.includes('end-')" :rows="4"/>
</v-col>
<v-col v-if="isAccess" cols="12" style="text-align: center;" class="mb-3">
<v-btn color="success" class="mx-4" v-for="item in nextLineList" @click="doUiAction('submitNode', item.type)">
{{ item.type }}
</v-btn>
</v-col>
</v-row>
</v-col>
</v-row>
<v-row class="pa-0 ma-0" :class="{'px-10': !isMobile, 'px-3': isMobile}">
</v-row>
<v-card-text class="pl-10">
课程流转历史
</v-card-text>
<v-data-table fixed-header dense
:headers="headers"
:items="taskHistoryList"
:items-per-page="-1"
mobile-breakpoint="0"
:loading="isTableLoading"
checkbox-color="success"
:class="{'mx-2': isMobile}"
color="success"
hide-default-footer
class="elevation-0 mx-10 flex-fill d-flex flex-column">
<template v-slot:item.taskCostDuration="{ item }">
{{timeFormat(item.taskCostDuration)}}
</template>
<template v-slot:item.action="{ item }">
<v-btn small class="mr-2" @click="viewInput({item})">
查看
</v-btn>
</template>
</v-data-table>
<v-dialog
v-model="dialog"
max-width="500px"
>
<v-card>
<v-card-title>
<span class="text-h5"></span>
</v-card-title>
<v-card-text>
<v-container>
<v-row>
<v-col cols="12" sm="12" md="12" v-for="(item, index) in editItem.formList" >
<span>{{item.component.outline}}:</span><span>{{editItem.input[item.id]}}</span>
</v-col>
</v-row>
</v-container>
</v-card-text>
</v-card>
</v-dialog>
</v-card>
</jh-layout-v3>
{% endblock %}
{% block vue_body %}
{% include 'component/flow/processFlow.html' %}
{% include 'component/flow/editFlow.html' %}
{% include 'component/flow/editLine.html' %}
{% include 'component/flow/editNode.html' %}
<script type="module">
new Vue({
el: '#app',
template: '#app-template',
vuetify: new Vuetify(),
data: () => ({
isMobile: window.innerWidth < 600,
dialog: false,
isTableLoading: true,
headers: [
{text: "节点", value: "taskExplain", width: 120},
{text: "流转", value: "taskHandleDesc", width: 120},
{text: "操作人", value: "operationByUser", width: 120},
{text: "备注", value: "taskComment", width: 120},
{text: "处理时长/秒", value: "taskCostDuration", width: 120},
{text: "表单明细", value: "action", width: 120},
],
editItem: {},
dialogSaveInfoAction: '',
id: '',
taskId: '',
isAccess: [],
nextLineList: [],
taskHistoryList: [],
taskTpl: [],
taskStepperList: [],
currentNode: {},
taskHistoryConfigList: null
}),
watch: {},
async created() {
const searchParams = new URLSearchParams(location.search.substring(1));
this.id = searchParams.get('id');
this.taskId = searchParams.get('taskId');
await this.getTaskHistoryList()
},
mounted() {
},
methods: {
async doUiAction(uiActionId, uiActionData) {
switch (uiActionId) {
case 'submitNode':
await this.submitNode(uiActionData);
// await this.getTaskHistoryList(uiActionData);
break;
default:
console.error("[doUiAction] uiActionId not find", { uiActionId });
break;
}
},
/**
* 获取表格数据
*/
async getTaskHistoryList() {
this.isTableLoading = true;
const {
data: {
appData: {
resultData: {
taskHistoryList,
taskStepperList,
taskTpl,
isAccess,
nextLineList,
currentNode,
taskHistoryConfigList
}
}
}
} = await window.jianghuAxios({
data: {
appData: {
pageId: 'taskHistoryManagement',
actionId: 'getTaskHistoryInfo',
actionData: {id: this.id},
}
}
});
taskHistoryList.forEach(e => {
e.taskFormInput = JSON.parse(e.taskFormInput);
})
this.taskHistoryList = taskHistoryList;
this.taskTpl = taskTpl;
this.taskStepperList = taskStepperList;
this.currentNode = currentNode;
this.isAccess = isAccess;
this.nextLineList = _.uniqBy(nextLineList, 'type') ;
// 更新操作人到连线
taskHistoryConfigList.lineList.map(line => {
let operationByUser = (taskHistoryList.find(taskHistory => taskHistory.taskConfigId == line.from && taskHistory.taskLineTo == line.to) || {}).operationByUser;
line.origin.text.value = `${operationByUser}-${line.label}`;
});
this.taskHistoryConfigList = taskHistoryConfigList;
this.isTableLoading = false;
},
/**
* 新增数据
*/
async submitNode(type) {
await window.vtoast.loading("提交数据");
await window.jianghuAxios({
data: {
appData: {
pageId: 'taskHistoryManagement',
actionId: 'submitNode',
actionData: {type, id: this.id, taskId: this.taskId, taskComment: this.editItem.taskComment, taskTpl: this.taskTpl}
}
}
})
await window.vtoast.success("提交数据成功");
setTimeout(function() {
if (document.referrer) {
location.href = document.referrer;
} else {
history.back();
}
}, 1000);
},
formTitlePrefix(title, type) {
if (type === 'prev') {
return '历史-' + title;
}
return title;
},
viewInput({item}) {
this.editItem = item.taskFormInput;
this.dialog = true;
},
timeFormat(time) {
if (time == 0) {
return ''
} else if (time < 60) {
return time + ' 秒';
} else if (time < 3600) {
const s = time % 60;
return parseInt(time / 60) + ' 分' + s + ' 秒';
} else if (time < 86400) {
const m = time % 3600;
return parseInt(time / 3600) + ' 小时' + parseInt(m / 60) + ' 分';
} else {
const m = time % 86400;
return parseInt(time / 86400) + ' 天' + parseInt(m / 3600) + ' 小时';
}
}
}
})
</script>
<style scoped>
.v-data-table--dense>.v-data-table__wrapper>table>tbody>tr>td, .v-data-table--dense>.v-data-table__wrapper>table>tbody>tr>th, .v-data-table--dense>.v-data-table__wrapper>table>tfoot>tr>td, .v-data-table--dense>.v-data-table__wrapper>table>tfoot>tr>th, .v-data-table--dense>.v-data-table__wrapper>table>thead>tr>td, .v-data-table--dense>.v-data-table__wrapper>table>thead>tr>th {
height: 32px;
}
</style>
{% endblock %}