ls-pro-common 3.0.84 → 3.0.85

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.
@@ -9,7 +9,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
9
9
  import React from "react";
10
10
  import { useState, useRef, useCallback, useMemo } from 'react';
11
11
  import { PlusCircleOutlined, EditOutlined, DeleteOutlined, ImportOutlined, ExportOutlined } from '@ant-design/icons';
12
- import { showConfirm, showWarn, showError, showSuccess } from '../../utils';
12
+ import { showConfirm, showWarn, showError, showSuccess, downloadFile } from '../../utils';
13
13
  import { httpPost } from '../../http';
14
14
  import usePermission from '../usePermission';
15
15
  import exportProcess from '../../utils/exportProcess';
@@ -796,7 +796,7 @@ function useDtl(dtlParam) {
796
796
  _context9.next = 14;
797
797
  break;
798
798
  }
799
- window.open(result.data);
799
+ downloadFile(result.data);
800
800
  return _context9.abrupt("return", true);
801
801
  case 14:
802
802
  if (!(((_result$flag6 = result.flag) === null || _result$flag6 === void 0 ? void 0 : _result$flag6.retCode) === '0')) {
@@ -9,7 +9,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
9
9
  import React from "react";
10
10
  import { useState, useRef, useMemo, useCallback } from 'react';
11
11
  import { PlusCircleOutlined, EditOutlined, DeleteOutlined, ImportOutlined, ExportOutlined, AuditOutlined } from '@ant-design/icons';
12
- import { showConfirm, showWarn, showSuccess, showError } from '../../utils';
12
+ import { showConfirm, showWarn, showSuccess, showError, downloadFile } from '../../utils';
13
13
  import exportProcess from '../../utils/exportProcess';
14
14
  import { httpPost } from '../../http';
15
15
  import usePermission from '../usePermission';
@@ -594,7 +594,7 @@ function useSingle(inParam) {
594
594
  _context7.next = 14;
595
595
  break;
596
596
  }
597
- window.open(result.data);
597
+ downloadFile(result.data);
598
598
  return _context7.abrupt("return", true);
599
599
  case 14:
600
600
  if (!(((_result$flag4 = result.flag) === null || _result$flag4 === void 0 ? void 0 : _result$flag4.retCode) === '0')) {
package/es/utils/index.js CHANGED
@@ -900,6 +900,11 @@ export var sleep = function sleep(secord) {
900
900
  export var downloadFile = function downloadFile(url, fileName) {
901
901
  var a = document.createElement('a');
902
902
  a.href = url;
903
+ // 如果导出域名有配置,则优先使用导出域名
904
+ var baseExportUrl = getCache('exportUrl') || '';
905
+ if (baseExportUrl && !url.startsWith('http')) {
906
+ a.href = baseExportUrl + url;
907
+ }
903
908
  // a.target = '_blank'; // 新开屏有闪烁
904
909
  if (fileName) {
905
910
  a.setAttribute('download', fileName);
@@ -9,7 +9,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
9
9
  import React from "react";
10
10
  import { useState, useRef, useCallback, useMemo } from 'react';
11
11
  import { PlusCircleOutlined, EditOutlined, DeleteOutlined, ImportOutlined, ExportOutlined } from '@ant-design/icons';
12
- import { showConfirm, showWarn, showError, showSuccess } from '../../utils';
12
+ import { showConfirm, showWarn, showError, showSuccess, downloadFile } from '../../utils';
13
13
  import { httpPost } from '../../http';
14
14
  import usePermission from '../usePermission';
15
15
  import exportProcess from '../../utils/exportProcess';
@@ -796,7 +796,7 @@ function useDtl(dtlParam) {
796
796
  _context9.next = 14;
797
797
  break;
798
798
  }
799
- window.open(result.data);
799
+ downloadFile(result.data);
800
800
  return _context9.abrupt("return", true);
801
801
  case 14:
802
802
  if (!(((_result$flag6 = result.flag) === null || _result$flag6 === void 0 ? void 0 : _result$flag6.retCode) === '0')) {
@@ -9,7 +9,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
9
9
  import React from "react";
10
10
  import { useState, useRef, useMemo, useCallback } from 'react';
11
11
  import { PlusCircleOutlined, EditOutlined, DeleteOutlined, ImportOutlined, ExportOutlined, AuditOutlined } from '@ant-design/icons';
12
- import { showConfirm, showWarn, showSuccess, showError } from '../../utils';
12
+ import { showConfirm, showWarn, showSuccess, showError, downloadFile } from '../../utils';
13
13
  import exportProcess from '../../utils/exportProcess';
14
14
  import { httpPost } from '../../http';
15
15
  import usePermission from '../usePermission';
@@ -594,7 +594,7 @@ function useSingle(inParam) {
594
594
  _context7.next = 14;
595
595
  break;
596
596
  }
597
- window.open(result.data);
597
+ downloadFile(result.data);
598
598
  return _context7.abrupt("return", true);
599
599
  case 14:
600
600
  if (!(((_result$flag4 = result.flag) === null || _result$flag4 === void 0 ? void 0 : _result$flag4.retCode) === '0')) {
@@ -900,6 +900,11 @@ export var sleep = function sleep(secord) {
900
900
  export var downloadFile = function downloadFile(url, fileName) {
901
901
  var a = document.createElement('a');
902
902
  a.href = url;
903
+ // 如果导出域名有配置,则优先使用导出域名
904
+ var baseExportUrl = getCache('exportUrl') || '';
905
+ if (baseExportUrl && !url.startsWith('http')) {
906
+ a.href = baseExportUrl + url;
907
+ }
903
908
  // a.target = '_blank'; // 新开屏有闪烁
904
909
  if (fileName) {
905
910
  a.setAttribute('download', fileName);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ls-pro-common",
3
- "version": "3.0.84",
3
+ "version": "3.0.85",
4
4
  "description": "ls-pro-common",
5
5
  "license": "MIT",
6
6
  "sideEffects": [