/** * UI上下文的展示器 * @author weidy * @date 2021-3-1 */ layui.define(['layer','element','form','table','util','tree','treeGrid','dynamicCondition','BaseAction'],function(exports){ var Class = function() { this.MODELNAME = "platform/objectService/VciUIContentViewer"; this.moduleKey = "VciUIContentViewer"; this.id = 'VciUIContentViewer'; this.config = {}; this.backPath = configData.compatibility?path:configData.objectServicePath; this.controller = 'webUIController/'; this.getContent=function(id){ return '
'; }; this.init = function (id,options,callback) { //ids是组件,options是配置的信息,也就是souceDatas; var that = this; $webUtil.copyConfig(that,that.moduleKey); that.config[id] = options; that.config[id].functionId=id; that.config[id].sourceDataMapList={}; if(this.sourceData&&this.sourceData.sourceDataMap){ layui.each(this.sourceData.sourceDataMap, function (i, item) { if(item && item.constructor === Object) return; if(i=='type'||i=='context'||i=='content') return; that.config[id].sourceDataMapList['sourceData["'+i+'"]'] = item;//encodeURIComponent(item); }); } if(this.sourceData&&this.sourceData.actionData){ $.extend(that.config[id],this.sourceData.actionData); /*if(that.config[id].selectData){ //上区域选中数据 layui.each(that.config[id].selectData, function (i, item) { if(item && item.constructor === Object) return; that.config[id].sourceDataMapList['sourceData["'+i+'"]'] = item;//encodeURIComponent(item); }); }*/ if(that.config[id].dataStore && that.config[id].dataStore.length>0){ //当前区域选中数据 layui.each(that.config[id].dataStore[0], function (i, item) { if(item && item.constructor === Object) return; that.config[id].sourceDataMapList['sourceData["'+i+'"]'] =item;// encodeURIComponent(item); }); } if(that.config[id].paramVOS){ layui.each(that.config[id].paramVOS, function (i, item) { if(item && item.constructor === Object) return; that.config[id].sourceDataMapList['sourceData["'+i+'"]'] = item;//encodeURIComponent(item); }); } } that.config[id].filterList={}; that.config[id].areasFilter= {}; that.config[id].checkedData={ westAreas:[], centerAreas:[], southAreas:[] } if($webUtil.isNull(options.btmType) || $webUtil.isNull(options.content)){ $webUtil.showErrorMsg("配置的信息错误,请参考UI:type#content?param=xxx这种形式。其中type是业务类型(或链接类型),content是UI上下文的名称"); return false; } //1. 获取UI上下文的配置信息 that.selectUIDefines(id,options,callback); }; this.selectUIDefines = function (id,options,callback) { var that = this; $webUtil.get(that.controller + '/getUIContentByBtmTypeAndId',{btmType:options.btmType,id:options.content},function (result) { if(result.success) { that.config[id].uiDefineVO = result.obj; that.showContent(id,options.content,callback) }else{ $webUtil.showErrorMsg(result.msg); } },function (xhr,error) { $webUtil.showErrorMsg('可能服务没有启动,页面获取失败。请稍后再试'); return false; },that.path); } this.checkDisplayExpression=function (id,displayExpressionStr){ var me=this; var that = this.config[id]; var checknotdisplay=true; var displayExpression; if (displayExpressionStr.indexOf(' or"${') != -1) { displayExpression = displayExpressionStr.split(' or"${') } else if (displayExpressionStr.indexOf(' OR"${') != -1) { displayExpression = displayExpressionStr.split(' OR"${') } else { displayExpression = [displayExpressionStr] } displayExpression[0]=displayExpression[0].split('"${')[1]; layui.each(displayExpression, function (i, item) { if (item.indexOf('=') != -1) { var key = item.split('}"="')[0]; var value = item.split('}"="')[1]; debugger; value = value && value.substr(0, value.length - 1) if (that.dataStore[0][key] == value) { checknotdisplay = false; return false; } } }) return checknotdisplay; } this.showContent=function (id,uiDefineId,callback){ var me=this; var that = this.config[id]; that.areasFilter= { northAreas: {tree: [], table: [],treeGrid: [], form: [],customView:[]}, westAreas: {tree: [], table: [], treeGrid: [], form: [],customView:[]}, centerAreas: {tree: [], table: [],treeGrid: [], form: [],customView:[]}, southAreas: {tree: [], table: [], treeGrid: [], form: [],customView:[]} } that.checkedData={ westAreas:[], centerAreas:[], southAreas:[] } var northHtml=[],centerHtml=[],westHtml=[],southHtml=[]; var parentWidth=$("#UIContent_"+that.functionId).width(); var html=[ '