@bsgoal/common 2.7.5 → 2.7.6

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": "@bsgoal/common",
3
- "version": "2.7.5",
3
+ "version": "2.7.6",
4
4
  "private": false,
5
5
  "files": [
6
6
  "dist",
@@ -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-26 15:55:40
5
+ * @LastEditTime: 2023-05-30 11:44:19
6
6
  * @FilePath: \common\src\components\bsgoal-base-form\demo.vue
7
7
  * @Description: 表单公共组件演示组件
8
8
  *
@@ -33,13 +33,14 @@ 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:'55'})
37
37
 
38
38
  // 配置项
39
39
  const configOptions = ref([
40
40
  {
41
41
  label: 'prop104',
42
42
  prop: '_prop104',
43
+ rules: true
43
44
  },
44
45
  {
45
46
  label: 'prop103',
@@ -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-23 15:37:32
5
+ * @LastEditTime: 2023-05-30 11:48:20
6
6
  * @FilePath: \common\src\components\bsgoal-base-form\index.vue
7
7
  * @Description: 表单公共组件
8
8
  *
@@ -154,12 +154,10 @@ watchEffect(() => {
154
154
  }
155
155
  const bindValue = unref(model)[prop]
156
156
  // '_xxx 开头都是内容插槽'
157
- if (!prop.startsWith('_')) {
158
- model.value[prop] = bindValue || valuesModel[prop] || value
157
+ model.value[prop] = bindValue || valuesModel[prop] || value
159
158
 
160
- if (isObject(show)) {
161
- watchPropsForShow(show, unref(model), prop)
162
- }
159
+ if (isObject(show)) {
160
+ watchPropsForShow(show, unref(model), prop)
163
161
  }
164
162
  })
165
163
  })
@@ -317,6 +315,22 @@ const triggerValueChange = (type, prop) => {
317
315
  emits('on-change', emitValue)
318
316
  }
319
317
 
318
+ /**
319
+ * @Author: canlong.shen
320
+ * @description: 过滤掉插槽字段
321
+ * @default:
322
+ * @return {*}
323
+ */
324
+ const filterSlotProps = (model = {}) => {
325
+ const rebuildModel = {}
326
+ for (const prop of Object.keys(model)) {
327
+ if (!prop.startsWith('_')) {
328
+ rebuildModel[prop] = model[prop]
329
+ }
330
+ }
331
+ return rebuildModel
332
+ }
333
+
320
334
  /**
321
335
  * @Author: canlong.shen
322
336
  * @description: 表单校验
@@ -327,7 +341,8 @@ const validateForm = (callback = () => {}) => {
327
341
  EL_FORM_REF.value.validate((valid = false, field = {}) => {
328
342
  if (valid) {
329
343
  const validModel = triggerOperationForm()
330
- callback(validModel)
344
+ const cleanModel = filterSlotProps(validModel)
345
+ callback(cleanModel)
331
346
  } else {
332
347
  callback(false)
333
348