rapid-spreadjs 1.0.40 → 1.0.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +119 -4
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs.min.js +1 -1
- package/dist/index.cjs.min.js.map +1 -1
- package/dist/index.esm.js +119 -4
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm.min.js +1 -1
- package/dist/index.esm.min.js.map +1 -1
- package/dist/utils/wookbook.d.ts +2 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -679,6 +679,15 @@ const BusinessUtils = {
|
|
|
679
679
|
sheet.suspendPaint();
|
|
680
680
|
// 设置工作表行数为0
|
|
681
681
|
sheet.setRowCount(0);
|
|
682
|
+
/**
|
|
683
|
+
* 设置单元格字体和大小
|
|
684
|
+
* @param row
|
|
685
|
+
* @param col
|
|
686
|
+
*/
|
|
687
|
+
const setFontSizeFamily = (row, col) => {
|
|
688
|
+
sheet.getCell(row, col).fontFamily('宋体');
|
|
689
|
+
sheet.getCell(row, col).fontSize('9pt');
|
|
690
|
+
};
|
|
682
691
|
for (let i = 0; i < testObjectAttrsChunk.length; i++) {
|
|
683
692
|
const rowAttrArr = testObjectAttrsChunk[i];
|
|
684
693
|
// 获取总行数
|
|
@@ -705,6 +714,8 @@ const BusinessUtils = {
|
|
|
705
714
|
sheet.addSpan(totalRowCount, contentColStartIndex + titleCellColumnCount, 1, rowAttrArr.length > 1 ? titleCellValColumnCount : contentTotalColCount - titleCellColumnCount, gc.Spread.Sheets.SheetArea.viewport);
|
|
706
715
|
sheet.setValue(totalRowCount, contentColStartIndex, rowAttrArr[0].title);
|
|
707
716
|
sheet.setValue(totalRowCount, contentColStartIndex + titleCellColumnCount, rowAttrArr[0].value);
|
|
717
|
+
setFontSizeFamily(totalRowCount, contentColStartIndex);
|
|
718
|
+
setFontSizeFamily(totalRowCount, contentColStartIndex + titleCellColumnCount);
|
|
708
719
|
// 合并第二个属性的标题列和值列,同时设置对应单元格的内容
|
|
709
720
|
if (rowAttrArr.length > 1) {
|
|
710
721
|
const colIndexTitle = contentColStartIndex + titleCellColumnCount + titleCellValColumnCount;
|
|
@@ -713,6 +724,8 @@ const BusinessUtils = {
|
|
|
713
724
|
sheet.addSpan(totalRowCount, colIndexValue, 1, titleCellValColumnCount + 1 + (!isVertical && rowAttrArr.length == 2 ? titleCellColumnCount + titleCellValColumnCount + 1 : 0), gc.Spread.Sheets.SheetArea.viewport);
|
|
714
725
|
sheet.setValue(totalRowCount, colIndexTitle, rowAttrArr[1].title);
|
|
715
726
|
sheet.setValue(totalRowCount, colIndexValue, rowAttrArr[1].value);
|
|
727
|
+
setFontSizeFamily(totalRowCount, colIndexTitle);
|
|
728
|
+
setFontSizeFamily(totalRowCount, colIndexValue);
|
|
716
729
|
}
|
|
717
730
|
// 合并第三个属性的标题列和值列,同时设置对应单元格的内容
|
|
718
731
|
if (rowAttrArr.length > 2) {
|
|
@@ -722,6 +735,8 @@ const BusinessUtils = {
|
|
|
722
735
|
sheet.addSpan(totalRowCount, colIndexValue, 1, titleCellValColumnCount + 1, gc.Spread.Sheets.SheetArea.viewport);
|
|
723
736
|
sheet.setValue(totalRowCount, colIndexTitle, rowAttrArr[2].title);
|
|
724
737
|
sheet.setValue(totalRowCount, colIndexValue, rowAttrArr[2].value);
|
|
738
|
+
setFontSizeFamily(totalRowCount, colIndexTitle);
|
|
739
|
+
setFontSizeFamily(totalRowCount, colIndexValue);
|
|
725
740
|
}
|
|
726
741
|
}
|
|
727
742
|
// 恢复绘制
|
|
@@ -18695,6 +18710,105 @@ const FormulaUtils = {
|
|
|
18695
18710
|
return czl;
|
|
18696
18711
|
},
|
|
18697
18712
|
},
|
|
18713
|
+
{
|
|
18714
|
+
funName: 'YJLHL',
|
|
18715
|
+
funDesc: '沥青蜡含量',
|
|
18716
|
+
funDefaultVal: null,
|
|
18717
|
+
// isContainNullUndefinedVal: true,
|
|
18718
|
+
funParams: [
|
|
18719
|
+
{
|
|
18720
|
+
name: '析出蜡质量1',
|
|
18721
|
+
repeatable: false,
|
|
18722
|
+
optional: false,
|
|
18723
|
+
},
|
|
18724
|
+
{
|
|
18725
|
+
name: '析出蜡质量2',
|
|
18726
|
+
repeatable: false,
|
|
18727
|
+
optional: false,
|
|
18728
|
+
},
|
|
18729
|
+
{
|
|
18730
|
+
name: '析出蜡质量3',
|
|
18731
|
+
repeatable: false,
|
|
18732
|
+
optional: false,
|
|
18733
|
+
},
|
|
18734
|
+
{
|
|
18735
|
+
name: '蜡含量1',
|
|
18736
|
+
repeatable: false,
|
|
18737
|
+
optional: false,
|
|
18738
|
+
},
|
|
18739
|
+
{
|
|
18740
|
+
name: '蜡含量2',
|
|
18741
|
+
repeatable: false,
|
|
18742
|
+
optional: false,
|
|
18743
|
+
},
|
|
18744
|
+
{
|
|
18745
|
+
name: '蜡含量3',
|
|
18746
|
+
repeatable: false,
|
|
18747
|
+
optional: false,
|
|
18748
|
+
},
|
|
18749
|
+
],
|
|
18750
|
+
funCallback: (spread, sheet, retData) => {
|
|
18751
|
+
//如果传递的参数小于6个,则返回空字符串
|
|
18752
|
+
if (retData.allCellVals.length < 6) {
|
|
18753
|
+
return '';
|
|
18754
|
+
}
|
|
18755
|
+
var xArr = [retData.allCellVals[0], retData.allCellVals[1], retData.allCellVals[2]]; //析出蜡质量数组
|
|
18756
|
+
var rArr = [retData.allCellVals[3], retData.allCellVals[4], retData.allCellVals[5]]; //蜡含量数组
|
|
18757
|
+
var jg;
|
|
18758
|
+
var MIN = 0.065;
|
|
18759
|
+
var MAX = 0.085;
|
|
18760
|
+
var ok = xArr.map((v) => +v >= MIN && +v <= MAX); //判定是否符合条件
|
|
18761
|
+
var idx = ok.map((v, i) => (v ? i : -1)).filter((i) => i >= 0); //符合条件个数
|
|
18762
|
+
if (idx.length === 0) {
|
|
18763
|
+
// msg = '三个值均不满足条件,请重新进行试验!';
|
|
18764
|
+
return '重新试验';
|
|
18765
|
+
}
|
|
18766
|
+
var vals = idx.map((i) => +rArr[i]); //符合条件的蜡质量对应的蜡含量
|
|
18767
|
+
var avg = vals.reduce((a, b) => a + b) / vals.length; //计算蜡含量平均值
|
|
18768
|
+
jg = FormulaUtils.commFun.GetDataOddIncreaseEvenDecrease(avg, -1);
|
|
18769
|
+
return jg;
|
|
18770
|
+
},
|
|
18771
|
+
},
|
|
18772
|
+
{
|
|
18773
|
+
funName: 'YJNFX',
|
|
18774
|
+
funDesc: '沥青黏附性',
|
|
18775
|
+
funDefaultVal: null,
|
|
18776
|
+
// isContainNullUndefinedVal: true,
|
|
18777
|
+
funParams: [
|
|
18778
|
+
{
|
|
18779
|
+
name: '沥青膜剥落情况',
|
|
18780
|
+
repeatable: false,
|
|
18781
|
+
optional: false,
|
|
18782
|
+
},
|
|
18783
|
+
],
|
|
18784
|
+
funCallback: (spread, sheet, retData) => {
|
|
18785
|
+
//如果传递的参数小于1个,则返回空字符串
|
|
18786
|
+
if (retData.allCellVals.length < 1) {
|
|
18787
|
+
return '';
|
|
18788
|
+
}
|
|
18789
|
+
let lqmblqk = retData.allCellVals[0];
|
|
18790
|
+
var pddj; //最后输出的值
|
|
18791
|
+
if (lqmblqk == '沥青膜裹覆率接近100%') {
|
|
18792
|
+
pddj = '5';
|
|
18793
|
+
}
|
|
18794
|
+
else if (lqmblqk == '沥青膜少部剥落,厚度不均,沥青膜裹覆率不小于90%') {
|
|
18795
|
+
pddj = '4';
|
|
18796
|
+
}
|
|
18797
|
+
else if (lqmblqk == '沥青膜局部明显剥落,沥青膜裹覆率为75%~90%') {
|
|
18798
|
+
pddj = '3';
|
|
18799
|
+
}
|
|
18800
|
+
else if (lqmblqk == '沥青膜大部分剥落,沥青膜裹覆率为25%~75%') {
|
|
18801
|
+
pddj = '2';
|
|
18802
|
+
}
|
|
18803
|
+
else if (lqmblqk == '沥青膜几乎完全剥落,沥青膜裹覆率小于25%') {
|
|
18804
|
+
pddj = '1';
|
|
18805
|
+
}
|
|
18806
|
+
else {
|
|
18807
|
+
pddj = '/';
|
|
18808
|
+
}
|
|
18809
|
+
return pddj;
|
|
18810
|
+
},
|
|
18811
|
+
},
|
|
18698
18812
|
],
|
|
18699
18813
|
};
|
|
18700
18814
|
|
|
@@ -18779,8 +18893,8 @@ const WorkbookUtils = {
|
|
|
18779
18893
|
// 设置打印区域,这里是固定的,在业务应用中需要根据实际情况修改打印区域
|
|
18780
18894
|
printInfo.rowStart(0);
|
|
18781
18895
|
printInfo.rowEnd(sheet.getRowCount()); //printInfo.rowEnd(41);
|
|
18782
|
-
printInfo.columnStart(
|
|
18783
|
-
printInfo.columnEnd(
|
|
18896
|
+
printInfo.columnStart(1);
|
|
18897
|
+
printInfo.columnEnd(77);
|
|
18784
18898
|
// 设置SpreadJS自身的边距为合适的距离
|
|
18785
18899
|
printInfo.margin({
|
|
18786
18900
|
/**
|
|
@@ -18891,12 +19005,13 @@ const WorkbookUtils = {
|
|
|
18891
19005
|
* @param exportName 导出的文件名称,不传则为第一个Sheet的名称
|
|
18892
19006
|
* @param regFonts 注册的字体集合,默认注册宋体和Arial字体
|
|
18893
19007
|
* @param contentColEndIndex 内容列结束的索引,默认为:77(用于导出PDF文件的时候,只导出内容列到索引contentColEndIndex的位置,超过contentColEndIndex索引列后续的内容其实不需要导出)
|
|
19008
|
+
* @param isHb 是否是横表,默认为false(横表的时候,设置导出PDF的缩放比例为1,否则为1.06)
|
|
18894
19009
|
* @returns 合并后的工作簿实例
|
|
18895
19010
|
*/
|
|
18896
19011
|
mergeWorkbooksToExcelOrPdf: (GC_1, spreads_1, ...args_1) => __awaiter(void 0, [GC_1, spreads_1, ...args_1], void 0, function* (GC, spreads, isExcel = true, exportName, regFonts = [
|
|
18897
19012
|
{ name: '宋体', type: 'normal', url: '/spreadJsFonts/simsun.ttf' },
|
|
18898
19013
|
{ name: 'Arial', type: 'normal', url: '/spreadJsFonts/arial.ttf' },
|
|
18899
|
-
], contentColEndIndex = 77) {
|
|
19014
|
+
], contentColEndIndex = 77, isHb = false) {
|
|
18900
19015
|
if (!spreads || spreads.length == 0) {
|
|
18901
19016
|
return;
|
|
18902
19017
|
}
|
|
@@ -18985,7 +19100,7 @@ const WorkbookUtils = {
|
|
|
18985
19100
|
printInfo.blackAndWhite(false);
|
|
18986
19101
|
printInfo.showRowHeader(GC.Spread.Sheets.Print.PrintVisibilityType.hide);
|
|
18987
19102
|
printInfo.showColumnHeader(GC.Spread.Sheets.Print.PrintVisibilityType.hide);
|
|
18988
|
-
printInfo.zoomFactor(1.06);
|
|
19103
|
+
printInfo.zoomFactor(isHb ? 1 : 1.06);
|
|
18989
19104
|
}
|
|
18990
19105
|
// 恢复绘制
|
|
18991
19106
|
mainWorkbook.resumePaint();
|