提交 68db645a 编写于 作者: ibizdev's avatar ibizdev

zoo457790531 发布系统代码 [ibz-lite,应用]

上级 aede3bd9
......@@ -377,7 +377,7 @@ export default class MetaEntityGridViewBase extends Vue {
* @memberof MetaEntityGridView
*/
public toolBarModels: any = {
tbitem1_initmodels: { name: 'tbitem1_initmodels', actiontarget: 'NONE', caption: '初始化模型', disabled: false, type: 'DEUIACTION', visabled: true,noprivdisplaymode:2,dataaccaction: '', uiaction: { tag: 'initModels', target: 'SINGLEDATA' } },
tbitem1_initmodels: { name: 'tbitem1_initmodels', actiontarget: 'NONE', caption: '初始化模型', disabled: false, type: 'DEUIACTION', visabled: true,noprivdisplaymode:2,dataaccaction: '', uiaction: { tag: 'initModels', target: 'SINGLEKEY' } },
tbitem2: { name: 'tbitem2', type: 'SEPERATOR', visabled: true, dataaccaction: '', uiaction: { } },
tbitem3: { name: 'tbitem3', actiontarget: 'NONE', caption: '新建', disabled: false, type: 'DEUIACTION', visabled: true,noprivdisplaymode:2,dataaccaction: '', uiaction: { tag: 'New', target: '' } },
......
......@@ -131,7 +131,72 @@ export default class MetaEntityUIServiceBase extends UIService {
* @returns {Promise<any>}
*/
public async MetaEntity_initModels(args: any[],context:any = {}, params:any = {}, $event?: any, xData?: any,actionContext?: any,srfParentDeName?:string){
actionContext.$Notice.error({ title: '错误', desc: '不支持单项数据' });
let data: any = {};
let parentContext:any = {};
let parentViewParam:any = {};
const _this: any = actionContext;
const _args: any[] = Util.deepCopy(args);
const actionTarget: string | null = 'SINGLEKEY';
Object.assign(context, { metaentity: '%metaentity%' });
Object.assign(params, { entity_id: '%metaentity%' });
Object.assign(params, { entity_name: '%entity_name%' });
if(_this.context){
parentContext = _this.context;
}
if(_this.viewparams){
parentViewParam = _this.viewparams;
}
context = UIActionTool.handleContextParam(actionTarget,_args,parentContext,parentViewParam,context);
data = UIActionTool.handleActionParam(actionTarget,_args,parentContext,parentViewParam,params);
if(Object.is(actionTarget,"MULTIKEY")){
let tempDataArray:Array<any> = [];
if((_args.length >1) && (Object.keys(data).length >0)){
for(let i =0;i<_args.length;i++){
let tempObject:any = {};
Object.keys(data).forEach((key:string) =>{
Object.assign(tempObject,{[key]:data[key].split(',')[i]});
})
tempDataArray.push(tempObject);
}
}else{
tempDataArray.push(data);
}
data = tempDataArray;
}
context = Object.assign({},actionContext.context,context);
let parentObj:any = {srfparentdename:srfParentDeName?srfParentDeName:null,srfparentkey:srfParentDeName?context[srfParentDeName.toLowerCase()]:null};
if(!Object.is(actionTarget,"MULTIKEY")){
Object.assign(data,parentObj);
}
Object.assign(context,parentObj);
// 直接调实体服务需要转换的数据
if(context && context.srfsessionid){
context.srfsessionkey = context.srfsessionid;
delete context.srfsessionid;
}
const backend = () => {
const curService:MetaEntityService = new MetaEntityService();
curService.InitModels(context,data, true).then((response: any) => {
if (!response || response.status !== 200) {
actionContext.$Notice.error({ title: '错误', desc: response.message });
return;
}
actionContext.$Notice.success({ title: '成功', desc: '初始化模型成功!' });
const _this: any = actionContext;
return response;
}).catch((response: any) => {
if (response && response.status && response.data) {
actionContext.$Notice.error({ title: (actionContext.$t('app.commonWords.wrong') as string), desc: response.data.message });
return;
}
if (!response || !response.status || !response.data) {
actionContext.$Notice.error({ title: (actionContext.$t('app.commonWords.wrong') as string), desc: (actionContext.$t('app.commonWords.sysException') as string) });
return;
}
return response;
});
};
backend();
}
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册