提交 5564c821 编写于 作者: ibizdev's avatar ibizdev

zoo457790531 发布系统代码 [ibiz-rt,ibizlab-runtime]

上级 5e510c6e
...@@ -671,12 +671,12 @@ ...@@ -671,12 +671,12 @@
"viewname": "WFUserPickupGridView", "viewname": "WFUserPickupGridView",
"viewtag": "c9c73c8d2e61bd29a304622f3d39b522" "viewtag": "c9c73c8d2e61bd29a304622f3d39b522"
}, },
"meta_dynamicmodeldynainstgridview": { "metadynamicmodeldynainstgridview": {
"title": "动态模型表格视图", "title": "动态模型表格视图",
"caption": "动态模型表格视图", "caption": "动态模型表格视图",
"viewtype": "DEGRIDVIEW", "viewtype": "DEGRIDVIEW",
"viewmodule": "disk", "viewmodule": "disk",
"viewname": "META_DYNAMICMODELDynaInstGridView", "viewname": "MetaDynamicModelDynaInstGridView",
"viewtag": "cec3236f5a1f742f9b91f313506ccc6c" "viewtag": "cec3236f5a1f742f9b91f313506ccc6c"
}, },
"sysdepartmentpickupview": { "sysdepartmentpickupview": {
...@@ -711,6 +711,14 @@ ...@@ -711,6 +711,14 @@
"viewname": "JobsInfoGridView", "viewname": "JobsInfoGridView",
"viewtag": "e4856779577562e9880855e6c66d63e5" "viewtag": "e4856779577562e9880855e6c66d63e5"
}, },
"metadynamicmodeleditview": {
"title": "动态模型编辑视图",
"caption": "动态模型",
"viewtype": "DEEDITVIEW",
"viewmodule": "disk",
"viewname": "MetaDynamicModelEditView",
"viewtag": "e8892afaebe9a899e5d528d5b55d3cc5"
},
"sysemployeepickupgridview": { "sysemployeepickupgridview": {
"title": "人员选择表格视图", "title": "人员选择表格视图",
"caption": "人员", "caption": "人员",
......
...@@ -24,6 +24,30 @@ function getLocaleResourceBase(){ ...@@ -24,6 +24,30 @@ function getLocaleResourceBase(){
caption: commonLogic.appcommonhandle("动态模型表格视图",null), caption: commonLogic.appcommonhandle("动态模型表格视图",null),
title: commonLogic.appcommonhandle("动态模型表格视图",null), title: commonLogic.appcommonhandle("动态模型表格视图",null),
}, },
editview: {
caption: commonLogic.appcommonhandle("动态模型",null),
title: commonLogic.appcommonhandle("动态模型编辑视图",null),
},
},
main_form: {
details: {
group1: commonLogic.appcommonhandle("动态模型基本信息",null),
formpage1: commonLogic.appcommonhandle("基本信息",null),
srforikey: commonLogic.appcommonhandle("",null),
srfkey: commonLogic.appcommonhandle("配置标识",null),
srfmajortext: commonLogic.appcommonhandle("配置名称",null),
srftempmode: commonLogic.appcommonhandle("",null),
srfuf: commonLogic.appcommonhandle("",null),
srfdeid: commonLogic.appcommonhandle("",null),
srfsourcekey: commonLogic.appcommonhandle("",null),
configname: commonLogic.appcommonhandle("配置名称",null),
formitem: commonLogic.appcommonhandle("文件",null),
systemid: commonLogic.appcommonhandle("系统",null),
pdynainstid: commonLogic.appcommonhandle("父实例",null),
configid: commonLogic.appcommonhandle("配置标识",null),
},
uiactions: {
},
}, },
dynainst_form: { dynainst_form: {
details: { details: {
...@@ -149,6 +173,16 @@ function getLocaleResourceBase(){ ...@@ -149,6 +173,16 @@ function getLocaleResourceBase(){
tip: commonLogic.appcommonhandle("过滤",null), tip: commonLogic.appcommonhandle("过滤",null),
}, },
}, },
editviewtoolbar_toolbar: {
tbitem1: {
caption: commonLogic.appcommonhandle("保存并关闭",null),
tip: commonLogic.appcommonhandle("保存并关闭",null),
},
tbitem2: {
caption: commonLogic.appcommonhandle("关闭",null),
tip: commonLogic.appcommonhandle("关闭",null),
},
},
dynainstgridviewtoolbar_toolbar: { dynainstgridviewtoolbar_toolbar: {
tbitem1_publish: { tbitem1_publish: {
caption: commonLogic.appcommonhandle("发布模型",null), caption: commonLogic.appcommonhandle("发布模型",null),
......
...@@ -24,6 +24,30 @@ function getLocaleResourceBase(){ ...@@ -24,6 +24,30 @@ function getLocaleResourceBase(){
caption: commonLogic.appcommonhandle("动态模型表格视图",null), caption: commonLogic.appcommonhandle("动态模型表格视图",null),
title: commonLogic.appcommonhandle("动态模型表格视图",null), title: commonLogic.appcommonhandle("动态模型表格视图",null),
}, },
editview: {
caption: commonLogic.appcommonhandle("动态模型",null),
title: commonLogic.appcommonhandle("动态模型编辑视图",null),
},
},
main_form: {
details: {
group1: commonLogic.appcommonhandle("动态模型基本信息",null),
formpage1: commonLogic.appcommonhandle("基本信息",null),
srforikey: commonLogic.appcommonhandle("",null),
srfkey: commonLogic.appcommonhandle("配置标识",null),
srfmajortext: commonLogic.appcommonhandle("配置名称",null),
srftempmode: commonLogic.appcommonhandle("",null),
srfuf: commonLogic.appcommonhandle("",null),
srfdeid: commonLogic.appcommonhandle("",null),
srfsourcekey: commonLogic.appcommonhandle("",null),
configname: commonLogic.appcommonhandle("配置名称",null),
formitem: commonLogic.appcommonhandle("文件",null),
systemid: commonLogic.appcommonhandle("系统",null),
pdynainstid: commonLogic.appcommonhandle("父实例",null),
configid: commonLogic.appcommonhandle("配置标识",null),
},
uiactions: {
},
}, },
dynainst_form: { dynainst_form: {
details: { details: {
...@@ -149,6 +173,16 @@ function getLocaleResourceBase(){ ...@@ -149,6 +173,16 @@ function getLocaleResourceBase(){
tip: commonLogic.appcommonhandle("Filter",null), tip: commonLogic.appcommonhandle("Filter",null),
}, },
}, },
editviewtoolbar_toolbar: {
tbitem1: {
caption: commonLogic.appcommonhandle("Save And Close",null),
tip: commonLogic.appcommonhandle("Save And Close Window",null),
},
tbitem2: {
caption: commonLogic.appcommonhandle("关闭",null),
tip: commonLogic.appcommonhandle("关闭",null),
},
},
dynainstgridviewtoolbar_toolbar: { dynainstgridviewtoolbar_toolbar: {
tbitem1_publish: { tbitem1_publish: {
caption: commonLogic.appcommonhandle("发布模型",null), caption: commonLogic.appcommonhandle("发布模型",null),
......
...@@ -24,6 +24,30 @@ function getLocaleResourceBase(){ ...@@ -24,6 +24,30 @@ function getLocaleResourceBase(){
caption: commonLogic.appcommonhandle("动态模型表格视图",null), caption: commonLogic.appcommonhandle("动态模型表格视图",null),
title: commonLogic.appcommonhandle("动态模型表格视图",null), title: commonLogic.appcommonhandle("动态模型表格视图",null),
}, },
editview: {
caption: commonLogic.appcommonhandle("动态模型",null),
title: commonLogic.appcommonhandle("动态模型编辑视图",null),
},
},
main_form: {
details: {
group1: commonLogic.appcommonhandle("动态模型基本信息",null),
formpage1: commonLogic.appcommonhandle("基本信息",null),
srforikey: commonLogic.appcommonhandle("",null),
srfkey: commonLogic.appcommonhandle("配置标识",null),
srfmajortext: commonLogic.appcommonhandle("配置名称",null),
srftempmode: commonLogic.appcommonhandle("",null),
srfuf: commonLogic.appcommonhandle("",null),
srfdeid: commonLogic.appcommonhandle("",null),
srfsourcekey: commonLogic.appcommonhandle("",null),
configname: commonLogic.appcommonhandle("配置名称",null),
formitem: commonLogic.appcommonhandle("文件",null),
systemid: commonLogic.appcommonhandle("系统",null),
pdynainstid: commonLogic.appcommonhandle("父实例",null),
configid: commonLogic.appcommonhandle("配置标识",null),
},
uiactions: {
},
}, },
dynainst_form: { dynainst_form: {
details: { details: {
...@@ -149,6 +173,16 @@ function getLocaleResourceBase(){ ...@@ -149,6 +173,16 @@ function getLocaleResourceBase(){
tip: commonLogic.appcommonhandle("过滤",null), tip: commonLogic.appcommonhandle("过滤",null),
}, },
}, },
editviewtoolbar_toolbar: {
tbitem1: {
caption: commonLogic.appcommonhandle("保存并关闭",null),
tip: commonLogic.appcommonhandle("保存并关闭",null),
},
tbitem2: {
caption: commonLogic.appcommonhandle("关闭",null),
tip: commonLogic.appcommonhandle("关闭",null),
},
},
dynainstgridviewtoolbar_toolbar: { dynainstgridviewtoolbar_toolbar: {
tbitem1_publish: { tbitem1_publish: {
caption: commonLogic.appcommonhandle("发布模型",null), caption: commonLogic.appcommonhandle("发布模型",null),
......
...@@ -679,12 +679,12 @@ mock.onGet('./assets/json/view-config.json').reply((config: any) => { ...@@ -679,12 +679,12 @@ mock.onGet('./assets/json/view-config.json').reply((config: any) => {
"viewname": "WFUserPickupGridView", "viewname": "WFUserPickupGridView",
"viewtag": "c9c73c8d2e61bd29a304622f3d39b522" "viewtag": "c9c73c8d2e61bd29a304622f3d39b522"
}, },
"meta_dynamicmodeldynainstgridview": { "metadynamicmodeldynainstgridview": {
"title": "动态模型表格视图", "title": "动态模型表格视图",
"caption": "动态模型表格视图", "caption": "动态模型表格视图",
"viewtype": "DEGRIDVIEW", "viewtype": "DEGRIDVIEW",
"viewmodule": "disk", "viewmodule": "disk",
"viewname": "META_DYNAMICMODELDynaInstGridView", "viewname": "MetaDynamicModelDynaInstGridView",
"viewtag": "cec3236f5a1f742f9b91f313506ccc6c" "viewtag": "cec3236f5a1f742f9b91f313506ccc6c"
}, },
"sysdepartmentpickupview": { "sysdepartmentpickupview": {
...@@ -719,6 +719,14 @@ mock.onGet('./assets/json/view-config.json').reply((config: any) => { ...@@ -719,6 +719,14 @@ mock.onGet('./assets/json/view-config.json').reply((config: any) => {
"viewname": "JobsInfoGridView", "viewname": "JobsInfoGridView",
"viewtag": "e4856779577562e9880855e6c66d63e5" "viewtag": "e4856779577562e9880855e6c66d63e5"
}, },
"metadynamicmodeleditview": {
"title": "动态模型编辑视图",
"caption": "动态模型",
"viewtype": "DEEDITVIEW",
"viewmodule": "disk",
"viewname": "MetaDynamicModelEditView",
"viewtag": "e8892afaebe9a899e5d528d5b55d3cc5"
},
"sysemployeepickupgridview": { "sysemployeepickupgridview": {
"title": "人员选择表格视图", "title": "人员选择表格视图",
"caption": "人员", "caption": "人员",
......
<template>
<div class='view-container degridview meta-dynamic-model-dyna-inst-grid-view'>
<app-studioaction :viewTitle="$t(model.srfCaption)" viewName="metadynamicmodeldynainstgridview"></app-studioaction>
<card class='view-card ' :dis-hover="true" :bordered="false">
<div slot='title' class="header-container">
<span class='caption-info' :title="$t(model.srfCaption)">{{$t(model.srfCaption)}}</span>
</div>
<div class='view-top-messages'>
</div>
<div class='content-container'>
<div style='margin-bottom: 6px;'>
<i-input v-show="!isExpandSearchForm" v-model="query" search enter-button @on-search="onSearch($event)" class='quick-search-input' style='max-width: 400px;padding-left: 24px' placeholder="配置名称" />
<div class='pull-right'>
<div class='toolbar-container'>
<tooltip :transfer="true" :max-width="600">
<i-button v-show="toolBarModels.tbitem1_publish.visabled" :disabled="toolBarModels.tbitem1_publish.disabled" class='' v-loading:i-button @click="toolbar_click({ tag: 'tbitem1_publish' }, $event)">
<i class=''></i>
<span class='caption'>{{$t('entities.metadynamicmodel.dynainstgridviewtoolbar_toolbar.tbitem1_publish.caption')}}</span>
</i-button>
<div slot='content'>{{$t('entities.metadynamicmodel.dynainstgridviewtoolbar_toolbar.tbitem1_publish.tip')}}</div>
</tooltip>
<span class='seperator'>|</span>
<tooltip :transfer="true" :max-width="600">
<i-button v-show="toolBarModels.tbitem3.visabled" :disabled="toolBarModels.tbitem3.disabled" class='' v-loading:i-button @click="toolbar_click({ tag: 'tbitem3' }, $event)">
<i class='fa fa-file-text-o'></i>
<span class='caption'>{{$t('entities.metadynamicmodel.dynainstgridviewtoolbar_toolbar.tbitem3.caption')}}</span>
</i-button>
<div slot='content'>{{$t('entities.metadynamicmodel.dynainstgridviewtoolbar_toolbar.tbitem3.tip')}}</div>
</tooltip>
<tooltip :transfer="true" :max-width="600">
<i-button v-show="toolBarModels.tbitem4.visabled" :disabled="toolBarModels.tbitem4.disabled" class='' v-loading:i-button @click="toolbar_click({ tag: 'tbitem4' }, $event)">
<i class='fa fa-edit'></i>
<span class='caption'>{{$t('entities.metadynamicmodel.dynainstgridviewtoolbar_toolbar.tbitem4.caption')}}</span>
</i-button>
<div slot='content'>{{$t('entities.metadynamicmodel.dynainstgridviewtoolbar_toolbar.tbitem4.tip')}}</div>
</tooltip>
<tooltip :transfer="true" :max-width="600">
<i-button v-show="toolBarModels.tbitem6.visabled" :disabled="toolBarModels.tbitem6.disabled" class='' v-loading:i-button @click="toolbar_click({ tag: 'tbitem6' }, $event)">
<i class='fa fa-copy'></i>
<span class='caption'>{{$t('entities.metadynamicmodel.dynainstgridviewtoolbar_toolbar.tbitem6.caption')}}</span>
</i-button>
<div slot='content'>{{$t('entities.metadynamicmodel.dynainstgridviewtoolbar_toolbar.tbitem6.tip')}}</div>
</tooltip>
<span class='seperator'>|</span>
<tooltip :transfer="true" :max-width="600">
<i-button v-show="toolBarModels.tbitem8.visabled" :disabled="toolBarModels.tbitem8.disabled" class='' v-loading:i-button @click="toolbar_click({ tag: 'tbitem8' }, $event)">
<i class='fa fa-remove'></i>
<span class='caption'>{{$t('entities.metadynamicmodel.dynainstgridviewtoolbar_toolbar.tbitem8.caption')}}</span>
</i-button>
<div slot='content'>{{$t('entities.metadynamicmodel.dynainstgridviewtoolbar_toolbar.tbitem8.tip')}}</div>
</tooltip>
<span class='seperator'>|</span>
<tooltip :transfer="true" :max-width="600">
<app-export-excel :item="toolBarModels.tbitem13" :caption="$t('entities.metadynamicmodel.dynainstgridviewtoolbar_toolbar.tbitem13.caption')" @exportexcel="toolbar_click({ tag: 'tbitem13' }, $event)"></app-export-excel>
<div slot='content'>{{$t('entities.metadynamicmodel.dynainstgridviewtoolbar_toolbar.tbitem13.tip')}}</div>
</tooltip>
<span class='seperator'>|</span>
<dropdown v-show="toolBarModels.tbitem16.visabled" trigger='click'>
<tooltip :transfer="true" :max-width="600">
<i-button class=''>
<i class=''></i>
<span class='caption'>{{$t('entities.metadynamicmodel.dynainstgridviewtoolbar_toolbar.tbitem16.caption')}}</span>
<icon type="ios-arrow-down"></icon>
</i-button>
<div slot='content'>{{$t('entities.metadynamicmodel.dynainstgridviewtoolbar_toolbar.tbitem16.tip')}}</div>
</tooltip>
<dropdown-menu slot='list'>
<dropdown-item>
<tooltip :transfer="true" :max-width="600">
<i-button v-show="toolBarModels.tbitem21.visabled" :disabled="toolBarModels.tbitem21.disabled" class='' v-loading:i-button @click="toolbar_click({ tag: 'tbitem21' }, $event)">
<i class='fa fa-download'></i>
<span class='caption'>{{$t('entities.metadynamicmodel.dynainstgridviewtoolbar_toolbar.tbitem21.caption')}}</span>
</i-button>
<div slot='content'>{{$t('entities.metadynamicmodel.dynainstgridviewtoolbar_toolbar.tbitem21.tip')}}</div>
</tooltip>
</dropdown-item>
<dropdown-item>
<tooltip :transfer="true" :max-width="600">
<i-button v-show="toolBarModels.tbitem23.visabled" :disabled="toolBarModels.tbitem23.disabled" class='' v-loading:i-button @click="toolbar_click({ tag: 'tbitem23' }, $event)">
<i class='fa fa-upload'></i>
<span class='caption'>{{$t('entities.metadynamicmodel.dynainstgridviewtoolbar_toolbar.tbitem23.caption')}}</span>
</i-button>
<div slot='content'>{{$t('entities.metadynamicmodel.dynainstgridviewtoolbar_toolbar.tbitem23.tip')}}</div>
</tooltip>
</dropdown-item>
</dropdown-menu>
</dropdown>
<span class='seperator'>|</span>
<tooltip :transfer="true" :max-width="600">
<i-button v-show="toolBarModels.tbitem19.visabled" :disabled="toolBarModels.tbitem19.disabled" class='' v-loading:i-button @click="toolbar_click({ tag: 'tbitem19' }, $event)">
<i class='fa fa-filter'></i>
<span class='caption'>{{$t('entities.metadynamicmodel.dynainstgridviewtoolbar_toolbar.tbitem19.caption')}}</span>
</i-button>
<div slot='content'>{{$t('entities.metadynamicmodel.dynainstgridviewtoolbar_toolbar.tbitem19.tip')}}</div>
</tooltip>
</div>
</div>
</div>
<view_searchform
:viewState="viewState"
:viewparams="viewparams"
:context="context"
:showBusyIndicator="true"
v-show="isExpandSearchForm"
loaddraftAction="FilterGetDraft"
loadAction="FilterGet"
name="searchform"
ref='searchform'
@save="searchform_save($event)"
@search="searchform_search($event)"
@load="searchform_load($event)"
@closeview="closeView($event)">
</view_searchform>
<div class='view-body-messages'>
</div>
<view_grid
:viewState="viewState"
:viewparams="viewparams"
:context="context"
:isSingleSelect="isSingleSelect"
:showBusyIndicator="true"
:isOpenEdit="false"
:gridRowActiveMode="gridRowActiveMode"
:isformDruipart="isformDruipart"
@save="onSave"
updateAction=""
removeAction="Remove"
loaddraftAction=""
loadAction=""
createAction=""
fetchAction="FetchDynaInst"
:newdata="newdata"
:opendata="opendata"
name="grid"
ref='grid'
@selectionchange="grid_selectionchange($event)"
@beforeload="grid_beforeload($event)"
@rowdblclick="grid_rowdblclick($event)"
@remove="grid_remove($event)"
@load="grid_load($event)"
@closeview="closeView($event)">
</view_grid>
</div>
<div class='view-bottom-messages'>
</div>
</card>
</div>
</template>
<script lang='tsx'>
import { Vue, Component, Prop, Provide, Emit, Watch,Inject } from 'vue-property-decorator';
import { UIActionTool,Util } from '@/utils';
import NavDataService from '@/service/app/navdata-service';
import { Subject,Subscription } from 'rxjs';
import MetaDynamicModelService from '@/service/meta-dynamic-model/meta-dynamic-model-service';
import MetaDynamicModelAuthService from '@/authservice/meta-dynamic-model/meta-dynamic-model-auth-service';
import GridViewEngine from '@engine/view/grid-view-engine';
import MetaDynamicModelUIService from '@/uiservice/meta-dynamic-model/meta-dynamic-model-ui-service';
import CodeListService from "@/codelist/codelist-service";
@Component({
components: {
},
})
export default class MetaDynamicModelDynaInstGridViewBase extends Vue {
/**
* 实体服务对象
*
* @type {MetaDynamicModelService}
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
public appEntityService: MetaDynamicModelService = new MetaDynamicModelService;
/**
* 实体UI服务对象
*
* @type MetaDynamicModelUIService
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
public appUIService: MetaDynamicModelUIService = new MetaDynamicModelUIService(this.$store);
/**
* 数据变化
*
* @param {*} val
* @returns {*}
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
@Emit()
public viewDatasChange(val: any):any {
return val;
}
/**
* 传入视图上下文
*
* @type {string}
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
@Prop() public viewdata!: string;
/**
* 传入视图参数
*
* @type {string}
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
@Prop() public viewparam!: string;
/**
* 视图默认使用
*
* @type {boolean}
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
@Prop({ default: true }) public viewDefaultUsage!: boolean;
/**
* 视图默认使用
*
* @type {string}
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
@Inject({from:'navModel',default: 'tab'})
public navModel!:string;
/**
* 视图标识
*
* @type {string}
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
public viewtag: string = 'cec3236f5a1f742f9b91f313506ccc6c';
/**
* 自定义视图导航上下文集合
*
* @type {*}
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
public customViewNavContexts:any ={
};
/**
* 自定义视图导航参数集合
*
* @type {*}
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
public customViewParams:any ={
};
/**
* 视图模型数据
*
* @type {*}
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
public model: any = {
srfCaption: 'entities.metadynamicmodel.views.dynainstgridview.caption',
srfTitle: 'entities.metadynamicmodel.views.dynainstgridview.title',
srfSubTitle: 'entities.metadynamicmodel.views.dynainstgridview.subtitle',
dataInfo: ''
}
/**
* 视图参数变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
@Watch('viewparam',{immediate: true, deep: true})
onParamData(newVal: any, oldVal: any) {
if(newVal){
this.viewparams = {};
if(typeof newVal == 'string') {
Object.assign(this.viewparams, JSON.parse(this.viewparam));
}else{
this.viewparams = Util.deepCopy(this.viewparam);
}
}
}
/**
* 处理应用上下文变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
@Watch('viewdata')
onViewData(newVal: any, oldVal: any) {
const _this: any = this;
if (!Object.is(newVal, oldVal) && _this.engine) {
this.$nextTick(()=>{
_this.parseViewParam();
_this.engine.load();
});
} else if(!Object.is(newVal, oldVal) && _this.refresh && _this.refresh instanceof Function) {
_this.refresh();
}
}
/**
* 容器模型
*
* @type {*}
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
public containerModel: any = {
view_toolbar: { name: 'toolbar', type: 'TOOLBAR' },
view_grid: { name: 'grid', type: 'GRID' },
view_searchform: { name: 'searchform', type: 'SEARCHFORM' },
};
/**
* 视图刷新
*
* @param {*} args
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
public refresh(args?: any): void {
const refs: any = this.$refs;
if (refs && refs.grid) {
refs.grid.refresh();
}
}
/**
* 计数器刷新
*
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
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();
}
})
}
}
/**
* 视图状态订阅对象
*
* @public
* @type {Subject<{action: string, data: any}>}
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
public viewState: Subject<ViewState> = new Subject();
/**
* 工具栏模型
*
* @type {*}
* @memberof MetaDynamicModelDynaInstGridView
*/
public toolBarModels: any = {
tbitem1_publish: { name: 'tbitem1_publish', actiontarget: 'NONE', caption: '发布模型', disabled: false, type: 'DEUIACTION', visabled: true,noprivdisplaymode:2,dataaccaction: '', uiaction: { tag: 'publish', target: 'SINGLEKEY' } },
tbitem2: { name: 'tbitem2', type: 'SEPERATOR', visabled: true, dataaccaction: '', uiaction: { } },
tbitem3: { name: 'tbitem3', actiontarget: 'NONE', caption: '新建', disabled: false, type: 'DEUIACTION', visabled: true,noprivdisplaymode:2,dataaccaction: '', uiaction: { tag: 'New', target: '' } },
tbitem4: { name: 'tbitem4', actiontarget: 'NONE', caption: '编辑', disabled: false, type: 'DEUIACTION', visabled: true,noprivdisplaymode:2,dataaccaction: '', uiaction: { tag: 'Edit', target: 'SINGLEKEY' } },
tbitem6: { name: 'tbitem6', actiontarget: 'NONE', caption: '拷贝', disabled: false, type: 'DEUIACTION', visabled: true,noprivdisplaymode:2,dataaccaction: '', uiaction: { tag: 'Copy', target: 'SINGLEKEY' } },
tbitem7: { name: 'tbitem7', type: 'SEPERATOR', visabled: true, dataaccaction: '', uiaction: { } },
tbitem8: { name: 'tbitem8', actiontarget: 'NONE', caption: '删除', disabled: false, type: 'DEUIACTION', visabled: true,noprivdisplaymode:2,dataaccaction: '', uiaction: { tag: 'Remove', target: 'MULTIKEY' } },
tbitem9: { name: 'tbitem9', type: 'SEPERATOR', visabled: true, dataaccaction: '', uiaction: { } },
tbitem13: { name: 'tbitem13', actiontarget: 'NONE', caption: '导出', disabled: false, type: 'DEUIACTION', visabled: true,noprivdisplaymode:2,dataaccaction: '', uiaction: { tag: 'ExportExcel', target: '' }, MaxRowCount: 1000 },
tbitem10: { name: 'tbitem10', type: 'SEPERATOR', visabled: true, dataaccaction: '', uiaction: { } },
tbitem16: { name: 'tbitem16', caption: '其它', disabled: false, type: 'ITEMS', visabled: true, dataaccaction: '', uiaction: { } },
tbitem21: { name: 'tbitem21', actiontarget: 'NONE', caption: '导出数据模型', disabled: false, type: 'DEUIACTION', visabled: true,noprivdisplaymode:2,dataaccaction: '', uiaction: { tag: 'ExportModel', target: '' } },
tbitem23: { name: 'tbitem23', actiontarget: 'NONE', caption: '数据导入', disabled: false, type: 'DEUIACTION', visabled: true,noprivdisplaymode:2,dataaccaction: '', uiaction: { tag: 'Import', target: '' } },
tbitem17: { name: 'tbitem17', type: 'SEPERATOR', visabled: true, dataaccaction: '', uiaction: { } },
tbitem19: { name: 'tbitem19', actiontarget: 'NONE', caption: '过滤', disabled: false, type: 'DEUIACTION', visabled: true,noprivdisplaymode:2,dataaccaction: '', uiaction: { tag: 'ToggleFilter', target: '' } },
};
/**
* 视图引擎
*
* @public
* @type {Engine}
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
public engine: GridViewEngine = new GridViewEngine();
/**
* 引擎初始化
*
* @public
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
public engineInit(): void {
this.engine.init({
view: this,
opendata: (args: any[],fullargs?:any[],params?: any, $event?: any, xData?: any) => {
this.opendata(args,fullargs, params, $event, xData);
},
newdata: (args: any[],fullargs?:any[],params?: any, $event?: any, xData?: any) => {
this.newdata(args,fullargs, params, $event, xData);
},
grid: this.$refs.grid,
searchform: this.$refs.searchform,
keyPSDEField: 'metadynamicmodel',
majorPSDEField: 'configname',
isLoadDefault: true,
});
}
/**
* 应用导航服务
*
* @type {*}
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
public navDataService = NavDataService.getInstance(this.$store);
/**
* 导航服务事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
public serviceStateEvent: Subscription | undefined;
/**
* 门户部件状态对象
*
* @type {*}
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
@Prop() public portletState?: any;
/**
* 门户部件状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
public portletStateEvent: Subscription | undefined;
/**
* 应用上下文
*
* @type {*}
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
public context:any = {};
/**
* 视图参数
*
* @type {*}
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
public viewparams:any = {};
/**
* 视图缓存数据
*
* @type {*}
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
public viewCacheData:any;
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
public counterServiceArray:Array<any> = [];
/**
* 解析视图参数
*
* @public
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
public parseViewParam(inputvalue:any = null): void {
for(let key in this.context){
delete this.context[key];
}
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
if (!this.viewDefaultUsage && this.viewdata && !Object.is(this.viewdata, '')) {
if(typeof this.viewdata == 'string') {
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(inputvalue){
Object.assign(this.context,{'metadynamicmodel':inputvalue});
}
//初始化视图唯一标识
Object.assign(this.context,{srfsessionid:this.$util.createUUID()});
this.handleCustomViewData();
//初始化导航数据
this.initNavDataWithRoute();
}
/**
* 处理自定义视图数据
*
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
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 MetaDynamicModelDynaInstGridViewBase
*/
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.toLowerCase(), {
value: null,
writable : true,
enumerable : true,
configurable : true
});
}else{
Object.defineProperty(tempData, item.toLowerCase(), {
value: curNavData.value,
writable : true,
enumerable : true,
configurable : true
});
}
}else{
// 先从导航上下文取数,没有再从导航参数(URL)取数,如果导航上下文和导航参数都没有则为null
if(this.context[(curNavData.value).toLowerCase()] != null){
Object.defineProperty(tempData, item.toLowerCase(), {
value: this.context[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
if(this.viewparams[(curNavData.value).toLowerCase()] != null){
Object.defineProperty(tempData, item.toLowerCase(), {
value: this.viewparams[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
Object.defineProperty(tempData, item.toLowerCase(), {
value: null,
writable : true,
enumerable : true,
configurable : true
});
}
}
}
}
/**
* 初始化导航数据(路由模式)
*
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
public initNavDataWithRoute(data:any = null, isNew:boolean = false, isAlways:boolean = false){
if( isAlways || (this.viewDefaultUsage && Object.is(this.navModel,"route")) ){
this.navDataService.addNavData({id:'meta-dynamic-model-dyna-inst-grid-view',tag:this.viewtag,srfkey:isNew ? null : this.context.metadynamicmodel,title:this.$t(this.model.srfCaption),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath});
}
}
/**
* 初始化导航数据(分页模式)
*
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
public initNavDataWithTab(data:any = null,isOnlyAdd:boolean = true, isAlways:boolean = false){
if( isAlways || (this.viewDefaultUsage && !Object.is(this.navModel,"route")) ){
this.navDataService.addNavDataByOnly({id:'meta-dynamic-model-dyna-inst-grid-view',tag:this.viewtag,srfkey:this.context.metadynamicmodel,title:this.$t(this.model.srfCaption),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath},isOnlyAdd);
}
}
/**
* Vue声明周期
*
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
public created() {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
public afterCreated(){
let _this:any = this;
const secondtag = _this.$util.createUUID();
_this.$store.commit('viewaction/createdView', { viewtag: _this.viewtag, secondtag: secondtag });
_this.viewtag = secondtag;
_this.parseViewParam();
_this.serviceStateEvent = _this.navDataService.serviceState.subscribe(({ action,name, data }:{ action:string,name:any,data:any }) => {
if(!Object.is(name,'meta-dynamic-model-dyna-inst-grid-view')){
return;
}
if (Object.is(action, 'viewrefresh')) {
_this.$nextTick(()=>{
_this.parseViewParam(data);
if(_this.engine){
_this.engine.load();
}
});
}
});
if(_this.portletState){
_this.portletStateEvent = _this.portletState.subscribe((res:any) =>{
if(!Object.is(res.name,'MetaDynamicModelDynaInstGridView')){
return;
}
if(Object.is(res.action,'refresh') && _this.refresh && _this.refresh instanceof Function){
_this.refresh();
}
})
}
if(this.formDruipart){
this.formDruipart.subscribe((res:any) =>{
if(Object.is(res.action,'save')){
this.viewState.next({ tag:'grid', action: 'save', data: this.viewparams });
}
if(Object.is(res.action,'load')){
const _this: any = this;
_this.engine.load(res.data,true);
}
});
}
}
/**
* 销毁之前
*
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
public beforeDestroy() {
this.$store.commit('viewaction/removeView', this.viewtag);
}
/**
* Vue声明周期(组件初始化完毕)
*
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
public mounted() {
this.afterMounted();
}
/**
* 执行mounted后的逻辑
*
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
public afterMounted(){
const _this: any = this;
_this.engineInit();
if (_this.loadModel && _this.loadModel instanceof Function) {
_this.loadModel();
}
}
/**
* toolbar 部件 click 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
public toolbar_click($event: any, $event2?: any) {
if (Object.is($event.tag, 'tbitem1_publish')) {
this.toolbar_tbitem1_publish_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem3')) {
this.toolbar_tbitem3_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem4')) {
this.toolbar_tbitem4_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem5')) {
this.toolbar_tbitem5_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem6')) {
this.toolbar_tbitem6_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem24')) {
this.toolbar_tbitem24_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem25')) {
this.toolbar_tbitem25_click(null, '', $event2);
}
if (Object.is($event.tag, 'deuiaction1')) {
this.toolbar_deuiaction1_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem8')) {
this.toolbar_tbitem8_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem13')) {
this.toolbar_tbitem13_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem11')) {
this.toolbar_tbitem11_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem21')) {
this.toolbar_tbitem21_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem23')) {
this.toolbar_tbitem23_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem19')) {
this.toolbar_tbitem19_click(null, '', $event2);
}
}
/**
* grid 部件 selectionchange 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
public grid_selectionchange($event: any, $event2?: any) {
this.engine.onCtrlEvent('grid', 'selectionchange', $event);
}
/**
* grid 部件 beforeload 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
public grid_beforeload($event: any, $event2?: any) {
this.engine.onCtrlEvent('grid', 'beforeload', $event);
}
/**
* grid 部件 rowdblclick 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
public grid_rowdblclick($event: any, $event2?: any) {
this.engine.onCtrlEvent('grid', 'rowdblclick', $event);
}
/**
* grid 部件 remove 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
public grid_remove($event: any, $event2?: any) {
this.engine.onCtrlEvent('grid', 'remove', $event);
}
/**
* grid 部件 load 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
public grid_load($event: any, $event2?: any) {
this.engine.onCtrlEvent('grid', 'load', $event);
}
/**
* searchform 部件 save 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
public searchform_save($event: any, $event2?: any) {
this.engine.onCtrlEvent('searchform', 'save', $event);
}
/**
* searchform 部件 search 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
public searchform_search($event: any, $event2?: any) {
this.engine.onCtrlEvent('searchform', 'search', $event);
}
/**
* searchform 部件 load 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
public searchform_load($event: any, $event2?: any) {
this.engine.onCtrlEvent('searchform', 'load', $event);
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem1_publish_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.grid;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
const curUIService:MetaDynamicModelUIService = new MetaDynamicModelUIService();
curUIService.MetaDynamicModel_publish(datas,contextJO, paramJO, $event, xData,this,"MetaDynamicModel");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem3_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.grid;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.New(datas, contextJO,paramJO, $event, xData,this,"MetaDynamicModel");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem4_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.grid;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.Edit(datas, contextJO,paramJO, $event, xData,this,"MetaDynamicModel");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem5_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.grid;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.View(datas, contextJO,paramJO, $event, xData,this,"MetaDynamicModel");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem6_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.grid;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.Copy(datas, contextJO,paramJO, $event, xData,this,"MetaDynamicModel");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem24_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.grid;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.ToggleRowEdit(datas, contextJO,paramJO, $event, xData,this,"MetaDynamicModel");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem25_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.grid;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.NewRow(datas, contextJO,paramJO, $event, xData,this,"MetaDynamicModel");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_deuiaction1_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.grid;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.SaveRow(datas, contextJO,paramJO, $event, xData,this,"MetaDynamicModel");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem8_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.grid;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.Remove(datas, contextJO,paramJO, $event, xData,this,"MetaDynamicModel");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem13_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.grid;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.ExportExcel(datas, contextJO,paramJO, $event, xData,this,"MetaDynamicModel");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem11_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.grid;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.Print(datas, contextJO,paramJO, $event, xData,this,"MetaDynamicModel");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem21_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.grid;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.ExportModel(datas, contextJO,paramJO, $event, xData,this,"MetaDynamicModel");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem23_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.grid;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.Import(datas, contextJO,paramJO, $event, xData,this,"MetaDynamicModel");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem19_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.grid;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.ToggleFilter(datas, contextJO,paramJO, $event, xData,this,"MetaDynamicModel");
}
/**
* 打开新建数据视图
*
* @param {any[]} args
* @param {*} [params]
* @param {*} [fullargs]
* @param {*} [$event]
* @param {*} [xData]
* @memberof MetaDynamicModelDynaInstGridView
*/
public newdata(args: any[],fullargs?:any[], params?: any, $event?: any, xData?: any) {
let localContext:any = null;
let localViewParam:any =null;
const data: any = {};
if(args[0].srfsourcekey){
data.srfsourcekey = args[0].srfsourcekey;
}
let tempContext = JSON.parse(JSON.stringify(this.context));
delete tempContext.metadynamicmodel;
if(args.length >0){
Object.assign(tempContext,args[0]);
}
const deResParameters: any[] = [];
const parameters: any[] = [
{ pathName: 'metadynamicmodels', parameterName: 'metadynamicmodel' },
{ pathName: 'dynainsteditview', parameterName: 'dynainsteditview' },
];
const _this: any = this;
const openIndexViewTab = (data: any) => {
const _data: any = { w: (new Date().getTime()) };
Object.assign(_data, data);
const routePath = this.$viewTool.buildUpRoutePath(this.$route, tempContext, deResParameters, parameters, args, _data);
this.$router.push(routePath);
}
openIndexViewTab(data);
}
/**
* 打开编辑数据视图
*
* @param {any[]} args
* @param {*} [params]
* @param {*} [fullargs]
* @param {*} [$event]
* @param {*} [xData]
* @memberof MetaDynamicModelDynaInstGridView
*/
public opendata(args: any[],fullargs?:any,params?: any, $event?: any, xData?: any) {
if(!this.viewDefaultUsage){
if(Object.is(this.navModel,"route")){
this.initNavDataWithRoute(this.viewCacheData, false, true);
}else{
this.initNavDataWithTab(this.viewCacheData, false, true);
}
}
let localContext:any = null;
let localViewParam:any =null;
const data: any = {};
let tempContext = JSON.parse(JSON.stringify(this.context));
if(args.length >0){
Object.assign(tempContext,args[0]);
}
const deResParameters: any[] = [];
const parameters: any[] = [
{ pathName: 'metadynamicmodels', parameterName: 'metadynamicmodel' },
{ pathName: 'dynainsteditview', parameterName: 'dynainsteditview' },
];
const _this: any = this;
if(fullargs && fullargs.copymode){
Object.assign(data,{copymode:true});
}
const openIndexViewTab = (data: any) => {
const routePath = this.$viewTool.buildUpRoutePath(this.$route, tempContext, deResParameters, parameters, args, data);
this.$router.push(routePath);
}
openIndexViewTab(data);
}
/**
* 新建
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
public New(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
const _this: any = this;
if (_this.newdata && _this.newdata instanceof Function) {
const data: any = {};
_this.newdata([{ ...data }],[{ ...data }], params, $event, xData);
} else {
_this.$Notice.error({ title: '错误', desc: 'newdata 视图处理逻辑不存在,请添加!' });
}
}
/**
* 编辑
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
public Edit(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
if (args.length === 0) {
return;
}
const _this: any = this;
if (_this.opendata && _this.opendata instanceof Function) {
const data: any = { };
if (args.length > 0) {
Object.assign(data, { metadynamicmodel: args[0].metadynamicmodel })
}
_this.opendata([{ ...data }], args, params, $event, xData);
} else {
_this.$Notice.error({ title: '错误', desc: 'opendata 视图处理逻辑不存在,请添加!' });
}
}
/**
* 查看
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
public View(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
if (args.length === 0) {
return;
}
const _this: any = this;
if (_this.opendata && _this.opendata instanceof Function) {
const data: any = { };
if (args.length > 0) {
Object.assign(data, { metadynamicmodel: args[0].metadynamicmodel })
}
_this.opendata([{ ...data }], args, params, $event, xData);
} else {
_this.$Notice.error({ title: '错误', desc: 'opendata 视图处理逻辑不存在,请添加!' });
}
}
/**
* 拷贝
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
public Copy(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
if (args.length === 0) {
return;
}
const _this: any = this;
if (_this.opendata && _this.opendata instanceof Function) {
const data: any = { };
if (args.length > 0) {
Object.assign(data, { metadynamicmodel: args[0].metadynamicmodel });
}
if(!params) params = {};
Object.assign(args,{copymode:true});
_this.opendata([{ ...data }], args, params, $event, xData);
} else {
Object.assign(this.viewparams,{copymode:true});
}
}
/**
* 行编辑
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
public ToggleRowEdit(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
xData.actualIsOpenEdit = !xData.actualIsOpenEdit;
}
/**
* 新建行
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
public NewRow(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
const _this: any = this;
const data: any = {};
if (_this.hasOwnProperty('newRow') && _this.newRow instanceof Function) {
_this.newRow([{ ...data }], params, $event, xData);
} else if(xData.newRow && xData.newRow instanceof Function) {
xData.newRow([{ ...data }], params, $event, xData);
}else{
_this.$Notice.error({ title: '错误', desc: 'newRow 视图处理逻辑不存在,请添加!' });
}
}
/**
* 保存行
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
public SaveRow(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();
} else if (_this.save && _this.save instanceof Function) {
_this.save();
}
}
/**
* 删除
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
public Remove(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
const _this: any = this;
if (!xData || !(xData.remove instanceof Function)) {
return ;
}
xData.remove(args);
}
/**
* 导出
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
public ExportExcel(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
const _this: any = this;
if (!xData || !(xData.exportExcel instanceof Function) || !$event) {
return ;
}
xData.exportExcel($event.exportparms);
}
/**
* 打印
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
public Print(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
let _this:any = this;
if (!xData || !(xData.print instanceof Function) || !$event) {
return ;
}
xData.print();
}
/**
* 导出数据模型
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
public ExportModel(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
this.$Notice.error({ title: '错误', desc: '导出数据模型未支持' });
}
/**
* 数据导入
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
public Import(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
const _this: any = this;
if (!xData || !(xData.importExcel instanceof Function) || !$event) {
return ;
}
xData.importExcel(params);
}
/**
* 过滤
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
public ToggleFilter(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
const _this: any = this;
if (_this.hasOwnProperty('isExpandSearchForm')) {
_this.isExpandSearchForm = !_this.isExpandSearchForm;
}
}
/**
* 关闭视图
*
* @param {any[]} args
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
public closeView(args: any[]): void {
let _view: any = this;
if (_view.viewdata) {
_view.$emit('viewdataschange', Array.isArray(args)?args:[args]);
_view.$emit('close', Array.isArray(args)?args:[args]);
} else if (_view.$tabPageExp) {
_view.$tabPageExp.onClose(_view.$route.fullPath);
}
}
/**
* 销毁视图回调
*
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
public destroyed(){
this.afterDestroyed();
}
/**
* 执行destroyed后的逻辑
*
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
public 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);
}
})
}
if(Object.is(this.navModel,"tab")){
this.navDataService.removeNavDataByTag(this.viewtag);
}
if (this.serviceStateEvent) {
this.serviceStateEvent.unsubscribe();
}
}
// 销毁计数器定时器
if(this.counterServiceArray && this.counterServiceArray.length >0){
this.counterServiceArray.forEach((item:any) =>{
if(item.destroyCounter && item.destroyCounter instanceof Function){
item.destroyCounter();
}
})
}
if(this.portletStateEvent){
this.portletStateEvent.unsubscribe();
}
}
/**
* 是否单选
*
* @type {boolean}
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
public isSingleSelect: boolean = false;
/**
* 是否嵌入关系界面
*
* @type {boolean}
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
@Prop({default:false}) public isformDruipart?: boolean;
/**
* 界面关系通讯对象
*
* @type {Subject<ViewState>}
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
@Prop() public formDruipart?: Subject<ViewState>;
/**
* 搜索值
*
* @type {string}
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
public query: string = '';
/**
* 是否展开搜索表单
*
* @type {boolean}
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
public isExpandSearchForm: boolean = false;
/**
* 表格行数据默认激活模式
* 0 不激活
* 1 单击激活
* 2 双击激活
*
* @type {(number | 0 | 1 | 2)}
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
public gridRowActiveMode: number | 0 | 1 | 2 = 2;
/**
* 快速搜索
*
* @param {*} $event
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
public onSearch($event: any): void {
const grid: any = this.$refs.grid;
if (grid) {
grid.load(this.context, true);
}
}
/**
* grid 部件 save 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof ENTITYTEST1Usr2GridViewBase
*/
public onSave($event: any) {
this.$emit('drdatasaved', $event);
}
/**
* 刷新数据
*
* @readonly
* @type {(number | null)}
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
get refreshdata(): number | null {
return this.$store.getters['viewaction/getRefreshData'](this.viewtag);
}
/**
* 监控数据变化
*
* @param {*} newVal
* @param {*} oldVal
* @returns
* @memberof MetaDynamicModelDynaInstGridViewBase
*/
@Watch('refreshdata')
onRefreshData(newVal: any, oldVal: any) {
if (newVal === null || newVal === undefined) {
return;
}
if (newVal === 0) {
return;
}
const grid: any = this.$refs.grid;
if (grid) {
grid.load({});
}
}
}
</script>
<style lang='less'>
@import './meta-dynamic-model-dyna-inst-grid-view.less';
</style>
\ No newline at end of file
.meta-dynamic-model-dyna-inst-grid-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 MetaDynamicModelDynaInstGridViewBase from './meta-dynamic-model-dyna-inst-grid-view-base.vue';
import view_grid from '@widgets/meta-dynamic-model/main-grid/main-grid.vue';
import view_searchform from '@widgets/meta-dynamic-model/default-searchform/default-searchform.vue';
@Component({
components: {
view_grid,
view_searchform,
},
beforeRouteEnter: (to: any, from: any, next: any) => {
next((vm: any) => {
if(!Object.is(vm.navModel,"route")){
vm.initNavDataWithTab(vm.viewCacheData);
}
vm.$store.commit('addCurPageViewtag', { fullPath: to.fullPath, viewtag: vm.viewtag });
});
},
})
export default class MetaDynamicModelDynaInstGridView extends MetaDynamicModelDynaInstGridViewBase {
}
</script>
\ No newline at end of file
<template>
<div class="view-container deeditview meta-dynamic-model-edit-view">
<app-studioaction :viewTitle="$t(model.srfCaption)" viewName="metadynamicmodeleditview"></app-studioaction>
<card class='view-card ' :disHover="true" :bordered="false">
<div slot='title' class="header-container">
<span class='caption-info'>{{$t(model.srfCaption)}}</span>
<div class='toolbar-container'>
<tooltip :transfer="true" :max-width="600">
<i-button v-show="toolBarModels.tbitem1.visabled" :disabled="toolBarModels.tbitem1.disabled" class='' v-loading:i-button @click="toolbar_click({ tag: 'tbitem1' }, $event)">
<i class='sx-tb-saveandclose'></i>
<span class='caption'>{{$t('entities.metadynamicmodel.editviewtoolbar_toolbar.tbitem1.caption')}}</span>
</i-button>
<div slot='content'>{{$t('entities.metadynamicmodel.editviewtoolbar_toolbar.tbitem1.tip')}}</div>
</tooltip>
<tooltip :transfer="true" :max-width="600">
<i-button v-show="toolBarModels.tbitem2.visabled" :disabled="toolBarModels.tbitem2.disabled" class='' v-loading:i-button @click="toolbar_click({ tag: 'tbitem2' }, $event)">
<i class='fa fa-sign-out'></i>
<span class='caption'>{{$t('entities.metadynamicmodel.editviewtoolbar_toolbar.tbitem2.caption')}}</span>
</i-button>
<div slot='content'>{{$t('entities.metadynamicmodel.editviewtoolbar_toolbar.tbitem2.tip')}}</div>
</tooltip>
</div>
</div>
<div class='view-top-messages'>
</div>
<div class="content-container">
<div class='view-body-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>
<div class='view-bottom-messages'>
</div>
</card>
</div>
</template>
<script lang='tsx'>
import { Vue, Component, Prop, Provide, Emit, Watch,Inject } from 'vue-property-decorator';
import { UIActionTool,Util } from '@/utils';
import NavDataService from '@/service/app/navdata-service';
import { Subject,Subscription } from 'rxjs';
import MetaDynamicModelService from '@/service/meta-dynamic-model/meta-dynamic-model-service';
import MetaDynamicModelAuthService from '@/authservice/meta-dynamic-model/meta-dynamic-model-auth-service';
import EditViewEngine from '@engine/view/edit-view-engine';
import MetaDynamicModelUIService from '@/uiservice/meta-dynamic-model/meta-dynamic-model-ui-service';
@Component({
components: {
},
})
export default class MetaDynamicModelEditViewBase extends Vue {
/**
* 实体服务对象
*
* @type {MetaDynamicModelService}
* @memberof MetaDynamicModelEditViewBase
*/
public appEntityService: MetaDynamicModelService = new MetaDynamicModelService;
/**
* 实体UI服务对象
*
* @type MetaDynamicModelUIService
* @memberof MetaDynamicModelEditViewBase
*/
public appUIService: MetaDynamicModelUIService = new MetaDynamicModelUIService(this.$store);
/**
* 数据变化
*
* @param {*} val
* @returns {*}
* @memberof MetaDynamicModelEditViewBase
*/
@Emit()
public viewDatasChange(val: any):any {
return val;
}
/**
* 传入视图上下文
*
* @type {string}
* @memberof MetaDynamicModelEditViewBase
*/
@Prop() public viewdata!: string;
/**
* 传入视图参数
*
* @type {string}
* @memberof MetaDynamicModelEditViewBase
*/
@Prop() public viewparam!: string;
/**
* 视图默认使用
*
* @type {boolean}
* @memberof MetaDynamicModelEditViewBase
*/
@Prop({ default: true }) public viewDefaultUsage!: boolean;
/**
* 视图默认使用
*
* @type {string}
* @memberof MetaDynamicModelEditViewBase
*/
@Inject({from:'navModel',default: 'tab'})
public navModel!:string;
/**
* 视图标识
*
* @type {string}
* @memberof MetaDynamicModelEditViewBase
*/
public viewtag: string = 'e8892afaebe9a899e5d528d5b55d3cc5';
/**
* 自定义视图导航上下文集合
*
* @type {*}
* @memberof MetaDynamicModelEditViewBase
*/
public customViewNavContexts:any ={
};
/**
* 自定义视图导航参数集合
*
* @type {*}
* @memberof MetaDynamicModelEditViewBase
*/
public customViewParams:any ={
"pdynainstid":{"isRawValue":false,"value":"metadynamicmodel"}
};
/**
* 视图模型数据
*
* @type {*}
* @memberof MetaDynamicModelEditViewBase
*/
public model: any = {
srfCaption: 'entities.metadynamicmodel.views.editview.caption',
srfTitle: 'entities.metadynamicmodel.views.editview.title',
srfSubTitle: 'entities.metadynamicmodel.views.editview.subtitle',
dataInfo: ''
}
/**
* 视图参数变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof MetaDynamicModelEditViewBase
*/
@Watch('viewparam',{immediate: true, deep: true})
onParamData(newVal: any, oldVal: any) {
if(newVal){
this.viewparams = {};
if(typeof newVal == 'string') {
Object.assign(this.viewparams, JSON.parse(this.viewparam));
}else{
this.viewparams = Util.deepCopy(this.viewparam);
}
}
}
/**
* 处理应用上下文变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof MetaDynamicModelEditViewBase
*/
@Watch('viewdata')
onViewData(newVal: any, oldVal: any) {
const _this: any = this;
if (!Object.is(newVal, oldVal) && _this.engine) {
this.$nextTick(()=>{
_this.parseViewParam();
_this.engine.load();
});
} else if(!Object.is(newVal, oldVal) && _this.refresh && _this.refresh instanceof Function) {
_this.refresh();
}
}
/**
* 容器模型
*
* @type {*}
* @memberof MetaDynamicModelEditViewBase
*/
public containerModel: any = {
view_toolbar: { name: 'toolbar', type: 'TOOLBAR' },
view_form: { name: 'form', type: 'FORM' },
};
/**
* 视图刷新
*
* @param {*} args
* @memberof MetaDynamicModelEditViewBase
*/
public refresh(args?: any): void {
const refs: any = this.$refs;
if (refs && refs.form) {
refs.form.refresh();
}
}
/**
* 计数器刷新
*
* @memberof MetaDynamicModelEditViewBase
*/
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();
}
})
}
}
/**
* 视图状态订阅对象
*
* @public
* @type {Subject<{action: string, data: any}>}
* @memberof MetaDynamicModelEditViewBase
*/
public viewState: Subject<ViewState> = new Subject();
/**
* 工具栏模型
*
* @type {*}
* @memberof MetaDynamicModelEditView
*/
public toolBarModels: any = {
tbitem1: { name: 'tbitem1', actiontarget: 'NONE', caption: '保存并关闭', disabled: false, type: 'DEUIACTION', visabled: true,noprivdisplaymode:2,dataaccaction: '', uiaction: { tag: 'SaveAndExit', target: '' } },
tbitem2: { name: 'tbitem2', actiontarget: 'NONE', caption: '关闭', disabled: false, type: 'DEUIACTION', visabled: true,noprivdisplaymode:2,dataaccaction: '', uiaction: { tag: 'Exit', target: '' } },
};
/**
* 视图引擎
*
* @public
* @type {Engine}
* @memberof MetaDynamicModelEditViewBase
*/
public engine: EditViewEngine = new EditViewEngine();
/**
* 引擎初始化
*
* @public
* @memberof MetaDynamicModelEditViewBase
*/
public engineInit(): void {
this.engine.init({
view: this,
form: this.$refs.form,
p2k: '0',
keyPSDEField: 'metadynamicmodel',
majorPSDEField: 'configname',
isLoadDefault: true,
});
}
/**
* 应用导航服务
*
* @type {*}
* @memberof MetaDynamicModelEditViewBase
*/
public navDataService = NavDataService.getInstance(this.$store);
/**
* 导航服务事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof MetaDynamicModelEditViewBase
*/
public serviceStateEvent: Subscription | undefined;
/**
* 门户部件状态对象
*
* @type {*}
* @memberof MetaDynamicModelEditViewBase
*/
@Prop() public portletState?: any;
/**
* 门户部件状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof MetaDynamicModelEditViewBase
*/
public portletStateEvent: Subscription | undefined;
/**
* 应用上下文
*
* @type {*}
* @memberof MetaDynamicModelEditViewBase
*/
public context:any = {};
/**
* 视图参数
*
* @type {*}
* @memberof MetaDynamicModelEditViewBase
*/
public viewparams:any = {};
/**
* 视图缓存数据
*
* @type {*}
* @memberof MetaDynamicModelEditViewBase
*/
public viewCacheData:any;
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof MetaDynamicModelEditViewBase
*/
public counterServiceArray:Array<any> = [];
/**
* 解析视图参数
*
* @public
* @memberof MetaDynamicModelEditViewBase
*/
public parseViewParam(inputvalue:any = null): void {
for(let key in this.context){
delete this.context[key];
}
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
if (!this.viewDefaultUsage && this.viewdata && !Object.is(this.viewdata, '')) {
if(typeof this.viewdata == 'string') {
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(inputvalue){
Object.assign(this.context,{'metadynamicmodel':inputvalue});
}
//初始化视图唯一标识
Object.assign(this.context,{srfsessionid:this.$util.createUUID()});
this.handleCustomViewData();
//初始化导航数据
this.initNavDataWithRoute();
}
/**
* 处理自定义视图数据
*
* @memberof MetaDynamicModelEditViewBase
*/
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 MetaDynamicModelEditViewBase
*/
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.toLowerCase(), {
value: null,
writable : true,
enumerable : true,
configurable : true
});
}else{
Object.defineProperty(tempData, item.toLowerCase(), {
value: curNavData.value,
writable : true,
enumerable : true,
configurable : true
});
}
}else{
// 先从导航上下文取数,没有再从导航参数(URL)取数,如果导航上下文和导航参数都没有则为null
if(this.context[(curNavData.value).toLowerCase()] != null){
Object.defineProperty(tempData, item.toLowerCase(), {
value: this.context[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
if(this.viewparams[(curNavData.value).toLowerCase()] != null){
Object.defineProperty(tempData, item.toLowerCase(), {
value: this.viewparams[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
Object.defineProperty(tempData, item.toLowerCase(), {
value: null,
writable : true,
enumerable : true,
configurable : true
});
}
}
}
}
/**
* 初始化导航数据(路由模式)
*
* @memberof MetaDynamicModelEditViewBase
*/
public initNavDataWithRoute(data:any = null, isNew:boolean = false, isAlways:boolean = false){
if( isAlways || (this.viewDefaultUsage && Object.is(this.navModel,"route")) ){
this.navDataService.addNavData({id:'meta-dynamic-model-edit-view',tag:this.viewtag,srfkey:isNew ? null : this.context.metadynamicmodel,title:this.$t(this.model.srfCaption),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath});
}
}
/**
* 初始化导航数据(分页模式)
*
* @memberof MetaDynamicModelEditViewBase
*/
public initNavDataWithTab(data:any = null,isOnlyAdd:boolean = true, isAlways:boolean = false){
if( isAlways || (this.viewDefaultUsage && !Object.is(this.navModel,"route")) ){
this.navDataService.addNavDataByOnly({id:'meta-dynamic-model-edit-view',tag:this.viewtag,srfkey:this.context.metadynamicmodel,title:this.$t(this.model.srfCaption),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath},isOnlyAdd);
}
}
/**
* Vue声明周期
*
* @memberof MetaDynamicModelEditViewBase
*/
public created() {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof MetaDynamicModelEditViewBase
*/
public afterCreated(){
let _this:any = this;
const secondtag = _this.$util.createUUID();
_this.$store.commit('viewaction/createdView', { viewtag: _this.viewtag, secondtag: secondtag });
_this.viewtag = secondtag;
_this.parseViewParam();
_this.serviceStateEvent = _this.navDataService.serviceState.subscribe(({ action,name, data }:{ action:string,name:any,data:any }) => {
if(!Object.is(name,'meta-dynamic-model-edit-view')){
return;
}
if (Object.is(action, 'viewrefresh')) {
_this.$nextTick(()=>{
_this.parseViewParam(data);
if(_this.engine){
_this.engine.load();
}
});
}
});
if(_this.portletState){
_this.portletStateEvent = _this.portletState.subscribe((res:any) =>{
if(!Object.is(res.name,'MetaDynamicModelEditView')){
return;
}
if(Object.is(res.action,'refresh') && _this.refresh && _this.refresh instanceof Function){
_this.refresh();
}
})
}
}
/**
* 销毁之前
*
* @memberof MetaDynamicModelEditViewBase
*/
public beforeDestroy() {
this.$store.commit('viewaction/removeView', this.viewtag);
}
/**
* Vue声明周期(组件初始化完毕)
*
* @memberof MetaDynamicModelEditViewBase
*/
public mounted() {
this.afterMounted();
}
/**
* 执行mounted后的逻辑
*
* @memberof MetaDynamicModelEditViewBase
*/
public afterMounted(){
const _this: any = this;
_this.engineInit();
if (_this.loadModel && _this.loadModel instanceof Function) {
_this.loadModel();
}
}
/**
* toolbar 部件 click 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof MetaDynamicModelEditViewBase
*/
public toolbar_click($event: any, $event2?: any) {
if (Object.is($event.tag, 'tbitem1')) {
this.toolbar_tbitem1_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem2')) {
this.toolbar_tbitem2_click(null, '', $event2);
}
}
/**
* form 部件 save 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof MetaDynamicModelEditViewBase
*/
public form_save($event: any, $event2?: any) {
this.engine.onCtrlEvent('form', 'save', $event);
}
/**
* form 部件 remove 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof MetaDynamicModelEditViewBase
*/
public form_remove($event: any, $event2?: any) {
this.engine.onCtrlEvent('form', 'remove', $event);
}
/**
* form 部件 load 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof MetaDynamicModelEditViewBase
*/
public form_load($event: any, $event2?: any) {
this.engine.onCtrlEvent('form', 'load', $event);
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public 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()];
}
if(params){
datas = [params];
}
// 界面行为
this.SaveAndExit(datas, contextJO,paramJO, $event, xData,this,"MetaDynamicModel");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem2_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()];
}
if(params){
datas = [params];
}
// 界面行为
this.Exit(datas, contextJO,paramJO, $event, xData,this,"MetaDynamicModel");
}
/**
* 保存并关闭
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof MetaDynamicModelEditViewBase
*/
public SaveAndExit(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
const _this: any = this;
if (xData && xData.saveAndExit instanceof Function) {
xData.saveAndExit().then((response: any) => {
if (!response || response.status !== 200) {
return;
}
if(window.parent){
window.parent.postMessage([{ ...response.data }],'*');
}
});
} else if (_this.saveAndExit && _this.saveAndExit instanceof Function) {
_this.saveAndExit().then((response: any) => {
if (!response || response.status !== 200) {
return;
}
if(window.parent){
window.parent.postMessage([{ ...response.data }],'*');
}
});
}
}
/**
* 关闭
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof MetaDynamicModelEditViewBase
*/
public Exit(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
this.closeView(args);
if(window.parent){
window.parent.postMessage([{ ...args }],'*');
}
}
/**
* 关闭视图
*
* @param {any[]} args
* @memberof MetaDynamicModelEditViewBase
*/
public closeView(args: any[]): void {
let _view: any = this;
if (_view.viewdata) {
_view.$emit('viewdataschange', Array.isArray(args)?args:[args]);
_view.$emit('close', Array.isArray(args)?args:[args]);
} else if (_view.$tabPageExp) {
_view.$tabPageExp.onClose(_view.$route.fullPath);
}
}
/**
* 销毁视图回调
*
* @memberof MetaDynamicModelEditViewBase
*/
public destroyed(){
this.afterDestroyed();
}
/**
* 执行destroyed后的逻辑
*
* @memberof MetaDynamicModelEditViewBase
*/
public 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);
}
})
}
if(Object.is(this.navModel,"tab")){
this.navDataService.removeNavDataByTag(this.viewtag);
}
if (this.serviceStateEvent) {
this.serviceStateEvent.unsubscribe();
}
}
// 销毁计数器定时器
if(this.counterServiceArray && this.counterServiceArray.length >0){
this.counterServiceArray.forEach((item:any) =>{
if(item.destroyCounter && item.destroyCounter instanceof Function){
item.destroyCounter();
}
})
}
if(this.portletStateEvent){
this.portletStateEvent.unsubscribe();
}
}
}
</script>
<style lang='less'>
@import './meta-dynamic-model-edit-view.less';
</style>
\ No newline at end of file
.view-card {
>.ivu-card-extra {
top: 5px;
right: 0px;
}
}
.meta-dynamic-model-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 MetaDynamicModelEditViewBase from './meta-dynamic-model-edit-view-base.vue';
import view_form from '@widgets/meta-dynamic-model/main-form/main-form.vue';
@Component({
components: {
view_form,
},
beforeRouteEnter: (to: any, from: any, next: any) => {
next((vm: any) => {
if(!Object.is(vm.navModel,"route")){
vm.initNavDataWithTab(vm.viewCacheData);
}
vm.$store.commit('addCurPageViewtag', { fullPath: to.fullPath, viewtag: vm.viewtag });
});
},
})
export default class MetaDynamicModelEditView extends MetaDynamicModelEditViewBase {
}
</script>
\ No newline at end of file
...@@ -1322,10 +1322,10 @@ export default class MetaDynamicModelGridViewBase extends Vue { ...@@ -1322,10 +1322,10 @@ export default class MetaDynamicModelGridViewBase extends Vue {
}); });
} }
const view: any = { const view: any = {
viewname: 'meta-dynamicmodeldyna-inst-edit-view', viewname: 'meta-dynamic-model-edit-view',
height: 0, height: 0,
width: 0, width: 0,
title: this.$t('entities.metadynamicmodel.views.dynainsteditview.title'), title: this.$t('entities.metadynamicmodel.views.editview.title'),
}; };
openPopupModal(view, data); openPopupModal(view, data);
} }
...@@ -1359,7 +1359,7 @@ export default class MetaDynamicModelGridViewBase extends Vue { ...@@ -1359,7 +1359,7 @@ export default class MetaDynamicModelGridViewBase extends Vue {
const deResParameters: any[] = []; const deResParameters: any[] = [];
const parameters: any[] = [ const parameters: any[] = [
{ pathName: 'metadynamicmodels', parameterName: 'metadynamicmodel' }, { pathName: 'metadynamicmodels', parameterName: 'metadynamicmodel' },
{ pathName: 'dynainsteditview', parameterName: 'dynainsteditview' }, { pathName: 'editview', parameterName: 'editview' },
]; ];
const _this: any = this; const _this: any = this;
if(fullargs && fullargs.copymode){ if(fullargs && fullargs.copymode){
......
...@@ -14,6 +14,7 @@ export const PageComponents = { ...@@ -14,6 +14,7 @@ export const PageComponents = {
Vue.component('sys-user-role-grid-view', () => import('@pages/uaa/sys-user-role-grid-view/sys-user-role-grid-view.vue')); Vue.component('sys-user-role-grid-view', () => import('@pages/uaa/sys-user-role-grid-view/sys-user-role-grid-view.vue'));
Vue.component('sys-department-pickup-view', () => import('@pages/ou/sys-department-pickup-view/sys-department-pickup-view.vue')); Vue.component('sys-department-pickup-view', () => import('@pages/ou/sys-department-pickup-view/sys-department-pickup-view.vue'));
Vue.component('pay-trade-grid-view', () => import('@pages/pay/pay-trade-grid-view/pay-trade-grid-view.vue')); Vue.component('pay-trade-grid-view', () => import('@pages/pay/pay-trade-grid-view/pay-trade-grid-view.vue'));
Vue.component('meta-dynamic-model-edit-view', () => import('@pages/disk/meta-dynamic-model-edit-view/meta-dynamic-model-edit-view.vue'));
Vue.component('wfmember-edit-view', () => import('@pages/workflow/wfmember-edit-view/wfmember-edit-view.vue')); Vue.component('wfmember-edit-view', () => import('@pages/workflow/wfmember-edit-view/wfmember-edit-view.vue'));
Vue.component('jobs-log-grid-view', () => import('@pages/task/jobs-log-grid-view/jobs-log-grid-view.vue')); Vue.component('jobs-log-grid-view', () => import('@pages/task/jobs-log-grid-view/jobs-log-grid-view.vue'));
Vue.component('sys-role-pickup-grid-view', () => import('@pages/uaa/sys-role-pickup-grid-view/sys-role-pickup-grid-view.vue')); Vue.component('sys-role-pickup-grid-view', () => import('@pages/uaa/sys-role-pickup-grid-view/sys-role-pickup-grid-view.vue'));
...@@ -80,7 +81,7 @@ export const PageComponents = { ...@@ -80,7 +81,7 @@ export const PageComponents = {
Vue.component('sys-organization-edit-view', () => import('@pages/ou/sys-organization-edit-view/sys-organization-edit-view.vue')); Vue.component('sys-organization-edit-view', () => import('@pages/ou/sys-organization-edit-view/sys-organization-edit-view.vue'));
Vue.component('pay-open-access-edit-view', () => import('@pages/pay/pay-open-access-edit-view/pay-open-access-edit-view.vue')); Vue.component('pay-open-access-edit-view', () => import('@pages/pay/pay-open-access-edit-view/pay-open-access-edit-view.vue'));
Vue.component('sys-role-pickup-view', () => import('@pages/uaa/sys-role-pickup-view/sys-role-pickup-view.vue')); Vue.component('sys-role-pickup-view', () => import('@pages/uaa/sys-role-pickup-view/sys-role-pickup-view.vue'));
Vue.component('meta-dynamicmodeldyna-inst-grid-view', () => import('@pages/disk/meta-dynamicmodeldyna-inst-grid-view/meta-dynamicmodeldyna-inst-grid-view.vue')); Vue.component('meta-dynamic-model-dyna-inst-grid-view', () => import('@pages/disk/meta-dynamic-model-dyna-inst-grid-view/meta-dynamic-model-dyna-inst-grid-view.vue'));
Vue.component('sys-app-edit-view', () => import('@pages/uaa/sys-app-edit-view/sys-app-edit-view.vue')); Vue.component('sys-app-edit-view', () => import('@pages/uaa/sys-app-edit-view/sys-app-edit-view.vue'));
Vue.component('sys-post-pickup-grid-view', () => import('@pages/ou/sys-post-pickup-grid-view/sys-post-pickup-grid-view.vue')); Vue.component('sys-post-pickup-grid-view', () => import('@pages/ou/sys-post-pickup-grid-view/sys-post-pickup-grid-view.vue'));
Vue.component('dict-option-grid-view', () => import('@pages/dict/dict-option-grid-view/dict-option-grid-view.vue')); Vue.component('dict-option-grid-view', () => import('@pages/dict/dict-option-grid-view/dict-option-grid-view.vue'));
......
...@@ -276,6 +276,20 @@ const router = new Router({ ...@@ -276,6 +276,20 @@ const router = new Router({
}, },
component: () => import('@pages/pay/pay-trade-grid-view/pay-trade-grid-view.vue'), component: () => import('@pages/pay/pay-trade-grid-view/pay-trade-grid-view.vue'),
}, },
{
path: 'metadynamicmodels/:metadynamicmodel?/editview/:editview?',
meta: {
caption: 'entities.metadynamicmodel.views.editview.caption',
info:'',
parameters: [
{ pathName: 'index', parameterName: 'index' },
{ pathName: 'metadynamicmodels', parameterName: 'metadynamicmodel' },
{ pathName: 'editview', parameterName: 'editview' },
],
requireAuth: true,
},
component: () => import('@pages/disk/meta-dynamic-model-edit-view/meta-dynamic-model-edit-view.vue'),
},
{ {
path: 'wfusers/:wfuser?/wfmembers/:wfmember?/editview/:editview?', path: 'wfusers/:wfuser?/wfmembers/:wfmember?/editview/:editview?',
meta: { meta: {
...@@ -2015,7 +2029,7 @@ const router = new Router({ ...@@ -2015,7 +2029,7 @@ const router = new Router({
], ],
requireAuth: true, requireAuth: true,
}, },
component: () => import('@pages/disk/meta-dynamicmodeldyna-inst-grid-view/meta-dynamicmodeldyna-inst-grid-view.vue'), component: () => import('@pages/disk/meta-dynamic-model-dyna-inst-grid-view/meta-dynamic-model-dyna-inst-grid-view.vue'),
}, },
{ {
path: 'sysapps/:sysapp?/editview/:editview?', path: 'sysapps/:sysapp?/editview/:editview?',
...@@ -3852,7 +3866,7 @@ const router = new Router({ ...@@ -3852,7 +3866,7 @@ const router = new Router({
], ],
requireAuth: true, requireAuth: true,
}, },
component: () => import('@pages/disk/meta-dynamicmodeldyna-inst-grid-view/meta-dynamicmodeldyna-inst-grid-view.vue'), component: () => import('@pages/disk/meta-dynamic-model-dyna-inst-grid-view/meta-dynamic-model-dyna-inst-grid-view.vue'),
}, },
{ {
path: '/sysorganizations/:sysorganization?/sysdepartments/:sysdepartment?/pickupview/:pickupview?', path: '/sysorganizations/:sysorganization?/sysdepartments/:sysdepartment?/pickupview/:pickupview?',
...@@ -3934,6 +3948,19 @@ const router = new Router({ ...@@ -3934,6 +3948,19 @@ const router = new Router({
}, },
component: () => import('@pages/task/jobs-info-grid-view/jobs-info-grid-view.vue'), component: () => import('@pages/task/jobs-info-grid-view/jobs-info-grid-view.vue'),
}, },
{
path: '/metadynamicmodels/:metadynamicmodel?/editview/:editview?',
meta: {
caption: 'entities.metadynamicmodel.views.editview.caption',
info:'',
parameters: [
{ pathName: 'metadynamicmodels', parameterName: 'metadynamicmodel' },
{ pathName: 'editview', parameterName: 'editview' },
],
requireAuth: true,
},
component: () => import('@pages/disk/meta-dynamic-model-edit-view/meta-dynamic-model-edit-view.vue'),
},
{ {
path: '/sysorganizations/:sysorganization?/sysdepartments/:sysdepartment?/sysemployees/:sysemployee?/pickupgridview/:pickupgridview?', path: '/sysorganizations/:sysorganization?/sysdepartments/:sysdepartment?/sysemployees/:sysemployee?/pickupgridview/:pickupgridview?',
meta: { meta: {
......
...@@ -689,7 +689,7 @@ export const viewstate: any = { ...@@ -689,7 +689,7 @@ export const viewstate: any = {
viewaction: '', viewaction: '',
viewdatachange: false, viewdatachange: false,
refviews: [ refviews: [
'92d51d41db51a671793ee8dc8876f9e9', 'e8892afaebe9a899e5d528d5b55d3cc5',
], ],
}, },
{ {
...@@ -820,7 +820,7 @@ export const viewstate: any = { ...@@ -820,7 +820,7 @@ export const viewstate: any = {
{ {
viewtag: 'cec3236f5a1f742f9b91f313506ccc6c', viewtag: 'cec3236f5a1f742f9b91f313506ccc6c',
viewmodule: 'disk', viewmodule: 'disk',
viewname: 'META_DYNAMICMODELDynaInstGridView', viewname: 'MetaDynamicModelDynaInstGridView',
viewaction: '', viewaction: '',
viewdatachange: false, viewdatachange: false,
refviews: [ refviews: [
...@@ -867,6 +867,15 @@ export const viewstate: any = { ...@@ -867,6 +867,15 @@ export const viewstate: any = {
'49b6b437f10c4e73e47d87d5d0f76cfd', '49b6b437f10c4e73e47d87d5d0f76cfd',
], ],
}, },
{
viewtag: 'e8892afaebe9a899e5d528d5b55d3cc5',
viewmodule: 'disk',
viewname: 'MetaDynamicModelEditView',
viewaction: '',
viewdatachange: false,
refviews: [
],
},
{ {
viewtag: 'ed2bd80851a999d7a0d70ea15507ad0d', viewtag: 'ed2bd80851a999d7a0d70ea15507ad0d',
viewmodule: 'ou', viewmodule: 'ou',
......
...@@ -98,7 +98,8 @@ export default class MetaDynamicModelUIServiceBase extends UIService { ...@@ -98,7 +98,8 @@ export default class MetaDynamicModelUIServiceBase extends UIService {
public initViewMap(){ public initViewMap(){
this.allViewMap.set(':',{viewname:'dynainsteditview',srfappde:'metadynamicmodels',component:'meta-dynamicmodeldyna-inst-edit-view'}); this.allViewMap.set(':',{viewname:'dynainsteditview',srfappde:'metadynamicmodels',component:'meta-dynamicmodeldyna-inst-edit-view'});
this.allViewMap.set('MDATAVIEW:',{viewname:'gridview',srfappde:'metadynamicmodels',component:'meta-dynamic-model-grid-view'}); this.allViewMap.set('MDATAVIEW:',{viewname:'gridview',srfappde:'metadynamicmodels',component:'meta-dynamic-model-grid-view'});
this.allViewMap.set(':',{viewname:'dynainstgridview',srfappde:'metadynamicmodels',component:'meta-dynamicmodeldyna-inst-grid-view'}); this.allViewMap.set(':',{viewname:'dynainstgridview',srfappde:'metadynamicmodels',component:'meta-dynamic-model-dyna-inst-grid-view'});
this.allViewMap.set('EDITVIEW:',{viewname:'editview',srfappde:'metadynamicmodels',component:'meta-dynamic-model-edit-view'});
} }
/** /**
......
...@@ -590,7 +590,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -590,7 +590,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
*/ */
public load(opt: any = {}): void { public load(opt: any = {}): void {
if(!this.loadAction){ if(!this.loadAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'META_DYNAMICMODELDynaInstGridView' + (this.$t('app.searchForm.notConfig.loadAction') as string) }); this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'MetaDynamicModelDynaInstGridView' + (this.$t('app.searchForm.notConfig.loadAction') as string) });
return; return;
} }
const arg: any = { ...opt }; const arg: any = { ...opt };
...@@ -626,7 +626,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -626,7 +626,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
*/ */
public loadDraft(opt: any = {},mode?:string): void { public loadDraft(opt: any = {},mode?:string): void {
if(!this.loaddraftAction){ if(!this.loaddraftAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'META_DYNAMICMODELDynaInstGridView' + (this.$t('app.searchForm.notConfig.loaddraftAction') as string) }); this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'MetaDynamicModelDynaInstGridView' + (this.$t('app.searchForm.notConfig.loaddraftAction') as string) });
return; return;
} }
const arg: any = { ...opt } ; const arg: any = { ...opt } ;
......
<template>
<i-form :model="this.data" class='app-form' ref='form' id='metadynamicmodel_main' style="" @on-validate="formItemValidate">
<input style="display:none;" />
<row >
<i-col v-show="detailsModel.group1.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-group :uiService="appUIService" :data="transformData(data)" :manageContainerStatus="detailsModel.group1.manageContainerStatus" :isManageContainer="detailsModel.group1.isManageContainer" @managecontainerclick="manageContainerClick('group1')" layoutType="TABLE_24COL" titleStyle="" class='' :uiActionGroup="detailsModel.group1.uiActionGroup" @groupuiactionclick="groupUIActionClick($event)" :caption="$t('entities.metadynamicmodel.main_form.details.group1')" :isShowCaption="true" uiStyle="DEFAULT" :titleBarCloseMode="0" :isInfoGroupMode="false" >
<row>
<i-col v-show="detailsModel.configname.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='configname' :itemRules="this.rules().configname" class='' :caption="$t('entities.metadynamicmodel.main_form.details.configname')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.configname.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box
v-model="data.configname"
@enter="onEnter($event)"
unit=""
:disabled="detailsModel.configname.disabled"
type='text'
style="">
</input-box>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.formitem.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='formitem' :itemRules="this.rules().formitem" class='' :caption="$t('entities.metadynamicmodel.main_form.details.formitem')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.formitem.error" :isEmptyCaption="false" labelPos="LEFT">
<app-file-upload :formState="formState" :ignorefieldvaluechange="ignorefieldvaluechange" @formitemvaluechange="onFormItemValueChange" :data="JSON.stringify(this.data)" name='formitem' :value="data.formitem" :disabled="detailsModel.formitem.disabled" :uploadparams='{}' :exportparams='{}' 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,Inject } from 'vue-property-decorator';
import { CreateElement } from 'vue';
import { Subject, Subscription } from 'rxjs';
import { ControlInterface } from '@/interface/control';
import { UIActionTool,Util,ViewTool } from '@/utils';
import NavDataService from '@/service/app/navdata-service';
import AppCenterService from "@service/app/app-center-service";
import MetaDynamicModelEntityService from '@/service/meta-dynamic-model/meta-dynamic-model-service';
import MainService from './main-form-service';
import MetaDynamicModelUIService from '@/uiservice/meta-dynamic-model/meta-dynamic-model-ui-service';
import { FormButtonModel, FormPageModel, FormItemModel, FormDRUIPartModel, FormPartModel, FormGroupPanelModel, FormIFrameModel, FormRowItemModel, FormTabPageModel, FormTabPanelModel, FormUserControlModel } from '@/model/form-detail';
import { debounceTime, distinctUntilChanged } from 'rxjs/operators';
import schema from 'async-validator';
import { Environment } from '@/environments/environment';
@Component({
components: {
}
})
export default class MainBase extends Vue implements ControlInterface {
/**
* 名称
*
* @type {string}
* @memberof MainBase
*/
@Prop() public name?: string;
/**
* 视图通讯对象
*
* @type {Subject<ViewState>}
* @memberof MainBase
*/
@Prop() public viewState!: Subject<ViewState>;
/**
* 应用上下文
*
* @type {*}
* @memberof MainBase
*/
@Prop() public context!: any;
/**
* 视图参数
*
* @type {*}
* @memberof MainBase
*/
@Prop() public viewparams!: any;
/**
* 视图状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof MainBase
*/
public viewStateEvent: Subscription | undefined;
/**
* 获取部件类型
*
* @returns {string}
* @memberof MainBase
*/
public getControlType(): string {
return 'FORM'
}
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof MainBase
*/
public counterServiceArray:Array<any> = [];
/**
* 建构部件服务对象
*
* @type {MainService}
* @memberof MainBase
*/
public service: MainService = new MainService({ $store: this.$store });
/**
* 实体服务对象
*
* @type {MetaDynamicModelService}
* @memberof MainBase
*/
public appEntityService: MetaDynamicModelEntityService = new MetaDynamicModelEntityService({ $store: this.$store });
/**
* 转化数据
*
* @param {any} args
* @memberof MainBase
*/
public transformData(args: any) {
let _this: any = this;
if(_this.service && _this.service.handleRequestData instanceof Function && _this.service.handleRequestData('transform',_this.context,args)){
return _this.service.handleRequestData('transform',_this.context,args)['data'];
}
}
/**
* 关闭视图
*
* @param {any} args
* @memberof MainBase
*/
public closeView(args: any): void {
let _this: any = this;
_this.$emit('closeview', [args]);
}
/**
* 计数器刷新
*
* @memberof MainBase
*/
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();
}
})
}
}
/**
* 视图默认使用
*
* @type {string}
* @memberof MainBase
*/
@Inject({from:'navModel',default: 'tab'})
public navModel!:string;
/**
* 主键表单项名称
*
* @protected
* @type {string}
* @memberof MainBase
*/
public formKeyItemName: string = '';
/**
* 是否自动加载
*
* @type {boolean}
* @memberof MainBase
*/
@Prop({default:false}) public isautoload?:boolean;
/**
* 界面UI服务对象
*
* @type {MetaDynamicModelUIService}
* @memberof MainBase
*/
public appUIService:MetaDynamicModelUIService = new MetaDynamicModelUIService(this.$store);
/**
* 工作流审批意见控件绑定值
*
* @memberof MainBase
*/
public srfwfmemo:string = "";
/**
* 获取多项数据
*
* @returns {any[]}
* @memberof MainBase
*/
public getDatas(): any[] {
return [this.data];
}
/**
* 获取单项树
*
* @returns {*}
* @memberof MainBase
*/
public getData(): any {
return this.data;
}
/**
* 是否默认保存
*
* @type {boolean}
* @memberof MainBase
*/
@Prop({ default: false }) public autosave?: boolean;
/**
* 显示处理提示
*
* @type {boolean}
* @memberof MainBase
*/
@Prop({ default: true }) public showBusyIndicator?: boolean;
/**
* 部件行为--submit
*
* @type {string}
* @memberof MainBase
*/
@Prop() public WFSubmitAction!: string;
/**
* 部件行为--start
*
* @type {string}
* @memberof MainBase
*/
@Prop() public WFStartAction!: string;
/**
* 部件行为--update
*
* @type {string}
* @memberof MainBase
*/
@Prop() public updateAction!: string;
/**
* 部件行为--remove
*
* @type {string}
* @memberof MainBase
*/
@Prop() public removeAction!: string;
/**
* 部件行为--loaddraft
*
* @type {string}
* @memberof MainBase
*/
@Prop() public loaddraftAction!: string;
/**
* 部件行为--load
*
* @type {string}
* @memberof MainBase
*/
@Prop() public loadAction!: string;
/**
* 部件行为--create
*
* @type {string}
* @memberof MainBase
*/
@Prop() public createAction!: string;
/**
* 部件行为--create
*
* @type {string}
* @memberof MainBase
*/
@Prop() public searchAction!: string;
/**
* 视图标识
*
* @type {string}
* @memberof MainBase
*/
@Prop() public viewtag!: string;
/**
* 表单状态
*
* @type {Subject<any>}
* @memberof MainBase
*/
public formState: Subject<any> = new Subject();
/**
* 忽略表单项值变化
*
* @type {boolean}
* @memberof MainBase
*/
public ignorefieldvaluechange: boolean = false;
/**
* 数据变化
*
* @public
* @type {Subject<any>}
* @memberof MainBase
*/
public dataChang: Subject<any> = new Subject();
/**
* 视图状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof MainBase
*/
public dataChangEvent: Subscription | undefined;
/**
* 原始数据
*
* @public
* @type {*}
* @memberof MainBase
*/
public oldData: any = {};
/**
* 混入表单数据对象
*
* @type {*}
* @memberof MainBase
*/
public mixinData:any = {};
/**
* 表单项校验错误提示信息
*
* @memberof MainBase
*/
public errorMessages: Array<any> = [];
/**
* 应用状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof MainBase
*/
public appStateEvent: Subscription | undefined;
/**
* 设置表单项错误提示信息
*
* @param {*} prop 表单项字段名
* @param {*} status 校验状态
* @param {*} error 错误信息
* @memberof MainBase
*/
public formItemValidate(prop: string,status: boolean, error: string){
error = error ? error : '';
if(this.errorMessages && this.errorMessages.length > 0){
const index = this.errorMessages.findIndex((errorMessage:any) => Object.is(errorMessage.prop,prop));
if(index != -1){
this.errorMessages[index].error = error;
}else{
this.errorMessages.push({prop: prop,error: error});
}
}else{
this.errorMessages.push({prop: prop,error: error});
}
}
/**
* 表单数据对象
*
* @type {*}
* @memberof MainBase
*/
public data: any = {
srforikey: null,
srfkey: null,
srfmajortext: null,
srftempmode: null,
srfuf: null,
srfdeid: null,
srfsourcekey: null,
configname: null,
formitem: null,
systemid: null,
pdynainstid: null,
configid: null,
metadynamicmodel:null,
};
/**
* 当前执行的行为逻辑
*
* @type {string}
* @memberof MainBase
*/
public currentAction: string = "";
/**
* 关系界面计数器
*
* @type {number}
* @memberof MainBase
*/
public drcounter: number = 0;
/**
* 需要等待关系界面保存时,第一次调用save参数的备份
*
* @type {number}
* @memberof MainBase
*/
public drsaveopt: any = {};
/**
* 表单保存回调存储对象
*
* @type {any}
* @memberof MainBase
*/
public saveState:any ;
/**
* 主信息属性映射表单项名称
*
* @type {string}
* @memberof MainBase
*/
public majorMessageField: string = "configname";
/**
* 值规则
*
* @type {*}
* @memberof MainBase
*/
public rules() :any {
return {
configname: [
{ required: this.detailsModel.configname.required, type: 'string', message: '配置名称 值不能为空', trigger: 'change' },
{ required: this.detailsModel.configname.required, type: 'string', message: '配置名称 值不能为空', trigger: 'blur' },
],
formitem: [
{ required: this.detailsModel.formitem.required, type: 'string', message: '文件 值不能为空', trigger: 'change' },
{ required: this.detailsModel.formitem.required, type: 'string', message: '文件 值不能为空', trigger: 'blur' },
],
}
}
/**
* 属性值规则
*
* @type {*}
* @memberof MainBase
*/
public deRules(){
return {
}
}
/**
* 校验属性值规则
*
* @public
* @param {{ name: string }} { name }
* @memberof MainBase
*/
public verifyDeRules(name:string,rule:any = this.deRules(),op:string = "AND") :{isPast:boolean,infoMessage:string}{
let falg:any = {infoMessage:""};
if(!rule[name]){
return falg;
}
let opValue = op == 'AND'? true :false;
let startOp = (val:boolean)=>{
if(falg.isPast){
if(opValue){
falg.isPast = falg.isPast && val;
}else{
falg.isPast = falg.isPast || val;
}
}else{
falg.isPast = val;
}
}
for(let i=0;i<rule[name].length;i++){
let item:any = rule[name][i];
let dataValue = item.deName?this.data[this.service.getItemNameByDeName(item.deName)]:"";
item.ruleInfo = item.ruleInfo ? item.ruleInfo : this.$t('app.formpage.valuecheckex');
if((dataValue === null || dataValue === undefined || dataValue === "") && (item.type != 'GROUP')){
startOp(true);
return falg;
}
try {
// 常规规则
if(item.type == 'SIMPLE'){
startOp(!this.$verify.checkFieldSimpleRule(dataValue,item.condOP,item.paramValue,item.ruleInfo,item.paramType,this.data,item.isKeyCond));
falg.infoMessage = item.ruleInfo;
if(!falg.isPast) return falg;
}
// 数值范围
if(item.type == 'VALUERANGE2'){
startOp( !this.$verify.checkFieldValueRangeRule(dataValue,item.minValue,item.isIncludeMinValue,item.maxValue,item.isIncludeMaxValue,item.ruleInfo,item.isKeyCond));
falg.infoMessage = item.ruleInfo;
if(!falg.isPast) return falg;
}
// 正则式
if (item.type == "REGEX") {
startOp(!this.$verify.checkFieldRegExRule(dataValue,item.regExCode,item.ruleInfo,item.isKeyCond));
falg.infoMessage = item.ruleInfo;
if(!falg.isPast) return falg;
}
// 长度
if (item.type == "STRINGLENGTH") {
startOp(!this.$verify.checkFieldStringLengthRule(dataValue,item.minValue,item.isIncludeMinValue,item.maxValue,item.isIncludeMaxValue,item.ruleInfo,item.isKeyCond));
falg.infoMessage = item.ruleInfo;
if(!falg.isPast) return falg;
}
// 系统值规则
if(item.type == "SYSVALUERULE") {
startOp(!this.$verify.checkFieldSysValueRule(dataValue,item.sysRule.regExCode,item.ruleInfo,item.isKeyCond));
falg.infoMessage = item.ruleInfo;
if(!falg.isPast) return falg;
}
} catch(error) {
falg.infoMessage = item.ruleInfo;
startOp(false);
if(!falg.isPast) return falg;
}
// 分组
if(item.type == 'GROUP'){
falg = this.verifyDeRules('group',item,item.condOP?item.condOP:"AND");
if(item.isNotMode){
falg.isPast = !falg.isPast;
}
if(!falg.isPast) return falg;
}
}
if(!falg.hasOwnProperty("isPast")){
falg.isPast = true;
}
if(!this.data[name] && this.data[name] != 0){
falg.isPast = true;
}
return falg;
}
/**
* 详情模型集合
*
* @type {*}
* @memberof MainBase
*/
public detailsModel: any = {
group1: new FormGroupPanelModel({ caption: '动态模型基本信息', detailType: 'GROUPPANEL', name: 'group1', visible: true, isShowCaption: true, form: this, isControlledContent: false , uiActionGroup: { caption: '', langbase: 'entities.metadynamicmodel.main_form', extractMode: 'ITEM', details: [] }, isManageContainer: false, showMoreModeItems: [] })
,
formpage1: new FormPageModel({ caption: '基本信息', detailType: 'FORMPAGE', name: 'formpage1', visible: true, isShowCaption: true, form: this, isControlledContent: false })
,
srforikey: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srforikey', visible: true, isShowCaption: true, form: this, isControlledContent: false , required:false, disabled: false, enableCond: 3 })
,
srfkey: new FormItemModel({ caption: '配置标识', detailType: 'FORMITEM', name: 'srfkey', visible: true, isShowCaption: true, form: this, isControlledContent: false , required:false, disabled: false, enableCond: 3 })
,
srfmajortext: new FormItemModel({ caption: '配置名称', detailType: 'FORMITEM', name: 'srfmajortext', visible: true, isShowCaption: true, form: this, isControlledContent: false , required:false, disabled: false, enableCond: 3 })
,
srftempmode: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srftempmode', visible: true, isShowCaption: true, form: this, isControlledContent: false , required:false, disabled: false, enableCond: 3 })
,
srfuf: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srfuf', visible: true, isShowCaption: true, form: this, isControlledContent: false , required:false, disabled: false, enableCond: 3 })
,
srfdeid: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srfdeid', visible: true, isShowCaption: true, form: this, isControlledContent: false , required:false, disabled: false, enableCond: 3 })
,
srfsourcekey: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srfsourcekey', visible: true, isShowCaption: true, form: this, isControlledContent: false , required:false, disabled: false, enableCond: 3 })
,
configname: new FormItemModel({ caption: '配置名称', detailType: 'FORMITEM', name: 'configname', visible: true, isShowCaption: true, form: this, isControlledContent: false , required:false, disabled: false, enableCond: 3 })
,
formitem: new FormItemModel({ caption: '文件', detailType: 'FORMITEM', name: 'formitem', visible: true, isShowCaption: true, form: this, isControlledContent: false , required:true, disabled: false, enableCond: 3 })
,
systemid: new FormItemModel({ caption: '系统', detailType: 'FORMITEM', name: 'systemid', visible: true, isShowCaption: true, form: this, isControlledContent: false , required:false, disabled: false, enableCond: 3 })
,
pdynainstid: new FormItemModel({ caption: '父实例', detailType: 'FORMITEM', name: 'pdynainstid', visible: true, isShowCaption: true, form: this, isControlledContent: false , required:false, disabled: false, enableCond: 3 })
,
configid: new FormItemModel({ caption: '配置标识', detailType: 'FORMITEM', name: 'configid', visible: true, isShowCaption: true, form: this, isControlledContent: false , required:false, disabled: false, enableCond: 3 })
,
};
/**
* 监控表单属性 srforikey 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof MainBase
*/
@Watch('data.srforikey')
onSrforikeyChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srforikey', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srfkey 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof MainBase
*/
@Watch('data.srfkey')
onSrfkeyChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srfkey', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srfmajortext 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof MainBase
*/
@Watch('data.srfmajortext')
onSrfmajortextChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srfmajortext', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srftempmode 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof MainBase
*/
@Watch('data.srftempmode')
onSrftempmodeChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srftempmode', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srfuf 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof MainBase
*/
@Watch('data.srfuf')
onSrfufChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srfuf', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srfdeid 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof MainBase
*/
@Watch('data.srfdeid')
onSrfdeidChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srfdeid', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srfsourcekey 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof MainBase
*/
@Watch('data.srfsourcekey')
onSrfsourcekeyChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srfsourcekey', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 configname 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof MainBase
*/
@Watch('data.configname')
onConfignameChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'configname', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 formitem 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof MainBase
*/
@Watch('data.formitem')
onFormitemChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'formitem', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 systemid 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof MainBase
*/
@Watch('data.systemid')
onSystemidChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'systemid', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 pdynainstid 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof MainBase
*/
@Watch('data.pdynainstid')
onPdynainstidChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'pdynainstid', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 configid 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof MainBase
*/
@Watch('data.configid')
onConfigidChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'configid', newVal: newVal, oldVal: oldVal });
}
/**
* 显示更多模式切换操作
*
* @type {string}
* @memberof MainBase
*/
public manageContainerClick(name: string){
let model = this.detailsModel[name];
if(model.isManageContainer){
model.setManageContainerStatus(!model.manageContainerStatus);
model.showMoreModeItems.forEach((item:any) => {
if(this.detailsModel[item].isControlledContent){
this.detailsModel[item].setVisible(model.manageContainerStatus? this.detailsModel[item].oldVisible : false);
}
});
}
}
/**
* 重置表单项值
*
* @public
* @param {{ name: string, newVal: any, oldVal: any }} { name, newVal, oldVal }
* @memberof MainBase
*/
public resetFormData({ name, newVal, oldVal }: { name: string, newVal: any, oldVal: any }): void {
}
/**
* 置空对象
*
* @param {any[]} args
* @memberof MainBase
*/
public ResetData(_datas:any){
if(Object.keys(_datas).length >0){
Object.keys(_datas).forEach((name: string) => {
if (this.data.hasOwnProperty(name)) {
this.data[name] = null;
}
});
}
}
/**
* 表单逻辑
*
* @public
* @param {{ name: string, newVal: any, oldVal: any }} { name, newVal, oldVal }
* @memberof MainBase
*/
public async formLogic({ name, newVal, oldVal }: { name: string, newVal: any, oldVal: any }){
}
/**
* 表单项检查逻辑
*
* @public
* @param name 属性名
* @memberof MainBase
*/
public checkItem(name:string):Promise<any> {
return new Promise((resolve, reject) => {
var validator = new schema({[name]:this.rules()[name]});
validator.validate({[name]:this.data[name]}).then(()=>{
resolve(true);
})
.catch(() => {
resolve(false);
});;
})
}
/**
* 表单值变化
*
* @public
* @param {{ name: string, newVal: any, oldVal: any }} { name, newVal, oldVal }
* @returns {void}
* @memberof MainBase
*/
public 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));
}
/**
* 表单加载完成
*
* @public
* @param {*} [data={}]
* @param {string} [action]
* @memberof MainBase
*/
public onFormLoad(data: any = {},action:string): void {
if(Object.is(action,"save") || Object.is(action,"autoSave") || Object.is(action,"submit"))
// 更新context的实体主键
if(data.metadynamicmodel){
Object.assign(this.context,{metadynamicmodel:data.metadynamicmodel})
}
this.setFormEnableCond(data);
this.computeButtonState(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 MainBase
*/
public fillForm(_datas: any = {},action:string): void {
this.mixinData = _datas;
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;
})
}
/**
* 设置表单项是否启用
*
* @public
* @param {*} data
* @memberof MainBase
*/
public 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);
});
}
/**
* 重置草稿表单状态
*
* @public
* @memberof MainBase
*/
public resetDraftFormStates(): void {
const form: any = this.$refs.form;
if (form) {
form.resetFields();
}
}
/**
* 重置校验结果
*
* @memberof MainBase
*/
public 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 MainBase
*/
public 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 MainBase
*/
public formValidateStatus(): boolean {
const form: any = this.$refs.form;
let validatestate: boolean = true;
form.validate((valid: boolean) => {
validatestate = valid ? true : false;
});
return validatestate
}
/**
* 获取全部值
*
* @returns {*}
* @memberof MainBase
*/
public getValues(): any {
return this.data;
}
/**
* 表单项值变更
*
* @param {{ name: string, value: any }} $event
* @returns {void}
* @memberof MainBase
*/
public 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 {*} arg
* @returns {void}
* @memberof MainBase
*/
public onFormItemActionClick(arg:any){
if(arg && (arg instanceof Function)) arg();
}
/**
* 设置数据项值
*
* @param {string} name
* @param {*} value
* @returns {void}
* @memberof MainBase
*/
public 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 {*} [data] 传入数据
* @memberof MainBase
*/
public computeButtonState(data:any){
let targetData:any = this.transformData(data);
if(this.detailsModel && Object.keys(this.detailsModel).length >0){
Object.keys(this.detailsModel).forEach((name:any) =>{
if(this.detailsModel[name] && this.detailsModel[name].uiaction && this.detailsModel[name].uiaction.dataaccaction && Object.is(this.detailsModel[name].detailType,"BUTTON")){
this.detailsModel[name].isPower = true;
let tempUIAction:any = JSON.parse(JSON.stringify(this.detailsModel[name].uiaction));
let result: any[] = ViewTool.calcActionItemAuthState(targetData,[tempUIAction],this.appUIService);
this.detailsModel[name].visible = tempUIAction.visabled;
this.detailsModel[name].disabled = tempUIAction.disabled;
this.detailsModel[name].isPower = result[0] === 1 ? true : false;
}
})
}
}
/**
* 分组界面行为事件
*
* @param {*} $event
* @memberof MainBase
*/
public groupUIActionClick($event: any): void {
if (!$event) {
return;
}
const item:any = $event.item;
}
/**
* Vue声明周期(处理组件的输入属性)
*
* @memberof MainBase
*/
public created(): void {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof MainBase
*/
public afterCreated(){
if(this.isautoload){
this.autoLoad({srfkey:this.context.metadynamicmodel});
}
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);
}
if (Object.is('panelaction', action)) {
this.panelAction(data.action,data.emitAction,data.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 MainBase
*/
public destroyed() {
this.afterDestroy();
}
/**
* 执行destroyed后的逻辑
*
* @memberof MainBase
*/
public afterDestroy() {
if (this.viewStateEvent) {
this.viewStateEvent.unsubscribe();
}
if (this.dataChangEvent) {
this.dataChangEvent.unsubscribe();
}
if(this.appStateEvent){
this.appStateEvent.unsubscribe();
}
}
/**
*打印
*@memberof @memberof MainBase
*/
public print(){
let _this:any = this;
_this.$print({id:'metadynamicmodel_main',popTitle:'主编辑表单'});
}
/**
* 部件刷新
*
* @param {any} args
* @memberof MainBase
*/
public refresh(args?: any): void {
let arg: any = {};
Object.assign(arg,args?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 MainBase
*/
public 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);
}
/**
* 加载
*
* @public
* @param {*} [opt={}]
* @memberof MainBase
*/
public load(opt: any = {}): void {
if(!this.loadAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'MetaDynamicModelEditView' + (this.$t('app.formpage.notconfig.loadaction') as string) });
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: (this.$t('app.commonWords.wrong') as string), desc: response.data.message });
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.sysException') as string) });
return;
}
});
}
/**
* 加载草稿
*
* @param {*} [opt={}]
* @memberof MainBase
*/
public loadDraft(opt: any = {}): void {
if(!this.loaddraftAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'MetaDynamicModelEditView' + (this.$t('app.formpage.notconfig.loaddraftaction') as string) });
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: (this.$t('app.commonWords.wrong') as string), desc: response.data.message });
}
return;
}
const data = response.data;
this.resetDraftFormStates();
this.onFormLoad(data,'loadDraft');
data.metadynamicmodel = null;
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: (this.$t('app.commonWords.wrong') as string), desc: response.data.message });
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.sysException') as string) });
return;
}
});
}
/**
* 自动保存
*
* @param {*} [opt={}]
* @memberof MainBase
*/
public autoSave(opt: any = {}): void {
if (!this.formValidateStatus()) {
return;
}
const arg: any = { ...opt };
const data = this.getValues();
Object.assign(arg, data);
Object.assign(arg,{srfmajortext:data[this.majorMessageField]});
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: (this.$t('app.commonWords.wrong') as string), desc: 'MetaDynamicModelEditView' + (this.$t('app.formpage.notconfig.actionname') as string) });
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: (this.$t('app.commonWords.wrong') as string), desc: response.data.message });
}
return;
}
const data = response.data;
this.onFormLoad(data,'autoSave');
this.$emit('save', data);
AppCenterService.notifyMessage({name:"MetaDynamicModel",action:'appRefresh',data:data});
this.$nextTick(() => {
this.formState.next({ type: 'save', data: data });
});
}).catch((response: any) => {
if (response && response.status && response.data) {
if (response.data.errorKey) {
if(Object.is(response.data.errorKey, "versionCheck")) {
this.$Modal.confirm({
title: (this.$t('app.formpage.saveerror') as string),
content: (this.$t('app.formpage.savecontent') as string),
onOk: () => {
this.refresh([]);
},
onCancel: () => { }
});
} else if(Object.is(response.data.errorKey, 'DupCheck')) {
let errorProp: string = response.data.message.match(/\[[a-zA-Z]*\]/)[0];
let name: string = this.service.getNameByProp(errorProp.substr(1, errorProp.length-2));
if(name) {
this.$Notice.error({
title: (this.$t('app.commonWords.createFailed') as string),
desc: this.detailsModel[name].caption + " : " + arg[name] + (this.$t('app.commonWords.isExist') as string) + '!',
});
} else {
this.$Notice.error({
title: (this.$t('app.commonWords.createFailed') as string),
desc: response.data.message?response.data.message:(this.$t('app.commonWords.sysException') as string),
})
}
}else if(Object.is(response.data.errorKey, 'DuplicateKeyException')){
this.$Notice.error({
title: (this.$t('app.commonWords.createFailed') as string),
desc: this.detailsModel[this.formKeyItemName].caption + " : " + arg[this.formKeyItemName] + (this.$t('app.commonWords.isExist') as string) + '!',
});
} else {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data.message?response.data.message:(this.$t('app.commonWords.sysException') as string) });
}
} else {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data.message?response.data.message:(this.$t('app.commonWords.sysException') as string) });
}
return;
} else {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.sysException') as string) });
}
});
}
/**
* 保存
*
* @param {*} [opt={}]
* @param {boolean} [showResultInfo]
* @param {boolean} [ifStateNext] formState是否下发通知
* @returns {Promise<any>}
* @memberof MainBase
*/
public 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()) {
if(this.errorMessages && this.errorMessages.length > 0) {
let descMessage: string = '';
this.errorMessages.forEach((message: any) => {
descMessage = descMessage + '<p>' + message.error + '<p>';
})
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: descMessage });
} else {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.formpage.valuecheckex') as string) });
}
return;
}
const arg: any = { ...opt };
const data = this.getValues();
Object.assign(arg, this.context);
Object.assign(arg, data);
Object.assign(arg,{srfmajortext:data[this.majorMessageField]});
if (ifStateNext) {
this.drcounter = 0;
if(this.drcounter !== 0){
this.drsaveopt = opt;
this.formState.next({ type: 'beforesave', data: arg });//先通知关系界面保存
this.saveState = resolve;
return;
}
}
if(this.viewparams && this.viewparams.copymode){
data.srfuf = '0';
}
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: (this.$t('app.commonWords.wrong') as string), desc: 'MetaDynamicModelEditView' + (this.$t('app.formpage.notconfig.actionname') as string) });
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: (this.$t('app.commonWords.wrong') as string), desc: response.data.message });
}
return;
}
this.viewparams.copymode = false;
const data = response.data;
this.onFormLoad(data,'save');
this.$emit('save', data);
AppCenterService.notifyMessage({name:"MetaDynamicModel",action:'appRefresh',data:data});
this.$nextTick(() => {
this.formState.next({ type: 'save', data: data });
});
if (showResultInfo) {
this.$Notice.success({ title: '', desc: (data.srfmajortext ? data.srfmajortext : '') + '&nbsp;'+ (this.$t('app.formpage.savesuccess') as string) });
}
resolve(response);
}).catch((response: any) => {
if (response && response.status && response.data) {
if (response.data.errorKey) {
if(Object.is(response.data.errorKey, "versionCheck")) {
this.$Modal.confirm({
title: (this.$t('app.formpage.saveerror') as string),
content: (this.$t('app.formpage.savecontent') as string),
onOk: () => {
this.refresh([]);
},
onCancel: () => { }
});
} else if(Object.is(response.data.errorKey, 'DupCheck')) {
let errorProp: string = response.data.message.match(/\[[a-zA-Z]*\]/)[0];
let name: string = this.service.getNameByProp(errorProp.substr(1, errorProp.length-2));
if(name) {
this.$Notice.error({
title: (this.$t('app.commonWords.createFailed') as string),
desc: this.detailsModel[name].caption + " : " + arg[name] + (this.$t('app.commonWords.isExist') as string) + '!',
});
} else {
this.$Notice.error({
title: (this.$t('app.commonWords.createFailed') as string),
desc: response.data.message,
})
}
} else {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data.message });
}
} else {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data.message });
reject(response);
}
return;
} else {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.sysException') as string) });
reject(response);
}
reject(response);
});
})
}
/**
* 删除
*
* @public
* @param {*} [opt={}]
* @memberof MainBase
*/
public remove(opt:Array<any> = [],showResultInfo?: boolean): Promise<any> {
return new Promise((resolve: any, reject: any) => {
if(!this.removeAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'MetaDynamicModelEditView' + (this.$t('app.formpage.notconfig.removeaction') as string) });
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;' + (this.$t('app.formpage.deletesuccess') as string) });
AppCenterService.notifyMessage({name:"MetaDynamicModel",action:'appRefresh',data:data});
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 MainBase
*/
public async wfstart(data: any,localdata?:any): Promise<any> {
return new Promise((resolve: any, reject: any) => {
const _this: any = this;
const formData:any = this.getData();
const copyData:any = Util.deepCopy(formData);
const post: Promise<any> = Object.is(formData.srfuf, '1')?this.service.update(this.updateAction, JSON.parse(JSON.stringify(this.context)),formData, this.showBusyIndicator,true):this.service.add(this.createAction,JSON.parse(JSON.stringify(this.context)),formData, this.showBusyIndicator,true);
post.then((response:any) =>{
const responseData:any = response.data;
let tempResponseData:any = Util.deepCopy(response);
this.service.handleResponse('save', tempResponseData);
const arg:any = tempResponseData.data;
// 保存完成UI处理
this.onFormLoad(arg,'save');
this.$emit('save', arg);
AppCenterService.notifyMessage({name:"MetaDynamicModel",action:'appRefresh',data:data});
this.$nextTick(() => {
this.formState.next({ type: 'save', data: arg });
});
// 准备工作流数据,填充未存库数据
Object.assign(arg,copyData);
// 准备提交参数
if(this.viewparams){
let copyViewParams:any = Util.deepCopy(this.viewparams);
if(copyViewParams.w){
delete copyViewParams.w;
}
Object.assign(responseData,copyViewParams);
}
Object.assign(arg,{viewparams:responseData});
// 强制补充srfwfmemo
if(this.srfwfmemo){
Object.assign(arg,{srfwfmemo:this.srfwfmemo});
}
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: (this.$t('app.formpage.workflow.starterror') as string) + ', ' + response.data.message });
}
return;
}
this.$Notice.info({ title: '', desc: (this.$t('app.formpage.workflow.startsuccess') as string) });
resolve(response);
}).catch((response: any) => {
if (response && response.status && response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data.message });
reject(response);
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.sysException') as string) });
reject(response);
return;
}
reject(response);
});
}).catch((response: any) => {
if (response && response.status && response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data.message });
reject(response);
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.sysException') as string) });
reject(response);
return;
}
reject(response);
})
});
}
/**
* 工作流提交
*
* @param {*} [data={}]
* @param {*} [localdata={}]
* @returns {Promise<any>}
* @memberof MainBase
*/
public async wfsubmit(data: any,localdata?:any): Promise<any> {
return new Promise((resolve: any, reject: any) => {
const _this: any = this;
const arg: any = data[0];
const copyData:any = Util.deepCopy(arg);
Object.assign(arg,{viewparams:this.viewparams});
if (!arg.metadynamicmodel || Object.is(arg.metadynamicmodel, '')) {
return;
}
const post: Promise<any> = Object.is(arg.srfuf, '1')?this.service.update(this.updateAction, JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator,true):this.service.add(this.createAction,JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator,true);
post.then((response:any) =>{
const responseData:any = response.data;
let tempResponseData:any = Util.deepCopy(response);
this.service.handleResponse('save', tempResponseData);
const arg:any = tempResponseData.data;
// 保存完成UI处理
this.onFormLoad(arg,'save');
this.$emit('save', arg);
AppCenterService.notifyMessage({name:"MetaDynamicModel",action:'appRefresh',data:data});
this.$nextTick(() => {
this.formState.next({ type: 'save', data: arg });
});
// 准备工作流数据,填充未存库数据
Object.assign(arg,copyData);
// 准备提交参数
if(this.viewparams){
Object.assign(responseData,this.viewparams);
}
Object.assign(arg,{viewparams:responseData});
// 强制补充srfwfmemo
if(this.srfwfmemo){
Object.assign(arg,{srfwfmemo:this.srfwfmemo});
}
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: (this.$t('app.formpage.workflow.submiterror') as string) + ', ' + response.data.message });
}
return;
}
this.onFormLoad(arg,'submit');
this.$store.dispatch('viewaction/datasaved', { viewtag: this.viewtag });
this.$Notice.info({ title: '', desc: (this.$t('app.formpage.workflow.submitsuccess') as string) });
resolve(response);
}).catch((response: any) => {
if (response && response.status && response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data.message });
reject(response);
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.sysException') as string) });
reject(response);
return;
}
reject(response);
});
}).catch((response: any) => {
if (response && response.status && response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data.message });
reject(response);
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.sysException') as string) });
reject(response);
return;
}
reject(response);
})
})
}
/**
* 面板行为
*
* @param {string} [action] 调用的实体行为
* @param {string} [emitAction] 抛出行为
* @param {*} [data={}] 传入数据
* @param {boolean} [showloading] 是否显示加载状态
*
* @memberof MainBase
*/
public panelAction(action:string,emitAction:string,data:any ={},showloading?:boolean):void{
if (!action || (action && Object.is(action, ''))) {
return;
}
const arg: any = { ...data };
const formdata = this.getValues();
Object.assign(arg, formdata);
Object.assign(arg,this.viewparams);
const post: Promise<any> = this.service.frontLogic(action,JSON.parse(JSON.stringify(this.context)),arg, showloading);
post.then((response: any) => {
if (!response.status || response.status !== 200) {
if (response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data.message });
}
return;
}
const data = response.data;
this.onFormLoad(data,emitAction);
this.$emit(emitAction, data);
this.$nextTick(() => {
this.formState.next({ type: emitAction, data: data });
});
}).catch((response: any) => {
if (response && response.status && response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data.message });
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.sysException') as string) });
return;
}
});
}
/**
* 表单项更新
*
* @param {string} mode 界面行为名称
* @param {*} [data={}] 请求数据
* @param {string[]} updateDetails 更新项
* @param {boolean} [showloading] 是否显示加载状态
* @returns {void}
* @memberof MainBase
*/
public 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: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.formpage.updateerror') as string) });
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));
AppCenterService.notifyMessage({name:"MetaDynamicModel",action:'appRefresh',data: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: (this.$t('app.commonWords.wrong') as string), desc: response.data.message });
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.sysException') as string) });
return;
}
});
}
/**
* 回车事件
*
* @param {*} $event
* @memberof MainBase
*/
public onEnter($event: any): void {
}
/**
* 保存并退出
*
* @param {any[]} args
* @memberof MainBase
*/
public 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 MainBase
*/
public 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 MainBase
*/
public 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 MainBase
*/
public drdatasaved($event:any){
let _this = this;
this.drcounter--;
if(this.drcounter === 0){
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 MainBase
*/
public createDefault(){
if (this.data.hasOwnProperty('systemid')) {
this.data['systemid'] = this.context['sysid'];
}
if (this.data.hasOwnProperty('pdynainstid')) {
this.data['pdynainstid'] = this.context['pinstid'];
}
}
/**
* 更新默认值
* @memberof MainBase
*/
public updateDefault(){
}
/**
* 面板数据变化处理事件
* @param {any} item 当前列数据
* @param {any} $event 面板事件数据
*
* @memberof MainBase
*/
public onPanelDataChange(item:any,$event:any) {
Object.assign(item, $event, {rowDataState:'update'});
}
}
</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: 'configid',
dataType: 'TEXT',
},
{
name: 'srfmajortext',
prop: 'configname',
dataType: 'TEXT',
},
{
name: 'srftempmode',
},
{
name: 'srfuf',
},
{
name: 'srfdeid',
},
{
name: 'srfsourcekey',
},
{
name: 'configname',
prop: 'configname',
dataType: 'TEXT',
},
{
name: 'formitem',
prop: 'modelfile',
dataType: 'TEXT',
},
{
name: 'systemid',
prop: 'system_id',
dataType: 'TEXT',
},
{
name: 'pdynainstid',
prop: 'pdynainstid',
dataType: 'PICKUP',
},
{
name: 'configid',
prop: 'configid',
dataType: 'TEXT',
},
{
name: 'metadynamicmodel',
prop: 'configid',
dataType: 'FONTKEY',
},
]
}
}
\ No newline at end of file
import { Http,Util,Errorlog } from '@/utils';
import ControlService from '@/widgets/control-service';
import MetaDynamicModelService from '@/service/meta-dynamic-model/meta-dynamic-model-service';
import MainModel from './main-form-model';
/**
* Main 部件服务对象
*
* @export
* @class MainService
*/
export default class MainService extends ControlService {
/**
* 动态模型服务对象
*
* @type {MetaDynamicModelService}
* @memberof MainService
*/
public appEntityService: MetaDynamicModelService = new MetaDynamicModelService({ $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();
}
/**
* 远端数据
*
* @type {*}
* @memberof MainService
*/
private remoteCopyData:any = {};
/**
* 处理数据
*
* @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[]> {
data.page = data.page ? data.page : 0;
data.size = data.size ? data.size : 1000;
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,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.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,true).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]
* @param {boolean} [isWorkflow] 是否在工作流中添加数据
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public add(action: string, context: any = {},data: any = {}, isloading?: boolean,isWorkflow?: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) => {
if(isWorkflow){
resolve(response);
}else{
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]
* @param {boolean} [isWorkflow] 是否在工作流中修改数据
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public update(action: string, context: any = {},data: any = {}, isloading?: boolean,isWorkflow?: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) => {
if(isWorkflow){
resolve(response);
}else{
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.setRemoteCopyData(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);
//仿真主键数据
const PrimaryKey = Util.createUUID();
Data.configid = PrimaryKey;
Data.metadynamicmodel = PrimaryKey;
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.setRemoteCopyData(response);
response.data.configid = PrimaryKey;
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 = {},isMerge:boolean = false){
let mode: any = this.getMode();
if (!mode && mode.getDataItems instanceof Function) {
return data;
}
let formItemItems: any[] = mode.getDataItems();
let requestData:any = {};
if(isMerge && (data && data.viewparams)){
Object.assign(requestData,data.viewparams);
}
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];
}else{
if(item.dataType && Object.is(item.dataType,"FORMPART")){
Object.assign(requestData,data[item.name]);
}
}
}
});
let tempContext:any = JSON.parse(JSON.stringify(context));
if(tempContext && tempContext.srfsessionid){
tempContext.srfsessionkey = tempContext.srfsessionid;
delete tempContext.srfsessionid;
}
return {context:tempContext,data:requestData};
}
/**
* 通过属性名称获取表单项名称
*
* @param name 实体属性名称
* @memberof MainService
*/
public getItemNameByDeName(name:string) :string{
let itemName = name;
let mode: any = this.getMode();
if (!mode && mode.getDataItems instanceof Function) {
return name;
}
let formItemItems: any[] = mode.getDataItems();
formItemItems.forEach((item:any)=>{
if(item.prop === name){
itemName = item.name;
}
});
return itemName.trim();
}
/**
* 重写处理返回数据
*
* @param {string} action
* @param {*} response
* @memberof MainService
*/
public handleResponseData(action: string, data: any = {},isCreate?:boolean,codelistArray?:any){
let model: any = this.getMode();
if (!model && model.getDataItems instanceof Function) {
return data;
}
let item: any = {};
let dataItems: any[] = model.getDataItems();
dataItems.forEach(dataitem => {
let val = data.hasOwnProperty(dataitem.prop) ? data[dataitem.prop] : null;
if (val === null) {
val = data.hasOwnProperty(dataitem.name) ? data[dataitem.name] : null;
}
if((isCreate === undefined || isCreate === null ) && Object.is(dataitem.dataType, 'GUID') && Object.is(dataitem.name, 'srfkey') && (val && !Object.is(val, ''))){
isCreate = true;
}
item[dataitem.name] = val;
// 转化代码表
if(codelistArray && dataitem.codelist){
if(codelistArray.get(dataitem.codelist.tag) && codelistArray.get(dataitem.codelist.tag).get(val)){
item[dataitem.name] = codelistArray.get(dataitem.codelist.tag).get(val);
}
}
});
item.srfuf = data.srfuf ? data.srfuf : (isCreate ? "0" : "1");
item = Object.assign(data,item);
return item;
}
/**
* 设置远端数据
*
* @param result 远端请求结果
* @memberof MainService
*/
public setRemoteCopyData(result:any){
if (result && result.status === 200) {
this.remoteCopyData = Util.deepCopy(result.data);
}
}
/**
* 获取远端数据
*
* @memberof MainService
*/
public getRemoteCopyData(){
return this.remoteCopyData;
}
}
\ 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;
padding: 6px;
> .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;
}
// 表单按钮margin
.app-form-button{
margin:0 6px;
}
}
// 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
...@@ -837,7 +837,7 @@ export default class MainBase extends Vue implements ControlInterface { ...@@ -837,7 +837,7 @@ export default class MainBase extends Vue implements ControlInterface {
*/ */
public load(opt: any = {}, pageReset: boolean = false): void { public load(opt: any = {}, pageReset: boolean = false): void {
if(!this.fetchAction){ if(!this.fetchAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'META_DYNAMICMODELDynaInstGridView'+(this.$t('app.gridpage.notConfig.fetchAction') as string) }); this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'MetaDynamicModelDynaInstGridView'+(this.$t('app.gridpage.notConfig.fetchAction') as string) });
return; return;
} }
if(pageReset){ if(pageReset){
...@@ -932,7 +932,7 @@ export default class MainBase extends Vue implements ControlInterface { ...@@ -932,7 +932,7 @@ export default class MainBase extends Vue implements ControlInterface {
*/ */
public async remove(datas: any[]): Promise<any> { public async remove(datas: any[]): Promise<any> {
if(!this.removeAction){ if(!this.removeAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'META_DYNAMICMODELDynaInstGridView'+(this.$t('app.gridpage.notConfig.removeAction') as string) }); this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'MetaDynamicModelDynaInstGridView'+(this.$t('app.gridpage.notConfig.removeAction') as string) });
return; return;
} }
let _datas:any[] = []; let _datas:any[] = [];
...@@ -1038,7 +1038,7 @@ export default class MainBase extends Vue implements ControlInterface { ...@@ -1038,7 +1038,7 @@ export default class MainBase extends Vue implements ControlInterface {
*/ */
public addBatch(arg: any = {}): void { public addBatch(arg: any = {}): void {
if(!this.fetchAction){ if(!this.fetchAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'META_DYNAMICMODELDynaInstGridView'+(this.$t('app.gridpage.notConfig.fetchAction') as string) }); this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'MetaDynamicModelDynaInstGridView'+(this.$t('app.gridpage.notConfig.fetchAction') as string) });
return; return;
} }
if(!arg){ if(!arg){
...@@ -1914,7 +1914,7 @@ export default class MainBase extends Vue implements ControlInterface { ...@@ -1914,7 +1914,7 @@ export default class MainBase extends Vue implements ControlInterface {
try { try {
if(Object.is(item.rowDataState, 'create')){ if(Object.is(item.rowDataState, 'create')){
if(!this.createAction){ if(!this.createAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'META_DYNAMICMODELDynaInstGridView'+(this.$t('app.gridpage.notConfig.createAction') as string) }); this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'MetaDynamicModelDynaInstGridView'+(this.$t('app.gridpage.notConfig.createAction') as string) });
}else{ }else{
Object.assign(item,{viewparams:this.viewparams}); Object.assign(item,{viewparams:this.viewparams});
let response = await this.service.add(this.createAction, JSON.parse(JSON.stringify(this.context)),item, this.showBusyIndicator); let response = await this.service.add(this.createAction, JSON.parse(JSON.stringify(this.context)),item, this.showBusyIndicator);
...@@ -1922,7 +1922,7 @@ export default class MainBase extends Vue implements ControlInterface { ...@@ -1922,7 +1922,7 @@ export default class MainBase extends Vue implements ControlInterface {
} }
}else if(Object.is(item.rowDataState, 'update')){ }else if(Object.is(item.rowDataState, 'update')){
if(!this.updateAction){ if(!this.updateAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'META_DYNAMICMODELDynaInstGridView'+(this.$t('app.gridpage.notConfig.updateAction') as string) }); this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'MetaDynamicModelDynaInstGridView'+(this.$t('app.gridpage.notConfig.updateAction') as string) });
}else{ }else{
Object.assign(item,{viewparams:this.viewparams}); Object.assign(item,{viewparams:this.viewparams});
if(item.metadynamicmodel){ if(item.metadynamicmodel){
...@@ -1989,7 +1989,7 @@ export default class MainBase extends Vue implements ControlInterface { ...@@ -1989,7 +1989,7 @@ export default class MainBase extends Vue implements ControlInterface {
*/ */
public newRow(args: any[], params?: any, $event?: any, xData?: any): void { public newRow(args: any[], params?: any, $event?: any, xData?: any): void {
if(!this.loaddraftAction){ if(!this.loaddraftAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'META_DYNAMICMODELDynaInstGridView'+(this.$t('app.gridpage.notConfig.loaddraftAction') as string) }); this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'MetaDynamicModelDynaInstGridView'+(this.$t('app.gridpage.notConfig.loaddraftAction') as string) });
return; return;
} }
let _this = this; let _this = this;
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册