Jelajahi Sumber

受检单位基本信息增加工商信息

xy 1 Minggu lalu
induk
melakukan
ae89eabddd

+ 35 - 29
yudao-ui-admin-vue3/src/views/pressure2/planNew/boilerDetail.vue

@@ -1,17 +1,18 @@
 <template>
-  <!-- 单位基本信息 -->
+  <!-- 受检单位基本信息 - 始终展开 -->
   <div class="plan-section mb-4">
     <div class="section-title">
       <span>受检单位基本信息</span>
     </div>
-    <el-descriptions :column="3" border>
-      <el-descriptions-item label="单位名称">{{ unitInfo.unitName }}</el-descriptions-item>
-      <el-descriptions-item label="单位地址">{{ unitInfo.unitAddress }}</el-descriptions-item>
-      <!-- <el-descriptions-item label="使用单位联系人">{{ unitInfo.contact }}</el-descriptions-item>
-        <el-descriptions-item label="使用单位联系电话">{{ unitInfo.contactPhone }}</el-descriptions-item>
-        <el-descriptions-item label="区域">{{ unitInfo.equipDistrictName }}</el-descriptions-item>
-        <el-descriptions-item label="街道">{{ unitInfo.equipStreetName }}</el-descriptions-item> -->
-    </el-descriptions>
+    <div class="mb-[5px]">
+      <el-button type="primary" @click="handleUnitCodeFn(unitInfo.id)">工商信息</el-button>
+      <el-descriptions :column="3" border class="flex-1 mt-[10px]">
+        <el-descriptions-item label="单位名称">{{ unitInfo.name || '-' }}</el-descriptions-item>
+        <el-descriptions-item label="登记状态">{{ unitInfo.regstateCn || '-' }}</el-descriptions-item>
+        <el-descriptions-item label="市场主体类型">{{ unitInfo.enterpriseType || '-' }}</el-descriptions-item>
+        <el-descriptions-item label="单位地址">{{ unitInfo.addr || '-' }}</el-descriptions-item>
+      </el-descriptions>
+    </div>
   </div>
 
   <div class="plan-section mb-4">
@@ -450,6 +451,8 @@
       <el-button @click="batchEditLocationVisible = false">取 消</el-button>
     </template>
   </Dialog>
+
+  <unitContainerForm ref="unitContainerFormRef" />
 </template>
 
 <script setup lang="ts" name="PlanNewDetail">
@@ -481,6 +484,8 @@ import {
 } from "@/api/pressure2/equipboilerscheduling";
 import BoilerPlanScheduleDialog
   from "@/views/pressure2/equipboilerscheduling/components/BoilerPlanScheduleDialog.vue";
