提交 3213cdbd 编写于 作者: WodahsOrez's avatar WodahsOrez

update:表单部件服务

上级 c85b0f53
import { ControlServiceBase, ControlVOBase, hasFunction } from '@ibiz-core';
import { createUUID } from 'qx-util';
/**
* 表单部件服务
*
* @export
* @class EditFormService
* @template T 部件数据对象类型
*/
export class EditFormService<T extends ControlVOBase> extends ControlServiceBase<T> {
/**
* 加载草稿数据
*
......@@ -12,14 +17,15 @@ export class EditFormService<T extends ControlVOBase> extends ControlServiceBase
* @return {*}
*/
public async loadDraft(context: any, data: any, opts: { action: string; isLoading?: boolean }): Promise<any> {
const { context: Context, data: Data } = this.handleRequestData(context, data, opts);
// todo主键
const action = hasFunction(this.entityService, opts.action) ? opts.action : 'GetDraft';
const response = await this.entityService[action](Context, Data, opts.isLoading);
// this.setRemoteCopyData(response);
response.data = this.newControlVO(response.data);
response.data.srfuf = "0";
return this.handleResponse(response, opts);
let _entityService: any = this.entityService;
const { context: Context, data: Data } = this.handleRequestData(context, data, opts);
// todo主键
const action = hasFunction(_entityService, opts.action) ? opts.action : 'GetDraft';
const response = await _entityService[action](Context, Data, opts.isLoading);
// this.setRemoteCopyData(response);
response.data = this.newControlVO(response.data);
response.data.srfuf = '0';
return this.handleResponse(response, opts);
}
/**
......@@ -31,12 +37,13 @@ export class EditFormService<T extends ControlVOBase> extends ControlServiceBase
* @return {*}
*/
public async get(context: any, data: any, opts: { action: string; isLoading?: boolean }): Promise<any> {
const { context: Context, data: Data } = this.handleRequestData(context, data, opts);
const action = hasFunction(this.entityService, opts.action) ? opts.action : 'GET';
const response = await this.entityService[action](Context, Data, opts.isLoading);
// this.setRemoteCopyData(response);
response.data = this.newControlVO(response.data);
return this.handleResponse(response, opts);
let _entityService: any = this.entityService;
const { context: Context, data: Data } = this.handleRequestData(context, data, opts);
const action = hasFunction(_entityService, opts.action) ? opts.action : 'GET';
const response = await _entityService[action](Context, Data, opts.isLoading);
// this.setRemoteCopyData(response);
response.data = this.newControlVO(response.data);
return this.handleResponse(response, opts);
}
/**
......@@ -48,11 +55,12 @@ export class EditFormService<T extends ControlVOBase> extends ControlServiceBase
* @return {*}
*/
public async create(context: any, data: any, opts: { action: string; isLoading?: boolean }): Promise<any> {
const { context: Context, data: Data } = this.handleRequestData(context, data, opts);
const action = hasFunction(this.entityService, opts.action) ? opts.action : 'Create';
const response = await this.entityService[action](Context, Data, opts.isLoading);
response.data = this.newControlVO(response.data);
return this.handleResponse(response, opts);
let _entityService: any = this.entityService;
const { context: Context, data: Data } = this.handleRequestData(context, data, opts);
const action = hasFunction(_entityService, opts.action) ? opts.action : 'Create';
const response = await _entityService[action](Context, Data, opts.isLoading);
response.data = this.newControlVO(response.data);
return this.handleResponse(response, opts);
}
/**
......@@ -64,11 +72,12 @@ export class EditFormService<T extends ControlVOBase> extends ControlServiceBase
* @return {*}
*/
public async remove(context: any, data: any, opts: { action: string; isLoading?: boolean }): Promise<any> {
const { context: Context, data: Data } = this.handleRequestData(context, data, opts);
const action = hasFunction(this.entityService, opts.action) ? opts.action : 'Remove';
const response = await this.entityService[action](Context, Data, opts.isLoading);
response.data = this.newControlVO(response.data);
return this.handleResponse(response, opts);
let _entityService: any = this.entityService;
const { context: Context, data: Data } = this.handleRequestData(context, data, opts);
const action = hasFunction(_entityService, opts.action) ? opts.action : 'Remove';
const response = await _entityService[action](Context, Data, opts.isLoading);
response.data = this.newControlVO(response.data);
return this.handleResponse(response, opts);
}
/**
......@@ -80,11 +89,11 @@ export class EditFormService<T extends ControlVOBase> extends ControlServiceBase
* @return {*}
*/
public async update(context: any, data: any, opts: { action: string; isLoading?: boolean }): Promise<any> {
const { context: Context, data: Data } = this.handleRequestData(context, data, opts);
const action = hasFunction(this.entityService, opts.action) ? opts.action : 'Update';
const response = await this.entityService[action](Context, Data, opts.isLoading);
response.data = this.newControlVO(response.data);
return this.handleResponse(response, opts);
}
let _entityService: any = this.entityService;
const { context: Context, data: Data } = this.handleRequestData(context, data, opts);
const action = hasFunction(_entityService, opts.action) ? opts.action : 'Update';
const response = await _entityService[action](Context, Data, opts.isLoading);
response.data = this.newControlVO(response.data);
return this.handleResponse(response, opts);
}
}
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册