rapid-spreadjs 1.0.40 → 1.0.42
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 +167 -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 +167 -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,153 @@ 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
|
+
},
|
|
18812
|
+
{
|
|
18813
|
+
funName: 'YJNDCS',
|
|
18814
|
+
funDesc: '沥青黏度常数',
|
|
18815
|
+
funDefaultVal: null,
|
|
18816
|
+
// isContainNullUndefinedVal: true,
|
|
18817
|
+
funParams: [
|
|
18818
|
+
{
|
|
18819
|
+
name: '毛细管型号',
|
|
18820
|
+
repeatable: false,
|
|
18821
|
+
optional: false,
|
|
18822
|
+
},
|
|
18823
|
+
{
|
|
18824
|
+
name: '标管编号',
|
|
18825
|
+
repeatable: false,
|
|
18826
|
+
optional: false,
|
|
18827
|
+
},
|
|
18828
|
+
],
|
|
18829
|
+
funCallback: (spread, sheet, retData) => {
|
|
18830
|
+
//如果传递的参数小于2个,则返回空字符串
|
|
18831
|
+
if (retData.allCellVals.length < 2) {
|
|
18832
|
+
return '';
|
|
18833
|
+
}
|
|
18834
|
+
let mxgxh = retData.allCellVals[0], bgbh = retData.allCellVals[1];
|
|
18835
|
+
var ndcs; //最后输出的值
|
|
18836
|
+
if (bgbh == '管B') {
|
|
18837
|
+
var arr = new Array('25-0.2', '50-0.8', '100-3.2', '200-12.8', '400-50.0');
|
|
18838
|
+
}
|
|
18839
|
+
else if (bgbh == '管C') {
|
|
18840
|
+
var arr = new Array('25-0.1', '50-0.4', '100-1.6', '200-6.4', '400-25.0');
|
|
18841
|
+
}
|
|
18842
|
+
else if (bgbh == '管D') {
|
|
18843
|
+
var arr = new Array('25-0.07', '50-0.3', '100-1.0', '200-4.0', '400-16.0');
|
|
18844
|
+
}
|
|
18845
|
+
else if (bgbh == '球B') {
|
|
18846
|
+
var arr = new Array('4-0.0002', '5-0.0006', '6-0.002', '7-0.006', '8-0.02', '9-0.06');
|
|
18847
|
+
}
|
|
18848
|
+
else if (bgbh == '球C') {
|
|
18849
|
+
var arr = new Array('4-0.00006', '5-0.0002', '6-0.0006', '7-0.002', '8-0.006', '9-0.02');
|
|
18850
|
+
}
|
|
18851
|
+
for (var i = 0; i < arr.length; i++) {
|
|
18852
|
+
var ret = arr[i].split('-');
|
|
18853
|
+
if (mxgxh == ret[0]) {
|
|
18854
|
+
ndcs = ret[1];
|
|
18855
|
+
}
|
|
18856
|
+
}
|
|
18857
|
+
return ndcs;
|
|
18858
|
+
},
|
|
18859
|
+
},
|
|
18698
18860
|
],
|
|
18699
18861
|
};
|
|
18700
18862
|
|
|
@@ -18779,8 +18941,8 @@ const WorkbookUtils = {
|
|
|
18779
18941
|
// 设置打印区域,这里是固定的,在业务应用中需要根据实际情况修改打印区域
|
|
18780
18942
|
printInfo.rowStart(0);
|
|
18781
18943
|
printInfo.rowEnd(sheet.getRowCount()); //printInfo.rowEnd(41);
|
|
18782
|
-
printInfo.columnStart(
|
|
18783
|
-
printInfo.columnEnd(
|
|
18944
|
+
printInfo.columnStart(1);
|
|
18945
|
+
printInfo.columnEnd(77);
|
|
18784
18946
|
// 设置SpreadJS自身的边距为合适的距离
|
|
18785
18947
|
printInfo.margin({
|
|
18786
18948
|
/**
|
|
@@ -18891,12 +19053,13 @@ const WorkbookUtils = {
|
|
|
18891
19053
|
* @param exportName 导出的文件名称,不传则为第一个Sheet的名称
|
|
18892
19054
|
* @param regFonts 注册的字体集合,默认注册宋体和Arial字体
|
|
18893
19055
|
* @param contentColEndIndex 内容列结束的索引,默认为:77(用于导出PDF文件的时候,只导出内容列到索引contentColEndIndex的位置,超过contentColEndIndex索引列后续的内容其实不需要导出)
|
|
19056
|
+
* @param isHb 是否是横表,默认为false(横表的时候,设置导出PDF的缩放比例为1,否则为1.06)
|
|
18894
19057
|
* @returns 合并后的工作簿实例
|
|
18895
19058
|
*/
|
|
18896
19059
|
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
19060
|
{ name: '宋体', type: 'normal', url: '/spreadJsFonts/simsun.ttf' },
|
|
18898
19061
|
{ name: 'Arial', type: 'normal', url: '/spreadJsFonts/arial.ttf' },
|
|
18899
|
-
], contentColEndIndex = 77) {
|
|
19062
|
+
], contentColEndIndex = 77, isHb = false) {
|
|
18900
19063
|
if (!spreads || spreads.length == 0) {
|
|
18901
19064
|
return;
|
|
18902
19065
|
}
|
|
@@ -18985,7 +19148,7 @@ const WorkbookUtils = {
|
|
|
18985
19148
|
printInfo.blackAndWhite(false);
|
|
18986
19149
|
printInfo.showRowHeader(GC.Spread.Sheets.Print.PrintVisibilityType.hide);
|
|
18987
19150
|
printInfo.showColumnHeader(GC.Spread.Sheets.Print.PrintVisibilityType.hide);
|
|
18988
|
-
printInfo.zoomFactor(1.06);
|
|
19151
|
+
printInfo.zoomFactor(isHb ? 1 : 1.06);
|
|
18989
19152
|
}
|
|
18990
19153
|
// 恢复绘制
|
|
18991
19154
|
mainWorkbook.resumePaint();
|