本帖最后由 lijw50 于 2022-1-7 16:30 编辑
80版本运行正常的脚本 但是到90版本运行时出现了问题 交叉表对应的脚本defaultSelectFirst(syb);
function getDateByYearMon(obj){
var arr = obj.firstDates[0].substring(1).split('-');
return parseDate((arr[0] * 100) + (Integer(arr[1]) + 1),'yyyyMM');
}
var date = getDateByYearMon(Year_Mon);
param['monthname'] = substring(formatDate(date,'yyyyMM'),4,6) + '月';
param['YearMon'] = integer(formatDate(date,'yyyyMM'));
//param['YearMonStart'] = integer(formatDate(dateAdd(date,'month',-11),'yyyyMM'));
param['YearMonStart'] = integer(formatDate(date,'yyyy') + '01');
param['YearMonEnd'] = integer(formatDate(date,'yyyy') + '12');
var sel_arr = dimensions.getSelectedObjects();
var chexi = dimensions_chexi.getSelectedObjects();
var targetArr = new Array();
var arr = new Array();
var arr_chexi = new Array();
var color1 =new Color(15921906);
var color2 =new Color();
if(param['target_dim'] == '公司目标'){
dimensions.setSelectedObjects([].STRING);
arr.push('项目');
arr.push('指标名称');
targetArr.push('战法');
targetArr.push('月度');
var loc01 =new Locator([''],OBJECT,DETAIL);
文本11.setForeground(loc01,color1);
列表过滤1.enabled = 列表过滤3.enabled = 列表过滤4.enabled = 列表过滤5.enabled = 列表过滤6.enabled = false;
列表过滤7.enabled = 列表过滤8.enabled = 列表过滤9.enabled = 列表过滤10.enabled = 列表过滤11.enabled = false;
文本23.visible = true;
}else if(param['target_dim'] == '战法目标'){
arr.push('项目');
for (var i = 0; i < sel_arr.length; i++) {
arr.push(sel_arr);
}
arr.push('指标名称');
targetArr.push('公司');
targetArr.push('月度');
列表过滤1.enabled = 列表过滤3.enabled = 列表过滤4.enabled = 列表过滤5.enabled = 列表过滤6.enabled = true;
列表过滤7.enabled = 列表过滤8.enabled = 列表过滤9.enabled = 列表过滤10.enabled = 列表过滤11.enabled = true;
文本23.visible = false;
}else {
arr.push('项目');
for (var i = 0; i < sel_arr.length; i++) {
arr.push(sel_arr);
}
arr.push('指标名称');
targetArr.push('公司');
targetArr.push('战法');
列表过滤1.enabled = 列表过滤3.enabled = 列表过滤4.enabled = 列表过滤5.enabled = 列表过滤6.enabled = true;
列表过滤7.enabled = 列表过滤8.enabled = 列表过滤9.enabled = 列表过滤10.enabled = 列表过滤11.enabled = true;
文本23.visible = false;
}
for(var i = 0; i < chexi.length; i++){
arr_chexi.push(chexi);
}
param['target'] = targetArr;
交叉表1.binding.clearRowHeaders();
for(var i = 0; i < arr.length; i++){
var bcol = new BCol(arr, STRING, true);
var dimCol = new DimCol(bcol);
if(arr == '项目'){
bcolSort = new BCol('PL',INTEGER,true);
dimCol.sortType = 5;
dimCol.groupSpan = true;
dimColSort = new MeasureCol(Max,bcolSort,null);
dimCol.sortBy = dimColSort;
}else if(arr == '指标名称'){
bcolSort = new BCol('排序',INTEGER,true);
dimCol.sortType = 5;
dimCol.groupSpan = true;
dimColSort = new MeasureCol(Max,bcolSort,null);
dimCol.sortBy = dimColSort;
}
debug(arr)
交叉表1.binding.addRowHeader(dimCol,i);
//添加“车系”行
if(arr == '项目'){
if(arr_chexi.length > 0){
var bcol = new BCol(arr_chexi, STRING, true);
var dimCol = new DimCol(bcol);
DEBUG()
交叉表1.binding.addRowHeader(dimCol);
}
}
}
|