import { Subject } from 'rxjs'; import { GridViewBase } from '@/studio-core'; import ProductSalesLiteratureService from '@/service/product-sales-literature/product-sales-literature-service'; import ProductSalesLiteratureAuthService from '@/authservice/product-sales-literature/product-sales-literature-auth-service'; import GridViewEngine from '@engine/view/grid-view-engine'; import ProductSalesLiteratureUIService from '@/uiservice/product-sales-literature/product-sales-literature-ui-service'; import CodeListService from "@service/app/codelist-service"; /** * 宣传资料产品明细视图基类 * * @export * @class ProductSalesLiteratureSalLitProGridViewBase * @extends {GridViewBase} */ export class ProductSalesLiteratureSalLitProGridViewBase extends GridViewBase { /** * 视图对应应用实体名称 * * @protected * @type {string} * @memberof ProductSalesLiteratureSalLitProGridViewBase */ protected appDeName: string = 'productsalesliterature'; /** * 应用实体主键 * * @protected * @type {string} * @memberof ProductSalesLiteratureSalLitProGridViewBase */ protected appDeKey: string = 'relationshipsid'; /** * 应用实体主信息 * * @protected * @type {string} * @memberof ProductSalesLiteratureSalLitProGridViewBase */ protected appDeMajor: string = 'relationshipsname'; /** * 实体服务对象 * * @type {ProductSalesLiteratureService} * @memberof ProductSalesLiteratureSalLitProGridViewBase */ protected appEntityService: ProductSalesLiteratureService = new ProductSalesLiteratureService; /** * 实体权限服务对象 * * @type ProductSalesLiteratureUIService * @memberof ProductSalesLiteratureSalLitProGridViewBase */ public appUIService: ProductSalesLiteratureUIService = new ProductSalesLiteratureUIService(this.$store); /** * 计数器服务对象集合 * * @protected * @type {Array<*>} * @memberof ProductSalesLiteratureSalLitProGridViewBase */ protected counterServiceArray: Array<any> = []; /** * 视图模型数据 * * @protected * @type {*} * @memberof ProductSalesLiteratureSalLitProGridViewBase */ protected model: any = { srfCaption: 'entities.productsalesliterature.views.sallitprogridview.caption', srfTitle: 'entities.productsalesliterature.views.sallitprogridview.title', srfSubTitle: 'entities.productsalesliterature.views.sallitprogridview.subtitle', dataInfo: '' } /** * 容器模型 * * @protected * @type {*} * @memberof ProductSalesLiteratureSalLitProGridViewBase */ protected containerModel: any = { view_toolbar: { name: 'toolbar', type: 'TOOLBAR' }, view_grid: { name: 'grid', type: 'GRID' }, view_searchform: { name: 'searchform', type: 'SEARCHFORM' }, }; /** * 工具栏模型 * * @type {*} * @memberof ProductSalesLiteratureSalLitProGridView */ public toolBarModels: any = { deuiaction1: { name: 'deuiaction1', caption: '新建', 'isShowCaption': true, 'isShowIcon': true, tooltip: '新建', iconcls: 'fa fa-file-text-o', icon: '', disabled: false, type: 'DEUIACTION', visabled: true,noprivdisplaymode:2,dataaccaction: '', uiaction: { tag: 'New', target: '', class: '' } }, tbitem2: { name: 'tbitem2', type: 'SEPERATOR', visabled: true, dataaccaction: '', uiaction: { } }, tbitem4: { name: 'tbitem4', caption: '编辑', 'isShowCaption': true, 'isShowIcon': true, tooltip: '编辑', iconcls: 'fa fa-edit', icon: '', disabled: false, type: 'DEUIACTION', visabled: true,noprivdisplaymode:2,dataaccaction: '', uiaction: { tag: 'Edit', target: 'SINGLEKEY', class: '' } }, tbitem7: { name: 'tbitem7', type: 'SEPERATOR', visabled: true, dataaccaction: '', uiaction: { } }, tbitem8: { name: 'tbitem8', caption: '删除', 'isShowCaption': true, 'isShowIcon': true, tooltip: '删除', iconcls: 'fa fa-remove', icon: '', disabled: false, type: 'DEUIACTION', visabled: true,noprivdisplaymode:2,dataaccaction: '', uiaction: { tag: 'Remove', target: 'MULTIKEY', class: '' } }, tbitem9: { name: 'tbitem9', type: 'SEPERATOR', visabled: true, dataaccaction: '', uiaction: { } }, tbitem13: { name: 'tbitem13', caption: '导出', 'isShowCaption': true, 'isShowIcon': true, tooltip: '导出', iconcls: 'fa fa-file-excel-o', icon: '', disabled: false, type: 'DEUIACTION', visabled: true,noprivdisplaymode:2,dataaccaction: '', uiaction: { tag: 'ExportExcel', target: '' }, MaxRowCount: 1000, class: '' }, tbitem10: { name: 'tbitem10', type: 'SEPERATOR', visabled: true, dataaccaction: '', uiaction: { } }, tbitem19: { name: 'tbitem19', caption: '过滤', 'isShowCaption': true, 'isShowIcon': true, tooltip: '过滤', iconcls: 'fa fa-filter', icon: '', disabled: false, type: 'DEUIACTION', visabled: true,noprivdisplaymode:2,dataaccaction: '', uiaction: { tag: 'ToggleFilter', target: '', class: '' } }, }; /** * 视图唯一标识 * * @protected * @type {string} * @memberof ViewBase */ protected viewtag: string = '96cc644d7d763e47f3644aed0d9850f0'; /** * 视图引擎 * * @public * @type {Engine} * @memberof ProductSalesLiteratureSalLitProGridViewBase */ public engine: GridViewEngine = new GridViewEngine(); /** * 引擎初始化 * * @public * @memberof ProductSalesLiteratureSalLitProGridViewBase */ public engineInit(): void { this.engine.init({ view: this, opendata: (args: any[],fullargs?:any[],params?: any, $event?: any, xData?: any) => { this.opendata(args,fullargs, params, $event, xData); }, newdata: (args: any[],fullargs?:any[],params?: any, $event?: any, xData?: any) => { this.newdata(args,fullargs, params, $event, xData); }, grid: this.$refs.grid, searchform: this.$refs.searchform, keyPSDEField: 'productsalesliterature', majorPSDEField: 'relationshipsname', isLoadDefault: true, }); } /** * toolbar 部件 click 事件 * * @param {*} [args={}] * @param {*} $event * @memberof ProductSalesLiteratureSalLitProGridViewBase */ public toolbar_click($event: any, $event2?: any): void { if (Object.is($event.tag, 'deuiaction1')) { this.toolbar_deuiaction1_click(null, '', $event2); } if (Object.is($event.tag, 'tbitem4')) { this.toolbar_tbitem4_click(null, '', $event2); } if (Object.is($event.tag, 'tbitem8')) { this.toolbar_tbitem8_click(null, '', $event2); } if (Object.is($event.tag, 'tbitem13')) { this.toolbar_tbitem13_click(null, '', $event2); } if (Object.is($event.tag, 'tbitem11')) { this.toolbar_tbitem11_click(null, '', $event2); } if (Object.is($event.tag, 'tbitem19')) { this.toolbar_tbitem19_click(null, '', $event2); } } /** * grid 部件 selectionchange 事件 * * @param {*} [args={}] * @param {*} $event * @memberof ProductSalesLiteratureSalLitProGridViewBase */ public grid_selectionchange($event: any, $event2?: any): void { this.engine.onCtrlEvent('grid', 'selectionchange', $event); } /** * grid 部件 beforeload 事件 * * @param {*} [args={}] * @param {*} $event * @memberof ProductSalesLiteratureSalLitProGridViewBase */ public grid_beforeload($event: any, $event2?: any): void { this.engine.onCtrlEvent('grid', 'beforeload', $event); } /** * grid 部件 rowdblclick 事件 * * @param {*} [args={}] * @param {*} $event * @memberof ProductSalesLiteratureSalLitProGridViewBase */ public grid_rowdblclick($event: any, $event2?: any): void { this.engine.onCtrlEvent('grid', 'rowdblclick', $event); } /** * grid 部件 remove 事件 * * @param {*} [args={}] * @param {*} $event * @memberof ProductSalesLiteratureSalLitProGridViewBase */ public grid_remove($event: any, $event2?: any): void { this.engine.onCtrlEvent('grid', 'remove', $event); } /** * grid 部件 load 事件 * * @param {*} [args={}] * @param {*} $event * @memberof ProductSalesLiteratureSalLitProGridViewBase */ public grid_load($event: any, $event2?: any): void { this.engine.onCtrlEvent('grid', 'load', $event); } /** * searchform 部件 save 事件 * * @param {*} [args={}] * @param {*} $event * @memberof ProductSalesLiteratureSalLitProGridViewBase */ public searchform_save($event: any, $event2?: any): void { this.engine.onCtrlEvent('searchform', 'save', $event); } /** * searchform 部件 search 事件 * * @param {*} [args={}] * @param {*} $event * @memberof ProductSalesLiteratureSalLitProGridViewBase */ public searchform_search($event: any, $event2?: any): void { this.engine.onCtrlEvent('searchform', 'search', $event); } /** * searchform 部件 load 事件 * * @param {*} [args={}] * @param {*} $event * @memberof ProductSalesLiteratureSalLitProGridViewBase */ public searchform_load($event: any, $event2?: any): void { this.engine.onCtrlEvent('searchform', 'load', $event); } /** * 逻辑事件 * * @param {*} [params={}] * @param {*} [tag] * @param {*} [$event] * @memberof */ public toolbar_deuiaction1_click(params: any = {}, tag?: any, $event?: any) { // 参数 // 取数 let datas: any[] = []; let xData: any = null; // _this 指向容器对象 const _this: any = this; let paramJO:any = {}; let contextJO:any = {}; xData = this.$refs.grid; if (xData.getDatas && xData.getDatas instanceof Function) { datas = [...xData.getDatas()]; } if(params){ datas = [params]; } // 界面行为 this.New(datas, contextJO,paramJO, $event, xData,this,"ProductSalesLiterature"); } /** * 逻辑事件 * * @param {*} [params={}] * @param {*} [tag] * @param {*} [$event] * @memberof */ public toolbar_tbitem4_click(params: any = {}, tag?: any, $event?: any) { // 参数 // 取数 let datas: any[] = []; let xData: any = null; // _this 指向容器对象 const _this: any = this; let paramJO:any = {}; let contextJO:any = {}; xData = this.$refs.grid; if (xData.getDatas && xData.getDatas instanceof Function) { datas = [...xData.getDatas()]; } if(params){ datas = [params]; } // 界面行为 this.Edit(datas, contextJO,paramJO, $event, xData,this,"ProductSalesLiterature"); } /** * 逻辑事件 * * @param {*} [params={}] * @param {*} [tag] * @param {*} [$event] * @memberof */ public toolbar_tbitem8_click(params: any = {}, tag?: any, $event?: any) { // 参数 // 取数 let datas: any[] = []; let xData: any = null; // _this 指向容器对象 const _this: any = this; let paramJO:any = {}; let contextJO:any = {}; xData = this.$refs.grid; if (xData.getDatas && xData.getDatas instanceof Function) { datas = [...xData.getDatas()]; } if(params){ datas = [params]; } // 界面行为 this.Remove(datas, contextJO,paramJO, $event, xData,this,"ProductSalesLiterature"); } /** * 逻辑事件 * * @param {*} [params={}] * @param {*} [tag] * @param {*} [$event] * @memberof */ public toolbar_tbitem13_click(params: any = {}, tag?: any, $event?: any) { // 参数 // 取数 let datas: any[] = []; let xData: any = null; // _this 指向容器对象 const _this: any = this; let paramJO:any = {}; let contextJO:any = {}; xData = this.$refs.grid; if (xData.getDatas && xData.getDatas instanceof Function) { datas = [...xData.getDatas()]; } if(params){ datas = [params]; } // 界面行为 this.ExportExcel(datas, contextJO,paramJO, $event, xData,this,"ProductSalesLiterature"); } /** * 逻辑事件 * * @param {*} [params={}] * @param {*} [tag] * @param {*} [$event] * @memberof */ public toolbar_tbitem11_click(params: any = {}, tag?: any, $event?: any) { // 参数 // 取数 let datas: any[] = []; let xData: any = null; // _this 指向容器对象 const _this: any = this; let paramJO:any = {}; let contextJO:any = {}; xData = this.$refs.grid; if (xData.getDatas && xData.getDatas instanceof Function) { datas = [...xData.getDatas()]; } if(params){ datas = [params]; } // 界面行为 this.Print(datas, contextJO,paramJO, $event, xData,this,"ProductSalesLiterature"); } /** * 逻辑事件 * * @param {*} [params={}] * @param {*} [tag] * @param {*} [$event] * @memberof */ public toolbar_tbitem19_click(params: any = {}, tag?: any, $event?: any) { // 参数 // 取数 let datas: any[] = []; let xData: any = null; // _this 指向容器对象 const _this: any = this; let paramJO:any = {}; let contextJO:any = {}; xData = this.$refs.grid; if (xData.getDatas && xData.getDatas instanceof Function) { datas = [...xData.getDatas()]; } if(params){ datas = [params]; } // 界面行为 this.ToggleFilter(datas, contextJO,paramJO, $event, xData,this,"ProductSalesLiterature"); } /** * 打开新建数据视图 * * @param {any[]} args * @param {*} [params] * @param {*} [fullargs] * @param {*} [$event] * @param {*} [xData] * @memberof ProductSalesLiteratureSalLitProGridView */ public newdata(args: any[],fullargs?:any[], params?: any, $event?: any, xData?: any) { let localContext:any = null; let localViewParam:any =null; const data: any = {}; if(args[0].srfsourcekey){ data.srfsourcekey = args[0].srfsourcekey; } let tempContext = JSON.parse(JSON.stringify(this.context)); delete tempContext.productsalesliterature; if(args.length >0){ Object.assign(tempContext,args[0]); } let deResParameters: any[] = []; if(tempContext.salesliterature && true){ deResParameters = [ { pathName: 'salesliteratures', parameterName: 'salesliterature' }, ] } const parameters: any[] = [ { pathName: 'productsalesliteratures', parameterName: 'productsalesliterature' }, ]; const _this: any = this; const openPopupModal = (view: any, data: any) => { let container: Subject<any> = this.$appmodal.openModal(view, tempContext, data); container.subscribe((result: any) => { if (!result || !Object.is(result.ret, 'OK')) { return; } if (!xData || !(xData.refresh instanceof Function)) { return; } xData.refresh(result.datas); }); } const view: any = { viewname: 'product-sales-literature-sal-lit-pro-edit-view', height: 0, width: 0, title: this.$t('entities.productsalesliterature.views.sallitproeditview.title'), }; openPopupModal(view, data); } /** * 打开编辑数据视图 * * @param {any[]} args * @param {*} [params] * @param {*} [fullargs] * @param {*} [$event] * @param {*} [xData] * @memberof ProductSalesLiteratureSalLitProGridView */ public opendata(args: any[],fullargs?:any[],params?: any, $event?: any, xData?: any) { const localContext: any = null; const localViewParam: any =null; const data: any = {}; let tempContext = JSON.parse(JSON.stringify(this.context)); if(args.length >0){ Object.assign(tempContext,args[0]); } let deResParameters: any[] = []; if(tempContext.salesliterature && true){ deResParameters = [ { pathName: 'salesliteratures', parameterName: 'salesliterature' }, ] } const parameters: any[] = [ { pathName: 'productsalesliteratures', parameterName: 'productsalesliterature' }, ]; const _this: any = this; const openPopupModal = (view: any, data: any) => { let container: Subject<any> = this.$appmodal.openModal(view, tempContext, data); container.subscribe((result: any) => { if (!result || !Object.is(result.ret, 'OK')) { return; } if (!xData || !(xData.refresh instanceof Function)) { return; } xData.refresh(result.datas); }); } const view: any = { viewname: 'product-sales-literature-sal-lit-pro-edit-view', height: 0, width: 0, title: this.$t('entities.productsalesliterature.views.sallitproeditview.title'), }; openPopupModal(view, data); } /** * 新建 * * @param {any[]} args 当前数据 * @param {any} contextJO 行为附加上下文 * @param {*} [params] 附加参数 * @param {*} [$event] 事件源 * @param {*} [xData] 执行行为所需当前部件 * @param {*} [actionContext] 执行行为上下文 * @memberof ProductSalesLiteratureSalLitProGridViewBase */ public New(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) { const _this: any = this; if (_this.newdata && _this.newdata instanceof Function) { const data: any = {}; _this.newdata([{ ...data }],[{ ...data }], params, $event, xData); } else { _this.$Notice.error({ title: '错误', desc: 'newdata 视图处理逻辑不存在,请添加!' }); } } /** * 编辑 * * @param {any[]} args 当前数据 * @param {any} contextJO 行为附加上下文 * @param {*} [params] 附加参数 * @param {*} [$event] 事件源 * @param {*} [xData] 执行行为所需当前部件 * @param {*} [actionContext] 执行行为上下文 * @memberof ProductSalesLiteratureSalLitProGridViewBase */ public Edit(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) { if (args.length === 0) { return; } const _this: any = this; if (_this.opendata && _this.opendata instanceof Function) { const data: any = { }; if (args.length > 0) { Object.assign(data, { productsalesliterature: args[0].productsalesliterature }) } _this.opendata([{ ...data }], params, $event, xData); } else { _this.$Notice.error({ title: '错误', desc: 'opendata 视图处理逻辑不存在,请添加!' }); } } /** * 删除 * * @param {any[]} args 当前数据 * @param {any} contextJO 行为附加上下文 * @param {*} [params] 附加参数 * @param {*} [$event] 事件源 * @param {*} [xData] 执行行为所需当前部件 * @param {*} [actionContext] 执行行为上下文 * @memberof ProductSalesLiteratureSalLitProGridViewBase */ public Remove(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) { const _this: any = this; if (!xData || !(xData.remove instanceof Function)) { return ; } xData.remove(args); } /** * 导出 * * @param {any[]} args 当前数据 * @param {any} contextJO 行为附加上下文 * @param {*} [params] 附加参数 * @param {*} [$event] 事件源 * @param {*} [xData] 执行行为所需当前部件 * @param {*} [actionContext] 执行行为上下文 * @memberof ProductSalesLiteratureSalLitProGridViewBase */ public ExportExcel(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) { const _this: any = this; if (!xData || !(xData.exportExcel instanceof Function) || !$event) { return ; } xData.exportExcel($event.exportparms); } /** * 打印 * * @param {any[]} args 当前数据 * @param {any} contextJO 行为附加上下文 * @param {*} [params] 附加参数 * @param {*} [$event] 事件源 * @param {*} [xData] 执行行为所需当前部件 * @param {*} [actionContext] 执行行为上下文 * @memberof ProductSalesLiteratureSalLitProGridViewBase */ public Print(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) { let _this:any = this; if (!xData || !(xData.print instanceof Function) || !$event) { return ; } xData.print(); } /** * 过滤 * * @param {any[]} args 当前数据 * @param {any} contextJO 行为附加上下文 * @param {*} [params] 附加参数 * @param {*} [$event] 事件源 * @param {*} [xData] 执行行为所需当前部件 * @param {*} [actionContext] 执行行为上下文 * @memberof ProductSalesLiteratureSalLitProGridViewBase */ public ToggleFilter(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) { const _this: any = this; if (_this.hasOwnProperty('isExpandSearchForm')) { _this.isExpandSearchForm = !_this.isExpandSearchForm; } } }