Quellcode durchsuchen

调整检验性质枚举及其映射逻辑

yangguanjin vor 16 Stunden
Ursprung
Commit
daa98e1887

+ 47 - 10
src/pages/pendingPreparation/list/Item.vue

@@ -5,7 +5,11 @@
         <view class="row">
           <text class="item-top-text">
             任务单号:{{ item.orderNo }}
-            <text>(<text :style="{ color: checkTypeColor }">{{ checkType }}</text>)</text>
+            <text>
+              (
+              <text :style="{ color: checkTypeColor }">{{ checkType }}</text>
+              )
+            </text>
           </text>
           <text v-if="item.equipNum" class="item-top-num-box">{{ item.equipNum }}台</text>
         </view>
@@ -17,8 +21,14 @@
 
     <view class="item-center">
       <view class="row-center">
-        <text class="title">检测时间:<text class="text">{{ checkDate }}</text></text>
-        <text class="title">设备注册代码:<text class="text">{{ item.equipCode }}</text></text>
+        <text class="title">
+          检测时间:
+          <text class="text">{{ checkDate }}</text>
+        </text>
+        <text class="title">
+          设备注册代码:
+          <text class="text">{{ item.equipCode }}</text>
+        </text>
         <view class="row">
           <text class="title">主报告状态:</text>
           <view class="status-badge">
@@ -27,20 +37,27 @@
         </view>
       </view>
 
-      <text class="title">使用单位:<text class="text">{{ item.unitName }}</text></text>
+      <text class="title">
+        使用单位:
+        <text class="text">{{ item.unitName }}</text>
+      </text>
       <view class="row-center">
         <text class="title">
-          项目负责人:<text class="text">{{ item?.manager?.nickname }}</text>
+          项目负责人:
+          <text class="text">{{ item?.manager?.nickname }}</text>
         </text>
         <text class="title">
-          主检人:<text class="text">{{ item?.mainCheckerUser?.nickname }}</text>
+          主检人:
+          <text class="text">{{ item?.mainCheckerUser?.nickname }}</text>
         </text>
       </view>
       <text class="title">
-        检验员:<text class="text">{{ checkUsersText }}</text>
+        检验员:
+        <text class="text">{{ checkUsersText }}</text>
       </text>
       <text class="title">
-        检验项目:<text class="text">{{ reportText }}</text>
+        检验项目:
+        <text class="text">{{ reportText }}</text>
       </text>
     </view>
   </view>
@@ -48,8 +65,17 @@
 
 <script lang="ts" setup>
 import { computed } from 'vue'
-import { PressureCheckTypeMap } from '@/utils/dictMap'
+import {
+  PressureCheckTypeMap,
+  BoilerPressureCheckTypeMap,
+  PipeCheckTypeMap,
+  EquipmentType,
+} from '@/utils/dictMap'
 import { PressureCheckerMyTaskStatusMap } from '@/utils/dictMap'