+import unitContainerForm from '@/components/unitContainerForm/index.vue'
+import { getUnitInfo, UpdateUnitVO } from '@/api/laboratory/unit'
 const router = useRouter()
 
 const props = defineProps({
@@ -519,16 +524,9 @@ const batchEditLocationFormRules = reactive({
   equipDistrict: [{ required: true, message: '请选择设备所在行政区', trigger: 'change' }],
   equipStreet: [{ required: true, message: '请选择设备所在街道', trigger: 'change' }],
 })
-// 单位基本信息
-const unitInfo = ref({
-  unitId: '',
-  unitName: '',
-  unitAddress: '',
-  contact: '',
-  contactPhone: '',
-  equipDistrictName: '',
-  equipStreetName: ''
-})
+// 单位基本信息(通过API获取完整单位信息)
+const unitInfo = ref<UpdateUnitVO>({} as UpdateUnitVO)
+const unitContainerFormRef = ref<InstanceType<typeof unitContainerForm>>()
 
 const equipTypeMap = {
   1: '容器'
@@ -569,6 +567,15 @@ const containerTypeOptions = getStrDictOptions(DICT_TYPE.SYSTEM_EQUIP_BOILER_TYP
 const currentEquip = ref<EquipBoilerSchedulingEquipVO>()
 const currentCheckType = ref<scheduleType>('')
 
+const getUnitDetail = async (unitId: string) => {
+  try {
+    const res = await getUnitInfo({id: unitId})
+    unitInfo.value = res
+  } catch (error) {
+    console.error('获取单位详情失败:', error)
+  }
+}
+
 /** 打开弹窗 */
 const open = async (row: PlanNewPageVO) => {
   equipIds.value = [...new Set([row.equipIds, row.yearEquipIds, row.expiredEquipIds])]
@@ -576,16 +583,7 @@ const open = async (row: PlanNewPageVO) => {
     .join(',')
     .split(',')
 
-  // 设置单位信息
-  unitInfo.value = {
-    unitId: row.unitId || '',
-    unitName: row.unitName || '',
-    unitAddress: row.unitAddress || '',
-    contact: row.contact || '',
-    contactPhone: row.contactPhone || '',
-    equipDistrictName: row.equipDistrictName || '',
-    equipStreetName: row.equipStreetName || ''
-  }
+  row.unitId && await getUnitDetail(row.unitId)
 
   // 初始化查询参数
   queryParams.value = {
@@ -927,6 +925,14 @@ onMounted(() => {
 defineExpose({
   open
 })
+
+// 工商信息
+const handleUnitCodeFn = (id) => {
+  if (!id) {
+    return ElMessage.warning('该单位信息异常!')
+  }
+  unitContainerFormRef.value?.open(id)
+}
 </script>
 
 <style lang="scss" scoped>

+ 35 - 29
yudao-ui-admin-vue3/src/views/pressure2/planNew/pipeDetail.vue

@@ -1,17 +1,18 @@
 <template>
-  <!-- 单位基本信息 -->
+  <!-- 受检单位基本信息 - 始终展开 -->
   <div class="plan-section mb-4">
     <div class="section-title">
       <span>受检单位基本信息</span>
     </div>
-    <el-descriptions :column="3" border>
-      <el-descriptions-item label="单位名称">{{ unitInfo.unitName }}</el-descriptions-item>
-      <el-descriptions-item label="单位地址">{{ unitInfo.unitAddress }}</el-descriptions-item>
-      <!-- <el-descriptions-item label="使用单位联系人">{{ unitInfo.contact }}</el-descriptions-item>
-        <el-descriptions-item label="使用单位联系电话">{{ unitInfo.contactPhone }}</el-descriptions-item>
-        <el-descriptions-item label="区域">{{ unitInfo.equipDistrictName }}</el-descriptions-item>
-        <el-descriptions-item label="街道">{{ unitInfo.equipStreetName }}</el-descriptions-item> -->
-    </el-descriptions>
+    <div class="mb-[5px]">
+      <el-button type="primary" @click="handleUnitCodeFn(unitInfo.id)">工商信息</el-button>
+      <el-descriptions :column="3" border class="flex-1 mt-[10px]">
+        <el-descriptions-item label="单位名称">{{ unitInfo.name || '-' }}</el-descriptions-item>
+        <el-descriptions-item label="登记状态">{{ unitInfo.regstateCn || '-' }}</el-descriptions-item>
+        <el-descriptions-item label="市场主体类型">{{ unitInfo.enterpriseType || '-' }}</el-descriptions-item>
+        <el-descriptions-item label="单位地址">{{ unitInfo.addr || '-' }}</el-descriptions-item>
+      </el-descriptions>
+    </div>
   </div>
 
   <div class="plan-section mb-4">
@@ -520,6 +521,8 @@
       <el-button @click="batchEditLocationVisible = false">取 消</el-button>
     </template>
   </Dialog>
+
+  <unitContainerForm ref="unitContainerFormRef" />
 </template>
 
 <script setup lang="ts" name="PlanNewDetail">
@@ -552,6 +555,8 @@ import PlanScheduleBoilerDialog
 import {ref} from "vue";
 import PipePlanScheduleDialog
   from "@/views/pressure2/pipescheduling/components/PipePlanScheduleDialog.vue";
+import unitContainerForm from '@/components/unitContainerForm/index.vue'
+import { getUnitInfo, UpdateUnitVO } from '@/api/laboratory/unit'
 
 const router = useRouter()
 
@@ -595,16 +600,9 @@ const batchEditLocationFormRules = reactive({
   equipDistrict: [{ required: true, message: '请选择设备所在行政区', trigger: 'change' }],
   equipStreet: [{ required: true, message: '请选择设备所在街道', trigger: 'change' }],
 })
-// 单位基本信息
-const unitInfo = ref({
-  unitId: '',
-  unitName: '',
-  unitAddress: '',
-  contact: '',
-  contactPhone: '',
-  equipDistrictName: '',
-  equipStreetName: ''
-})
+// 单位基本信息(通过API获取完整单位信息)
+const unitInfo = ref<UpdateUnitVO>({} as UpdateUnitVO)
+const unitContainerFormRef = ref<InstanceType<typeof unitContainerForm>>()
 
 const equipTypeMap = {
   1: '容器'
@@ -741,22 +739,22 @@ const handleExpandChange = (row, expandedRows: any[]) => {
 }
 
 /** 打开弹窗 */
+const getUnitDetail = async (unitId: string) => {
+  try {
+    const res = await getUnitInfo({id: unitId})
+    unitInfo.value = res
+  } catch (error) {
+    console.error('获取单位详情失败:', error)
+  }
+}
+
 const open = async (row: PlanNewPageVO) => {
   equipIds.value = [...new Set([row.equipIds, row.yearEquipIds, row.expiredEquipIds])]
     .filter((id) => id) // 过滤掉 null、undefined、空字符串
     .join(',')
     .split(',')
 
-  // 设置单位信息
-  unitInfo.value = {
-    unitId: row.unitId || '',
-    unitName: row.unitName || '',
-    unitAddress: row.unitAddress || '',
-    contact: row.contact || '',
-    contactPhone: row.contactPhone || '',
-    equipDistrictName: row.equipDistrictName || '',
-    equipStreetName: row.equipStreetName || ''
-  }
+  row.unitId && await getUnitDetail(row.unitId)
 
   // 初始化查询参数
   queryParams.value = {
@@ -1237,6 +1235,14 @@ onMounted(() => {
 defineExpose({
   open
 })
+
+// 工商信息
+const handleUnitCodeFn = (id) => {
+  if (!id) {
+    return ElMessage.warning('该单位信息异常!')
+  }
+  unitContainerFormRef.value?.open(id)
+}
 </script>
 
 <style lang="scss" scoped>