vue2-client 1.8.132 → 1.8.135

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": "vue2-client",
3
- "version": "1.8.132",
3
+ "version": "1.8.135",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint",
@@ -0,0 +1,19 @@
1
+ import Vue from 'vue'
2
+ import App from './pages/XReportView/index.vue'
3
+ import Vuex from 'vuex'
4
+ import { bootstrap, i18n, message, modules } from '../index'
5
+
6
+ Vue.use(Vuex)
7
+
8
+ // 创建router store
9
+ const store = new Vuex.Store({ modules })
10
+
11
+ // 绑定原型,用于amis
12
+ Vue.$store = store
13
+
14
+ bootstrap({ i18n, message }).then(() => {
15
+ new Vue({
16
+ i18n,
17
+ render: h => h(App)
18
+ }).$mount('#app')
19
+ })
@@ -18,18 +18,30 @@
18
18
  支持单个或多个文件
19
19
  </p>
20
20
  </a-upload-dragger>
21
- <a-upload
22
- v-if=" model.type === 'image'"
23
- :accept="model.accept.join('')"
24
- :customRequest="uploadFiles"
25
- :file-list="uploadedFileList"
26
- :remove="deleteFileItem"
27
- list-type="picture-card">
28
- <a-icon type="plus"/>
29
- <div class="ant-upload-text">
30
- Upload
31
- </div>
32
- </a-upload>
21
+ <template v-if="uploadStyle === 'simple'">
22
+ <a-upload
23
+ v-if=" model.type === 'image'"
24
+ :accept="model.accept.join('')"
25
+ :customRequest="uploadFiles"
26
+ :file-list="uploadedFileList"
27
+ :remove="deleteFileItem">
28
+ <a-button style="margin-top: 2%"> <a-icon type="upload" /> 上传 </a-button>
29
+ </a-upload>
30
+ </template>
31
+ <template v-else>
32
+ <a-upload
33
+ v-if=" model.type === 'image'"
34
+ :accept="model.accept.join('')"
35
+ :customRequest="uploadFiles"
36
+ :file-list="uploadedFileList"
37
+ :remove="deleteFileItem"
38
+ list-type="picture-card">
39
+ <a-icon type="plus"/>
40
+ <div class="ant-upload-text">
41
+ Upload
42
+ </div>
43
+ </a-upload>
44
+ </template>
33
45
  </div>
34
46
  </template>
35
47
 
@@ -68,6 +80,14 @@ export default {
68
80
  serviceName: {
69
81
  type: String,
70
82
  default: undefined
83
+ },
84
+ uploadStyle: {
85
+ type: String,
86
+ default: undefined
87
+ },
88
+ outerContainerIndex: {
89
+ type: [String, Number],
90
+ default: undefined
71
91
  }
72
92
  },
73
93
  computed: {
@@ -80,7 +100,11 @@ export default {
80
100
  } else {
81
101
  this.uploadedFileList = list
82
102
  }
83
- this.$emit('setFiles', this.uploadedFileList.filter(item => item.status === 'done').map(item => item.id))
103
+ if (this.outerContainerIndex !== undefined) {
104
+ this.$emit('setFiles', this.uploadedFileList.filter(item => item.status === 'done'), this.outerContainerIndex)
105
+ } else {
106
+ this.$emit('setFiles', this.uploadedFileList.filter(item => item.status === 'done').map(item => item.id))
107
+ }
84
108
  },
