diff --git a/src/views/modules/yieldReport/com_tid_upload_mt_log.vue b/src/views/modules/yieldReport/com_tid_upload_mt_log.vue index 646ac20..fe55012 100644 --- a/src/views/modules/yieldReport/com_tid_upload_mt_log.vue +++ b/src/views/modules/yieldReport/com_tid_upload_mt_log.vue @@ -94,23 +94,22 @@
MT日志文件(支持多选)
-
+
将文件拖到此处,或点击上传
-
可一次选择多个日志文件,保存时会逐个上传
+
可一次选择多个日志文件,也可分多次添加,保存时会逐个上传
@@ -120,7 +119,7 @@ 待上传文件 共 {{ uploadMtFileList.length }} 个 - + - + @@ -194,7 +193,6 @@ export default { uploadMtFileList: [], uploadResults: [], uploadFileUid: 1, - maxUploadFileCount: 20, maxUploadFileSize: 20 * 1024 * 1024, uploadRequestTimeoutMs: 1000 * 60 * 20, uploadProgress: { @@ -257,8 +255,8 @@ export default { this.leftTableHeight = nextLeftTableHeight let nextRightTableHeight = nextLayoutHeight - 370 - if (nextRightTableHeight < 120) { - nextRightTableHeight = 120 + if (nextRightTableHeight < 160) { + nextRightTableHeight = 160 } this.rightTableHeight = nextRightTableHeight }, @@ -416,12 +414,6 @@ export default { return String(status) === '1' ? 'success' : 'danger' }, - triggerMtFileSelect () { - if (this.$refs.mtFileInput) { - this.$refs.mtFileInput.click() - } - }, - handleMtFileInputChange (event) { const files = event && event.target && event.target.files ? Array.prototype.slice.call(event.target.files) @@ -448,25 +440,20 @@ export default { '.log': true, '.csv': true } + const nextList = this.uploadMtFileList.slice() const keyMap = {} - for (let i = 0; i < this.uploadMtFileList.length; i++) { - const item = this.uploadMtFileList[i] + for (let i = 0; i < nextList.length; i++) { + const item = nextList[i] const itemKey = [item.name || '', item.size || 0, item.lastModified || 0].join('|') keyMap[itemKey] = true } let invalidCount = 0 let duplicateCount = 0 - let overLimitCount = 0 let overSizeCount = 0 let addedCount = 0 for (let i = 0; i < files.length; i++) { const file = files[i] - const currentTotal = this.uploadMtFileList.length + addedCount - if (currentTotal >= this.maxUploadFileCount) { - overLimitCount++ - continue - } const lowerName = (file.name || '').toLowerCase() const ext = lowerName.lastIndexOf('.') > -1 ? lowerName.substring(lowerName.lastIndexOf('.')) : '' if (!allowedExtMap[ext]) { @@ -484,7 +471,7 @@ export default { } keyMap[fileKey] = true addedCount++ - this.uploadMtFileList.push({ + nextList.push({ uid: 'local_' + this.uploadFileUid++, name: file.name, size: file.size, @@ -493,6 +480,9 @@ export default { }) } + this.uploadMtFileList = nextList + this.layoutPendingFileTable() + if (invalidCount > 0) { this.$message.warning('仅支持 .txt/.log/.csv 文件,已忽略 ' + invalidCount + ' 个') } @@ -502,14 +492,20 @@ export default { if (overSizeCount > 0) { this.$message.warning('单个文件不能超过 20MB,已忽略 ' + overSizeCount + ' 个') } - if (overLimitCount > 0) { - this.$message.warning('最多可上传 20 个文件,已忽略 ' + overLimitCount + ' 个') - } if (addedCount > 0) { this.$message.success('已添加文件 ' + addedCount + ' 个') } }, + layoutPendingFileTable () { + this.$nextTick(() => { + const table = this.$refs.pendingFileTable + if (table && table.doLayout) { + table.doLayout() + } + }) + }, + removePendingUploadFile (index) { this.uploadMtFileList.splice(index, 1) }, @@ -578,10 +574,6 @@ export default { this.$message.warning('请先选择上传文件') return false } - if (this.uploadMtFileList.length > this.maxUploadFileCount) { - this.$message.warning('最多只能上传 20 个文件') - return false - } return true }, @@ -858,10 +850,19 @@ export default { } .upload-file-input { - display: none; + position: absolute; + top: 0; + left: 0; + z-index: 2; + width: 100%; + height: 100%; + opacity: 0; + cursor: pointer; + font-size: 0; } .upload-drop-zone { + position: relative; display: flex; flex-direction: column; align-items: center; @@ -925,6 +926,10 @@ export default { margin-top: 0; } +.selected-file-wrap /deep/ .el-table__body-wrapper { + overflow-y: auto; +} + .upload-result-wrap /deep/ .el-table td { padding-top: 2px !important; padding-bottom: 2px !important; diff --git a/src/views/modules/yieldReport/com_tid_upload_order.vue b/src/views/modules/yieldReport/com_tid_upload_order.vue index 2a7c24d..345cffb 100644 --- a/src/views/modules/yieldReport/com_tid_upload_order.vue +++ b/src/views/modules/yieldReport/com_tid_upload_order.vue @@ -124,23 +124,22 @@
订单日志文件(支持多选)
-
+
将文件拖到此处,或点击上传
-
可一次选择多个日志文件,保存时会逐个上传
+
可一次选择多个日志文件,也可分多次添加,保存时会逐个上传
@@ -150,7 +149,7 @@ 待上传文件 共 {{ uploadOrderFileList.length }} 个 - + - + @@ -236,7 +235,6 @@ export default { uploadOrderFileList: [], uploadResults: [], uploadFileUid: 1, - maxUploadFileCount: 20, maxUploadFileSize: 20 * 1024 * 1024, uploadRequestTimeoutMs: 1000 * 60 * 20, uploadProgress: { @@ -307,8 +305,8 @@ export default { this.leftTableHeight = nextLeftTableHeight let nextRightTableHeight = nextLayoutHeight - 370 - if (nextRightTableHeight < 120) { - nextRightTableHeight = 120 + if (nextRightTableHeight < 160) { + nextRightTableHeight = 160 } this.rightTableHeight = nextRightTableHeight }, @@ -538,12 +536,6 @@ export default { return String(status) === '1' ? 'success' : 'danger' }, - triggerOrderFileSelect () { - if (this.$refs.orderFileInput) { - this.$refs.orderFileInput.click() - } - }, - handleOrderFileInputChange (event) { const files = event && event.target && event.target.files ? Array.prototype.slice.call(event.target.files) @@ -570,25 +562,20 @@ export default { '.log': true, '.csv': true } + const nextList = this.uploadOrderFileList.slice() const keyMap = {} - for (let i = 0; i < this.uploadOrderFileList.length; i++) { - const item = this.uploadOrderFileList[i] + for (let i = 0; i < nextList.length; i++) { + const item = nextList[i] const itemKey = [item.name || '', item.size || 0, item.lastModified || 0].join('|') keyMap[itemKey] = true } let invalidCount = 0 let duplicateCount = 0 - let overLimitCount = 0 let overSizeCount = 0 let addedCount = 0 for (let i = 0; i < files.length; i++) { const file = files[i] - const currentTotal = this.uploadOrderFileList.length + addedCount - if (currentTotal >= this.maxUploadFileCount) { - overLimitCount++ - continue - } const lowerName = (file.name || '').toLowerCase() const ext = lowerName.lastIndexOf('.') > -1 ? lowerName.substring(lowerName.lastIndexOf('.')) : '' if (!allowedExtMap[ext]) { @@ -606,7 +593,7 @@ export default { } keyMap[fileKey] = true addedCount++ - this.uploadOrderFileList.push({ + nextList.push({ uid: 'local_' + this.uploadFileUid++, name: file.name, size: file.size, @@ -615,6 +602,9 @@ export default { }) } + this.uploadOrderFileList = nextList + this.layoutPendingFileTable() + if (invalidCount > 0) { this.$message.warning('仅支持 .txt/.log/.csv 文件,已忽略 ' + invalidCount + ' 个') } @@ -624,14 +614,20 @@ export default { if (overSizeCount > 0) { this.$message.warning('单个文件不能超过 20MB,已忽略 ' + overSizeCount + ' 个') } - if (overLimitCount > 0) { - this.$message.warning('最多可上传 20 个文件,已忽略 ' + overLimitCount + ' 个') - } if (addedCount > 0) { this.$message.success('已添加文件 ' + addedCount + ' 个') } }, + layoutPendingFileTable () { + this.$nextTick(() => { + const table = this.$refs.pendingFileTable + if (table && table.doLayout) { + table.doLayout() + } + }) + }, + removePendingUploadFile (index) { this.uploadOrderFileList.splice(index, 1) }, @@ -695,10 +691,6 @@ export default { this.$message.warning('请先选择上传文件') return false } - if (this.uploadOrderFileList.length > this.maxUploadFileCount) { - this.$message.warning('最多只能上传 20 个文件') - return false - } return true }, @@ -986,10 +978,19 @@ export default { } .upload-file-input { - display: none; + position: absolute; + top: 0; + left: 0; + z-index: 2; + width: 100%; + height: 100%; + opacity: 0; + cursor: pointer; + font-size: 0; } .upload-drop-zone { + position: relative; display: flex; flex-direction: column; align-items: center; @@ -1053,6 +1054,10 @@ export default { margin-top: 0; } +.selected-file-wrap /deep/ .el-table__body-wrapper { + overflow-y: auto; +} + .upload-result-wrap /deep/ .el-table td { padding-top: 2px !important; padding-bottom: 2px !important;