vue2-client 1.8.131 → 1.8.133

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/CHANGELOG.md CHANGED
@@ -1,9 +1,6 @@
1
1
  # Change Log
2
2
  > 所有关于本项目的变化都在该文档里。
3
3
 
4
- **1.8.131 -2024-4-12 @陈博晨**
5
- - 查询配置解析json字段内容表单校验bug修改
6
-
7
4
  **1.8.130 -2024-4-11 @江超**
8
5
  - 导出bug修改
9
6
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue2-client",
3
- "version": "1.8.131",
3
+ "version": "1.8.133",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint",
@@ -51,7 +51,7 @@
51
51
  :attr="formItem"
52
52
  :disabled="itemDisabled(formItem)"
53
53
  :files="files"
54
- :form="form[groupItem.model]"
54
+ :form="form"
55
55
  :images="images"
56
56
  :service-name="serviceName"
57
57
  mode="新增/修改"
@@ -137,8 +137,6 @@ export default {
137
137
  return item.addOrEdit && item.addOrEdit !== 'no' && item.addOrEdit !== 'silenceAdd' && item.addOrEdit !== 'version' && !this.itemDisabled(item)
138
138
  }).map((groupItem) => {
139
139
  // 只保留第一个下划线后面的内容
140
- // 多层校验规则需要将prop设置为 key1.key2.....
141
- groupItem.prop = `${item.model}.${groupItem.model.substring(groupItem.model.indexOf('_') + 1)}`
142
140
  groupItem.model = groupItem.model.substring(groupItem.model.indexOf('_') + 1)
143
141
  return groupItem
144
142
  })
