Pārlūkot izejas kodu

fix: 修改问题

szr190 1 mēnesi atpakaļ
vecāks
revīzija
bbfb7e131b
6 mainītis faili ar 185 papildinājumiem un 2 dzēšanām
  1. 21 0
      .hbuilderx/launch.json
  2. 16 0
      src/api/home.ts
  3. 1 1
      src/manifest.json
  4. 7 0
      src/pages.json
  5. 139 0
      src/pages/deviceInfo.vue
  6. 1 1
      vite.config.ts

+ 21 - 0
.hbuilderx/launch.json

@@ -0,0 +1,21 @@
1
+{
2
+    "version" : "1.0",
3
+    "configurations" : [
4
+        {
5
+            "openVueDevtools" : true,
6
+            "type" : "uni-app:app-ios"
7
+        },
8
+        {
9
+            "openVueDevtools" : true,
10
+            "type" : "uni-app:app-android"
11
+        },
12
+        {
13
+            "openVueDevtools" : true,
14
+            "type" : "uni-app:h5"
15
+        },
16
+        {
17
+            "openVueDevtools" : true,
18
+            "type" : "uni-app:miniProgram"
19
+        }
20
+    ]
21
+}

+ 16 - 0
src/api/home.ts

@@ -203,3 +203,19 @@ export function getParkInfo(id: string) {
203 203
     method: 'GET'
204 204
   })
205 205
 }
206
+
207
+// 获取设备信息
208
+export function getDeviceInfo(id: string) {
209
+  return http({
210
+    url: `/device/wx/code/${id}`,
211
+    method: 'GET'
212
+  })
213
+}
214
+
215
+// 查询设备供应商列表
216
+export function getDeviceSupplierAll() {
217
+  return http({
218
+    url: '/device/assets/supplier/all',
219
+    method: 'GET'
220
+  })
221
+}

+ 1 - 1
src/manifest.json

@@ -54,7 +54,7 @@
54 54
     "quickapp" : {},
55 55
     "h5" : {
56 56
         "router" : {
57
-            "base" : "/",
57
+            "base" : "/h5/",
58 58
             "mode" : "history"
59 59
         },
60 60
         "sdkConfigs" : {

+ 7 - 0
src/pages.json

@@ -37,6 +37,13 @@
37 37
         "navigationBarTitleText": "服务区信息",
38 38
         "enablePullDownRefresh": false
39 39
       }
40
+    },
41
+    {
42
+      "path": "pages/deviceInfo",
43
+      "style": {
44
+        "navigationBarTitleText": "设备信息",
45
+        "enablePullDownRefresh": false
46
+      }
40 47
     }
41 48
   ],
