@newview/file-ui 1.1.38 → 1.1.39
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/file-ui.js +17 -7
- package/dist/file-ui.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/file-ui.js
CHANGED
|
@@ -633,10 +633,14 @@ let UploadFileInstance$1 = class UploadFileInstance extends BaseInstance {
|
|
|
633
633
|
let fileMark = this.utilities.getCurrentDate("YYYYMMDDHHmmss") + "." + ext;
|
|
634
634
|
let ossClient = await new OSSFileApi().getOSSClient();
|
|
635
635
|
const userInfo = this.storageInfo.getUser();
|
|
636
|
+
const business = this.storageInfo.getCurrentBusiness();
|
|
636
637
|
const module = this.storageInfo.getCurrentModule();
|
|
637
638
|
const platform = this.storageInfo.getCurrentPlatform();
|
|
638
|
-
let
|
|
639
|
-
let
|
|
639
|
+
let businessName = business ? business == null ? void 0 : business.ModuleAlias : "非业务";
|
|
640
|
+
let moduleName = module ? module == null ? void 0 : module.ModuleAlias : "非业务";
|
|
641
|
+
let moduleName2 = businessName + "/" + moduleName;
|
|
642
|
+
let FileCabinePath = (platform == null ? void 0 : platform.OssRootPath) + "/" + moduleName2 + "/";
|
|
643
|
+
let newFileName = `${FileCabinePath}${this.props.catalog}/${this.currentToken}/${fileMark}`;
|
|
640
644
|
const result = await ossClient.multipartUpload(newFileName, file, {
|
|
641
645
|
async progress(p) {
|
|
642
646
|
_this.uploadingPercent.value = (p * 100).toFixed(0);
|
|
@@ -646,7 +650,7 @@ let UploadFileInstance$1 = class UploadFileInstance extends BaseInstance {
|
|
|
646
650
|
if (result.res.statusCode === 200) {
|
|
647
651
|
let fileInfo = {
|
|
648
652
|
"FileCabinetId": (module == null ? void 0 : module.Id) ? module == null ? void 0 : module.Id : 0,
|
|
649
|
-
"FileCabinePath":
|
|
653
|
+
"FileCabinePath": FileCabinePath,
|
|
650
654
|
"Catalog": this.props.catalog,
|
|
651
655
|
"Token": this.currentToken,
|
|
652
656
|
"GroupName": this.activeGroupName.value,
|
|
@@ -660,10 +664,16 @@ let UploadFileInstance$1 = class UploadFileInstance extends BaseInstance {
|
|
|
660
664
|
"CreateTime": this.utilities.getCurrentDate(),
|
|
661
665
|
"Id": 0
|
|
662
666
|
};
|
|
663
|
-
await this.fileInfoApi.save(fileInfo);
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
+
let infoSaveRes = this.utilities.parseApiResult(await this.fileInfoApi.save(fileInfo));
|
|
668
|
+
if (infoSaveRes) {
|
|
669
|
+
this.message.success("上传成功!");
|
|
670
|
+
this.ctx.emit("success", { token: this.currentToken, fileId: infoSaveRes });
|
|
671
|
+
this.loadFileList(true);
|
|
672
|
+
this.uploadingPercent.value = 100;
|
|
673
|
+
} else {
|
|
674
|
+
this.message.error("网络出现异常,再次上传");
|
|
675
|
+
this.uploadingPercent.value = 0;
|
|
676
|
+
}
|
|
667
677
|
} else {
|
|
668
678
|
this.message.error("网络出现异常,再次上传");
|
|
669
679
|
this.uploadingPercent.value = 0;
|