Bladeren bron

调整管道设备档案信息组织方式

yangguanjin 6 uur geleden
bovenliggende
commit
dba69ac5f0

+ 45 - 4
src/pages/equipment/detail/components/PipeBaseInfo.vue

@@ -3,7 +3,15 @@
     <!-- 使用单位信息 -->
     <view class="section">
       <view class="section-header">
-        <text class="section-title">使用单位信息</text>
+        <view class="section-header-left">
+          <text class="section-title">使用单位信息</text>
+          <view v-if="pipeSetList.length > 0" class="pipe-set-picker">
+            <wd-picker
+              v-model="currentPipeSetIndexModel"
+              :columns="pipeSetColumns"
+            />
+          </view>
+        </view>
         <view v-if="canEdit" class="action-buttons">
           <view v-if="isEdit" class="operate-btn cancel-btn" @click="handleCancel">
             <text class="operate-btn-text">取消</text>
@@ -590,7 +598,7 @@
 </template>
 
 <script lang="ts" setup>
-import { ref, reactive, watchEffect } from 'vue'
+import { ref, reactive, watchEffect, computed, watch } from 'vue'
 import { updateEquipPipe } from '@/api/pipe/pipeEquip'
 
 interface Props {
@@ -600,17 +608,36 @@ interface Props {
   orderId?: string
   orderItemId?: string
   equipId?: string
+  currentPipeSetIndex?: number
+  pipeSetList?: any[]
+  currentPipeSet?: any
 }
 
 const props = withDefaults(defineProps<Props>(), {
   canEdit: false,
   useOnline: '0',
+  currentPipeSetIndex: 0,
+  pipeSetList: () => [],
+  currentPipeSet: null,
 })
 
 const emit = defineEmits<{
   update: [data: any]
+  'update:currentPipeSetIndex': [index: number]
 }>()
 
+const currentPipeSetIndexModel = computed({
+  get: () => props.currentPipeSetIndex,
+  set: (val) => emit('update:currentPipeSetIndex', val),
+})
+
+const pipeSetColumns = computed(() => [
+  props.pipeSetList.map((item: any, index: number) => ({
+    label: `${item.projectNo}`,
+    value: index,
+  })),
+])
+
 const isEdit = ref(false)
 const originalData = ref<any>(null)
 
@@ -651,6 +678,10 @@ const equipment = reactive<any>({
 })
 
 watchEffect(() => {
+  if (props.currentPipeSet) {
+    Object.assign(equipment, props.currentPipeSet)
+    return
+  }
   if (props.dataSource?.taskOrder) {
     Object.assign(equipment, props.dataSource.taskOrder)
   }
@@ -813,12 +844,22 @@ defineExpose({
   border-bottom: 1px solid #f0f0f0;
 }
 
+.section-header-left {
+  display: flex;
+  flex-flow: row nowrap;
+  align-items: center;
+}
+
 .section-title {
   font-size: 18px;
   font-weight: 600;
   color: #333;
 }
 
+.pipe-set-picker {
+  margin-left: 10px;
+}
+
 .table {
   width: 100%;
   border: 1px solid rgb(225, 228, 233);
@@ -833,11 +874,11 @@ defineExpose({
 
   .table-cell {
     &.title {
-      width: 35%;
+      width: 25%;
     }
 
     &.content {
-      width: 65%;
+      width: 75%;
     }
   }
 }

+ 65 - 14
src/pages/equipment/detail/components/PipeEquipmentInfo.vue

@@ -3,7 +3,15 @@
     <!-- 管道设备信息 -->
     <view class="section">
       <view class="section-header">
-        <text class="section-title">管道设备信息</text>
+        <view class="section-header-left">
+          <text class="section-title">管道设备信息</text>
+          <view v-if="pipeSetList.length > 0" class="pipe-set-picker">
+            <wd-picker
+              v-model="currentPipeSetIndexModel"
+              :columns="pipeSetColumns"
+            />
+          </view>
+        </view>
         <view v-if="canEdit" class="action-buttons">
           <view v-if="isEdit" class="operate-btn cancel-btn" @click="handleCancel">
             <text class="operate-btn-text">取消</text>
@@ -1368,17 +1376,36 @@ interface Props {
   orderId?: string
   orderItemId?: string
   equipId?: string
+  currentPipeSetIndex?: number
+  pipeSetList?: any[]
+  currentPipeSet?: any
 }
 
 const props = withDefaults(defineProps<Props>(), {
   canEdit: false,
   useOnline: '0',
+  currentPipeSetIndex: 0,
+  pipeSetList: () => [],
+  currentPipeSet: null,
 })
 
 const emit = defineEmits<{
   update: [data: any]
+  'update:currentPipeSetIndex': [index: number]
 }>()
 
+const currentPipeSetIndexModel = computed({
+  get: () => props.currentPipeSetIndex,
+  set: (val) => emit('update:currentPipeSetIndex', val),
+})
+
+const pipeSetColumns = computed(() => [
+  props.pipeSetList.map((item: any, index: number) => ({
+    label: `${item.projectNo}`,
+    value: index,
+  })),
+])
+
 const equipment = reactive<any>({
   id: '',
   certificateNo: '',
@@ -1437,17 +1464,14 @@ const pipeList = ref<any[]>([])
 const selectedDistrict = ref<string | number | (string | number)[]>('')
 const showCascader = ref(false)
 
-watch(
-  () => props.equipmentData,
-  (newVal) => {
-    if (newVal) {
-      Object.assign(equipment, newVal)
-      selectedPipeCategoryIndex.value = pipeCategoryOptions.findIndex((item: any) => item.value == equipment.pipeCategory)
-      selectedUseStatusIndex.value = useStatusOptions.findIndex((item: any) => item.value == equipment.useStatus)
-    }
-    pipeList.value = !newVal?.detailSaveReqVOS
-      ? []
-      : newVal.detailSaveReqVOS.map((item: any) => ({
+const updateEquipmentFromData = (data: any) => {
+  if (!data) return
+  Object.assign(equipment, data)
+  selectedPipeCategoryIndex.value = pipeCategoryOptions.findIndex((item: any) => item.value == equipment.pipeCategory)
+  selectedUseStatusIndex.value = useStatusOptions.findIndex((item: any) => item.value == equipment.useStatus)
+  pipeList.value = !data?.detailSaveReqVOS
+    ? []
+    : data.detailSaveReqVOS.map((item: any) => ({
         pipeId: item.id || '',
         pipeName: item.pipeName || '',
         pipeNo: item.pipeNo || '',
@@ -1497,6 +1521,23 @@ watch(
         lastYearCheckConclusion: item.lastYearCheckConclusion || '',
         lastYearCheckProblem: item.lastYearCheckProblem || '',
       }))
+}
+
+watch(
+  () => props.currentPipeSet,
+  (newVal) => {
+    if (newVal) {
+      updateEquipmentFromData(newVal)
+    }
+  },
+  { immediate: true },
+)
+
+watch(
+  () => props.equipmentData,
+  (newVal) => {
+    if (props.currentPipeSet) return
+    updateEquipmentFromData(newVal)
   },
   { immediate: true, deep: true }
 )
@@ -1515,9 +1556,9 @@ function handleAreaConfirm(data: {
   }
 }
 
-const expandedNames = ref<string>('1')
+const expandedNames = ref<string>('0')
 const handleCollapseChange = (detail: any) => {
-  expandedNames.value = String(detail || '')
+  expandedNames.value = String(detail.value || '')
 }
 
 const isEdit = ref(false)
@@ -1697,12 +1738,22 @@ defineExpose({
   border-bottom: 1px solid #eee;
 }
 
+.section-header-left {
+  display: flex;
+  flex-flow: row nowrap;
+  align-items: center;
+}
+
 .section-title {
   font-size: 18px;
   font-weight: 600;
   color: #333;
 }
 
+.pipe-set-picker {
+  margin-left: 10px;
+}
+
 .action-buttons {
   display: flex;
   flex-direction: row;

+ 32 - 21
src/pages/equipment/detail/equipmentDetail.vue

@@ -44,6 +44,9 @@
           :order-id="orderId"
           :order-item-id="orderItemId"
           :equip-id="equipId"
+          v-model:current-pipe-set-index="currentPipeSetIndex"
+          :pipe-set-list="pipeSetList"
+          :current-pipe-set="currentPipeSet"
           @update="handleBaseInfoUpdate"
         />
       </view>
@@ -58,6 +61,9 @@
           :order-id="orderId"
           :order-item-id="orderItemId"
           :equip-id="equipId"
+          v-model:current-pipe-set-index="currentPipeSetIndex"
+          :pipe-set-list="pipeSetList"
+          :current-pipe-set="currentPipeSet"
           @update="handleEquipmentInfoUpdate"
         />
       </view>
@@ -154,11 +160,7 @@
 <script lang="ts" setup>
 import { ref, computed, onMounted, watch } from 'vue'
 import { onLoad, onShow } from '@dcloudio/uni-app'
-import {
-  getFilterReport,
-  getReportTemplateInfo,
-  getReportTemplateBlob,
-} from '@/api/task'
+import { getFilterReport, getReportTemplateInfo, getReportTemplateBlob } from '@/api/task'
 import { PressureCheckerMyTaskStatus, PressureReportType, EquipmentType } from '@/utils/dictMap'
 import { isMainChecker, canViewCheckItem } from '@/utils/equipmentPermissions'
 import { useUserStore } from '@/store/user'
@@ -183,16 +185,18 @@ import { TaskOrderFuncName, requestFunc } from '@/api/ApiRouter/taskOrder'
 import { EquipFuncName, requestFunc as equipRequestFunc } from '@/api/ApiRouter/equipment'
 import NavBar from '@/components/NavBar/NavBar.vue'
 
-
 import { getEquipPipeByTaskOrderId } from '@/api/pipe/pipeEquip'
 
-
-
 const currentTab = ref(0)
 const dataSource = ref<any>({})
 const pageLoading = ref(false)
 const tabList = ref<any[]>([])
 const isInspectMode = ref(false)
+const currentPipeSetIndex = ref(0)
+const pipeSetList = ref<any[]>([])
+const currentPipeSet = computed(() => {
+  return pipeSetList.value[currentPipeSetIndex.value] || null
+})
 const showSelectUserPopup = ref(false)
 const showCheckProject = ref(false)
 const recheckUserGroupList = ref<any[]>([])
@@ -292,7 +296,7 @@ const initTabList = () => {
 
   if (isInspectMode.value === true) {
     tabs.push({ value: '检验项目', id: 'INSPECT' })
-  } 
+  }
   // else {
   //   tabs.push({ value: '历年报告', id: 'HISTORY_REPORT' })
   // }
@@ -350,19 +354,9 @@ const fetchGetOnlineEquipmentDetail = async () => {
         )
         .filter((item: any) => canViewCheckItem(item, userInfo.value, equipment))
 
-      let equipResp = {}
-      if (equipType === EquipmentType.PIPE) {
-        equipResp = await getEquipPipeByTaskOrderId({ taskOrderId: orderId })
-      } else {
-        equipResp = await equipRequestFunc(EquipFuncName.EquipDetail, equipType, { id: equip.equipId })
-      }
-      
       const taskInfo = {
         ...result.data,
-        equipment: {
-          ...equipResp.data,
-          mainCheckerUser: equipment.mainCheckerUser
-        },
+        equipment: {},
         reportList: filteredReportList,
         otherReportList: reportDic.otherReportList,
         isMainChecker: isMain,
@@ -371,6 +365,22 @@ const fetchGetOnlineEquipmentDetail = async () => {
           canViewAll: isMain,
         },
       }
+      let equipResp = {}
+      if (equipType === EquipmentType.PIPE) {
+        equipResp = await getEquipPipeByTaskOrderId({ taskOrderId: orderId })
+        taskInfo.equipment.pipeSetList = equipResp.data
+        taskInfo.equipment.mainCheckerUser = equipment.mainCheckerUser
+        pipeSetList.value = equipResp.data || []
+      } else {
+        equipResp = await equipRequestFunc(EquipFuncName.EquipDetail, equipType, {
+          id: equip.equipId,
+        })
+        taskInfo.equipment = {
+          ...equipResp.data,
+          mainCheckerUser: equipment.mainCheckerUser
+        }
+      }
+      // console.log('taskInfo......', taskInfo)
       dataSource.value = taskInfo
       if (reportDic?.otherReportList?.length && pageType !== 'OTHER_REPORT') {
         tabList.value[3] = { value: '项目文件', id: 'OTHER_REPORT' }
@@ -433,7 +443,8 @@ const showSelectUserPopupFn = async (checkItem: any) => {
       value: item.id,
     }))
 
-    const defaultOption = checkerUserOptionList.find((item: any) => item.value === mainCheckerUserId) || {}
+    const defaultOption =
+      checkerUserOptionList.find((item: any) => item.value === mainCheckerUserId) || {}
     currentReckUser.value = defaultOption
     selectedUserValue.value = defaultOption.value
     recheckUserGroupList.value = checkerUserOptionList