@indfnd/common 1.0.13 → 1.0.14

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,13 @@
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
+ ### [1.0.14](http://git.inspur.com/imp-ec/ind-front/ind-common-front/compare/v1.0.13...v1.0.14) (2024-06-29)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * 导出excel支持百分比格式 ([2e3fc6c](http://git.inspur.com/imp-ec/ind-front/ind-common-front/commit/2e3fc6cb0d32c94a2382d37f2a96e32f1f9700c5))
11
+
5
12
  ### [1.0.13](http://git.inspur.com/imp-ec/ind-front/ind-common-front/compare/v1.0.12...v1.0.13) (2024-06-28)
6
13
 
7
14
 
@@ -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, getIndexDescCache, listIndexDescApi, setIndexDescCache } from "@indfnd/utils";
3
3
  import Vue$1 from "vue";
4
4
  const name$1 = "@indfnd/common";
5
- const version = "1.0.12";
5
+ const version = "1.0.13";
6
6
  const author = "huxuetong";
7
7
  const publishConfig = {
8
8
  registry: "https://registry.npmjs.org/"
@@ -43160,14 +43160,16 @@ function getAgColumnTitleAndData({ columns, datas }) {
43160
43160
  }
43161
43161
  calcColumns(columnsClo, columnsCalc);
43162
43162
  var columnAlign = columnsCalc.map((d) => d.align || "left");
43163
- var columnType = columnsCalc.map((d) => d.align == "right" || d.align == "rightNum" ? "n" : "s");
43163
+ var columnType = columnsCalc.map((d) => d.dataType == "percent" ? "p" : d.align == "right" || d.align == "rightNum" ? "n" : "s");
43164
43164
  var columnWidth = columnsCalc.map(
43165
43165
  (d) => d.excelWidth ? d.excelWidth : d.width ? Math.floor(d.width / 10) : 10
43166
43166
  );
43167
43167
  var numberFormat = columnsCalc.map((d) => {
43168
43168
  var _a;
43169
43169
  let scale = (_a = d == null ? void 0 : d.cellRendererParams) == null ? void 0 : _a.scale;
43170
- if (scale !== void 0) {
43170
+ if (d.dataType == "percent") {
43171
+ return "0.00%";
43172
+ } else if (scale !== void 0) {
43171
43173
  return "#,##0." + _.range(scale).fill(0).join("");
43172
43174
  } else {
43173
43175
  return d.align == "rightNum" ? "#,##0.0000" : d.align == "right" ? "#,##0.00" : "";
@@ -43394,14 +43396,17 @@ function exportJsonToExcel(excelData) {
43394
43396
  for (var i = 0; i < jsonData.length; i++) {
43395
43397
  var lineData = jsonData[i];
43396
43398
  for (var j = 0; j < lineData.length; j++) {
43397
- if (columnType[j] === "s" && lineData[j]) {
43398
- sheet.cell(rowsNow + i, j + 1).value(lineData[j]);
43399
- dataCellStyle.numberFormat = "";
43399
+ if (columnType[j] === "p" && lineData[j]) {
43400
+ sheet.cell(rowsNow + i, j + 1).value(parseFloat(lineData[j] / 100));
43401
+ dataCellStyle.numberFormat = numberFormat[j];
43400
43402
  } else if (columnType[j] === "n" && lineData[j]) {
43401
43403
  sheet.cell(rowsNow + i, j + 1).value(parseFloat(lineData[j]));
43402
43404
  dataCellStyle.numberFormat = numberFormat[j];
43405
+ } else if (columnType[j] === "s" && lineData[j]) {
43406
+ sheet.cell(rowsNow + i, j + 1).value(lineData[j]);
43407
+ dataCellStyle.numberFormat = "";
43403
43408
  } else {
43404
- if (columnType[j] === "n") {
43409
+ if (columnType[j] === "p" || columnType[j] === "n") {
43405
43410
  dataCellStyle.numberFormat = numberFormat[j];
43406
43411
  } else {
43407
43412
  sheet.cell(rowsNow + i, j + 1).value("");
@@ -53143,6 +53148,9 @@ const __vue2_script$_ = {
53143
53148
  if (column.align) {
53144
53149
  agColumn.align = column.align;
53145
53150
  }
53151
+ if (column.dataType) {
53152
+ agColumn.dataType = column.dataType;
53153
+ }
53146
53154
  if (column.headerTooltip) {
53147
53155
  agColumn.headerTooltip = agColumn.headerTooltip || column.headerTooltip;
53148
53156
  }