n20-common-lib 3.3.3 → 3.3.4
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
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
:action="apiPrefix ? apiPrefix + action : action"
|
|
114
114
|
:multiple="multiple"
|
|
115
115
|
:headers="headers"
|
|
116
|
-
:disabled="
|
|
116
|
+
:disabled="row._typeDisabled || row._uploadDisabled"
|
|
117
117
|
:accept="row[keys.type] | acceptFilter(typeOptions, fileAccept)"
|
|
118
118
|
:size="row[keys.type] | sizeFilter(typeOptions, fileSize)"
|
|
119
119
|
:http-request="uploadHttpRequest ? (options) => uploadHttpRequest(options, row) : undefined"
|
|
@@ -960,6 +960,10 @@ export default {
|
|
|
960
960
|
if (!type || row._originalType === type) {
|
|
961
961
|
return
|
|
962
962
|
}
|
|
963
|
+
// 未上传的临时行没有后端附件 ID,只保留本地类型选择,不调用更新接口。
|
|
964
|
+
if (!row.beid) {
|
|
965
|
+
return
|
|
966
|
+
}
|
|
963
967
|
// 未识别类型的行手动选中类型后,删除该类型对应的占位行
|
|
964
968
|
if (!row._originalType) {
|
|
965
969
|
let placeholderIndex = this.tableData.findIndex(
|
|
@@ -1232,6 +1236,11 @@ export default {
|
|
|
1232
1236
|
}
|
|
1233
1237
|
},
|
|
1234
1238
|
beforeUploadFn(file, row) {
|
|
1239
|
+
if (!row[this.keys.type]) {
|
|
1240
|
+
this.$message.warning($lc('请先选择附件类型'))
|
|
1241
|
+
return false
|
|
1242
|
+
}
|
|
1243
|
+
|
|
1235
1244
|
this.$set(row, '_percent', 0)
|
|
1236
1245
|
this.$set(row, '_status', undefined)
|
|
1237
1246
|
|
|
@@ -1243,7 +1252,7 @@ export default {
|
|
|
1243
1252
|
this.$set(row, '_percent', percent <= 99 ? Math.round(percent) : 99)
|
|
1244
1253
|
},
|
|
1245
1254
|
onSuccessFn(response, file, fileList, row) {
|
|
1246
|
-
this.$set(row, '_typeDisabled',
|
|
1255
|
+
this.$set(row, '_typeDisabled', false)
|
|
1247
1256
|
this.$set(row, '_name', file.name)
|
|
1248
1257
|
|
|
1249
1258
|
this.$set(row, [this.keys.rowKey], response.data)
|
|
@@ -1259,6 +1268,42 @@ export default {
|
|
|
1259
1268
|
row[this.keys.url] = response.data
|
|
1260
1269
|
row[this.keys.name] = file.name
|
|
1261
1270
|
|
|
1271
|
+
// 从上传参数中提取后续 updateFlieBuss 需要的业务字段,合并到行上,
|
|
1272
|
+
// 避免上传后修改附件类型时因 row 缺字段导致后端报“参数缺失”
|
|
1273
|
+
let fileDataObj = row['_fileData'] || this.fileData
|
|
1274
|
+
if (fileDataObj) {
|
|
1275
|
+
let dto = {}
|
|
1276
|
+
try {
|
|
1277
|
+
dto = JSON.parse(fileDataObj.data || '{}') || {}
|
|
1278
|
+
} catch (e) {
|
|
1279
|
+
dto = {}
|
|
1280
|
+
}
|
|
1281
|
+
;['syscode', 'appno', 'bussId', 'bussValue', 'bussName', 'reid', 'fmid'].forEach((k) => {
|
|
1282
|
+
if (dto[k] !== undefined && row[k] === undefined) {
|
|
1283
|
+
this.$set(row, k, dto[k])
|
|
1284
|
+
}
|
|
1285
|
+
})
|
|
1286
|
+
if (fileDataObj.bussId !== undefined && row.bussId === undefined) {
|
|
1287
|
+
this.$set(row, 'bussId', fileDataObj.bussId)
|
|
1288
|
+
}
|
|
1289
|
+
}
|
|
1290
|
+
let currType = row[this.keys.type] || this.bathType
|
|
1291
|
+
let currTypeOption = this.typeOptions.find((item) => item.type === currType)
|
|
1292
|
+
let currTypeName = currTypeOption?.attname || currTypeOption?.label || ''
|
|
1293
|
+
this.$set(row, 'beid', response.data)
|
|
1294
|
+
this.$set(row, 'filePath', row.filePath || response.data)
|
|
1295
|
+
this.$set(row, 'fileName', file.name)
|
|
1296
|
+
this.$set(row, 'attno', currType)
|
|
1297
|
+
this.$set(row, 'attname', currTypeName)
|
|
1298
|
+
if (currTypeOption?.bussValue !== undefined && row.bussValue === undefined) {
|
|
1299
|
+
this.$set(row, 'bussValue', currTypeOption.bussValue)
|
|
1300
|
+
}
|
|
1301
|
+
// 标记为“已存在后端”的行,使 handleTypeChange 可正常进入 updateFileBuss
|
|
1302
|
+
this.$set(row, '_originalType', currType || '')
|
|
1303
|
+
this.$set(row, '_lastFileType', currType)
|
|
1304
|
+
this.$set(row, '_lastFileTypeName', currTypeName)
|
|
1305
|
+
this.$set(row, '_lastBussValue', row.bussValue)
|
|
1306
|
+
|
|
1262
1307
|
this.$emit('on-success', file, row)
|
|
1263
1308
|
},
|
|
1264
1309
|
MultipleSUccessFn(response, file, fileList, row) {
|
|
@@ -1286,7 +1331,7 @@ export default {
|
|
|
1286
1331
|
[this.keys.url]: response.data,
|
|
1287
1332
|
[this.keys.name]: file.name,
|
|
1288
1333
|
_status,
|
|
1289
|
-
_typeDisabled:
|
|
1334
|
+
_typeDisabled: false,
|
|
1290
1335
|
[this.keys.user]: deepRow[this.keys.user],
|
|
1291
1336
|
[this.keys.type]: deepRow[this.keys.type]
|
|
1292
1337
|
})
|