清除page
This commit is contained in:
1 parent
7062befd9f
commit
2df502146e
5 files changed
-1178
No files matched your search
@@ -1,240 +0,0 @@
|
|||||||
{% extends 'template/jhTemplateV3.html'%}
|
|
||||||
|
|
||||||
{% block vue_template %}
|
|
||||||
|
|
||||||
<jh-layout-v3>
|
|
||||||
<template slot="serverSearch">
|
|
||||||
<v-row class="ma-0 align-center" :class="{'pa-0': isMobile, 'pa-2': !isMobile}" style="justify-content: end">
|
|
||||||
<v-col cols="12" sm="12" xs="5" md="3" xl="2" class="pb-3" :class="{'pl-0': isMobile, 'pt-0': isMobile}">
|
|
||||||
<v-text-field v-model="serverSearchInput.workflowName" color="success" prefix="流程名称:" class="cus-v-input" :class="{'mr-2': !isMobile}" dense filled single-line></v-text-field>
|
|
||||||
</v-col>
|
|
||||||
<v-col class="pl-0 pr-0" :class="{'pt-0': isMobile}" style="max-width: 57px">
|
|
||||||
<v-btn
|
|
||||||
class="elevation-0"
|
|
||||||
color="success"
|
|
||||||
dark
|
|
||||||
@click="doUiAction('refreshTableData')"
|
|
||||||
>
|
|
||||||
查询
|
|
||||||
</v-btn>
|
|
||||||
</v-col>
|
|
||||||
</v-row>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<!-- 页面主要内容 -->
|
|
||||||
<v-card :class="{'px-2': isMobile}">
|
|
||||||
<v-data-table
|
|
||||||
: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 color="success" class="mr-2" @click="doUiAction('startCreateItem', {item: item})">
|
|
||||||
申请
|
|
||||||
</v-btn>
|
|
||||||
</template>
|
|
||||||
</v-data-table>
|
|
||||||
</v-card>
|
|
||||||
|
|
||||||
<!-- 编辑抽屉 -->
|
|
||||||
<v-navigation-drawer v-model="isEditDrawerShow" :permanent="isEditDrawerShow" fixed temporary right width="40%"
|
|
||||||
class="elevation-24">
|
|
||||||
<v-form v-model="isFormValid" v-if="isEditDrawerShow" ref="form" lazy-validation>
|
|
||||||
<v-row class="pt-8">
|
|
||||||
<span class="title pa-6" :class="{'pl-12': !isMobile, 'pl-6': isMobile}">{{ currentClickButton.title }}信息</span>
|
|
||||||
<v-spacer></v-spacer>
|
|
||||||
<v-btn class="mt-6 elevation-0" :class="{'mr-16': !isMobile, 'mr-8': isMobile}" fab x-small @click="isEditDrawerShow = false">
|
|
||||||
<v-icon dark>mdi-close</v-icon>
|
|
||||||
</v-btn>
|
|
||||||
</v-row>
|
|
||||||
<v-row :class="{'px-10': !isMobile, 'px-3': isMobile, 'pb-7': isMobile}">
|
|
||||||
|
|
||||||
<v-col cols="12" sm="12" md="12" :class="{'pa-0': isMobile, 'px-3': isMobile, 'pt-6': isMobile}">
|
|
||||||
<span class="inputLabel">课程标题</span>
|
|
||||||
<v-text-field class="cus-v-input mr-2" dense filled single-line label="课程标题" v-model="editItem['taskTitle']">
|
|
||||||
</v-text-field>
|
|
||||||
</v-col>
|
|
||||||
|
|
||||||
<v-col cols="12" class=" pb-3" v-for="(formItem, index) in editItem.workflowForm" :key="index">
|
|
||||||
<span class="inputLabel">{{ index+1 }}、 {{ formItem.component.outline }}</span>
|
|
||||||
<v-list-item-content v-if="formItem.component.type === 'singleSelect'">
|
|
||||||
<v-radio-group row v-model="editItem.workflowFormData[formItem.id]" hide-details>
|
|
||||||
<v-radio v-for="(option, optionIndex) in formItem.component.property.selectOptionList"
|
|
||||||
:key="optionIndex" :label="option.value"></v-radio>
|
|
||||||
</v-radio-group>
|
|
||||||
</v-list-item-content>
|
|
||||||
|
|
||||||
<v-list-item-content v-if="formItem.component.type === 'multipleSelect'">
|
|
||||||
<div v-for="(option, optionIndex) in formItem.component.property.selectOptionList" :key="optionIndex">
|
|
||||||
<v-checkbox style="margin-top: 0px;" :label="option.value" :value="option.value" v-model="editItem.workflowFormData[formItem.id]" hide-details color="red"></v-checkbox>
|
|
||||||
</div>
|
|
||||||
</v-list-item-content>
|
|
||||||
|
|
||||||
<v-list-item-content v-if="formItem.component.type === 'textarea'">
|
|
||||||
<v-textarea hide-details dense filled single-line placeholder="请输入" :rules="requireRules" :label="(index+1) + '. ' + formItem.component.outline" v-model="editItem.workflowFormData[formItem.id]" :rows="4"/>
|
|
||||||
</v-list-item-content>
|
|
||||||
|
|
||||||
<v-list-item-content v-if="formItem.component.type === 'input'">
|
|
||||||
<v-text-field class="cus-v-input mr-2" dense filled single-line placeholder="请输入" :rules="requireRules" :label="(index+1) + '. ' + formItem.component.outline" v-model="editItem.workflowFormData[formItem.id]" ></v-text-field>
|
|
||||||
</v-list-item-content>
|
|
||||||
</v-col>
|
|
||||||
</v-row>
|
|
||||||
<v-row class="justify-end mx-0 mt-8" :class="{'px-10': !isMobile, 'px-4': isMobile, 'mb-8': isMobile}">
|
|
||||||
<v-btn color="success" @click="doUiAction(dialogSaveInfoAction)"
|
|
||||||
>保存
|
|
||||||
</v-btn>
|
|
||||||
<v-btn class="elevation-0 ml-2" @click="isEditDrawerShow = false">取消</v-btn>
|
|
||||||
</v-row>
|
|
||||||
</v-form>
|
|
||||||
</v-navigation-drawer>
|
|
||||||
</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,
|
|
||||||
// 表格相关数据
|
|
||||||
isFormValid: true,
|
|
||||||
requireRules: [
|
|
||||||
v => !!v || 'This is required',
|
|
||||||
],
|
|
||||||
serverSearchInput: {
|
|
||||||
workflowName: null
|
|
||||||
},
|
|
||||||
isEditDrawerShow: false,
|
|
||||||
searchInput: null,
|
|
||||||
isTableLoading: true,
|
|
||||||
tableDataFromBackend: [],
|
|
||||||
headers: [
|
|
||||||
{ text: "ID", value: "id", width: 100, class: 'fixed', cellClass: 'fixed' },
|
|
||||||
{ text: "课程ID", value: "workflowId", width: 120 },
|
|
||||||
{ text: "课程名称", value: "workflowName", width: 150 },
|
|
||||||
{ 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: 200, class: 'fixed', cellClass: 'fixed' },
|
|
||||||
],
|
|
||||||
currentClickButton: { title: '新增', action: 'add' },
|
|
||||||
editItem: {},
|
|
||||||
dialogSaveInfoAction: ''
|
|
||||||
}),
|
|
||||||
async created() {
|
|
||||||
await this.doUiAction('refreshTableData');
|
|
||||||
},
|
|
||||||
mounted() { },
|
|
||||||
methods: {
|
|
||||||
async doUiAction(uiActionId, uiActionData) {
|
|
||||||
switch (uiActionId) {
|
|
||||||
case 'refreshTableData':
|
|
||||||
await this.refreshTableData(uiActionData);
|
|
||||||
break;
|
|
||||||
case 'startCreateItem':
|
|
||||||
await this.preprocessItemData(uiActionData);
|
|
||||||
await this.openCreateItemDialog(uiActionData);
|
|
||||||
break;
|
|
||||||
case 'createItem':
|
|
||||||
await this.confirmCreateItemDialog(uiActionData);
|
|
||||||
await this.doCreateItem(uiActionData);
|
|
||||||
await this.refreshTableData(uiActionData);
|
|
||||||
await this.closeDrawerShow(uiActionData);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
console.error("[doAction] uiActionId not find", { uiActionId });
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* 获取表格数据
|
|
||||||
*/
|
|
||||||
async refreshTableData() {
|
|
||||||
this.isTableLoading = true;
|
|
||||||
const serverSearchInput = _.pickBy(this.serverSearchInput, value => !!value);
|
|
||||||
const {rows} = (await window.jianghuAxios({
|
|
||||||
data: {
|
|
||||||
appData: {
|
|
||||||
pageId: 'taskCreateManagement',
|
|
||||||
actionId: 'selectWorkflowList',
|
|
||||||
actionData: {},
|
|
||||||
where: {},
|
|
||||||
whereLike: serverSearchInput,
|
|
||||||
orderBy: [{ column: 'operationAt', order: 'desc' }]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})).data.appData.resultData;
|
|
||||||
rows.forEach(row => {
|
|
||||||
if(row.workflowConfig) {
|
|
||||||
row.workflowConfig = JSON.parse(row.workflowConfig).nodeList.map(item => [item.label, item.lineTypeList]);
|
|
||||||
row.workflowForm = JSON.parse(row.workflowForm || '[]');
|
|
||||||
}
|
|
||||||
row.operationAt = dayjs(row.operationAt).format('YYYY-MM-DD HH:mm:ss');
|
|
||||||
})
|
|
||||||
this.tableDataFromBackend = rows;
|
|
||||||
this.isTableLoading = false;
|
|
||||||
},
|
|
||||||
|
|
||||||
preprocessItemData({item: { workflowForm, workflowConfig, workflowId }}) {
|
|
||||||
const workflowFormData = {};
|
|
||||||
workflowForm.forEach(e => {
|
|
||||||
workflowFormData[e.id] = '';
|
|
||||||
if (e.component.type === 'multipleSelect') {
|
|
||||||
workflowFormData[e.id] = [];
|
|
||||||
}
|
|
||||||
})
|
|
||||||
this.editItem = {workflowForm, workflowFormData, workflowId};
|
|
||||||
},
|
|
||||||
|
|
||||||
async openCreateItemDialog() {
|
|
||||||
this.currentClickButton = { action: 'add', title: '新增' };
|
|
||||||
this.isEditDrawerShow = true;
|
|
||||||
this.dialogSaveInfoAction = 'createItem';
|
|
||||||
},
|
|
||||||
|
|
||||||
async confirmCreateItemDialog() {
|
|
||||||
if (await window.confirmDialog({title: "新增", content: "确定新增吗?"}) === false) {
|
|
||||||
throw new Error("[confirmCreateFormDialog] 否");
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增数据
|
|
||||||
*/
|
|
||||||
async doCreateItem() {
|
|
||||||
delete this.editItem.id;
|
|
||||||
await window.vtoast.loading("新增数据");
|
|
||||||
await window.jianghuAxios({
|
|
||||||
data: {
|
|
||||||
appData: {
|
|
||||||
pageId: 'taskCreateManagement',
|
|
||||||
actionId: 'insertItem',
|
|
||||||
actionData: this.editItem
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
await window.vtoast.success("新增数据成功");
|
|
||||||
},
|
|
||||||
|
|
||||||
async closeDrawerShow() {
|
|
||||||
this.isEditDrawerShow = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
</style>
|
|
||||||
{% endblock %}
|
|
||||||
@@ -1,306 +0,0 @@
|
|||||||
{% 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 && (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 %}
|
|
||||||
@@ -1,127 +0,0 @@
|
|||||||
{% 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="4" sm="4" md="4" xl="4" class="pl-0">
|
|
||||||
<span class="body-2">共{{ tableDataFromBackend.length }}条记录</span>
|
|
||||||
</v-col>
|
|
||||||
<v-spacer></v-spacer>
|
|
||||||
<v-col cols="12" xs="8" 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
|
|
||||||
: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 color="success" class="mr-2" @click="doUiAction('toTaskHistory', {item})">
|
|
||||||
查看
|
|
||||||
</v-btn>
|
|
||||||
</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,
|
|
||||||
// 表格相关数据
|
|
||||||
requireRules: [
|
|
||||||
v => !!v || 'This is required',
|
|
||||||
],
|
|
||||||
currentTableGenderType: 'all',
|
|
||||||
searchInput: null,
|
|
||||||
isTableLoading: true,
|
|
||||||
tableDataFromBackend: [],
|
|
||||||
headers: [
|
|
||||||
{text: "ID", value: "id", width: 120, class: 'fixed', cellClass: 'fixed'},
|
|
||||||
{text: "课程ID", value: "taskId", width: 120},
|
|
||||||
{text: "课程名称", value: "taskTitle", width: 120},
|
|
||||||
{text: "课程状态", value: "taskStatus", width: 120},
|
|
||||||
{text: "当前节点ID", value: "taskConfigId", width: 200},
|
|
||||||
{text: "申请人", value: "taskInitUser", width: 120},
|
|
||||||
{text: "处理人员", value: "taskEditUserList", width: 120},
|
|
||||||
{text: "所有相关人员,用逗号分隔", value: "taskViewUserList", width: 120},
|
|
||||||
{text: "课程创建人", value: "createByUser", width: 120},
|
|
||||||
{text: "操作者", value: "operationByUser", width: 120},
|
|
||||||
{text: "操作时间", value: "operationAt", width: 250},
|
|
||||||
{text: '操作', value: 'action', align: 'center', sortable: false, width: 120, class: 'fixed', cellClass: 'fixed'},
|
|
||||||
],
|
|
||||||
}),
|
|
||||||
watch: {},
|
|
||||||
async created() {
|
|
||||||
await this.doUiAction('refreshTableData');
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
async doUiAction(uiActionId, uiActionData) {
|
|
||||||
switch (uiActionId) {
|
|
||||||
case 'refreshTableData':
|
|
||||||
await this.refreshTableData(uiActionData);
|
|
||||||
break;
|
|
||||||
case 'toTaskHistory':
|
|
||||||
await this.toTaskHistory(uiActionData);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
console.error("[doAction] uiActionId not find", { uiActionId });
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* 获取表格数据
|
|
||||||
*/
|
|
||||||
async refreshTableData() {
|
|
||||||
this.isTableLoading = true;
|
|
||||||
const {rows} = (await window.jianghuAxios({
|
|
||||||
data: {
|
|
||||||
appData: {
|
|
||||||
pageId: 'taskICreateManagement',
|
|
||||||
actionId: 'selectItemList',
|
|
||||||
actionData: {},
|
|
||||||
where: {},
|
|
||||||
orderBy: [{column: 'operationAt', order: 'desc'}]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})).data.appData.resultData;
|
|
||||||
|
|
||||||
rows.forEach(row => {
|
|
||||||
row.operationAt = dayjs(row.operationAt).format('YYYY-MM-DD HH:mm:ss');
|
|
||||||
})
|
|
||||||
this.tableDataFromBackend = rows;
|
|
||||||
this.isTableLoading = false;
|
|
||||||
},
|
|
||||||
|
|
||||||
toTaskHistory({item}) {
|
|
||||||
location.href = `/${window.appInfo.appId}/page/taskHistoryManagement?id=${item.id}&taskId=${item.taskId}`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
</style>
|
|
||||||
{% endblock %}
|
|
||||||
@@ -1,318 +0,0 @@
|
|||||||
{% extends 'template/jhTemplateV3.html'%}
|
|
||||||
|
|
||||||
{% block vue_template %}
|
|
||||||
<jh-layout-v3>
|
|
||||||
|
|
||||||
<template slot="serverSearch">
|
|
||||||
<div class="mt-4" style="text-align: right;">
|
|
||||||
<v-btn color="success" @click="doUiAction(dialogSaveInfoAction)" style="height: 40px">
|
|
||||||
保存
|
|
||||||
</v-btn>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template slot-scope="props">
|
|
||||||
<v-card class="" :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-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 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>
|
|
||||||
<tpl-form-design :form="editItem.workflowForm" v-if="!loading">
|
|
||||||
</tpl-form-design> -->
|
|
||||||
|
|
||||||
<div class="pt-4 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"
|
|
||||||
:mode="editItem.mode">
|
|
||||||
</process-flow>
|
|
||||||
|
|
||||||
<v-overlay :value="loading" absolute>
|
|
||||||
<v-progress-circular
|
|
||||||
indeterminate
|
|
||||||
size="64"
|
|
||||||
></v-progress-circular>
|
|
||||||
</v-overlay>
|
|
||||||
</template>
|
|
||||||
</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' %}
|
|
||||||
{% include 'component/tpl/tplFormDesign.html' %}
|
|
||||||
{% include 'component/tpl/formItemListGenerator.html' %}
|
|
||||||
{% include 'component/tpl/formItemListRender.html' %}
|
|
||||||
|
|
||||||
<script type="module">
|
|
||||||
new Vue({
|
|
||||||
el: '#app',
|
|
||||||
template: '#app-template',
|
|
||||||
vuetify: new Vuetify(),
|
|
||||||
data: () => ({
|
|
||||||
requireRules: [
|
|
||||||
v => !!v || '必填',
|
|
||||||
],
|
|
||||||
constantCollection: {
|
|
||||||
userList: [],
|
|
||||||
groupList: [],
|
|
||||||
workflowFormList: [],
|
|
||||||
modeList: [
|
|
||||||
{ text: '串行', value: 'serial'},
|
|
||||||
{ text: '并行', value: 'parallel'},
|
|
||||||
]
|
|
||||||
},
|
|
||||||
editItem: {},
|
|
||||||
dialogSaveInfoAction: 'createItem',
|
|
||||||
loading: false,
|
|
||||||
}),
|
|
||||||
watch: {
|
|
||||||
'editItem.workflowForm': {
|
|
||||||
handler(val) {
|
|
||||||
if (!val) return
|
|
||||||
this.buildWorkflowFormList(val);
|
|
||||||
if (!this.editItem.workflowConfig) return;
|
|
||||||
this.buildWorkflowConfig()
|
|
||||||
},
|
|
||||||
deep: true,
|
|
||||||
immediate: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
async created() {
|
|
||||||
const searchParams = new URLSearchParams(location.search.substring(1));
|
|
||||||
const id = searchParams.get('id');
|
|
||||||
if(id) {
|
|
||||||
this.editItem = {id};
|
|
||||||
await this.syncEditItem()
|
|
||||||
} else {
|
|
||||||
this.clearItemData();
|
|
||||||
}
|
|
||||||
this.getUserList();
|
|
||||||
this.getGroupList();
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
async doUiAction(uiActionId, uiActionData) {
|
|
||||||
switch (uiActionId) {
|
|
||||||
case 'createItem':
|
|
||||||
await this.confirmCreateItemDialog(uiActionData);
|
|
||||||
await this.doCreateItem(uiActionData);
|
|
||||||
await this.syncEditItem()
|
|
||||||
break;
|
|
||||||
case 'updateItem':
|
|
||||||
await this.confirmUpdateItemDialog(uiActionData);
|
|
||||||
await this.doUpdateItem(uiActionData);
|
|
||||||
await this.syncEditItem()
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
console.error("[doUiAction] uiActionId not find", { uiActionId });
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
buildEditItem() {
|
|
||||||
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,
|
|
||||||
workflowCategory,
|
|
||||||
workflowId: workflowId || null,
|
|
||||||
workflowConfig: workflowConfig ? JSON.stringify(workflowConfig) : null,
|
|
||||||
workflowForm: workflowForm ? JSON.stringify(workflowForm) : null,
|
|
||||||
}
|
|
||||||
if (id) {
|
|
||||||
item.id = id;
|
|
||||||
}
|
|
||||||
return item;
|
|
||||||
},
|
|
||||||
|
|
||||||
buildWorkflowFormList(val) {
|
|
||||||
this.constantCollection.workflowFormList = [];
|
|
||||||
for (const item of val) {
|
|
||||||
this.constantCollection.workflowFormList.push({
|
|
||||||
text: item.component.outline,
|
|
||||||
value: item.id
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
buildWorkflowConfig() {
|
|
||||||
for (const config of this.editItem.workflowConfig.nodeList) {
|
|
||||||
if (!config.formId) return;
|
|
||||||
const formId = []
|
|
||||||
for (const item of config.formId) {
|
|
||||||
if (!this.constantCollection.workflowFormList.find(e => e.value === item)) {
|
|
||||||
formId.push(item)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
config.formId = formId
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取user数据
|
|
||||||
*/
|
|
||||||
async getUserList() {
|
|
||||||
const {rows} = (await window.jianghuAxios({
|
|
||||||
data: {
|
|
||||||
appData: {
|
|
||||||
pageId: 'workflowManagement',
|
|
||||||
actionId: 'selectUserList',
|
|
||||||
actionData: {},
|
|
||||||
where: {},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})).data.appData.resultData;
|
|
||||||
this.constantCollection.userList = rows.map(e => {
|
|
||||||
return {text: e.username, value: e.userId, userId: e.userId }
|
|
||||||
})
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* 获取group数据
|
|
||||||
*/
|
|
||||||
async getGroupList() {
|
|
||||||
const {rows} = (await window.jianghuAxios({
|
|
||||||
data: {
|
|
||||||
appData: {
|
|
||||||
pageId: 'workflowManagement',
|
|
||||||
actionId: 'selectGroupList',
|
|
||||||
actionData: {},
|
|
||||||
where: {},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})).data.appData.resultData;
|
|
||||||
this.constantCollection.groupList = rows.map(e => {
|
|
||||||
return {text: e.groupName, value: e.groupId}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
async clearItemData() {
|
|
||||||
this.dialogSaveInfoAction = 'createItem';
|
|
||||||
this.editItem = {workflowForm: [], workflowConfig: {lineList: [], nodeList: []}, mode: 'serial'};
|
|
||||||
},
|
|
||||||
|
|
||||||
async syncEditItem() {
|
|
||||||
this.loading = true;
|
|
||||||
this.dialogSaveInfoAction = 'updateItem';
|
|
||||||
const {rows} = (await window.jianghuAxios({
|
|
||||||
data: {
|
|
||||||
appData: {
|
|
||||||
pageId: 'workflowManagement',
|
|
||||||
actionId: 'selectItemList',
|
|
||||||
where: {id: this.editItem.id},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})).data.appData.resultData;
|
|
||||||
if (!rows.length) {
|
|
||||||
this.clearItemData();
|
|
||||||
} else {
|
|
||||||
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(() => {
|
|
||||||
this.loading = false;
|
|
||||||
}, 500)
|
|
||||||
},
|
|
||||||
|
|
||||||
async confirmCreateItemDialog() {
|
|
||||||
if (await window.confirmDialog({title: "新增", content: "确定新增吗?"}) === false) {
|
|
||||||
throw new Error("[confirmCreateFormDialog] 否");
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增数据
|
|
||||||
*/
|
|
||||||
async doCreateItem() {
|
|
||||||
delete this.editItem.id;
|
|
||||||
const item = this.buildEditItem();
|
|
||||||
await window.vtoast.loading("新增数据");
|
|
||||||
const {rows} = (await window.jianghuAxios({
|
|
||||||
data: {
|
|
||||||
appData: {
|
|
||||||
pageId: 'workflowManagement',
|
|
||||||
actionId: 'insertItem',
|
|
||||||
actionData: item
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})).data.appData.resultData;
|
|
||||||
this.editItem.id = rows[0];
|
|
||||||
history.pushState({}, '', `?id=${rows[0]}`);
|
|
||||||
await window.vtoast.success("新增数据成功");
|
|
||||||
},
|
|
||||||
|
|
||||||
async confirmUpdateItemDialog() {
|
|
||||||
if (await window.confirmDialog({title: "修改", content: "确定修改吗?"}) === false) {
|
|
||||||
throw new Error("[confirmUpdateItemDialog] 否");
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改数据
|
|
||||||
*/
|
|
||||||
async doUpdateItem() {
|
|
||||||
const {id, ...item} = this.buildEditItem();
|
|
||||||
await window.vtoast.loading("修改数据");
|
|
||||||
await window.jianghuAxios({
|
|
||||||
data: {
|
|
||||||
appData: {
|
|
||||||
pageId: 'workflowManagement',
|
|
||||||
actionId: 'updateItem',
|
|
||||||
actionData: item,
|
|
||||||
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 %}
|
|
||||||
@@ -1,187 +0,0 @@
|
|||||||
{% 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 %}
|
|
||||||
Reference in new issue
Block a user