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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n20-common-lib",
3
- "version": "3.2.20",
3
+ "version": "3.2.22",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -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
- let dto = JSON.parse(this.dataPorp.fileData.data)
746
+ // 创建新的文件数据对象,避免直接修改计算属性
747
+ let fileData = this.fileData || {}
748
+ let dto = JSON.parse(fileData.data || '{}')
745
749
  dto[this.keys.type] = this.bathType
746
- this.fileData.data = JSON.stringify(dto)
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
- let fileList = $uploadwrap.fileList
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
- let row = { ...this.dataPorp.keys }
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
- let data
905
- if (window._fileData) {
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 = 99
993
+ _percent = 100
985
994
  _status = 'success'
986
995
  }
987
996
  setTimeout(() => {
@@ -265,7 +265,7 @@ export default {
265
265
  // 默认 false —— 完全向后兼容,业务方按页面粒度显式开启
266
266
  autoExpandWithValues: {
267
267
  type: Boolean,
268
- default: false
268
+ default: true
269
269
  },
270
270
  // 是否显示筛选按钮及筛选区域,为 false 时不显示筛选按钮、视图相关 UI,且不请求筛选相关接口
271
271
  isFilter: {