ソースを参照

产品档案-编辑后表单清空

jingbb 3 ヶ月 前
コミット
bb6e5c1733
1 ファイル変更25 行追加5 行削除
  1. 25 5
      src/views/BasicData/components/productArchiveModel.vue

+ 25 - 5
src/views/BasicData/components/productArchiveModel.vue

@@ -9,7 +9,7 @@
       @cancel="handleCancel">
         <a-spin :spinning="loading">
          <!-- 主表单区域 -->
-         <a-form ref="form" :model="model" :rules="validatorRules">
+         <a-form ref="formRef" :model="model" :rules="validatorRules">
            <a-row :gutter="24">
              <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="12">
                <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="classId" label="分类(class)">
@@ -117,7 +117,7 @@
   import JSelectInput from '/@/components/Form/src/jeecg/components/JSelectInput.vue';
   import { ref, reactive, toRaw, toRefs, watch, nextTick, onMounted, getCurrentInstance } from 'vue';
   const emit = defineEmits([ 'success']); //定义emit
-  const form = ref()
+  const formRef = ref()
   var visible = ref(false)
   let title = ref('')
   let loading = ref(false)
@@ -138,7 +138,8 @@
     commissionRebate:1,
     notes:'',
     status:1,
-    measurementUnit:'PCE'
+    measurementUnit:'PCE',
+    id:''
   })
   let enforcemmentBasis = ref('')
   const validatorRules = {
@@ -154,7 +155,7 @@
     sm: { span: 15 },
   });
   function handleOk() {
-    form.value
+    formRef.value
           .validate()
           .then(async () => {
               let url = ''
@@ -182,7 +183,26 @@
     
   }
   function handleCancel() {
-    form.value.resetFields()
+    model.value ={
+      classId:'',
+      code:'',
+      chineseName:'',
+      englishName:'',
+      chineseAlias:'',
+      englishAlias:'',
+      model:'',
+      partno:'',
+      orderno:'',
+      drawingno:'',
+      taxRate:'0',
+      harmfulSubstances:0,
+      virtualProduct:0,
+      commissionRebate:1,
+      notes:'',
+      status:1,
+      measurementUnit:'PCE',
+      id:''
+    }
     visible.value = false
     emit('success');
   }