车间能级提升-智能设备管理系统
baoshiwei
2025-06-12 bab490d2da009c1a23b352b3b964e0c2dd06a0b3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
<route lang="json5" type="page">
{
  layout: 'default',
  needLogin: true,
  style: {
    navigationBarTitleText: '报修详情',
    navigationStyle: 'custom'
  },
}
</route>
<template>
  <view class="bg-base container" safeAreaInsetTopBottom>
    <wd-navbar
      title="报修详情"
      left-arrow
      @click-left="goBack"
      custom-style="background: #4D80F0;"
      safeAreaInsetTop
    ></wd-navbar>
 
    <view class="content">
      <!-- 状态展示 -->
      <view class="status-card">
        <view class="status-header">
          <text class="status-code">{{ repairReq.code }}</text>
          <view class="status-tag">
            <wd-button size="small" v-if="repairReq.status === '0'" type="info">待接单</wd-button>
            <wd-button size="small" v-else-if="repairReq.status === '1'" type="warning">已接单</wd-button>
            <wd-button size="small" v-else-if="repairReq.status === '2'" type="primary">维修中</wd-button>
            <wd-button size="small" v-else-if="repairReq.status === '3'" type="success">已完成</wd-button>
          </view>
        </view>
      </view>
 
      <!-- 设备信息 -->
      <wd-cell-group
        v-if="repairReq.reqType === '1'"
        custom-class="mt-2"
        title="设备信息"
        use-slot
        border
      >
        <wd-cell title="设备名称" title-width="200rpx">
          <text>{{ repairReq.equName }}</text>
        </wd-cell>
        <wd-cell title="资产编号" title-width="200rpx">
          <text>{{ repairReq.assetNo }}</text>
        </wd-cell>
      </wd-cell-group>
 
      <!-- 工具信息 -->
      <wd-cell-group
        v-if="repairReq.reqType === '2'"
        custom-class="mt-2"
        title="工具信息"
        use-slot
        border
      >
        <wd-cell title="工具名称" title-width="200rpx">
          <text>{{ repairReq.fixtureName }}</text>
        </wd-cell>
      </wd-cell-group>
 
      <!-- 报修信息 -->
      <wd-cell-group custom-class="mt-2" title="报修信息" use-slot border>
        <wd-cell title="报修类型" title-width="200rpx">
          <text v-if="repairReq.reqType === '1'">设备类型</text>
          <text v-else-if="repairReq.reqType === '2'">工具类型</text>
          <text v-else-if="repairReq.reqType === '3'">其他类型</text>
        </wd-cell>
        <wd-cell title="发生时间" title-width="200rpx">
          <text>{{ repairReq.occTime }}</text>
        </wd-cell>
        <wd-cell title="报修时间" title-width="200rpx">
          <text>{{ repairReq.reqTime }}</text>
        </wd-cell>
        <wd-cell title="报修人" title-width="200rpx">
          <text>{{ repairReq.reqUserName }}</text>
        </wd-cell>
        <wd-cell title="紧急程度" title-width="200rpx">
          <wd-tag type="danger" v-if="repairReq.urgencyLevel === '1'">紧急</wd-tag>
          <wd-tag type="warning" v-else-if="repairReq.urgencyLevel === '2'">一般</wd-tag>
          <wd-tag type="success" v-else-if="repairReq.urgencyLevel === '3'">普通</wd-tag>
        </wd-cell>
      </wd-cell-group>
 
      <!-- 故障描述 -->
      <wd-cell-group custom-class="mt-2" title="故障描述" use-slot border>
        <view class="description-box">
          <text>{{ repairReq.reqDesc }}</text>
        </view>
      </wd-cell-group>
 
      <!-- 故障图片 -->
      <wd-cell-group v-if="repairReq.faultPicture" custom-class="mt-2" title="故障图片" use-slot border>
        <view class="image-box">
          <image 
            class="fault-image" 
            :src="repairReq.faultPicture" 
            mode="aspectFit"
            @click="previewImage"
          />
        </view>
      </wd-cell-group>
    </view>
  </view>
</template>
 
<script setup lang="ts">
import { reactive, onMounted } from 'vue'
import { useToast } from 'wot-design-uni'
import { getRepairReqList } from '@/service/repair'
import type { RepairReqVO } from '@/service/repair.d'
 
const toast = useToast()
 
// 报修请求数据
const repairReq = reactive<RepairReqVO>({
  id: '',
  code: '',
  status: '',
  occTime: '',
  reqTime: '',
  reqDept: 0,
  reqUser: 0,
  reqDesc: '',
  urgencyLevel: '',
  faultPicture: '',
  reqType: '',
  equId: '',
  repairId: '',
  repairDept: 0,
  repairUser: 0,
  faultType: '',
  remark: '',
  reqUserName: '',
  equName: '',
  assetNo: '',
  fixtureName: ''
})
 
// 获取报修请求详情
function getRepairReqDetail(id: string | number) {
  getRepairReqList({ id })
    .then((res: any) => {
      if (res && res.rows && res.rows.length > 0) {
        Object.assign(repairReq, res.rows[0])
      } else {
        toast.error('获取报修详情失败')
      }
    })
    .catch((err) => {
      console.error('获取报修详情失败', err)
      toast.error('获取报修详情失败')
    })
}
 
// 预览图片
function previewImage() {
  if (repairReq.faultPicture) {
    uni.previewImage({
      urls: [repairReq.faultPicture],
      current: repairReq.faultPicture
    })
  }
}
 
// 返回上一页
function goBack() {
  uni.navigateBack()
}
 
// 页面加载时获取报修详情
onLoad((options) => {
  if (options && options.id) {
    getRepairReqDetail(options.id)
  } else {
    toast.error('参数错误')
    setTimeout(() => {
      goBack()
    }, 1500)
  }
})
</script>
 
<style scoped lang="scss">
.container {
  min-height: 100vh;
  background-color: #f5f5f5;
}
 
.content {
  padding: 20rpx;
}
 
.status-card {
  background-color: #ffffff;
  border-radius: 12rpx;
  padding: 24rpx;
  margin-bottom: 20rpx;
  box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
}
 
.status-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
 
.status-code {
  font-size: 32rpx;
  font-weight: bold;
  color: #333333;
}
 
.description-box {
  padding: 24rpx;
  background-color: #f9f9f9;
  border-radius: 8rpx;
  margin: 16rpx;
  color: #666666;
  line-height: 1.6;
}
 
.image-box {
  padding: 24rpx;
  display: flex;
  justify-content: center;
}
 
.fault-image {
  width: 80%;
  height: 400rpx;
  border-radius: 8rpx;
  box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.1);
}
 
:deep(.wd-cell-group__title) {
  font-size: 28rpx;
  font-weight: bold;
  color: #4D80F0;
}
 
:deep(.wd-cell__title) {
  color: #666666;
}
 
:deep(.wd-cell__value) {
  color: #333333;
  font-weight: 500;
}
</style>