+import { useConfigStore } from '@/store/config'
+
+const configStore = useConfigStore()
+const equipType = configStore.getEquipType()
 
 interface Props {
   item: any
@@ -64,7 +90,18 @@ const emit = defineEmits<{
 }>()
 
 const checkType = computed(() => {
-  return PressureCheckTypeMap[props.item.checkType] || ''
+  let checkTypeMap = BoilerPressureCheckTypeMap
+  switch (equipType) {
+    case EquipmentType.BOILER:
+      checkTypeMap = BoilerPressureCheckTypeMap
+      break
+    case EquipmentType.PIPE:
+      checkTypeMap = PipeCheckTypeMap
+      break
+    default:
+      checkTypeMap = PressureCheckTypeMap
+  }
+  return checkTypeMap[props.item.checkType] || ''
 })
 
 const checkTypeColor = computed(() => {

+ 42 - 10
src/pages/pendingVerification/list/Item.vue

@@ -5,7 +5,11 @@
         <view class="row">
           <text class="item-top-text">
             任务单号:{{ item.orderNo }}
-            <text>(<text :style="{ color: checkTypeColor }">{{ checkType }}</text>)</text>
+            <text>
+              (
+              <text :style="{ color: checkTypeColor }">{{ checkType }}</text>
+              )
+            </text>
           </text>
           <text v-if="item.equipNum" class="item-top-num-box">{{ item.equipNum }}台</text>
         </view>
@@ -17,8 +21,14 @@
 
     <view class="item-center">
       <view class="row-center">
-        <text class="title">检测时间:<text class="text">{{ checkDate }}</text></text>
-        <text class="title">设备注册代码:<text class="text">{{ item.equipCode }}</text></text>
+        <text class="title">
+          检测时间:
+          <text class="text">{{ checkDate }}</text>
+        </text>
+        <text class="title">
+          设备注册代码:
+          <text class="text">{{ item.equipCode }}</text>
+        </text>
         <view class="row">
           <text class="title">主报告状态:</text>
           <view class="status-badge">
@@ -27,20 +37,27 @@
         </view>
       </view>
 
-      <text class="title">使用单位:<text class="text">{{ item.unitName }}</text></text>
+      <text class="title">
+        使用单位:
+        <text class="text">{{ item.unitName }}</text>
+      </text>
       <view class="row-center">
         <text class="title">
-          项目负责人:<text class="text">{{ item?.manager?.nickname }}</text>
+          项目负责人:
+          <text class="text">{{ item?.manager?.nickname }}</text>
         </text>
         <text class="title">
-          主检人:<text class="text">{{ item?.mainCheckerUser?.nickname }}</text>
+          主检人:
+          <text class="text">{{ item?.mainCheckerUser?.nickname }}</text>
         </text>
       </view>
       <text class="title">
-        检验员:<text class="text">{{ checkUsersText }}</text>
+        检验员:
+        <text class="text">{{ checkUsersText }}</text>
       </text>
       <text class="title">
-        检验项目:<text class="text">{{ reportText }}</text>
+        检验项目:
+        <text class="text">{{ reportText }}</text>
       </text>
     </view>
   </view>
@@ -48,8 +65,12 @@
 
 <script lang="ts" setup>
 import { computed } from 'vue'
-import { PressureCheckTypeMap } from '@/utils/dictMap'
+import { PressureCheckTypeMap, BoilerPressureCheckTypeMap, PipeCheckTypeMap, EquipmentType } from '@/utils/dictMap'
 import { PressureCheckerMyTaskStatusMap } from '@/utils/dictMap'
+import { useConfigStore } from '@/store/config'
+
+const configStore = useConfigStore()
+const equipType = configStore.getEquipType()
 
 interface Props {
   item: any
@@ -64,7 +85,18 @@ const emit = defineEmits<{
 }>()
 
 const checkType = computed(() => {
-  return PressureCheckTypeMap[props.item.checkType] || ''
+  let checkTypeMap = BoilerPressureCheckTypeMap
+  switch(equipType) {
+    case EquipmentType.BOILER:
+      checkTypeMap = BoilerPressureCheckTypeMap
+      break
+    case EquipmentType.PIPE: 
+      checkTypeMap = PipeCheckTypeMap
+      break
+    default:
+      checkTypeMap = PressureCheckTypeMap
+  }
+  return checkTypeMap[props.item.checkType] || ''
 })
 
 const checkTypeColor = computed(() => {

+ 8 - 7
src/pages/taskOnlinePage/components/BoilerTaskItemInfo.vue

@@ -10,7 +10,7 @@
       <text class="title">
         检验性质:
         <text class="text">
-          {{ columns.find((col) => col.value === item.checkType)?.label || '-' }}
+          {{ checkType }}
         </text>
       </text>
       <!-- 主报告状态 -->
@@ -43,7 +43,10 @@
 
 <script lang="ts" setup>
 import { computed, ref, watch } from 'vue'
-import { PressureCheckerMyTaskStatus } from '@/utils/dictMap'
+import {
+  BoilerPressureCheckTypeMap,
+  PressureCheckerMyTaskStatus
+} from '@/utils/dictMap'
 
 interface Props {
   item: any
@@ -51,11 +54,9 @@ interface Props {
 
 const props = defineProps<Props>()
 
-const columns = [
-  { label: '定期检验', value: 100 },
-  { label: '年度检查', value: 200 },
-  // { label: '超年限检验', value: 300 },
-]
+const checkType = computed(() => {
+  return BoilerPressureCheckTypeMap[props.item.checkType] || ''
+})
 
 const taskStatusList = [
   { label: '待认领', value: PressureCheckerMyTaskStatus.WAIT_CONFIRM },

+ 30 - 12
src/pages/taskOnlinePage/components/PipeTaskItemInfo.vue

@@ -2,24 +2,45 @@
   <view class="task-center">
     <view class="row-center">
       <!-- 检验日期 -->
-      <text class="title">检验日期:<text class="text">{{ item.checkDate }}</text></text>
+      <text class="title">
+        检验日期:
+        <text class="text">{{ item.checkDate }}</text>
+      </text>
       <!-- 检验性质 -->
-      <text class="title">检验性质:<text class="text">{{ columns.find((col) => col.value === item.checkType)?.label || '-' }}</text></text>
-      <text class="title">主报告状态:<text class="text">{{ taskStatusList.find((col) => col.value === item.taskStatus)?.label || '-' }}</text></text>
+      <text class="title">
+        检验性质:
+        <text class="text">{{ checkType }}</text>
+      </text>
+      <text class="title">
+        主报告状态:
+        <text class="text">
+          {{ taskStatusList.find((col) => col.value === item.taskStatus)?.label || '-' }}
+        </text>
+      </text>
     </view>
     <view class="row-center">
-      <text class="title">工程号:<text class="text">{{ item.projectNo?.split(',')?.join('、') }}</text></text>
+      <text class="title">
+        工程号:
+        <text class="text">{{ item.projectNo?.split(',')?.join('、') }}</text>
+      </text>
     </view>
     <view class="row-center">
-      <text class="title">单位名称:<text class="text">{{ item.unitName }}</text></text>
+      <text class="title">
+        单位名称:
+        <text class="text">{{ item.unitName }}</text>
+      </text>
       <!-- <text class="title">费用:<text class="text">{{ item.fee || '-' }}</text></text> -->
     </view>
   </view>
 </template>
 
 <script lang="ts" setup>
+import { computed } from 'vue'
+import {
+  PipeCheckTypeMap,
+  PressureCheckerMyTaskStatus,
+} from '@/utils/dictMap'
 
-import { PressureCheckerMyTaskStatus } from '@/utils/dictMap'
 
 interface Props {
   item: any
@@ -27,11 +48,9 @@ interface Props {
 
 const props = defineProps<Props>()
 
-const columns = [
-  { label: '定期检验', value: 100 },
-  { label: '年度检查', value: 200 },
-  // { label: '超年限检验', value: 300 },
-]
+const checkType = computed(() => {
+  return PipeCheckTypeMap[props.item.checkType] || ''
+})
 
 const taskStatusList = [
   { label: '待认领', value: PressureCheckerMyTaskStatus.WAIT_CONFIRM },
@@ -44,7 +63,6 @@ const taskStatusList = [
   { label: '报告审批', value: PressureCheckerMyTaskStatus.REPORT_APPROVE },
   { label: '报告报告办结', value: PressureCheckerMyTaskStatus.REPORT_END },
 ]
-
 </script>
 
 <style lang="scss" scoped>

+ 33 - 5
src/pages/taskOnlinePage/components/query/CheckNatureCom.vue

@@ -18,6 +18,16 @@
 
 <script lang="ts" setup>
 import { ref, computed } from 'vue'
+import {
+  EquipmentType,
+  BoilerPressureCheckTypeMap,
+  PipeCheckTypeMap,
+  PressureCheckTypeMap,
+} from '@/utils/dictMap'
+import { useConfigStore } from '@/store/config'
+
+const configStore = useConfigStore()
+const equipType = configStore.getEquipType()
 
 interface Props {
   type: string
@@ -32,11 +42,29 @@ const emit = defineEmits<{
 
 const selectCode = ref<number | undefined>(undefined)
 
-const columns = [
-  { label: '定期检验', value: 100 },
-  { label: '年度检查', value: 200 },
-  // { label: '超年限检验', value: 300 },
-]
+const columns = computed(() => {
+  let checkTypeMap = BoilerPressureCheckTypeMap
+  switch(equipType) {
+    case EquipmentType.BOILER:
+      checkTypeMap = BoilerPressureCheckTypeMap
+      break
+    case EquipmentType.PIPE: 
+      checkTypeMap = PipeCheckTypeMap
+      break
+    default:
+      checkTypeMap = PressureCheckTypeMap
+  }
+
+  const columns = []
+  for (const key in checkTypeMap) {
+    columns.push({
+      label: checkTypeMap[key],
+      value: key,
+    })
+  }
+
+  return columns
+})
 
 const displayLabel = computed(() => {
   if (selectCode.value == null) return ''

+ 22 - 2
src/pages/unClaim/components/TaskItem.vue

@@ -80,8 +80,17 @@
 
 <script lang="ts" setup>
 import { computed } from 'vue'
-import { PressureCheckTypeMap } from '@/pages/unClaim/types'
+import {
+  PressureCheckTypeMap,
+  BoilerPressureCheckTypeMap,
+  PipeCheckTypeMap,
+  EquipmentType,
+} from '@/utils/dictMap'
 import TaskItemInfo from './TaskItemInfo.vue'
+import { useConfigStore } from '@/store/config'
+
+const configStore = useConfigStore()
+const equipType = configStore.getEquipType()
 
 interface Props {
   item: any
@@ -111,7 +120,18 @@ const checkUsers = computed(() => {
 })
 
 const checkType = computed(() => {
-  return PressureCheckTypeMap[props.item.checkType] || ''
+  let checkTypeMap = BoilerPressureCheckTypeMap
+  switch (equipType) {
+    case EquipmentType.BOILER:
+      checkTypeMap = BoilerPressureCheckTypeMap
+      break
+    case EquipmentType.PIPE:
+      checkTypeMap = PipeCheckTypeMap
+      break
+    default:
+      checkTypeMap = PressureCheckTypeMap
+  }
+  return checkTypeMap[props.item.checkType] || ''
 })
 
 const checkTypeColor = computed(() => {

+ 34 - 11
src/pages/unClaim/components/query/CheckNatureCom.vue

@@ -1,12 +1,7 @@
 <template>
   <view class="check-nature-box">
     <view class="title" :style="textStyle">检验性质:</view>
-    <wd-picker
-      class="nature-picker"
-      v-model="selectCode"
-      :columns="columns"
-      @confirm="onConfirm"
-    >
+    <wd-picker class="nature-picker" v-model="selectCode" :columns="columns" @confirm="onConfirm">
       <view class="nature-input">
         <text :class="['nature-text', { 'nature-text--placeholder': !displayLabel }]">
           {{ displayLabel || '请选择' }}
@@ -18,6 +13,16 @@
 
 <script lang="ts" setup>
 import { ref, computed } from 'vue'
+import {
+  EquipmentType,
+  BoilerPressureCheckTypeMap,
+  PipeCheckTypeMap,
+  PressureCheckTypeMap,
+} from '@/utils/dictMap'
+import { useConfigStore } from '@/store/config'
+
+const configStore = useConfigStore()
+const equipType = configStore.getEquipType()
 
 interface Props {
   type: string
@@ -32,11 +37,29 @@ const emit = defineEmits<{
 
 const selectCode = ref<number | undefined>(undefined)
 
-const columns = [
-  { label: '定期检验', value: 100 },
-  { label: '年度检查', value: 200 },
-  // { label: '超年限检验', value: 300 },
-]
+const columns = computed(() => {
+  let checkTypeMap = BoilerPressureCheckTypeMap
+  switch(equipType) {
+    case EquipmentType.BOILER:
+      checkTypeMap = BoilerPressureCheckTypeMap
+      break
+    case EquipmentType.PIPE: 
+      checkTypeMap = PipeCheckTypeMap
+      break
+    default:
+      checkTypeMap = PressureCheckTypeMap
+  }
+
+  const columns = []
+  for (const key in checkTypeMap) {
+    columns.push({
+      label: checkTypeMap[key],
+      value: key,
+    })
+  }
+
+  return columns
+})
 
 const displayLabel = computed(() => {
   if (selectCode.value == null) return ''

+ 11 - 0
src/utils/dictMap.ts

@@ -81,6 +81,17 @@ export const PressureCheckTypeMap: Record<number, string> = {
   [PressureCheckType.EXPIRED]: '超年限检验',
 }
 
+export const BoilerPressureCheckTypeMap: Record<number, string> = {
+  [PressureCheckType.REGULAR]: '内部检验',
+  [PressureCheckType.ANNUAL]: '外部检验',
+  [PressureCheckType.EXPIRED]: '耐压检验',
+}
+
+export const PipeCheckTypeMap: Record<number, string> = {
+  [PressureCheckType.REGULAR]: '定期检验',
+  [PressureCheckType.ANNUAL]: '年度检查',
+}
+
 export const EquipmentStatusMap: Record<number, string> = {
   [PressureCheckType.REGULAR]: '在用',
   [PressureCheckType.ANNUAL]: '停运',