@indfnd/common 0.1.74 → 0.1.75

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/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [0.1.75](http://git.inspur.com/imp-ec/ind-front/ind-common-front/compare/v0.1.74...v0.1.75) (2024-05-14)
6
+
7
+
8
+ ### Features
9
+
10
+ * **table:** 支持一行数据是否切换单位 ([726b2a0](http://git.inspur.com/imp-ec/ind-front/ind-common-front/commit/726b2a0c52b0f15a97fa669517d14518d86da9b4))
11
+ * **table:** 支持增加行高 ([fb851d3](http://git.inspur.com/imp-ec/ind-front/ind-common-front/commit/fb851d37a8722ef8d5625689855e4627b4dbfe40))
12
+
5
13
  ### [0.1.74](http://git.inspur.com/imp-ec/ind-front/ind-common-front/compare/v0.1.73...v0.1.74) (2024-05-12)
6
14
 
7
15
  ### [0.1.73](http://git.inspur.com/imp-ec/ind-front/ind-common-front/compare/v0.1.72...v0.1.73) (2024-05-10)
@@ -2,7 +2,7 @@ import { Button as Button$1, ButtonGroup as ButtonGroup$1, Input, Drawer as Draw
2
2
  import { isNil, formatDate as formatDate$1, useConfig, getQuarterNum, formatQuarter, str2Date, isDate, isArray, checkIdCard, checkVehicleNo, checkPhone, getDictMapApi, axios, isFunction, isString, uuid, exportJsonToExcel as exportJsonToExcel$1, importJsonFromExcel, on, off, deleteMenuHistoryApi, deleteMenuCollectApi, getMenuHistoryApi, getMenuCollectApi, getPermissionCache, listItemTreeApi, getPriceInfo, MIME_TYPE, base64ToBlob, putOssFileApi, isEqual, getCaptchaURL, getLocalStorage, guid, setLocalStorage, removeLocalStorage, clearSessionStorage, cryptor, getToken, putOssFileUrl, getOssFileUrl, responseInterceptors, config as config$1, setToken, loginApi, clearUserInfoCache, clearPermissionCache, logoutApi, getUserInfoCache, getUserInfoApi, setUserInfoCache, getSessionStorage, setSessionStorage, getAppListApi, getPermissionApi, setPermissionCache, menuHistoryApi, addMenuCollectApi, removeMenuCollectApi, listIndexDescApi, setIndexDescCache } from "@indfnd/utils";
3
3
  import Vue$1 from "vue";
4
4
  const name$1 = "@indfnd/common";
5
- const version = "0.1.73";
5
+ const version = "0.1.74";
6
6
  const author = "huxuetong";
7
7
  const publishConfig = {
8
8
  registry: "https://registry.npmjs.org/"
@@ -52037,6 +52037,31 @@ function generateTreeByNodes$1(nodes) {
52037
52037
  });
52038
52038
  return rlt;
52039
52039
  }
52040
+ function changeCellUnit(fromUnit, toUnit, rowData, prop) {
52041
+ if (!fromUnit || !toUnit || !rowData || !prop)
52042
+ return;
52043
+ if (rowData.isSwitchUnit === false)
52044
+ return;
52045
+ const unitChangeRatio = {
52046
+ WX_X: 1e4,
52047
+ WX_WZ: 1e4 * 5,
52048
+ X_WX: 1 / 1e4,
52049
+ X_WZ: 5,
52050
+ WZ_WX: 1 / 5 / 1e4,
52051
+ WZ_X: 1 / 5,
52052
+ YY_WY: 1e4,
52053
+ YY_Y: 1e4 * 1e4,
52054
+ WY_YY: 1 / 1e4,
52055
+ WY_Y: 1e4,
52056
+ Y_YY: 1 / 1e4 / 1e4,
52057
+ Y_WY: 1 / 1e4
52058
+ };
52059
+ const ratio = unitChangeRatio[`${fromUnit}_${toUnit}`];
52060
+ if (!ratio)
52061
+ return;
52062
+ const value = _.round(parseFloat(rowData[prop]), 6);
52063
+ rowData[prop] = isNaN(value) ? null : _.round(value * ratio, 6);
52064
+ }
52040
52065
  var render$Y = function() {
52041
52066
  var _vm = this;
52042
52067
  var _h = _vm.$createElement;
@@ -52494,41 +52519,21 @@ const __vue2_script$Z = {
52494
52519
  },
52495
52520
  deep: true
52496
52521
  },
52497
- unitType(val) {
52522
+ unitType(val, oldValue) {
52498
52523
  let datasTmp = _.cloneDeep(this.tableData);
52499
- if (val == "X") {
52500
- datasTmp.forEach((d) => {
52501
- this.switchCols.forEach((dd) => {
52502
- let t2 = _.round(parseFloat(d[dd]), 6);
52503
- d[dd] = isNaN(t2) ? null : _.round(t2 / 5, 6);
52504
- });
52505
- });
52506
- } else if (val == "WZ") {
52507
- datasTmp.forEach((d) => {
52508
- this.switchCols.forEach((dd) => {
52509
- let t2 = _.round(parseFloat(d[dd]), 6);
52510
- d[dd] = isNaN(t2) ? null : _.round(t2 * 5, 6);
52511
- });
52524
+ datasTmp.forEach((d) => {
52525
+ this.switchCols.forEach((dd) => {
52526
+ changeCellUnit(oldValue, val, d, dd);
52512
52527
  });
52513
- }
52528
+ });
52514
52529
  this.tableData = datasTmp;
52515
52530
  if (this.pinnedTopRowDataWithUnit && this.pinnedTopRowDataWithUnit.length) {
52516
52531
  let pinnedTopRowDataWithUnitTmp = _.cloneDeep(this.pinnedTopRowDataWithUnit);
52517
- if (val == "X") {
52518
- pinnedTopRowDataWithUnitTmp.forEach((d) => {
52519
- this.switchCols.forEach((dd) => {
52520
- let t2 = _.round(parseFloat(d[dd]), 6);
52521
- d[dd] = isNaN(t2) ? null : _.round(t2 / 5, 6);
52522
- });
52523
- });
52524
- } else if (val == "WZ") {
52525
- pinnedTopRowDataWithUnitTmp.forEach((d) => {
52526
- this.switchCols.forEach((dd) => {
52527
- let t2 = _.round(parseFloat(d[dd]), 6);
52528
- d[dd] = isNaN(t2) ? null : _.round(t2 * 5, 6);
52529
- });
52532
+ pinnedTopRowDataWithUnitTmp.forEach((d) => {
52533
+ this.switchCols.forEach((dd) => {
52534
+ changeCellUnit(oldValue, val, d, dd);
52530
52535
  });
52531
- }
52536
+ });
52532
52537
  this.pinnedTopRowDataWithUnit = pinnedTopRowDataWithUnitTmp;
52533
52538
  this.renderSumRow();
52534
52539
  }
@@ -53549,21 +53554,11 @@ const __vue2_script$Z = {
53549
53554
  d["_initialseq"] = idx;
53550
53555
  });
53551
53556
  if (this.unitType != this.defaultUnitType) {
53552
- if (this.unitType == "WZ") {
53553
- data.forEach((d) => {
53554
- this.switchCols.forEach((dd) => {
53555
- let t2 = _.round(parseFloat(d[dd]), 6);
53556
- d[dd] = isNaN(t2) ? null : _.round(t2 * 5, 6);
53557
- });
53558
- });
53559
- } else {
53560
- data.forEach((d) => {
53561
- this.switchCols.forEach((dd) => {
53562
- let t2 = _.round(parseFloat(d[dd]), 6);
53563
- d[dd] = isNaN(t2) ? null : _.round(t2 / 5, 6);
53564
- });
53557
+ data.forEach((d) => {
53558
+ this.switchCols.forEach((dd) => {
53559
+ changeCellUnit(this.defaultUnitType, this.unitType, d, dd);
53565
53560
  });
53566
- }
53561
+ });
53567
53562
  }
53568
53563
  this.tableData = await this.renderTreeData(data);
53569
53564
  this.totalNumber = result.data.total || 0;
@@ -53588,42 +53583,22 @@ const __vue2_script$Z = {
53588
53583
  if (this.pinnedTopRowDataWithUnit && this.pinnedTopRowDataWithUnit.length) {
53589
53584
  let pinnedTopRowDataWithUnitTmp = _.cloneDeep(this.pinnedTopRowDataWithUnit);
53590
53585
  if (this.unitType != this.defaultUnitType) {
53591
- if (this.unitType == "X") {
53592
- pinnedTopRowDataWithUnitTmp.forEach((d) => {
53593
- this.switchCols.forEach((dd) => {
53594
- let t2 = _.round(parseFloat(d[dd]), 6);
53595
- d[dd] = isNaN(t2) ? null : _.round(t2 / 5, 6);
53596
- });
53597
- });
53598
- } else if (this.unitType == "WZ") {
53599
- pinnedTopRowDataWithUnitTmp.forEach((d) => {
53600
- this.switchCols.forEach((dd) => {
53601
- let t2 = _.round(parseFloat(d[dd]), 6);
53602
- d[dd] = isNaN(t2) ? null : _.round(t2 * 5, 6);
53603
- });
53586
+ pinnedTopRowDataWithUnitTmp.forEach((d) => {
53587
+ this.switchCols.forEach((dd) => {
53588
+ changeCellUnit(this.defaultUnitType, this.unitType, d, dd);
53604
53589
  });
53605
- }
53590
+ });
53606
53591
  }
53607
53592
  this.pinnedTopRowDataWithUnit = pinnedTopRowDataWithUnitTmp;
53608
53593
  this.renderSumRow();
53609
53594
  }
53610
53595
  let datasTmp = _.cloneDeep(this.tableData);
53611
53596
  if (this.unitType != this.defaultUnitType) {
53612
- if (this.unitType == "WZ") {
53613
- datasTmp.forEach((d) => {
53614
- this.switchCols.forEach((dd) => {
53615
- let t2 = parseFloat(d[dd]);
53616
- d[dd] = isNaN(t2) ? null : _.round(t2 * 5, 6);
53617
- });
53618
- });
53619
- } else {
53620
- datasTmp.forEach((d) => {
53621
- this.switchCols.forEach((dd) => {
53622
- let t2 = parseFloat(d[dd]);
53623
- d[dd] = isNaN(t2) ? null : _.round(t2 / 5, 6);
53624
- });
53597
+ datasTmp.forEach((d) => {
53598
+ this.switchCols.forEach((dd) => {
53599
+ changeCellUnit(this.defaultUnitType, this.unitType, d, dd);
53625
53600
  });
53626
- }
53601
+ });
53627
53602
  }
53628
53603
  this.$emit("input", datasTmp);
53629
53604
  }, 10);
@@ -53662,8 +53637,7 @@ const __vue2_script$Z = {
53662
53637
  let datasTmp = _.cloneDeep(this.tableData);
53663
53638
  datasTmp.forEach((d) => {
53664
53639
  this.switchCols.forEach((dd) => {
53665
- let t2 = _.round(parseFloat(d[dd]), 6);
53666
- d[dd] = isNaN(t2) ? null : _.round(t2 / 5, 6);
53640
+ changeCellUnit(this.unitType, "X", d, dd);
53667
53641
  });
53668
53642
  });
53669
53643
  return datasTmp;
@@ -53676,8 +53650,7 @@ const __vue2_script$Z = {
53676
53650
  let datasTmp = _.cloneDeep(this.tableData);
53677
53651
  datasTmp.forEach((d) => {
53678
53652
  this.switchCols.forEach((dd) => {
53679
- let t2 = _.round(parseFloat(d[dd]), 6);
53680
- d[dd] = isNaN(t2) ? null : _.round(t2 * 5, 6);
53653
+ changeCellUnit(this.unitType, "WZ", d, dd);
53681
53654
  });
53682
53655
  });
53683
53656
  return datasTmp;
@@ -53690,8 +53663,7 @@ const __vue2_script$Z = {
53690
53663
  let datasTmp = _.cloneDeep(this.topRows);
53691
53664
  datasTmp.forEach((d) => {
53692
53665
  this.switchCols.forEach((dd) => {
53693
- let t2 = _.round(parseFloat(d[dd]), 6);
53694
- d[dd] = isNaN(t2) ? null : _.round(t2 / 5, 6);
53666
+ changeCellUnit(this.unitType, "X", d, dd);
53695
53667
  });
53696
53668
  });
53697
53669
  return datasTmp;
@@ -53704,8 +53676,7 @@ const __vue2_script$Z = {
53704
53676
  let datasTmp = _.cloneDeep(this.topRows);
53705
53677
  datasTmp.forEach((d) => {
53706
53678
  this.switchCols.forEach((dd) => {
53707
- let t2 = _.round(parseFloat(d[dd]), 6);
53708
- d[dd] = isNaN(t2) ? null : _.round(t2 * 5, 6);
53679
+ changeCellUnit(this.unitType, "WZ", d, dd);
53709
53680
  });
53710
53681
  });
53711
53682
  return datasTmp;