Procházet zdrojové kódy

修复单选取消选中功能导致的子表内单选组件数据不保存bug

cfort před 2 roky
rodič
revize
e8912f3969

+ 10 - 6
src/business/platform/form/formrender/dynamic-form/dynamic-form-field.vue

@@ -123,7 +123,7 @@
                     :border="fieldOptions.border"
                     :style="{ display: fieldOptions.arrangement === 'vertical' ? 'block' : null }"
                     class="ibps-pt-5"
-                    @click.native.stop.prevent="pendingRes(o.val)"
+                    @click.native.stop.prevent="handleRadioChange(o.val)"
                 >
                     {{ o.label }}
                 </component>
@@ -997,12 +997,16 @@ export default {
         }
     },
     methods: {
-        pendingRes(event){
-            if(this.dataModel!=event){
-                this.dataModel=event
-            }else{
-                this.dataModel=null
+        handleRadioChange (val) {
+            if (this.dataModel === val) {
+                this.dataModel = null
+            } else {
+                this.dataModel = val
             }
+            // 因@click.native.stop.prevent修饰符阻止了父元素的事件监听,需手动触发el-radio-group的change事件
+            this.$nextTick(() => {
+                this.$emit('change', this.dataModel)
+            })
         },
         // 日期格式调整
         selectTime (val) {