85
109
  methods: {
86
110
  uploadFiles (info) {
@@ -131,7 +155,11 @@ export default {
131
155
  fileInfo.response = dataObj
132
156
  fileInfo.id = dataObj.id
133
157
  fileInfo.url = dataObj.f_downloadpath
134
- this.$emit('setFiles', this.uploadedFileList.filter(item => item.status === 'done').map(item => item.id))
158
+ if (this.outerContainerIndex !== undefined) {
159
+ this.$emit('setFiles', this.uploadedFileList.filter(item => item.status === 'done'), this.outerContainerIndex)
160
+ } else {
161
+ this.$emit('setFiles', this.uploadedFileList.filter(item => item.status === 'done').map(item => item.id))
162
+ }
135
163
  this.$message.success('上传成功!')
136
164
  } else {
137
165
  fileInfo.status = 'error'
@@ -154,7 +182,11 @@ export default {
154
182
  const index = this.uploadedFileList.indexOf(file)
155
183
  // 从列表中移除该文件
156
184
  this.uploadedFileList.splice(index, 1)
157
- this.$emit('setFiles', this.uploadedFileList.filter(item => item.status === 'done').map(item => item.id))
185
+ if (this.outerContainerIndex !== undefined) {
186
+ this.$emit('setFiles', this.uploadedFileList.filter(item => item.status === 'done'), this.outerContainerIndex)
187
+ } else {
188
+ this.$emit('setFiles', this.uploadedFileList.filter(item => item.status === 'done').map(item => item.id))
189
+ }
158
190
  return true
159
191
  }
160
192
  }
@@ -7,17 +7,23 @@
7
7
  <a-radio-button value="design">
8
8
  设计
9
9
  </a-radio-button>
10
- <a-radio-button value="display">
10
+ <a-radio-button value="display" style="border-radius: 0">
11
11
  预览
12
12
  </a-radio-button>
13
13
  </a-radio-group>
14
+ <a-radio-button @click="saveConfig" style="border-radius: 0 4px 4px 0">
15
+ 保存
16
+ </a-radio-button>
14
17
  <!-- 主体表格 -->
15
18
  <XReportDesign
16
19
  v-if="scanFinish"
17
20
  :config="type === 'display' ? originalConfig : activeConfig"
18
21
  :slot-config-name="type === 'display' ? undefined : activatedSlotName"
19
22
  :for-display="type === 'display'"
20
- id="printReady">
23
+ ref="XReportDesign"
24
+ id="printReady"
25
+ :show-images="hasImages"
26
+ :image-list="imageList">
21
27
  </XReportDesign>
22
28
  <!-- 导出按钮 -->
23
29
  <template v-if="type === 'display'">
@@ -42,6 +48,16 @@ import XReportDesign from '@vue2-client/base-client/components/common/XReport/XR
42
48
  export default {
43
49
  name: 'XReport',
44
50
  props: {
51
+ files: {
52
+ type: Array,
53
+ default: () => {
54
+ return []
55
+ }
56
+ },
57
+ authority: {
58
+ type: String,
59
+ default: 'user'
60
+ },
45
61
  configName: {
46
62
  type: String,
47
63
  required: true
@@ -53,6 +69,10 @@ export default {
53
69
  localConfig: {
54
70
  type: Object,
55
71
  default: undefined
72
+ },
73
+ dontFormat: {
74
+ type: Boolean,
75
+ default: false
56
76
  }
57
77
  },
58
78
  components: {
@@ -72,10 +92,31 @@ export default {
72
92
  originalConfig: null,
73
93
  // 扫描到的配置
74
94
  configFromWeb: {},
75
- timer: undefined
95
+ timer: undefined,
96
+ hasImages: false,
97
+ imageList: []
98
+ }
99
+ },
100
+ watch: {
101
+ configName (val) {
102
+ if (val) {
103
+ getConfigByName(this.configName, undefined, res => {
104
+ this.config = res
105
+ this.configInit()
106
+ })
107
+ }
108
+ },
109
+ localConfig (val) {
110
+ if (val) {
111
+ this.config = val
112
+ this.configInit()
113
+ }
76
114
  }
77
115
  },
78
116
  methods: {
117
+ saveConfig () {
118
+ this.$emit('saveConfig', this.$refs.XReportDesign.activatedConfig)
119
+ },
79
120
  // 检查slot是否在配置文件中包含,如果没有包含,则视为非法获取
80
121
  checkSlotDefine (config) {
81
122
  const slotsDeclare = config.slotsDeclare
@@ -98,6 +139,20 @@ export default {
98
139
  this.scanFinish = false
99
140
  this.originalConfig.data = { ...this.originalConfig.data, ...this.config.data }
100
141
  this.config.data = this.originalConfig.data
142
+ if (this.type === 'display') {
143
+ let count = 0
144
+ this.imageList = []
145
+ const keys = Object.keys(this.config.data.images)
146
+ keys.forEach(key => {
147
+ if (this.config.data.images[key].length > 0) {
148
+ this.imageList = [...this.imageList, ...this.config.data.images[key]]
149
+ count++
150
+ }
151
+ })
152
+ this.hasImages = count > 0
153
+ } else {
154
+ this.hasImages = false
155
+ }
101
156
  this.$nextTick(() => {
102
157
  this.scanFinish = true
103
158
  })
@@ -204,7 +259,14 @@ export default {
204
259
  }
205
260
 
206
261
  if (cell.text && total !== 0) { // 如果遇到了下一个声明行,证明rowspan少了一行,需要补充一个占位格
207
- const nullObj = { type: 'placeHolderColumn', order: subRowIndex, noBoarder: true, needSplit: true, colSpan: preColSpan, dontShowRow: true }
262
+ const nullObj = {
263
+ type: 'placeHolderColumn',
264
+ order: subRowIndex,
265
+ noBoarder: true,
266
+ needSplit: true,
267
+ colSpan: preColSpan,
268
+ dontShowRow: true
269
+ }
208
270
  subRowIndex++
209
271
  waitForAddArr.push(nullObj)
210
272
  total = 0
@@ -213,7 +275,14 @@ export default {
213
275
  firstSubLine = false
214
276
  } else if ((total !== count + cell.rowSpan) && forEachCount === rowArr.length) {
215
277
  // 如果没有遇到了下一个声明行,但已经是当前行最后一个数据,也证明rowspan少了一行,需要补充一个占位格
216
- const nullObj = { type: 'placeHolderColumn', order: subRowIndex, noBoarder: true, needSplit: true, colSpan: preColSpan, dontShowRow: true }
278
+ const nullObj = {
279
+ type: 'placeHolderColumn',
280
+ order: subRowIndex,
281
+ noBoarder: true,
282
+ needSplit: true,
283
+ colSpan: preColSpan,
284
+ dontShowRow: true
285
+ }
217
286
  subRowIndex++
218
287
  waitForAddArr.push(nullObj)
219
288
  total = 0
@@ -394,7 +463,7 @@ export default {
394
463
 
395
464
  // 挨个获取插槽
396
465
  waitForDownloadSlotName.forEach(configName => {
397
- getConfigByName(configName, undefined, res => {
466
+ getConfigByName(configName, 'af-system', res => {
398
467
  this.configFromWeb[configName] = res
399
468
  count++
400
469
  })
@@ -435,8 +504,10 @@ export default {
435
504
  clearInterval(this.timer)
436
505
  console.log('拼接完成', this.config)
437
506
  this.originalConfig = Object.assign({}, this.config)
438
- // 扫描配置文件中有没有rowSpan,进行格式化调整
439
- this.formatConfigRow(this.config)
507
+ if (!this.dontFormat) {
508
+ // 扫描配置文件中有没有rowSpan,进行格式化调整
509
+ this.formatConfigRow(this.config)
510
+ }
440
511
  this.activeConfig = this.config
441
512
  this.$nextTick(() => {
442
513
  this.scanFinish = true
@@ -448,10 +519,16 @@ export default {
448
519
  beforeMount () {
449
520
  if (this.localConfig) {
450
521
  this.config = this.localConfig
522
+ if (this.config.data.images === undefined) {
523
+ this.config.data.images = {}
524
+ }
451
525
  this.configInit()
452
526
  } else {
453
- getConfigByName(this.configName, undefined, res => {
527
+ getConfigByName(this.configName, 'af-system', res => {
454
528
  this.config = res
529
+ if (this.config.data.images === undefined) {
530
+ this.config.data.images = {}
531
+ }
455
532
  this.configInit()
456
533
  })
457
534
  }
@@ -460,10 +537,11 @@ export default {
460
537
  </script>
461
538
 
462
539
  <style lang="less" scoped>
463
- .tools{
540
+ .tools {
464
541
  text-align: center;
465
542
  cursor: pointer;
466
- .toolsItem{
543
+
544
+ .toolsItem {
467
545
  display: inline-block;
468
546
  }
469
547
  }
@@ -68,6 +68,15 @@
68
68
  </template>
69
69
  </tbody>
70
70
  </table>
71
+ <div v-if="showImages" style="margin-top: 5%; display: flex;margin-bottom: 5%">
72
+ <p>图片:</p>
73
+ <template v-for="(img,imgIndex) in imageList">
74
+ <div :key="imgIndex" style="margin-left: 3%;width: 200px">
75
+ <img :src="img.url" class="img" :alt="img.name"/>
76
+ <p style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;width: 100%;">{{img.name}}</p>
77
+ </div>
78
+ </template>
79
+ </div>
71
80
  </div>
72
81
  </template>
73
82
 
@@ -90,6 +99,14 @@ export default {
90
99
  slotConfigName: {
91
100
  type: String,
92
101
  default: undefined
102
+ },
103
+ showImages: {
104
+ type: Boolean,
105
+ default: false
106
+ },
107
+ imageList: {
108
+ type: Array,
109
+ default: undefined
93
110
  }
94
111
  },
95
112
  components: {
@@ -174,6 +191,11 @@ export default {
174
191
  </script>
175
192
 
176
193
  <style lang="less" scoped>
194
+ .img{
195
+ width: 95%;
196
+ height: 180px;
197
+ object-fit: cover;
198
+ }
177
199
  .reportMain {
178
200
  text-align: center;
179
201
  margin: 0 auto;