ls-pro-common 3.1.40 → 3.1.42
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/common.js +1 -1
- package/dist/common.min.js +1 -1
- package/es/components/ViewOffice.js +8 -1
- package/es/hooks/useDtl/index.js +17 -4
- package/es/hooks/useSingle/index.js +15 -3
- package/es/http/index.js +11 -15
- package/lib/components/ViewOffice.js +8 -1
- package/lib/hooks/useDtl/index.js +17 -4
- package/lib/hooks/useSingle/index.js +15 -3
- package/lib/http/index.js +11 -15
- package/package.json +1 -1
|
@@ -34,7 +34,14 @@ var ViewDocment = function ViewDocment(props) {
|
|
|
34
34
|
//外部文件比如,xxx/ddd.docx,兜底直接给个临时的,但好像有问题,因为后端不知道文件类型
|
|
35
35
|
filename = url.split('/').pop() || Date.now().toString(32);
|
|
36
36
|
}
|
|
37
|
-
var
|
|
37
|
+
var href = url;
|
|
38
|
+
if (!url.includes('token=')) {
|
|
39
|
+
href = href + (href.includes('?') ? '&' : '?') + 'token=' + token;
|
|
40
|
+
}
|
|
41
|
+
if (!href.includes('fullfilename=')) {
|
|
42
|
+
href = href + (href.includes('?') ? '&' : '?') + 'fullfilename=' + filename;
|
|
43
|
+
}
|
|
44
|
+
var doc = base64Encode(href);
|
|
38
45
|
// 如果是生产环境,走下载域名,其它环境走原来域名
|
|
39
46
|
var domain = '';
|
|
40
47
|
if (location.href.includes('.cloud/') && getCache('exportUrl')) {
|
package/es/hooks/useDtl/index.js
CHANGED
|
@@ -748,6 +748,7 @@ function useDtl(dtlParam) {
|
|
|
748
748
|
showWarn('请配置业务接口 bizApi 属性');
|
|
749
749
|
return _context10.abrupt("return", false);
|
|
750
750
|
case 6:
|
|
751
|
+
// 处理接口参数
|
|
751
752
|
if (param.searchData) {
|
|
752
753
|
searchArr = (param.searchData || '').split('&');
|
|
753
754
|
if (isV2) {
|
|
@@ -763,15 +764,16 @@ function useDtl(dtlParam) {
|
|
|
763
764
|
return item.replace('sort=', 'sort.').replace(' ', '=');
|
|
764
765
|
} else if (item.startsWith('ifPage=') || item.startsWith('ifHistory=') || item.startsWith('resCode=')) {
|
|
765
766
|
return item;
|
|
766
|
-
} else {
|
|
767
|
-
//其它查询条件,添加 search.
|
|
767
|
+
} else if (!item.startsWith('search.')) {
|
|
768
|
+
//其它查询条件,添加 search. 二次调用时不能多次添加。
|
|
768
769
|
return 'search.' + item;
|
|
769
770
|
}
|
|
771
|
+
return item;
|
|
770
772
|
});
|
|
771
773
|
param.searchData = arr.join('&');
|
|
772
774
|
} else {
|
|
773
775
|
otherArr = searchArr.filter(function (item) {
|
|
774
|
-
return item.startsWith('page=') || item.startsWith('pageSize=') || item.startsWith('ifPage=') || item.startsWith('ifHistory=') || item.startsWith('sort=') || item.startsWith('resCode=');
|
|
776
|
+
return item.startsWith('page=') || item.startsWith('pageSize=') || item.startsWith('ifPage=') || item.startsWith('ifHistory=') || item.startsWith('sort=') || item.startsWith('resCode=') || item.startsWith('lesoon-tenant=');
|
|
775
777
|
});
|
|
776
778
|
whereArr = searchArr.filter(function (item) {
|
|
777
779
|
return !otherArr.includes(item);
|
|
@@ -780,7 +782,18 @@ function useDtl(dtlParam) {
|
|
|
780
782
|
if (whereArr.length) {
|
|
781
783
|
whereArr.forEach(function (item) {
|
|
782
784
|
var itemArr = item.split('=');
|
|
783
|
-
|
|
785
|
+
if (itemArr[0] === 'where') {
|
|
786
|
+
try {
|
|
787
|
+
var obj = JSON.parse(itemArr[1]);
|
|
788
|
+
for (var key in obj) {
|
|
789
|
+
where[key] = obj[key];
|
|
790
|
+
}
|
|
791
|
+
} catch (e) {
|
|
792
|
+
console.log(e);
|
|
793
|
+
}
|
|
794
|
+
} else {
|
|
795
|
+
where[itemArr[0]] = itemArr[1];
|
|
796
|
+
}
|
|
784
797
|
});
|
|
785
798
|
otherArr.push('where=' + JSON.stringify(where));
|
|
786
799
|
param.searchData = otherArr.join('&');
|
|
@@ -561,15 +561,16 @@ function useSingle(inParam) {
|
|
|
561
561
|
return item.replace('sort=', 'sort.').replace(' ', '=');
|
|
562
562
|
} else if (item.startsWith('ifPage=') || item.startsWith('ifHistory=') || item.startsWith('resCode=')) {
|
|
563
563
|
return item;
|
|
564
|
-
} else {
|
|
564
|
+
} else if (!item.startsWith('search.')) {
|
|
565
565
|
//其它查询条件,添加 search.
|
|
566
566
|
return 'search.' + item;
|
|
567
567
|
}
|
|
568
|
+
return item;
|
|
568
569
|
});
|
|
569
570
|
param.searchData = arr.join('&');
|
|
570
571
|
} else {
|
|
571
572
|
otherArr = searchArr.filter(function (item) {
|
|
572
|
-
return item.startsWith('page=') || item.startsWith('pageSize=') || item.startsWith('ifPage=') || item.startsWith('ifHistory=') || item.startsWith('sort=') || item.startsWith('resCode=');
|
|
573
|
+
return item.startsWith('page=') || item.startsWith('pageSize=') || item.startsWith('ifPage=') || item.startsWith('ifHistory=') || item.startsWith('sort=') || item.startsWith('resCode=') || item.startsWith('lesoon-tenant=');
|
|
573
574
|
});
|
|
574
575
|
whereArr = searchArr.filter(function (item) {
|
|
575
576
|
return !otherArr.includes(item);
|
|
@@ -578,7 +579,18 @@ function useSingle(inParam) {
|
|
|
578
579
|
if (whereArr.length) {
|
|
579
580
|
whereArr.forEach(function (item) {
|
|
580
581
|
var itemArr = item.split('=');
|
|
581
|
-
|
|
582
|
+
if (itemArr[0] === 'where') {
|
|
583
|
+
try {
|
|
584
|
+
var obj = JSON.parse(itemArr[1]);
|
|
585
|
+
for (var key in obj) {
|
|
586
|
+
where[key] = obj[key];
|
|
587
|
+
}
|
|
588
|
+
} catch (e) {
|
|
589
|
+
console.log(e);
|
|
590
|
+
}
|
|
591
|
+
} else {
|
|
592
|
+
where[itemArr[0]] = itemArr[1];
|
|
593
|
+
}
|
|
582
594
|
});
|
|
583
595
|
otherArr.push('where=' + JSON.stringify(where));
|
|
584
596
|
param.searchData = otherArr.join('&');
|
package/es/http/index.js
CHANGED
|
@@ -267,27 +267,26 @@ function ajax(url) {
|
|
|
267
267
|
_loading: ''
|
|
268
268
|
}).replace('&_loading=', '').replace('_loading=', '');
|
|
269
269
|
}
|
|
270
|
+
var finallyFn = function finallyFn() {
|
|
271
|
+
if (loadText) {
|
|
272
|
+
exitLoading();
|
|
273
|
+
}
|
|
274
|
+
};
|
|
270
275
|
if (type === 'get') {
|
|
271
276
|
return request.get(url, {
|
|
272
277
|
params: params,
|
|
273
278
|
timeout: timeout
|
|
274
|
-
}).finally(
|
|
275
|
-
return exitLoading();
|
|
276
|
-
});
|
|
279
|
+
}).finally(finallyFn);
|
|
277
280
|
} else if (type === 'delete') {
|
|
278
281
|
return request.delete(url, {
|
|
279
282
|
data: params,
|
|
280
283
|
timeout: timeout
|
|
281
|
-
}).finally(
|
|
282
|
-
return exitLoading();
|
|
283
|
-
});
|
|
284
|
+
}).finally(finallyFn);
|
|
284
285
|
} else if (type === 'put') {
|
|
285
286
|
return request.put(url, {
|
|
286
287
|
data: params,
|
|
287
288
|
timeout: timeout
|
|
288
|
-
}).finally(
|
|
289
|
-
return exitLoading();
|
|
290
|
-
});
|
|
289
|
+
}).finally(finallyFn);
|
|
291
290
|
} else {
|
|
292
291
|
// 如果sumProperties存在,则添加sumProperties参数到url中
|
|
293
292
|
if (params.sumProperties && typeof params.sumProperties === 'string') {
|
|
@@ -295,15 +294,12 @@ function ajax(url) {
|
|
|
295
294
|
sumProperties: params.sumProperties
|
|
296
295
|
});
|
|
297
296
|
}
|
|
297
|
+
var requestType = isJson ? 'json' : 'form';
|
|
298
298
|
return request.post(url, {
|
|
299
299
|
data: params,
|
|
300
300
|
timeout: timeout,
|
|
301
|
-
requestType:
|
|
302
|
-
}).finally(
|
|
303
|
-
if (loadText) {
|
|
304
|
-
exitLoading();
|
|
305
|
-
}
|
|
306
|
-
});
|
|
301
|
+
requestType: requestType
|
|
302
|
+
}).finally(finallyFn);
|
|
307
303
|
}
|
|
308
304
|
}
|
|
309
305
|
/**
|
|
@@ -34,7 +34,14 @@ var ViewDocment = function ViewDocment(props) {
|
|
|
34
34
|
//外部文件比如,xxx/ddd.docx,兜底直接给个临时的,但好像有问题,因为后端不知道文件类型
|
|
35
35
|
filename = url.split('/').pop() || Date.now().toString(32);
|
|
36
36
|
}
|
|
37
|
-
var
|
|
37
|
+
var href = url;
|
|
38
|
+
if (!url.includes('token=')) {
|
|
39
|
+
href = href + (href.includes('?') ? '&' : '?') + 'token=' + token;
|
|
40
|
+
}
|
|
41
|
+
if (!href.includes('fullfilename=')) {
|
|
42
|
+
href = href + (href.includes('?') ? '&' : '?') + 'fullfilename=' + filename;
|
|
43
|
+
}
|
|
44
|
+
var doc = base64Encode(href);
|
|
38
45
|
// 如果是生产环境,走下载域名,其它环境走原来域名
|
|
39
46
|
var domain = '';
|
|
40
47
|
if (location.href.includes('.cloud/') && getCache('exportUrl')) {
|
|
@@ -748,6 +748,7 @@ function useDtl(dtlParam) {
|
|
|
748
748
|
showWarn('请配置业务接口 bizApi 属性');
|
|
749
749
|
return _context10.abrupt("return", false);
|
|
750
750
|
case 6:
|
|
751
|
+
// 处理接口参数
|
|
751
752
|
if (param.searchData) {
|
|
752
753
|
searchArr = (param.searchData || '').split('&');
|
|
753
754
|
if (isV2) {
|
|
@@ -763,15 +764,16 @@ function useDtl(dtlParam) {
|
|
|
763
764
|
return item.replace('sort=', 'sort.').replace(' ', '=');
|
|
764
765
|
} else if (item.startsWith('ifPage=') || item.startsWith('ifHistory=') || item.startsWith('resCode=')) {
|
|
765
766
|
return item;
|
|
766
|
-
} else {
|
|
767
|
-
//其它查询条件,添加 search.
|
|
767
|
+
} else if (!item.startsWith('search.')) {
|
|
768
|
+
//其它查询条件,添加 search. 二次调用时不能多次添加。
|
|
768
769
|
return 'search.' + item;
|
|
769
770
|
}
|
|
771
|
+
return item;
|
|
770
772
|
});
|
|
771
773
|
param.searchData = arr.join('&');
|
|
772
774
|
} else {
|
|
773
775
|
otherArr = searchArr.filter(function (item) {
|
|
774
|
-
return item.startsWith('page=') || item.startsWith('pageSize=') || item.startsWith('ifPage=') || item.startsWith('ifHistory=') || item.startsWith('sort=') || item.startsWith('resCode=');
|
|
776
|
+
return item.startsWith('page=') || item.startsWith('pageSize=') || item.startsWith('ifPage=') || item.startsWith('ifHistory=') || item.startsWith('sort=') || item.startsWith('resCode=') || item.startsWith('lesoon-tenant=');
|
|
775
777
|
});
|
|
776
778
|
whereArr = searchArr.filter(function (item) {
|
|
777
779
|
return !otherArr.includes(item);
|
|
@@ -780,7 +782,18 @@ function useDtl(dtlParam) {
|
|
|
780
782
|
if (whereArr.length) {
|
|
781
783
|
whereArr.forEach(function (item) {
|
|
782
784
|
var itemArr = item.split('=');
|
|
783
|
-
|
|
785
|
+
if (itemArr[0] === 'where') {
|
|
786
|
+
try {
|
|
787
|
+
var obj = JSON.parse(itemArr[1]);
|
|
788
|
+
for (var key in obj) {
|
|
789
|
+
where[key] = obj[key];
|
|
790
|
+
}
|
|
791
|
+
} catch (e) {
|
|
792
|
+
console.log(e);
|
|
793
|
+
}
|
|
794
|
+
} else {
|
|
795
|
+
where[itemArr[0]] = itemArr[1];
|
|
796
|
+
}
|
|
784
797
|
});
|
|
785
798
|
otherArr.push('where=' + JSON.stringify(where));
|
|
786
799
|
param.searchData = otherArr.join('&');
|
|
@@ -561,15 +561,16 @@ function useSingle(inParam) {
|
|
|
561
561
|
return item.replace('sort=', 'sort.').replace(' ', '=');
|
|
562
562
|
} else if (item.startsWith('ifPage=') || item.startsWith('ifHistory=') || item.startsWith('resCode=')) {
|
|
563
563
|
return item;
|
|
564
|
-
} else {
|
|
564
|
+
} else if (!item.startsWith('search.')) {
|
|
565
565
|
//其它查询条件,添加 search.
|
|
566
566
|
return 'search.' + item;
|
|
567
567
|
}
|
|
568
|
+
return item;
|
|
568
569
|
});
|
|
569
570
|
param.searchData = arr.join('&');
|
|
570
571
|
} else {
|
|
571
572
|
otherArr = searchArr.filter(function (item) {
|
|
572
|
-
return item.startsWith('page=') || item.startsWith('pageSize=') || item.startsWith('ifPage=') || item.startsWith('ifHistory=') || item.startsWith('sort=') || item.startsWith('resCode=');
|
|
573
|
+
return item.startsWith('page=') || item.startsWith('pageSize=') || item.startsWith('ifPage=') || item.startsWith('ifHistory=') || item.startsWith('sort=') || item.startsWith('resCode=') || item.startsWith('lesoon-tenant=');
|
|
573
574
|
});
|
|
574
575
|
whereArr = searchArr.filter(function (item) {
|
|
575
576
|
return !otherArr.includes(item);
|
|
@@ -578,7 +579,18 @@ function useSingle(inParam) {
|
|
|
578
579
|
if (whereArr.length) {
|
|
579
580
|
whereArr.forEach(function (item) {
|
|
580
581
|
var itemArr = item.split('=');
|
|
581
|
-
|
|
582
|
+
if (itemArr[0] === 'where') {
|
|
583
|
+
try {
|
|
584
|
+
var obj = JSON.parse(itemArr[1]);
|
|
585
|
+
for (var key in obj) {
|
|
586
|
+
where[key] = obj[key];
|
|
587
|
+
}
|
|
588
|
+
} catch (e) {
|
|
589
|
+
console.log(e);
|
|
590
|
+
}
|
|
591
|
+
} else {
|
|
592
|
+
where[itemArr[0]] = itemArr[1];
|
|
593
|
+
}
|
|
582
594
|
});
|
|
583
595
|
otherArr.push('where=' + JSON.stringify(where));
|
|
584
596
|
param.searchData = otherArr.join('&');
|
package/lib/http/index.js
CHANGED
|
@@ -267,27 +267,26 @@ function ajax(url) {
|
|
|
267
267
|
_loading: ''
|
|
268
268
|
}).replace('&_loading=', '').replace('_loading=', '');
|
|
269
269
|
}
|
|
270
|
+
var finallyFn = function finallyFn() {
|
|
271
|
+
if (loadText) {
|
|
272
|
+
exitLoading();
|
|
273
|
+
}
|
|
274
|
+
};
|
|
270
275
|
if (type === 'get') {
|
|
271
276
|
return request.get(url, {
|
|
272
277
|
params: params,
|
|
273
278
|
timeout: timeout
|
|
274
|
-
}).finally(
|
|
275
|
-
return exitLoading();
|
|
276
|
-
});
|
|
279
|
+
}).finally(finallyFn);
|
|
277
280
|
} else if (type === 'delete') {
|
|
278
281
|
return request.delete(url, {
|
|
279
282
|
data: params,
|
|
280
283
|
timeout: timeout
|
|
281
|
-
}).finally(
|
|
282
|
-
return exitLoading();
|
|
283
|
-
});
|
|
284
|
+
}).finally(finallyFn);
|
|
284
285
|
} else if (type === 'put') {
|
|
285
286
|
return request.put(url, {
|
|
286
287
|
data: params,
|
|
287
288
|
timeout: timeout
|
|
288
|
-
}).finally(
|
|
289
|
-
return exitLoading();
|
|
290
|
-
});
|
|
289
|
+
}).finally(finallyFn);
|
|
291
290
|
} else {
|
|
292
291
|
// 如果sumProperties存在,则添加sumProperties参数到url中
|
|
293
292
|
if (params.sumProperties && typeof params.sumProperties === 'string') {
|
|
@@ -295,15 +294,12 @@ function ajax(url) {
|
|
|
295
294
|
sumProperties: params.sumProperties
|
|
296
295
|
});
|
|
297
296
|
}
|
|
297
|
+
var requestType = isJson ? 'json' : 'form';
|
|
298
298
|
return request.post(url, {
|
|
299
299
|
data: params,
|
|
300
300
|
timeout: timeout,
|
|
301
|
-
requestType:
|
|
302
|
-
}).finally(
|
|
303
|
-
if (loadText) {
|
|
304
|
-
exitLoading();
|
|
305
|
-
}
|
|
306
|
-
});
|
|
301
|
+
requestType: requestType
|
|
302
|
+
}).finally(finallyFn);
|
|
307
303
|
}
|
|
308
304
|
}
|
|
309
305
|
/**
|