提交 065cbeaa 编写于 作者: KK's avatar KK

多数据部件服务基类handleResponseData逻辑调整

上级 b0c6e1f8
......@@ -119,7 +119,7 @@ export class MdServiceBase extends ControlServiceBase {
if (!val) {
val = tempData.hasOwnProperty(dataitem.name) ? tempData[dataitem.name] : null;
}
if(action != 'Remove'){
if (action != 'Remove') {
tempData[dataitem.name] = val;
}
});
......@@ -128,4 +128,38 @@ export class MdServiceBase extends ControlServiceBase {
return result;
}
/**
* 处理请求多数据
*
* @protected
* @param {string} action 行为
* @param {*} [context={}] 上下文参数
* @param {*} [data={}] 数据
* @returns {*}
* @memberof ControlServiceBase
*/
public handleRequestDatas(context: any = {}, data: any = {}): any {
if (!this.model || !Util.isFunction(this.model.getDataItems)) {
return data;
}
const dataItems: any[] = this.model.getDataItems();
for (let index = 0; index < data.length; index++) {
const data1 = data[index];
const requestData: any = {};
dataItems.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] = data1[item.name];
}
}
});
data[index] = requestData;
}
return data;
}
}
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册