vue2-client 1.8.220 → 1.8.222

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.220",
3
+ "version": "1.8.222",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint",
@@ -13,7 +13,8 @@
13
13
  v-for="(item, index) in realJsonData"
14
14
  :key="index"
15
15
  :attr="item"
16
- :disabled="itemDisabled(item) || readonly(item)"
16
+ :disabled="itemDisabled(item)"
17
+ :readonly="readonly(item)"
17
18
  :files="files"
18
19
  :style="layout ==='inline'?{marginTop:'5px'}:undefined"
19
20
  :form="form"
@@ -33,6 +34,7 @@
33
34
  :key="index"
34
35
  :attr="item"
35
36
  :disabled="itemDisabled(item)"
37
+ :readonly="readonly(item)"
36
38
  :files="files"
37
39
  :form="form[groupItem.model]"
38
40
  :images="images"
@@ -53,6 +55,7 @@
53
55
  :key="key + formItemIndex"
54
56
  :attr="formItem"
55
57
  :disabled="itemDisabled(formItem)"
58
+ :readonly="readonly(formItem)"
56
59
  :files="files"
57
60
  :form="form[groupItem.model]"
58
61
  :images="images"
@@ -631,6 +634,9 @@ export default {
631
634
  }
632
635
  }
633
636
  },
637
+ setForm (obj) {
638
+ this.form = Object.assign(this.form, obj)
639
+ },
634
640
  emitFunc (func, data) {
635
641
  this.$emit('x-form-item-emit-func', func, data)
636
642
  }
@@ -12,7 +12,8 @@
12
12
  <a-input-group v-if="attr.inputOnAfterName && attr.inputOnAfterFunc" compact>
13
13
  <a-input
14
14
  v-model="form[attr.model]"
15
- :disabled="disabled"
15
+ :readonly="readonly"
16
+ :disabled="disabled && !readonly"
16
17
  style="width:90%"
17
18
  :placeholder="attr.placeholder ? attr.placeholder : '请输入'+attr.name.replace(/\s*/g, '')"/>
18
19
  <a-button style="width:10%" type="primary" @click="emitFunc(attr.inputOnAfterFunc,form[attr.model])">
@@ -22,7 +23,8 @@
22
23
  <a-input
23
24
  v-else
24
25
  v-model="form[attr.model]"
25
- :disabled="disabled"
26
+ :readonly="readonly"
27
+ :disabled="disabled && !readonly"
26
28
  style="width:100%"
27
29
  :placeholder="attr.placeholder ? attr.placeholder : '请输入'+attr.name.replace(/\s*/g, '')"/>
28
30
 
@@ -479,6 +481,13 @@ export default {
479
481
  return false
480
482
  }
481
483
  },
