diff --git a/dangan-ui/src/api/dangan/collection.js b/dangan-ui/src/api/dangan/collection.js
index 29a6962..c88af37 100644
--- a/dangan-ui/src/api/dangan/collection.js
+++ b/dangan-ui/src/api/dangan/collection.js
@@ -8,7 +8,7 @@ export function collectSaves(data) {
'Content-Type': 'multipart/form-data',
repeatSubmit: false
},
- timeout: 100000000,
+ timeout: 120000,
method: 'post',
data: data
})
@@ -19,6 +19,7 @@ export function collectRecongnize(data) {
return request({
url: '/dangan/collect/recongnize',
method: 'post',
+ timeout: 180000,
data: data
})
}
diff --git a/dangan-ui/src/views/dangan/collection/index.vue b/dangan-ui/src/views/dangan/collection/index.vue
index 88c099c..c751509 100644
--- a/dangan-ui/src/views/dangan/collection/index.vue
+++ b/dangan-ui/src/views/dangan/collection/index.vue
@@ -90,7 +90,7 @@
-
将文件拖到此处,或点击上传
- 只能上传图片,且不超过100MB
+ 只能上传图片,且不超过{{ upload.fileSize }}MB
@@ -254,6 +254,7 @@ export default {
muName: undefined,
// 用户导入参数
upload: {
+ fileSize: 300, //MB
loading: false,
// 是否显示弹出层(用户导入)
open: false,
@@ -490,52 +491,82 @@ export default {
// 确认上传文件提交
submitFiles(type) {
if(type===1){
+
if(this.smwj.list.length>0){
const formData = new FormData();
+ let fileSize = 0;
this.smwj.list.forEach((item) => {
- formData.append('files', this.dataURLtoFile(item.base64Str, item.fileName));
- });
- const DaPicturesRecard = {}
- DaPicturesRecard.muId = this.dangAnNode.key;
- DaPicturesRecard.muPath = this.getAllLabels(this.dangAnNode);
- DaPicturesRecard.ywType = this.dangAnNode.data.ywType;
- DaPicturesRecard.wlsjId = this.smwj.wlsjNode.key;
- DaPicturesRecard.wlsjPath = this.getAllLabels(this.smwj.wlsjNode);
- formData.append('picRecard', new Blob([JSON.stringify(DaPicturesRecard)],{ type: 'application/json', }));
- this.smwj.loading = true;
- collectSaves(formData).then(response => {
- this.pictureRecard = response.data;
- this.smwj.open = false;
- this.smwj.loading = false;
- }).catch(err=>{
- this.smwj.loading = false;
+ item.file = this.dataURLtoFile(item.base64Str, item.fileName);
+ fileSize += item.file.size;
+ formData.append('files', item.file);
});
+
+ console.log(22222, fileSize/1024/1024);
+
+ // 文件最大限制
+ if(fileSize/1024/1024 < this.upload.fileSize){
+ const DaPicturesRecard = {}
+ DaPicturesRecard.muId = this.dangAnNode.key;
+ DaPicturesRecard.muPath = this.getAllLabels(this.dangAnNode);
+ DaPicturesRecard.ywType = this.dangAnNode.data.ywType;
+ DaPicturesRecard.wlsjId = this.smwj.wlsjNode.key;
+ DaPicturesRecard.wlsjPath = this.getAllLabels(this.smwj.wlsjNode);
+ formData.append('picRecard', new Blob([JSON.stringify(DaPicturesRecard)], {type: 'application/json',}));
+ this.smwj.loading = true;
+ collectSaves(formData).then(response => {
+ this.pictureRecard = response.data;
+ this.smwj.open = false;
+ this.smwj.loading = false;
+ }).catch(err => {
+ this.smwj.loading = false;
+ });
+ }else {
+ this.$alert(`上传文件大小不能超过 ${this.upload.fileSize} MB!`, `提示`, {
+ type: 'warning'
+ });
+ }
+
}else {
this.$alert(`请先开始扫描!`, `提示`, {
type: 'warning'
});
}
}else {
+
if(this.fileList.length>0){
const formData = new FormData();
+ let fileSize = 0;
this.fileList.forEach((file) => {
+ fileSize += file.size;
formData.append('files', file);
});
- const DaPicturesRecard = {}
- DaPicturesRecard.muId = this.dangAnNode.key;
- DaPicturesRecard.muPath = this.getAllLabels(this.dangAnNode);
- DaPicturesRecard.ywType = this.dangAnNode.data.ywType;
- DaPicturesRecard.wlsjId = this.upload.wlsjNode.key;
- DaPicturesRecard.wlsjPath = this.getAllLabels(this.upload.wlsjNode);
- formData.append('picRecard', new Blob([JSON.stringify(DaPicturesRecard)],{ type: 'application/json', }));
- this.upload.loading = true;
- collectSaves(formData).then(response => {
- this.pictureRecard = response.data;
- this.upload.open = false;
- this.upload.loading = false;
- }).catch(err=>{
- this.upload.loading = false;
- });
+
+ // 文件最大限制
+ if(fileSize/1024/1024 < this.upload.fileSize){
+
+ const DaPicturesRecard = {}
+ DaPicturesRecard.muId = this.dangAnNode.key;
+ DaPicturesRecard.muPath = this.getAllLabels(this.dangAnNode);
+ DaPicturesRecard.ywType = this.dangAnNode.data.ywType;
+ DaPicturesRecard.wlsjId = this.upload.wlsjNode.key;
+ DaPicturesRecard.wlsjPath = this.getAllLabels(this.upload.wlsjNode);
+ formData.append('picRecard', new Blob([JSON.stringify(DaPicturesRecard)], {type: 'application/json',}));
+ this.upload.loading = true;
+
+ collectSaves(formData).then(response => {
+ this.pictureRecard = response.data;
+ this.upload.open = false;
+ this.upload.loading = false;
+ }).catch(err => {
+ this.upload.loading = false;
+ });
+
+ }else {
+ this.$alert(`上传文件大小不能超过 ${this.upload.fileSize} MB!`, `提示`, {
+ type: 'warning'
+ });
+ }
+
}else {
this.$alert(`请先上传图片!`, `提示`, {
type: 'warning'
@@ -603,11 +634,21 @@ export default {
this.checkLength = arr.length;
if(arr.length>0){
+
+ const loading = this.$loading({
+ lock: true,
+ text: 'Loading',
+ spinner: 'el-icon-loading',
+ background: 'rgba(0, 0, 0, 0.7)'
+ });
+
collectRecongnize(arr).then(response => {
this.pictureRecard = [];
this.checkAll = false;
this.$modal.msgSuccess(response.msg);
+ loading.close();
}).catch((err)=>{
+ loading.close();
console.log(123,err);
if(err.taskId){
this.taskId = err.taskId;
@@ -688,21 +729,6 @@ export default {
border-radius: 10px;
overflow: hidden;
}
-.myProgress{
- position: fixed;
- top:0;
- left:0;
- z-index: 10000;
- width: 100%;
- height: 100%;
- background: rgba(0,0,0,0.7);
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- font-size: 20px;
- color: white;
-}
.sm_col{
display: flex;
justify-content: space-between;