zmdms-utils 0.0.68 → 0.0.70
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/es/baseUrl.js +2 -2
- package/dist/es/file.js +2 -2
- package/dist/es/math.d.ts +1 -1
- package/dist/es/math.js +3 -2
- package/package.json +1 -1
- package/src/baseUrl.ts +2 -2
- package/src/file.ts +2 -2
- package/src/math.ts +2 -2
package/dist/es/baseUrl.js
CHANGED
|
@@ -4,7 +4,7 @@ function getBaseUrl(processObj, options) {
|
|
|
4
4
|
var ENV = processObj[envKey]; // 获取当前环境变量
|
|
5
5
|
// api各个环境地址
|
|
6
6
|
var apiBaseUrlObj = {
|
|
7
|
-
dev: processObj["".concat(apiKey, "_DEV")] ||
|
|
7
|
+
dev: processObj["".concat(apiKey, "_DEV")] || window.location.origin,
|
|
8
8
|
test: processObj["".concat(apiKey, "_TEST")] || window.location.origin,
|
|
9
9
|
stage: processObj["".concat(apiKey, "_STAGE")] || window.location.origin,
|
|
10
10
|
prod: processObj["".concat(apiKey, "_PROD")] || window.location.origin,
|
|
@@ -18,7 +18,7 @@ function getBaseUrl(processObj, options) {
|
|
|
18
18
|
};
|
|
19
19
|
// file 服务器
|
|
20
20
|
var fileBaseUrlObj = {
|
|
21
|
-
dev: processObj["".concat(fileKey, "_DEV")] ||
|
|
21
|
+
dev: processObj["".concat(fileKey, "_DEV")] || window.location.origin,
|
|
22
22
|
test: processObj["".concat(fileKey, "_TEST")] || window.location.origin,
|
|
23
23
|
stage: processObj["".concat(fileKey, "_STAGE")] || window.location.origin,
|
|
24
24
|
prod: processObj["".concat(fileKey, "_PROD")] || window.location.origin,
|
package/dist/es/file.js
CHANGED
|
@@ -137,7 +137,7 @@ function previewFile(fileId, fileName, options) {
|
|
|
137
137
|
previewFileName = "".concat(filePreName, "-").concat(fileId, ".").concat(fileExtension);
|
|
138
138
|
if (!isZmdmsFileService) {
|
|
139
139
|
// 2023-12-30 修改成数字中心预览
|
|
140
|
-
window.open("".concat(apiBaseURL, "/api/cicoms-
|
|
140
|
+
window.open("".concat(apiBaseURL, "/api/cicoms-resource/attach/filePreview?attachId=").concat(fileId, "&").concat(TOKEN_KEY, "=").concat(token));
|
|
141
141
|
return;
|
|
142
142
|
}
|
|
143
143
|
// 如果是图片 走批量预览接口
|
|
@@ -290,7 +290,7 @@ function createOriginalLink(fileId, fileName, options) {
|
|
|
290
290
|
previewFileName = "".concat(filePreName, "-").concat(fileId, ".").concat(fileExtension);
|
|
291
291
|
// 2023-12-30 替换成数字中心的 预览接口
|
|
292
292
|
if (!isZmdmsFileService) {
|
|
293
|
-
return "".concat(apiBaseURL, "/api/cicoms-
|
|
293
|
+
return "".concat(apiBaseURL, "/api/cicoms-resource/attach/filePreview?attachId=").concat(fileId, "&").concat(TOKEN_KEY, "=").concat(token);
|
|
294
294
|
}
|
|
295
295
|
if (isZmdmsFileService) {
|
|
296
296
|
fileId = encodeFileId(fileId, 2);
|
package/dist/es/math.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ declare function times(num1: numType, num2: numType): number;
|
|
|
14
14
|
/**
|
|
15
15
|
* 除法
|
|
16
16
|
*/
|
|
17
|
-
declare function divide(num1: numType, num2: numType): number;
|
|
17
|
+
declare function divide(num1: numType, num2: numType, precision?: number): number;
|
|
18
18
|
/**
|
|
19
19
|
* 四舍五入保留小数
|
|
20
20
|
*/
|
package/dist/es/math.js
CHANGED
|
@@ -81,7 +81,8 @@ function times(num1, num2) {
|
|
|
81
81
|
/**
|
|
82
82
|
* 除法
|
|
83
83
|
*/
|
|
84
|
-
function divide(num1, num2) {
|
|
84
|
+
function divide(num1, num2, precision) {
|
|
85
|
+
if (precision === void 0) { precision = 5; }
|
|
85
86
|
try {
|
|
86
87
|
var _num1 = num1 == null ? NaN : Number(num1);
|
|
87
88
|
var _num2 = num2 == null ? NaN : Number(num2);
|
|
@@ -90,7 +91,7 @@ function divide(num1, num2) {
|
|
|
90
91
|
if (typeof result === "number") {
|
|
91
92
|
return result;
|
|
92
93
|
}
|
|
93
|
-
Decimal.set({ precision:
|
|
94
|
+
Decimal.set({ precision: precision });
|
|
94
95
|
return new Decimal(_num1).div(_num2).toNumber();
|
|
95
96
|
// return (isNaN(_num1) ? 0 : _num1) / (isNaN(_num2) ? 0 : _num2);
|
|
96
97
|
}
|
package/package.json
CHANGED
package/src/baseUrl.ts
CHANGED
|
@@ -28,7 +28,7 @@ export function getBaseUrl(processObj: any, options?: IOptions) {
|
|
|
28
28
|
|
|
29
29
|
// api各个环境地址
|
|
30
30
|
const apiBaseUrlObj: any = {
|
|
31
|
-
dev: processObj[`${apiKey}_DEV`] ||
|
|
31
|
+
dev: processObj[`${apiKey}_DEV`] || window.location.origin,
|
|
32
32
|
test: processObj[`${apiKey}_TEST`] || window.location.origin,
|
|
33
33
|
stage: processObj[`${apiKey}_STAGE`] || window.location.origin,
|
|
34
34
|
prod: processObj[`${apiKey}_PROD`] || window.location.origin,
|
|
@@ -44,7 +44,7 @@ export function getBaseUrl(processObj: any, options?: IOptions) {
|
|
|
44
44
|
|
|
45
45
|
// file 服务器
|
|
46
46
|
const fileBaseUrlObj: any = {
|
|
47
|
-
dev: processObj[`${fileKey}_DEV`] ||
|
|
47
|
+
dev: processObj[`${fileKey}_DEV`] || window.location.origin,
|
|
48
48
|
test: processObj[`${fileKey}_TEST`] || window.location.origin,
|
|
49
49
|
stage: processObj[`${fileKey}_STAGE`] || window.location.origin,
|
|
50
50
|
prod: processObj[`${fileKey}_PROD`] || window.location.origin,
|
package/src/file.ts
CHANGED
|
@@ -190,7 +190,7 @@ export function previewFile(
|
|
|
190
190
|
if (!isZmdmsFileService) {
|
|
191
191
|
// 2023-12-30 修改成数字中心预览
|
|
192
192
|
window.open(
|
|
193
|
-
`${apiBaseURL}/api/cicoms-
|
|
193
|
+
`${apiBaseURL}/api/cicoms-resource/attach/filePreview?attachId=${fileId}&${TOKEN_KEY}=${token}`
|
|
194
194
|
);
|
|
195
195
|
return;
|
|
196
196
|
}
|
|
@@ -357,7 +357,7 @@ export function createOriginalLink(
|
|
|
357
357
|
previewFileName = `${filePreName}-${fileId}.${fileExtension}`;
|
|
358
358
|
// 2023-12-30 替换成数字中心的 预览接口
|
|
359
359
|
if (!isZmdmsFileService) {
|
|
360
|
-
return `${apiBaseURL}/api/cicoms-
|
|
360
|
+
return `${apiBaseURL}/api/cicoms-resource/attach/filePreview?attachId=${fileId}&${TOKEN_KEY}=${token}`;
|
|
361
361
|
}
|
|
362
362
|
if (isZmdmsFileService) {
|
|
363
363
|
fileId = encodeFileId(fileId, 2);
|
package/src/math.ts
CHANGED
|
@@ -82,7 +82,7 @@ export function times(num1: numType, num2: numType) {
|
|
|
82
82
|
/**
|
|
83
83
|
* 除法
|
|
84
84
|
*/
|
|
85
|
-
export function divide(num1: numType, num2: numType) {
|
|
85
|
+
export function divide(num1: numType, num2: numType, precision: number = 5) {
|
|
86
86
|
try {
|
|
87
87
|
const _num1 = num1 == null ? NaN : Number(num1);
|
|
88
88
|
const _num2 = num2 == null ? NaN : Number(num2);
|
|
@@ -91,7 +91,7 @@ export function divide(num1: numType, num2: numType) {
|
|
|
91
91
|
if (typeof result === "number") {
|
|
92
92
|
return result;
|
|
93
93
|
}
|
|
94
|
-
Decimal.set({ precision
|
|
94
|
+
Decimal.set({ precision });
|
|
95
95
|
return new Decimal(_num1).div(_num2).toNumber();
|
|
96
96
|
// return (isNaN(_num1) ? 0 : _num1) / (isNaN(_num2) ? 0 : _num2);
|
|
97
97
|
} catch (err) {
|