vue2-client 1.8.152 → 1.8.154

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,6 +1,9 @@
1
1
  # Change Log
2
2
  > 所有关于本项目的变化都在该文档里。
3
3
 
4
+ **1.8.131 -2024-4-12 @陈博晨**
5
+ - 查询配置解析json字段内容表单校验bug修改
6
+
4
7
  **1.8.130 -2024-4-11 @江超**
5
8
  - 导出bug修改
6
9
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue2-client",
3
- "version": "1.8.152",
3
+ "version": "1.8.154",
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"
54
+ :form="form[groupItem.model]"
55
55
  :images="images"
56
56
  :service-name="serviceName"
57
57
  mode="新增/修改"
@@ -137,6 +137,8 @@ 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)}`
140
142
  groupItem.model = groupItem.model.substring(groupItem.model.indexOf('_') + 1)
141
143
  return groupItem
142
144
  })
@@ -189,7 +191,7 @@ export default {
189
191
  const formData = Object.assign({}, fixedAddForm)
190
192
  for (let i = 0; i < this.realJsonData.length; i++) {
191
193
  const item = this.realJsonData[i]
192
- this.setFormProps(formData, item)
194
+ this.setFormProps(formData, item, null)
193
195
  }
194
196
  // 设置表单分组项目相关参数
195
197
  for (let i = 0; i < this.groupJsonData.length; i++) {
@@ -197,14 +199,14 @@ export default {
197
199
  formData[groupItem.model] = {}
198
200
  for (let j = 0; j < groupItem.groupItems.length; j++) {
199
201
  const item = groupItem.groupItems[j]
200
- this.setFormProps(formData[groupItem.model], item)
202
+ this.setFormProps(formData[groupItem.model], item, item.prop)
201
203
  }
202
204
  }
203
205
  // 设置动态简易表单项的相关参数
204
206
  for (const key in this.simpleFormJsonData) {
205
207
  for (const item of this.simpleFormJsonData[key].value) {
206
208
  item.model = key + '@' + item.model
207
- this.setFormProps(formData, item)
209
+ this.setFormProps(formData, item, null)
208
210
  }
209
211
  }
210
212
 
@@ -220,11 +222,15 @@ export default {
220
222
  }
221
223
  this.loaded = true
222
224
  },
223
- setFormProps (formData, item) {
225
+ setFormProps (formData, item, groupItem) {
224
226
  formData[item.model] = undefined
225
227
  // 处理表单校验情况
226
228
  if (item.rule) {
227
- this.rules[item.model] = []
229
+ if (groupItem) {
230
+ this.rules[groupItem] = []
231
+ } else {
232
+ this.rules[item.model] = []
233
+ }
228
234
  const required = item.rule.required ? item.rule.required === true || item.rule.required === 'true' : false
229
235
  let trigger
230
236
  let message
@@ -250,11 +256,19 @@ export default {
250
256
  message = '请输入' + item.name
251
257
  trigger = 'blur'
252
258
  }
253
- this.rules[item.model].push({
254
- required: true,
255
- message: message,
256
- trigger: trigger
257
- })
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
+ }
258
272
  }
259
273
 
260
274
  switch (item.rule.type) {
@@ -279,18 +293,33 @@ export default {
279
293
  defaultValue = 0.0
280
294
  break
281
295
  }
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
- })
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
+ }
294
323
  break
295
324
  }
296
325
  }
@@ -1,161 +1,161 @@
1
- <template>
2
- <div class="reportMain">
3
- <table class="reportTable">
4
- <tbody class="reportTable">
5
- <tr v-if="config.title.type && config.title.type !== ''">
6
- <th class="tdWithBorder" colspan="12">
7
- <template v-if="config.title.type === 'titleKey'">
8
- {{ config.data[config.title.value] }}
9
- </template>
10
- <template v-else-if="config.title.type === 'titleValue'">
11
- {{ config.title.value }}
12
- </template>
13
- </th>
14
- </tr>
15
- <template v-for="(row, rowIndex) in config.content">
16
- <template v-if="row.type === 'jsonKey'">
17
- <tr :key="rowIndex">
18
- <!-- 表头 -->
19
- <td class="tdWithBorder" colspan="6">
20
- <template v-if="receivedFunction[rowIndex].labelFunction(config).type === 'key'">
21
- {{ config.data[receivedFunction[rowIndex].labelFunction(config).content] }}
22
- </template>
23
- <template v-else-if="receivedFunction[rowIndex].labelFunction(config).type === 'value'">
24
- {{ receivedFunction[rowIndex].labelFunction(config).content }}
25
- </template>
26
- </td>
27
- <!-- 内容 -->
28
- <td class="tdWithBorder" colspan="6">
29
- <template v-if="receivedFunction[rowIndex].valueFunction(config).type === 'key'">
30
- {{ config.data[receivedFunction[rowIndex].valueFunction(config).content] }}
31
- </template>
32
- <template v-else-if="receivedFunction[rowIndex].valueFunction(config).type === 'value'">
33
- {{ receivedFunction[rowIndex].valueFunction(config).content }}
34
- </template>
35
- <template v-else-if="receivedFunction[rowIndex].valueFunction(config).type === 'img'">
36
- <template v-for="(img, imgIndex) in receivedFunction[rowIndex].valueFunction(config).content">
37
- <span :key="imgIndex" class="imgText">
38
- <a-icon type="link"/>
39
- <span @click="openImgModal(img)">{{ formatImgName(img) }}</span>
40
- <br/>
41
- </span>
42
- </template>
43
- </template>
44
- </td>
45
- </tr>
46
- </template>
47
- <template v-else-if="row.type === 'jsonArray'">
48
- <tr :key="rowIndex + '' + jsonArrayItemIndex" v-for="(item, jsonArrayItemIndex) in config.data[row.jsonArrayDataIndex]">
49
- <!-- 表头 -->
50
- <td class="tdWithBorder" colspan="6">
51
- <template v-if="receivedFunction[rowIndex].labelFunction(config, item).type === 'key'">
52
- {{ item[receivedFunction[rowIndex].labelFunction(config, item).content] }}
53
- </template>
54
- <template v-if="receivedFunction[rowIndex].labelFunction(config, item).type === 'value'">
55
- {{ receivedFunction[rowIndex].labelFunction(config, item).content }}
56
- </template>
57
- </td>
58
- <!-- 内容 -->
59
- <td class="tdWithBorder" colspan="6">
60
- <template v-if="receivedFunction[rowIndex].valueFunction(config, item).type === 'key'">
61
- {{ item[receivedFunction[rowIndex].valueFunction(config, item).content] }}
62
- </template>
63
- <template v-if="receivedFunction[rowIndex].valueFunction(config, item).type === 'value'">
64
- {{ receivedFunction[rowIndex].valueFunction(config, item).content }}
65
- </template>
66
- </td>
67
- </tr>
68
- </template>
69
- </template>
70
- </tbody>
71
- </table>
72
- <a-modal
73
- title="图片"
74
- width="80%"
75
- :visible="showImgModal"
76
- @ok="handleShowImgOk"
77
- @cancel="handleShowImgCancel"
78
- :z-index="1001"
79
- :destroyOnClose="true">
80
- <div style="width: 100%;display: flex;justify-content: center;align-items: center">
81
- <img :src="showImageSrc" alt="图片"/>
82
- </div>
83
- </a-modal>
84
- </div>
85
- </template>
86
-
87
- <script>
88
-
89
- export default {
90
- name: 'XReportJsonRender',
91
- props: {
92
- config: {
93
- type: Object,
94
- required: true
95
- }
96
- },
97
- data () {
98
- return {
99
- receivedFunction: [],
100
- showImgModal: false,
101
- showImageSrc: undefined
102
- }
103
- },
104
- methods: {
105
- handleShowImgOk () {
106
- this.showImgModal = false
107
- this.showImageSrc = undefined
108
- },
109
- handleShowImgCancel () {
110
- this.showImgModal = false
111
- this.showImageSrc = undefined
112
- },
113
- openImgModal (img) {
114
- this.showImageSrc = img
115
- this.showImgModal = true
116
- },
117
- formatImgName (imgSrc) {
118
- return imgSrc.split('/').pop()
119
- }
120
- },
121
- beforeMount () {
122
- for (let i = 0; i < this.config.content.length; i++) {
123
- this.receivedFunction.push({
124
- // eslint-disable-next-line no-eval
125
- labelFunction: eval('(' + this.config.content[i].customFunctionForLabel + ')'),
126
- // eslint-disable-next-line no-eval
127
- valueFunction: eval('(' + this.config.content[i].customFunctionForValue + ')')
128
- })
129
- }
130
- }
131
- }
132
- </script>
133
-
134
- <style scoped lang="less">
135
- .reportMain {
136
- text-align: center;
137
- margin: 0 auto;
138
- font-size: 16px;
139
- color: #000;
140
- background-color: #fff;
141
- padding: 15px;
142
- border-radius: 8px;
143
- }
144
- .reportTitle {
145
- font-weight: bold;
146
- }
147
- .reportTable {
148
- width: 100%;
149
- border-collapse: collapse;
150
- table-layout:fixed;
151
- word-break:break-all;
152
- }
153
- .tdWithBorder {
154
- border: 1px solid #000;
155
- padding: 8px;
156
- }
157
- .imgText:hover {
158
- color: rgb( 24,144,255);
159
- cursor: pointer;
160
- }
161
- </style>
1
+ <template>
2
+ <div class="reportMain">
3
+ <table class="reportTable">
4
+ <tbody class="reportTable">
5
+ <tr v-if="config.title.type && config.title.type !== ''">
6
+ <th class="tdWithBorder" colspan="12">
7
+ <template v-if="config.title.type === 'titleKey'">
8
+ {{ config.data[config.title.value] }}
9
+ </template>
10
+ <template v-else-if="config.title.type === 'titleValue'">
11
+ {{ config.title.value }}
12
+ </template>
13
+ </th>
14
+ </tr>
15
+ <template v-for="(row, rowIndex) in config.content">
16
+ <template v-if="row.type === 'jsonKey'">
17
+ <tr :key="rowIndex">
18
+ <!-- 表头 -->
19
+ <td class="tdWithBorder" colspan="6">
20
+ <template v-if="receivedFunction[rowIndex].labelFunction(config).type === 'key'">
21
+ {{ config.data[receivedFunction[rowIndex].labelFunction(config).content] }}
22
+ </template>
23
+ <template v-else-if="receivedFunction[rowIndex].labelFunction(config).type === 'value'">
24
+ {{ receivedFunction[rowIndex].labelFunction(config).content }}
25
+ </template>
26
+ </td>
27
+ <!-- 内容 -->
28
+ <td class="tdWithBorder" colspan="6">
29
+ <template v-if="receivedFunction[rowIndex].valueFunction(config).type === 'key'">
30
+ {{ config.data[receivedFunction[rowIndex].valueFunction(config).content] }}
31
+ </template>
32
+ <template v-else-if="receivedFunction[rowIndex].valueFunction(config).type === 'value'">
33
+ {{ receivedFunction[rowIndex].valueFunction(config).content }}
34
+ </template>
35
+ <template v-else-if="receivedFunction[rowIndex].valueFunction(config).type === 'img'">
36
+ <template v-for="(img, imgIndex) in receivedFunction[rowIndex].valueFunction(config).content">
37
+ <span :key="imgIndex" class="imgText">
38
+ <a-icon type="link"/>
39
+ <span @click="openImgModal(img)">{{ formatImgName(img) }}</span>
40
+ <br/>
41
+ </span>
42
+ </template>
43
+ </template>
44
+ </td>
45
+ </tr>
46
+ </template>
47
+ <template v-else-if="row.type === 'jsonArray'">
48
+ <tr :key="rowIndex + '' + jsonArrayItemIndex" v-for="(item, jsonArrayItemIndex) in config.data[row.jsonArrayDataIndex]">
49
+ <!-- 表头 -->
50
+ <td class="tdWithBorder" colspan="6">
51
+ <template v-if="receivedFunction[rowIndex].labelFunction(config, item).type === 'key'">
52
+ {{ item[receivedFunction[rowIndex].labelFunction(config, item).content] }}
53
+ </template>
54
+ <template v-if="receivedFunction[rowIndex].labelFunction(config, item).type === 'value'">
55
+ {{ receivedFunction[rowIndex].labelFunction(config, item).content }}
56
+ </template>
57
+ </td>
58
+ <!-- 内容 -->
59
+ <td class="tdWithBorder" colspan="6">
60
+ <template v-if="receivedFunction[rowIndex].valueFunction(config, item).type === 'key'">
61
+ {{ item[receivedFunction[rowIndex].valueFunction(config, item).content] }}
62
+ </template>
63
+ <template v-if="receivedFunction[rowIndex].valueFunction(config, item).type === 'value'">
64
+ {{ receivedFunction[rowIndex].valueFunction(config, item).content }}
65
+ </template>
66
+ </td>
67
+ </tr>
68
+ </template>
69
+ </template>
70
+ </tbody>
71
+ </table>
72
+ <a-modal
73
+ title="图片"
74
+ width="80%"
75
+ :visible="showImgModal"
76
+ @ok="handleShowImgOk"
77
+ @cancel="handleShowImgCancel"
78
+ :z-index="1001"
79
+ :destroyOnClose="true">
80
+ <div style="width: 100%;display: flex;justify-content: center;align-items: center">
81
+ <img :src="showImageSrc" alt="图片"/>
82
+ </div>
83
+ </a-modal>
84
+ </div>
85
+ </template>
86
+
87
+ <script>
88
+
89
+ export default {
90
+ name: 'XReportJsonRender',
91
+ props: {
92
+ config: {
93
+ type: Object,
94
+ required: true
95
+ }
96
+ },
97
+ data () {
98
+ return {
99
+ receivedFunction: [],
100
+ showImgModal: false,
101
+ showImageSrc: undefined
102
+ }
103
+ },
104
+ methods: {
105
+ handleShowImgOk () {
106
+ this.showImgModal = false
107
+ this.showImageSrc = undefined
108
+ },
109
+ handleShowImgCancel () {
110
+ this.showImgModal = false
111
+ this.showImageSrc = undefined
112
+ },
113
+ openImgModal (img) {
114
+ this.showImageSrc = img
115
+ this.showImgModal = true
116
+ },
117
+ formatImgName (imgSrc) {
118
+ return imgSrc.split('/').pop()
119
+ }
120
+ },
121
+ beforeMount () {
122
+ for (let i = 0; i < this.config.content.length; i++) {
123
+ this.receivedFunction.push({
124
+ // eslint-disable-next-line no-eval
125
+ labelFunction: eval('(' + this.config.content[i].customFunctionForLabel + ')'),
126
+ // eslint-disable-next-line no-eval
127
+ valueFunction: eval('(' + this.config.content[i].customFunctionForValue + ')')
128
+ })
129
+ }
130
+ }
131
+ }
132
+ </script>
133
+
134
+ <style scoped lang="less">
135
+ .reportMain {
136
+ text-align: center;
137
+ margin: 0 auto;
138
+ font-size: 16px;
139
+ color: #000;
140
+ background-color: #fff;
141
+ padding: 15px;
142
+ border-radius: 8px;
143
+ }
144
+ .reportTitle {
145
+ font-weight: bold;
146
+ }
147
+ .reportTable {
148
+ width: 100%;
149
+ border-collapse: collapse;
150
+ table-layout:fixed;
151
+ word-break:break-all;
152
+ }
153
+ .tdWithBorder {
154
+ border: 1px solid #000;
155
+ padding: 8px;
156
+ }
157
+ .imgText:hover {
158
+ color: rgb( 24,144,255);
159
+ cursor: pointer;
160
+ }
161
+ </style>
@@ -1,48 +1,48 @@
1
- # XReportSlot 暂时废弃
2
-
3
-
4
- 动态报表的插槽组件,可以递归使用
5
-
6
-
7
- ## 何时使用
8
-
9
- > 当需要一个动态生成的报表时
10
-
11
- > 一般由XReportDesign嵌套使用,在XReportDesign中判断当前行如果类型是slot,
12
- > 则递归此组件
13
-
14
- 引用方式:
15
-
16
- ```javascript
17
- import XReportSlot from '@vue2-client/base-client/components/XReportSlot/XReportSlot'
18
-
19
- export default {
20
- components: {
21
- XReportSlot
22
- }
23
- }
24
- ```
25
-
26
-
27
- ## API
28
-
29
- | 参数 | 说明 | 类型 | 默认值 |
30
- |-----------------|--------------------------|--------|------|
31
- | config | 表格完整配置 | Object | 无(必填) |
32
- | forDisplay | 是否为展示页 | Boolean | false |
33
- | slotConfigName | 插槽名 | String | undefined |
34
-
35
- ## 例子1
36
- ----
37
- ```vue
38
- <XReportSlot
39
- :config="activatedConfig"
40
- :slot-config-name="slotConfig"
41
- :for-display="forDisplay">
42
- </XReportSlot>
43
- ```
44
- ## 注意事项
45
- > slotConfigName如果不填,则展示整个表格。
46
- > 如果填写,则仅展示插槽中的内容
47
-
48
- > 该组件可以递归调用
1
+ # XReportSlot 暂时废弃
2
+
3
+
4
+ 动态报表的插槽组件,可以递归使用
5
+
6
+
7
+ ## 何时使用
8
+
9
+ > 当需要一个动态生成的报表时
10
+
11
+ > 一般由XReportDesign嵌套使用,在XReportDesign中判断当前行如果类型是slot,
12
+ > 则递归此组件
13
+
14
+ 引用方式:
15
+
16
+ ```javascript
17
+ import XReportSlot from '@vue2-client/base-client/components/XReportSlot/XReportSlot'
18
+
19
+ export default {
20
+ components: {
21
+ XReportSlot
22
+ }
23
+ }
24
+ ```
25
+
26
+
27
+ ## API
28
+
29
+ | 参数 | 说明 | 类型 | 默认值 |
30
+ |-----------------|--------------------------|--------|------|
31
+ | config | 表格完整配置 | Object | 无(必填) |
32
+ | forDisplay | 是否为展示页 | Boolean | false |
33
+ | slotConfigName | 插槽名 | String | undefined |
34
+
35
+ ## 例子1
36
+ ----
37
+ ```vue
38
+ <XReportSlot
39
+ :config="activatedConfig"
40
+ :slot-config-name="slotConfig"
41
+ :for-display="forDisplay">
42
+ </XReportSlot>
43
+ ```
44
+ ## 注意事项
45
+ > slotConfigName如果不填,则展示整个表格。
46
+ > 如果填写,则仅展示插槽中的内容
47
+
48
+ > 该组件可以递归调用
@@ -93,7 +93,7 @@ const GetAppDataService = {
93
93
  if (Object.prototype.hasOwnProperty.call(result, value)) {
94
94
  return result[value]
95
95
  } else {
96
- return null
96
+ return {status: 'none', text: value}
97
97
  }
98
98
  }
99
99
  return null