Selaa lähdekoodia

fix:修改体重周龄新增逻辑

LYK 2 viikkoa sitten
vanhempi
commit
2e6db1909c

+ 10 - 10
.env.development

@@ -10,21 +10,21 @@
 # 本地环境
 ENV = development
 # 本地环境接口地址
-VITE_API_URL = http://192.168.0.216:9954/
+VITE_API_URL = http://192.168.0.216:9957/
 VITE_API_WECHAT = /wechat/
 VITE_TENANT = default
 
 # 微服务地址
-VITE_ADMIN = dashoo.labsop.admin-34000
-VITE_WORKFLOW = dashoo.labsop.workflow-34000
-VITE_FINANCE = dashoo.labsop.finance-34000
-VITE_SCI = dashoo.labsop.scientific-34000
-VITE_INSTR_ADMIN = dashoo.labsop.apparatus-34000
-VITE_LEARNING = dashoo.labsop.learning-34000
-VITE_PLATFORM_API = dashoo.labsop.platform-34000
-VITE_LABORATORY: dashoo.labsop.laboratory-34000
+VITE_ADMIN = dashoo.labsop.admin-50000
+VITE_WORKFLOW = dashoo.labsop.workflow-50000
+VITE_FINANCE = dashoo.labsop.finance-50000
+VITE_SCI = dashoo.labsop.scientific-50000
+VITE_INSTR_ADMIN = dashoo.labsop.apparatus-50000
+VITE_LEARNING = dashoo.labsop.learning-50000
+VITE_PLATFORM_API = dashoo.labsop.platform-50000
+VITE_LABORATORY: dashoo.labsop.laboratory-50000
 
 #公共配置
 VITE_UPLOAD = http://192.168.0.218:9933/weedfs/upload
 #图片回显域名
-VITE_IMAGE_BASE_URL = http://lims-demo.labsop.cn:34000
+VITE_IMAGE_BASE_URL = http://lims-demo.labsop.cn:50000

+ 74 - 34
src/view/animal/application/components/Application.vue

@@ -49,7 +49,14 @@
                   </div>
                 </template>
               </van-field>
-              <van-field v-model="state.form.maleNumber" label="雄性" placeholder="雄性数量" type="digit">
+              <van-field
+                v-model="state.form.maleNumber"
+                label="雄性"
+                placeholder="雄性数量"
+                type="digit"
+                
+                :rules="rules.sexNumber"
+              >
                 <template #button>
                   <van-stepper v-model="state.form.maleNumber" :min="0" integer />
                 </template>
@@ -244,32 +251,74 @@ const rules = {
   ethicsAdviceFile: [{ required: true, message: '实验动物福利伦理审查意见表不能为空' }],
   licenseNumberFile: [{ required: true, message: '生产许可证副本不能为空' }],
   animalTestDateFile: [{ required: true, message: '近三个月动物质量检测证明不能为空' }],
-  age: [{
-    validator: () => {
-      const value = state.form.age
-      console.log("周龄范围:", value)
-      if (!value || value.min === null || value.min === '' || value.max === null || value.max === '') {
-        return '周龄范围不能为空';
-      } else if (value.min > value.max) {
-        return '最小周龄不能大于最大周龄';
-      }
-      return true;
+  age: [
+    {
+      validator: () => {
+        const value = state.form.age
+        console.log('周龄范围:', value)
+        const min = Number(value?.min)
+        const max = Number(value?.max)
+        if (
+          !value ||
+          value.min === null ||
+          value.min === '' ||
+          value.max === null ||
+          value.max === '' ||
+          isNaN(min) ||
+          isNaN(max)
+        ) {
+          return '周龄范围不能为空'
+        }
+        if (max === 0) {
+          return '最大周龄不能为0'
+        }
+        if (min > max) {
+          return '最小周龄不能大于最大周龄'
+        }
+        return true
+      },
     },
-  }],
-  weight: [{
-    validator: () => {
-      const value = state.form.weight
-      const min = Number(value.min)
-      const max = Number(value.max)
-      console.log("体重范围:", value)
-      if (!value || isNaN(min) || isNaN(max)) {
-        return '体重范围不能为空'
-      } else if (min > max) {
-        return '最小体重不能大于最大体重'
-      }
-      return true;
+  ],
+  weight: [
+    {
+      validator: () => {
+        const value = state.form.weight
+        console.log('体重范围:', value)
+        const min = Number(value?.min)
+        const max = Number(value?.max)
+        if (
+          !value ||
+          value.min === null ||
+          value.min === '' ||
+          value.max === null ||
+          value.max === '' ||
+          isNaN(min) ||
+          isNaN(max)
+        ) {
+          return '体重范围不能为空'
+        }
+        if (max === 0) {
+          return '最大体重不能为0'
+        }
+        if (min > max) {
+          return '最小体重不能大于最大体重'
+        }
+        return true
+      },
     },
-  }],
+  ],
+  sexNumber: [
+    {
+      validator: () => {
+        const male = Number(state.form.maleNumber) || 0
+        const female = Number(state.form.famaleNumber) || 0
+        if (!male && !female) {
+          return '雌性或雄性数量至少填写一个'
+        }
+        return true
+      },
+    },
+  ],
 }
 
 const licenseNumberFileList = ref<any[]>([])
@@ -610,15 +659,6 @@ const onSubmit = async () => {
     return
   }
 
-  if (!state.form.maleNumber && !state.form.famaleNumber) {
-    showNotify({
-      type: 'warning',
-      message: '请输入雄性或雌性数量!',
-    })
-    submitting.value = false // 重置提交状态
-    return
-  }
-
   // 验证自行购买时的必填项
   if (state.form.buyFrom === ProcurementChannels.PURCHASED_BY_MYSELF) {
     if (!state.form.licenseNumberFile.length) {

+ 1 - 1
src/view/animal/applicationRemoval/components/addEdit.vue

@@ -69,7 +69,7 @@
                   class="simple-table__row"
                 >
                   <div class="simple-table__cell" align="center">
-                    {{ formatYmd(item.createdTime) || '-' }}
+                    {{ formatYmd(item.returnDate) || '-' }}
                   </div>
                   <div class="simple-table__cell" align="center">
                   {{ (item.returnMaleNumber || 0) + (item.returnFemaleNumber || 0) }}