Quellcode durchsuchen

fix:修改动态表单用到updateSchme时 编辑值被清空问题 在formModal上增加了isUpdate字段

zcuishan vor 4 Monaten
Ursprung
Commit
fc5f70ef4e

+ 5 - 0
src/components/SimpleForm/src/SimpleForm.vue

@@ -20,6 +20,7 @@
               <SimpleFormItem
                 :refreshFieldObj="refreshFieldObj"
                 :schema="schema"
+                :is-update="isUpdate"
                 :form-api="formApi"
                 :isWorkFlow="isWorkFlow"
                 v-model:value="formModel[schema.field]"
@@ -115,6 +116,10 @@
       type: Object as PropType<Recordable>,
       default: () => {},
     },
+    isUpdate: {
+      type: Boolean,
+      default: false,
+    },
     //是否是工作流
     isWorkFlow: {
       type: Boolean,

+ 10 - 2
src/components/SimpleForm/src/components/SimpleFormItem.vue

@@ -267,13 +267,17 @@
       type: Boolean,
       default: false,
     },
+    isUpdate: {
+      type: Boolean,
+      default: false,
+    },
   });
 
   const formModel = inject<Recordable>('formModel');
   const formProps = inject<Ref<FormProps>>('formProps');
   const tabActiveKey = inject<Ref<number>>('tabActiveKey', ref(0));
   const activeKey = ref<number>(0);
-
+  formModel.isUpdate = props.isUpdate;
   watch(
     () => tabActiveKey?.value,
     (val) => {
@@ -350,7 +354,11 @@
     let { componentProps = {} } = props.schema;
     if (isFunction(componentProps)) {
       componentProps =
-        componentProps({ schema: props.schema, formModel, formActionType: props.formApi }) ?? {};
+        componentProps({
+          schema: props.schema,
+          formModel,
+          formActionType: props.formApi,
+        }) ?? {};
     } else {
       if (componentProps['events']) {
         for (const eventKey in componentProps['events']) {

+ 1 - 0
src/views/educational/graduate/view.vue

@@ -9,6 +9,7 @@
   const dataInfo = ref<any>({});
   const [tableRef, { reload }] = useTable({
     title: '去向登记记录',
+    bordered: true,
     columns: [
       {
         title: '登记时间',

+ 6 - 1
src/views/form/template/components/FormModal.vue

@@ -20,7 +20,12 @@
     @ok="handleSubmit"
     @cancel="handleClose"
   >
-    <SimpleForm ref="formRef" :formProps="formProps" :formModel="state.formModel" />
+    <SimpleForm
+      ref="formRef"
+      :is-update="state.isUpdate"
+      :formProps="formProps"
+      :formModel="state.formModel"
+    />
   </BasicDrawer>
 </template>
 <script lang="ts" setup>