42 49
   "subPackages": [

+ 139 - 0
src/pages/deviceInfo.vue

@@ -0,0 +1,139 @@
1
+<template>
2
+  <view>
3
+    <view class="device-info-container">
4
+      <view class="device-info-wrapper">
5
+        <view class="info-title">基本信息</view>
6
+        <view class="info-item">
7
+          <view class="info-item-left">设备编号</view>
8
+          <view class="info-item-value">{{ deviceInfo?.number }}</view>
9
+        </view>
10
+        <view class="info-item">
11
+          <view class="info-item-left">设备名称</view>
12
+          <view class="info-item-value">{{ deviceInfo?.name }}</view>
13
+        </view>
14
+        <view class="info-item">
15
+          <view class="info-item-left">服务区</view>
16
+          <view class="info-item-value">{{ deviceInfo?.parkName }}</view>
17
+        </view>
18
+        <view class="info-item">
19
+          <view class="info-item-left">设备分类</view>
20
+          <view class="info-item-value">{{ deviceInfo?.categoryName }}</view>
21
+        </view>
22
+        <view class="info-item">
23
+          <view class="info-item-left">设备规格</view>
24
+          <view class="info-item-value">{{ deviceInfo?.spec }}</view>
25
+        </view>
26
+        <view class="info-item">
27
+          <view class="info-item-left">负责人</view>
28
+          <view class="info-item-value">{{ deviceInfo?.manageBy?.realname || deviceInfo?.manageBy?.username }}</view>
29
+        </view>
30
+        <view class="info-item">
31
+          <view class="info-item-left">负责人电话</view>
32
+          <view class="info-item-value">{{ deviceInfo?.manageMobile }}</view>
33
+        </view>
34
+        <view class="info-item">
35
+          <view class="info-item-left">供应商名称</view>
36
+          <view class="info-item-value">{{ selectedSupplierName }}</view>
37
+        </view>
38
+        <view class="info-item">
39
+          <view class="info-item-left">供应商联系人</view>
40
+          <view class="info-item-value">{{ deviceInfo?.supplierContact }}</view>
41
+        </view>
42
+        <view class="info-item">
43
+          <view class="info-item-left">供应商电话</view>
44
+          <view class="info-item-value">{{ deviceInfo?.supplierMobile }}</view>
45
+        </view>
46
+        <view class="info-item">
47
+          <view class="info-item-left">维保到期日</view>
48
+          <view class="info-item-value">{{ deviceInfo.maintenanceAt ? deviceInfo.maintenanceAt.slice(0, 10) : '' }}</view>
49
+        </view>
50
+        <view class="info-item">
51
+          <view class="info-item-left">状态</view>
52
+          <view class="info-item-value">{{ ['', '在用', '维修中', '处置', '处置审核', '维保'][deviceInfo?.status] }}</view>
53
+        </view>
54
+        <view class="info-item">
55
+          <view class="info-item-left">所在位置</view>
56
+          <view class="info-item-value">{{ deviceInfo?.position }}</view>
57
+        </view>
58
+      </view>
59
+    </view>
60
+  </view>
61
+</template>
62
+
63
+<script lang="ts" setup>
64
+import { ref, computed } from 'vue'
65
+import { onLoad } from '@dcloudio/uni-app'
66
+import { getDeviceInfo, getDeviceSupplierAll } from '@/api/home'
67
+
68
+const deviceInfo = ref<any>({})
69
+const id = ref<string>('')
70
+const supplierList = ref<any>([])
71
+
72
+const selectedSupplierName = computed(() => {
73
+  const foundSupplier = supplierList.value.find((supplier: any) => supplier.id === deviceInfo.value?.supplierId)
74
+  return foundSupplier ? foundSupplier.name : ''
75
+})
76
+
77
+// 查询设备供应商列表
78
+const getSupplierList = async () => {
79
+  const res = await getDeviceSupplierAll()
80
+  if (res.code === 200) {
81
+    supplierList.value = res.data || []
82
+  }
83
+}
84
+
85
+onLoad(async (options) => {
86
+  id.value = options?.id || ''
87
+  const res = await getDeviceInfo(id.value)
88
+  if (res.code === 200) {
89
+    deviceInfo.value = res.data
90
+    // 查询供应商列表
91
+    await getSupplierList()
92
+  }
93
+})
94
+</script>
95
+
96
+<style lang="scss" scoped>
97
+.device-info-container {
98
+  box-sizing: border-box;
99
+  padding: 24rpx;
100
+  .device-info-wrapper {
101
+    background-color: #fff;
102
+    padding: 30rpx;
103
+    border-radius: 14rpx;
104
+    margin-bottom: 24rpx;
105
+    .info-title {
106
+      font-size: 32rpx;
107
+      color: #1d2129;
108
+      font-weight: bold;
109
+      margin-bottom: 24rpx;
110
+    }
111
+    .info-item {
112
+      display: flex;
113
+      align-items: center;
114
+      justify-content: space-between;
115
+      border-bottom: 1rpx solid #e5e8ed;
116
+      padding: 24rpx 0;
117
+      &:first-child {
118
+        padding-top: 0;
119
+      }
120
+      &:last-child {
121
+        border-bottom: none;
122
+        padding-bottom: 0;
123
+      }
124
+      .info-item-left {
125
+        font-size: 28rpx;
126
+        color: #1d2129;
127
+        width: 200rpx;
128
+      }
129
+      .info-item-value {
130
+        flex: 1;
131
+        font-size: 28rpx;
132
+        color: #737880;
133
+        display: flex;
134
+        justify-content: flex-end;
135
+      }
136
+    }
137
+  }
138
+}
139
+</style>

+ 1 - 1
vite.config.ts

@@ -8,7 +8,7 @@ export default defineConfig(({ command, mode }) => {
8 8
   if (mode === 'development' || mode === 'sandbox') {
9 9
     // 测试环境配置
10 10
     return {
11
-      // base: '/h5/',
11
+      base: '/h5/',
12 12
       plugins: [uni()],
13 13
       // envDir: resolve(__dirname, 'env'),
14 14
       define: {