import { Subject } from 'rxjs'; import { EditViewBase } from '@/studio-core'; import EAMLocationStateModelLineService from '@/service/eamlocation-state-model-line/eamlocation-state-model-line-service'; import EAMLocationStateModelLineAuthService from '@/authservice/eamlocation-state-model-line/eamlocation-state-model-line-auth-service'; import EditViewEngine from '@engine/view/edit-view-engine'; import EAMLocationStateModelLineUIService from '@/uiservice/eamlocation-state-model-line/eamlocation-state-model-line-ui-service'; /** * 功能位置状态模型明细编辑视图视图基类 * * @export * @class EAMLocationStateModelLineEditViewBase * @extends {EditViewBase} */ export class EAMLocationStateModelLineEditViewBase extends EditViewBase { /** * 视图对应应用实体名称 * * @protected * @type {string} * @memberof EAMLocationStateModelLineEditViewBase */ protected appDeName: string = 'eamlocationstatemodelline'; /** * 应用实体主键 * * @protected * @type {string} * @memberof EAMLocationStateModelLineEditViewBase */ protected appDeKey: string = 'eamlocationstatemodellineid'; /** * 应用实体主信息 * * @protected * @type {string} * @memberof EAMLocationStateModelLineEditViewBase */ protected appDeMajor: string = 'eamlocationstatemodellinename'; /** * 实体服务对象 * * @type {EAMLocationStateModelLineService} * @memberof EAMLocationStateModelLineEditViewBase */ protected appEntityService: EAMLocationStateModelLineService = new EAMLocationStateModelLineService; /** * 实体权限服务对象 * * @type EAMLocationStateModelLineUIService * @memberof EAMLocationStateModelLineEditViewBase */ public appUIService: EAMLocationStateModelLineUIService = new EAMLocationStateModelLineUIService(this.$store); /** * 计数器服务对象集合 * * @protected * @type {Array<*>} * @memberof EAMLocationStateModelLineEditViewBase */ protected counterServiceArray: Array<any> = []; /** * 视图模型数据 * * @protected * @type {*} * @memberof EAMLocationStateModelLineEditViewBase */ protected model: any = { srfCaption: 'entities.eamlocationstatemodelline.views.editview.caption', srfTitle: 'entities.eamlocationstatemodelline.views.editview.title', srfSubTitle: 'entities.eamlocationstatemodelline.views.editview.subtitle', dataInfo: '' } /** * 容器模型 * * @protected * @type {*} * @memberof EAMLocationStateModelLineEditViewBase */ protected containerModel: any = { view_toolbar: { name: 'toolbar', type: 'TOOLBAR' }, view_form: { name: 'form', type: 'FORM' }, }; /** * 工具栏模型 * * @type {*} * @memberof EAMLocationStateModelLineEditView */ public toolBarModels: any = { tbitem2: { name: 'tbitem2', caption: '保存并关闭', 'isShowCaption': true, 'isShowIcon': true, tooltip: '保存并关闭', iconcls: 'sx-tb-saveandclose', icon: '../sasrfex/images/default/icon_saveandclose.png', disabled: false, type: 'DEUIACTION', visabled: true,noprivdisplaymode:2,dataaccaction: '', uiaction: { tag: 'SaveAndExit', target: '', class: '' } }, tbitem1: { name: 'tbitem1', caption: '关闭', 'isShowCaption': true, 'isShowIcon': true, tooltip: '关闭', iconcls: 'fa fa-sign-out', icon: '', disabled: false, type: 'DEUIACTION', visabled: true,noprivdisplaymode:2,dataaccaction: '', uiaction: { tag: 'Exit', target: '', class: '' } }, }; /** * 视图唯一标识 * * @protected * @type {string} * @memberof ViewBase */ protected viewtag: string = 'b3d85711a6feb998249451ba167895d2'; /** * 视图引擎 * * @public * @type {Engine} * @memberof EAMLocationStateModelLineEditViewBase */ public engine: EditViewEngine = new EditViewEngine(); /** * 引擎初始化 * * @public * @memberof EAMLocationStateModelLineEditViewBase */ public engineInit(): void { this.engine.init({ view: this, form: this.$refs.form, p2k: '0', keyPSDEField: 'eamlocationstatemodelline', majorPSDEField: 'eamlocationstatemodellinename', isLoadDefault: true, }); } /** * toolbar 部件 click 事件 * * @param {*} [args={}] * @param {*} $event * @memberof EAMLocationStateModelLineEditViewBase */ public toolbar_click($event: any, $event2?: any): void { if (Object.is($event.tag, 'tbitem2')) { this.toolbar_tbitem2_click(null, '', $event2); } if (Object.is($event.tag, 'tbitem1')) { this.toolbar_tbitem1_click(null, '', $event2); } } /** * form 部件 save 事件 * * @param {*} [args={}] * @param {*} $event * @memberof EAMLocationStateModelLineEditViewBase */ public form_save($event: any, $event2?: any): void { this.engine.onCtrlEvent('form', 'save', $event); } /** * form 部件 remove 事件 * * @param {*} [args={}] * @param {*} $event * @memberof EAMLocationStateModelLineEditViewBase */ public form_remove($event: any, $event2?: any): void { this.engine.onCtrlEvent('form', 'remove', $event); } /** * form 部件 load 事件 * * @param {*} [args={}] * @param {*} $event * @memberof EAMLocationStateModelLineEditViewBase */ public form_load($event: any, $event2?: any): void { this.engine.onCtrlEvent('form', 'load', $event); } /** * 逻辑事件 * * @param {*} [params={}] * @param {*} [tag] * @param {*} [$event] * @memberof */ public toolbar_tbitem2_click(params: any = {}, tag?: any, $event?: any) { // 参数 // 取数 let datas: any[] = []; let xData: any = null; // _this 指向容器对象 const _this: any = this; let paramJO:any = {}; let contextJO:any = {}; xData = this.$refs.form; if (xData.getDatas && xData.getDatas instanceof Function) { datas = [...xData.getDatas()]; } if(params){ datas = [params]; } // 界面行为 this.SaveAndExit(datas, contextJO,paramJO, $event, xData,this,"EAMLocationStateModelLine"); } /** * 逻辑事件 * * @param {*} [params={}] * @param {*} [tag] * @param {*} [$event] * @memberof */ public toolbar_tbitem1_click(params: any = {}, tag?: any, $event?: any) { // 参数 // 取数 let datas: any[] = []; let xData: any = null; // _this 指向容器对象 const _this: any = this; let paramJO:any = {}; let contextJO:any = {}; xData = this.$refs.form; if (xData.getDatas && xData.getDatas instanceof Function) { datas = [...xData.getDatas()]; } if(params){ datas = [params]; } // 界面行为 this.Exit(datas, contextJO,paramJO, $event, xData,this,"EAMLocationStateModelLine"); } /** * 保存并关闭 * * @param {any[]} args 当前数据 * @param {any} contextJO 行为附加上下文 * @param {*} [params] 附加参数 * @param {*} [$event] 事件源 * @param {*} [xData] 执行行为所需当前部件 * @param {*} [actionContext] 执行行为上下文 * @memberof EAMLocationStateModelLineEditViewBase */ 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 EAMLocationStateModelLineEditViewBase */ public Exit(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) { this.closeView(args); if(window.parent){ window.parent.postMessage([{ ...args }],'*'); } } }