@@ -191,7 +189,7 @@ export default {
191
189
  const formData = Object.assign({}, fixedAddForm)
192
190
  for (let i = 0; i < this.realJsonData.length; i++) {
193
191
  const item = this.realJsonData[i]
194
- this.setFormProps(formData, item, null)
192
+ this.setFormProps(formData, item)
195
193
  }
196
194
  // 设置表单分组项目相关参数
197
195
  for (let i = 0; i < this.groupJsonData.length; i++) {
@@ -199,14 +197,14 @@ export default {
199
197
  formData[groupItem.model] = {}
200
198
  for (let j = 0; j < groupItem.groupItems.length; j++) {
201
199
  const item = groupItem.groupItems[j]
202
- this.setFormProps(formData[groupItem.model], item, item.prop)
200
+ this.setFormProps(formData[groupItem.model], item)
203
201
  }
204
202
  }
205
203
  // 设置动态简易表单项的相关参数
206
204
  for (const key in this.simpleFormJsonData) {
207
205
  for (const item of this.simpleFormJsonData[key].value) {
208
206
  item.model = key + '@' + item.model
209
- this.setFormProps(formData, item, null)
207
+ this.setFormProps(formData, item)
210
208
  }
211
209
  }
212
210
 
@@ -222,15 +220,11 @@ export default {
222
220
  }
223
221
  this.loaded = true
224
222
  },
225
- setFormProps (formData, item, groupItem) {
223
+ setFormProps (formData, item) {
226
224
  formData[item.model] = undefined
227
225
  // 处理表单校验情况
228
226
  if (item.rule) {
229
- if (groupItem) {
230
- this.rules[groupItem] = []
231
- } else {
232
- this.rules[item.model] = []
233
- }
227
+ this.rules[item.model] = []
234
228
  const required = item.rule.required ? item.rule.required === true || item.rule.required === 'true' : false
235
229
  let trigger
236
230
  let message
@@ -256,19 +250,11 @@ export default {
256
250
  message = '请输入' + item.name
257
251
  trigger = 'blur'
258
252
  }
259
- if (groupItem) {
260
- this.rules[groupItem].push({
261
- required: true,
262
- message: message,
263
- trigger: trigger
264
- })
265
- } else {
266
- this.rules[item.model].push({
267
- required: true,
268
- message: message,
269
- trigger: trigger
270
- })
271
- }
253
+ this.rules[item.model].push({
254
+ required: true,
255
+ message: message,
256
+ trigger: trigger
257
+ })
272
258
  }
273
259
 
274
260
  switch (item.rule.type) {
@@ -293,33 +279,18 @@ export default {
293
279
  defaultValue = 0.0
294
280
  break
295
281
  }
296
- if (groupItem) {
297
- this.rules[groupItem].push({
298
- type: item.rule.type,
299
- message: item.name + '必须为' + message,
300
- transform: (value) => {
301
- if (value && value.length !== 0) {
302
- return Number(value)
303
- } else {
304
- return defaultValue
305
- }
306
- },
307
- trigger: 'blur'
308
- })
309
- } else {
310
- this.rules[item.model].push({
311
- type: item.rule.type,
312
- message: item.name + '必须为' + message,
313
- transform: (value) => {
314
- if (value && value.length !== 0) {
315
- return Number(value)
316
- } else {
317
- return defaultValue
318
- }
319
- },
320
- trigger: 'blur'
321
- })
322
- }
282
+ this.rules[item.model].push({
283
+ type: item.rule.type,
284
+ message: item.name + '必须为' + message,
285
+ transform: (value) => {
286
+ if (value && value.length !== 0) {
287
+ return Number(value)
288
+ } else {
289
+ return defaultValue
290
+ }
291
+ },
292
+ trigger: 'blur'
293
+ })
323
294
  break
324
295
  }
325
296
  }
@@ -53,12 +53,16 @@ export default {
53
53
  localConfig: {
54
54
  type: Object,
55
55
  default: undefined
56
+ },
57
+ dontFormat: {
58
+ type: Boolean,
59
+ default: false
56
60
  }
57
61
  },
58
62
  components: {
59
63
  XReportDesign
60
64
  },
61
- data () {
65
+ data() {
62
66
  return {
63
67
  config: undefined,
64
68
  type: 'design',
@@ -77,7 +81,7 @@ export default {
77
81
  },
78
82
  methods: {
79
83
  // 检查slot是否在配置文件中包含,如果没有包含,则视为非法获取
80
- checkSlotDefine (config) {
84
+ checkSlotDefine(config) {
81
85
  const slotsDeclare = config.slotsDeclare
82
86
  const total = slotsDeclare.length
83
87
  let count = 0
@@ -94,16 +98,16 @@ export default {
94
98
  return count === total
95
99
  },
96
100
  // 切换了标签页
97
- tabChanged (key) {
101
+ tabChanged(key) {
98
102
  this.scanFinish = false
99
- this.originalConfig.data = { ...this.originalConfig.data, ...this.config.data }
103
+ this.originalConfig.data = {...this.originalConfig.data, ...this.config.data}
100
104
  this.config.data = this.originalConfig.data
101
105
  this.$nextTick(() => {
102
106
  this.scanFinish = true
103
107
  })
104
108
  },
105
109
  // 获取当前日期,为保存文件命名用
106
- getDate () {
110
+ getDate() {
107
111
  const currentDate = new Date()
108
112
 
109
113
  const year = currentDate.getFullYear()
@@ -115,7 +119,7 @@ export default {
115
119
  return formattedDate
116
120
  },
117
121
  // 导出PDF
118
- exportPDF () {
122
+ exportPDF() {
119
123
  const date = this.getDate()
120
124
  let title = this.config.title
121
125
  title = title.replace(/<[^>]+>/g, '')
@@ -123,7 +127,7 @@ export default {
123
127
  HtmlToPdf.getPdf(fileName, '#printReady')
124
128
  },
125
129
  // 用于分割配置中的colums,将需要处理的数组提取出来
126
- formatConfigRow () {
130
+ formatConfigRow() {
127
131
  for (let i = 0; i < this.config.columns.length; i++) {
128
132
  // 对原始数组进行递归,依次将该位置拆分为三个部分,当前处理位置之前的,当前处理位置,当前处理位置之后的
129
133
  const before = this.config.columns.slice(0, i)
@@ -173,7 +177,7 @@ export default {
173
177
  }
174
178
  },
175
179
  // 处理colums数组,为声明了rowspan的单元格,自动匹配格式
176
- checkRow (rowArr) {
180
+ checkRow(rowArr) {
177
181
  // 不需要更改的数据
178
182
  const original = []
179
183
  // 需要更改新加的数据
@@ -204,7 +208,14 @@ export default {
204
208
  }
205
209
 
206
210
  if (cell.text && total !== 0) { // 如果遇到了下一个声明行,证明rowspan少了一行,需要补充一个占位格
207
- const nullObj = { type: 'placeHolderColumn', order: subRowIndex, noBoarder: true, needSplit: true, colSpan: preColSpan, dontShowRow: true }
211
+ const nullObj = {
212
+ type: 'placeHolderColumn',
213
+ order: subRowIndex,
214
+ noBoarder: true,
215
+ needSplit: true,
216
+ colSpan: preColSpan,
217
+ dontShowRow: true
218
+ }
208
219
  subRowIndex++
209
220
  waitForAddArr.push(nullObj)
210
221
  total = 0
@@ -213,7 +224,14 @@ export default {
213
224
  firstSubLine = false
214
225
  } else if ((total !== count + cell.rowSpan) && forEachCount === rowArr.length) {
215
226
  // 如果没有遇到了下一个声明行,但已经是当前行最后一个数据,也证明rowspan少了一行,需要补充一个占位格
216
- const nullObj = { type: 'placeHolderColumn', order: subRowIndex, noBoarder: true, needSplit: true, colSpan: preColSpan, dontShowRow: true }
227
+ const nullObj = {
228
+ type: 'placeHolderColumn',
229
+ order: subRowIndex,
230
+ noBoarder: true,
231
+ needSplit: true,
232
+ colSpan: preColSpan,
233
+ dontShowRow: true
234
+ }
217
235
  subRowIndex++
218
236
  waitForAddArr.push(nullObj)
219
237
  total = 0
@@ -304,7 +322,7 @@ export default {
304
322
  }
305
323
  },
306
324
  // 扫描配置,如果有插槽则拼接插槽
307
- scanConfigSlot (config) {
325
+ scanConfigSlot(config) {
308
326
  const columnsArr = config.columns
309
327
  for (let i = 0; i < columnsArr.length; i++) {
310
328
  for (let j = 0; j < columnsArr[i].length; j++) {
@@ -365,7 +383,7 @@ export default {
365
383
  config.slotsDeclare = []
366
384
  }
367
385
 
368
- config.data = { ...config.data, ...this.configFromWeb[targetName].data }
386
+ config.data = {...config.data, ...this.configFromWeb[targetName].data}
369
387
  this.configFromWeb = {}
370
388
  }
371
389
  }
@@ -373,7 +391,7 @@ export default {
373
391
  this.config = config
374
392
  },
375
393
  // 扫描所有插槽名
376
- scanConfigName (config, resut) {
394
+ scanConfigName(config, resut) {
377
395
  if (config.slotsDeclare) {
378
396
  config.slotsDeclare.forEach(name => {
379
397
  resut.push(name)
@@ -381,7 +399,7 @@ export default {
381
399
  }
382
400
  },
383
401
  // 获取插槽
384
- getConfigAndJoin (config, outerLock) {
402
+ getConfigAndJoin(config, outerLock) {
385
403
  // 检查主配置插槽声明是否合法
386
404
  const check = this.checkSlotDefine(config)
387
405
  const waitForDownloadSlotName = []
@@ -394,8 +412,7 @@ export default {
394
412
 
395
413
  // 挨个获取插槽
396
414
  waitForDownloadSlotName.forEach(configName => {
397
- getConfigByName(configName, undefined, res => {
398
- console.warn('res', res)
415
+ getConfigByName(configName, 'af-system', res => {
399
416
  this.configFromWeb[configName] = res
400
417
  count++
401
418
  })
@@ -407,7 +424,7 @@ export default {
407
424
  clearInterval(timer)
408
425
  this.scanConfigSlot(config)
409
426
  if (config.slotsDeclare.length > 0) {
410
- const lock = { status: true }
427
+ const lock = {status: true}
411
428
  this.getConfigAndJoin(config, lock)
412
429
  const innerTimer = setInterval(() => {
413
430
  if (!lock.status) {
@@ -426,8 +443,8 @@ export default {
426
443
  }
427
444
  },
428
445
  // 获取配置之后的初始化
429
- configInit () {
430
- const lock = { status: true }
446
+ configInit() {
447
+ const lock = {status: true}
431
448
 
432
449
  this.getConfigAndJoin(this.config, lock)
433
450
 
@@ -436,8 +453,10 @@ export default {
436
453
  clearInterval(this.timer)
437
454
  console.log('拼接完成', this.config)
438
455
  this.originalConfig = Object.assign({}, this.config)
439
- // 扫描配置文件中有没有rowSpan,进行格式化调整
440
- this.formatConfigRow(this.config)
456
+ if (!this.dontFormat) {
457
+ // 扫描配置文件中有没有rowSpan,进行格式化调整
458
+ this.formatConfigRow(this.config)
459
+ }
441
460
  this.activeConfig = this.config
442
461
  this.$nextTick(() => {
443
462
  this.scanFinish = true
@@ -446,12 +465,12 @@ export default {
446
465
  }, 100)
447
466
  }
448
467
  },
449
- beforeMount () {
468
+ beforeMount() {
450
469
  if (this.localConfig) {
451
470
  this.config = this.localConfig
452
471
  this.configInit()
453
472
  } else {
454
- getConfigByName(this.configName, undefined, res => {
473
+ getConfigByName(this.configName, 'af-system', res => {
455
474
  this.config = res
456
475
  this.configInit()
457
476
  })
@@ -461,10 +480,11 @@ export default {
461
480
  </script>
462
481
 
463
482
  <style lang="less" scoped>
464
- .tools{
483
+ .tools {
465
484
  text-align: center;
466
485
  cursor: pointer;
467
- .toolsItem{
486
+
487
+ .toolsItem {
468
488
  display: inline-block;
469
489
  }
470
490
  }