484
+ readonly: {
485
+ type: Boolean,
486
+ default:
487
+ () => {
488
+ return false
489
+ }
490
+ },
482
491
  mode: {
483
492
  type: String,
484
493
  default:
@@ -21,11 +21,11 @@
21
21
  </a-col>
22
22
  </a-row>
23
23
  <template v-if="item.formGroupType === 'slot'">
24
- <slot :name="item.slotName" :data="allFormData" :ref="`nativeForm-${index}`" >
24
+ <slot :name="item.slotName" :data="allFormData" :index="index">
25
25
  <a-empty :description="`[${item.describe}:${item.slotName}]插槽没有使用`"/>
26
26
  </slot>
27
27
  </template>
28
- <x-add-native-form v-else :ref="`nativeForm-${index}`"/>
28
+ <x-add-native-form @x-form-item-emit-func="emitFunc" v-else :ref="`nativeForm-${index}`"/>
29
29
  </div>
30
30
  </a-col>
31
31
  </a-row>
@@ -61,9 +61,13 @@ export default {
61
61
  },
62
62
  props: {},
63
63
  watch: {},
64
- computed: {
65
- },
64
+ computed: {},
66
65
  methods: {
66
+ setRef (refName, refValue) {
67
+ if (!this.$refs[refName]) {
68
+ this.$refs[refName] = refValue
69
+ }
70
+ },
67
71
  /**
68
72
  * 初始化
69
73
  * @param groups 表单组诗句
@@ -72,7 +76,13 @@ export default {
72
76
  * @param env 环境
73
77
  * @param showLeftTab 是否展示左侧索引页
74
78
  */
75
- init ({ groups, modifyModelData = {}, serviceName = process.env.VUE_APP_SYSTEM_NAME, env = 'prod', showLeftTab = false }) {
79
+ init ({
80
+ groups,
81
+ modifyModelData = {},
82
+ serviceName = process.env.VUE_APP_SYSTEM_NAME,
83
+ env = 'prod',
84
+ showLeftTab = false
85
+ }) {
76
86
  Object.assign(this, { groups, modifyModelData, serviceName, env, showLeftTab })
77
87
  this.initView()
78
88
  },
@@ -82,6 +92,15 @@ export default {
82
92
  this.initData(i)
83
93
  }
84
94
  },
95
+ getNativeFormRef (group) {
96
+ return this.groups.map((item, index) => {
97
+ if (item.group === group) {
98
+ return this.$refs[`nativeForm-${index}`][0]
99
+ } else {
100
+ return null
101
+ }
102
+ }).filter(ref => ref !== null)
103
+ },
85
104
  initData (index) {
86
105
  // 如果是插槽组件
87
106
  // 不做解析配置处理
@@ -91,7 +110,7 @@ export default {
91
110
  return
92
111
  }
93
112
  // 组织native表单存储的结果
94
- this.allFormData[this.groups[index].groupName] = {}
113
+ this.allFormData[this.groups[index].group] = {}
95
114
  parseConfig(this.groups[index], 'SIMPLE_FORM', this.serviceName, this.env === 'dev').then(res => {
96
115
  this.formList.push(res)
97
116
  let modifyModelData = {}
@@ -120,26 +139,27 @@ export default {
120
139
  onClose () {
121
140
  this.$emit('update:visible', false)
122
141
  },
142
+ // xfromitem 一路传递上来的事件
143
+ emitFunc (func, data) {
144
+ this.$emit('x-form-item-emit-func', func, data)
145
+ },
123
146
  async onSubmit () {
124
147
  let pass = true
125
148
  const promises = this.groups.map((item, index) => {
126
- const nativeFormRef = this.$refs[`nativeForm-${index}`][0]
127
- if (item.group) {
149
+ const nativeFormRef = this.$refs[`nativeForm-${index}`] ? this.$refs[`nativeForm-${index}`][0] : undefined
150
+ if ((item.group || item.slotName) && nativeFormRef && typeof nativeFormRef.asyncSubmit === 'function') {
128
151
  // 如果 ref 存在 asyncSubmit 方法,则调用 asyncSubmit 方法
129
- if (nativeFormRef && typeof nativeFormRef.asyncSubmit === 'function') {
130
- return nativeFormRef.asyncSubmit().then(res => {
131
- this.allFormData[item.groupName] = res.realForm
132
- }).catch(_err => {
133
- pass = false
134
- this.scrollToGroup(index)
135
- })
136
- } else {
137
- console.warn(item.groupName + '未找到组件,或者组件没有 asyncSubmit 方法')
138
- // 如果 ref 不存在或没有 asyncSubmit 方法,则返回一个已解决的 Promise
139
- return Promise.resolve()
140
- }
152
+ return nativeFormRef.asyncSubmit().then(res => {
153
+ this.allFormData[item.slotName || item.group] = res.realForm
154
+ }).catch(_err => {
155
+ pass = false
156
+ this.scrollToGroup(index)
157
+ })
158
+ } else {
159
+ console.warn(item.groupName + '未找到组件,或者组件没有 asyncSubmit 方法')
160
+ // 如果 ref 不存在或没有 asyncSubmit 方法,则返回一个已解决的 Promise
161
+ return Promise.resolve()
141
162
  }
142
- return Promise.resolve()
143
163
  })
144
164
 
145
165
  try {
@@ -161,12 +181,14 @@ export default {
161
181
  <style lang="less" scoped>
162
182
  .XFormGroupClass {
163
183
  height: 100%;
164
- .xFormGroupTitle{
184
+
185
+ .xFormGroupTitle {
165
186
  font-size: 15px;
166
187
  font-weight: bold;
167
188
  color: @primary-color;
168
189
  }
169
- .formGroupContext{
190
+
191
+ .formGroupContext {
170
192
  height: 100%;
171
193
  overflow-y: scroll;
172
194
  }
@@ -42,6 +42,7 @@
42
42
  :query-params-json="queryParamsJson"
43
43
  :show-pagination="showPagination"
44
44
  :customDelete="customDelete"
45
+ :extraHeight="extraHeight"
45
46
  @add="add"
46
47
  @edit="edit"
47
48
  @del="del"
@@ -227,6 +228,11 @@ export default {
227
228
  type: Boolean,
228
229
  default: false
229
230
  },
231
+ // 自适应底部边距
232
+ extraHeight: {
233
+ type: Number,
234
+ default: 80
235
+ }
230
236
  },
231
237
  watch: {
232
238
  logicParam: {
@@ -55,7 +55,7 @@
55
55
  </a-row>
56
56
  <s-table
57
57
  ref="table"
58
- id="XTable"
58
+ :id="uniqueId"
59
59
  :alert="true"
60
60
  :columns="tableColumns"
61
61
  :data="loadData"
@@ -153,6 +153,7 @@ export default {
153
153
  },
154
154
  data () {
155
155
  return {
156
+ uniqueId: `x-table-${this._uid}`, // 使用 _uid 生成唯一 ID
156
157
  // 筛选列加载状态
157
158
  columnSelectLoaded: false,
158
159
  // 预览模式
@@ -247,6 +248,11 @@ export default {
247
248
  customDelete: {
248
249
  type: Boolean,
249
250
  default: false
251
+ },
252
+ // 自适应底部编剧
253
+ extraHeight: {
254
+ type: Number,
255
+ default: 80
250
256
  }
251
257
  },
252
258
  computed: {
@@ -380,7 +386,7 @@ export default {
380
386
  this.$refs.table.refresh(bool)
381
387
  })
382
388
  },
383
- setScrollYHeight ({ extraHeight = 80, id = 'XTable', type = '' }) {
389
+ setScrollYHeight ({ extraHeight = this.extraHeight, id = this.uniqueId, type = '' }) {
384
390
  this.$nextTick(() => {
385
391
  if (typeof extraHeight == 'undefined') {
386
392
  // 默认底部分页32 + 边距48