n20-common-lib 3.2.20 → 3.2.22
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/package.json
CHANGED
|
@@ -268,7 +268,7 @@
|
|
|
268
268
|
:close-on-click-modal="false"
|
|
269
269
|
:destroy-on-open="true"
|
|
270
270
|
>
|
|
271
|
-
<el-select v-model="bathType" class="m-b-s" clearable @change="handleBathChange">
|
|
271
|
+
<el-select v-model="bathType" class="m-b-s w-100p" clearable @change="handleBathChange">
|
|
272
272
|
<el-option
|
|
273
273
|
v-for="item in typeOptions"
|
|
274
274
|
:key="item.type"
|
|
@@ -288,7 +288,7 @@
|
|
|
288
288
|
:multiple="true"
|
|
289
289
|
:show-file-list="true"
|
|
290
290
|
:action="apiPrefix ? apiPrefix + action : action"
|
|
291
|
-
:data="fileData"
|
|
291
|
+
:data="_batchFileData || fileData"
|
|
292
292
|
:headers="headers"
|
|
293
293
|
:accept="fileAccept"
|
|
294
294
|
:size="fileSize"
|
|
@@ -497,7 +497,9 @@ export default {
|
|
|
497
497
|
previewName: undefined,
|
|
498
498
|
previewSameOrg: false,
|
|
499
499
|
seeRow: {},
|
|
500
|
-
officeStatus: false
|
|
500
|
+
officeStatus: false,
|
|
501
|
+
// 批量上传使用的文件数据(避免直接修改计算属性)
|
|
502
|
+
_batchFileData: null
|
|
501
503
|
}
|
|
502
504
|
},
|
|
503
505
|
computed: {
|
|
@@ -741,20 +743,32 @@ export default {
|
|
|
741
743
|
if (bu) return bu(file)
|
|
742
744
|
},
|
|
743
745
|
handleBathChange() {
|
|
744
|
-
|
|
746
|
+
// 创建新的文件数据对象,避免直接修改计算属性
|
|
747
|
+
let fileData = this.fileData || {}
|
|
748
|
+
let dto = JSON.parse(fileData.data || '{}')
|
|
745
749
|
dto[this.keys.type] = this.bathType
|
|
746
|
-
this.
|
|
750
|
+
this._batchFileData = {
|
|
751
|
+
...fileData,
|
|
752
|
+
data: JSON.stringify(dto)
|
|
753
|
+
}
|
|
747
754
|
},
|
|
748
755
|
batchUploadFn() {
|
|
749
756
|
let $uploadwrap = this.$refs['upload-batch']
|
|
750
|
-
|
|
751
|
-
if (fileList.length !== 0 && fileList.every((f) => f.status === 'success')) {
|
|
752
|
-
this.visibleBatch = false
|
|
753
|
-
}
|
|
757
|
+
// 直接提交上传,关闭对话框的逻辑在 batchSuccess 回调中处理
|
|
754
758
|
$uploadwrap.submit()
|
|
755
759
|
},
|
|
756
760
|
batchSuccess(response, file, fileList) {
|
|
757
|
-
|
|
761
|
+
// 创建完整的行对象,初始化状态字段
|
|
762
|
+
let row = {
|
|
763
|
+
id: 'n' + Math.random(),
|
|
764
|
+
[this.keys.name]: '',
|
|
765
|
+
[this.keys.type]: this.bathType,
|
|
766
|
+
[this.keys.time]: '',
|
|
767
|
+
[this.keys.user]: JSON.parse(sessionStorage.getItem('userInfo')).uname,
|
|
768
|
+
_percent: 0,
|
|
769
|
+
_status: undefined,
|
|
770
|
+
_typeDisabled: false
|
|
771
|
+
}
|
|
758
772
|
this.tableData.splice(0, 0, row)
|
|
759
773
|
this.$nextTick(() => {
|
|
760
774
|
this.onSuccessFn(response, file, fileList, row)
|
|
@@ -901,13 +915,8 @@ export default {
|
|
|
901
915
|
let FD = new FormData()
|
|
902
916
|
FD.append(opt.filename, opt.file)
|
|
903
917
|
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
data = window._fileData
|
|
907
|
-
delete window._fileData
|
|
908
|
-
} else {
|
|
909
|
-
data = opt.data
|
|
910
|
-
}
|
|
918
|
+
// 优先使用 opt.data,其次使用 this.fileData,移除全局变量 window._fileData 的使用
|
|
919
|
+
let data = opt.data || this.fileData
|
|
911
920
|
|
|
912
921
|
if (data) {
|
|
913
922
|
let dto = JSON.parse(data.data)
|
|
@@ -981,7 +990,7 @@ export default {
|
|
|
981
990
|
_percent = 99
|
|
982
991
|
_status = 'error'
|
|
983
992
|
} else {
|
|
984
|
-
_percent =
|
|
993
|
+
_percent = 100
|
|
985
994
|
_status = 'success'
|
|
986
995
|
}
|
|
987
996
|
setTimeout(() => {
|