// 基于 @CONTROL/看板视图/SERVICE.ts.ftl 生成 import { Http,Util,Errorlog } from '@/utils'; import ControlService from '@/widgets/control-service'; import IBIZBOOKService from '@/service/ibizbook/ibizbook-service'; import HasPanelKanBanModel from './has-panel-kan-ban-kanban-model'; /** * HasPanelKanBan 部件服务对象 * * @export * @class HasPanelKanBanService */ export default class HasPanelKanBanService extends ControlService { /** * 图书服务对象 * * @type {IBIZBOOKService} * @memberof HasPanelKanBanService */ public appEntityService: IBIZBOOKService = new IBIZBOOKService(); /** * 设置从数据模式 * * @type {boolean} * @memberof HasPanelKanBanService */ public setTempMode(){ this.isTempMode = false; } /** * Creates an instance of HasPanelKanBanService. * * @param {*} [opts={}] * @memberof HasPanelKanBanService */ constructor(opts: any = {}) { super(opts); this.model = new HasPanelKanBanModel(); } /** * 查询数据 * * @param {string} action * @param {*} [context={}] * @param {*} [data={}] * @param {boolean} [isloading] * @returns {Promise<any>} * @memberof HasPanelKanBanService */ @Errorlog public search(action: string,context: any = {}, data: any = {}, isloading?: boolean): Promise<any> { const {data:Data,context:Context} = this.handleRequestData(action,context,data,true); return new Promise((resolve: any, reject: any) => { const _appEntityService: any = this.appEntityService; let result: Promise<any>; if (_appEntityService[action] && _appEntityService[action] instanceof Function) { result = _appEntityService[action](Context,Data, isloading); }else{ result =_appEntityService.FetchDefault(Context,Data, isloading); } result.then((response) => { this.handleResponse(action, response); resolve(response); }).catch(response => { reject(response); }); }); } /** * 删除数据 * * @param {string} action * @param {*} [context={}] * @param {*} [data={}] * @param {boolean} [isloading] * @returns {Promise<any>} * @memberof HasPanelKanBanService */ @Errorlog public delete(action: string,context: any = {}, data: any = {}, isloading?: boolean): Promise<any> { const {data:Data,context:Context} = this.handleRequestData(action,context,data,true); return new Promise((resolve: any, reject: any) => { const _appEntityService: any = this.appEntityService; let result: Promise<any>; if (_appEntityService[action] && _appEntityService[action] instanceof Function) { result = _appEntityService[action](Context,Data, isloading); }else{ result =_appEntityService.remove(Context,Data, isloading); } result.then((response) => { this.handleResponse(action, response); resolve(response); }).catch(response => { reject(response); }); }); } /** * 更新数据 * * @param {string} action * @param {*} [context={}] * @param {*} [data={}] * @param {boolean} [isloading] * @returns {Promise<any>} * @memberof HasPanelKanBanService */ @Errorlog public update(action: string,context: any = {}, data: any = {}, isloading?: boolean): Promise<any> { const {data:Data,context:Context} = this.handleRequestData(action,context,data,true); return new Promise((resolve: any, reject: any) => { const _appEntityService: any = this.appEntityService; let result: Promise<any>; if (_appEntityService[action] && _appEntityService[action] instanceof Function) { result = _appEntityService[action](Context,Data, isloading); }else{ result =_appEntityService.update(Context,Data, isloading); } result.then((response) => { this.handleResponse(action, response); resolve(response); }).catch(response => { reject(response); }); }); } }