ソースを参照

Merge branch 'stable' of http://39.98.153.250:9080/yudao/yudao-admin-yiqun into stable

xzc 1 日 前
コミット
9f4f6fb44e

+ 35 - 0
yudao-ui-admin-vue3/src/views/pressure2/orderConfirm/boilerDetail.vue

@@ -690,6 +690,9 @@ import { cloneDeep } from 'lodash-es'
 import { useUserStoreWithOut } from '@/store/modules/user'
 import { type CheckerItem } from '@/views/pressure2/components/CheckerSelect'
 
+import { getDept } from '@/api/system/dept'
+import { EquipBoilerApi } from '@/api/pressure2/equipboiler'
+
 const { emitter } = useEmitt()
 
 const route = useRoute()
@@ -1836,6 +1839,37 @@ const formattedCheckers = computed(() => {
   return result
 })
 
+const fillNullOrEmptyValWithDefaultVal = (obj, key, defaultValue) => {
+  if(obj[key] == null) {
+    obj[key] = defaultValue
+    return 
+  }
+  if(typeof obj[key] === 'string' && obj[key] === '') {
+      obj[key] = defaultValue
+  }
+}
+
+const fillDefaultVal = async () => {
+  const [equipBoiler, dept] = await Promise.all([
+    EquipBoilerApi.getEquipBoiler(equipList.value[0].id), 
+    getDept(formData.value.deptId)
+  ])
+  if(equipBoiler) {
+    fillNullOrEmptyValWithDefaultVal(formData.value, 'unitContact', equipBoiler?.contact || '')
+    fillNullOrEmptyValWithDefaultVal(formData.value, 'unitPhone', equipBoiler?.contactPhone || '')
+    fillNullOrEmptyValWithDefaultVal(formData.value, 'email', equipBoiler?.contactEmail || '')
+    // fillNullOrEmptyValWithDefaultVal(formData.value, 'recipient', equipBoiler?.recipient || '')
+    // fillNullOrEmptyValWithDefaultVal(formData.value, 'recipientPhone', equipBoiler?.recipientPhone || '')
+    // fillNullOrEmptyValWithDefaultVal(formData.value, 'recipientEmail', equipBoiler?.recipientEmail || '')
+    // fillNullOrEmptyValWithDefaultVal(formData.value, 'payerContactName', equipBoiler?.payment || '')
+    // fillNullOrEmptyValWithDefaultVal(formData.value, 'payerContact', equipBoiler?.paymentPhone || '')
+    // fillNullOrEmptyValWithDefaultVal(formData.value, 'payerMail', equipBoiler?.paymentEmail || '')
+  }
+  if(dept) {
+    fillNullOrEmptyValWithDefaultVal(formData.value, 'deptPhone', dept?.phone || '')
+  }
+}
+
 // 页面加载时获取详情
 onMounted(async () => {
   await getDetail()
@@ -1843,6 +1877,7 @@ onMounted(async () => {
     await handleEquipQuery()
     // await handleGetExceptionInfo('eb9a57fe2ed98a45e1a892aef4cc13f0')
   }
+  await fillDefaultVal()
 })
 </script>
 

+ 37 - 4
yudao-ui-admin-vue3/src/views/pressure2/orderConfirm/pipeDetail.vue

@@ -742,9 +742,12 @@ import {
 import {PipeAppointmentConfirmOrderApi} from "@/api/pressure2/pipeappointmentconfirmorder";
 import { EquipPipeSchedulingApi } from "@/api/pressure2/pipescheduling";
 import {UserQualificationsApi} from "@/api/pressure2/userQualifications";
-import { type CheckerItem } from '@/views/pressure2/components/CheckerSelect'
+import CheckerSelect, { type CheckerItem } from '@/views/pressure2/components/CheckerSelect'
 import { useUserStoreWithOut } from '@/store/modules/user'
 
+import { getDept } from '@/api/system/dept'
+import { EquipPipeApi } from '@/api/pressure2/equippipe'
+
 const { emitter } = useEmitt()
 
 const route = useRoute()
@@ -949,9 +952,6 @@ const formRules = {
   ],
   checkType: [
     { required: true, message: '请选择检验性质', trigger: 'blur' }
-  ],
-  deptId: [
-    { required: true, message: '请选择检验部门', trigger: 'change' }
   ]
 }
 
@@ -2118,6 +2118,38 @@ const handleRemove = (type: string, attach: string) => {
   exceptionInfo.value[attach] = ''
 }
 
+const fillNullOrEmptyValWithDefaultVal = (obj, key, defaultValue) => {
+  if(obj[key] == null) {
+    obj[key] = defaultValue
+    return 
+  }
+  if(typeof obj[key] === 'string' && obj[key] === '') {
+      obj[key] = defaultValue
+  }
+}
+
+const fillDefaultVal = async () => {
+  const [equipPipe, dept] = await Promise.all([
+    EquipPipeApi.getEquipPipe(equipList.value[0].id), 
+    getDept(formData.value.deptId)
+  ])
+  if(equipPipe) {
+    fillNullOrEmptyValWithDefaultVal(formData.value, 'unitContact', equipPipe?.contact || '')
+    fillNullOrEmptyValWithDefaultVal(formData.value, 'unitPhone', equipPipe?.contactPhone || '')
+    fillNullOrEmptyValWithDefaultVal(formData.value, 'email', equipPipe?.contactEmail || '')
+    // fillNullOrEmptyValWithDefaultVal(formData.value, 'recipient', equipPipe?.recipient || '')
+    // fillNullOrEmptyValWithDefaultVal(formData.value, 'recipientPhone', equipPipe?.recipientPhone || '')
+    // fillNullOrEmptyValWithDefaultVal(formData.value, 'recipientEmail', equipPipe?.recipientEmail || '')
+    // fillNullOrEmptyValWithDefaultVal(formData.value, 'payerContactName', equipPipe?.payment || '')
+    // fillNullOrEmptyValWithDefaultVal(formData.value, 'payerContact', equipPipe?.paymentPhone || '')
+    // fillNullOrEmptyValWithDefaultVal(formData.value, 'payerMail', equipPipe?.paymentEmail || '')
+  }
+  if(dept) {
+    fillNullOrEmptyValWithDefaultVal(formData.value, 'deptPhone', dept?.phone || '')
+  }
+}
+
+
 
 // 页面加载时获取详情
 onMounted(async () => {
@@ -2126,6 +2158,7 @@ onMounted(async () => {
     await handleEquipQuery()
     // await handleGetExceptionInfo('eb9a57fe2ed98a45e1a892aef4cc13f0')
   }
+  await fillDefaultVal()
 })
 
 const formattedCheckers = computed(() => {