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.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,105 @@ 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
+ },
18676
18790
  ],
18677
18791
  };
18678
18792
 
@@ -18757,8 +18871,8 @@ const WorkbookUtils = {
18757
18871
  // 设置打印区域,这里是固定的,在业务应用中需要根据实际情况修改打印区域
18758
18872
  printInfo.rowStart(0);
18759
18873
  printInfo.rowEnd(sheet.getRowCount()); //printInfo.rowEnd(41);
18760
- printInfo.columnStart(0);
18761
- printInfo.columnEnd(76);
18874
+ printInfo.columnStart(1);
18875
+ printInfo.columnEnd(77);
18762
18876
  // 设置SpreadJS自身的边距为合适的距离
18763
18877
  printInfo.margin({
18764
18878
  /**
@@ -18869,12 +18983,13 @@ const WorkbookUtils = {
18869
18983
  * @param exportName 导出的文件名称,不传则为第一个Sheet的名称
18870
18984
  * @param regFonts 注册的字体集合,默认注册宋体和Arial字体
18871
18985
  * @param contentColEndIndex 内容列结束的索引,默认为:77(用于导出PDF文件的时候,只导出内容列到索引contentColEndIndex的位置,超过contentColEndIndex索引列后续的内容其实不需要导出)
18986
+ * @param isHb 是否是横表,默认为false(横表的时候,设置导出PDF的缩放比例为1,否则为1.06)
18872
18987
  * @returns 合并后的工作簿实例
18873
18988
  */
18874
18989
  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
18990
  { name: '宋体', type: 'normal', url: '/spreadJsFonts/simsun.ttf' },
18876
18991
  { name: 'Arial', type: 'normal', url: '/spreadJsFonts/arial.ttf' },
18877
- ], contentColEndIndex = 77) {
18992
+ ], contentColEndIndex = 77, isHb = false) {
18878
18993
  if (!spreads || spreads.length == 0) {
18879
18994
  return;
18880
18995
  }
@@ -18963,7 +19078,7 @@ const WorkbookUtils = {
18963
19078
  printInfo.blackAndWhite(false);
18964
19079
  printInfo.showRowHeader(GC.Spread.Sheets.Print.PrintVisibilityType.hide);
18965
19080
  printInfo.showColumnHeader(GC.Spread.Sheets.Print.PrintVisibilityType.hide);
18966
- printInfo.zoomFactor(1.06); //1.06
19081
+ printInfo.zoomFactor(isHb ? 1 : 1.06);
18967
19082
  }
18968
19083
  // 恢复绘制
18969
19084
  mainWorkbook.resumePaint();