n20-common-lib 2.19.2 → 2.19.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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n20-common-lib",
3
- "version": "2.19.2",
3
+ "version": "2.19.4",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -10,9 +10,10 @@
10
10
  <script>
11
11
  export default {
12
12
  name: 'Descriptions',
13
- data() {
14
- return {
15
- column: 2
13
+ props: {
14
+ column: {
15
+ type: Number,
16
+ default: 2
16
17
  }
17
18
  },
18
19
  created() {
@@ -34,6 +35,9 @@ export default {
34
35
  } else if (wW > 1920) {
35
36
  this.column = 4
36
37
  }
38
+ },
39
+ destroyResize() {
40
+ window.removeEventListener('resize', this.resize)
37
41
  }
38
42
  }
39
43
  }
@@ -10,10 +10,7 @@
10
10
  :close-on-click-modal="false"
11
11
  @close="closeSee"
12
12
  >
13
- <span class="file-upload-table_preview-pn">
14
- <el-button round onlyicon plain size="mini" icon="el-icon-back" @click="$emit('preSee')" />
15
- <el-button round onlyicon plain size="mini" icon="el-icon-right" @click="$emit('nextSee')" />
16
- </span>
13
+ <span class="file-upload-table_preview-pn"> </span>
17
14
  <div v-if="visiblePv" class="p-a" style="height: 82vh">
18
15
  <!-- <ViewerImg v-if="imgType.test(previewName)" :options="viewerOptions" style="height: 100%">
19
16
  <img :src="previewUrl" :alt="previewName" style="display: none" />
@@ -22,7 +19,7 @@
22
19
  :is="previewSameOrg ? 'object' : 'div'"
23
20
  :key="previewUrl"
24
21
  :data="previewUrl"
25
- style="width: 100%; height: 100%"
22
+ style="width: 100%; height: calc(100% - 30px)"
26
23
  >
27
24
  <div class="flex-column flex-c flex-v" style="height: 100%">
28
25
  <i class="el-icon-s-release" style="font-size: 60px; color: #999"></i>
@@ -38,6 +35,11 @@
38
35
  </span>
39
36
  </div>
40
37
  </component>
38
+ <div class="flex-box flex-c flex-v m-t-s">
39
+ <el-button round onlyicon plain size="mini" icon="el-icon-back" @click="preSee" />
40
+ <span v-if="fileList.length > 0" class="m-l-s m-r-s">{{ index + 1 }}/{{ fileList.length }}</span>
41
+ <el-button round onlyicon plain size="mini" icon="el-icon-right" @click="nextSee" />
42
+ </div>
41
43
  </div>
42
44
  </Dialog>
43
45
  </template>
@@ -62,6 +64,12 @@ export default {
62
64
  visible: {
63
65
  type: Boolean,
64
66
  default: false
67
+ },
68
+ fileList: {
69
+ type: Array,
70
+ default: () => {
71
+ return []
72
+ }
65
73
  }
66
74
  // seeRow: {
67
75
  // type: Object,
@@ -99,24 +107,56 @@ export default {
99
107
  previewName: undefined,
100
108
  previewSameOrg: false,
101
109
  visiblePv: false,
102
- visiblePvT: null
103
- }
104
- },
105
- computed: {
106
- visibleP: {
107
- get() {
108
- return this.visible
109
- },
110
- set(val) {
111
- this.$emit('update:visible', val)
112
- }
110
+ visiblePvT: null,
111
+ visibleP: false,
112
+ index: 0
113
113
  }
114
114
  },
115
115
 
116
116
  methods: {
117
+ async preSee() {
118
+ if (this.fileList.length > 0) {
119
+ if (this.index === 0) {
120
+ this.index = this.fileList.length - 1
121
+ } else {
122
+ this.index--
123
+ }
124
+ const { url, name, sameOrg } = await this.getFileInfo(this.fileList[this.index])
125
+ if (url) {
126
+ this.previewSameOrg = sameOrg
127
+ this.previewUrl = url
128
+ this.previewName = name
129
+ }
130
+ } else {
131
+ this.$emit('preSee')
132
+ }
133
+ },
134
+ async nextSee() {
135
+ if (this.fileList.length > 0) {
136
+ if (this.index === this.fileList.length - 1) {
137
+ this.index = 0
138
+ } else {
139
+ this.index++
140
+ }
141
+ const { url, name, sameOrg } = await this.getFileInfo(this.fileList[this.index])
142
+ if (url) {
143
+ this.previewSameOrg = sameOrg
144
+ this.previewUrl = url
145
+ this.previewName = name
146
+ }
147
+ } else {
148
+ this.$emit('nextSee')
149
+ }
150
+ },
151
+
117
152
  async fileShow(id, fileName = '') {
153
+ let selectid = id
154
+ this.index = 0
155
+ if (this.fileList.length > 0) {
156
+ selectid = this.fileList[this.index]
157
+ }
118
158
  this.name = fileName
119
- const { url, name, sameOrg } = await this.getFileInfo(id)
159
+ const { url, name, sameOrg } = await this.getFileInfo(selectid)
120
160
  if (url) {
121
161
  this.previewSameOrg = sameOrg
122
162
  this.previewUrl = url
@@ -130,7 +170,7 @@ export default {
130
170
  const response = await this.$axios.post(
131
171
  this.apiPrefix ? this.apiPrefix + '/neams/eamsbaserecord/downloadFile' : '/neams/eamsbaserecord/downloadFile',
132
172
  { beid: id },
133
- { responseType: 'blob', loading: false }
173
+ { responseType: 'blob', loading: true }
134
174
  )
135
175
  const blob = response
136
176
  // 下载文件名
@@ -142,6 +182,7 @@ export default {
142
182
  url = `/api/onlinePreview?beid=${id}`
143
183
  }
144
184
  const sameOrg = this.seeTypes.test(name) || this.seeTypes.test(url)
185
+ console.log(url, name, sameOrg)
145
186
  return {
146
187
  url,
147
188
  name,
@@ -151,10 +192,7 @@ export default {
151
192
  closeSee() {
152
193
  this.previewUrl && URL.revokeObjectURL(this.previewUrl)
153
194
  this.previewUrl = undefined
154
-
155
- this.visiblePvT = setTimeout(() => {
156
- this.visiblePv = false
157
- }, 300)
195
+ this.visibleP = false
158
196
  }
159
197
  }
160
198
  }