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.esm.js
CHANGED
|
@@ -657,6 +657,15 @@ const BusinessUtils = {
|
|
|
657
657
|
sheet.suspendPaint();
|
|
658
658
|
// 设置工作表行数为0
|
|
659
659
|
sheet.setRowCount(0);
|
|
660
|
+
/**
|
|
661
|
+
* 设置单元格字体和大小
|
|
662
|
+
* @param row
|
|
663
|
+
* @param col
|
|
664
|
+
*/
|
|
665
|
+
const setFontSizeFamily = (row, col) => {
|
|
666
|
+
sheet.getCell(row, col).fontFamily('宋体');
|
|
667
|
+
sheet.getCell(row, col).fontSize('9pt');
|
|
668
|
+
};
|
|
660
669
|
for (let i = 0; i < testObjectAttrsChunk.length; i++) {
|
|
661
670
|
const rowAttrArr = testObjectAttrsChunk[i];
|
|
662
671
|
// 获取总行数
|
|
@@ -683,6 +692,8 @@ const BusinessUtils = {
|
|
|
683
692
|
sheet.addSpan(totalRowCount, contentColStartIndex + titleCellColumnCount, 1, rowAttrArr.length > 1 ? titleCellValColumnCount : contentTotalColCount - titleCellColumnCount, gc.Spread.Sheets.SheetArea.viewport);
|
|
684
693
|
sheet.setValue(totalRowCount, contentColStartIndex, rowAttrArr[0].title);
|
|
685
694
|
sheet.setValue(totalRowCount, contentColStartIndex + titleCellColumnCount, rowAttrArr[0].value);
|
|
695
|
+
setFontSizeFamily(totalRowCount, contentColStartIndex);
|
|
696
|
+
setFontSizeFamily(totalRowCount, contentColStartIndex + titleCellColumnCount);
|
|
686
697
|
// 合并第二个属性的标题列和值列,同时设置对应单元格的内容
|
|
687
698
|
if (rowAttrArr.length > 1) {
|
|
688
699
|
const colIndexTitle = contentColStartIndex + titleCellColumnCount + titleCellValColumnCount;
|
|
@@ -691,6 +702,8 @@ const BusinessUtils = {
|
|
|
691
702
|
sheet.addSpan(totalRowCount, colIndexValue, 1, titleCellValColumnCount + 1 + (!isVertical && rowAttrArr.length == 2 ? titleCellColumnCount + titleCellValColumnCount + 1 : 0), gc.Spread.Sheets.SheetArea.viewport);
|
|
692
703
|
sheet.setValue(totalRowCount, colIndexTitle, rowAttrArr[1].title);
|
|
693
704
|
sheet.setValue(totalRowCount, colIndexValue, rowAttrArr[1].value);
|
|
705
|
+
setFontSizeFamily(totalRowCount, colIndexTitle);
|
|
706
|
+
setFontSizeFamily(totalRowCount, colIndexValue);
|
|
694
707
|
}
|
|
695
708
|
// 合并第三个属性的标题列和值列,同时设置对应单元格的内容
|
|
696
709
|
if (rowAttrArr.length > 2) {
|
|
@@ -700,6 +713,8 @@ const BusinessUtils = {
|
|
|
700
713
|
sheet.addSpan(totalRowCount, colIndexValue, 1, titleCellValColumnCount + 1, gc.Spread.Sheets.SheetArea.viewport);
|
|
701
714
|
sheet.setValue(totalRowCount, colIndexTitle, rowAttrArr[2].title);
|
|
702
715
|
sheet.setValue(totalRowCount, colIndexValue, rowAttrArr[2].value);
|
|
716
|
+
setFontSizeFamily(totalRowCount, colIndexTitle);
|
|
717
|
+
setFontSizeFamily(totalRowCount, colIndexValue);
|
|
703
718
|
}
|
|
704
719
|
}
|
|
705
720
|
// 恢复绘制
|
|
@@ -18673,6 +18688,153 @@ const FormulaUtils = {
|
|
|
18673
18688
|
return czl;
|
|
18674
18689
|
},
|
|
18675
18690
|
},
|
|
18691
|
+
{
|
|
18692
|
+
funName: 'YJLHL',
|
|
18693
|
+
funDesc: '沥青蜡含量',
|
|
18694
|
+
funDefaultVal: null,
|
|
18695
|
+
// isContainNullUndefinedVal: true,
|
|
18696
|
+
funParams: [
|
|
18697
|
+
{
|
|
18698
|
+
name: '析出蜡质量1',
|
|
18699
|
+
repeatable: false,
|
|
18700
|
+
optional: false,
|
|
18701
|
+
},
|
|
18702
|
+
{
|
|
18703
|
+
name: '析出蜡质量2',
|
|
18704
|
+
repeatable: false,
|
|
18705
|
+
optional: false,
|
|
18706
|
+
},
|
|
18707
|
+
{
|
|
18708
|
+
name: '析出蜡质量3',
|
|
18709
|
+
repeatable: false,
|
|
18710
|
+
optional: false,
|
|
18711
|
+
},
|
|
18712
|
+
{
|
|
18713
|
+
name: '蜡含量1',
|
|
18714
|
+
repeatable: false,
|
|
18715
|
+
optional: false,
|
|
18716
|
+
},
|
|
18717
|
+
{
|
|
18718
|
+
name: '蜡含量2',
|
|
18719
|
+
repeatable: false,
|
|
18720
|
+
optional: false,
|
|
18721
|
+
},
|
|
18722
|
+
{
|
|
18723
|
+
name: '蜡含量3',
|
|
18724
|
+
repeatable: false,
|
|
18725
|
+
optional: false,
|
|
18726
|
+
},
|
|
18727
|
+
],
|
|
18728
|
+
funCallback: (spread, sheet, retData) => {
|
|
18729
|
+
//如果传递的参数小于6个,则返回空字符串
|
|
18730
|
+
if (retData.allCellVals.length < 6) {
|
|
18731
|
+
return '';
|
|
18732
|
+
}
|
|
18733
|
+
var xArr = [retData.allCellVals[0], retData.allCellVals[1], retData.allCellVals[2]]; //析出蜡质量数组
|
|
18734
|
+
var rArr = [retData.allCellVals[3], retData.allCellVals[4], retData.allCellVals[5]]; //蜡含量数组
|
|
18735
|
+
var jg;
|
|
18736
|
+
var MIN = 0.065;
|
|
18737
|
+
var MAX = 0.085;
|
|
18738
|
+
var ok = xArr.map((v) => +v >= MIN && +v <= MAX); //判定是否符合条件
|
|
18739
|
+
var idx = ok.map((v, i) => (v ? i : -1)).filter((i) => i >= 0); //符合条件个数
|
|
18740
|
+
if (idx.length === 0) {
|
|
18741
|
+
// msg = '三个值均不满足条件,请重新进行试验!';
|
|
18742
|
+
return '重新试验';
|
|
18743
|
+
}
|
|
18744
|
+
var vals = idx.map((i) => +rArr[i]); //符合条件的蜡质量对应的蜡含量
|
|
18745
|
+
var avg = vals.reduce((a, b) => a + b) / vals.length; //计算蜡含量平均值
|
|
18746
|
+
jg = FormulaUtils.commFun.GetDataOddIncreaseEvenDecrease(avg, -1);
|
|
18747
|
+
return jg;
|
|
18748
|
+
},
|
|
18749
|
+
},
|
|
18750
|
+
{
|
|
18751
|
+
funName: 'YJNFX',
|
|
18752
|
+
funDesc: '沥青黏附性',
|
|
18753
|
+
funDefaultVal: null,
|
|
18754
|
+
// isContainNullUndefinedVal: true,
|
|
18755
|
+
funParams: [
|
|
18756
|
+
{
|
|
18757
|
+
name: '沥青膜剥落情况',
|
|
18758
|
+
repeatable: false,
|
|
18759
|
+
optional: false,
|
|
18760
|
+
},
|
|
18761
|
+
],
|
|
18762
|
+
funCallback: (spread, sheet, retData) => {
|
|
18763
|
+
//如果传递的参数小于1个,则返回空字符串
|
|
18764
|
+
if (retData.allCellVals.length < 1) {
|
|
18765
|
+
return '';
|
|
18766
|
+
}
|
|
18767
|
+
let lqmblqk = retData.allCellVals[0];
|
|
18768
|
+
var pddj; //最后输出的值
|
|
18769
|
+
if (lqmblqk == '沥青膜裹覆率接近100%') {
|
|
18770
|
+
pddj = '5';
|
|
18771
|
+
}
|
|
18772
|
+
else if (lqmblqk == '沥青膜少部剥落,厚度不均,沥青膜裹覆率不小于90%') {
|
|
18773
|
+
pddj = '4';
|
|
18774
|
+
}
|
|
18775
|
+
else if (lqmblqk == '沥青膜局部明显剥落,沥青膜裹覆率为75%~90%') {
|
|
18776
|
+
pddj = '3';
|
|
18777
|
+
}
|
|
18778
|
+
else if (lqmblqk == '沥青膜大部分剥落,沥青膜裹覆率为25%~75%') {
|
|
18779
|
+
pddj = '2';
|
|
18780
|
+
}
|
|
18781
|
+
else if (lqmblqk == '沥青膜几乎完全剥落,沥青膜裹覆率小于25%') {
|
|
18782
|
+
pddj = '1';
|
|
18783
|
+
}
|
|
18784
|
+
else {
|
|
18785
|
+
pddj = '/';
|
|
18786
|
+
}
|
|
18787
|
+
return pddj;
|
|
18788
|
+
},
|
|
18789
|
+
},
|
|
18790
|
+
{
|
|
18791
|
+
funName: 'YJNDCS',
|
|
18792
|
+
funDesc: '沥青黏度常数',
|
|
18793
|
+
funDefaultVal: null,
|
|
18794
|
+
// isContainNullUndefinedVal: true,
|
|
18795
|
+
funParams: [
|
|
18796
|
+
{
|
|
18797
|
+
name: '毛细管型号',
|
|
18798
|
+
repeatable: false,
|
|
18799
|
+
optional: false,
|
|
18800
|
+
},
|
|
18801
|
+
{
|
|
18802
|
+
name: '标管编号',
|
|
18803
|
+
repeatable: false,
|
|
18804
|
+
optional: false,
|
|
18805
|
+
},
|
|
18806
|
+
],
|
|
18807
|
+
funCallback: (spread, sheet, retData) => {
|
|
18808
|
+
//如果传递的参数小于2个,则返回空字符串
|
|
18809
|
+
if (retData.allCellVals.length < 2) {
|
|
18810
|
+
return '';
|
|
18811
|
+
}
|
|
18812
|
+
let mxgxh = retData.allCellVals[0], bgbh = retData.allCellVals[1];
|
|
18813
|
+
var ndcs; //最后输出的值
|
|
18814
|
+
if (bgbh == '管B') {
|
|
18815
|
+
var arr = new Array('25-0.2', '50-0.8', '100-3.2', '200-12.8', '400-50.0');
|
|
18816
|
+
}
|
|
18817
|
+
else if (bgbh == '管C') {
|
|
18818
|
+
var arr = new Array('25-0.1', '50-0.4', '100-1.6', '200-6.4', '400-25.0');
|
|
18819
|
+
}
|
|
18820
|
+
else if (bgbh == '管D') {
|
|
18821
|
+
var arr = new Array('25-0.07', '50-0.3', '100-1.0', '200-4.0', '400-16.0');
|
|
18822
|
+
}
|
|
18823
|
+
else if (bgbh == '球B') {
|
|
18824
|
+
var arr = new Array('4-0.0002', '5-0.0006', '6-0.002', '7-0.006', '8-0.02', '9-0.06');
|
|
18825
|
+
}
|
|
18826
|
+
else if (bgbh == '球C') {
|
|
18827
|
+
var arr = new Array('4-0.00006', '5-0.0002', '6-0.0006', '7-0.002', '8-0.006', '9-0.02');
|
|
18828
|
+
}
|
|
18829
|
+
for (var i = 0; i < arr.length; i++) {
|
|
18830
|
+
var ret = arr[i].split('-');
|
|
18831
|
+
if (mxgxh == ret[0]) {
|
|
18832
|
+
ndcs = ret[1];
|
|
18833
|
+
}
|
|
18834
|
+
}
|
|
18835
|
+
return ndcs;
|
|
18836
|
+
},
|
|
18837
|
+
},
|
|
18676
18838
|
],
|
|
18677
18839
|
};
|
|
18678
18840
|
|
|
@@ -18757,8 +18919,8 @@ const WorkbookUtils = {
|
|
|
18757
18919
|
// 设置打印区域,这里是固定的,在业务应用中需要根据实际情况修改打印区域
|
|
18758
18920
|
printInfo.rowStart(0);
|
|
18759
18921
|
printInfo.rowEnd(sheet.getRowCount()); //printInfo.rowEnd(41);
|
|
18760
|
-
printInfo.columnStart(
|
|
18761
|
-
printInfo.columnEnd(
|
|
18922
|
+
printInfo.columnStart(1);
|
|
18923
|
+
printInfo.columnEnd(77);
|
|
18762
18924
|
// 设置SpreadJS自身的边距为合适的距离
|
|
18763
18925
|
printInfo.margin({
|
|
18764
18926
|
/**
|
|
@@ -18869,12 +19031,13 @@ const WorkbookUtils = {
|
|
|
18869
19031
|
* @param exportName 导出的文件名称,不传则为第一个Sheet的名称
|
|
18870
19032
|
* @param regFonts 注册的字体集合,默认注册宋体和Arial字体
|
|
18871
19033
|
* @param contentColEndIndex 内容列结束的索引,默认为:77(用于导出PDF文件的时候,只导出内容列到索引contentColEndIndex的位置,超过contentColEndIndex索引列后续的内容其实不需要导出)
|
|
19034
|
+
* @param isHb 是否是横表,默认为false(横表的时候,设置导出PDF的缩放比例为1,否则为1.06)
|
|
18872
19035
|
* @returns 合并后的工作簿实例
|
|
18873
19036
|
*/
|
|
18874
19037
|
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 = [
|
|
18875
19038
|
{ name: '宋体', type: 'normal', url: '/spreadJsFonts/simsun.ttf' },
|
|
18876
19039
|
{ name: 'Arial', type: 'normal', url: '/spreadJsFonts/arial.ttf' },
|
|
18877
|
-
], contentColEndIndex = 77) {
|
|
19040
|
+
], contentColEndIndex = 77, isHb = false) {
|
|
18878
19041
|
if (!spreads || spreads.length == 0) {
|
|
18879
19042
|
return;
|
|
18880
19043
|
}
|
|
@@ -18963,7 +19126,7 @@ const WorkbookUtils = {
|
|
|
18963
19126
|
printInfo.blackAndWhite(false);
|
|
18964
19127
|
printInfo.showRowHeader(GC.Spread.Sheets.Print.PrintVisibilityType.hide);
|
|
18965
19128
|
printInfo.showColumnHeader(GC.Spread.Sheets.Print.PrintVisibilityType.hide);
|
|
18966
|
-
printInfo.zoomFactor(1.06);
|
|
19129
|
+
printInfo.zoomFactor(isHb ? 1 : 1.06);
|
|
18967
19130
|
}
|
|
18968
19131
|
// 恢复绘制
|
|
18969
19132
|
mainWorkbook.resumePaint();
|