车间能级提升-智能设备管理系统
zhuguifei
2025-05-13 14681dfe7052cb76eefcc0c17d0a0d708e1ac9dd
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: '维修评价',
    'app-plus': {
      titleNView: {
        buttons: [
          {
            text: '提交',
            fontSize: '14px',
            color: '#FFFFFF',
          },
          {
            text: '',
            fontSize: '14px',
            color: '#FFFFFF',
          },
        ],
      },
    },
  },
}
</route>
<template>
  <view class="bg-base">
    <wd-card type="rectangle">
      <template #title>
        <view class="flex items-center menu-title-box">
          <view class="menu-indicator"></view>
          <view class="ml-1 text-xs">维修概览</view>
        </view>
      </template>
      <wd-steps :active="repairRecordList.length" vertical class="px-4">
        <wd-step v-for="(item, index) in repairRecordList">
          <template #title>
            <view class="flex items-center menu-title-box">
              <view class="ml-1 text-xs">{{ item?.operaResult }}</view>
            </view>
          </template>
          <template #description>
            <view class="flex items-center menu-title-box">
              <view class="ml-1 text-xs">{{ item?.operaUserName }}</view>
              <view class="ml-1 text-xs">{{ item?.handleTime }}</view>
            </view>
          </template>
        </wd-step>
      </wd-steps>
    </wd-card>
 
    <wd-cell-group use-slot border>
      <template #title>
        <view class="flex items-center menu-title-box">
          <view class="menu-indicator"></view>
          <view class="ml-1 text-xs">维修评价</view>
        </view>
      </template>
      <wd-cell title="维修满意度">
        <wd-rate v-model="repairFb.repairSatisfaction" change="handleChange"></wd-rate>
      </wd-cell>
      <wd-cell title="维修及时性">
        <wd-rate v-model="repairFb.repairTimeliness" change="handleChange"></wd-rate>
      </wd-cell>
      <wd-cell title="维修及态度">
        <wd-rate v-model="repairFb.serviceAttitude" change="handleChange"></wd-rate>
      </wd-cell>
      <wd-cell title="维修现场6S">
        <wd-rate v-model="repairFb.repairSs" change="handleChange"></wd-rate>
      </wd-cell>
 
      <wd-textarea
        label="结果反馈"
        label-width="200rpx"
        type="textarea"
        v-model="repairFb.fbResult"
        auto-height
        :maxlength="200"
        show-word-limit
        placeholder="请输入结果反馈"
        clearable
      />
      <wd-textarea
        label="意见或建议"
        label-width="200rpx"
        type="textarea"
        v-model="repairFb.suggestions"
        auto-height
        :maxlength="200"
        show-word-limit
        placeholder="请输入意见或建议"
        clearable
      />
    </wd-cell-group>
  </view>
</template>
<script setup lang="ts">
import {
  getRepairRes,
  getRepairFb,
  getRepairRecordList,
  addRepairFb,
  updateRepairFb,
} from '@/service/repair'
import { reactive } from 'vue'
import { isLeader, isOperatorOrRepair } from '@/utils/RoleUtils'
import { RepairResVO, RepairFbVO, RepairRecordVO } from '@/service/repair.d'
 
const isUpdate = ref(false)
const repairRes = reactive<RepairResVO>({
  id: '',
  resCode: '',
  reqType: '',
  reqDesc: '',
  equName: '',
  assetNo: '',
  fixtureName: '',
  resReason: '',
  status: '',
  resHandle: '',
  resPrevent: '',
  fbId: '',
  remark: '',
})
 
const repairFb = reactive<RepairFbVO>({
  id: '',
  resId: '',
  resCode: '',
  fbResult: '',
  suggestions: '',
  repairSatisfaction: 0,
  repairTimeliness: 0,
  serviceAttitude: 0,
  repairSs: 0,
})
 
const repairRecordList = ref<RepairRecordVO[]>([])
 
function handleChange({ value }) {
  console.log(value)
}
 
function getRepairRecord() {
  if (!repairRes.id) {
    return false
  }
  const params = {
    resId: repairRes.id,
  }
  getRepairRecordList(params)
    .then((res: any) => {
      console.error(res)
      if (res?.code === 200) {
        repairRecordList.value = res?.rows?.sort((a, b) => {
          if (a.handleTime < b.handleTime) {
            return -1
          }
          if (a.handleTime > b.handleTime) {
            return 1
          }
          return 0
        })
      }
    })
    .catch((res) => {})
}
 
function initRepairRes(id: any) {
  getRepairRes(id)
    .then((res: any) => {
      Object.assign(repairRes, res)
      if (repairRes.fbId != null) {
        getFeedBack(repairRes.fbId)
      }
      getRepairRecord()
    })
    .catch((res) => {})
}
 
function getFeedBack(id: any) {
  getRepairFb(id)
    .then((res: any) => {
      // 在这里进行数据类型转换
      res.repairSatisfaction = Number(res?.repairSatisfaction)
      res.repairTimeliness = Number(res?.repairTimeliness)
      res.serviceAttitude = Number(res?.serviceAttitude)
      res.repairSs = Number(res?.repairSs)
      Object.assign(repairFb, res)
    })
    .catch((res) => {})
}
 
function handleRepairFb() {
  if(isOperatorOrRepair()){
    uni.showToast({
      title: '无权限,请登录管理员账号操作',
      icon: 'none',
    })
    return false
  }
  const id = repairFb.id
  isUpdate.value = !!id
  if (isUpdate.value) {
    updateRepairFb(repairFb)
      .then((res: any) => {
        if (res?.code === 200) {
          uni.showToast({
            title: '修改成功',
            icon: 'none',
          })
        }
      })
      .catch((res) => {})
  } else {
    addRepairFb(repairFb)
      .then((res: any) => {
        if (res?.code === 200) {
          uni.showToast({
            title: '评价成功',
            icon: 'none',
          })
        }
      })
      .catch((res) => {})
  }
}
 
async function initData(options: any) {
  repairFb.resId = options.id
  initRepairRes(options.id)
}
 
onNavigationBarButtonTap((e) => {
  if (e.index === 0) {
    handleRepairFb()
  }
})
 
onLoad((options) => {
  initData(options)
})
</script>
 
<style scoped lang="scss">
.menu-indicator {
  width: 6rpx;
  height: 24rpx;
  border-radius: 10rpx;
  background-color: $uni-color-primary;
}
</style>