@bsgoal/common 2.7.6 → 2.7.9
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
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @Author: canlong.shen
|
|
3
3
|
* @Date: 2023-04-10 15:00:00
|
|
4
4
|
* @LastEditors: canlong.shen
|
|
5
|
-
* @LastEditTime: 2023-05-30
|
|
5
|
+
* @LastEditTime: 2023-05-30 14:07:00
|
|
6
6
|
* @FilePath: \common\src\components\bsgoal-base-form\demo.vue
|
|
7
7
|
* @Description: 表单公共组件演示组件
|
|
8
8
|
*
|
|
@@ -33,14 +33,26 @@ const confirm = () => {
|
|
|
33
33
|
})
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
const bindModel = ref({ prop1: '111', prop99: 1, prop101: '否', prop102: '0'
|
|
36
|
+
const bindModel = ref({ prop1: '111', prop99: 1, prop101: '否', prop102: '0', _prop104: '' })
|
|
37
|
+
|
|
38
|
+
|
|
37
39
|
|
|
38
40
|
// 配置项
|
|
39
41
|
const configOptions = ref([
|
|
40
|
-
|
|
42
|
+
{
|
|
41
43
|
label: 'prop104',
|
|
42
44
|
prop: '_prop104',
|
|
43
|
-
|
|
45
|
+
validator:true,
|
|
46
|
+
rules: [
|
|
47
|
+
{
|
|
48
|
+
validator: (rule, value, callback) => {
|
|
49
|
+
console.log('value', value)
|
|
50
|
+
|
|
51
|
+
return callback(new Error('Please input the age'))
|
|
52
|
+
},
|
|
53
|
+
trigger: 'change'
|
|
54
|
+
}
|
|
55
|
+
]
|
|
44
56
|
},
|
|
45
57
|
{
|
|
46
58
|
label: 'prop103',
|
|
@@ -49,7 +61,8 @@ const configOptions = ref([
|
|
|
49
61
|
formatter: (value = '') => {
|
|
50
62
|
return `${value}`.match(/^\d{1,}$/) ? value : ''
|
|
51
63
|
},
|
|
52
|
-
placeholder: ''
|
|
64
|
+
placeholder: '',
|
|
65
|
+
rules:true
|
|
53
66
|
},
|
|
54
67
|
|
|
55
68
|
{
|
|
@@ -249,9 +262,9 @@ const configOptions = ref([
|
|
|
249
262
|
:config-options="configOptions"
|
|
250
263
|
:bind-model="bindModel"
|
|
251
264
|
>
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
265
|
+
<template #_prop104>
|
|
266
|
+
6666
|
|
267
|
+
</template>
|
|
255
268
|
</BsgoalBaseForm>
|
|
256
269
|
<el-button type="primary" @click="confirm">提交</el-button>
|
|
257
270
|
</div>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @Author: canlong.shen
|
|
3
3
|
* @Date: 2023-04-17 11:44:29
|
|
4
4
|
* @LastEditors: canlong.shen
|
|
5
|
-
* @LastEditTime: 2023-05-30
|
|
5
|
+
* @LastEditTime: 2023-05-30 14:24:25
|
|
6
6
|
* @FilePath: \common\src\components\bsgoal-base-form\index.vue
|
|
7
7
|
* @Description: 表单公共组件
|
|
8
8
|
*
|
|
@@ -175,15 +175,13 @@ const configOptionsGet = computed(() => {
|
|
|
175
175
|
const { configOptions } = props
|
|
176
176
|
const options = unref(configOptions)
|
|
177
177
|
const reOptions = options.map((option) => {
|
|
178
|
-
let { rules = [], label = '' } = option
|
|
178
|
+
let { rules = [], label = '', prop = ''} = option
|
|
179
179
|
const requiredRule = { required: true, message: `${label}不能为空`, trigger: 'blur' }
|
|
180
180
|
if (isBoolean(rules) && rules) {
|
|
181
181
|
rules = [requiredRule]
|
|
182
|
-
} else if (Array.isArray(rules) && !!rules.length) {
|
|
183
|
-
rules = [requiredRule
|
|
184
|
-
}
|
|
185
|
-
rules = []
|
|
186
|
-
}
|
|
182
|
+
} else if ( !prop.startsWith('_') && Array.isArray(rules) && !!rules.length ) {
|
|
183
|
+
rules = [ requiredRule ,...rules,]
|
|
184
|
+
}
|
|
187
185
|
option.rules = rules
|
|
188
186
|
return option
|
|
189
187
|
})
|
|
@@ -436,7 +434,7 @@ defineExpose({
|
|
|
436
434
|
:key="key"
|
|
437
435
|
>
|
|
438
436
|
<el-col :class="{ 'base_form--visible': !visible }" :xs="24" :sm="24" :md="medium">
|
|
439
|
-
<el-form-item :label="label" :prop="prop" :rules="rules">
|
|
437
|
+
<el-form-item :label="label" :prop="prop" :rules="rules" :required="!!rules.length">
|
|
440
438
|
<slot :name="[prop]" :option="{ readonly, value: model[prop], values: model }">
|
|
441
439
|
<!-- S 内容组件 -->
|
|
442
440
|
<template v-if="!readonly">
|