264 lines
9.9 KiB
HTML
264 lines
9.9 KiB
HTML
{% 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.processName" 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="tableData"
|
|
: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" 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 :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'">
|
|
<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 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: () => ({
|
|
// 表格相关数据
|
|
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: "workflowId", width: 120 },
|
|
{ text: "任务名称", value: "workflowName", width: 120 },
|
|
{ text: "任务分类ID", value: "workflowCategory", width: 120 },
|
|
{ text: "任务节点", value: "workflowConfig", 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: {},
|
|
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 doUiAction(uiActionId, actionData) {
|
|
switch (uiActionId) {
|
|
case 'refreshTableData':
|
|
await this.refreshTableData(actionData);
|
|
break;
|
|
case 'startCreateItem':
|
|
await this.clearItemData(actionData);
|
|
await this.openCreateItemDialog(actionData);
|
|
break;
|
|
case 'createItem':
|
|
await this.confirmCreateItemDialog(actionData);
|
|
await this.doCreateItem(actionData);
|
|
await this.refreshTableData(actionData);
|
|
await this.closeDrawerShow(actionData);
|
|
break;
|
|
default:
|
|
console.error("[doAction] uiActionId not find", { uiActionId });
|
|
break;
|
|
}
|
|
},
|
|
/**
|
|
* 获取表格数据
|
|
*/
|
|
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' }]
|
|
}
|
|
}
|
|
});
|
|
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 || '[]');
|
|
}
|
|
})
|
|
this.tableDataFromBackend = rows;
|
|
console.log(this.tableDataFromBackend);
|
|
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() {
|
|
if (await window.confirmDialog({title: "新增", content: "确定新增吗?"}) === false) {
|
|
throw new Error("[confirmCreateFormDialog] 否");
|
|
}
|
|
},
|
|
|
|
/**
|
|
* 新增数据
|
|
*/
|
|
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;
|
|
}
|
|
}
|
|
})
|
|
</script>
|
|
|
|
<style scoped>
|
|
</style>
|
|
{% endblock %}
|