提交 1e5706f1 编写于 作者: ibizdev's avatar ibizdev

ibizdev提交

上级 6eed030d
......@@ -95,6 +95,14 @@
"viewname": "WFGroupPickupView",
"viewtag": "bfd32eedd618add6408b75a98f40f809"
},
"wfremodeleditview": {
"title": "流程模型编辑视图",
"caption": "流程模型",
"viewtype": "DEEDITVIEW",
"viewmodule": "workflow",
"viewname": "WFREModelEditView",
"viewtag": "c0e7fb60c35f15d4f23800acae7afbd1"
},
"wfgrouppickupgridview": {
"title": "角色/用户组选择表格视图",
"caption": "角色/用户组",
......
import wfremodel_en_US from '@locale/lanres/wfremodel/wfremodel_en_US';
import wfmember_en_US from '@locale/lanres/wfmember/wfmember_en_US';
import wfgroup_en_US from '@locale/lanres/wfgroup/wfgroup_en_US';
import wfuser_en_US from '@locale/lanres/wfuser/wfuser_en_US';
......@@ -61,11 +62,13 @@ export default {
menus: {
wfindexview: {
menuitem1: '流程定义',
menuitem3: '发布新流程',
menuitem2: '用户组',
},
},
},
entities: {
wfremodel: wfremodel_en_US,
wfmember: wfmember_en_US,
wfgroup: wfgroup_en_US,
wfuser: wfuser_en_US,
......
import wfremodel_zh_CN from '@locale/lanres/wfremodel/wfremodel_zh_CN';
import wfmember_zh_CN from '@locale/lanres/wfmember/wfmember_zh_CN';
import wfgroup_zh_CN from '@locale/lanres/wfgroup/wfgroup_zh_CN';
import wfuser_zh_CN from '@locale/lanres/wfuser/wfuser_zh_CN';
......@@ -61,11 +62,13 @@ export default {
menus: {
wfindexview: {
menuitem1: '流程定义',
menuitem3: '发布新流程',
menuitem2: '用户组',
},
},
},
entities: {
wfremodel: wfremodel_zh_CN,
wfmember: wfmember_zh_CN,
wfgroup: wfgroup_zh_CN,
wfuser: wfuser_zh_CN,
......
export default {
fields: {
id: 'ID',
name: '名称',
bpmnfile: 'BPMN',
},
views: {
editview: {
caption: "流程模型",
title: '流程模型',
},
},
main_form: {
details: {
group1: "流程模型",
formpage1: "基本信息",
srforikey: "",
srfkey: "ID",
srfmajortext: "名称",
srftempmode: "",
srfuf: "",
srfdeid: "",
srfsourcekey: "",
bpmnfile: "BPMN",
modelid: "ID",
},
uiactions: {
},
},
editviewtoolbar_toolbar: {
tbitem1: {
caption: "Save",
tip: "Save",
},
},
};
\ No newline at end of file
export default {
fields: {
id: 'ID',
name: '名称',
bpmnfile: 'BPMN',
},
views: {
editview: {
caption: '流程模型',
title: '流程模型',
},
},
main_form: {
details: {
group1: '流程模型',
formpage1: '基本信息',
srforikey: '',
srfkey: 'ID',
srfmajortext: '名称',
srftempmode: '',
srfuf: '',
srfdeid: '',
srfsourcekey: '',
bpmnfile: 'BPMN',
modelid: 'ID',
},
uiactions: {
},
},
editviewtoolbar_toolbar: {
tbitem1: {
caption: '保存',
tip: '保存',
},
},
};
\ No newline at end of file
......@@ -27,6 +27,24 @@ mock.onGet('v7/wfindex-viewappmenu').reply((config: any) => {
textcls: '',
appfunctag: '_2',
resourcetag: '',
},
{
id: 'F6C65EF1-F523-466D-9C63-7FA2F87BA90B',
name: 'menuitem3',
text: '发布新流程',
type: 'MENUITEM',
counterid: '',
tooltip: '发布新流程',
expanded: false,
separator: false,
hidden: false,
hidesidebar: false,
opendefault: false,
iconcls: '',
icon: '',
textcls: '',
appfunctag: '_4',
resourcetag: '',
},
{
id: 'A2004B9C-B0CE-4180-8C76-6FD90059F17B',
......
import qs from 'qs';
import { MockAdapter } from '@/mock/mock-adapter';
const mock = MockAdapter.getInstance();
// 模拟数据
const mockDatas: Array<any> = [
];
//getwflink
mock.onGet(new RegExp(/^\/wfcore\/ibzwf-app-web\/wfremodels\/[a-zA-Z0-9\-\;]+\/usertasks\/[a-zA-Z0-9\-\;]+\/ways$/)).reply((config: any) => {
console.groupCollapsed("实体:wfremodel 方法: getwflink");
console.table({url:config.url, method: config.method, data:config.data});
console.groupEnd();
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, {}];
}
return [status,[
{"sequenceFlowId":"dfdsfdsfdsfdsfds","sequenceFlowName":"同意",
"taskId":"aaaaddddccccddddd","processDefinitionKey":"support-workorders-approve-v1",
"processInstanceId":"ddlfldldfldsfds","refViewKey":""},
{"sequenceFlowId":"ddssdfdfdfdfsfdf","sequenceFlowName":"不同意",
"taskId":"aaaaddddccccddddd","processDefinitionKey":"support-workorders-approve-v1",
"processInstanceId":"ddfdsldlfdlldsf","refViewKey":"workorder_ltform_editview"}
]];
});
// getwfstep
mock.onGet(new RegExp(/^\/wfcore\/ibzwf-app-web\/wfremodels\/process-definitions-nodes$/)).reply((config: any) => {
console.groupCollapsed("实体:wfremodel 方法: getwfstep");
console.table({url:config.url, method: config.method, data:config.data});
console.groupEnd();
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, {}];
}
return [status, [
{"userTaskId":"sddfddfd-dfdf-fdfd-fdf-dfdfd",
"userTaskName":"待审",
"cnt":0,
"processDefinitionKey":"support-workorders-approve-v1",
"processDefinitionName":"工单审批流程v1"
},
{"userTaskId":"sddfddfd-dfdf-fdfd-fdf-87927",
"userTaskName":"待分配",
"cnt":3,
"processDefinitionKey":"support-workorders-approve-v1",
"processDefinitionName":"工单审批流程v1"}
]];
});
// createBatch
mock.onPost(new RegExp(/^\/wfremodels\/batch$/)).reply((config: any) => {
console.groupCollapsed("实体:wfremodel 方法: createBatch");
console.table({url:config.url, method: config.method, data:config.data});
console.groupEnd();
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, {}];
}
return [status, {}];
});
// updateBatch
mock.onPut(new RegExp(/^\/wfremodels\/batch$/)).reply((config: any) => {
console.groupCollapsed("实体:wfremodel 方法: updateBatch");
console.table({url:config.url, method: config.method, data:config.data});
console.groupEnd();
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, {}];
}
return [status, {}];
});
// removeBatch
mock.onDelete(new RegExp(/^\/wfremodels\/batch$/)).reply((config: any) => {
console.groupCollapsed("实体:wfremodel 方法: removeBatch");
console.table({url:config.url, method: config.method, data:config.data});
console.groupEnd();
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, {}];
}
return [status, {}];
});
// Select
mock.onGet(new RegExp(/^\/wfremodels\/([a-zA-Z0-9\-\;]{1,35})\/select$/)).reply((config: any) => {
console.groupCollapsed("实体:wfremodel 方法: Select");
console.table({url:config.url, method: config.method, data:config.data});
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
const paramArray:Array<any> = ['id'];
const matchArray:any = new RegExp(/^\/wfremodels\/([a-zA-Z0-9\-\;]{1,35})\/select$/).exec(config.url);
let tempValue: any = {};
if(matchArray && matchArray.length >1 && paramArray && paramArray.length >0){
paramArray.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item, {
enumerable: true,
value: matchArray[index + 1]
});
});
}
let items = mockDatas ? mockDatas : [];
let _items = items.find((item: any) => Object.is(item.id, tempValue.id));
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table(_items);
console.groupEnd();
console.groupEnd();
return [status, _items];
});
// Update
mock.onPut(new RegExp(/^\/wfremodels\/?([a-zA-Z0-9\-\;]{0,35})$/)).reply((config: any) => {
console.groupCollapsed("实体:wfremodel 方法: Update");
console.table({url:config.url, method: config.method, data:config.data});
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
const paramArray:Array<any> = ['id'];
const matchArray:any = new RegExp(/^\/wfremodels\/([a-zA-Z0-9\-\;]{1,35})$/).exec(config.url);
let tempValue: any = {};
if(matchArray && matchArray.length >1 && paramArray && paramArray.length >0){
paramArray.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item, {
enumerable: true,
value: matchArray[index + 1]
});
});
}
//let items = mockDatas ? mockDatas : [];
//let _items = items.find((item: any) => Object.is(item.id, tempValue.id));
let data = JSON.parse(config.data);
mockDatas.forEach((item)=>{
if(item['id'] == tempValue['id'] ){
for(let value in data){
if(item.hasOwnProperty(value)){
item[value] = data[value];
}
}
}
})
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table(data);
console.groupEnd();
console.groupEnd();
return [status, data];
});
// Save
mock.onPost(new RegExp(/^\/wfremodels\/?([a-zA-Z0-9\-\;]{0,35})\/save$/)).reply((config: any) => {
console.groupCollapsed("实体:wfremodel 方法: Save");
console.table({url:config.url, method: config.method, data:config.data});
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
const paramArray:Array<any> = ['id'];
const matchArray:any = new RegExp(/^\/wfremodels\/([a-zA-Z0-9\-\;]{1,35})\/save$/).exec(config.url);
let tempValue: any = {};
if(matchArray && matchArray.length >1 && paramArray && paramArray.length >0){
paramArray.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item, {
enumerable: true,
value: matchArray[index + 1]
});
});
}
//let items = mockDatas ? mockDatas : [];
//let _items = items.find((item: any) => Object.is(item.id, tempValue.id));
let data = JSON.parse(config.data);
mockDatas.forEach((item)=>{
if(item['id'] == tempValue['id'] ){
for(let value in data){
if(item.hasOwnProperty(value)){
item[value] = data[value];
}
}
}
})
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table(data);
console.groupEnd();
console.groupEnd();
return [status, data];
});
// Create
mock.onPost(new RegExp(/^\/wfremodels\/?([a-zA-Z0-9\-\;]{0,35})$/)).reply((config: any) => {
console.groupCollapsed("实体:wfremodel 方法: Create");
console.table({url:config.url, method: config.method, data:config.data});
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
const paramArray:Array<any> = ['id'];
const matchArray:any = new RegExp(/^\/wfremodels\/([a-zA-Z0-9\-\;]{1,35})$/).exec(config.url);
let tempValue: any = {};
if(matchArray && matchArray.length >1 && paramArray && paramArray.length >0){
paramArray.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item, {
enumerable: true,
value: matchArray[index + 1]
});
});
}
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table(mockDatas[0]);
console.groupEnd();
console.groupEnd();
return [status, mockDatas[0]];
});
// CheckKey
mock.onPost(new RegExp(/^\/wfremodels\/?([a-zA-Z0-9\-\;]{0,35})\/checkkey$/)).reply((config: any) => {
console.groupCollapsed("实体:wfremodel 方法: CheckKey");
console.table({url:config.url, method: config.method, data:config.data});
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
const paramArray:Array<any> = ['id'];
const matchArray:any = new RegExp(/^\/wfremodels\/([a-zA-Z0-9\-\;]{1,35})\/checkkey$/).exec(config.url);
let tempValue: any = {};
if(matchArray && matchArray.length >1 && paramArray && paramArray.length >0){
paramArray.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item, {
enumerable: true,
value: matchArray[index + 1]
});
});
}
//let items = mockDatas ? mockDatas : [];
//let _items = items.find((item: any) => Object.is(item.id, tempValue.id));
let data = JSON.parse(config.data);
mockDatas.forEach((item)=>{
if(item['id'] == tempValue['id'] ){
for(let value in data){
if(item.hasOwnProperty(value)){
item[value] = data[value];
}
}
}
})
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table(data);
console.groupEnd();
console.groupEnd();
return [status, data];
});
// GetDraft
mock.onGet(new RegExp(/^\/wfremodels\/getdraft$/)).reply((config: any) => {
console.groupCollapsed("实体:wfremodel 方法: GetDraft");
console.table({url:config.url, method: config.method, data:config.data});
// GetDraft
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table({});
console.groupEnd();
console.groupEnd();
return [status, {}];
});
// FetchDefault
mock.onGet(new RegExp(/^\/wfremodels\/fetchdefault$/)).reply((config: any) => {
console.groupCollapsed("实体:wfremodel 方法: FetchDefault");
console.table({url:config.url, method: config.method, data:config.data});
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table(mockDatas);
console.groupEnd();
console.groupEnd();
return [status, mockDatas ? mockDatas : []];
});
// FetchDefault
mock.onGet(new RegExp(/^\/wfremodels\/fetchdefault(\?[\w-./?%&=,]*)*$/)).reply((config: any) => {
console.groupCollapsed("实体:wfremodel 方法: FetchDefault");
console.table({url:config.url, method: config.method, data:config.data});
if(config.url.includes('page')){
let url = config.url.split('?')[1];
let params = qs.parse(url);
Object.assign(config, params);
}
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
let total = mockDatas.length;
let records: Array<any> = [];
if(!config.page || !config.size){
records = mockDatas;
}else{
if((config.page-1)*config.size < total){
records = mockDatas.slice(config.page,config.size);
}
}
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table(records ? records : []);
console.groupEnd();
console.groupEnd();
return [status, records ? records : []];
});
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// Get
mock.onGet(new RegExp(/^\/wfremodels\/([a-zA-Z0-9\-\;]{1,35})$/)).reply((config: any) => {
console.groupCollapsed("实体:wfremodel 方法: Get");
console.table({url:config.url, method: config.method, data:config.data});
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
const paramArray:Array<any> = ['id'];
const matchArray:any = new RegExp(/^\/wfremodels\/([a-zA-Z0-9\-\;]{1,35})$/).exec(config.url);
let tempValue: any = {};
if(matchArray && matchArray.length >1 && paramArray && paramArray.length >0){
paramArray.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item, {
enumerable: true,
value: matchArray[index + 1]
});
});
}
let items = mockDatas ? mockDatas : [];
let _items = items.find((item: any) => Object.is(item.id, tempValue.id));
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table(_items?_items:{});
console.groupEnd();
console.groupEnd();
return [status, _items?_items:{}];
});
// Remove
mock.onDelete(new RegExp(/^\/wfremodels\/([a-zA-Z0-9\-\;]{1,35})$/)).reply((config: any) => {
console.groupCollapsed("实体:wfremodel 方法: Remove");
console.table({url:config.url, method: config.method, data:config.data});
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
const paramArray:Array<any> = ['id'];
const matchArray:any = new RegExp(/^\/wfremodels\/([a-zA-Z0-9\-\;]{1,35})$/).exec(config.url);
let tempValue: any = {};
if(matchArray && matchArray.length >1 && paramArray && paramArray.length >0){
paramArray.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item, {
enumerable: true,
value: matchArray[index + 1]
});
});
}
let items = mockDatas ? mockDatas : [];
let _items = items.find((item: any) => Object.is(item.id, tempValue.id));
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table(_items?_items:{});
console.groupEnd();
console.groupEnd();
return [status, _items?_items:{}];
});
......@@ -7,6 +7,7 @@ import './login/login';
import './upload/upload';
// 实体级接口对象
import './entity/wfremodels/wfremodels';
import './entity/wfmembers/wfmembers';
import './entity/wfgroups/wfgroups';
import './entity/wfusers/wfusers';
......
......@@ -103,6 +103,14 @@ mock.onGet('./assets/json/view-config.json').reply((config: any) => {
"viewname": "WFGroupPickupView",
"viewtag": "bfd32eedd618add6408b75a98f40f809"
},
"wfremodeleditview": {
"title": "流程模型编辑视图",
"caption": "流程模型",
"viewtype": "DEEDITVIEW",
"viewmodule": "workflow",
"viewname": "WFREModelEditView",
"viewtag": "c0e7fb60c35f15d4f23800acae7afbd1"
},
"wfgrouppickupgridview": {
"title": "角色/用户组选择表格视图",
"caption": "角色/用户组",
......
......@@ -4,6 +4,7 @@ export const PageComponents = {
Vue.component('wfuser-pickup-grid-view', () => import('@pages/workflow/wfuser-pickup-grid-view/wfuser-pickup-grid-view.vue'));
Vue.component('wfprocess-definition-grid-view', () => import('@pages/workflow/wfprocess-definition-grid-view/wfprocess-definition-grid-view.vue'));
Vue.component('wfuser-pickup-view', () => import('@pages/workflow/wfuser-pickup-view/wfuser-pickup-view.vue'));
Vue.component('wfremodel-edit-view', () => import('@pages/workflow/wfremodel-edit-view/wfremodel-edit-view.vue'));
Vue.component('wfmember-edit-view', () => import('@pages/workflow/wfmember-edit-view/wfmember-edit-view.vue'));
Vue.component('wfgroup-grid-view', () => import('@pages/workflow/wfgroup-grid-view/wfgroup-grid-view.vue'));
Vue.component('wfuser-mpickup-view', () => import('@pages/workflow/wfuser-mpickup-view/wfuser-mpickup-view.vue'));
......
......@@ -86,6 +86,19 @@ const router = new Router({
},
component: () => import('@pages/workflow/wfuser-pickup-view/wfuser-pickup-view.vue'),
},
{
path: 'wfremodels/:wfremodel?/editview/:editview?',
meta: {
caption: 'entities.wfremodel.views.editview.caption',
parameters: [
{ pathName: 'wfindexview', parameterName: 'wfindexview' },
{ pathName: 'wfremodels', parameterName: 'wfremodel' },
{ pathName: 'editview', parameterName: 'editview' },
],
requireAuth: true,
},
component: () => import('@pages/workflow/wfremodel-edit-view/wfremodel-edit-view.vue'),
},
{
path: 'wfusers/:wfuser?/wfmembers/:wfmember?/editview/:editview?',
meta: {
......@@ -396,6 +409,18 @@ const router = new Router({
},
component: () => import('@pages/workflow/wfgroup-edit-view/wfgroup-edit-view.vue'),
},
{
path: '/wfremodels/:wfremodel?/editview/:editview?',
meta: {
caption: 'entities.wfremodel.views.editview.caption',
parameters: [
{ pathName: 'wfremodels', parameterName: 'wfremodel' },
{ pathName: 'editview', parameterName: 'editview' },
],
requireAuth: true,
},
component: () => import('@pages/workflow/wfremodel-edit-view/wfremodel-edit-view.vue'),
},
{
path: '/wfgroups/:wfgroup?/pickupgridview/:pickupgridview?',
meta: {
......
<template>
<div class="view-container deeditview wfremodel-edit-view">
<app-studioaction :viewTitle="$t(model.srfTitle)" viewName="wfremodeleditview"></app-studioaction>
<card class='view-card ' :disHover="true" :bordered="false">
<p slot='title'>
<span class='caption-info'>{{$t(model.srfTitle)}}</span>
</p>
<div slot="extra">
<div class='toolbar-container'>
<tooltip :transfer="true" :max-width="600">
<i-button v-show="toolBarModels.tbitem1.visabled" :disabled="toolBarModels.tbitem1.disabled" class='' @click="toolbar_click({ tag: 'tbitem1' }, $event)">
<i class='fa fa-save'></i>
<span class='caption'>{{$t('entities.wfremodel.editviewtoolbar_toolbar.tbitem1.caption')}}</span>
</i-button>
<div slot='content'>{{$t('entities.wfremodel.editviewtoolbar_toolbar.tbitem1.tip')}}</div>
</tooltip>
</div>
</div>
<div class="content-container">
<div class='view-top-messages'>
</div>
<view_form
:viewState="viewState"
:viewparams="viewparams"
:context="context"
:autosave="false"
:viewtag="viewtag"
:showBusyIndicator="true"
updateAction="Update"
removeAction="Remove"
loaddraftAction="GetDraft"
loadAction="Get"
createAction="Create"
WFSubmitAction=""
WFStartAction=""
style=''
name="form"
ref='form'
@save="form_save($event)"
@remove="form_remove($event)"
@load="form_load($event)"
@closeview="closeView($event)">
</view_form>
<div class='view-bottom-messages'>
</div>
</div>
</card>
</div>
</template>
<script lang='tsx'>
import { Vue, Component, Prop, Provide, Emit, Watch } from 'vue-property-decorator';
import { UIActionTool,Util } from '@/utils';
import { Subject } from 'rxjs';
import WFREModelService from '@/service/wfremodel/wfremodel-service';
import EditViewEngine from '@engine/view/edit-view-engine';
@Component({
components: {
},
})
export default class WFREModelEditViewBase extends Vue {
/**
* 实体服务对象
*
* @type {WFREModelService}
* @memberof WFREModelEditViewBase
*/
protected appEntityService: WFREModelService = new WFREModelService;
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof WFREModelEditViewBase
*/
protected counterServiceArray:Array<any> = [];
/**
* 数据变化
*
* @param {*} val
* @returns {*}
* @memberof WFREModelEditViewBase
*/
@Emit()
protected viewDatasChange(val: any):any {
return val;
}
/**
* 传入视图上下文
*
* @type {string}
* @memberof WFREModelEditViewBase
*/
@Prop() protected viewdata!: string;
/**
* 传入视图参数
*
* @type {string}
* @memberof WFREModelEditViewBase
*/
@Prop() protected viewparam!: string;
/**
* 视图默认使用
*
* @type {boolean}
* @memberof WFREModelEditViewBase
*/
@Prop({ default: true }) protected viewDefaultUsage!: boolean;
/**
* 视图标识
*
* @type {string}
* @memberof WFREModelEditViewBase
*/
protected viewtag: string = 'c0e7fb60c35f15d4f23800acae7afbd1';
/**
* 自定义视图导航上下文集合
*
* @type {*}
* @memberof WFREModelEditViewBase
*/
protected customViewNavContexts:any ={
};
/**
* 自定义视图导航参数集合
*
* @type {*}
* @memberof WFREModelEditViewBase
*/
protected customViewParams:any ={
};
/**
* 视图模型数据
*
* @type {*}
* @memberof WFREModelEditViewBase
*/
protected model: any = {
srfCaption: 'entities.wfremodel.views.editview.caption',
srfTitle: 'entities.wfremodel.views.editview.title',
srfSubTitle: 'entities.wfremodel.views.editview.subtitle',
dataInfo: ''
}
/**
* 视图参数变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof WFREModelEditViewBase
*/
@Watch('viewparam',{immediate: true, deep: true})
onParamData(newVal: any, oldVal: any) {
if(newVal){
for(let key in this.viewparams){
delete this.viewparams[key];
}
Object.assign(this.viewparams, JSON.parse(this.viewparam));
}
}
/**
* 处理应用上下文变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof WFREModelEditViewBase
*/
@Watch('viewdata')
onViewData(newVal: any, oldVal: any) {
const _this: any = this;
if (!Object.is(newVal, oldVal) && _this.engine) {
_this.parseViewParam();
_this.engine.load();
}
}
/**
* 容器模型
*
* @type {*}
* @memberof WFREModelEditViewBase
*/
protected containerModel: any = {
view_toolbar: { name: 'toolbar', type: 'TOOLBAR' },
view_form: { name: 'form', type: 'FORM' },
};
/**
* 计数器刷新
*
* @memberof WFREModelEditViewBase
*/
public counterRefresh(){
const _this:any =this;
if(_this.counterServiceArray && _this.counterServiceArray.length >0){
_this.counterServiceArray.forEach((item:any) =>{
if(item.refreshData && item.refreshData instanceof Function){
item.refreshData();
}
})
}
}
/**
* 视图状态订阅对象
*
* @private
* @type {Subject<{action: string, data: any}>}
* @memberof WFREModelEditViewBase
*/
protected viewState: Subject<ViewState> = new Subject();
/**
* 工具栏模型
*
* @type {*}
* @memberof WFREModelEditView
*/
public toolBarModels: any = {
tbitem1: { name: 'tbitem1', caption: '保存', disabled: false, type: 'DEUIACTION', visabled: true, dataaccaction: '', uiaction: { tag: 'Save', target: '' } },
};
/**
* 视图引擎
*
* @private
* @type {Engine}
* @memberof WFREModelEditViewBase
*/
private engine: EditViewEngine = new EditViewEngine();
/**
* 引擎初始化
*
* @private
* @memberof WFREModelEditViewBase
*/
private engineInit(): void {
this.engine.init({
view: this,
form: this.$refs.form,
p2k: '0',
keyPSDEField: 'wfremodel',
majorPSDEField: 'name',
isLoadDefault: true,
});
}
/**
* 应用上下文
*
* @type {*}
* @memberof WFREModelEditViewBase
*/
protected context:any = {};
/**
* 视图参数
*
* @type {*}
* @memberof WFREModelEditViewBase
*/
protected viewparams:any = {};
/**
* 解析视图参数
*
* @private
* @memberof WFREModelEditViewBase
*/
private parseViewParam(): void {
for(let key in this.context){
delete this.context[key];
}
if (!this.viewDefaultUsage && this.viewdata && !Object.is(this.viewdata, '')) {
Object.assign(this.context, JSON.parse(this.viewdata));
if(this.context && this.context.srfparentdename){
Object.assign(this.viewparams,{srfparentdename:this.context.srfparentdename});
}
if(this.context && this.context.srfparentkey){
Object.assign(this.viewparams,{srfparentkey:this.context.srfparentkey});
}
this.handleCustomViewData();
return;
}
const path = (this.$route.matched[this.$route.matched.length - 1]).path;
const keys: Array<any> = [];
const curReg = this.$pathToRegExp.pathToRegexp(path, keys);
const matchArray = curReg.exec(this.$route.path);
let tempValue: Object = {};
keys.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item.name, {
enumerable: true,
value: matchArray[index + 1]
});
});
this.$viewTool.formatRouteParams(tempValue,this.$route,this.context,this.viewparams);
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
//初始化视图唯一标识
Object.assign(this.context,{srfsessionid:this.$util.createUUID()});
this.handleCustomViewData();
}
/**
* 处理自定义视图数据
*
* @memberof WFREModelEditViewBase
*/
public handleCustomViewData(){
if(Object.keys(this.customViewNavContexts).length > 0){
Object.keys(this.customViewNavContexts).forEach((item:any) =>{
let tempContext:any = {};
let curNavContext:any = this.customViewNavContexts[item];
this.handleCustomDataLogic(curNavContext,tempContext,item);
Object.assign(this.context,tempContext);
})
}
if(Object.keys(this.customViewParams).length > 0){
Object.keys(this.customViewParams).forEach((item:any) =>{
let tempParam:any = {};
let curNavParam:any = this.customViewParams[item];
this.handleCustomDataLogic(curNavParam,tempParam,item);
Object.assign(this.viewparams,tempParam);
})
}
}
/**
* 处理自定义视图数据逻辑
*
* @memberof WFREModelEditViewBase
*/
public handleCustomDataLogic(curNavData:any,tempData:any,item:string){
// 直接值直接赋值
if(curNavData.isRawValue){
if(Object.is(curNavData.value,"null") || Object.is(curNavData.value,"")){
Object.defineProperty(tempData, item, {
value: null,
writable : true,
enumerable : true,
configurable : true
});
}else{
Object.defineProperty(tempData, item, {
value: curNavData.value,
writable : true,
enumerable : true,
configurable : true
});
}
}else{
// 先从导航上下文取数,没有再从导航参数(URL)取数,如果导航上下文和导航参数都没有则为null
if(this.context[(curNavData.value).toLowerCase()]){
Object.defineProperty(tempData, item, {
value: this.context[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
if(this.viewparams[(curNavData.value).toLowerCase()]){
Object.defineProperty(tempData, item, {
value: this.viewparams[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
Object.defineProperty(tempData, item, {
value: null,
writable : true,
enumerable : true,
configurable : true
});
}
}
}
}
/**
* Vue声明周期
*
* @memberof WFREModelEditViewBase
*/
protected created() {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof WFREModelEditViewBase
*/
protected afterCreated(){
const secondtag = this.$util.createUUID();
this.$store.commit('viewaction/createdView', { viewtag: this.viewtag, secondtag: secondtag });
this.viewtag = secondtag;
this.parseViewParam();
}
/**
* 销毁之前
*
* @memberof WFREModelEditViewBase
*/
protected beforeDestroy() {
this.$store.commit('viewaction/removeView', this.viewtag);
}
/**
* Vue声明周期(组件初始化完毕)
*
* @memberof WFREModelEditViewBase
*/
protected mounted() {
this.afterMounted();
}
/**
* 执行mounted后的逻辑
*
* @memberof WFREModelEditViewBase
*/
protected afterMounted(){
const _this: any = this;
_this.engineInit();
if (_this.loadModel && _this.loadModel instanceof Function) {
_this.loadModel();
}
}
/**
* toolbar 部件 click 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof WFREModelEditViewBase
*/
protected toolbar_click($event: any, $event2?: any) {
if (Object.is($event.tag, 'tbitem1')) {
this.toolbar_tbitem1_click($event, '', $event2);
}
}
/**
* form 部件 save 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof WFREModelEditViewBase
*/
protected form_save($event: any, $event2?: any) {
this.engine.onCtrlEvent('form', 'save', $event);
}
/**
* form 部件 remove 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof WFREModelEditViewBase
*/
protected form_remove($event: any, $event2?: any) {
this.engine.onCtrlEvent('form', 'remove', $event);
}
/**
* form 部件 load 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof WFREModelEditViewBase
*/
protected form_load($event: any, $event2?: any) {
this.engine.onCtrlEvent('form', 'load', $event);
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
protected toolbar_tbitem1_click(params: any = {}, tag?: any, $event?: any) {
// 参数
// 取数
let datas: any[] = [];
let xData: any = null;
// _this 指向容器对象
const _this: any = this;
let paramJO:any = {};
let contextJO:any = {};
xData = this.$refs.form;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
// 界面行为
this.Save(datas, contextJO,paramJO, $event, xData,this,"WFREModel");
}
/**
* 保存
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof WFREModelEditViewBase
*/
protected Save(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
// 界面行为容器对象 _this
const _this: any = this;
if (xData && xData.save instanceof Function) {
xData.save().then((response: any) => {
if (!response || response.status !== 200) {
return;
}
_this.$emit('viewdataschange', [{ ...response.data }]);
});
} else if (_this.save && _this.save instanceof Function) {
_this.save();
}
}
/**
* 关闭视图
*
* @param {any[]} args
* @memberof WFREModelEditViewBase
*/
protected closeView(args: any[]): void {
let _view: any = this;
if (_view.viewdata) {
_view.$emit('viewdataschange', [args]);
_view.$emit('close', [args]);
} else if (_view.$tabPageExp) {
_view.$tabPageExp.onClose(_view.$route.fullPath);
}
}
/**
* 销毁视图回调
*
* @memberof WFREModelEditViewBase
*/
protected destroyed(){
this.afterDestroyed();
}
/**
* 执行destroyed后的逻辑
*
* @memberof WFREModelEditViewBase
*/
protected afterDestroyed(){
if(this.viewDefaultUsage){
let localStoreLength = Object.keys(localStorage);
if(localStoreLength.length > 0){
localStoreLength.forEach((item:string) =>{
if(item.startsWith(this.context.srfsessionid)){
localStorage.removeItem(item);
}
})
}
}
}
}
</script>
<style lang='less'>
@import './wfremodel-edit-view.less';
</style>
\ No newline at end of file
.view-card {
>.ivu-card-extra {
top: 5px;
right: 0px;
}
}
.wfremodel-edit-view{
position: relative;
}
.toolbar-container {
button {
margin: 6px 0px 4px 4px;
.caption {
margin-left: 4px;
}
}
.seperator {
color: #dcdee2;
margin: 0 0px 0 4px;
}
}
// this is less
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import WFREModelEditViewBase from './wfremodel-edit-view-base.vue';
import view_form from '@widgets/wfremodel/main-form/main-form.vue';
@Component({
components: {
view_form,
},
beforeRouteEnter: (to: any, from: any, next: any) => {
next((vm: any) => {
vm.$store.commit('addCurPageViewtag', { fullPath: to.fullPath, viewtag: vm.viewtag });
});
},
})
export default class WFREModelEditView extends WFREModelEditViewBase {
}
</script>
\ No newline at end of file
......@@ -39,7 +39,8 @@ export class EntityServiceRegister {
* @memberof EntityServiceRegister
*/
protected init(): void {
this.allEntityService.set('wfmember', () => import('@/service/wfmember/wfmember-service'));
this.allEntityService.set('wfremodel', () => import('@/service/wfremodel/wfremodel-service'));
this.allEntityService.set('wfmember', () => import('@/service/wfmember/wfmember-service'));
this.allEntityService.set('wfgroup', () => import('@/service/wfgroup/wfgroup-service'));
this.allEntityService.set('wfuser', () => import('@/service/wfuser/wfuser-service'));
this.allEntityService.set('wfprocessdefinition', () => import('@/service/wfprocess-definition/wfprocess-definition-service'));
......
import { Http,Util } from '@/utils';
import EntityService from '../entity-service';
/**
* 流程模型服务对象基类
*
* @export
* @class WFREModelServiceBase
* @extends {EntityServie}
*/
export default class WFREModelServiceBase extends EntityService {
/**
* Creates an instance of WFREModelServiceBase.
*
* @param {*} [opts={}]
* @memberof WFREModelServiceBase
*/
constructor(opts: any = {}) {
super(opts);
}
/**
* 初始化基础数据
*
* @memberof WFREModelServiceBase
*/
public initBasicData(){
this.APPLYDEKEY ='wfremodel';
this.APPDEKEY = 'id';
this.APPDENAME = 'wfremodels';
this.APPDETEXT = 'name';
this.APPNAME = 'web';
this.SYSTEMNAME = 'ibzwf';
}
// 实体接口
/**
* Select接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof WFREModelServiceBase
*/
public async Select(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
return Http.getInstance().get(`/wfremodels/${context.wfremodel}/select`,isloading);
}
/**
* Update接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof WFREModelServiceBase
*/
public async Update(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData:any = {};
Object.assign(data,masterData);
let res:any = await Http.getInstance().put(`/wfremodels/${context.wfremodel}`,data,isloading);
return res;
}
/**
* Save接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof WFREModelServiceBase
*/
public async Save(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData:any = {};
Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/wfremodels/${context.wfremodel}/save`,data,isloading);
return res;
}
/**
* Get接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof WFREModelServiceBase
*/
public async Get(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().get(`/wfremodels/${context.wfremodel}`,isloading);
return res;
}
/**
* Create接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof WFREModelServiceBase
*/
public async Create(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData:any = {};
Object.assign(data,masterData);
if(!data.srffrontuf || data.srffrontuf !== "1"){
data[this.APPDEKEY] = null;
}
if(data.srffrontuf){
delete data.srffrontuf;
}
let tempContext:any = JSON.parse(JSON.stringify(context));
let res:any = await Http.getInstance().post(`/wfremodels`,data,isloading);
return res;
}
/**
* CheckKey接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof WFREModelServiceBase
*/
public async CheckKey(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
return Http.getInstance().post(`/wfremodels/${context.wfremodel}/checkkey`,data,isloading);
}
/**
* Remove接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof WFREModelServiceBase
*/
public async Remove(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
return Http.getInstance().delete(`/wfremodels/${context.wfremodel}`,isloading);
}
/**
* GetDraft接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof WFREModelServiceBase
*/
public async GetDraft(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().get(`/wfremodels/getdraft`,isloading);
res.data.wfremodel = data.wfremodel;
return res;
}
/**
* FetchDefault接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof WFREModelServiceBase
*/
public async FetchDefault(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let tempData:any = JSON.parse(JSON.stringify(data));
return Http.getInstance().get(`/wfremodels/fetchdefault`,tempData,isloading);
}
}
\ No newline at end of file
import { Http,Util } from '@/utils';
import WFREModelServiceBase from './wfremodel-service-base';
/**
* 流程模型服务对象
*
* @export
* @class WFREModelService
* @extends {WFREModelServiceBase}
*/
export default class WFREModelService extends WFREModelServiceBase {
/**
* Creates an instance of WFREModelService.
*
* @param {*} [opts={}]
* @memberof WFREModelService
*/
constructor(opts: any = {}) {
super(opts);
}
}
\ No newline at end of file
......@@ -23,6 +23,7 @@ export const viewstate: any = {
viewdatachange: false,
refviews: [
'a06aed382ebc28e6521b4398880388cd',
'c0e7fb60c35f15d4f23800acae7afbd1',
'f11ad9a3b9260fb68a2a2e870419bffa',
],
},
......@@ -123,6 +124,15 @@ export const viewstate: any = {
'c539c8d177b0401b79fa0808de6f13dd',
],
},
{
viewtag: 'c0e7fb60c35f15d4f23800acae7afbd1',
viewmodule: 'workflow',
viewname: 'WFREModelEditView',
viewaction: '',
viewdatachange: false,
refviews: [
],
},
{
viewtag: 'c539c8d177b0401b79fa0808de6f13dd',
viewmodule: 'workflow',
......
......@@ -39,7 +39,8 @@ export class UIServiceRegister {
* @memberof UIServiceRegister
*/
protected init(): void {
this.allUIService.set('wfmember', () => import('@/uiservice/wfmember/wfmember-ui-service'));
this.allUIService.set('wfremodel', () => import('@/uiservice/wfremodel/wfremodel-ui-service'));
this.allUIService.set('wfmember', () => import('@/uiservice/wfmember/wfmember-ui-service'));
this.allUIService.set('wfgroup', () => import('@/uiservice/wfgroup/wfgroup-ui-service'));
this.allUIService.set('wfuser', () => import('@/uiservice/wfuser/wfuser-ui-service'));
this.allUIService.set('wfprocessdefinition', () => import('@/uiservice/wfprocess-definition/wfprocess-definition-ui-service'));
......
import { Environment } from '@/environments/environment';
import { UIActionTool,Util } from '@/utils';
import UIService from '../ui-service';
import { Subject } from 'rxjs';
import WFREModelService from '@/service/wfremodel/wfremodel-service';
/**
* 流程模型UI服务对象基类
*
* @export
* @class WFREModelUIServiceBase
*/
export default class WFREModelUIServiceBase extends UIService {
/**
* 是否支持工作流
*
* @memberof WFREModelUIServiceBase
*/
protected isEnableWorkflow:boolean = false;
/**
* 当前UI服务对应的数据服务对象
*
* @memberof WFREModelUIServiceBase
*/
protected dataService:WFREModelService = new WFREModelService();
/**
* 所有关联视图
*
* @memberof WFREModelUIServiceBase
*/
protected allViewMap: Map<string, Object> = new Map();
/**
* 状态值
*
* @memberof WFREModelUIServiceBase
*/
protected stateValue: number = 0;
/**
* 状态属性
*
* @memberof WFREModelUIServiceBase
*/
protected stateField: string = "";
/**
* 主状态属性集合
*
* @memberof WFREModelUIServiceBase
*/
protected mainStateFields:Array<any> = [];
/**
* 主状态集合Map
*
* @memberof WFREModelUIServiceBase
*/
protected allDeMainStateMap:Map<string,string> = new Map();
/**
* Creates an instance of WFREModelUIServiceBase.
*
* @param {*} [opts={}]
* @memberof WFREModelUIServiceBase
*/
constructor(opts: any = {}) {
super(opts);
this.initViewMap();
this.initDeMainStateMap();
}
/**
* 初始化视图Map
*
* @memberof WFREModelUIServiceBase
*/
public initViewMap(){
this.allViewMap.set('EDITVIEW:',{viewname:'editview',srfappde:'wfremodels'});
}
/**
* 初始化主状态集合
*
* @memberof WFREModelUIServiceBase
*/
public initDeMainStateMap(){
}
/**
* 获取指定数据的重定向页面
*
* @param srfkey 数据主键
* @param isEnableWorkflow 重定向视图是否需要处理流程中的数据
* @memberof WFREModelUIServiceBase
*/
public async getRDAppView(srfkey:string,isEnableWorkflow:boolean){
this.isEnableWorkflow = isEnableWorkflow;
// 进行数据查询
let result:any = await this.dataService.Get({wfremodel:srfkey});
const curData:any = result.data;
//判断当前数据模式,默认为true,todo
const iRealDEModel:boolean = true;
let bDataInWF:boolean = false;
let bWFMode:any = false;
// 计算数据模式
if (this.isEnableWorkflow) {
bDataInWF = await this.dataService.testDataInWF({stateValue:this.stateValue,stateField:this.stateField},curData);
if (bDataInWF) {
bDataInWF = true;
bWFMode = await this.dataService.testUserExistWorklist(null,curData);
}
}
let strPDTViewParam:string = await this.getDESDDEViewPDTParam(curData, bDataInWF, bWFMode);
//若不是当前数据模式,处理strPDTViewParam,todo
//查找视图
//返回视图
return this.allViewMap.get(strPDTViewParam);
}
/**
* 获取实际的数据类型
*
* @memberof WFREModelUIServiceBase
*/
protected getRealDEType(entity:any){
}
/**
* 获取实体单数据实体视图预定义参数
*
* @param curData 当前数据
* @param bDataInWF 是否有数据在工作流中
* @param bWFMode 是否工作流模式
* @memberof WFREModelUIServiceBase
*/
protected async getDESDDEViewPDTParam(curData:any, bDataInWF:boolean, bWFMode:boolean){
let strPDTParam:string = '';
if (bDataInWF) {
// 判断数据是否在流程中
}
//多表单,todo
const isEnableMultiForm:boolean = false;
const multiFormDEField:string|null =null;
if (isEnableMultiForm && multiFormDEField) {
const objFormValue:string = curData[multiFormDEField];
if(!Environment.isAppMode){
return 'MOBEDITVIEW'+objFormValue;
}
return 'EDITVIEW'+objFormValue;
}
if(!Environment.isAppMode){
if(this.getDEMainStateTag(curData)){
return `MOBEDITVIEW:MSTAG:${ await this.getDEMainStateTag(curData)}`;
}
return 'MOBEDITVIEW:';
}
if(this.getDEMainStateTag(curData)){
return `EDITVIEW:MSTAG:${ await this.getDEMainStateTag(curData)}`;
}
return 'EDITVIEW:';
}
/**
* 获取数据对象的主状态标识
*
* @param curData 当前数据
* @memberof WFREModelUIServiceBase
*/
protected async getDEMainStateTag(curData:any){
if(this.mainStateFields.length === 0) return null;
this.mainStateFields.forEach((singleMainField:any) =>{
if(!(singleMainField in curData)){
console.error(`当前数据对象不包含属性singleMainField,可能会发生错误`);
}
})
let strTag:String = "";
for (let i = 0; i <= 1; i++) {
let strTag:string = (curData[this.mainStateFields[0]])?(i == 0) ? curData[this.mainStateFields[0]] : "":"";
if (this.mainStateFields.length >= 2) {
for (let j = 0; j <= 1; j++) {
let strTag2:string = (curData[this.mainStateFields[1]])?`${strTag}__${(j == 0) ? curData[this.mainStateFields[1]] : ""}`:strTag;
if (this.mainStateFields.length >= 3) {
for (let k = 0; k <= 1; k++) {
let strTag3:string = (curData[this.mainStateFields[2]])?`${strTag2}__${(k == 0) ? curData[this.mainStateFields[2]] : ""}`:strTag2;
// 判断是否存在
return this.allDeMainStateMap.get(strTag3);
}
}else{
return this.allDeMainStateMap.get(strTag2);
}
}
}else{
return this.allDeMainStateMap.get(strTag);
}
}
return null;
}
}
\ No newline at end of file
import WFREModelUIServiceBase from './wfremodel-ui-service-base';
/**
* 流程模型UI服务对象
*
* @export
* @class WFREModelUIService
*/
export default class WFREModelUIService extends WFREModelUIServiceBase {
/**
* Creates an instance of WFREModelUIService.
*
* @param {*} [opts={}]
* @memberof WFREModelUIService
*/
constructor(opts: any = {}) {
super(opts);
}
}
\ No newline at end of file
......@@ -556,6 +556,9 @@ export default class WFIndexViewBase extends Vue implements ControlInterface {
private click(item: any) {
if (item) {
switch (item.appfunctag) {
case '_4':
this.click_4(item);
return;
case '_2':
this.click_2(item);
return;
......@@ -569,6 +572,24 @@ export default class WFIndexViewBase extends Vue implements ControlInterface {
}
/**
* 发布流程
*
* @param {*} [item={}]
* @memberof WFIndexView
*/
protected click_4(item: any = {}) {
const viewparam: any = {};
Object.assign(viewparam, {});
const deResParameters: any[] = [];
const parameters: any[] = [
{ pathName: 'wfremodels', parameterName: 'wfremodel' },
{ pathName: 'editview', parameterName: 'editview' },
];
const path: string = this.$viewTool.buildUpRoutePath(this.$route, {}, deResParameters, parameters, [], viewparam);
this.$router.push(path);
}
/**
* 流程定义
*
......
......@@ -31,6 +31,24 @@ export default class WFIndexViewModel {
textcls: '',
appfunctag: '_2',
resourcetag: '',
},
{
id: 'F6C65EF1-F523-466D-9C63-7FA2F87BA90B',
name: 'menuitem3',
text: '发布新流程',
type: 'MENUITEM',
counterid: '',
tooltip: '发布新流程',
expanded: false,
separator: false,
hidden: false,
hidesidebar: false,
opendefault: false,
iconcls: '',
icon: '',
textcls: '',
appfunctag: '_4',
resourcetag: '',
},
{
id: 'A2004B9C-B0CE-4180-8C76-6FD90059F17B',
......@@ -60,6 +78,18 @@ export default class WFIndexViewModel {
* @memberof WFIndexViewModel
*/
private funcs: any[] = [
{
appfunctag: '_4',
appfuncyype: 'APPVIEW',
openmode: '',
codename: 'wfremodeleditview',
deResParameters: [],
routepath: '/wfindexview/:wfindexview?/wfremodels/:wfremodel?/editview/:editview?',
parameters: [
{ pathName: 'wfremodels', parameterName: 'wfremodel' },
{ pathName: 'editview', parameterName: 'editview' },
],
},
{
appfunctag: '_2',
appfuncyype: 'APPVIEW',
......
<template>
<i-form :model="this.data" class='app-form' ref='form' id='form' style="">
<input style="display:none;" />
<row >
<i-col v-show="detailsModel.group1.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-group layoutType="TABLE_24COL" titleStyle="" class='' uiActionGroup="detailsModel.group1.uiActionGroup" @groupuiactionclick="groupUIActionClick($event)" :caption="$t('entities.wfremodel.main_form.details.group1')" :isShowCaption="false" uiStyle="DEFAULT" :titleBarCloseMode="0" :isInfoGroupMode="false" >
<row>
<i-col v-show="detailsModel.bpmnfile.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='bpmnfile' :itemRules="this.rules.bpmnfile" class='' :caption="$t('entities.wfremodel.main_form.details.bpmnfile')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.bpmnfile.error" :isEmptyCaption="false" labelPos="LEFT">
<app-file-upload :formState="formState" :ignorefieldvaluechange="ignorefieldvaluechange" @formitemvaluechange="onFormItemValueChange" :data="JSON.stringify(this.data)" name='bpmnfile' :value="data.bpmnfile" :disabled="detailsModel.bpmnfile.disabled" uploadparams='' exportparams='' :customparams="{}" style="overflow: auto;"></app-file-upload>
</app-form-item>
</i-col>
</row>
</app-form-group>
</i-col>
</row>
</i-form>
</template>
<script lang='tsx'>
import { Vue, Component, Prop, Provide, Emit, Watch, Model } from 'vue-property-decorator';
import { CreateElement } from 'vue';
import { Subject, Subscription } from 'rxjs';
import { ControlInterface } from '@/interface/control';
import { UIActionTool,Util } from '@/utils';
import WFREModelService from '@/service/wfremodel/wfremodel-service';
import MainService from './main-form-service';
import { FormButtonModel, FormPageModel, FormItemModel, FormDRUIPartModel, FormPartModel, FormGroupPanelModel, FormIFrameModel, FormRowItemModel, FormTabPageModel, FormTabPanelModel, FormUserControlModel } from '@/model/form-detail';
import { debounceTime, distinctUntilChanged } from 'rxjs/operators';
@Component({
components: {
}
})
export default class MainBase extends Vue implements ControlInterface {
/**
* 名称
*
* @type {string}
* @memberof Main
*/
@Prop() protected name?: string;
/**
* 视图通讯对象
*
* @type {Subject<ViewState>}
* @memberof Main
*/
@Prop() protected viewState!: Subject<ViewState>;
/**
* 应用上下文
*
* @type {*}
* @memberof Main
*/
@Prop() protected context: any;
/**
* 视图参数
*
* @type {*}
* @memberof Main
*/
@Prop() protected viewparams: any;
/**
* 视图状态事件
*
* @protected
* @type {(Subscription | undefined)}
* @memberof Main
*/
protected viewStateEvent: Subscription | undefined;
/**
* 获取部件类型
*
* @returns {string}
* @memberof Main
*/
protected getControlType(): string {
return 'FORM'
}
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof Main
*/
protected counterServiceArray:Array<any> = [];
/**
* 建构部件服务对象
*
* @type {MainService}
* @memberof Main
*/
protected service: MainService = new MainService({ $store: this.$store });
/**
* 实体服务对象
*
* @type {WFREModelService}
* @memberof Main
*/
protected appEntityService: WFREModelService = new WFREModelService({ $store: this.$store });
/**
* 关闭视图
*
* @param {any} args
* @memberof Main
*/
protected closeView(args: any): void {
let _this: any = this;
_this.$emit('closeview', [args]);
}
/**
* 计数器刷新
*
* @memberof Main
*/
public counterRefresh(){
const _this:any =this;
if(_this.counterServiceArray && _this.counterServiceArray.length >0){
_this.counterServiceArray.forEach((item:any) =>{
if(item.refreshData && item.refreshData instanceof Function){
item.refreshData();
}
})
}
}
/**
* 获取多项数据
*
* @returns {any[]}
* @memberof Main
*/
public getDatas(): any[] {
return [this.data];
}
/**
* 获取单项树
*
* @returns {*}
* @memberof Main
*/
public getData(): any {
return this.data;
}
/**
* 是否默认保存
*
* @type {boolean}
* @memberof Main
*/
@Prop({ default: false }) protected autosave?: boolean;
/**
* 显示处理提示
*
* @type {boolean}
* @memberof Main
*/
@Prop({ default: true }) protected showBusyIndicator?: boolean;
/**
* 部件行为--submit
*
* @type {string}
* @memberof Main
*/
@Prop() protected WFSubmitAction!: string;
/**
* 部件行为--start
*
* @type {string}
* @memberof Main
*/
@Prop() protected WFStartAction!: string;
/**
* 部件行为--update
*
* @type {string}
* @memberof Main
*/
@Prop() protected updateAction!: string;
/**
* 部件行为--remove
*
* @type {string}
* @memberof Main
*/
@Prop() protected removeAction!: string;
/**
* 部件行为--loaddraft
*
* @type {string}
* @memberof Main
*/
@Prop() protected loaddraftAction!: string;
/**
* 部件行为--load
*
* @type {string}
* @memberof Main
*/
@Prop() protected loadAction!: string;
/**
* 部件行为--create
*
* @type {string}
* @memberof Main
*/
@Prop() protected createAction!: string;
/**
* 部件行为--create
*
* @type {string}
* @memberof Main
*/
@Prop() protected searchAction!: string;
/**
* 视图标识
*
* @type {string}
* @memberof Main
*/
@Prop() protected viewtag!: string;
/**
* 表单状态
*
* @type {Subject<any>}
* @memberof Main
*/
protected formState: Subject<any> = new Subject();
/**
* 忽略表单项值变化
*
* @type {boolean}
* @memberof Main
*/
protected ignorefieldvaluechange: boolean = false;
/**
* 数据变化
*
* @private
* @type {Subject<any>}
* @memberof Main
*/
private dataChang: Subject<any> = new Subject();
/**
* 视图状态事件
*
* @private
* @type {(Subscription | undefined)}
* @memberof Main
*/
private dataChangEvent: Subscription | undefined;
/**
* 原始数据
*
* @private
* @type {*}
* @memberof Main
*/
private oldData: any = {};
/**
* 表单数据对象
*
* @type {*}
* @memberof Main
*/
protected data: any = {
srforikey: null,
srfkey: null,
srfmajortext: null,
srftempmode: null,
srfuf: null,
srfdeid: null,
srfsourcekey: null,
bpmnfile: null,
modelid: null,
wfremodel:null,
};
/**
* 当前执行的行为逻辑
*
* @type {string}
* @memberof Main
*/
protected currentAction: string = "";
/**
* 关系界面计数器
*
* @type {number}
* @memberof Main
*/
protected drcounter: number = 0;
/**
* 需要等待关系界面保存时,第一次调用save参数的备份
*
* @type {number}
* @memberof Main
*/
protected drsaveopt: any = {};
/**
* 表单保存回调存储对象
*
* @type {any}
* @memberof Main
*/
protected saveState:any ;
/**
* 属性值规则
*
* @type {*}
* @memberof Main
*/
protected rules: any = {
srforikey: [
{ type: 'string', message: ' 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: ' 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'blur' },
],
srfkey: [
{ type: 'string', message: 'ID 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: 'ID 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: 'ID 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: 'ID 值不能为空', trigger: 'blur' },
],
srfmajortext: [
{ type: 'string', message: '名称 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '名称 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '名称 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '名称 值不能为空', trigger: 'blur' },
],
srftempmode: [
{ type: 'string', message: ' 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: ' 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'blur' },
],
srfuf: [
{ type: 'string', message: ' 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: ' 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'blur' },
],
srfdeid: [
{ type: 'string', message: ' 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: ' 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'blur' },
],
srfsourcekey: [
{ type: 'string', message: ' 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: ' 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'blur' },
],
bpmnfile: [
{ type: 'string', message: 'BPMN 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: 'BPMN 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: 'BPMN 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: 'BPMN 值不能为空', trigger: 'blur' },
],
modelid: [
{ type: 'string', message: 'ID 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: 'ID 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: 'ID 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: 'ID 值不能为空', trigger: 'blur' },
],
}
/**
* 详情模型集合
*
* @type {*}
* @memberof Main
*/
protected detailsModel: any = {
group1: new FormGroupPanelModel({ caption: '流程模型', detailType: 'GROUPPANEL', name: 'group1', visible: true, isShowCaption: false, form: this, uiActionGroup: { caption: '', langbase: 'entities.wfremodel.main_form', extractMode: 'ITEM', details: [] } })
,
formpage1: new FormPageModel({ caption: '基本信息', detailType: 'FORMPAGE', name: 'formpage1', visible: true, isShowCaption: true, form: this })
,
srforikey: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srforikey', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
srfkey: new FormItemModel({ caption: 'ID', detailType: 'FORMITEM', name: 'srfkey', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
srfmajortext: new FormItemModel({ caption: '名称', detailType: 'FORMITEM', name: 'srfmajortext', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
srftempmode: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srftempmode', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
srfuf: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srfuf', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
srfdeid: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srfdeid', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
srfsourcekey: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srfsourcekey', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
bpmnfile: new FormItemModel({ caption: 'BPMN', detailType: 'FORMITEM', name: 'bpmnfile', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
modelid: new FormItemModel({ caption: 'ID', detailType: 'FORMITEM', name: 'modelid', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
};
/**
* 监控表单属性 srforikey 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.srforikey')
onSrforikeyChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srforikey', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srfkey 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.srfkey')
onSrfkeyChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srfkey', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srfmajortext 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.srfmajortext')
onSrfmajortextChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srfmajortext', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srftempmode 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.srftempmode')
onSrftempmodeChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srftempmode', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srfuf 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.srfuf')
onSrfufChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srfuf', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srfdeid 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.srfdeid')
onSrfdeidChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srfdeid', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srfsourcekey 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.srfsourcekey')
onSrfsourcekeyChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srfsourcekey', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 bpmnfile 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.bpmnfile')
onBpmnfileChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'bpmnfile', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 modelid 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.modelid')
onModelidChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'modelid', newVal: newVal, oldVal: oldVal });
}
/**
* 重置表单项值
*
* @private
* @param {{ name: string, newVal: any, oldVal: any }} { name, newVal, oldVal }
* @memberof Main
*/
private resetFormData({ name, newVal, oldVal }: { name: string, newVal: any, oldVal: any }): void {
}
/**
* 置空对象
*
* @param {any[]} args
* @memberof EditForm
*/
protected ResetData(_datas:any){
if(Object.keys(_datas).length >0){
Object.keys(_datas).forEach((name: string) => {
if (this.data.hasOwnProperty(name)) {
this.data[name] = null;
}
});
}
}
/**
* 表单逻辑
*
* @private
* @param {{ name: string, newVal: any, oldVal: any }} { name, newVal, oldVal }
* @memberof Main
*/
private formLogic({ name, newVal, oldVal }: { name: string, newVal: any, oldVal: any }): void {
}
/**
* 表单值变化
*
* @private
* @param {{ name: string, newVal: any, oldVal: any }} { name, newVal, oldVal }
* @returns {void}
* @memberof Main
*/
private formDataChange({ name, newVal, oldVal }: { name: string, newVal: any, oldVal: any }): void {
if (this.ignorefieldvaluechange) {
return;
}
this.resetFormData({ name: name, newVal: newVal, oldVal: oldVal });
this.formLogic({ name: name, newVal: newVal, oldVal: oldVal });
this.dataChang.next(JSON.stringify(this.data));
}
/**
* 表单加载完成
*
* @private
* @param {*} [data={}]
* @param {string} [action]
* @memberof Main
*/
private onFormLoad(data: any = {},action:string): void {
if(Object.is(action,"save") || Object.is(action,"autoSave") || Object.is(action,"submit"))
// 更新context的实体主键
if(data.wfremodel){
Object.assign(this.context,{wfremodel:data.wfremodel})
}
this.setFormEnableCond(data);
this.fillForm(data,action);
this.oldData = {};
Object.assign(this.oldData, JSON.parse(JSON.stringify(this.data)));
this.$store.commit('viewaction/setViewDataChange', { viewtag: this.viewtag, viewdatachange: false });
this.formLogic({ name: '', newVal: null, oldVal: null });
}
/**
* 值填充
*
* @param {*} [_datas={}]
* @param {string} [action]
* @memberof Main
*/
protected fillForm(_datas: any = {},action:string): void {
this.ignorefieldvaluechange = true;
Object.keys(_datas).forEach((name: string) => {
if (this.data.hasOwnProperty(name)) {
this.data[name] = _datas[name];
}
});
if(Object.is(action,'loadDraft')){
this.createDefault();
}
if(Object.is(action,'load')){
this.updateDefault();
}
this.$nextTick(function () {
this.ignorefieldvaluechange = false;
})
}
/**
* 设置表单项是否启用
*
* @protected
* @param {*} data
* @memberof Main
*/
protected setFormEnableCond(data: any): void {
Object.values(this.detailsModel).forEach((detail: any) => {
if (!Object.is(detail.detailType, 'FORMITEM')) {
return;
}
const formItem: FormItemModel = detail;
formItem.setEnableCond(data.srfuf);
});
}
/**
* 重置草稿表单状态
*
* @private
* @memberof Main
*/
private resetDraftFormStates(): void {
const form: any = this.$refs.form;
if (form) {
form.resetFields();
}
}
/**
* 重置校验结果
*
* @memberof Main
*/
protected resetValidates(): void {
Object.values(this.detailsModel).forEach((detail: any) => {
if (!Object.is(detail.detailType, 'FORMITEM')) {
return;
}
const formItem: FormItemModel = detail;
formItem.setError('');
});
}
/**
* 填充校验结果 (后台)
*
* @param {any[]} fieldErrors
* @memberof Main
*/
protected fillValidates(fieldErrors: any[]): void {
fieldErrors.forEach((error: any) => {
const formItem: FormItemModel = this.detailsModel[error.field];
if (!formItem) {
return;
}
this.$nextTick(() => {
formItem.setError(error.message);
});
});
}
/**
* 表单校验状态
*
* @returns {boolean}
* @memberof Main
*/
protected formValidateStatus(): boolean {
const form: any = this.$refs.form;
let validatestate: boolean = true;
form.validate((valid: boolean) => {
validatestate = valid ? true : false;
});
return validatestate
}
/**
* 获取全部值
*
* @returns {*}
* @memberof Main
*/
protected getValues(): any {
return this.data;
}
/**
* 表单项值变更
*
* @param {{ name: string, value: any }} $event
* @returns {void}
* @memberof Main
*/
protected onFormItemValueChange($event: { name: string, value: any }): void {
if (!$event) {
return;
}
if (!$event.name || Object.is($event.name, '') || !this.data.hasOwnProperty($event.name)) {
return;
}
this.data[$event.name] = $event.value;
}
/**
* 设置数据项值
*
* @param {string} name
* @param {*} value
* @returns {void}
* @memberof Main
*/
protected setDataItemValue(name: string, value: any): void {
if (!name || Object.is(name, '') || !this.data.hasOwnProperty(name)) {
return;
}
if (Object.is(this.data[name], value)) {
return;
}
this.data[name] = value;
}
/**
* 分组界面行为事件
*
* @param {*} $event
* @memberof Main
*/
protected groupUIActionClick($event: any): void {
if (!$event) {
return;
}
const item:any = $event.item;
}
/**
* Vue声明周期(处理组件的输入属性)
*
* @memberof Main
*/
protected created(): void {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof Main
*/
protected afterCreated(){
if (this.viewState) {
this.viewStateEvent = this.viewState.subscribe(({ tag, action, data }) => {
if (!Object.is(tag, this.name)) {
return;
}
if (Object.is('autoload', action)) {
this.autoLoad(data);
}
if (Object.is('load', action)) {
this.load(data);
}
if (Object.is('loaddraft', action)) {
this.loadDraft(data);
}
if (Object.is('save', action)) {
this.save(data,data.showResultInfo);
}
if (Object.is('remove', action)) {
this.remove(data);
}
if (Object.is('saveandexit', action)) {
this.saveAndExit(data);
}
if (Object.is('saveandnew', action)) {
this.saveAndNew(data);
}
if (Object.is('removeandexit', action)) {
this.removeAndExit(data);
}
if (Object.is('refresh', action)) {
this.refresh(data);
}
});
}
this.dataChang
.pipe(
debounceTime(300),
distinctUntilChanged()
).subscribe((data: any) => {
if (this.autosave) {
this.autoSave();
}
const state = !Object.is(JSON.stringify(this.oldData), JSON.stringify(this.data)) ? true : false;
this.$store.commit('viewaction/setViewDataChange', { viewtag: this.viewtag, viewdatachange: state });
});
}
/**
* vue 生命周期
*
* @memberof Main
*/
protected destroyed() {
this.afterDestroy();
}
/**
* 执行destroyed后的逻辑
*
* @memberof Main
*/
protected afterDestroy() {
if (this.viewStateEvent) {
this.viewStateEvent.unsubscribe();
}
if (this.dataChangEvent) {
this.dataChangEvent.unsubscribe();
}
}
/**
* 拷贝内容
*
* @param {*} [arg={}]
* @memberof @memberof Main
*/
protected copy(arg: any = {}): void {
this.loadDraft(arg);
}
/**
*打印
*@memberof @memberof Main
*/
protected print(){
let _this:any = this;
_this.$print({id:'form',popTitle:'主编辑表单'});
}
/**
* 部件刷新
*
* @param {any[]} args
* @memberof Main
*/
protected refresh(args: any[]): void {
let arg: any = {};
Object.assign(arg,args[0]);
if (this.data.srfkey && !Object.is(this.data.srfkey, '')) {
Object.assign(arg, { srfkey: this.data.srfkey });
this.load(arg);
return;
}
if (this.data.srfkeys && !Object.is(this.data.srfkeys, '')) {
Object.assign(arg, { srfkey: this.data.srfkeys });
this.load(arg);
return;
}
}
/**
* 自动加载
*
* @param {*} [arg={}]
* @returns {void}
* @memberof Main
*/
protected autoLoad(arg: any = {}): void {
if (arg.srfkey && !Object.is(arg.srfkey, '')) {
Object.assign(arg, { srfkey: arg.srfkey });
this.load(arg);
return;
}
if (arg.srfkeys && !Object.is(arg.srfkeys, '')) {
Object.assign(arg, { srfkey: arg.srfkeys });
this.load(arg);
return;
}
this.loadDraft(arg);
}
/**
* 加载
*
* @private
* @param {*} [opt={}]
* @memberof Main
*/
private load(opt: any = {}): void {
if(!this.loadAction){
this.$Notice.error({ title: '错误', desc: 'WFREModelEditView视图表单loadAction参数未配置' });
return;
}
const arg: any = { ...opt };
let viewparamResult:any = Object.assign(arg,this.viewparams);
const get: Promise<any> = this.service.get(this.loadAction,JSON.parse(JSON.stringify(this.context)),{viewparams:viewparamResult}, this.showBusyIndicator);
get.then((response: any) => {
if (response && response.status === 200) {
const data = response.data;
this.onFormLoad(data,'load');
this.$emit('load', data);
this.$nextTick(() => {
this.formState.next({ type: 'load', data: data });
});
}
}).catch((response: any) => {
if (response && response.status && response.data) {
this.$Notice.error({ title: '错误', desc: response.data.message });
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: '错误', desc: '系统异常' });
return;
}
});
}
/**
* 加载草稿
*
* @param {*} [opt={}]
* @memberof Main
*/
protected loadDraft(opt: any = {}): void {
if(!this.loaddraftAction){
this.$Notice.error({ title: '错误', desc: 'WFREModelEditView视图表单loaddraftAction参数未配置' });
return;
}
const arg: any = { ...opt } ;
let viewparamResult:any = Object.assign(arg,this.viewparams);
let post: Promise<any> = this.service.loadDraft(this.loaddraftAction,JSON.parse(JSON.stringify(this.context)),{viewparams:viewparamResult}, this.showBusyIndicator);
post.then((response: any) => {
if (!response.status || response.status !== 200) {
if (response.data) {
this.$Notice.error({ title: '错误', desc: response.data.message });
}
return;
}
const data = response.data;
if(data.wfremodel){
Object.assign(this.context,{wfremodel:data.wfremodel})
}
this.resetDraftFormStates();
this.onFormLoad(data,'loadDraft');
this.$emit('load', data);
this.$nextTick(() => {
this.formState.next({ type: 'load', data: data });
});
setTimeout(() => {
const form: any = this.$refs.form;
if (form) {
form.fields.forEach((field: any) => {
field.validateMessage = "";
field.validateState = "";
field.validateStatus = false;
});
}
});
}).catch((response: any) => {
if (response && response.status && response.data) {
this.$Notice.error({ title: '错误', desc: response.data.message });
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: '错误', desc: '系统异常' });
return;
}
});
}
/**
* 自动保存
*
* @param {*} [opt={}]
* @memberof Main
*/
protected autoSave(opt: any = {}): void {
if (!this.formValidateStatus()) {
return;
}
const arg: any = { ...opt };
const data = this.getValues();
Object.assign(arg, data);
const action: any = Object.is(data.srfuf, '1') ? this.updateAction : this.createAction;
if(!action){
let actionName:any = Object.is(data.srfuf, '1')?"updateAction":"createAction";
this.$Notice.error({ title: '错误', desc: 'WFREModelEditView视图表单'+actionName+'参数未配置' });
return;
}
Object.assign(arg,{viewparams:this.viewparams});
const post: Promise<any> = this.service.add(action, JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator);
post.then((response: any) => {
if (!response.status || response.status !== 200) {
if (response.data) {
this.$Notice.error({ title: '错误', desc: response.data.message });
}
return;
}
const data = response.data;
this.onFormLoad(data,'autoSave');
this.$emit('save', data);
this.$store.dispatch('viewaction/datasaved', { viewtag: this.viewtag });
this.$nextTick(() => {
this.formState.next({ type: 'save', data: data });
});
}).catch((response: any) => {
if (response && response.status && response.data) {
this.$Notice.error({ title: '错误', desc: response.data.message });
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: '错误', desc: '系统异常' });
return;
}
});
}
/**
* 保存
*
* @param {*} [opt={}]
* @param {boolean} [showResultInfo]
* @param {boolean} [ifStateNext] formState是否下发通知
* @returns {Promise<any>}
* @memberof Main
*/
protected async save(opt: any = {}, showResultInfo?: boolean, ifStateNext: boolean = true): Promise<any> {
return new Promise((resolve: any, reject: any) => {
showResultInfo = showResultInfo === undefined ? true : false;
if (!this.formValidateStatus()) {
this.$Notice.error({ title: '错误', desc: '值规则校验异常' });
return;
}
const arg: any = { ...opt };
const data = this.getValues();
Object.assign(arg, data);
Object.assign(arg, this.context);
if (ifStateNext) {
this.drcounter = 0;
if(this.drcounter !== 0){
this.drsaveopt = opt;
this.formState.next({ type: 'beforesave', data: arg });//先通知关系界面保存
this.saveState = resolve;
return;
}
}
const action: any = Object.is(data.srfuf, '1') ? this.updateAction : this.createAction;
if(!action){
let actionName:any = Object.is(data.srfuf, '1')?"updateAction":"createAction";
this.$Notice.error({ title: '错误', desc: 'WFREModelEditView视图表单'+actionName+'参数未配置' });
return;
}
Object.assign(arg,{viewparams:this.viewparams});
const post: Promise<any> = Object.is(data.srfuf, '1')?this.service.update(action, JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator):this.service.add(action,JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator);
post.then((response: any) => {
if (!response.status || response.status !== 200) {
if (response.data) {
this.$Notice.error({ title: '错误', desc: response.data.message });
}
return;
}
const data = response.data;
this.onFormLoad(data,'save');
this.$emit('save', data);
this.$store.dispatch('viewaction/datasaved', { viewtag: this.viewtag });
this.$nextTick(() => {
this.formState.next({ type: 'save', data: data });
});
if (showResultInfo) {
this.$Notice.success({ title: '', desc: (data.srfmajortext ? data.srfmajortext : '') + '&nbsp;保存成功!' });
}
resolve(response);
}).catch((response: any) => {
if (response && response.status && response.data) {
this.$Notice.error({ title: '错误', desc: response.data.message });
reject(response);
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: '错误', desc: '系统异常' });
reject(response);
return;
}
reject(response);
});
})
}
/**
* 删除
*
* @private
* @param {*} [opt={}]
* @memberof EditForm
*/
private remove(opt:Array<any> = [],showResultInfo?: boolean): Promise<any> {
return new Promise((resolve: any, reject: any) => {
if(!this.removeAction){
this.$Notice.error({ title: '错误', desc: 'WFREModelEditView视图表单removeAction参数未配置' });
return;
}
const arg: any = opt[0];
const _this: any = this;
Object.assign(arg,{viewparams:this.viewparams});
this.service.delete(_this.removeAction, JSON.parse(JSON.stringify(this.context)),arg, showResultInfo).then((response: any) => {
if (response) {
const data = response.data;
this.$emit('remove',data);
this.formState.next({ type: 'remove', data: data });
this.data.ismodify = false;
this.$Notice.success({ title: '', desc: (data.srfmajortext ? data.srfmajortext : '') + '&nbsp;删除成功!' });
resolve(response);
}
}).catch((error: any) => {
const { data: _data } = error;
this.$Notice.error({ title: _data.title, desc: _data.message });
reject(error);
});
});
}
/**
* 工作流启动
*
* @param {*} [data={}]
* @param {*} [localdata={}]
* @returns {Promise<any>}
* @memberof Main
*/
protected async wfstart(data: any,localdata?:any): Promise<any> {
return new Promise((resolve: any, reject: any) => {
const _this: any = this;
const post: Promise<any> = _this.save({},false);
post.then((response:any) =>{
const arg:any = response.data;
if(this.viewparams){
Object.assign(arg,{viewparams:this.viewparams});
}
const result: Promise<any> = this.service.wfstart(_this.WFStartAction, JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator,localdata);
result.then((response: any) => {
if (!response || response.status !== 200) {
if(response.data){
this.$Notice.error({ title: '', desc: '工作流启动失败, ' + response.data.message });
}
return;
}
this.$Notice.info({ title: '', desc: '工作流启动成功' });
resolve(response);
}).catch((response: any) => {
if (response && response.status && response.data) {
this.$Notice.error({ title: '错误', desc: response.data.message });
reject(response);
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: '错误', desc: '系统异常' });
reject(response);
return;
}
reject(response);
});
}).catch((response: any) => {
if (response && response.status && response.data) {
this.$Notice.error({ title: '错误', desc: response.data.message });
reject(response);
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: '错误', desc: '系统异常' });
reject(response);
return;
}
reject(response);
})
});
}
/**
* 工作流提交
*
* @param {*} [data={}]
* @param {*} [localdata={}]
* @returns {Promise<any>}
* @memberof Main
*/
protected async wfsubmit(data: any,localdata?:any): Promise<any> {
return new Promise((resolve: any, reject: any) => {
const _this: any = this;
const arg: any = data[0];
Object.assign(arg,{viewparams:this.viewparams});
if (!arg.wfremodel || Object.is(arg.wfremodel, '')) {
return;
}
const post: Promise<any> = Object.is(arg.srfuf, '1')?this.service.update(this.updateAction, JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator):this.service.add(this.createAction,JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator);
post.then((response:any) =>{
const arg:any = response.data;
// 保存完成UI处理
this.onFormLoad(arg,'save');
this.$emit('save', arg);
this.$nextTick(() => {
this.formState.next({ type: 'save', data: arg });
});
// 准备提交参数
if(this.viewparams){
Object.assign(arg,{viewparams:this.viewparams});
}
const result: Promise<any> = this.service.wfsubmit(_this.WFSubmitAction, JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator,localdata);
result.then((response: any) => {
if (!response || response.status !== 200) {
if(response.data){
this.$Notice.error({ title: '', desc: '工作流提交失败, ' + response.data.message });
}
return;
}
this.onFormLoad(arg,'submit');
this.$store.dispatch('viewaction/datasaved', { viewtag: this.viewtag });
this.$Notice.info({ title: '', desc: '工作流提交成功' });
resolve(response);
}).catch((response: any) => {
if (response && response.status && response.data) {
this.$Notice.error({ title: '错误', desc: response.data.message });
reject(response);
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: '错误', desc: '系统异常' });
reject(response);
return;
}
reject(response);
});
}).catch((response: any) => {
if (response && response.status && response.data) {
this.$Notice.error({ title: '错误', desc: response.data.message });
reject(response);
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: '错误', desc: '系统异常' });
reject(response);
return;
}
reject(response);
})
})
}
/**
* 表单项更新
*
* @param {string} mode 界面行为名称
* @param {*} [data={}] 请求数据
* @param {string[]} updateDetails 更新项
* @param {boolean} [showloading] 是否显示加载状态
* @returns {void}
* @memberof Main
*/
protected updateFormItems(mode: string, data: any = {}, updateDetails: string[], showloading?: boolean): void {
if (!mode || (mode && Object.is(mode, ''))) {
return;
}
const arg: any = { ...data };
Object.assign(arg,this.viewparams);
const post: Promise<any> = this.service.frontLogic(mode,JSON.parse(JSON.stringify(this.context)),arg, showloading);
post.then((response: any) => {
if (!response || response.status !== 200) {
this.$Notice.error({ title: '错误', desc: '表单项更新失败' });
return;
}
const data = response.data;
const _data: any = {};
updateDetails.forEach((name: string) => {
if (!data.hasOwnProperty(name)) {
return;
}
Object.assign(_data, { [name]: data[name] });
});
this.setFormEnableCond(_data);
this.fillForm(_data,'updateFormItem');
this.formLogic({ name: '', newVal: null, oldVal: null });
this.dataChang.next(JSON.stringify(this.data));
this.$nextTick(() => {
this.formState.next({ type: 'updateformitem', ufimode: arg.srfufimode, data: _data });
});
}).catch((response: any) => {
if (response && response.status && response.data) {
this.$Notice.error({ title: '错误', desc: response.data.message });
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: '错误', desc: '系统异常' });
return;
}
});
}
/**
* 回车事件
*
* @param {*} $event
* @memberof Main
*/
protected onEnter($event: any): void {
}
/**
* 保存并退出
*
* @param {any[]} args
* @memberof Main
*/
protected saveAndExit(data:any[]):Promise<any>{
let _this = this;
return new Promise((resolve: any, reject: any) =>{
let arg: any = {};
if(data && data.length > 0){
Object.assign(arg,data[0]);
}
_this.currentAction = "saveAndExit";
_this.save([arg]).then((res) =>{
if(res){
_this.closeView(res.data);
}
resolve(res);
}).catch((error) =>{
reject(error);
})
})
}
/**
* 保存并新建
*
* @param {any[]} args
* @memberof Main
*/
protected saveAndNew(data:any[]):Promise<any>{
let _this = this;
return new Promise((resolve: any, reject: any) =>{
let arg: any = {};
if(data && data.length > 0){
Object.assign(arg,data[0]);
}
_this.currentAction = "saveAndNew";
_this.save([arg]).then((res) =>{
_this.ResetData(res);
_this.loadDraft({});
}).catch((error) =>{
reject(error);
})
})
}
/**
* 删除并退出
*
* @param {any[]} args
* @memberof Main
*/
protected removeAndExit(data:any[]):Promise<any>{
let _this = this;
return new Promise((resolve: any, reject: any) =>{
let arg: any = {};
if(data && data.length > 0){
Object.assign(arg,data[0]);
}
_this.remove([arg]).then((res) =>{
if(res){
_this.closeView(res.data);
}
resolve(res);
}).catch((error) =>{
reject(error);
})
})
}
/**
* 关系界面数据保存完成
*
* @param {any} $event
* @memberof Main
*/
protected drdatasaved($event:any){
let _this = this;
this.drcounter--;
if(this.drcounter > 0){
return;
}
this.save(this.drsaveopt, undefined, false).then((res) =>{
this.saveState(res);
this.drsaveopt = {};
if(Object.is(_this.currentAction, "saveAndNew")){
_this.ResetData(res);
_this.loadDraft({});
}else if(Object.is(_this.currentAction, "saveAndExit")){
if(res){
_this.closeView(res.data);
}
}
});
}
/**
* 新建默认值
* @memberof Main
*/
public createDefault(){
}
/**
* 更新默认值
* @memberof Main
*/
public updateDefault(){
}
}
</script>
<style lang='less'>
@import './main-form.less';
</style>
\ No newline at end of file
/**
* Main 部件模型
*
* @export
* @class MainModel
*/
export default class MainModel {
/**
* 获取数据项集合
*
* @returns {any[]}
* @memberof MainModel
*/
public getDataItems(): any[] {
return [
{
name: 'srfwfmemo',
prop: 'srfwfmemo',
dataType: 'TEXT',
},
// 前端新增修改标识,新增为"0",修改为"1"或未设值
{
name: 'srffrontuf',
prop: 'srffrontuf',
dataType: 'TEXT',
},
{
name: 'srforikey',
},
{
name: 'srfkey',
prop: 'id',
dataType: 'TEXT',
},
{
name: 'srfmajortext',
prop: 'name',
dataType: 'TEXT',
},
{
name: 'srftempmode',
},
{
name: 'srfuf',
},
{
name: 'srfdeid',
},
{
name: 'srfsourcekey',
},
{
name: 'bpmnfile',
prop: 'bpmnfile',
dataType: 'TEXT',
},
{
name: 'modelid',
prop: 'id',
dataType: 'TEXT',
},
{
name: 'wfremodel',
prop: 'id',
dataType: 'FONTKEY',
},
]
}
}
\ No newline at end of file
import { Http,Util,Errorlog } from '@/utils';
import ControlService from '@/widgets/control-service';
import WFREModelService from '@/service/wfremodel/wfremodel-service';
import MainModel from './main-form-model';
/**
* Main 部件服务对象
*
* @export
* @class MainService
*/
export default class MainService extends ControlService {
/**
* 流程模型服务对象
*
* @type {WFREModelService}
* @memberof MainService
*/
public appEntityService: WFREModelService = new WFREModelService({ $store: this.getStore() });
/**
* 设置从数据模式
*
* @type {boolean}
* @memberof MainService
*/
public setTempMode(){
this.isTempMode = false;
}
/**
* Creates an instance of MainService.
*
* @param {*} [opts={}]
* @memberof MainService
*/
constructor(opts: any = {}) {
super(opts);
this.model = new MainModel();
}
/**
* 处理数据
*
* @private
* @param {Promise<any>} promise
* @returns {Promise<any>}
* @memberof MainService
*/
private doItems(promise: Promise<any>, deKeyField: string, deName: string): Promise<any> {
return new Promise((resolve, reject) => {
promise.then((response: any) => {
if (response && response.status === 200) {
const data = response.data;
data.forEach((item:any,index:number) =>{
item[deName] = item[deKeyField];
data[index] = item;
});
resolve(data);
} else {
reject([])
}
}).catch((response: any) => {
reject([])
});
});
}
/**
* 获取跨实体数据集合
*
* @param {string} serviceName 服务名称
* @param {string} interfaceName 接口名称
* @param {*} data
* @param {boolean} [isloading]
* @returns {Promise<any[]>}
* @memberof MainService
*/
@Errorlog
public getItems(serviceName: string, interfaceName: string, context: any = {}, data: any, isloading?: boolean): Promise<any[]> {
return Promise.reject([])
}
/**
* 启动工作流
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @param {*} [localdata]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public wfstart(action: string,context: any = {},data: any = {}, isloading?: boolean,localdata?:any): Promise<any> {
data = this.handleWFData(data);
context = this.handleRequestData(action,context,data).context;
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](context,data, isloading,localdata);
} else {
result = this.appEntityService.WFStart(context,data, isloading,localdata);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 提交工作流
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @param {*} [localdata]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public wfsubmit(action: string,context: any = {}, data: any = {}, isloading?: boolean,localdata?:any): Promise<any> {
data = this.handleWFData(data,true);
context = this.handleRequestData(action,context,data).context;
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](context,data, isloading,localdata);
} else {
result = this.appEntityService.WFSubmit(context,data, isloading,localdata);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 添加数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public add(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
result = this.appEntityService.Create(Context,Data, isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 删除数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public delete(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
result = this.appEntityService.Remove(Context,Data, isloading);
}
result.then((response) => {
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 修改数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public update(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
result = this.appEntityService.Update(Context,Data, isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 查询数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public get(action: string,context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
result = this.appEntityService.Get(Context,Data, isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 加载草稿
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public loadDraft(action: string,context: any = {}, data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
//仿真主键数据
Data.id = Util.createUUID();
Data.wfremodel = Data.id;
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
result = this.appEntityService.GetDraft(Context,Data, isloading);
}
result.then((response) => {
this.handleResponse(action, response, true);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 前台逻辑
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public frontLogic(action:string,context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
return new Promise((resolve: any, reject: any)=>{
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
return Promise.reject({ status: 500, data: { title: '失败', message: '系统异常' } });
}
result.then((response) => {
this.handleResponse(action, response,true);
resolve(response);
}).catch(response => {
reject(response);
});
})
}
/**
* 处理请求数据
*
* @param action 行为
* @param data 数据
* @memberof MainService
*/
public handleRequestData(action: string,context:any, data: any = {}){
let mode: any = this.getMode();
if (!mode && mode.getDataItems instanceof Function) {
return data;
}
let formItemItems: any[] = mode.getDataItems();
let requestData:any = {};
formItemItems.forEach((item:any) =>{
if(item && item.dataType && Object.is(item.dataType,'FONTKEY')){
if(item && item.prop){
requestData[item.prop] = context[item.name];
}
}else{
if(item && item.prop){
requestData[item.prop] = data[item.name];
}
}
});
if(data && data.viewparams){
Object.assign(requestData,data.viewparams);
}
let tempContext:any = JSON.parse(JSON.stringify(context));
if(tempContext && tempContext.srfsessionid){
tempContext.srfsessionkey = tempContext.srfsessionid;
delete tempContext.srfsessionid;
}
return {context:tempContext,data:requestData};
}
}
\ No newline at end of file
.ivu-tabs-no-animation>.ivu-tabs-content{
padding: 0 16px;
}
.ivu-card-head{
padding: 14px 0;
}
.app-form {
overflow: auto;
> .ivu-row {
> .ivu-tabs {
height: 100%;
display: flex;
flex-direction: column;
> .ivu-tabs-content {
flex-grow: 1;
overflow: auto;
> .ivu-tabs-tabpane {
height: 100%;
}
}
}
}
}
.app-tabpanel-flex {
height: 100%;
> .ivu-tabs-content {
height: calc(100% - 52px);
> .ivu-tabs-tabpane {
height: 100%;
}
}
}
.app-form {
>.ivu-row:nth-child(2) {
>.ivu-col:nth-child(1) {
>.ivu-row.app-form-group.app-group-hiddden-caption:nth-child(1) {
margin-top: 12px;
}
}
}
}
// 表单行间距
.app-form{
.app-form-item{
margin-bottom: 20px;
}
}
// this is less
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import MainBase from './main-form-base.vue';
@Component({
components: {
}
})
export default class Main extends MainBase {
}
</script>
\ No newline at end of file
......@@ -37,11 +37,6 @@
git clone -b master $para2 ibzwf/
export NODE_OPTIONS=--max-old-space-size=4096
cd ibzwf/
mvn clean package -Papi
cd ibzwf-provider/ibzwf-provider-api
mvn -Papi docker:build
mvn -Papi docker:push
docker -H $para1 stack deploy --compose-file=src/main/docker/ibzwf-provider-api.yaml ibzlab-rt --with-registry-auth
</command>
</hudson.tasks.Shell>
</builders>
......
......@@ -4,6 +4,10 @@ server:
#zuul网关路由设置
zuul:
routes:
wf_model:
path: /wfremodels/**
serviceId: ibzwf-api
stripPrefix: false
wf_group_member:
path: /wfmembers/**
serviceId: ibzwf-api
......
package cn.ibizlab.core.workflow.domain;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.math.BigInteger;
import java.util.HashMap;
import java.math.BigDecimal;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import cn.ibizlab.util.domain.EntityBase;
import cn.ibizlab.util.annotation.DEField;
import cn.ibizlab.util.enums.DEPredefinedFieldType;
import cn.ibizlab.util.enums.DEFieldDefaultValueType;
import java.io.Serializable;
import lombok.Data;
import org.springframework.data.annotation.Transient;
import cn.ibizlab.util.domain.EntityClient;
/**
* ServiceApi [流程模型] 对象
*/
@Data
public class WFREModel extends EntityClient implements Serializable {
/**
* ID
*/
@DEField(name = "modelid" , isKeyField=true)
@JSONField(name = "id")
@JsonProperty("id")
private String id;
/**
* 名称
*/
@DEField(name = "modelname")
@JSONField(name = "name")
@JsonProperty("name")
private String name;
/**
* BPMN
*/
@JSONField(name = "bPMNFile")
@JsonProperty("bPMNFile")
private String bpmnfile;
/**
* 设置 [名称]
*/
public void setName(String name){
this.name = name ;
this.modify("modelname",name);
}
/**
* 设置 [BPMN]
*/
public void setBpmnfile(String bpmnfile){
this.bpmnfile = bpmnfile ;
this.modify("bpmnfile",bpmnfile);
}
}
package cn.ibizlab.core.workflow.filter;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.alibaba.fastjson.annotation.JSONField;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import cn.ibizlab.util.filter.SearchContextBase;
/**
* ServiceApi数据实体[WFREModel] 查询条件对象
*/
@Slf4j
@Data
public class WFREModelSearchContext extends SearchContextBase {
private String n_modelname_like;//[名称]
}
package cn.ibizlab.core.workflow.service;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.math.BigInteger;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import com.alibaba.fastjson.JSONObject;
import cn.ibizlab.core.workflow.domain.WFREModel;
import cn.ibizlab.core.workflow.filter.WFREModelSearchContext;
/**
* 实体[WFREModel] 服务对象接口
*/
public interface IWFREModelService{
boolean update(WFREModel et) ;
void updateBatch(List<WFREModel> list) ;
boolean save(WFREModel et) ;
void saveBatch(List<WFREModel> list) ;
WFREModel get(String key) ;
boolean create(WFREModel et) ;
void createBatch(List<WFREModel> list) ;
boolean checkKey(WFREModel et) ;
boolean remove(String key) ;
void removeBatch(Collection<String> idList) ;
WFREModel getDraft(WFREModel et) ;
Page<WFREModel> searchDefault(WFREModelSearchContext context) ;
}
package cn.ibizlab.core.workflow.service.impl;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.HashSet;
import java.util.HashMap;
import java.util.Collection;
import java.util.Objects;
import java.util.Optional;
import java.math.BigInteger;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cglib.beans.BeanCopier;
import org.springframework.stereotype.Service;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.util.ObjectUtils;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.context.annotation.Lazy;
import cn.ibizlab.core.workflow.domain.WFREModel;
import cn.ibizlab.core.workflow.filter.WFREModelSearchContext;
import cn.ibizlab.core.workflow.service.IWFREModelService;
import cn.ibizlab.util.helper.CachedBeanCopier;
/**
* 实体[流程模型] 无存储服务对象接口实现
*/
@Slf4j
@Service
public class WFREModelServiceImpl implements IWFREModelService {
@Override
public boolean update(WFREModel et) {
return true;
}
public void updateBatch(List<WFREModel> list){
}
@Override
@Transactional
public boolean save(WFREModel et) {
return true;
}
@Override
public void saveBatch(List<WFREModel> list) {
}
@Override
public WFREModel get(String id) {
return null;
}
@Override
public boolean create(WFREModel et) {
return true;
}
public void createBatch(List<WFREModel> list){
}
@Override
public boolean checkKey(WFREModel et) {
return false;
}
@Override
public boolean remove(String id) {
return true;
}
public void removeBatch(Collection<String> idList){
}
@Override
public WFREModel getDraft(WFREModel et) {
return null;
}
/**
* 查询集合 DEFAULT
*/
@Override
public Page<WFREModel> searchDefault(WFREModelSearchContext context) {
return null;
}
}
......@@ -4,6 +4,13 @@
"predefineddatarange":[{"id":"ALL","name":"全部数据"},{"id":"CURORG","name":"当前单位"},{"id":"PORG","name":"上级单位"},{"id":"SORG","name":"下级单位"},{"id":"CURORGDEPT","name":"当前部门"},{"id":"PORGDEPT","name":"上级部门"},{"id":"SORGDEPT","name":"下级部门"}],
"entities":[
{
"dename":"WFREModel",
"delogicname":"流程模型",
"sysmoudle":{"id":"WORKFLOW","name":"workflow"},
"dedataset":[{"id":"Default" , "name":"DEFAULT"}],
"deaction":[{"id":"Update" , "name":"Update" , "type":"BUILTIN" },{"id":"Save" , "name":"Save" , "type":"BUILTIN" },{"id":"Get" , "name":"Get" , "type":"BUILTIN" },{"id":"Create" , "name":"Create" , "type":"BUILTIN" },{"id":"CheckKey" , "name":"CheckKey" , "type":"BUILTIN" },{"id":"Remove" , "name":"Remove" , "type":"BUILTIN" },{"id":"GetDraft" , "name":"GetDraft" , "type":"BUILTIN" }]
}
, {
"dename":"WFMember",
"delogicname":"成员",
"sysmoudle":{"id":"WORKFLOW","name":"workflow"},
......
......@@ -69,8 +69,20 @@
</column>
</createTable>
</changeSet>
<!--输出实体[WF_MODEL]数据结构 -->
<changeSet author="a_A_5d9d78509" id="tab-wf_model-18-6">
<createTable tableName="IBZWFMODEL">
<column name="MODELID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_WF_MODEL_MODELID"/>
</column>
<column name="MODELNAME" remarks="" type="VARCHAR(100)">
</column>
<column name="BPMNFILE" remarks="" type="VARCHAR(1000)">
</column>
</createTable>
</changeSet>
<!--输出实体[WF_TASK_WAY]数据结构 -->
<changeSet author="a_A_5d9d78509" id="tab-wf_task_way-23-6">
<changeSet author="a_A_5d9d78509" id="tab-wf_task_way-23-7">
<createTable tableName="IBZWFTASKWAY">
<column name="WAYID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_WF_TASK_WAY_WAYID"/>
......@@ -92,7 +104,7 @@
</createTable>
</changeSet>
<!--输出实体[WF_DEFINITION]数据结构 -->
<changeSet author="a_A_5d9d78509" id="tab-wf_definition-50-7">
<changeSet author="a_A_5d9d78509" id="tab-wf_definition-50-8">
<createTable tableName="IBZWFDEFINITION">
<column name="DEFINITIONKEY" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_WF_DEFINITION_DEFINITIONKEY"/>
......@@ -114,7 +126,7 @@
</createTable>
</changeSet>
<!--输出实体[WF_GROUP_MEMBER]数据结构 -->
<changeSet author="a_A_5d9d78509" id="tab-wf_group_member-39-8">
<changeSet author="a_A_5d9d78509" id="tab-wf_group_member-39-9">
<createTable tableName="IBZWFMEMBER">
<column name="MEMBERID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_WF_GROUP_MEMBER_MEMBERID"/>
......@@ -128,7 +140,7 @@
</createTable>
</changeSet>
<!--输出实体[WF_TASK]数据结构 -->
<changeSet author="a_A_5d9d78509" id="tab-wf_task-17-9">
<changeSet author="a_A_5d9d78509" id="tab-wf_task-17-10">
<createTable tableName="IBZTASK">
<column name="TASKID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_WF_TASK_TASKID"/>
......@@ -151,13 +163,14 @@
<!--输出实体[WF_USER]外键关系 -->
<!--输出实体[WF_GROUP]外键关系 -->
<!--输出实体[WF_INSTANCE]外键关系 -->
<!--输出实体[WF_MODEL]外键关系 -->
<!--输出实体[WF_TASK_WAY]外键关系 -->
<!--输出实体[WF_DEFINITION]外键关系 -->
<!--输出实体[WF_GROUP_MEMBER]外键关系 -->
<changeSet author="a_A_5d9d78509" id="fk-wf_group_member-39-10">
<changeSet author="a_A_5d9d78509" id="fk-wf_group_member-39-11">
<addForeignKeyConstraint baseColumnNames="GROUPID" baseTableName="IBZWFMEMBER" constraintName="DER1N_WF_GROUP_MEMBER_WF_GROUP" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="GROUPID" referencedTableName="IBZWFGROUP" validate="true"/>
</changeSet>
<changeSet author="a_A_5d9d78509" id="fk-wf_group_member-39-11">
<changeSet author="a_A_5d9d78509" id="fk-wf_group_member-39-12">
<addForeignKeyConstraint baseColumnNames="USERID" baseTableName="IBZWFMEMBER" constraintName="DER1N_WF_GROUP_MEMBER_WF_USER_" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="USERID" referencedTableName="IBZUSER" validate="true"/>
</changeSet>
<!--输出实体[WF_TASK]外键关系 -->
......
......@@ -9,6 +9,6 @@ CMD echo "The application will start in ${IBZ_SLEEP}s..." && \
sleep ${IBZ_SLEEP} && \
java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar /ibzwf-provider-api.jar
EXPOSE 40003
EXPOSE 8081
ADD ibzwf-provider-api.jar /ibzwf-provider-api.jar
......@@ -3,11 +3,9 @@ services:
ibzwf-provider-api:
image: registry.cn-shanghai.aliyuncs.com/ibizsys/ibzwf-provider-api:latest
ports:
- "40003:40003"
- "8081:8081"
networks:
- agent_network
environment:
SPRING_CLOUD_NACOS_DISCOVERY_IP: 172.16.180.237
deploy:
mode: replicated
replicas: 1
......
package cn.ibizlab.api.dto;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.math.BigInteger;
import java.util.Map;
import java.util.HashMap;
import java.io.Serializable;
import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.alibaba.fastjson.annotation.JSONField;
import cn.ibizlab.util.domain.DTOBase;
import lombok.Data;
/**
* 服务DTO对象[WFREModelDTO]
*/
@Data
public class WFREModelDTO extends DTOBase implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 属性 [MODELID]
*
*/
@JSONField(name = "id")
@JsonProperty("id")
private String id;
/**
* 属性 [MODELNAME]
*
*/
@JSONField(name = "name")
@JsonProperty("name")
private String name;
/**
* 属性 [BPMNFILE]
*
*/
@JSONField(name = "bpmnfile")
@JsonProperty("bpmnfile")
private String bpmnfile;
/**
* 设置 [MODELNAME]
*/
public void setName(String name){
this.name = name ;
this.modify("modelname",name);
}
/**
* 设置 [BPMNFILE]
*/
public void setBpmnfile(String bpmnfile){
this.bpmnfile = bpmnfile ;
this.modify("bpmnfile",bpmnfile);
}
}
package cn.ibizlab.api.mapping;
import org.mapstruct.*;
import cn.ibizlab.core.workflow.domain.WFREModel;
import cn.ibizlab.api.dto.WFREModelDTO;
import cn.ibizlab.util.domain.MappingBase;
import org.mapstruct.factory.Mappers;
@Mapper(componentModel = "spring", uses = {},
nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE,
nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS)
public interface WFREModelMapping extends MappingBase<WFREModelDTO, WFREModel> {
}
package cn.ibizlab.api.rest;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.math.BigInteger;
import java.util.HashMap;
import lombok.extern.slf4j.Slf4j;
import com.alibaba.fastjson.JSONObject;
import javax.servlet.ServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cglib.beans.BeanCopier;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.http.HttpStatus;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.util.StringUtils;
import org.springframework.context.annotation.Lazy;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import cn.ibizlab.api.dto.*;
import cn.ibizlab.api.mapping.*;
import cn.ibizlab.core.workflow.domain.WFREModel;
import cn.ibizlab.core.workflow.service.IWFREModelService;
import cn.ibizlab.core.workflow.filter.WFREModelSearchContext;
@Slf4j
@Api(tags = {"WFREModel" })
@RestController("api-wfremodel")
@RequestMapping("")
public class WFREModelResource {
@Autowired
private IWFREModelService wfremodelService;
@Autowired
@Lazy
private WFREModelMapping wfremodelMapping;
@PreAuthorize("hasPermission(#wfremodel_id,'Update',{this.getEntity(),'None'})")
@ApiOperation(value = "Update", tags = {"WFREModel" }, notes = "Update")
@RequestMapping(method = RequestMethod.PUT, value = "/wfremodels/{wfremodel_id}")
@Transactional
public ResponseEntity<WFREModelDTO> update(@PathVariable("wfremodel_id") String wfremodel_id, @RequestBody WFREModelDTO wfremodeldto) {
WFREModel domain = wfremodelMapping.toDomain(wfremodeldto);
domain.setId(wfremodel_id);
wfremodelService.update(domain);
WFREModelDTO dto = wfremodelMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasPermission(#wfremodel_id,'Update',{this.getEntity(),'None'})")
@ApiOperation(value = "UpdateBatch", tags = {"WFREModel" }, notes = "UpdateBatch")
@RequestMapping(method = RequestMethod.PUT, value = "/wfremodels/batch")
public ResponseEntity<Boolean> updateBatch(@RequestBody List<WFREModelDTO> wfremodeldtos) {
wfremodelService.updateBatch(wfremodelMapping.toDomain(wfremodeldtos));
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@ApiOperation(value = "Save", tags = {"WFREModel" }, notes = "Save")
@RequestMapping(method = RequestMethod.POST, value = "/wfremodels/save")
public ResponseEntity<Boolean> save(@RequestBody WFREModelDTO wfremodeldto) {
return ResponseEntity.status(HttpStatus.OK).body(wfremodelService.save(wfremodelMapping.toDomain(wfremodeldto)));
}
@ApiOperation(value = "SaveBatch", tags = {"WFREModel" }, notes = "SaveBatch")
@RequestMapping(method = RequestMethod.POST, value = "/wfremodels/savebatch")
public ResponseEntity<Boolean> saveBatch(@RequestBody List<WFREModelDTO> wfremodeldtos) {
wfremodelService.saveBatch(wfremodelMapping.toDomain(wfremodeldtos));
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasPermission(#wfremodel_id,'Get',{this.getEntity(),'None'})")
@ApiOperation(value = "Get", tags = {"WFREModel" }, notes = "Get")
@RequestMapping(method = RequestMethod.GET, value = "/wfremodels/{wfremodel_id}")
public ResponseEntity<WFREModelDTO> get(@PathVariable("wfremodel_id") String wfremodel_id) {
WFREModel domain = wfremodelService.get(wfremodel_id);
WFREModelDTO dto = wfremodelMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasPermission('','Create',{this.getEntity(),'None'})")
@ApiOperation(value = "Create", tags = {"WFREModel" }, notes = "Create")
@RequestMapping(method = RequestMethod.POST, value = "/wfremodels")
@Transactional
public ResponseEntity<WFREModelDTO> create(@RequestBody WFREModelDTO wfremodeldto) {
WFREModel domain = wfremodelMapping.toDomain(wfremodeldto);
wfremodelService.create(domain);
WFREModelDTO dto = wfremodelMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasPermission('','Create',{this.getEntity(),'None'})")
@ApiOperation(value = "createBatch", tags = {"WFREModel" }, notes = "createBatch")
@RequestMapping(method = RequestMethod.POST, value = "/wfremodels/batch")
public ResponseEntity<Boolean> createBatch(@RequestBody List<WFREModelDTO> wfremodeldtos) {
wfremodelService.createBatch(wfremodelMapping.toDomain(wfremodeldtos));
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@ApiOperation(value = "CheckKey", tags = {"WFREModel" }, notes = "CheckKey")
@RequestMapping(method = RequestMethod.POST, value = "/wfremodels/checkkey")
public ResponseEntity<Boolean> checkKey(@RequestBody WFREModelDTO wfremodeldto) {
return ResponseEntity.status(HttpStatus.OK).body(wfremodelService.checkKey(wfremodelMapping.toDomain(wfremodeldto)));
}
@PreAuthorize("hasPermission('Remove',{#wfremodel_id,{this.getEntity(),'None'}})")
@ApiOperation(value = "Remove", tags = {"WFREModel" }, notes = "Remove")
@RequestMapping(method = RequestMethod.DELETE, value = "/wfremodels/{wfremodel_id}")
@Transactional
public ResponseEntity<Boolean> remove(@PathVariable("wfremodel_id") String wfremodel_id) {
return ResponseEntity.status(HttpStatus.OK).body(wfremodelService.remove(wfremodel_id));
}
@ApiOperation(value = "RemoveBatch", tags = {"WFREModel" }, notes = "RemoveBatch")
@RequestMapping(method = RequestMethod.DELETE, value = "/wfremodels/batch")
public ResponseEntity<Boolean> removeBatch(@RequestBody List<String> ids) {
wfremodelService.removeBatch(ids);
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@ApiOperation(value = "GetDraft", tags = {"WFREModel" }, notes = "GetDraft")
@RequestMapping(method = RequestMethod.GET, value = "/wfremodels/getdraft")
public ResponseEntity<WFREModelDTO> getDraft() {
return ResponseEntity.status(HttpStatus.OK).body(wfremodelMapping.toDto(wfremodelService.getDraft(new WFREModel())));
}
@PreAuthorize("hasPermission('Get',{#context,'Default',this.getEntity(),'None'})")
@ApiOperation(value = "fetchDEFAULT", tags = {"WFREModel" } ,notes = "fetchDEFAULT")
@RequestMapping(method= RequestMethod.GET , value="/wfremodels/fetchdefault")
public ResponseEntity<List<WFREModelDTO>> fetchDefault(WFREModelSearchContext context) {
Page<WFREModel> domains = wfremodelService.searchDefault(context) ;
List<WFREModelDTO> list = wfremodelMapping.toDto(domains.getContent());
return ResponseEntity.status(HttpStatus.OK)
.header("x-page", String.valueOf(context.getPageable().getPageNumber()))
.header("x-per-page", String.valueOf(context.getPageable().getPageSize()))
.header("x-total", String.valueOf(domains.getTotalElements()))
.body(list);
}
@PreAuthorize("hasPermission('Get',{#context,'Default',this.getEntity(),'None'})")
@ApiOperation(value = "searchDEFAULT", tags = {"WFREModel" } ,notes = "searchDEFAULT")
@RequestMapping(method= RequestMethod.GET , value="/wfremodels/searchdefault")
public ResponseEntity<Page<WFREModelDTO>> searchDefault(WFREModelSearchContext context) {
Page<WFREModel> domains = wfremodelService.searchDefault(context) ;
return ResponseEntity.status(HttpStatus.OK)
.body(new PageImpl(wfremodelMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements()));
}
/**
* 用户权限校验
* @return
*/
public WFREModel getEntity(){
return new WFREModel();
}
}
server:
port: 40003
\ No newline at end of file
port: 8081
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册