Kaynağa Gözat

组件注册问题;子表按钮index为undefined

cyy 1 yıl önce
ebeveyn
işleme
93296a0958

+ 11 - 3
src/business/platform/form/dynamic-form/form-table.vue

@@ -173,7 +173,7 @@
                           class="ibps-mr-5"
                           :color="button.type | optionsFilter(colorOptions,'color','type')"
                           :text-color="button.type | optionsFilter(colorOptions,'textColor','type')"
-                          @click.stop="handleActionEvent(button)"
+                          @click.stop="handleActionEvent(button,j)"
                         >
                           {{ button.label }}</van-tag>
                       </template>
@@ -247,6 +247,12 @@
         />
       </div>
     </van-popup>
+    <component
+      :is="dialogTemplate"
+      v-if="dialogTemplate"
+      ref="dialogTemplate"
+      v-bind="dialogTemplateAtts"
+    />
   </div>
 </template>
 <script>
@@ -257,7 +263,8 @@ import { hasPermission } from '../constants/buttonTypes'
 import { colorOptions } from '@/constants/btnColor'
 import clickoutside from '@/utils/clickoutside'
 
-import JForm from '../utils/JForm'// 自定义脚本
+const JForm = window.JForm
+// import JForm from '../utils/JForm'// 自定义脚本
 const COLLAPSE_NAME_KEY = 'table_'
 export default {
   name: 'form-table',
@@ -331,7 +338,8 @@ export default {
       dialogFormIndex: -1,
 
       importTableDialogVisible: false,
-
+      dialogTemplate: null,
+      dialogTemplateAtts: {},
       inputValue: '',
       toggle: this._getItem(),
       colorOptions

+ 21 - 2
src/business/platform/form/formrender/formrender.vue

@@ -35,6 +35,18 @@
       />
     </slot>
     <slot ref="frExt" name="fr-ext" />
+    <component
+      :is="dialogTemplate"
+      v-if="dialogTemplate"
+      ref="dialogTemplate"
+      v-bind="dialogTemplateAtts"
+    />
+    <!-- <component
+      :is="customComponent"
+      v-if="customComponent"
+      ref="customComponent"
+      v-bind="customComponentAtts"
+    /> -->
   </div>
 </template>
 
@@ -99,7 +111,8 @@ export default {
       curActiveStep: 0,
       curTime: new Date().getTime(),
       stepLoading: false,
-
+      dialogTemplate: null,
+      dialogTemplateAtts: {},
       btnNum: this.getBtnNumByWidth()
     }
   },
@@ -196,6 +209,10 @@ export default {
     if (script) {
       script.parentNode.removeChild(script)
     }
+    /*清除缓存 */
+    if (this.formDef.key) {
+      JForm.cleanEvents()
+    }
   },
   methods: {
     getBtnNumByWidth() {
@@ -419,7 +436,9 @@ export default {
      * 设置字段数据
      */
     setData(name, value) {
-      return this.getForm().setFieldData(name, value)
+      setTimeout(() => {
+        return this.getForm().setFieldData(name, value)
+      }, 200);
     },
     /**
      * 设置表单权限