/**
|
* 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 '<div id="UIContent_' + id + '" style="overflow: auto;padding:0 5px"></div>';
|
};
|
|
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=[
|
'<div class="layui-layout easyui-layout UIContentLayout" id="easyuiLayout_',id,'" data-options="fit:true" style="display:block;overflow-y: hidden;">',
|
//'<div class="layui-layout-border" style="clear: both">',
|
that.uiDefineVO.northAreas&& that.uiDefineVO.northAreas.length>0?'<div class="layui-north" data-options="region:\'north\',split:true" style=""></div>':'',
|
that.uiDefineVO.westAreas&& that.uiDefineVO.westAreas.length>0?'<div class="layui-west" data-options="region:\'west\',split:true" style="width:300px;padding: 5px;margin-right: 0;"></div>':'',
|
'<div class="layui-center" data-options="region:\'center\',split:true" style="display:inline-block;border:0;'+(that.uiDefineVO.westAreas&& that.uiDefineVO.westAreas.length>0?'width:'+(parentWidth-328)+'px;':'')+'margin: 0;overflow: auto">',
|
'<div id="easyuiLayoutCenter_',id,'" class="easyui-layout" data-options="fit:true">',
|
that.uiDefineVO.centerAreas&& that.uiDefineVO.centerAreas.length>0?'<div class="layui-layout" data-options="region:\'center\',minHeight:50" style="padding-left: 10px;padding-right: 10px;"></div>':'',
|
that.uiDefineVO.southAreas&& that.uiDefineVO.southAreas.length>0?'<div class="layui-south" data-options="region:\'south\',split:true,minHeight:50" style="padding-left:10px;padding-right:10px;height: 200px;"></div>':'',
|
'</div>',
|
'</div>',
|
//'</div>',
|
'</div>'
|
];
|
$("#UIContent_"+that.functionId).html(html.join(''));
|
|
that.firstLoad=true;
|
if(that.uiDefineVO.northAreas && that.uiDefineVO.northAreas.length>0){
|
northHtml=[]
|
}
|
if(that.uiDefineVO.westAreas && that.uiDefineVO.westAreas.length>0){
|
if(that.uiDefineVO.westAreas.length>1) {
|
westHtml.push('<div class="layui-tab" >');
|
westHtml.push('<ul class="layui-tab-title" lay-allowClose="false">');
|
westHtml.push('</ul>');
|
westHtml.push('<ul class="layui-tab-content">');
|
westHtml.push('</ul>');
|
westHtml.push('</div>');
|
|
$("#UIContent_" + that.functionId + " .layui-west").append(westHtml.join(''));
|
var showIndex2=0;
|
layui.each(that.uiDefineVO.westAreas, function (i, areaItem) {
|
if(!areaItem.enableStatus){
|
showIndex2++;
|
return;
|
}
|
var checknotdisplay=false;
|
if(webUtil.isNotNull(areaItem.displayExpression)) {
|
checknotdisplay = me.checkDisplayExpression(id,areaItem.displayExpression);
|
if (checknotdisplay) {
|
showIndex2++;
|
return;
|
}
|
}
|
$("#UIContent_" + that.functionId + " .layui-west .layui-tab-title").append('<li class="' + (i == showIndex2 ? 'layui-this' : '') + '" style="'+(checknotdisplay?'display: none':'')+'">' + areaItem.name + '</li>');
|
|
var itemLi = $('<li class="layui-tab-item ' + (i == showIndex2 ? 'layui-show' : '') + '" style="'+(checknotdisplay?'display: none':'')+'"></li>');
|
$("#UIContent_" + that.functionId + " .layui-west .layui-tab-content").append(itemLi);
|
if(!checknotdisplay){
|
me.getWestContent(id,areaItem, uiDefineId,itemLi,'westAreas')
|
}
|
})
|
|
}else{
|
var div=$('<div></div>')
|
$("#UIContent_" + that.functionId + " .layui-west").append(div);
|
me.getWestContent(id,that.uiDefineVO.westAreas[0], uiDefineId,div,'westAreas')
|
}
|
}
|
if(that.uiDefineVO.centerAreas && that.uiDefineVO.centerAreas.length>0){
|
if(that.uiDefineVO.centerAreas.length>1){
|
centerHtml.push('<div class="layui-tab" style="margin-top: 0;">');
|
centerHtml.push('<ul class="layui-tab-title" lay-allowClose="false">');
|
centerHtml.push('</ul>');
|
|
centerHtml.push('<ul class="layui-tab-content">');
|
centerHtml.push('</ul>');
|
centerHtml.push('</div>');
|
|
$("#UIContent_" + that.functionId + " .layui-center .layui-layout").append(centerHtml.join(''));
|
var showIndex=0;
|
layui.each(that.uiDefineVO.centerAreas, function (i, areaItem) {
|
if(!areaItem.enableStatus){
|
showIndex++;
|
return;
|
}
|
var checknotdisplay=false;
|
if(webUtil.isNotNull(areaItem.displayExpression)) {
|
checknotdisplay = me.checkDisplayExpression(id,areaItem.displayExpression);
|
if (checknotdisplay) {
|
showIndex++;
|
return;
|
}
|
}
|
$("#UIContent_" + that.functionId + " .layui-center .layui-layout .layui-tab-title").append('<li class="' + (i == showIndex ? 'layui-this' : '') + '" style="'+(checknotdisplay?'display: none':'')+'">' + areaItem.name + '</li>');
|
|
var itemLi = $('<li class="layui-tab-item ' + (i == showIndex ? 'layui-show' : '') + ' style="'+(checknotdisplay?'display: none':'')+'""></li>');
|
$("#UIContent_" + that.functionId + " .layui-center .layui-layout .layui-tab-content").append(itemLi);
|
if(!checknotdisplay){
|
me.getWestContent(id,areaItem, uiDefineId,itemLi,'centerAreas')
|
}
|
})
|
}else{
|
var div=$('<div></div>')
|
$("#UIContent_" + that.functionId + " .layui-center .layui-layout").append(div);
|
me.getWestContent(id,that.uiDefineVO.centerAreas[0], uiDefineId,div,'centerAreas')
|
}
|
}
|
if(that.uiDefineVO.southAreas && that.uiDefineVO.southAreas.length>0){
|
if(that.uiDefineVO.southAreas.length>1){
|
southHtml.push('<div class="layui-tab" >');
|
southHtml.push('<ul class="layui-tab-title" lay-allowClose="false">');
|
southHtml.push('</ul>');
|
|
southHtml.push('<ul class="layui-tab-content">');
|
southHtml.push('</ul>');
|
southHtml.push('</div>');
|
|
$("#UIContent_" + that.functionId + " .layui-south").append(southHtml.join(''));
|
var showIndex1=0;
|
layui.each(that.uiDefineVO.southAreas, function (i, areaItem) {
|
if(!areaItem.enableStatus){
|
showIndex1++;
|
return;
|
}
|
var checknotdisplay=false;
|
if(webUtil.isNotNull(areaItem.displayExpression)) {
|
checknotdisplay = me.checkDisplayExpression(id,areaItem.displayExpression);
|
if (checknotdisplay) {
|
showIndex1++;
|
return;
|
}
|
}
|
$("#UIContent_" + that.functionId + " .layui-south .layui-tab-title").append('<li class="' + (i == showIndex1 ? 'layui-this' : '') + '" style="'+(checknotdisplay?'display: none':'')+'">' + areaItem.name + '</li>');
|
|
var itemLi = $('<li class="layui-tab-item ' + (i == showIndex1 ? 'layui-show' : '') + '" style="'+(checknotdisplay?'display: none':'')+'"></li>');
|
$("#UIContent_" + that.functionId + " .layui-south .layui-tab-content").append(itemLi);
|
if(!checknotdisplay){
|
me.getWestContent(id,areaItem, uiDefineId,itemLi,'southAreas')
|
}
|
})
|
}else{
|
var div=$('<div></div>')
|
$("#UIContent_" + that.functionId + " .layui-south").append(div);
|
me.getWestContent(id,that.uiDefineVO.southAreas[0], uiDefineId,div,'southAreas')
|
}
|
}
|
|
var key='ui_'+uiDefineId;
|
that.filterList[key]=that.areasFilter;
|
|
$("#UIContent_" + that.functionId + ' .layui-tab-title').on('click', function(title) {
|
var tabcontent=$(title.toElement).parent().next().find('.layui-tab-item:eq('+$(title.toElement).index()+')')
|
layui.each(tabcontent.find('.component'),function (i,component){
|
var dataFilters=$(this).data('filters');
|
dataFilters.tableFilter != '' && layui.table.reload(dataFilters.tableFilter,{url:'uiDataController/dataGridQuery'}), that.checkedData[dataFilters.tableFilter.split('_')[0]] = [];
|
dataFilters.treeFilter != '' && layui.tree.reload(dataFilters.treeFilter,{url:'uiDataController/getDataForTree'}), that.checkedData[dataFilters.treeFilter.split('_')[0]] = [];
|
dataFilters.treeTableFilter != '' && layui.treeGrid.reload(dataFilters.treeTableFilter,{url:'uiDataController/dataGridQuery'}), that.checkedData[dataFilters.treeTableFilter.split('_')[0]] = [];
|
|
})
|
});
|
|
var h=$('#portal_body').height()-43
|
if(that.isOpen){
|
h=$('#easyuiLayout_'+id).closest('.layui-layer-content').height()-10
|
if($('#easyuiLayout_'+id).closest('.layui-tab').length>0) {
|
h-=55;
|
}
|
}
|
$('#easyuiLayout_'+id).css({height:h})
|
|
$('#easyuiLayoutCenter_'+id).layout();
|
$('#easyuiLayout_'+id).layout();
|
if(callback) callback();
|
}
|
|
|
this.getWestContent=function (id,areaItem,uiDefineId,containerDiv,areaName) {
|
var that=this;
|
var table=layui.table;
|
var tree=layui.tree;
|
var form=layui.form;
|
var treeGrid=layui.treeGrid;
|
var html = []
|
if(areaItem.componentVOs.length>1){
|
containerDiv.append('<div class="layui-collapse" lay-filter=""></div>')
|
}
|
layui.each(areaItem.componentVOs, function (i, componentVO) {
|
html = [];
|
html.push('<div class="component" >');
|
//按钮
|
html.push('<div id="toolbar_button_',componentVO.oid,'" layui-filter="toolbar_button_',componentVO.oid,'" class="layui-btn-container layui-buttons">');
|
var hasRefresh = false;
|
var dataFilters={
|
treeFilter:componentVO.treeDefineVO?(areaName+'_tree_'+id+'_' + componentVO.oid +'_'+ componentVO.treeDefineVO.btmType+'_'+uiDefineId):'',
|
tableFilter:componentVO.tableDefineVO?(areaName + '_table_'+id+'_' + componentVO.oid + '_' + componentVO.tableDefineVO.oid+'_'+uiDefineId):'',
|
treeTableFilter:componentVO.treeTableDefineVO?(areaName + '_treetable_'+id+'_' + componentVO.oid + '_' + componentVO.treeTableDefineVO.oid+'_'+uiDefineId):'',
|
formFilter:componentVO.formDefineVO?(areaName+'_form_'+id+'_'+ componentVO.oid+'_'+componentVO.formDefineVO.oid+'_'+uiDefineId):''
|
};
|
if(that.config[id].isShowBtns!=false && componentVO.buttons.length>0) {
|
var DefineVO = componentVO.treeDefineVO || componentVO.tableDefineVO || componentVO.treeTableDefineVO || componentVO.formDefineVO;
|
DefineVO && (DefineVO.componentTitle = componentVO.description||componentVO.name)
|
layui.each(componentVO.buttons, function (i, button) {
|
if (button.name == '刷新' || button.id == 'refresh') {
|
hasRefresh = true;
|
//html.push('<button class="layui-btn layui-btn-sm" layui-filter="toolbar_' + componentVO.oid + '_refresh" data-configId="'+id+'" data-filters=\'' + JSON.stringify(dataFilters) + '\'><i class="layui-icon layui-icon-refresh"></i>刷新</button>');
|
}
|
html.push('<button class="layui-btn layui-btn-sm" type="button" layui-filter="toolbar_' + componentVO.oid + '_buttonAction" data-configId="'+id+'" data-button=\'' + JSON.stringify(button) + '\' data-filters=\'' + JSON.stringify(dataFilters) + '\' data-componentVOOid=\'' + JSON.stringify(componentVO.oid) + '\' data-DefineVO=\'' + JSON.stringify(DefineVO) + '\' data-currentArea="' + areaName + '" data-uiDefineId="' + uiDefineId + '"><i class="layui-icon" style=" ' + (button.iconPath ? 'width:16px;height:16px;background-image: url(' + button.iconPath + ')' : '') + '"></i>' + button.name + '</button>');
|
|
})
|
}
|
|
if(componentVO.tableDefineVO) {
|
if(componentVO.tableDefineVO.seniorQueryColumns && componentVO.tableDefineVO.seniorQueryColumns.length>0) {
|
html.push('<button class="layui-btn layui-btn-sm" type="button" layui-filter="toolbar_' + componentVO.oid + '_ADVANCEDQUERY" data-configId="' + id + '" data-filter=\'' + dataFilters.tableFilter + '\' data-toolbarId="' + componentVO.oid + '" data-fields=\'' + JSON.stringify(componentVO.tableDefineVO.seniorQueryColumns) + '\'><i class="layui-icon layui-icon-search"></i>查询</button>');
|
}
|
if (!hasRefresh) {
|
html.push('<button class="layui-btn layui-btn-sm" type="button" layui-filter="toolbar_' + componentVO.oid + '_refresh" data-configId="'+id+'" data-filters=\'' + JSON.stringify(dataFilters) + '\'><i class="layui-icon layui-icon-refresh"></i>刷新</button>');
|
}
|
}else if(componentVO.treeDefineVO||componentVO.treeTableDefineVO){
|
if (!hasRefresh) {
|
html.push('<button class="layui-btn layui-btn-sm" type="button" layui-filter="toolbar_' + componentVO.oid + '_refresh" data-configId="'+id+'" data-filters=\'' + JSON.stringify(dataFilters) + '\'><i class="layui-icon layui-icon-refresh"></i>刷新</button>');
|
}
|
}
|
html.push('</div>');
|
html.push('</div>');
|
|
if(areaItem.componentVOs.length>1){
|
$(".layui-collapse",containerDiv).append('<div class="layui-colla-item"><h2 class="layui-colla-title">'+componentVO.name+'</h2><div class="layui-colla-content layui-show">'+html.join('')+'</div></div>')
|
}else{
|
containerDiv.append(html.join(''));
|
}
|
$('.component',containerDiv).data('filters',dataFilters)
|
|
layui.element.render();
|
|
$webUtil.bindDefultButtonLisenter(that, componentVO.oid);
|
|
//树
|
if(componentVO.treeDefineVO){
|
var filter=dataFilters.treeFilter;
|
if(tree.config&&tree.config[filter]){
|
tree.destory(filter);
|
}
|
$(".component", containerDiv).eq(i).append('<ul layui-filter="'+ filter+'"></ul>');
|
|
that.fristTreeLoad = false;
|
var parentFieldName = "";
|
var rootQueryValue = "";
|
if(componentVO.treeDefineVO.showLinkAbs){
|
parentFieldName = componentVO.treeDefineVO.showLinkAbs.split(",")[0];
|
rootQueryValue = componentVO.treeDefineVO.showLinkAbs.split(",")[1];
|
}
|
var treeParams={
|
isMuti: false,
|
isQueryAllColumn: true,
|
btmname: componentVO.treeDefineVO.btmType,
|
componentOid:componentVO.oid,
|
uiDefineId:uiDefineId,
|
valueField:componentVO.treeDefineVO.valueField,
|
parentFieldName:parentFieldName,
|
//parentOid:result.treeData[0].oid,
|
//parentBtmName:result.treeData[0].attributes.btmname,
|
textField:componentVO.treeDefineVO.treeNodeExpression,
|
queryTemplate: that.config[id].querytemplate,
|
linkTypeFlag: $webUtil.isNull(that.config[id].queryType)?($webUtil.isNull(that.config[id].linkType)?false:true):(that.config[id].queryType==0?false:true),
|
//toBtmType:componentVO.treeDefineVO.btmType,
|
rootExpress:componentVO.treeDefineVO.rootExpress
|
}
|
tree.init(filter, $('[layui-filter="' + filter + '"]'), {
|
url: that.config[id].firstLoad?'uiDataController/getDataForTree':'',
|
backPath: that.backPath,
|
requestType:'post',
|
rootParams:{
|
queryRoot: true
|
},
|
where: treeParams,
|
extraParams:that.config[id].sourceDataMapList,
|
showSearch:that.config[id].showSearch||false,
|
treeFilter: filter,
|
loadType: componentVO.treeDefineVO.loadType,
|
treeName: componentVO.treeDefineVO.id,
|
click: function (thisTreeFilter, elem, options) {
|
that.config[id].checkedData[areaName]=[thisTreeFilter.attributes];
|
that.clickRowFn(options.treeFilter, thisTreeFilter.attributes, componentVO.treeDefineVO.btmType, that.config[id].filterList['ui_' + uiDefineId]);
|
|
},
|
done:function (thisTreeFilter,children,elem) {
|
elem.children().eq(0).children('a').trigger('click');
|
that.config[id].firstLoad=false;
|
}
|
});
|
|
that.config[id].areasFilter[areaName].tree.push(filter);
|
}
|
//表格
|
if(componentVO.tableDefineVO) {
|
var filter = dataFilters.tableFilter;
|
$(".component", containerDiv).css({minWidth:'520px'}).eq(i).append('<table id="' + filter + '" lay-filter="' + filter + '" style="overflow-x:auto;"></table>')
|
var cols = [];
|
for (var i = 0; i < componentVO.tableDefineVO.cols.length; i++) {
|
if (componentVO.tableDefineVO.btmType == 'fileobject') {
|
//是文件
|
$.each(componentVO.tableDefineVO.cols[i],function (ci,citem){
|
if(citem.field=='name'){
|
componentVO.tableDefineVO.cols[i][ci].templet=function (d){
|
return '<a class="layui-btn layui-btn-intable" lay-event="PREVIEW">'+d.name+'</a>'
|
}
|
return false;
|
}
|
})
|
|
}
|
if (i == 0) {
|
componentVO.tableDefineVO.cols[i].unshift({
|
field: table.config.indexName,
|
type: 'numbers',
|
title: '序号',
|
rowspan: componentVO.tableDefineVO.cols.length,
|
width: 40
|
}, {
|
field: table.config.checkName,
|
type: 'checkbox',
|
rowspan: componentVO.tableDefineVO.cols.length,
|
width: 30
|
})
|
}
|
cols.push(componentVO.tableDefineVO.cols[i]);
|
}
|
|
var tableParams={
|
btmname: componentVO.tableDefineVO.btmType,
|
tableDefineId: componentVO.tableDefineVO.id,
|
componentOid: componentVO.oid,
|
uiDefineId: uiDefineId,
|
linkTypeFlag:componentVO.tableDefineVO.linkTypeFlag
|
}
|
table.render({
|
elem: '#' + filter,
|
id: filter,
|
url: that.config[id].firstLoad?'uiDataController/dataGridQuery':'',
|
backPath: that.backPath,
|
method:'post',
|
page: {
|
limit: componentVO.tableDefineVO.pageVO ? componentVO.tableDefineVO.pageVO.limit : 10,
|
page: componentVO.tableDefineVO.pageVO? componentVO.tableDefineVO.pageVO.page :1
|
},
|
limits: componentVO.tableDefineVO.limits,
|
where: tableParams,
|
extraParams:that.config[id].sourceDataMapList,
|
selectMode: table.selectMode.muti,
|
cols: cols,
|
done: function (res, cur, total) {
|
if (total > 0) {
|
//table.selectRecord(filter, {index: 0});
|
}
|
table.on('tool(' + filter + ')',function(obj){
|
var data = obj.data;//当前选择行的数据
|
var layEvent = obj.event;//点的是什么按钮
|
if(layEvent == 'PREVIEW'){
|
that.PREVIEW(data);
|
}
|
});
|
that.config[id].firstLoad=false;
|
},
|
rowClick: function (thisTableFilter, record,isChecked) {
|
that.config[id].checkedData[areaName]=layui.table.checkStatus(thisTableFilter).data;
|
that.clickRowFn(thisTableFilter, record, componentVO.tableDefineVO.btmType, that.config[id].filterList['ui_' + uiDefineId]);
|
|
},
|
rowDBLClick:function (thisTableFilter, record){
|
|
}
|
})
|
|
that.config[id].areasFilter[areaName].table.push(filter);
|
|
if (componentVO.tableDefineVO.queryColumns && componentVO.tableDefineVO.queryColumns.length > 0) {
|
that.createSearchHtml(componentVO.tableDefineVO.queryColumns, componentVO.oid, filter,id)
|
}
|
}
|
//树表
|
if(componentVO.treeTableDefineVO){
|
var filter=dataFilters.treeTableFilter;
|
$(".component", containerDiv).eq(i).append('<table id="' + filter + '" lay-filter="' + filter + '" style="overflow-x:auto;"></table>')
|
var cols = [];
|
for (var i = 0; i < componentVO.treeTableDefineVO.cols.length; i++) {
|
if (i == 0) {
|
componentVO.treeTableDefineVO.cols[i].unshift({
|
field: table.config.indexName,
|
type: 'numbers',
|
title: '序号',
|
rowspan: componentVO.treeTableDefineVO.cols.length,
|
width: 40
|
}, {
|
field: table.config.checkName,
|
type: 'checkbox',
|
rowspan: componentVO.treeTableDefineVO.cols.length,
|
width: 30
|
})
|
}
|
cols.push(componentVO.treeTableDefineVO.cols[i]);
|
}
|
var treeTableParams={
|
btmname: componentVO.treeTableDefineVO.btmType,
|
tableDefineId: componentVO.treeTableDefineVO.id,
|
componentOid: componentVO.oid,
|
uiDefineId: uiDefineId,
|
linkTypeFlag:componentVO.treeTableDefineVO.linkTypeFlag,
|
treeTableFlag:true
|
}
|
treeGrid.render({
|
elem: '#' + filter,
|
id: filter,
|
cols: cols,
|
url: that.config[id].firstLoad?'uiDataController/dataGridQuery':'',
|
backPath: that.backPath,
|
method:'post',
|
limit: componentVO.treeTableDefineVO.pageVO ? componentVO.treeTableDefineVO.pageVO.limit : 10,
|
limits: componentVO.treeTableDefineVO.limits,
|
where: treeTableParams,
|
extraParams:that.config[id].sourceDataMapList,
|
selectMode:table.selectMode.muti,
|
treeId:(componentVO.treeTableDefineVO.treeCurrentField||'oid'),//树形id字段名称
|
treeUpId:(componentVO.treeTableDefineVO.treeParentField||'parentOid'),//树形父id字段名称
|
treeShowName:(componentVO.treeTableDefineVO.treeFieldName||'name'),//以树形式显示的字段
|
rowClick: function (thisTableFilter, record,isChecked) {
|
that.config[id].checkedData[areaName] = layui.treeGrid.checkStatus(thisTableFilter).data;
|
that.clickRowFn(thisTableFilter, record, componentVO.treeTableDefineVO.btmType, that.config[id].filterList['ui_' + uiDefineId])
|
},
|
done:function(res,cur,total){
|
if (total > 0) {
|
//treeGrid.selectRecord(filter, {index: 0});
|
}
|
that.config[id].firstLoad=false;
|
}
|
});
|
|
that.config[id].areasFilter[areaName].treeGrid.push(filter);
|
|
if (componentVO.treeTableDefineVO.queryColumns && componentVO.treeTableDefineVO.queryColumns.length > 0) {
|
that.createSearchHtml(componentVO.treeTableDefineVO.queryColumns, componentVO.oid, filter,id)
|
}
|
}
|
//表单
|
if(componentVO.formDefineVO){
|
var filter=dataFilters.formFilter;
|
$(".component", containerDiv).eq(i).append('<form id="'+filter +'" lay-filter="'+ filter+ '" class="layui-form" style=""></form>')
|
form.addItems(filter,componentVO.formDefineVO.items, function (){
|
that.loadFormData(filter,componentVO.formDefineVO,id,uiDefineId)
|
}, {}, { defaultColumnOneRow: componentVO.formDefineVO.columnOneRow || 1});
|
|
that.config[id].areasFilter[areaName].form.push(filter);
|
}
|
//自定义
|
if(componentVO.customClass) {
|
// //1. 获取?后的参数,作为options放进去。同时options还把当前自定义组件的信息放进去,包括UI上下文的主键,当前组件的主键等
|
// //2. use这个组件,然后将options放到该组件里
|
// //3. 调用getContent方法,参数为id和options。这里的id就是当前自定义界面的oid。组件内部自行存储options。也或者在当前对象上存在
|
// //4. 调用init,参数也是id和options。页面默认不加载数据
|
// //5. 加载数据的时候,调用loadForUI方法,参数为id和sourceData,这个sourceData为前面这个区域选择的数据,统一使用数组的形式。
|
layui.use(componentVO.customClass.split('?')[0], function () {
|
var customClass=componentVO.customClass.split(':');
|
if(customClass.length>1){
|
lowcustom=customClass[0].toLowerCase();
|
if(lowcustom=='usejs'||lowcustom=='js'){
|
var customClassList=[]
|
for (var li=1;li<customClass.length;li++){
|
customClassList.push(customClass[li]);
|
}
|
componentVO.customClass=customClassList.join(':');
|
}
|
}
|
|
var customView = layui[componentVO.customClass.split('?')[0]];
|
if(componentVO.customClass.indexOf("?") <0){
|
componentVO.customClass=componentVO.customClass+'?'
|
//$webUtil.showErrorMsg("请联系管理员,这个自定义页面的地址格式不正确。推荐使用UI:type#content?param=xxx这种形式");
|
//return;
|
}
|
var paramsArray = componentVO.customClass.split('?')[1].split("&");
|
var urlParams={};
|
for(var i = 0 ; i < paramsArray.length ; i ++){
|
var preParam =paramsArray[i].split("=");
|
if(preParam[0]=='btmname'){
|
urlParams['btmType']=preParam[1];
|
}else if(preParam[0]=='imagetype'){
|
urlParams['imageType']=preParam[1];
|
if(preParam[1]=='fileobject'){
|
|
}
|
}else{
|
urlParams[preParam[0]] = preParam[1];
|
}
|
|
}
|
|
var customOptions={
|
action: componentVO.customClass.split('?')[0],
|
urlParams: urlParams,
|
imgHeight: 400,
|
uiComponentType: componentVO.uiComponentType,
|
uiComponentTypeText: componentVO.uiComponentTypeText,
|
uiParseClass: componentVO.uiParseClass
|
}
|
var customid='customView_'+componentVO.oid;
|
$(".component", containerDiv).html(customView.getContent(customid,customOptions));
|
customView.id=customid;
|
customView.init(customid, customOptions);
|
that.config[id].areasFilter[areaName].customView.push(customView);
|
});
|
}
|
|
//该页面显示在弹窗中
|
if(that.config[id].isOpen && componentVO.formDefineVO){
|
$("#toolbar_button_"+componentVO.oid).css({'text-align':'right'}).appendTo($("#toolbar_button_"+componentVO.oid).parent('.component'))
|
}
|
})
|
}
|
this.loadFormData=function (filter,DefineVO,id,uiDefineId){
|
var that=this;
|
var params = {
|
btmname: DefineVO.btmType,
|
btmType: DefineVO.btmType,
|
formDefineId: DefineVO.id,
|
oid: DefineVO.oid
|
};
|
if(that.config[id].dataOid){
|
params.oid=that.config[id].dataOid;
|
}
|
if(that.config[id].sourceDataMapList){
|
$.extend(params,that.config[id].sourceDataMapList);
|
}
|
var paramVOS=that.config[id].paramVOS||{
|
uploadFileUrl:'vciFileUploadController/uploadFile',
|
uploadFileBackPath: configData.compatibility ? path : configData.fileServicePath,
|
uploadattachment:false
|
}
|
var baseAction = layui['BaseAction'];
|
if ($('#' + filter + ' .layui-upload-drag').length > 0) {
|
baseAction.renderUploadFile('#' + filter + ' .layui-upload-drag',paramVOS)
|
}
|
if(paramVOS.uploadattachment &¶mVOS.uploadattachment == 'true'){
|
//显示上传附件
|
baseAction.renderUploadAttach(filter,paramVOS)
|
}
|
|
$webUtil.ajax('post', 'uiDataController/dataFormQuery', params,
|
function (result) {
|
if (result.success && result.obj){
|
layui.form.setValues( result.obj.data, filter);
|
//文件
|
if(result.obj.filePathFieldMap){
|
var filepath=layui.$('#' + filter + ' .uploadDemoView input.uploadFileOid').attr('name');
|
layui.$('#' + filter + ' .uploadDemoView').removeClass('layui-hide').find('img').attr('src', paramVOS.uploadfilebackpath + 'vciFileDownloadController/downloadByFileOid?fileOid=' + result.obj.filePathFieldMap[filepath].oid + '&' + TOKEN_KEY + '=' + $webUtil.getToken());
|
layui.$('#' + filter + ' .uploadDemoView input.uploadFileOid').val(result.obj.filePathFieldMap[filepath].filePath);
|
}
|
//附件
|
if(result.obj.attachmentFileVOs &&result.obj.attachmentFileVOs.length>0) {
|
var val=[];
|
layui.each(result.obj.attachmentFileVOs,function (i,attachmentFile){
|
val.push(attachmentFile.oid);
|
var tr = $(['<tr id="upload-'+ i +' oid="'+attachmentFile.oid+'">'
|
,'<td>'+ attachmentFile.name+'.'+attachmentFile.fileExtension +'</td>'
|
,'<td>'+ (attachmentFile.fileSize/1024).toFixed(1) +'kb</td>'
|
,'<td>已上传</td>'
|
,'<td>'
|
,'<button class="layui-btn layui-btn-xs attach-reload layui-hide">重传</button>'
|
,'<button class="layui-btn layui-btn-xs layui-btn-danger attach-delete">删除</button>'
|
,'</td>'
|
,'</tr>'].join(''));
|
$('#'+filter+'_uploadList').append(tr);
|
})
|
$('#' + filter + ' [name="releaseFileOids"]').val(val.join(','))
|
}
|
|
$('#'+filter).click(function (){
|
that.clickRowFn(filter,result.obj.data,DefineVO.btmType, that.config[id].filterList['ui_' + uiDefineId])
|
})
|
|
that.clickRowFn(filter,result.obj.data,DefineVO.btmType, that.config[id].filterList['ui_' + uiDefineId])
|
}
|
}, function (xhr, error) {
|
$webUtil.showErrorMsg("获取数据出现了错误,可能是文件服务没有启动");
|
}, that.backPath)
|
}
|
|
this.clickRowFn=function (thisFilter,record,btmType,filterList){
|
var that=this;
|
if(record.oid.indexOf('@vcitreesep@')>-1){
|
record.oid=record.oid.split('@vcitreesep@')[1];
|
}
|
if (thisFilter.indexOf("westAreas") > -1) {
|
for (var i = 0; i < filterList["centerAreas"].table.length; i++) {
|
var options = layui.table.getConfig(filterList["centerAreas"].table[i])
|
options.extraParams = {
|
sourceBtmName: btmType,
|
sourceOid: record.oid
|
};
|
options.sourceDataParams = record;
|
options.url='uiDataController/dataGridQuery';
|
layui.table.setConfig(options)
|
layui.table.reload(filterList["centerAreas"].table[i]);
|
}
|
for (var i = 0; i < filterList["centerAreas"].treeGrid.length; i++) {
|
var options = layui.treeGrid.getConfig(filterList["centerAreas"].treeGrid[i])
|
options.extraParams = {
|
sourceBtmName: btmType,
|
sourceOid: record.oid
|
};
|
options.sourceDataParams = record;
|
options.url='uiDataController/dataGridQuery';
|
layui.treeGrid.reload(filterList["centerAreas"].treeGrid[i],options);
|
}
|
for (var i = 0; i < filterList["centerAreas"].tree.length; i++) {
|
var options = layui.tree.getOptions(filterList["centerAreas"].tree[i])
|
options.extraParams = {
|
sourceBtmName: btmType,
|
sourceOid: record.oid
|
};
|
options.sourceDataParams = record;
|
options.url='uiDataController/getDataForTree';
|
layui.tree.setOptions(filterList["centerAreas"].tree[i], options);
|
layui.tree.reload(filterList["centerAreas"].tree[i]);
|
}
|
for (var i = 0; i < filterList["centerAreas"].form.length; i++) {
|
layui.form.setValues(record, filterList["centerAreas"].form[i]);
|
//文件
|
if(record.filePathFieldMap){
|
var filepath=layui.$('#' + filterList["centerAreas"].form[i] + ' .uploadDemoView input.uploadFileOid').attr('name');
|
layui.$('#' + filterList["centerAreas"].form[i] + ' .uploadDemoView').removeClass('layui-hide').find('img').attr('src', (configData.compatibility ? path : configData.fileServicePath) + 'vciFileDownloadController/downloadByFileOid?fileOid=' + record.filePathFieldMap[filepath].oid + '&' + TOKEN_KEY + '=' + $webUtil.getToken());
|
layui.$('#' + filterList["centerAreas"].form[i] + ' .uploadDemoView input.uploadFileOid').val(record.filePathFieldMap[filepath].filePath);
|
}
|
}
|
for (var i = 0; i < filterList["centerAreas"].customView.length; i++) {
|
filterList["centerAreas"].customView[i].loadForUI(filterList["centerAreas"].customView[i].id,record)
|
}
|
|
} else if (thisFilter.indexOf("centerAreas") > -1) {
|
for (var i = 0; i < filterList["southAreas"].table.length; i++) {
|
var options = layui.table.getConfig(filterList["southAreas"].table[i])
|
options.extraParams = {
|
sourceBtmName: btmType,
|
sourceOid: record.oid
|
};
|
options.sourceDataParams = record;
|
options.url='uiDataController/dataGridQuery';
|
layui.table.setConfig(options)
|
layui.table.reload(filterList["southAreas"].table[i]);
|
}
|
for (var i = 0; i < filterList["southAreas"].treeGrid.length; i++) {
|
var options = layui.treeGrid.getConfig(filterList["southAreas"].treeGrid[i])
|
options.extraParams = {
|
sourceBtmName: btmType,
|
sourceOid: record.oid
|
};
|
options.sourceDataParams = record;
|
options.url='uiDataController/dataGridQuery';
|
layui.treeGrid.reload(filterList["southAreas"].treeGrid[i],options);
|
}
|
for (var i = 0; i < filterList["southAreas"].tree.length; i++) {
|
var options = layui.tree.getOptions(filterList["southAreas"].tree[i])
|
options.extraParams = {
|
sourceBtmName: btmType,
|
sourceOid: record.oid
|
};
|
options.sourceDataParams = record;
|
options.url='uiDataController/getDataForTree';
|
layui.tree.setOptions(filterList["southAreas"].tree[i], options);
|
layui.tree.reload(filterList["southAreas"].tree[i]);
|
}
|
for (var i = 0; i < filterList["southAreas"].form.length; i++) {
|
layui.form.setValues(record, filterList["southAreas"].form[i]);
|
//文件
|
if(record.filePathFieldMap){
|
var filepath=layui.$('#' + filterList["southAreas"].form[i] + ' .uploadDemoView input.uploadFileOid').attr('name');
|
layui.$('#' + filterList["southAreas"].form[i] + ' .uploadDemoView').removeClass('layui-hide').find('img').attr('src', (configData.compatibility ? path : configData.fileServicePath) + 'vciFileDownloadController/downloadByFileOid?fileOid=' + record.filePathFieldMap[filepath].oid + '&' + TOKEN_KEY + '=' + $webUtil.getToken());
|
layui.$('#' + filterList["southAreas"].form[i] + ' .uploadDemoView input.uploadFileOid').val(record.filePathFieldMap[filepath].filePath);
|
}
|
}
|
for (var i = 0; i < filterList["southAreas"].customView.length; i++) {
|
filterList["southAreas"].customView[i].loadForUI(filterList["southAreas"].customView[i].id,record)
|
}
|
}
|
}
|
this.createSearchHtml = function (queryColumns,componentVOOid,tableFilter,configId) {
|
var queryD={}
|
layui.each(queryColumns,function (i,item){
|
item.edit = item.edit || item.type || "text";
|
if(item.edit == 'text'){
|
queryD[item.queryField]=item.title
|
}
|
})
|
$webUtil.createSearchHtml(queryD,$("[layui-filter='toolbar_button_" + componentVOOid + "']"),tableFilter);
|
};
|
this.ADVANCEDQUERY = function(action,el){
|
var configId = $(el).attr('data-configId');
|
if(this.config[configId].serinorQueryInstance){
|
this.config[configId].serinorQueryInstance.open();
|
return;
|
}
|
var dynamicCondition = layui.dynamicCondition;
|
$('[layui-filter="toolbar_' + $(el).attr('data-toolbarId') + '"]').append('<div id="toolbar'+ $(el).attr('data-toolbarId')+'" class="layui-inline"></div>');
|
var dataFields = JSON.parse($(el).attr('data-fields'));
|
this.config[configId].serinorQueryInstance = dynamicCondition.create({
|
fields : dataFields//查询字段
|
,tableId:$(el).attr('data-filter')//需要查询的表格
|
,type:"complex" //type:"simple"/"complex" 查询的方法 暂时写死为 complex
|
// ,conditionTextId:"#toolbar"+that.id//高级查询 按钮所在的div
|
// ,popupShowQueryBtn: true//显示高级查询按钮
|
,queryCallBack:function(requestData){//查询之后的callback
|
//console.log(JSON.stringify(requestData))
|
}
|
});
|
|
this.config[configId].serinorQueryInstance.open();
|
};
|
|
this.refresh = function(action,el) {
|
var that = this;
|
var configId = $(el).attr('data-configId');
|
var dataFilters = JSON.parse($(el).attr('data-filters'));
|
dataFilters.tableFilter != '' && layui.table.reload(dataFilters.tableFilter), that.config[configId].checkedData[dataFilters.tableFilter.split('_')[0]] = [];
|
|
if(dataFilters.treeFilter != ''){
|
layui.tree.reload(dataFilters.treeFilter,{
|
rootParams:{
|
queryRoot: true
|
}
|
});
|
that.config[configId].checkedData[dataFilters.treeFilter.split('_')[0]] = [];
|
}
|
dataFilters.treeTableFilter != '' && layui.treeGrid.reload(dataFilters.treeTableFilter), that.config[configId].checkedData[dataFilters.treeTableFilter.split('_')[0]] = [];
|
if (dataFilters.formFilter) {
|
var configId = $(el).attr('data-configId');
|
var DefineVO = JSON.parse($(el).attr('data-DefineVO'));
|
that.loadFormData(dataFilters.formFilter,DefineVO,configId);
|
}
|
};
|
|
this.refreshAll = function() {
|
var that = this;
|
var btns = $('.layui-buttons .layui-btn[layui-filter$="_buttonAction"]');
|
layui.each(btns, function (i, btn) {
|
var button = JSON.parse($(btn).attr('data-button'))
|
if(button.url && button.url.indexOf('RefreshAction')>-1){
|
that.refresh('buttonAction', btn)
|
}
|
})
|
btns = $('.layui-buttons .layui-btn[layui-filter$="_refresh"]');
|
layui.each(btns, function (i, btn) {
|
that.refresh('refresh', btn)
|
})
|
};
|
|
this.PREVIEW=function (rowData){
|
//文件预览
|
layui.use('BaseFileDownloadAction', function () {
|
var vciWebFilePreview = layui['BaseFileDownloadAction'];
|
vciWebFilePreview.PREVIEW(rowData.oid,{fileOid:rowData.oid},function (){
|
$webUtil.showErrorMsg("文件预览失败,请联系管理员")
|
})
|
})
|
}
|
|
this.buttonAction=function(action,el) {
|
var that = this;
|
var configId = $(el).attr('data-configId');
|
var button = JSON.parse($(el).attr('data-button'))
|
var paramVOS = button.paramVOS;
|
if(!paramVOS){
|
paramVOS = {};
|
}
|
var componentVOOid = JSON.parse($(el).attr('data-componentVOOid'));
|
var DefineVO = JSON.parse($(el).attr('data-DefineVO')) || {};
|
var currentAreaName = $(el).attr('data-currentArea');
|
var uiDefineId = $(el).attr('data-uiDefineId');
|
|
|
if (!paramVOS['type']) {
|
paramVOS['type'] = DefineVO.btmType;
|
}
|
|
if (!paramVOS['title']) {
|
if (DefineVO.title) {
|
paramVOS['title'] = button.name + DefineVO.title
|
} else {
|
paramVOS['title'] = button.name + DefineVO.componentTitle;
|
}
|
}
|
if(!$webUtil.isNull(that.config[configId].linkType)){
|
//区域为链接类型
|
paramVOS['linkType']=that.config[configId].linkType;
|
}
|
var dataStore = [];//当前按钮所在的组件中选择的数据,且以数组形式传递
|
var sourceData = {};
|
var isShow = true;
|
|
if (currentAreaName.indexOf("westAreas") > -1) {
|
for (var i = 0; i < that.config[configId].filterList['ui_' + uiDefineId]["westAreas"].table.length; i++) {
|
dataStore = layui.table.checkStatus(that.config[configId].filterList['ui_' + uiDefineId]["westAreas"].table[i]).data;
|
}
|
for (var i = 0; i < that.config[configId].filterList['ui_' + uiDefineId]["westAreas"].tree.length; i++) {
|
if (layui.tree.getSelectNode(that.config[configId].filterList['ui_' + uiDefineId]["westAreas"].tree[i])) {
|
dataStore.push(layui.tree.getSelectNode(that.config[configId].filterList['ui_' + uiDefineId]["westAreas"].tree[i]).attributes);
|
}
|
}
|
for (var i = 0; i < that.config[configId].filterList['ui_' + uiDefineId]["westAreas"].treeGrid.length; i++) {
|
dataStore = layui.treeGrid.checkStatus(that.config[configId].filterList['ui_' + uiDefineId]["westAreas"].treeGrid[i]).data;
|
}
|
sourceData = [that.sourceData];
|
} else if (currentAreaName.indexOf("centerAreas") > -1) {
|
for (var i = 0; i < that.config[configId].filterList['ui_' + uiDefineId]["centerAreas"].table.length; i++) {
|
dataStore = layui.table.checkStatus(that.config[configId].filterList['ui_' + uiDefineId]["centerAreas"].table[i]).data;
|
}
|
for (var i = 0; i < that.config[configId].filterList['ui_' + uiDefineId]["centerAreas"].tree.length; i++) {
|
if (layui.tree.getSelectNode(that.config[configId].filterList['ui_' + uiDefineId]["centerAreas"].tree[i])) {
|
dataStore.push(layui.tree.getSelectNode(that.config[configId].filterList['ui_' + uiDefineId]["centerAreas"].tree[i]).attributes);
|
}
|
}
|
for (var i = 0; i < that.config[configId].filterList['ui_' + uiDefineId]["centerAreas"].treeGrid.length; i++) {
|
dataStore = layui.treeGrid.checkStatus(that.config[configId].filterList['ui_' + uiDefineId]["centerAreas"].treeGrid[i]).data;
|
}
|
sourceData = that.config[configId].checkedData['westAreas'];
|
} else if (currentAreaName.indexOf("southAreas") > -1) {
|
for (var i = 0; i < that.config[configId].filterList['ui_' + uiDefineId]["southAreas"].table.length; i++) {
|
dataStore = layui.table.checkStatus(that.config[configId].filterList['ui_' + uiDefineId]["southAreas"].table[i]).data;
|
}
|
for (var i = 0; i < that.config[configId].filterList['ui_' + uiDefineId]["southAreas"].tree.length; i++) {
|
if (layui.tree.getSelectNode(that.config[configId].filterList['ui_' + uiDefineId]["southAreas"].tree[i])) {
|
dataStore.push(layui.tree.getSelectNode(that.config[configId].filterList['ui_' + uiDefineId]["southAreas"].tree[i]).attributes);
|
}
|
}
|
for (var i = 0; i < that.config[configId].filterList['ui_' + uiDefineId]["southAreas"].treeGrid.length; i++) {
|
dataStore = layui.treeGrid.checkStatus(that.config[configId].filterList['ui_' + uiDefineId]["southAreas"].treeGrid[i]).data;
|
}
|
sourceData = that.config[configId].checkedData['centerAreas'];
|
}
|
if (paramVOS['initvalue']) {
|
var values = paramVOS['initvalue'].split(';');
|
var initValues = []
|
layui.each(values, function (i, item) {
|
item=item.replace(':','=');
|
if (item.indexOf('${') > -1) {
|
if (item.split('=')[1].indexOf('.') > -1) {
|
if (sourceData.length<1 || !sourceData[0].oid) {
|
isShow = false;
|
$webUtil.showErrorMsg("请先选择一条来源数据");
|
return false;
|
}
|
var name = item.split('=')[1].split('.')[1].replace('${', '').replace('}', '');
|
if (name == 'oid') {
|
item = item.split('=')[0] + '=' + sourceData[0]['oid']
|
} else {
|
item = item.split('=')[0] + '=' + sourceData[0][name]
|
}
|
} else {
|
if (dataStore.length < 1) {
|
isShow = false;
|
$webUtil.showErrorMsg("请先选择一条数据");
|
return false;
|
}
|
var name = item.split('=')[1].replace('${', '').replace('}', '');
|
item = item.split('=')[0] + '=' + dataStore[0][name];
|
|
}
|
}
|
initValues.push(item)
|
})
|
paramVOS['initvalue'] = initValues.join(';')
|
}
|
paramVOS['title']=$webUtil.replaceFreeMarker(paramVOS.title,dataStore,{})
|
var urlobj = $webUtil.getUrlParams(button.url, {
|
jsPath: 'BaseAddAction',
|
methodName:'doAction'
|
});
|
$.extend(paramVOS, urlobj.params);
|
if (isShow) {
|
layui.use(urlobj.jsPath, function () {
|
var BaseAction = layui[urlobj.jsPath];
|
var viewid = 'actionView_' + componentVOOid;
|
var callback = function () {
|
/*var refreshBtn = $('.layui-btn[layui-filter="toolbar_' + componentVOOid + '_refresh"]');
|
refreshBtn.trigger('click')*/
|
that.refresh(action,el)
|
}
|
BaseAction[urlobj.methodName]({
|
paramVOS: paramVOS,
|
id: viewid,
|
dataStore: dataStore,
|
sourceData: sourceData[0],
|
navData:that.navData || that.sourceData,//导航区域选中的菜单
|
callback: callback
|
});
|
})
|
}
|
}
|
};
|
var cs = new Class();
|
exports(cs.MODELNAME,cs);
|
});
|