Files
workflow/app/view/page/taskCreateManagement.html
T
2022-08-02 14:34:07 +08:00

316 lines
12 KiB
HTML

{% extends 'template/jhTemplateV3.html'%}
{% block vue_template %}
<jh-layout-v3>
<template slot="serverSearch">
<v-row class="ma-0 align-center flex-none pa-0" :class="{'pa-2': !isMobile, 'pa-2': isMobile}" style="justify-content: end">
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field v-model="serverSearchInput.processName" label="流程名称" class="cus-v-input "
:class="{'mr-2': !isMobile}" dense filled single-line ></v-text-field>
</v-col>
<v-col :class="{'pt-2': isMobile, 'pl-0': isMobile, 'pr-0': !isMobile}" style="max-width: 77px">
<v-btn
class="elevation-0"
color="success"
dark
@click="doUiAction('refreshTableData')"
>
查询
</v-btn>
</v-col>
</v-row>
</template>
<!-- 页面主要内容 -->
<v-container class="fullScreen d-flex flex-column pa-xs-0 pa-0">
<v-card>
<v-list three-line subheader>
<v-subheader>流程列表</v-subheader>
<v-list-item v-for="(item, index) in tableDataFromBackend" :key="index">
<v-subheader>{{getConstantCollectionItemText('categoryList', index)}}</v-subheader>
<v-row class="pa-0 ma-0 pa-xs-4 pb-xs-4 flex-none">
<v-col cols="12" sm="12" md="6" xl="6" class="pa-xs-0 pb-xs-4 pb-3" v-for="(it, index) in item">
<v-btn class="elevation-0 mr-10" color="success" dark @click="doUiAction('startCreateItem', {item: it})">
{{it.workflowName}}
</v-btn>
</v-col>
</v-row>
</v-list-item>
</v-list>
</v-card>
</v-container>
<!-- 编辑抽屉 -->
<v-navigation-drawer v-model="isEditDrawerShow" :permanent="isEditDrawerShow" fixed temporary right width="80%"
class="elevation-24">
<v-form v-model="isFormValid" v-if="isEditDrawerShow" ref="form" lazy-validation>
<v-row>
<span class="title pa-6">{{ currentClickButton.title }}信息</span>
<v-spacer></v-spacer>
<v-btn class="mt-7 mr-8 elevation-0" fab x-small @click="isEditDrawerShow = false">
<v-icon dark>mdi-close</v-icon>
</v-btn>
</v-row>
<v-row class="pa-0 ma-0 pa-xs-4 pb-xs-4 flex-none">
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<span style="color: #3F4254;" :style="{'line-height': isMobile ? '20px' : '42px', 'font-weight': isMobile ? 400 : 500}">任务标题</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="pa-xs-0 pb-xs-4 pb-3" v-for="(formItem, index) in editItem.workflowForm" :key="index">
<span style="color: #3F4254;" :style="{'line-height': isMobile ? '20px' : '42px', 'font-weight': isMobile ? 400 : 500}">{{formItem.component.outline}}</span>
<v-list-item-content v-if="formItem.component.type === 'singleSelect'">
<v-list-item-title class="formItem-title">{{ index+1 }}、 {{ formItem.component.outline }}</v-list-item-title>
<v-radio-group :rules="requireRules" 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'">
<v-list-item-title class="formItem-title">{{ index+1 }}、 {{ formItem.component.outline }}</v-list-item-title>
<div v-for="(option, optionIndex) in formItem.component.property.selectOptionList" :key="optionIndex">
<v-checkbox :rules="requireRules" style="margin-top: 0px;" :label="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 pr-6">
<v-btn color="success" small @click="doUiAction(dialogSaveInfoAction)"
:style="{width: isMobile ? 'calc(100% - 45px)' : '200px'}" :class="{'mb-2': isMobile, 'mr-4': isMobile}">保存
</v-btn>
<v-btn class="ml-2" small @click="isEditDrawerShow = false"
:style="{width: isMobile ? 'calc(100% - 45px)' : '200px'}" :class="{'mr-4': isMobile}">取消</v-btn>
</v-row>
</v-form>
</v-navigation-drawer>
</jh-layout-v3>
{% endblock %}
{% block vue_body %}
{% include 'layout/jhLayout.html' %}
{% include 'common/resetTableMaxHeight.html' %}
<script type="module">
new Vue({
el: '#app',
template: '#app-template',
vuetify: new Vuetify(),
mixins: [window.jianghuUiActionMixins],
data: () => ({
// 表格相关数据
isFormValid: true,
requireRules: [
v => !!v || 'This is required',
],
constantCollection: {
categoryList: [],
},
serverSearchInput: {
processName: null
},
currentTableGenderType: 'all',
isEditDrawerShow: false,
searchInput: null,
isTableLoading: true,
tableDataFromBackend: [],
headers: [
{ text: "ID", value: "id", width: 120, class: 'fixed', cellClass: 'fixed' },
{ text: "任务ID", value: "taskId", width: 120 },
{ text: "流程节点版本ID", value: "processVersionId", width: 120 },
{ text: "任务名称", value: "taskTitle", width: 120 },
{ text: "任务状态:running 执行中;deny 拒绝;end 结束", value: "taskStatus", width: 120 },
{ text: "当前执行中节点", value: "taskCurrentNode", width: 120 },
{ text: "申请人", value: "taskApplier", width: 120 },
{ text: "当前执行的处理人员,用逗号分隔", value: "taskProcessorList", width: 120 },
{ text: "所有相关人员,用逗号分隔", value: "taskRelatedPersonList", width: 120 },
{ text: "催单次数", value: "taskUrgeCount", width: 120 },
{ text: "最后催单时间", value: "taskUrgeLastTime", 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: {},
tplItem: {},
tableButtonList: [
{ text: '修改', buttonType: 'edit', color: 'success', action: 'startUpdateItem' },
{ text: '删除', buttonType: 'delete', color: 'error', action: 'deleteItem' },
],
dialogSaveInfoAction: ''
}),
computed: {
isMobile() {
return window.innerWidth < 600;
},
tableData() {
if (!this.currentTableGenderType || this.currentTableGenderType === 'all') {
return this.tableDataFromBackend;
}
return this.tableDataFromBackend.filter(({ gender }) => gender === this.currentTableGenderType);
},
computedEditItem() {
return this.editItem;
},
},
watch: {},
async created() {
await this.doUiAction('refreshTableData');
},
mounted() { },
methods: {
/**
* 获取表格数据
*/
async refreshTableData() {
this.isTableLoading = true;
const serverSearchInput = _.pickBy(this.serverSearchInput, value => !!value);
const { data: { appData: { rows } } } = await window.jianghuAxios({
data: {
appData: {
pageId: 'taskCreateManagement',
actionId: 'selectWorkflowList',
actionData: {},
where: {},
whereLike: serverSearchInput,
orderBy: [{ column: 'operationAt', order: 'desc' }]
}
}
});
for(const item of rows) {
item.workflowForm = JSON.parse(item.workflowForm || '[]');
}
this.tableDataFromBackend = _.groupBy(rows, 'workflowCategory');
this.isTableLoading = false;
},
// startCreateItem
async clearItemData({item: { workflowForm, workflowConfig, workflowId }}) {
this.editItem = {workflowForm, workflowFormData: {}, workflowId};
},
async openCreateItemDialog() {
this.currentClickButton = { action: 'add', title: '新增' };
this.isEditDrawerShow = true;
this.dialogSaveInfoAction = 'createItem';
},
// createItem
async confirmCreateItemDialog() {
return window.confirmDialog({ title: '新增', content: '确定新增吗?' })
},
/**
* 新增数据
*/
async doCreateItem() {
delete this.computedEditItem.id;
await window.vtoast.loading("新增数据");
await window.jianghuAxios({
data: {
appData: {
pageId: 'taskCreateManagement',
actionId: 'insertItem',
actionData: this.computedEditItem
}
}
})
await window.vtoast.success("新增数据成功");
},
async closeDrawerShow() {
this.isEditDrawerShow = false;
},
// startUpdateItem
async prepareItemData({ item }) {
this.editItem = { ...item };
},
async openUpdateDialog() {
this.currentClickButton = { action: 'edit', title: '修改' };
this.isEditDrawerShow = true;
this.dialogSaveInfoAction = 'updateItem';
},
// updateItem
async confirmUpdateItemDialog() {
return window.confirmDialog({ title: '修改', content: '确定修改吗?' });
},
/**
* 保存数据
*/
async doUpdateItem() {
const id = this.computedEditItem.id;
delete this.computedEditItem.id;
await window.vtoast.loading("修改数据");
await window.jianghuAxios({
data: {
appData: {
pageId: 'taskManagement',
actionId: 'updateItem',
actionData: this.computedEditItem,
where: { id: id }
}
}
})
await window.vtoast.success("修改数据成功");
},
// updateItem
async confirmDeleteItemDialog() {
return window.confirmDialog({ title: '删除', content: '确定删除吗?' });
},
/**
* 删除数据
*/
async doDeleteItem({ item }) {
const { id } = item;
await window.vtoast.loading("删除数据");
await window.jianghuAxios({
data: {
appData: {
pageId: 'taskManagement',
actionId: 'deleteItem',
actionData: {},
where: { id: id }
}
}
});
await window.vtoast.success("删除数据成功");
},
getConstantCollectionItemText(key, _value) {
const constantCollectionItemFind = this.constantCollection[key].length ? this.constantCollection[key].find(e => e && e.value+'' === _value+'') : '';
if (constantCollectionItemFind) {
return constantCollectionItemFind.text;
}
return _value || '';
}
}
})
</script>
<style scoped>
</style>
{% endblock %}