meixioacomponent 0.3.32 → 0.3.35
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/lib/meixioacomponent.common.js +127 -119
- package/lib/meixioacomponent.umd.js +127 -119
- package/lib/meixioacomponent.umd.min.js +28 -28
- package/lib/style/element/index.css +5624 -582
- package/package.json +1 -1
- package/packages/components/proForm/proForm/pro_form.vue +89 -89
- package/packages/components/proForm/proForm/pro_form_item.vue +8 -2
- package/packages/components/style/element/index.css +5624 -582
package/package.json
CHANGED
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
:disabled="disabled"
|
|
34
34
|
v-model="item.value"
|
|
35
35
|
:labelWidth="labelWidth"
|
|
36
|
+
:labelPosition="labelPosition"
|
|
36
37
|
:class="[`form-item-${item.key}`]"
|
|
37
38
|
@formItemConfirm="formItemConfirm"
|
|
38
39
|
@disableWatcherResult="disableWatcherResult"
|
|
@@ -90,28 +91,27 @@
|
|
|
90
91
|
</template>
|
|
91
92
|
|
|
92
93
|
<script>
|
|
93
|
-
import pro_form_itemVue from
|
|
94
|
-
import baseAreaVue from
|
|
95
|
-
import baseUploadVue from
|
|
96
|
-
import pro_formItem_skeletonVue from
|
|
97
|
-
import baseButtonHandleVue from
|
|
94
|
+
import pro_form_itemVue from './pro_form_item.vue'
|
|
95
|
+
import baseAreaVue from '../../base/baseArea/baseArea.vue'
|
|
96
|
+
import baseUploadVue from '../../base/baseUpload/baseUpload.vue'
|
|
97
|
+
import pro_formItem_skeletonVue from './pro_form-item_skeleton.vue'
|
|
98
|
+
import baseButtonHandleVue from '../../base/baseButtonHandle/baseButtonHandle.vue'
|
|
98
99
|
//
|
|
99
|
-
import { ArrayChunk } from
|
|
100
|
+
import { ArrayChunk } from '../../../utils/utils'
|
|
100
101
|
export default {
|
|
101
|
-
name:
|
|
102
|
+
name: 'baseForm',
|
|
102
103
|
data() {
|
|
103
104
|
return {
|
|
104
105
|
handleConfig: [],
|
|
105
106
|
chunkLength: null,
|
|
106
107
|
loading: true,
|
|
107
|
-
}
|
|
108
|
+
}
|
|
108
109
|
},
|
|
109
110
|
created() {},
|
|
110
111
|
mounted() {
|
|
111
112
|
this.$nextTick(() => {
|
|
112
|
-
this.init()
|
|
113
|
-
|
|
114
|
-
});
|
|
113
|
+
this.init()
|
|
114
|
+
})
|
|
115
115
|
},
|
|
116
116
|
props: {
|
|
117
117
|
disabled: {
|
|
@@ -140,7 +140,7 @@ export default {
|
|
|
140
140
|
|
|
141
141
|
labelWidth: {
|
|
142
142
|
type: String,
|
|
143
|
-
default:
|
|
143
|
+
default: '100px',
|
|
144
144
|
},
|
|
145
145
|
|
|
146
146
|
footer: {
|
|
@@ -150,7 +150,7 @@ export default {
|
|
|
150
150
|
|
|
151
151
|
formType: {
|
|
152
152
|
type: String,
|
|
153
|
-
default:
|
|
153
|
+
default: 'default',
|
|
154
154
|
},
|
|
155
155
|
|
|
156
156
|
formConfig: {
|
|
@@ -165,7 +165,7 @@ export default {
|
|
|
165
165
|
|
|
166
166
|
size: {
|
|
167
167
|
type: String,
|
|
168
|
-
default:
|
|
168
|
+
default: 'small',
|
|
169
169
|
},
|
|
170
170
|
},
|
|
171
171
|
components: {
|
|
@@ -177,39 +177,39 @@ export default {
|
|
|
177
177
|
},
|
|
178
178
|
computed: {
|
|
179
179
|
itemWidth() {
|
|
180
|
-
return `${100 / this.chunkLength}
|
|
180
|
+
return `${100 / this.chunkLength}%`
|
|
181
181
|
},
|
|
182
182
|
module: {
|
|
183
183
|
set(val) {
|
|
184
|
-
this.$emit(
|
|
184
|
+
this.$emit('input', val)
|
|
185
185
|
},
|
|
186
186
|
get() {
|
|
187
|
-
return this.$props.value
|
|
187
|
+
return this.$props.value
|
|
188
188
|
},
|
|
189
189
|
},
|
|
190
190
|
flexClass() {
|
|
191
|
-
let labelPosition = this.$props.labelPosition
|
|
192
|
-
if (labelPosition ==
|
|
193
|
-
return
|
|
191
|
+
let labelPosition = this.$props.labelPosition
|
|
192
|
+
if (labelPosition == 'top') {
|
|
193
|
+
return 'flex-column'
|
|
194
194
|
} else {
|
|
195
|
-
return
|
|
195
|
+
return 'flex-row'
|
|
196
196
|
}
|
|
197
197
|
},
|
|
198
198
|
|
|
199
199
|
formdata() {
|
|
200
|
-
let obj = {}
|
|
200
|
+
let obj = {}
|
|
201
201
|
|
|
202
202
|
this.module.forEach((item) => {
|
|
203
203
|
if (!item.renderHide) {
|
|
204
|
-
obj[`${item.key}`] = item.value
|
|
204
|
+
obj[`${item.key}`] = item.value
|
|
205
205
|
}
|
|
206
|
-
})
|
|
206
|
+
})
|
|
207
207
|
|
|
208
|
-
return obj
|
|
208
|
+
return obj
|
|
209
209
|
},
|
|
210
210
|
|
|
211
211
|
formLineList() {
|
|
212
|
-
return ArrayChunk(this.module, this.chunkLength)
|
|
212
|
+
return ArrayChunk(this.module, this.chunkLength)
|
|
213
213
|
},
|
|
214
214
|
},
|
|
215
215
|
methods: {
|
|
@@ -217,163 +217,163 @@ export default {
|
|
|
217
217
|
if (this.$props.form) {
|
|
218
218
|
this.handleConfig = [
|
|
219
219
|
{
|
|
220
|
-
text:
|
|
221
|
-
type:
|
|
220
|
+
text: '取消',
|
|
221
|
+
type: 'info',
|
|
222
222
|
plain: true,
|
|
223
223
|
click: () => {
|
|
224
|
-
this.onCancel()
|
|
224
|
+
this.onCancel()
|
|
225
225
|
},
|
|
226
226
|
},
|
|
227
227
|
{
|
|
228
|
-
text:
|
|
229
|
-
type:
|
|
228
|
+
text: '确定',
|
|
229
|
+
type: 'primary',
|
|
230
230
|
plain: false,
|
|
231
231
|
click: () => {
|
|
232
|
-
this.onSubmit()
|
|
232
|
+
this.onSubmit()
|
|
233
233
|
},
|
|
234
234
|
},
|
|
235
|
-
]
|
|
235
|
+
]
|
|
236
236
|
}
|
|
237
|
-
this.setChunkLength()
|
|
237
|
+
this.setChunkLength()
|
|
238
238
|
},
|
|
239
239
|
setChunkLength() {
|
|
240
|
-
const { formConfig } = this.$props
|
|
240
|
+
const { formConfig } = this.$props
|
|
241
241
|
if (formConfig?.rowNumber) {
|
|
242
|
-
this.chunkLength = formConfig.rowNumber
|
|
243
|
-
return
|
|
242
|
+
this.chunkLength = formConfig.rowNumber
|
|
243
|
+
return
|
|
244
244
|
} else if (this.$props.rowNumber) {
|
|
245
|
-
this.chunkLength = this.$props.rowNumber
|
|
246
|
-
return
|
|
245
|
+
this.chunkLength = this.$props.rowNumber
|
|
246
|
+
return
|
|
247
247
|
}
|
|
248
248
|
|
|
249
|
-
let width = this.$refs.proFormWrap.clientWidth
|
|
250
|
-
if (this.$props.formType !=
|
|
251
|
-
this.chunkLength = 1
|
|
252
|
-
return
|
|
249
|
+
let width = this.$refs.proFormWrap.clientWidth
|
|
250
|
+
if (this.$props.formType != 'default') {
|
|
251
|
+
this.chunkLength = 1
|
|
252
|
+
return
|
|
253
253
|
}
|
|
254
254
|
if (width < 1240) {
|
|
255
|
-
this.chunkLength = 2
|
|
256
|
-
return
|
|
255
|
+
this.chunkLength = 2
|
|
256
|
+
return
|
|
257
257
|
}
|
|
258
|
-
this.chunkLength = 3
|
|
258
|
+
this.chunkLength = 3
|
|
259
259
|
},
|
|
260
260
|
|
|
261
261
|
formItemConfirm(params) {
|
|
262
|
-
if (params.config.type ==
|
|
263
|
-
this.formAreaConfirm(params)
|
|
264
|
-
return
|
|
262
|
+
if (params.config.type == 'area') {
|
|
263
|
+
this.formAreaConfirm(params)
|
|
264
|
+
return
|
|
265
265
|
}
|
|
266
|
-
let result = this.submitVerifiData(params)
|
|
267
|
-
console.log(result)
|
|
266
|
+
let result = this.submitVerifiData(params)
|
|
267
|
+
console.log(result)
|
|
268
268
|
if (result) {
|
|
269
|
-
params.this.handleConfirm()
|
|
270
|
-
this.$emit(
|
|
269
|
+
params.this.handleConfirm()
|
|
270
|
+
this.$emit('formItemConfirm', params.config)
|
|
271
271
|
}
|
|
272
272
|
},
|
|
273
273
|
formAreaConfirm(params) {
|
|
274
|
-
let result = this.submitVerifiData(params)
|
|
274
|
+
let result = this.submitVerifiData(params)
|
|
275
275
|
if (result) {
|
|
276
|
-
this.$refs[`area-${params.config.key}`][0].doClose()
|
|
277
|
-
this.$emit(
|
|
276
|
+
this.$refs[`area-${params.config.key}`][0].doClose()
|
|
277
|
+
this.$emit('formItemConfirm', params.config)
|
|
278
278
|
} else {
|
|
279
|
-
this.$message.error(
|
|
279
|
+
this.$message.error('请重新选择')
|
|
280
280
|
}
|
|
281
281
|
},
|
|
282
282
|
submitVerifiData(params) {
|
|
283
|
-
console.log(params)
|
|
283
|
+
console.log(params)
|
|
284
284
|
if (this.$props.rules) {
|
|
285
285
|
// element 验证单条表单修改
|
|
286
|
-
let confrim = true
|
|
287
|
-
const rulesItem = this.$props.rules[params.config.key]
|
|
286
|
+
let confrim = true
|
|
287
|
+
const rulesItem = this.$props.rules[params.config.key]
|
|
288
288
|
if (rulesItem) {
|
|
289
289
|
this.$refs.form.validateField(`${params.config.key}`, (errorMsg) => {
|
|
290
290
|
if (errorMsg) {
|
|
291
|
-
confrim = false
|
|
291
|
+
confrim = false
|
|
292
292
|
}
|
|
293
|
-
})
|
|
293
|
+
})
|
|
294
294
|
}
|
|
295
|
-
return confrim
|
|
295
|
+
return confrim
|
|
296
296
|
} else {
|
|
297
|
-
return true
|
|
297
|
+
return true
|
|
298
298
|
}
|
|
299
299
|
},
|
|
300
300
|
|
|
301
301
|
// 返回form表单值
|
|
302
302
|
returnFormValue() {
|
|
303
|
-
return this.formdata
|
|
303
|
+
return this.formdata
|
|
304
304
|
},
|
|
305
305
|
// 重置表单的值
|
|
306
306
|
reset() {
|
|
307
|
-
this.$refs.form.resetFields()
|
|
307
|
+
this.$refs.form.resetFields()
|
|
308
308
|
},
|
|
309
309
|
|
|
310
310
|
checkValidate() {
|
|
311
311
|
return new Promise((resolve, reject) => {
|
|
312
312
|
this.$refs.form.validate((validate, Object) => {
|
|
313
313
|
// 滚动至未填写的项目中
|
|
314
|
-
if (JSON.stringify(Object) !=
|
|
315
|
-
this.scrollToItem(Object)
|
|
314
|
+
if (JSON.stringify(Object) != '{}') {
|
|
315
|
+
this.scrollToItem(Object)
|
|
316
316
|
}
|
|
317
|
-
resolve({ result: validate, validateArray: Object })
|
|
318
|
-
})
|
|
319
|
-
})
|
|
317
|
+
resolve({ result: validate, validateArray: Object })
|
|
318
|
+
})
|
|
319
|
+
})
|
|
320
320
|
},
|
|
321
321
|
|
|
322
322
|
scrollToItem(object) {
|
|
323
|
-
let firstKey = null
|
|
323
|
+
let firstKey = null
|
|
324
324
|
for (const key in object) {
|
|
325
325
|
if (!firstKey) {
|
|
326
|
-
firstKey = key
|
|
326
|
+
firstKey = key
|
|
327
327
|
}
|
|
328
328
|
}
|
|
329
|
-
let nodeScope = this.$refs.proFormWrap
|
|
330
|
-
let dom = nodeScope.querySelector(`.form-item-${firstKey}`)
|
|
331
|
-
dom.scrollIntoView()
|
|
329
|
+
let nodeScope = this.$refs.proFormWrap
|
|
330
|
+
let dom = nodeScope.querySelector(`.form-item-${firstKey}`)
|
|
331
|
+
dom.scrollIntoView()
|
|
332
332
|
},
|
|
333
333
|
|
|
334
334
|
async onSubmit() {
|
|
335
335
|
if (this.$props.rules) {
|
|
336
|
-
let validate = await this.checkValidate()
|
|
336
|
+
let validate = await this.checkValidate()
|
|
337
337
|
if (validate.result) {
|
|
338
|
-
this.$emit(
|
|
338
|
+
this.$emit('formSubmit', true)
|
|
339
339
|
} else {
|
|
340
|
-
this.$emit(
|
|
340
|
+
this.$emit('formSubmit', false)
|
|
341
341
|
}
|
|
342
342
|
} else {
|
|
343
|
-
this.$emit(
|
|
343
|
+
this.$emit('formSubmit', true)
|
|
344
344
|
}
|
|
345
345
|
},
|
|
346
346
|
// 取消按钮
|
|
347
347
|
onCancel() {
|
|
348
|
-
this.$emit(
|
|
348
|
+
this.$emit('onCancel')
|
|
349
349
|
},
|
|
350
350
|
|
|
351
351
|
findFormItem(index, cindex) {
|
|
352
|
-
return index * this.chunkLength + cindex
|
|
352
|
+
return index * this.chunkLength + cindex
|
|
353
353
|
},
|
|
354
354
|
|
|
355
355
|
setWatcher(key) {
|
|
356
|
-
let disables = this.$props.disables
|
|
356
|
+
let disables = this.$props.disables
|
|
357
357
|
if (disables) {
|
|
358
|
-
return disables[`${key}`]
|
|
358
|
+
return disables[`${key}`]
|
|
359
359
|
}
|
|
360
|
-
return false
|
|
360
|
+
return false
|
|
361
361
|
},
|
|
362
362
|
|
|
363
363
|
disableWatcherResult(params) {
|
|
364
|
-
this.$emit(
|
|
364
|
+
this.$emit('disableWatcherResult', params)
|
|
365
365
|
},
|
|
366
366
|
},
|
|
367
367
|
watch: {
|
|
368
368
|
chunkLength(newVal, oldVal) {
|
|
369
369
|
if (this.loading) {
|
|
370
370
|
setTimeout(() => {
|
|
371
|
-
this.loading = false
|
|
372
|
-
}, 750)
|
|
371
|
+
this.loading = false
|
|
372
|
+
}, 750)
|
|
373
373
|
}
|
|
374
374
|
},
|
|
375
375
|
},
|
|
376
|
-
}
|
|
376
|
+
}
|
|
377
377
|
</script>
|
|
378
378
|
|
|
379
379
|
<style lang="less" scoped>
|
|
@@ -225,8 +225,10 @@ export default {
|
|
|
225
225
|
},
|
|
226
226
|
mounted() {
|
|
227
227
|
this.$nextTick(() => {
|
|
228
|
-
const { labelWidth } = this.$props
|
|
229
|
-
|
|
228
|
+
const { labelWidth, labelPosition } = this.$props
|
|
229
|
+
if (labelPosition != 'top') {
|
|
230
|
+
this.$refs.formItemRef.parentNode.style.cssText += `;width:calc(100% - ${labelWidth}) !important`
|
|
231
|
+
}
|
|
230
232
|
if (this.$props.disableWatcher) {
|
|
231
233
|
this.triggerDisable(this.$props.value)
|
|
232
234
|
}
|
|
@@ -246,6 +248,10 @@ export default {
|
|
|
246
248
|
type: Boolean,
|
|
247
249
|
default: false,
|
|
248
250
|
},
|
|
251
|
+
labelPosition: {
|
|
252
|
+
type: String,
|
|
253
|
+
default: `right`,
|
|
254
|
+
},
|
|
249
255
|
|
|
250
256
|
value: {},
|
|
251
257
|
|