提交 248091a3 编写于 作者: ibizdev's avatar ibizdev

Mosher 发布系统代码 [后台服务,演示应用]

上级 274eb7b4
......@@ -175,6 +175,14 @@
"viewname": "IBIZBOOKAutoGroupListView",
"viewtag": "2b42718d8fb3b4c9a01651222304445a"
},
"ibizbookruleseditview": {
"title": "图书编辑视图(值规则)",
"caption": "图书",
"viewtype": "DEEDITVIEW",
"viewmodule": "Sample",
"viewname": "IBIZBOOKRulesEditView",
"viewtag": "2bf74d5d66fa6d8d38b21b090586529b"
},
"ibizbooktreegridexview": {
"title": "图书树表格视图",
"caption": "图书",
......@@ -1023,6 +1031,14 @@
"viewname": "IBIZBOOKDataView",
"viewtag": "dddefe276053bb9682b51318e96b45d6"
},
"ibizbookinterfunceditview": {
"title": "图书编辑视图(内置功能)",
"caption": "图书",
"viewtype": "DEEDITVIEW",
"viewmodule": "Sample",
"viewname": "IBIZBOOKInterFuncEditView",
"viewtag": "de9166f936946237e2d0e5367db078c2"
},
"ibizsample0003spickupview2": {
"title": "IBIZSAMPLE0003数据选择视图",
"caption": "示例实体03",
......
......@@ -22,6 +22,10 @@ export default {
caption: "图书",
title: "图书列表视图(自动分组)",
},
ruleseditview: {
caption: "图书",
title: "图书编辑视图(值规则)",
},
treegridexview: {
caption: "图书",
title: "图书树表格视图",
......@@ -98,6 +102,10 @@ export default {
caption: "图书",
title: "图书数据视图",
},
interfunceditview: {
caption: "图书",
title: "图书编辑视图(内置功能)",
},
usr3dataview: {
caption: "图书",
title: "图书数据视图(代码表分组)",
......@@ -160,6 +168,72 @@ export default {
uiactions: {
},
},
interfuncform_form: {
details: {
group1: "图书基本信息",
formpage1: "基本信息",
group2: "操作信息",
formpage2: "其它",
srfupdatedate: "更新时间",
srforikey: "",
srfkey: "图书标识",
srfmajortext: "图书名称",
srftempmode: "",
srfuf: "",
srfdeid: "",
srfsourcekey: "",
ibizbookid: "图书标识",
ibizbookname: "图书名称",
author: "图书作者",
press: "图书出版社",
price: "图书价格",
type: "图书类型",
booknumber: "图书数量",
subtext: "图书描述",
icon: "图标",
returntime: "归还日期",
lendouttime: "借出日期",
createman: "建立人",
createdate: "建立时间",
updateman: "更新人",
updatedate: "更新时间",
},
uiactions: {
},
},
rulesform_form: {
details: {
group1: "图书基本信息",
formpage1: "基本信息",
group2: "操作信息",
formpage2: "其它",
srfupdatedate: "更新时间",
srforikey: "",
srfkey: "图书标识",
srfmajortext: "图书名称",
srftempmode: "",
srfuf: "",
srfdeid: "",
srfsourcekey: "",
ibizbookid: "图书标识",
ibizbookname: "图书名称",
author: "图书作者",
press: "图书出版社",
price: "图书价格",
type: "图书类型",
booknumber: "图书数量",
subtext: "图书描述",
icon: "图标",
returntime: "归还日期",
lendouttime: "借出日期",
createman: "建立人",
createdate: "建立时间",
updateman: "更新人",
updatedate: "更新时间",
},
uiactions: {
},
},
rowedit_grid: {
columns: {
ibizbookname: "图书名称",
......@@ -861,6 +935,16 @@ export default {
tip: "数据导入",
},
},
interfunceditviewtoolbar_toolbar: {
tbitem3: {
caption: "Save",
tip: "Save",
},
tbitem5: {
caption: "Save And Close",
tip: "Save And Close Window",
},
},
usr5gridviewtoolbar_toolbar: {
},
valuerulesgridviewtoolbar_toolbar: {
......@@ -1003,6 +1087,16 @@ export default {
},
haspanellistviewtoolbar_toolbar: {
},
ruleseditviewtoolbar_toolbar: {
tbitem3: {
caption: "Save",
tip: "Save",
},
tbitem5: {
caption: "Save And Close",
tip: "Save And Close Window",
},
},
tree_treeview: {
nodata:"",
nodes: {
......
......@@ -21,6 +21,10 @@ export default {
caption: "图书",
title: "图书列表视图(自动分组)",
},
ruleseditview: {
caption: "图书",
title: "图书编辑视图(值规则)",
},
treegridexview: {
caption: "图书",
title: "图书树表格视图",
......@@ -97,6 +101,10 @@ export default {
caption: "图书",
title: "图书数据视图",
},
interfunceditview: {
caption: "图书",
title: "图书编辑视图(内置功能)",
},
usr3dataview: {
caption: "图书",
title: "图书数据视图(代码表分组)",
......@@ -159,6 +167,72 @@ export default {
uiactions: {
},
},
interfuncform_form: {
details: {
group1: "图书基本信息",
formpage1: "基本信息",
group2: "操作信息",
formpage2: "其它",
srfupdatedate: "更新时间",
srforikey: "",
srfkey: "图书标识",
srfmajortext: "图书名称",
srftempmode: "",
srfuf: "",
srfdeid: "",
srfsourcekey: "",
ibizbookid: "图书标识",
ibizbookname: "图书名称",
author: "图书作者",
press: "图书出版社",
price: "图书价格",
type: "图书类型",
booknumber: "图书数量",
subtext: "图书描述",
icon: "图标",
returntime: "归还日期",
lendouttime: "借出日期",
createman: "建立人",
createdate: "建立时间",
updateman: "更新人",
updatedate: "更新时间",
},
uiactions: {
},
},
rulesform_form: {
details: {
group1: "图书基本信息",
formpage1: "基本信息",
group2: "操作信息",
formpage2: "其它",
srfupdatedate: "更新时间",
srforikey: "",
srfkey: "图书标识",
srfmajortext: "图书名称",
srftempmode: "",
srfuf: "",
srfdeid: "",
srfsourcekey: "",
ibizbookid: "图书标识",
ibizbookname: "图书名称",
author: "图书作者",
press: "图书出版社",
price: "图书价格",
type: "图书类型",
booknumber: "图书数量",
subtext: "图书描述",
icon: "图标",
returntime: "归还日期",
lendouttime: "借出日期",
createman: "建立人",
createdate: "建立时间",
updateman: "更新人",
updatedate: "更新时间",
},
uiactions: {
},
},
rowedit_grid: {
columns: {
ibizbookname: "图书名称",
......@@ -860,6 +934,16 @@ export default {
tip: "数据导入",
},
},
interfunceditviewtoolbar_toolbar: {
tbitem3: {
caption: "保存",
tip: "保存",
},
tbitem5: {
caption: "保存并关闭",
tip: "保存并关闭",
},
},
usr5gridviewtoolbar_toolbar: {
},
valuerulesgridviewtoolbar_toolbar: {
......@@ -1002,6 +1086,16 @@ export default {
},
haspanellistviewtoolbar_toolbar: {
},
ruleseditviewtoolbar_toolbar: {
tbitem3: {
caption: "保存",
tip: "保存",
},
tbitem5: {
caption: "保存并关闭",
tip: "保存并关闭",
},
},
tree_treeview: {
nodata:"",
nodes: {
......
......@@ -171,7 +171,7 @@ mock.onGet('v7/main-menuappmenu').reply((config: any) => {
iconcls: '',
icon: '',
textcls: '',
appfunctag: '',
appfunctag: 'AppFunc31',
resourcetag: '',
},
{
......
......@@ -183,6 +183,14 @@ mock.onGet('./assets/json/view-config.json').reply((config: any) => {
"viewname": "IBIZBOOKAutoGroupListView",
"viewtag": "2b42718d8fb3b4c9a01651222304445a"
},
"ibizbookruleseditview": {
"title": "图书编辑视图(值规则)",
"caption": "图书",
"viewtype": "DEEDITVIEW",
"viewmodule": "Sample",
"viewname": "IBIZBOOKRulesEditView",
"viewtag": "2bf74d5d66fa6d8d38b21b090586529b"
},
"ibizbooktreegridexview": {
"title": "图书树表格视图",
"caption": "图书",
......@@ -1031,6 +1039,14 @@ mock.onGet('./assets/json/view-config.json').reply((config: any) => {
"viewname": "IBIZBOOKDataView",
"viewtag": "dddefe276053bb9682b51318e96b45d6"
},
"ibizbookinterfunceditview": {
"title": "图书编辑视图(内置功能)",
"caption": "图书",
"viewtype": "DEEDITVIEW",
"viewmodule": "Sample",
"viewname": "IBIZBOOKInterFuncEditView",
"viewtag": "de9166f936946237e2d0e5367db078c2"
},
"ibizsample0003spickupview2": {
"title": "IBIZSAMPLE0003数据选择视图",
"caption": "示例实体03",
......
<template>
<div class="view-container deeditview ibizbookinter-func-edit-view">
<app-studioaction :viewTitle="$t(model.srfCaption)" viewName="ibizbookinterfunceditview"></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.tbitem3.visabled" :disabled="toolBarModels.tbitem3.disabled" class=' deepskyblueToolBar' @click="toolbar_click({ tag: 'tbitem3' }, $event)">
<i class='fa fa-save'></i>
<span class='caption'>{{$t('entities.ibizbook.interfunceditviewtoolbar_toolbar.tbitem3.caption')}}</span>
</i-button>
<div slot='content'>{{$t('entities.ibizbook.interfunceditviewtoolbar_toolbar.tbitem3.tip')}}</div>
</tooltip>
<tooltip :transfer="true" :max-width="600">
<i-button v-show="toolBarModels.tbitem5.visabled" :disabled="toolBarModels.tbitem5.disabled" class='' @click="toolbar_click({ tag: 'tbitem5' }, $event)">
<i class='sx-tb-saveandclose'></i>
<span class='caption'>{{$t('entities.ibizbook.interfunceditviewtoolbar_toolbar.tbitem5.caption')}}</span>
</i-button>
<div slot='content'>{{$t('entities.ibizbook.interfunceditviewtoolbar_toolbar.tbitem5.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 IBIZBOOKService from '@/service/ibizbook/ibizbook-service';
import IBIZBOOKAuthService from '@/authservice/ibizbook/ibizbook-auth-service';
import EditViewEngine from '@engine/view/edit-view-engine';
import IBIZBOOKUIService from '@/uiservice/ibizbook/ibizbook-ui-service';
@Component({
components: {
},
})
export default class IBIZBOOKInterFuncEditViewBase extends Vue {
/**
* 实体服务对象
*
* @type {IBIZBOOKService}
* @memberof IBIZBOOKInterFuncEditViewBase
*/
public appEntityService: IBIZBOOKService = new IBIZBOOKService;
/**
* 实体UI服务对象
*
* @type IBIZBOOKUIService
* @memberof IBIZBOOKInterFuncEditViewBase
*/
public appUIService: IBIZBOOKUIService = new IBIZBOOKUIService(this.$store);
/**
* 数据变化
*
* @param {*} val
* @returns {*}
* @memberof IBIZBOOKInterFuncEditViewBase
*/
@Emit()
public viewDatasChange(val: any):any {
return val;
}
/**
* 传入视图上下文
*
* @type {string}
* @memberof IBIZBOOKInterFuncEditViewBase
*/
@Prop() public viewdata!: string;
/**
* 传入视图参数
*
* @type {string}
* @memberof IBIZBOOKInterFuncEditViewBase
*/
@Prop() public viewparam!: string;
/**
* 视图默认使用
*
* @type {boolean}
* @memberof IBIZBOOKInterFuncEditViewBase
*/
@Prop({ default: true }) public viewDefaultUsage!: boolean;
/**
* 视图默认使用
*
* @type {string}
* @memberof IBIZBOOKInterFuncEditViewBase
*/
@Inject({from:'navModel',default: 'tab'})
public navModel!:string;
/**
* 视图标识
*
* @type {string}
* @memberof IBIZBOOKInterFuncEditViewBase
*/
public viewtag: string = 'de9166f936946237e2d0e5367db078c2';
/**
* 自定义视图导航上下文集合
*
* @type {*}
* @memberof IBIZBOOKInterFuncEditViewBase
*/
public customViewNavContexts:any ={
};
/**
* 自定义视图导航参数集合
*
* @type {*}
* @memberof IBIZBOOKInterFuncEditViewBase
*/
public customViewParams:any ={
};
/**
* 视图模型数据
*
* @type {*}
* @memberof IBIZBOOKInterFuncEditViewBase
*/
public model: any = {
srfCaption: 'entities.ibizbook.views.interfunceditview.caption',
srfTitle: 'entities.ibizbook.views.interfunceditview.title',
srfSubTitle: 'entities.ibizbook.views.interfunceditview.subtitle',
dataInfo: ''
}
/**
* 视图参数变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof IBIZBOOKInterFuncEditViewBase
*/
@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 IBIZBOOKInterFuncEditViewBase
*/
@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 IBIZBOOKInterFuncEditViewBase
*/
public containerModel: any = {
view_toolbar: { name: 'toolbar', type: 'TOOLBAR' },
view_form: { name: 'form', type: 'FORM' },
};
/**
* 视图刷新
*
* @param {*} args
* @memberof IBIZBOOKInterFuncEditViewBase
*/
public refresh(args?: any): void {
const refs: any = this.$refs;
if (refs && refs.form) {
refs.form.refresh();
}
}
/**
* 计数器刷新
*
* @memberof IBIZBOOKInterFuncEditViewBase
*/
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 IBIZBOOKInterFuncEditViewBase
*/
public viewState: Subject<ViewState> = new Subject();
/**
* 工具栏模型
*
* @type {*}
* @memberof IBIZBOOKInterFuncEditView
*/
public toolBarModels: any = {
tbitem3: { name: 'tbitem3', actiontarget: 'NONE', caption: '保存', disabled: false, type: 'DEUIACTION', visabled: true,noprivdisplaymode:2,dataaccaction: '', uiaction: { tag: 'Save', target: '' } },
tbitem5: { name: 'tbitem5', actiontarget: 'NONE', caption: '保存并关闭', disabled: false, type: 'DEUIACTION', visabled: true,noprivdisplaymode:2,dataaccaction: '', uiaction: { tag: 'SaveAndExit', target: '' } },
};
/**
* 视图引擎
*
* @public
* @type {Engine}
* @memberof IBIZBOOKInterFuncEditViewBase
*/
public engine: EditViewEngine = new EditViewEngine();
/**
* 引擎初始化
*
* @public
* @memberof IBIZBOOKInterFuncEditViewBase
*/
public engineInit(): void {
this.engine.init({
view: this,
form: this.$refs.form,
p2k: '0',
keyPSDEField: 'ibizbook',
majorPSDEField: 'ibizbookname',
isLoadDefault: true,
});
}
/**
* 应用导航服务
*
* @type {*}
* @memberof IBIZBOOKInterFuncEditViewBase
*/
public navDataService = NavDataService.getInstance(this.$store);
/**
* 导航服务事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof IBIZBOOKInterFuncEditViewBase
*/
public serviceStateEvent: Subscription | undefined;
/**
* 门户部件状态对象
*
* @type {*}
* @memberof IBIZBOOKInterFuncEditViewBase
*/
@Prop() public portletState?: any;
/**
* 门户部件状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof IBIZBOOKInterFuncEditViewBase
*/
public portletStateEvent: Subscription | undefined;
/**
* 应用上下文
*
* @type {*}
* @memberof IBIZBOOKInterFuncEditViewBase
*/
public context:any = {};
/**
* 视图参数
*
* @type {*}
* @memberof IBIZBOOKInterFuncEditViewBase
*/
public viewparams:any = {};
/**
* 视图缓存数据
*
* @type {*}
* @memberof IBIZBOOKInterFuncEditViewBase
*/
public viewCacheData:any;
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof IBIZBOOKInterFuncEditViewBase
*/
public counterServiceArray:Array<any> = [];
/**
* 解析视图参数
*
* @public
* @memberof IBIZBOOKInterFuncEditViewBase
*/
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,{'ibizbook':inputvalue});
}
//初始化视图唯一标识
Object.assign(this.context,{srfsessionid:this.$util.createUUID()});
this.handleCustomViewData();
//初始化导航数据
this.initNavDataWithRoute();
}
/**
* 处理自定义视图数据
*
* @memberof IBIZBOOKInterFuncEditViewBase
*/
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 IBIZBOOKInterFuncEditViewBase
*/
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 IBIZBOOKInterFuncEditViewBase
*/
public initNavDataWithRoute(data:any = null, isNew:boolean = false, isAlways:boolean = false){
if( isAlways || (this.viewDefaultUsage && Object.is(this.navModel,"route")) ){
this.navDataService.addNavData({id:'ibizbookinter-func-edit-view',tag:this.viewtag,srfkey:isNew ? null : this.context.ibizbook,title:this.$t(this.model.srfCaption),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath});
}
}
/**
* 初始化导航数据(分页模式)
*
* @memberof IBIZBOOKInterFuncEditViewBase
*/
public initNavDataWithTab(data:any = null,isOnlyAdd:boolean = true, isAlways:boolean = false){
if( isAlways || (this.viewDefaultUsage && !Object.is(this.navModel,"route")) ){
this.navDataService.addNavDataByOnly({id:'ibizbookinter-func-edit-view',tag:this.viewtag,srfkey:this.context.ibizbook,title:this.$t(this.model.srfCaption),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath},isOnlyAdd);
}
}
/**
* Vue声明周期
*
* @memberof IBIZBOOKInterFuncEditViewBase
*/
public created() {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof IBIZBOOKInterFuncEditViewBase
*/
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,'ibizbookinter-func-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,'IBIZBOOKInterFuncEditView')){
return;
}
if(Object.is(res.action,'refresh') && _this.refresh && _this.refresh instanceof Function){
_this.refresh();
}
})
}
}
/**
* 销毁之前
*
* @memberof IBIZBOOKInterFuncEditViewBase
*/
public beforeDestroy() {
this.$store.commit('viewaction/removeView', this.viewtag);
}
/**
* Vue声明周期(组件初始化完毕)
*
* @memberof IBIZBOOKInterFuncEditViewBase
*/
public mounted() {
this.afterMounted();
}
/**
* 执行mounted后的逻辑
*
* @memberof IBIZBOOKInterFuncEditViewBase
*/
public afterMounted(){
const _this: any = this;
_this.engineInit();
if (_this.loadModel && _this.loadModel instanceof Function) {
_this.loadModel();
}
}
/**
* toolbar 部件 click 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof IBIZBOOKInterFuncEditViewBase
*/
public toolbar_click($event: any, $event2?: any) {
if (Object.is($event.tag, 'tbitem3')) {
this.toolbar_tbitem3_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem5')) {
this.toolbar_tbitem5_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem9')) {
this.toolbar_tbitem9_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem15')) {
this.toolbar_tbitem15_click(null, '', $event2);
}
}
/**
* form 部件 save 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof IBIZBOOKInterFuncEditViewBase
*/
public form_save($event: any, $event2?: any) {
this.engine.onCtrlEvent('form', 'save', $event);
}
/**
* form 部件 remove 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof IBIZBOOKInterFuncEditViewBase
*/
public form_remove($event: any, $event2?: any) {
this.engine.onCtrlEvent('form', 'remove', $event);
}
/**
* form 部件 load 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof IBIZBOOKInterFuncEditViewBase
*/
public form_load($event: any, $event2?: any) {
this.engine.onCtrlEvent('form', 'load', $event);
}
/**
* 逻辑事件
*
* @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.form;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.Save(datas, contextJO,paramJO, $event, xData,this,"IBIZBOOK");
}
/**
* 逻辑事件
*
* @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.form;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.SaveAndExit(datas, contextJO,paramJO, $event, xData,this,"IBIZBOOK");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem9_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.SaveAndStart(datas, contextJO,paramJO, $event, xData,this,"IBIZBOOK");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem15_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.Print(datas, contextJO,paramJO, $event, xData,this,"IBIZBOOK");
}
/**
* 保存
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof IBIZBOOKInterFuncEditViewBase
*/
public Save(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
// 界面行为容器对象 _this
const _this: any = this;
if (xData && xData.save instanceof Function) {
xData.save().then((response: any) => {
if (!response || response.status !== 200) {
return;
}
_this.$emit('viewdataschange', [{ ...response.data }]);
});
} else if (_this.save && _this.save instanceof Function) {
_this.save();
}
}
/**
* 保存并关闭
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof IBIZBOOKInterFuncEditViewBase
*/
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 IBIZBOOKInterFuncEditViewBase
*/
public SaveAndStart(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
const _this: any = this;
if (!xData || !(xData.wfstart instanceof Function)) {
return;
}
xData.wfstart(args).then((response: any) => {
if (!response || response.status !== 200) {
return;
}
const { data: _data } = response;
if(window.parent){
window.parent.postMessage({ ..._data },'*');
}
if (_this.viewdata) {
_this.$emit('viewdataschange', [{ ..._data }]);
_this.$emit('close');
}else if (this.$tabPageExp) {
this.$tabPageExp.onClose(this.$route.fullPath);
}
});
}
/**
* 打印
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof IBIZBOOKInterFuncEditViewBase
*/
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
* @memberof IBIZBOOKInterFuncEditViewBase
*/
public closeView(args: any[]): void {
let _view: any = this;
if (_view.viewdata) {
_view.$emit('viewdataschange', [args]);
_view.$emit('close', [args]);
} else if (_view.$tabPageExp) {
_view.$tabPageExp.onClose(_view.$route.fullPath);
}
}
/**
* 销毁视图回调
*
* @memberof IBIZBOOKInterFuncEditViewBase
*/
public destroyed(){
this.afterDestroyed();
}
/**
* 执行destroyed后的逻辑
*
* @memberof IBIZBOOKInterFuncEditViewBase
*/
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 './ibizbookinter-func-edit-view.less';
</style>
\ No newline at end of file
.view-card {
>.ivu-card-extra {
top: 5px;
right: 0px;
}
}
.ibizbookinter-func-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
.deepskyblueToolBar {color:white !important;background-color:#108cee !important;}
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import IBIZBOOKInterFuncEditViewBase from './ibizbookinter-func-edit-view-base.vue';
import view_form from '@widgets/ibizbook/inter-func-form-form/inter-func-form-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 IBIZBOOKInterFuncEditView extends IBIZBOOKInterFuncEditViewBase {
}
</script>
\ No newline at end of file
......@@ -74,6 +74,7 @@ export const PageComponents = {
Vue.component('ibizcustomer-pickup-view', () => import('@pages/sample/ibizcustomer-pickup-view/ibizcustomer-pickup-view.vue'));
Vue.component('ibizuniproduct-index-pickup-view', () => import('@pages/sample/ibizuniproduct-index-pickup-view/ibizuniproduct-index-pickup-view.vue'));
Vue.component('ibizsample0003-sf1-edit-view', () => import('@pages/sample/ibizsample0003-sf1-edit-view/ibizsample0003-sf1-edit-view.vue'));
Vue.component('ibizbookinter-func-edit-view', () => import('@pages/sample/ibizbookinter-func-edit-view/ibizbookinter-func-edit-view.vue'));
Vue.component('ibizorder-pie-chart-view', () => import('@pages/sample/ibizorder-pie-chart-view/ibizorder-pie-chart-view.vue'));
Vue.component('ibizorder-detail-sgrid-view9', () => import('@pages/sample/ibizorder-detail-sgrid-view9/ibizorder-detail-sgrid-view9.vue'));
Vue.component('ibizuniproduct-sgrid-view', () => import('@pages/sample/ibizuniproduct-sgrid-view/ibizuniproduct-sgrid-view.vue'));
......
......@@ -1116,6 +1116,20 @@ const router = new Router({
},
component: () => import('@pages/sample/ibizsample0003-sf1-edit-view/ibizsample0003-sf1-edit-view.vue'),
},
{
path: 'ibizbooks/:ibizbook?/interfunceditview/:interfunceditview?',
meta: {
caption: 'entities.ibizbook.views.interfunceditview.caption',
info:'',
parameters: [
{ pathName: 'index', parameterName: 'index' },
{ pathName: 'ibizbooks', parameterName: 'ibizbook' },
{ pathName: 'interfunceditview', parameterName: 'interfunceditview' },
],
requireAuth: true,
},
component: () => import('@pages/sample/ibizbookinter-func-edit-view/ibizbookinter-func-edit-view.vue'),
},
{
path: 'ibizorders/:ibizorder?/piechartview/:piechartview?',
meta: {
......@@ -3606,6 +3620,19 @@ const router = new Router({
},
component: () => import('@pages/sample/ibizbookdata-view/ibizbookdata-view.vue'),
},
{
path: '/ibizbooks/:ibizbook?/interfunceditview/:interfunceditview?',
meta: {
caption: 'entities.ibizbook.views.interfunceditview.caption',
info:'',
parameters: [
{ pathName: 'ibizbooks', parameterName: 'ibizbook' },
{ pathName: 'interfunceditview', parameterName: 'interfunceditview' },
],
requireAuth: true,
},
component: () => import('@pages/sample/ibizbookinter-func-edit-view/ibizbookinter-func-edit-view.vue'),
},
{
path: '/ibizsample0003s/:ibizsample0003?/spickupview2/:spickupview2?',
meta: {
......
......@@ -155,13 +155,14 @@ export const viewstate: any = {
'dddefe276053bb9682b51318e96b45d6',
'b09ceb3081717c0ed4fe19f9986598a0',
'875222727b7ab7dcaccc45808fd38b09',
'de9166f936946237e2d0e5367db078c2',
'9db924c804154be5b442a9737514a6f9',
'b29d930f430c127162f83753d85dd40c',
'36763886cbec62729dca4d4b8dad8161',
'7a8b6138e5893e7aba3b1a5deb3b3036',
'10e721a882036c8c012f35d2a6b00237',
'0c1093afa96df2832f707495afec541e',
'd8a6379b9ddbd161045a288aba0890b6',
'0c1093afa96df2832f707495afec541e',
'd1f311d51e800e95e9b10c49a8b49b5a',
'53269c1ea73ad6fae5d2ac4eced7f9d1',
'7d37165f2f535b4a6d2116188fe83d18',
......@@ -1272,6 +1273,15 @@ export const viewstate: any = {
'b3429ecc4d89a02bc5f5279f1bd7f620',
],
},
{
viewtag: 'de9166f936946237e2d0e5367db078c2',
viewmodule: 'Sample',
viewname: 'IBIZBOOKInterFuncEditView',
viewaction: '',
viewdatachange: false,
refviews: [
],
},
{
viewtag: 'df462fabce815005a40debffad2f43e6',
viewmodule: 'Sample',
......
......@@ -97,6 +97,7 @@ export default class IBIZBOOKUIServiceBase extends UIService {
*/
public initViewMap(){
this.allViewMap.set(':',{viewname:'autogrouplistview',srfappde:'ibizbooks',component:'ibizbookauto-group-list-view'});
this.allViewMap.set(':',{viewname:'ruleseditview',srfappde:'ibizbooks',component:'ibizbookrules-edit-view'});
this.allViewMap.set(':',{viewname:'treegridexview',srfappde:'ibizbooks',component:'ibizbooktree-grid-ex-view'});
this.allViewMap.set(':',{viewname:'groupbycodelistkanbanview',srfappde:'ibizbooks',component:'ibizbookgroup-by-codelist-kan-ban-view'});
this.allViewMap.set(':',{viewname:'usr2gridview',srfappde:'ibizbooks',component:'ibizbookusr2-grid-view'});
......@@ -116,6 +117,7 @@ export default class IBIZBOOKUIServiceBase extends UIService {
this.allViewMap.set(':',{viewname:'usr4dataview',srfappde:'ibizbooks',component:'ibizbookusr4-data-view'});
this.allViewMap.set(':',{viewname:'usr3gridview',srfappde:'ibizbooks',component:'ibizbookusr3-grid-view'});
this.allViewMap.set(':',{viewname:'dataview',srfappde:'ibizbooks',component:'ibizbookdata-view'});
this.allViewMap.set(':',{viewname:'interfunceditview',srfappde:'ibizbooks',component:'ibizbookinter-func-edit-view'});
this.allViewMap.set(':',{viewname:'usr3dataview',srfappde:'ibizbooks',component:'ibizbookusr3-data-view'});
this.allViewMap.set(':',{viewname:'updatedefaultgridview',srfappde:'ibizbooks',component:'ibizbookupdate-default-grid-view'});
this.allViewMap.set(':',{viewname:'usr2dataview',srfappde:'ibizbooks',component:'ibizbookusr2-data-view'});
......
......@@ -527,12 +527,12 @@ export default class MainMenuBase extends Vue implements ControlInterface {
case 'Auto97':
this.clickAuto97(item);
return;
case 'AppFunc6':
this.clickAppFunc6(item);
return;
case 'Auto124':
this.clickAuto124(item);
return;
case 'AppFunc6':
this.clickAppFunc6(item);
return;
case 'Auto262':
this.clickAuto262(item);
return;
......@@ -656,12 +656,12 @@ export default class MainMenuBase extends Vue implements ControlInterface {
case 'Auto408':
this.clickAuto408(item);
return;
case 'AppFunc3':
this.clickAppFunc3(item);
return;
case 'AppFunc19':
this.clickAppFunc19(item);
return;
case 'AppFunc3':
this.clickAppFunc3(item);
return;
case 'Auto235':
this.clickAuto235(item);
return;
......@@ -743,6 +743,9 @@ export default class MainMenuBase extends Vue implements ControlInterface {
case 'AppFunc22':
this.clickAppFunc22(item);
return;
case 'AppFunc31':
this.clickAppFunc31(item);
return;
case 'Auto279':
this.clickAuto279(item);
return;
......@@ -852,18 +855,18 @@ export default class MainMenuBase extends Vue implements ControlInterface {
}
/**
* 图书实体-表格值规则
* 行编辑
*
* @param {*} [item={}]
* @memberof MainMenu
*/
public clickAppFunc6(item: any = {}) {
public clickAuto124(item: any = {}) {
const viewparam: any = {};
Object.assign(viewparam, {});
const deResParameters: any[] = [];
const parameters: any[] = [
{ pathName: 'ibizbooks', parameterName: 'ibizbook' },
{ pathName: 'valuerulesgridview', parameterName: 'valuerulesgridview' },
{ pathName: 'ibizorders', parameterName: 'ibizorder' },
{ pathName: 'sf20gridview', parameterName: 'sf20gridview' },
];
const path: string = this.$viewTool.buildUpRoutePath(this.$route, {}, deResParameters, parameters, [], viewparam);
if(Object.is(this.$route.fullPath,path)){
......@@ -875,18 +878,18 @@ export default class MainMenuBase extends Vue implements ControlInterface {
}
/**
* 行编辑
* 图书实体-表格值规则
*
* @param {*} [item={}]
* @memberof MainMenu
*/
public clickAuto124(item: any = {}) {
public clickAppFunc6(item: any = {}) {
const viewparam: any = {};
Object.assign(viewparam, {});
const deResParameters: any[] = [];
const parameters: any[] = [
{ pathName: 'ibizorders', parameterName: 'ibizorder' },
{ pathName: 'sf20gridview', parameterName: 'sf20gridview' },
{ pathName: 'ibizbooks', parameterName: 'ibizbook' },
{ pathName: 'valuerulesgridview', parameterName: 'valuerulesgridview' },
];
const path: string = this.$viewTool.buildUpRoutePath(this.$route, {}, deResParameters, parameters, [], viewparam);
if(Object.is(this.$route.fullPath,path)){
......@@ -1841,18 +1844,18 @@ export default class MainMenuBase extends Vue implements ControlInterface {
}
/**
* 图书实体行编辑表格
* 功能名称
*
* @param {*} [item={}]
* @memberof MainMenu
*/
public clickAppFunc3(item: any = {}) {
public clickAppFunc19(item: any = {}) {
const viewparam: any = {};
Object.assign(viewparam, {});
const deResParameters: any[] = [];
const parameters: any[] = [
{ pathName: 'ibizbooks', parameterName: 'ibizbook' },
{ pathName: 'roweditgridview', parameterName: 'roweditgridview' },
{ pathName: 'usr4dataview', parameterName: 'usr4dataview' },
];
const path: string = this.$viewTool.buildUpRoutePath(this.$route, {}, deResParameters, parameters, [], viewparam);
if(Object.is(this.$route.fullPath,path)){
......@@ -1864,18 +1867,18 @@ export default class MainMenuBase extends Vue implements ControlInterface {
}
/**
* 功能名称
* 图书实体行编辑表格
*
* @param {*} [item={}]
* @memberof MainMenu
*/
public clickAppFunc19(item: any = {}) {
public clickAppFunc3(item: any = {}) {
const viewparam: any = {};
Object.assign(viewparam, {});
const deResParameters: any[] = [];
const parameters: any[] = [
{ pathName: 'ibizbooks', parameterName: 'ibizbook' },
{ pathName: 'usr4dataview', parameterName: 'usr4dataview' },
{ pathName: 'roweditgridview', parameterName: 'roweditgridview' },
];
const path: string = this.$viewTool.buildUpRoutePath(this.$route, {}, deResParameters, parameters, [], viewparam);
if(Object.is(this.$route.fullPath,path)){
......@@ -2507,6 +2510,29 @@ export default class MainMenuBase extends Vue implements ControlInterface {
})
}
/**
* 图书实体表单(内置功能)
*
* @param {*} [item={}]
* @memberof MainMenu
*/
public clickAppFunc31(item: any = {}) {
const viewparam: any = {};
Object.assign(viewparam, {});
const deResParameters: any[] = [];
const parameters: any[] = [
{ pathName: 'ibizbooks', parameterName: 'ibizbook' },
{ pathName: 'interfunceditview', parameterName: 'interfunceditview' },
];
const path: string = this.$viewTool.buildUpRoutePath(this.$route, {}, deResParameters, parameters, [], viewparam);
if(Object.is(this.$route.fullPath,path)){
return;
}
this.$nextTick(function(){
this.$router.push(path);
})
}
/**
* 表单项输入提示
*
......
......@@ -183,7 +183,7 @@ export default class MainMenuModel {
iconcls: '',
icon: '',
textcls: '',
appfunctag: '',
appfunctag: 'AppFunc31',
resourcetag: '',
authtag:'Web-MainMenu-menuitem107',
},
......
<template>
<i-form :model="this.data" class='app-form' ref='form' id='ibizbook_interfuncform' style="" @on-validate="formItemValidate">
<input style="display:none;" />
<row >
<tabs :animated="false" name='interfuncform' :value="detailsModel.form.activiedPage"
@on-click="detailsModel.form.clickPage($event)">
<tab-pane v-show="detailsModel.formpage1.visible" name='formpage1' :index="0" tab='interfuncform' class=''
:label="(h) =>{
return h('span',{
class:'caption'
},[
$t('entities.ibizbook.interfuncform_form.details.formpage1')
])
}">
<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.ibizbook.interfuncform_form.details.group1')" :isShowCaption="true" uiStyle="DEFAULT" :titleBarCloseMode="0" :isInfoGroupMode="false" >
<row>
<i-col v-show="detailsModel.ibizbookid.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='ibizbookid' :itemRules="this.rules().ibizbookid" class='' :caption="$t('entities.ibizbook.interfuncform_form.details.ibizbookid')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.ibizbookid.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box
v-model="data.ibizbookid"
@enter="onEnter($event)"
unit=""
:disabled="detailsModel.ibizbookid.disabled"
type='text'
style="">
</input-box>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.ibizbookname.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='ibizbookname' :itemRules="this.rules().ibizbookname" class='' :caption="$t('entities.ibizbook.interfuncform_form.details.ibizbookname')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.ibizbookname.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box
v-model="data.ibizbookname"
@enter="onEnter($event)"
unit=""
:disabled="detailsModel.ibizbookname.disabled"
type='text'
style="">
</input-box>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.author.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='author' :itemRules="this.rules().author" class='' :caption="$t('entities.ibizbook.interfuncform_form.details.author')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.author.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box
v-model="data.author"
@enter="onEnter($event)"
unit=""
:disabled="detailsModel.author.disabled"
type='text'
style="">
</input-box>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.press.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='press' :itemRules="this.rules().press" class='' :caption="$t('entities.ibizbook.interfuncform_form.details.press')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.press.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box
v-model="data.press"
@enter="onEnter($event)"
unit=""
:disabled="detailsModel.press.disabled"
type='text'
style="">
</input-box>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.price.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='price' :itemRules="this.rules().price" class='' :caption="$t('entities.ibizbook.interfuncform_form.details.price')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.price.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box
v-model="data.price"
@enter="onEnter($event)"
:disabled="detailsModel.price.disabled"
type='number'
:precision="2"
style="">
</input-box>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.type.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='type' :itemRules="this.rules().type" class='' :caption="$t('entities.ibizbook.interfuncform_form.details.type')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.type.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box
v-model="data.type"
@enter="onEnter($event)"
unit=""
:disabled="detailsModel.type.disabled"
type='text'
style="">
</input-box>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.booknumber.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='booknumber' :itemRules="this.rules().booknumber" class='' :caption="$t('entities.ibizbook.interfuncform_form.details.booknumber')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.booknumber.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box
v-model="data.booknumber"
@enter="onEnter($event)"
unit=""
:disabled="detailsModel.booknumber.disabled"
type='number'
style="">
</input-box>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.subtext.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='subtext' :itemRules="this.rules().subtext" class='' :caption="$t('entities.ibizbook.interfuncform_form.details.subtext')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.subtext.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box
v-model="data.subtext"
@enter="onEnter($event)"
unit=""
:disabled="detailsModel.subtext.disabled"
type='text'
style="">
</input-box>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.icon.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='icon' :itemRules="this.rules().icon" class='' :caption="$t('entities.ibizbook.interfuncform_form.details.icon')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.icon.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box
v-model="data.icon"
@enter="onEnter($event)"
unit=""
:disabled="detailsModel.icon.disabled"
type='text'
style="">
</input-box>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.returntime.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='returntime' :itemRules="this.rules().returntime" class='' :caption="$t('entities.ibizbook.interfuncform_form.details.returntime')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.returntime.error" :isEmptyCaption="false" labelPos="LEFT">
<date-picker type="date" :transfer="true" format="yyyy-MM-dd" :value="data.returntime" :disabled="detailsModel.returntime.disabled" style="min-width: 150px; width:100px;" @on-change="(val1, val2) => { this.data.returntime = val1 }"></date-picker>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.lendouttime.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='lendouttime' :itemRules="this.rules().lendouttime" class='' :caption="$t('entities.ibizbook.interfuncform_form.details.lendouttime')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.lendouttime.error" :isEmptyCaption="false" labelPos="LEFT">
<date-picker type="date" :transfer="true" format="yyyy-MM-dd" :value="data.lendouttime" :disabled="detailsModel.lendouttime.disabled" style="min-width: 150px; width:100px;" @on-change="(val1, val2) => { this.data.lendouttime = val1 }"></date-picker>
</app-form-item>
</i-col>
</row>
</app-form-group>
</i-col>
</tab-pane>
<tab-pane v-show="detailsModel.formpage2.visible" name='formpage2' :index="1" tab='interfuncform' class=''
:label="(h) =>{
return h('span',{
class:'caption'
},[
$t('entities.ibizbook.interfuncform_form.details.formpage2')
])
}">
<i-col v-show="detailsModel.group2.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-group :uiService="appUIService" :data="transformData(data)" :manageContainerStatus="detailsModel.group2.manageContainerStatus" :isManageContainer="detailsModel.group2.isManageContainer" @managecontainerclick="manageContainerClick('group2')" layoutType="TABLE_24COL" titleStyle="" class='' :uiActionGroup="detailsModel.group2.uiActionGroup" @groupuiactionclick="groupUIActionClick($event)" :caption="$t('entities.ibizbook.interfuncform_form.details.group2')" :isShowCaption="true" uiStyle="DEFAULT" :titleBarCloseMode="0" :isInfoGroupMode="false" >
<row>
<i-col v-show="detailsModel.createman.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='createman' :itemRules="this.rules().createman" class='' :caption="$t('entities.ibizbook.interfuncform_form.details.createman')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.createman.error" :isEmptyCaption="false" labelPos="LEFT">
<app-span name='createman' :value="data.createman" dataType="TEXT" :precision="0"
tag='SysOperator' codelistType='DYNAMIC' :data="data" :context="context" :viewparams="viewparams" :localContext ='{ }' :localParam ='{ }' style="">
</app-span>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.createdate.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='createdate' :itemRules="this.rules().createdate" class='' :caption="$t('entities.ibizbook.interfuncform_form.details.createdate')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.createdate.error" :isEmptyCaption="false" labelPos="LEFT">
<app-span name='createdate' :value="data.createdate" dataType="DATETIME" valueFormat="%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS" :precision="0"
:data="data" :context="context" :viewparams="viewparams" :localContext ='{ }' :localParam ='{ }' style="">
</app-span>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.updateman.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='updateman' :itemRules="this.rules().updateman" class='' :caption="$t('entities.ibizbook.interfuncform_form.details.updateman')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.updateman.error" :isEmptyCaption="false" labelPos="LEFT">
<app-span name='updateman' :value="data.updateman" dataType="TEXT" :precision="0"
tag='SysOperator' codelistType='DYNAMIC' :data="data" :context="context" :viewparams="viewparams" :localContext ='{ }' :localParam ='{ }' style="">
</app-span>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.updatedate.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='updatedate' :itemRules="this.rules().updatedate" class='' :caption="$t('entities.ibizbook.interfuncform_form.details.updatedate')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.updatedate.error" :isEmptyCaption="false" labelPos="LEFT">
<app-span name='updatedate' :value="data.updatedate" dataType="DATETIME" valueFormat="%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS" :precision="0"
:data="data" :context="context" :viewparams="viewparams" :localContext ='{ }' :localParam ='{ }' style="">
</app-span>
</app-form-item>
</i-col>
</row>
</app-form-group>
</i-col>
</tab-pane>
</tabs>
</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 IBIZBOOKService from '@/service/ibizbook/ibizbook-service';
import InterFuncFormService from './inter-func-form-form-service';
import IBIZBOOKUIService from '@/uiservice/ibizbook/ibizbook-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 InterFuncFormBase extends Vue implements ControlInterface {
/**
* 名称
*
* @type {string}
* @memberof InterFuncFormBase
*/
@Prop() public name?: string;
/**
* 视图通讯对象
*
* @type {Subject<ViewState>}
* @memberof InterFuncFormBase
*/
@Prop() public viewState!: Subject<ViewState>;
/**
* 应用上下文
*
* @type {*}
* @memberof InterFuncFormBase
*/
@Prop() public context: any;
/**
* 视图参数
*
* @type {*}
* @memberof InterFuncFormBase
*/
@Prop() public viewparams: any;
/**
* 视图状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof InterFuncFormBase
*/
public viewStateEvent: Subscription | undefined;
/**
* 获取部件类型
*
* @returns {string}
* @memberof InterFuncFormBase
*/
public getControlType(): string {
return 'FORM'
}
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof InterFuncFormBase
*/
public counterServiceArray:Array<any> = [];
/**
* 建构部件服务对象
*
* @type {InterFuncFormService}
* @memberof InterFuncFormBase
*/
public service: InterFuncFormService = new InterFuncFormService({ $store: this.$store });
/**
* 实体服务对象
*
* @type {IBIZBOOKService}
* @memberof InterFuncFormBase
*/
public appEntityService: IBIZBOOKService = new IBIZBOOKService({ $store: this.$store });
/**
* 转化数据
*
* @param {any} args
* @memberof InterFuncFormBase
*/
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 InterFuncFormBase
*/
public closeView(args: any): void {
let _this: any = this;
_this.$emit('closeview', [args]);
}
/**
* 计数器刷新
*
* @memberof InterFuncFormBase
*/
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 InterFuncFormBase
*/
@Inject({from:'navModel',default: 'tab'})
public navModel!:string;
/**
* 主键表单项名称
*
* @protected
* @type {string}
* @memberof InterFuncFormBase
*/
public formKeyItemName: string = 'ibizbookid';
/**
* 是否自动加载
*
* @type {boolean}
* @memberof InterFuncFormBase
*/
@Prop({default:false}) public isautoload?:boolean;
/**
* 界面UI服务对象
*
* @type {IBIZBOOKUIService}
* @memberof InterFuncFormBase
*/
public appUIService:IBIZBOOKUIService = new IBIZBOOKUIService(this.$store);
/**
* 工作流审批意见控件绑定值
*
* @memberof InterFuncFormBase
*/
public srfwfmemo:string = "";
/**
* 获取多项数据
*
* @returns {any[]}
* @memberof InterFuncFormBase
*/
public getDatas(): any[] {
return [this.data];
}
/**
* 获取单项树
*
* @returns {*}
* @memberof InterFuncFormBase
*/
public getData(): any {
return this.data;
}
/**
* 是否默认保存
*
* @type {boolean}
* @memberof InterFuncFormBase
*/
@Prop({ default: false }) public autosave?: boolean;
/**
* 显示处理提示
*
* @type {boolean}
* @memberof InterFuncFormBase
*/
@Prop({ default: true }) public showBusyIndicator?: boolean;
/**
* 部件行为--submit
*
* @type {string}
* @memberof InterFuncFormBase
*/
@Prop() public WFSubmitAction!: string;
/**
* 部件行为--start
*
* @type {string}
* @memberof InterFuncFormBase
*/
@Prop() public WFStartAction!: string;
/**
* 部件行为--update
*
* @type {string}
* @memberof InterFuncFormBase
*/
@Prop() public updateAction!: string;
/**
* 部件行为--remove
*
* @type {string}
* @memberof InterFuncFormBase
*/
@Prop() public removeAction!: string;
/**
* 部件行为--loaddraft
*
* @type {string}
* @memberof InterFuncFormBase
*/
@Prop() public loaddraftAction!: string;
/**
* 部件行为--load
*
* @type {string}
* @memberof InterFuncFormBase
*/
@Prop() public loadAction!: string;
/**
* 部件行为--create
*
* @type {string}
* @memberof InterFuncFormBase
*/
@Prop() public createAction!: string;
/**
* 部件行为--create
*
* @type {string}
* @memberof InterFuncFormBase
*/
@Prop() public searchAction!: string;
/**
* 视图标识
*
* @type {string}
* @memberof InterFuncFormBase
*/
@Prop() public viewtag!: string;
/**
* 表单状态
*
* @type {Subject<any>}
* @memberof InterFuncFormBase
*/
public formState: Subject<any> = new Subject();
/**
* 忽略表单项值变化
*
* @type {boolean}
* @memberof InterFuncFormBase
*/
public ignorefieldvaluechange: boolean = false;
/**
* 数据变化
*
* @public
* @type {Subject<any>}
* @memberof InterFuncFormBase
*/
public dataChang: Subject<any> = new Subject();
/**
* 视图状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof InterFuncFormBase
*/
public dataChangEvent: Subscription | undefined;
/**
* 原始数据
*
* @public
* @type {*}
* @memberof InterFuncFormBase
*/
public oldData: any = {};
/**
* 混入表单数据对象
*
* @type {*}
* @memberof InterFuncFormBase
*/
public mixinData:any = {};
/**
* 表单项校验错误提示信息
*
* @memberof InterFuncFormBase
*/
public errorMessages: Array<any> = [];
/**
* 设置表单项错误提示信息
*
* @param {*} prop 表单项字段名
* @param {*} status 校验状态
* @param {*} error 错误信息
* @memberof InterFuncFormBase
*/
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 InterFuncFormBase
*/
public data: any = {
srfupdatedate: null,
srforikey: null,
srfkey: null,
srfmajortext: null,
srftempmode: null,
srfuf: null,
srfdeid: null,
srfsourcekey: null,
ibizbookid: null,
ibizbookname: null,
author: null,
press: null,
price: null,
type: null,
booknumber: null,
subtext: null,
icon: null,
returntime: null,
lendouttime: null,
createman: null,
createdate: null,
updateman: null,
updatedate: null,
ibizbook:null,
};
/**
* 当前执行的行为逻辑
*
* @type {string}
* @memberof InterFuncFormBase
*/
public currentAction: string = "";
/**
* 关系界面计数器
*
* @type {number}
* @memberof InterFuncFormBase
*/
public drcounter: number = 0;
/**
* 需要等待关系界面保存时,第一次调用save参数的备份
*
* @type {number}
* @memberof InterFuncFormBase
*/
public drsaveopt: any = {};
/**
* 表单保存回调存储对象
*
* @type {any}
* @memberof InterFuncFormBase
*/
public saveState:any ;
/**
* 主信息属性映射表单项名称
*
* @type {string}
* @memberof InterFuncFormBase
*/
public majorMessageField: string = "ibizbookname";
/**
* 值规则
*
* @type {*}
* @memberof InterFuncFormBase
*/
public rules() :any {
return {
ibizbookid: [
{ required: this.detailsModel.ibizbookid.required, type: 'string', message: '图书标识 值不能为空', trigger: 'change' },
{ required: this.detailsModel.ibizbookid.required, type: 'string', message: '图书标识 值不能为空', trigger: 'blur' },
],
ibizbookname: [
{ required: this.detailsModel.ibizbookname.required, type: 'string', message: '图书名称 值不能为空', trigger: 'change' },
{ required: this.detailsModel.ibizbookname.required, type: 'string', message: '图书名称 值不能为空', trigger: 'blur' },
],
author: [
{ required: this.detailsModel.author.required, type: 'string', message: '图书作者 值不能为空', trigger: 'change' },
{ required: this.detailsModel.author.required, type: 'string', message: '图书作者 值不能为空', trigger: 'blur' },
],
press: [
{ required: this.detailsModel.press.required, type: 'string', message: '图书出版社 值不能为空', trigger: 'change' },
{ required: this.detailsModel.press.required, type: 'string', message: '图书出版社 值不能为空', trigger: 'blur' },
],
price: [
{ required: this.detailsModel.price.required, type: 'number', message: '图书价格 值不能为空', trigger: 'change' },
{ required: this.detailsModel.price.required, type: 'number', message: '图书价格 值不能为空', trigger: 'blur' },
],
type: [
{ required: this.detailsModel.type.required, type: 'string', message: '图书类型 值不能为空', trigger: 'change' },
{ required: this.detailsModel.type.required, type: 'string', message: '图书类型 值不能为空', trigger: 'blur' },
],
booknumber: [
{ required: this.detailsModel.booknumber.required, type: 'number', message: '图书数量 值不能为空', trigger: 'change' },
{ required: this.detailsModel.booknumber.required, type: 'number', message: '图书数量 值不能为空', trigger: 'blur' },
],
subtext: [
{ required: this.detailsModel.subtext.required, type: 'string', message: '图书描述 值不能为空', trigger: 'change' },
{ required: this.detailsModel.subtext.required, type: 'string', message: '图书描述 值不能为空', trigger: 'blur' },
],
icon: [
{ required: this.detailsModel.icon.required, type: 'string', message: '图标 值不能为空', trigger: 'change' },
{ required: this.detailsModel.icon.required, type: 'string', message: '图标 值不能为空', trigger: 'blur' },
],
returntime: [
{ required: this.detailsModel.returntime.required, type: 'string', message: '归还日期 值不能为空', trigger: 'change' },
{ required: this.detailsModel.returntime.required, type: 'string', message: '归还日期 值不能为空', trigger: 'blur' },
],
lendouttime: [
{ required: this.detailsModel.lendouttime.required, type: 'string', message: '借出日期 值不能为空', trigger: 'change' },
{ required: this.detailsModel.lendouttime.required, type: 'string', message: '借出日期 值不能为空', trigger: 'blur' },
],
createman: [
{ required: this.detailsModel.createman.required, type: 'string', message: '建立人 值不能为空', trigger: 'change' },
{ required: this.detailsModel.createman.required, type: 'string', message: '建立人 值不能为空', trigger: 'blur' },
],
createdate: [
{ required: this.detailsModel.createdate.required, type: 'string', message: '建立时间 值不能为空', trigger: 'change' },
{ required: this.detailsModel.createdate.required, type: 'string', message: '建立时间 值不能为空', trigger: 'blur' },
],
updateman: [
{ required: this.detailsModel.updateman.required, type: 'string', message: '更新人 值不能为空', trigger: 'change' },
{ required: this.detailsModel.updateman.required, type: 'string', message: '更新人 值不能为空', trigger: 'blur' },
],
updatedate: [
{ required: this.detailsModel.updatedate.required, type: 'string', message: '更新时间 值不能为空', trigger: 'change' },
{ required: this.detailsModel.updatedate.required, type: 'string', message: '更新时间 值不能为空', trigger: 'blur' },
],
}
}
/**
* 属性值规则
*
* @type {*}
* @memberof InterFuncFormBase
*/
public deRules:any = {
};
/**
* 校验属性值规则
*
* @public
* @param {{ name: string }} { name }
* @memberof InterFuncFormBase
*/
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 InterFuncFormBase
*/
public detailsModel: any = {
group1: new FormGroupPanelModel({ caption: '图书基本信息', detailType: 'GROUPPANEL', name: 'group1', visible: true, isShowCaption: true, form: this, isControlledContent: false , uiActionGroup: { caption: '', langbase: 'entities.ibizbook.interfuncform_form', extractMode: 'ITEM', details: [] }, isManageContainer: false, showMoreModeItems: [] })
,
formpage1: new FormPageModel({ caption: '基本信息', detailType: 'FORMPAGE', name: 'formpage1', visible: true, isShowCaption: true, form: this, isControlledContent: false })
,
group2: new FormGroupPanelModel({ caption: '操作信息', detailType: 'GROUPPANEL', name: 'group2', visible: true, isShowCaption: true, form: this, isControlledContent: false , uiActionGroup: { caption: '', langbase: 'entities.ibizbook.interfuncform_form', extractMode: 'ITEM', details: [] }, isManageContainer: false, showMoreModeItems: [] })
,
formpage2: new FormPageModel({ caption: '其它', detailType: 'FORMPAGE', name: 'formpage2', visible: true, isShowCaption: true, form: this, isControlledContent: false })
,
srfupdatedate: new FormItemModel({ caption: '更新时间', detailType: 'FORMITEM', name: 'srfupdatedate', visible: true, isShowCaption: true, form: this, isControlledContent: false , required:false, disabled: false, enableCond: 3 })
,
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 })
,
ibizbookid: new FormItemModel({ caption: '图书标识', detailType: 'FORMITEM', name: 'ibizbookid', visible: true, isShowCaption: true, form: this, isControlledContent: false , required:false, disabled: false, enableCond: 3 })
,
ibizbookname: new FormItemModel({ caption: '图书名称', detailType: 'FORMITEM', name: 'ibizbookname', visible: true, isShowCaption: true, form: this, isControlledContent: false , required:true, disabled: false, enableCond: 3 })
,
author: new FormItemModel({ caption: '图书作者', detailType: 'FORMITEM', name: 'author', visible: true, isShowCaption: true, form: this, isControlledContent: false , required:false, disabled: false, enableCond: 3 })
,
press: new FormItemModel({ caption: '图书出版社', detailType: 'FORMITEM', name: 'press', visible: true, isShowCaption: true, form: this, isControlledContent: false , required:false, disabled: false, enableCond: 3 })
,
price: new FormItemModel({ caption: '图书价格', detailType: 'FORMITEM', name: 'price', visible: true, isShowCaption: true, form: this, isControlledContent: false , required:false, disabled: false, enableCond: 3 })
,
type: new FormItemModel({ caption: '图书类型', detailType: 'FORMITEM', name: 'type', visible: true, isShowCaption: true, form: this, isControlledContent: false , required:false, disabled: false, enableCond: 3 })
,
booknumber: new FormItemModel({ caption: '图书数量', detailType: 'FORMITEM', name: 'booknumber', visible: true, isShowCaption: true, form: this, isControlledContent: false , required:false, disabled: false, enableCond: 3 })
,
subtext: new FormItemModel({ caption: '图书描述', detailType: 'FORMITEM', name: 'subtext', visible: true, isShowCaption: true, form: this, isControlledContent: false , required:false, disabled: false, enableCond: 3 })
,
icon: new FormItemModel({ caption: '图标', detailType: 'FORMITEM', name: 'icon', visible: true, isShowCaption: true, form: this, isControlledContent: false , required:false, disabled: false, enableCond: 3 })
,
returntime: new FormItemModel({ caption: '归还日期', detailType: 'FORMITEM', name: 'returntime', visible: true, isShowCaption: true, form: this, isControlledContent: false , required:true, disabled: false, enableCond: 3 })
,
lendouttime: new FormItemModel({ caption: '借出日期', detailType: 'FORMITEM', name: 'lendouttime', visible: true, isShowCaption: true, form: this, isControlledContent: false , required:true, disabled: false, enableCond: 3 })
,
createman: new FormItemModel({ caption: '建立人', detailType: 'FORMITEM', name: 'createman', visible: true, isShowCaption: true, form: this, isControlledContent: false , required:false, disabled: false, enableCond: 3 })
,
createdate: new FormItemModel({ caption: '建立时间', detailType: 'FORMITEM', name: 'createdate', visible: true, isShowCaption: true, form: this, isControlledContent: false , required:false, disabled: false, enableCond: 3 })
,
updateman: new FormItemModel({ caption: '更新人', detailType: 'FORMITEM', name: 'updateman', visible: true, isShowCaption: true, form: this, isControlledContent: false , required:false, disabled: false, enableCond: 3 })
,
updatedate: new FormItemModel({ caption: '更新时间', detailType: 'FORMITEM', name: 'updatedate', visible: true, isShowCaption: true, form: this, isControlledContent: false , required:false, disabled: false, enableCond: 3 })
,
form: new FormTabPanelModel({ caption: 'form', detailType: 'TABPANEL', name: 'form', visible: true, isShowCaption: true, form: this, tabPages: [{ name: 'formpage1', index: 0, visible: true }, { name: 'formpage2', index: 1, visible: true }] }),
};
/**
* 监控表单属性 srfupdatedate 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof InterFuncFormBase
*/
@Watch('data.srfupdatedate')
onSrfupdatedateChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srfupdatedate', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srforikey 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof InterFuncFormBase
*/
@Watch('data.srforikey')
onSrforikeyChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srforikey', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srfkey 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof InterFuncFormBase
*/
@Watch('data.srfkey')
onSrfkeyChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srfkey', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srfmajortext 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof InterFuncFormBase
*/
@Watch('data.srfmajortext')
onSrfmajortextChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srfmajortext', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srftempmode 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof InterFuncFormBase
*/
@Watch('data.srftempmode')
onSrftempmodeChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srftempmode', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srfuf 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof InterFuncFormBase
*/
@Watch('data.srfuf')
onSrfufChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srfuf', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srfdeid 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof InterFuncFormBase
*/
@Watch('data.srfdeid')
onSrfdeidChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srfdeid', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srfsourcekey 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof InterFuncFormBase
*/
@Watch('data.srfsourcekey')
onSrfsourcekeyChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srfsourcekey', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 ibizbookid 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof InterFuncFormBase
*/
@Watch('data.ibizbookid')
onIbizbookidChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'ibizbookid', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 ibizbookname 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof InterFuncFormBase
*/
@Watch('data.ibizbookname')
onIbizbooknameChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'ibizbookname', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 author 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof InterFuncFormBase
*/
@Watch('data.author')
onAuthorChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'author', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 press 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof InterFuncFormBase
*/
@Watch('data.press')
onPressChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'press', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 price 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof InterFuncFormBase
*/
@Watch('data.price')
onPriceChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'price', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 type 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof InterFuncFormBase
*/
@Watch('data.type')
onTypeChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'type', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 booknumber 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof InterFuncFormBase
*/
@Watch('data.booknumber')
onBooknumberChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'booknumber', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 subtext 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof InterFuncFormBase
*/
@Watch('data.subtext')
onSubtextChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'subtext', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 icon 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof InterFuncFormBase
*/
@Watch('data.icon')
onIconChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'icon', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 returntime 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof InterFuncFormBase
*/
@Watch('data.returntime')
onReturntimeChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'returntime', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 lendouttime 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof InterFuncFormBase
*/
@Watch('data.lendouttime')
onLendouttimeChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'lendouttime', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 createman 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof InterFuncFormBase
*/
@Watch('data.createman')
onCreatemanChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'createman', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 createdate 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof InterFuncFormBase
*/
@Watch('data.createdate')
onCreatedateChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'createdate', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 updateman 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof InterFuncFormBase
*/
@Watch('data.updateman')
onUpdatemanChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'updateman', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 updatedate 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof InterFuncFormBase
*/
@Watch('data.updatedate')
onUpdatedateChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'updatedate', newVal: newVal, oldVal: oldVal });
}
/**
* 显示更多模式切换操作
*
* @type {string}
* @memberof InterFuncFormBase
*/
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 InterFuncFormBase
*/
public resetFormData({ name, newVal, oldVal }: { name: string, newVal: any, oldVal: any }): void {
}
/**
* 置空对象
*
* @param {any[]} args
* @memberof InterFuncFormBase
*/
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 InterFuncFormBase
*/
public async formLogic({ name, newVal, oldVal }: { name: string, newVal: any, oldVal: any }){
}
/**
* 表单项检查逻辑
*
* @public
* @param name 属性名
* @memberof InterFuncFormBase
*/
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 InterFuncFormBase
*/
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 InterFuncFormBase
*/
public onFormLoad(data: any = {},action:string): void {
if(Object.is(action,"save") || Object.is(action,"autoSave") || Object.is(action,"submit"))
// 更新context的实体主键
if(data.ibizbook){
Object.assign(this.context,{ibizbook:data.ibizbook})
}
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 InterFuncFormBase
*/
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 InterFuncFormBase
*/
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 InterFuncFormBase
*/
public resetDraftFormStates(): void {
const form: any = this.$refs.form;
if (form) {
form.resetFields();
}
}
/**
* 重置校验结果
*
* @memberof InterFuncFormBase
*/
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 InterFuncFormBase
*/
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 InterFuncFormBase
*/
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 InterFuncFormBase
*/
public getValues(): any {
return this.data;
}
/**
* 表单项值变更
*
* @param {{ name: string, value: any }} $event
* @returns {void}
* @memberof InterFuncFormBase
*/
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 InterFuncFormBase
*/
public onFormItemActionClick(arg:any){
if(arg && (arg instanceof Function)) arg();
}
/**
* 设置数据项值
*
* @param {string} name
* @param {*} value
* @returns {void}
* @memberof InterFuncFormBase
*/
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 InterFuncFormBase
*/
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 InterFuncFormBase
*/
public groupUIActionClick($event: any): void {
if (!$event) {
return;
}
const item:any = $event.item;
}
/**
* Vue声明周期(处理组件的输入属性)
*
* @memberof InterFuncFormBase
*/
public created(): void {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof InterFuncFormBase
*/
public afterCreated(){
if(this.isautoload){
this.autoLoad({srfkey:this.context.documentcenter});
}
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 InterFuncFormBase
*/
public destroyed() {
this.afterDestroy();
}
/**
* 执行destroyed后的逻辑
*
* @memberof InterFuncFormBase
*/
public afterDestroy() {
if (this.viewStateEvent) {
this.viewStateEvent.unsubscribe();
}
if (this.dataChangEvent) {
this.dataChangEvent.unsubscribe();
}
}
/**
*打印
*@memberof @memberof InterFuncFormBase
*/
public print(){
let _this:any = this;
_this.$print({id:'ibizbook_interfuncform',popTitle:'编辑表单(内置功能)'});
}
/**
* 部件刷新
*
* @param {any} args
* @memberof InterFuncFormBase
*/
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 InterFuncFormBase
*/
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 InterFuncFormBase
*/
public load(opt: any = {}): void {
if(!this.loadAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKInterFuncEditView' + (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 InterFuncFormBase
*/
public loadDraft(opt: any = {}): void {
if(!this.loaddraftAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKInterFuncEditView' + (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');
this.data.ibizbookid = null;
data.ibizbook = 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 InterFuncFormBase
*/
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: 'IBIZBOOKInterFuncEditView' + (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:"IBIZBOOK",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 InterFuncFormBase
*/
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: 'IBIZBOOKInterFuncEditView' + (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:"IBIZBOOK",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 InterFuncFormBase
*/
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: 'IBIZBOOKInterFuncEditView' + (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:"IBIZBOOK",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 InterFuncFormBase
*/
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:"IBIZBOOK",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 InterFuncFormBase
*/
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.ibizbook || Object.is(arg.ibizbook, '')) {
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:"IBIZBOOK",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 InterFuncFormBase
*/
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 InterFuncFormBase
*/
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:"IBIZBOOK",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 InterFuncFormBase
*/
public onEnter($event: any): void {
}
/**
* 保存并退出
*
* @param {any[]} args
* @memberof InterFuncFormBase
*/
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 InterFuncFormBase
*/
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 InterFuncFormBase
*/
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 InterFuncFormBase
*/
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 InterFuncFormBase
*/
public createDefault(){
}
/**
* 更新默认值
* @memberof InterFuncFormBase
*/
public updateDefault(){
}
/**
* 面板数据变化处理事件
* @param {any} item 当前列数据
* @param {any} $event 面板事件数据
*
* @memberof InterFuncFormBase
*/
public onPanelDataChange(item:any,$event:any) {
Object.assign(item, $event, {rowDataState:'update'});
}
}
</script>
<style lang='less'>
@import './inter-func-form-form.less';
</style>
\ No newline at end of file
/**
* InterFuncForm 部件模型
*
* @export
* @class InterFuncFormModel
*/
export default class InterFuncFormModel {
/**
* 获取数据项集合
*
* @returns {any[]}
* @memberof InterFuncFormModel
*/
public getDataItems(): any[] {
return [
{
name: 'srfwfmemo',
prop: 'srfwfmemo',
dataType: 'TEXT',
},
// 前端新增修改标识,新增为"0",修改为"1"或未设值
{
name: 'srffrontuf',
prop: 'srffrontuf',
dataType: 'TEXT',
},
{
name: 'srfupdatedate',
prop: 'updatedate',
dataType: 'DATETIME',
},
{
name: 'srforikey',
},
{
name: 'srfkey',
prop: 'ibizbookid',
dataType: 'GUID',
},
{
name: 'srfmajortext',
prop: 'ibizbookname',
dataType: 'TEXT',
},
{
name: 'srftempmode',
},
{
name: 'srfuf',
},
{
name: 'srfdeid',
},
{
name: 'srfsourcekey',
},
{
name: 'ibizbookid',
prop: 'ibizbookid',
dataType: 'GUID',
},
{
name: 'ibizbookname',
prop: 'ibizbookname',
dataType: 'TEXT',
},
{
name: 'author',
prop: 'author',
dataType: 'TEXT',
},
{
name: 'press',
prop: 'press',
dataType: 'TEXT',
},
{
name: 'price',
prop: 'price',
dataType: 'FLOAT',
},
{
name: 'type',
prop: 'type',
dataType: 'TEXT',
},
{
name: 'booknumber',
prop: 'booknumber',
dataType: 'INT',
},
{
name: 'subtext',
prop: 'subtext',
dataType: 'TEXT',
},
{
name: 'icon',
prop: 'icon',
dataType: 'TEXT',
},
{
name: 'returntime',
prop: 'returntime',
dataType: 'DATE',
},
{
name: 'lendouttime',
prop: 'lendouttime',
dataType: 'DATE',
},
{
name: 'createman',
prop: 'createman',
dataType: 'TEXT',
},
{
name: 'createdate',
prop: 'createdate',
dataType: 'DATETIME',
},
{
name: 'updateman',
prop: 'updateman',
dataType: 'TEXT',
},
{
name: 'updatedate',
prop: 'updatedate',
dataType: 'DATETIME',
},
{
name: 'ibizbook',
prop: 'ibizbookid',
dataType: 'FONTKEY',
},
]
}
}
\ No newline at end of file
import { Http,Util,Errorlog } from '@/utils';
import ControlService from '@/widgets/control-service';
import IBIZBOOKService from '@/service/ibizbook/ibizbook-service';
import InterFuncFormModel from './inter-func-form-form-model';
/**
* InterFuncForm 部件服务对象
*
* @export
* @class InterFuncFormService
*/
export default class InterFuncFormService extends ControlService {
/**
* 图书服务对象
*
* @type {IBIZBOOKService}
* @memberof InterFuncFormService
*/
public appEntityService: IBIZBOOKService = new IBIZBOOKService({ $store: this.getStore() });
/**
* 设置从数据模式
*
* @type {boolean}
* @memberof InterFuncFormService
*/
public setTempMode(){
this.isTempMode = false;
}
/**
* Creates an instance of InterFuncFormService.
*
* @param {*} [opts={}]
* @memberof InterFuncFormService
*/
constructor(opts: any = {}) {
super(opts);
this.model = new InterFuncFormModel();
}
/**
* 远端数据
*
* @type {*}
* @memberof InterFuncFormService
*/
private remoteCopyData:any = {};
/**
* 处理数据
*
* @private
* @param {Promise<any>} promise
* @returns {Promise<any>}
* @memberof InterFuncFormService
*/
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 InterFuncFormService
*/
@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 InterFuncFormService
*/
@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 InterFuncFormService
*/
@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 InterFuncFormService
*/
@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);
Object.assign(Data,{ibizbookid: data.ibizbookid, srffrontuf: '1'});
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 InterFuncFormService
*/
@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 InterFuncFormService
*/
@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 InterFuncFormService
*/
@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 InterFuncFormService
*/
@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.ibizbookid = PrimaryKey;
Data.ibizbook = 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.ibizbookid = 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 InterFuncFormService
*/
@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 InterFuncFormService
*/
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 InterFuncFormService
*/
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 InterFuncFormService
*/
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 InterFuncFormService
*/
public setRemoteCopyData(result:any){
if (result && result.status === 200) {
this.remoteCopyData = Util.deepCopy(result.data);
}
}
/**
* 获取远端数据
*
* @memberof InterFuncFormService
*/
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 InterFuncFormBase from './inter-func-form-form-base.vue';
@Component({
components: {
}
})
export default class InterFuncForm extends InterFuncFormBase {
}
</script>
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册