n20-common-lib 2.7.52 → 2.7.54

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": "2.7.52",
3
+ "version": "2.7.54",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -9,7 +9,7 @@
9
9
  <el-button type="primary" size="mini" @click="addRow">{{ '新增' | $lc }}</el-button>
10
10
  </slot>
11
11
  <slot v-if="!readonly && showBatchUpload" name="batch-btn">
12
- <el-button size="mini" plain @click="visibleBatch = true">{{ '批量上传' | $lc }}</el-button>
12
+ <el-button size="mini" plain @click="handleBathUpload">{{ '批量上传' | $lc }}</el-button>
13
13
  </slot>
14
14
  <slot v-if="!readonly && showBatchPrint" name="batch-btn">
15
15
  <el-button size="mini" plain @click="batchPrint">{{ '批量打印' | $lc }}</el-button>
@@ -222,7 +222,17 @@
222
222
  :close-on-click-modal="false"
223
223
  :destroy-on-open="true"
224
224
  >
225
+ <el-select class="m-b-s" v-model="bathType" clearable @change="handleBathChange">
226
+ <el-option
227
+ v-for="item in typeOptions"
228
+ :key="item.type"
229
+ :disabled="item.disabled"
230
+ :value="item.type"
231
+ :label="item.label"
232
+ />
233
+ </el-select>
225
234
  <Upload
235
+ v-if="bathType"
226
236
  ref="upload-batch"
227
237
  class="n20-upload-drag"
228
238
  :msg-type="null"
@@ -236,7 +246,7 @@
236
246
  :headers="headers"
237
247
  :accept="fileAccept"
238
248
  :size="fileSize"
239
- :http-request="uploadHttpRequest"
249
+ :http-request="uploadHttpRequestBath"
240
250
  :before-upload="(file) => batchBeforeUploadFn(file)"
241
251
  :on-remove="batchRemove"
242
252
  :on-success="batchSuccess"
@@ -265,6 +275,8 @@ import { $lc } from '../../utils/i18n/index'
265
275
  import importG from '../../utils/importGlobal.js'
266
276
  import Dialog from '../Dialog/index.vue'
267
277
  import Upload from '../Upload/index.vue'
278
+ import auth from '../../utils/auth'
279
+ import _axios from 'axios'
268
280
 
269
281
  const ViewerImg = async function () {
270
282
  let { component } = await importG('v-viewer', () => import(/*webpackChunkName: "v-viewer"*/ 'v-viewer'))
@@ -398,6 +410,7 @@ export default {
398
410
  }
399
411
 
400
412
  return {
413
+ bathType:'',
401
414
  indexK: '$index',
402
415
  imgType: /\.(jpg|png|gif|svg)$/i,
403
416
  selectionList: [],
@@ -441,6 +454,9 @@ export default {
441
454
  ? `${this.apiPrefix}/neams/eamsBaseFile/getOfficeIsEnable`:`/neams/eamsBaseFile/getOfficeIsEnable`)
442
455
  this.officeStatus = data
443
456
  },
457
+ handleBathUpload() {
458
+ this.visibleBatch = true
459
+ },
444
460
  async batchPrint() {
445
461
  if (!this.selectionList.length) {
446
462
  return this.$message({
@@ -477,6 +493,11 @@ export default {
477
493
  let bu = this.$listeners['before-upload'] || this.$listeners['beforeUpload']
478
494
  if (bu) return bu(file)
479
495
  },
496
+ handleBathChange(){
497
+ let dto = JSON.parse(this.dataPorp.fileData.data)
498
+ dto[this.keys.type] = this.bathType
499
+ this.fileData.data = JSON.stringify(dto)
500
+ },
480
501
  batchUploadFn() {
481
502
  let $uploadwrap = this.$refs['upload-batch']
482
503
  let fileList = $uploadwrap.fileList
@@ -623,6 +644,50 @@ export default {
623
644
  this.visiblePv = false
624
645
  }, 300)
625
646
  },
647
+ uploadHttpRequestBath(opt) {
648
+ console.log(opt.data)
649
+ if (this.uploadHttpRequest) {
650
+ return this.uploadHttpRequest(opt)
651
+ } else {
652
+ let FD = new FormData()
653
+ FD.append(opt.filename, opt.file)
654
+
655
+ let data
656
+ if (window._fileData) {
657
+ data = window._fileData
658
+ delete window._fileData
659
+ } else {
660
+ data = opt.data
661
+ }
662
+
663
+ if (data) {
664
+ let dto = JSON.parse(data.data)
665
+ dto[this.keys.type] = this.bathType
666
+ data.data = JSON.stringify(dto)
667
+ for (let k in data) {
668
+ FD.append(k, data[k])
669
+ }
670
+ }
671
+
672
+ let abort
673
+ let Pro = axios.post(opt.action + '?r=' + Math.random(), FD, {
674
+ headers: Object.assign(auth.setHeaders(this.headers), { 'Content-Type': 'multipart/form-data' }),
675
+ loading: false,
676
+ onUploadProgress: (arg) => {
677
+ if (opt.onProgress) {
678
+ arg.percent = arg.progress * 100
679
+ opt.onProgress(arg)
680
+ }
681
+ },
682
+ cancelToken: new _axios.CancelToken((cancel) => {
683
+ abort = cancel
684
+ })
685
+ })
686
+ Pro.abort = abort
687
+ return Pro
688
+ }
689
+ console.log(opt)
690
+ },
626
691
  beforeUploadFn(file, row) {
627
692
  this.$set(row, '_percent', 0)
628
693
  this.$set(row, '_status', undefined)
@@ -637,6 +702,7 @@ export default {
637
702
  this.$set(row, '_typeDisabled', true)
638
703
  this.$set(row, '_name', file.name)
639
704
  this.$set(row, '_percent', 100)
705
+ this.$set(row,[this.keys.type],row[this.keys.type]||this.bathType)
640
706
  row[this.keys.time] = dayjs().format('YYYY-MM-DD HH:mm:ss')
641
707
 
642
708
  row[this.keys.url] = response.data
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file