inspectionProcessing.vue
6 KB
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
<template>
<view class="inspection-form">
<view class="form-container">
<view class="form-screenshot">
<!-- <img
ref="screenshotRef"
:src="screenshotUrl"
crossOrigin
width="100%"
></img> -->
<InspectionPainter
v-if="screenshotUrl"
ref="screenshotRef"
:image-url="screenshotUrl"
/>
</view>
<view class="processing-remark-title">{{ t('maintenance.common.remark') }}</view>
<uv-textarea
v-model="remarkValue"
:placeholder="t('maintenance.common.input')"
:height="110"
border="none"
placeholderStyle="font-size: 13px;"
customStyle="background-color: #F2F3F6;margin-top: 10px;"
></uv-textarea>
</view>
<view class="processing-btn-box" v-if="monitorInfoData.status==1">
<view class="submitBtn" @click="goBackPage">{{ t('app.common.back') }}</view>
<view class="submitBtn submitBtnSubmit" @click="handleSubmit(1)">{{ t('button.submit') }}</view>
<!-- <uv-button class="submitBtn" text="返回" :customStyle="backCustomStyle" @click="goBackPage"></uv-button>
<uv-button class="submitBtn submitBtnSubmit" type="primary" text="提交" :customStyle="submitCustomStyle" @click="handleSubmit(1)"></uv-button -->
</view>
<view class="processing-btn-box" v-if="monitorInfoData.status==2">
<view class="submitBtn failBtnSubmit" @click="handleSubmit(2)">{{ t('button.fail') }}</view>
<view class="submitBtn submitBtnSubmit" @click="handleSubmit(3)">{{ t('button.passAndComplete') }}</view>
<!-- <uv-button class="submitBtn failBtnSubmit" type="error" text="不通过" :customStyle="failCustomStyle" @click="handleSubmit(2)"></uv-button>
<uv-button class="submitBtn submitBtnSubmit" type="primary" text="通过并完成" :customStyle="submitCustomStyle" @click="handleSubmit(3)"></uv-button>
-->
</view>
</view>
</template>
<script setup>
import { ref, } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
import { doPatrolRecordFormSaveApi } from '@/api';
import { getStageObj } from '@/utils'
import { getImageBase64, getFormParams } from './utils'
import InspectionPainter from './components/inspection-painter.vue';
import {
t
} from '@/plugins/index.js'
const backCustomStyle = ref({
'height':'48px',
'background':' #F2F3F6',
'border-radius': '8px',
'border-color':'rgba(109,119,143,0.34)',
})
const submitCustomStyle = ref({
'height':'48px',
'background': 'linear-gradient( 270deg, #387CF5 0%, #5B9FF7 100%)',
'border-radius': '8px',
})
const failCustomStyle = ref({
'height':'48px',
'color': '#FFFFFF',
'background': 'linear-gradient( 270deg, #FF6772 0%, #FF7F88 100%)',
'border-radius': '8px',
})
const remarkValue = ref('')
const monitorInfoData = ref({})
const rules = {
}
const screenshotRef = ref(null)
const screenshotUrl = ref('')
// 返回上一页
function goBackPage() {
uni.navigateBack({
delta: 1,
});
}
// 提交表单
async function handleSubmit(val) {
console.log('handleSubmit', remarkValue.value, screenshotRef)
// const strBase64 = await getImageBase64(screenshotRef.value)
// const strBase64 = await screenshotRef.value.getCanvasBase64H5()
const strBase64 = await screenshotRef.value.getCanvasBase64()
if (strBase64) {
const storeInfo = getStageObj('store')
const params = {
result:val,
recordId: monitorInfoData.value.id,
remark: remarkValue.value,
picBase64s:[strBase64],
}
console.log('params', params)
doPatrolRecordFormSaveApi(params).then(res => {
console.log('doPatrolRecordFormSaveApi', res)
uni.showToast({icon: 'success', title: t('message.submitSuccess')})
uni.navigateBack({
delta:3
})
// uni.redirectTo({
// url: `/pages/inspection/inspectionRecord?origin=processing`,
// })
})
} else {
console.warn('获取base64图片数据失败')
}
}
onLoad((options) => {
console.log('onLoad', options)
screenshotUrl.value = `https://store.keliuyun.com/images/${options.pic}`
// 从localStorage中,获取监控点相关信息
const targetData = uni.getStorageSync('inspectionDetailData')
monitorInfoData.value = JSON.parse(targetData) || {}
console.log('monitorInfoData.value',monitorInfoData.value)
// monitorInfoData.value.status = 2
})
</script>
<style lang="scss" scoped>
.inspection-form {
background: #F2F3F6;
height: calc(100vh - 44px);
padding: 10px 10px 10px 10px;
.processing-btn-box{
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 20px;
.submitBtn{
width: 46vw;
height: 48px;
line-height: 48px;
text-align: center;
background: #fff;
border-radius: 8px;
font-family: PingFangSC, PingFang SC;
font-size: 16px;
}
.submitBtnSubmit{
color: #FFFFFF;
background: linear-gradient( 270deg, #387CF5 0%, #5B9FF7 100%);
}
.failBtnSubmit{
color: #FFFFFF;
background: linear-gradient( 270deg, #FF6772 0%, #FF7F88 100%);
}
}
}
.form-container {
background: #FFFFFF;
border-radius: 8px;
padding: 12px 12px 12px 12px;
.problemList-button {
width: 60px;
height: 24px;
background-color: #F2F3F6;
/* text-align: center; */
display: flex;
justify-content: center;
align-items: center;
border-radius: 30px;
}
.problem-list-container {
display: flex;
flex-wrap: wrap;
border-bottom: 1px solid #e8e8e9;
.problem-tag {
margin-bottom: 10px;
margin-right: 10px;
}
}
.problem-empoty {
height: 40px;
line-height: 40px;
width: 100%;
text-align: center;
}
.processing-remark-title{
margin: 14px 0 12px;
font-family: PingFangSC, PingFang SC;
font-weight: 500;
font-size: 14px;
color: #202328;
line-height: 20px;
}
}
</style>
<style lang="scss">
.inspection-problem-select {
background-color: #FFF;
.uv-action-sheet__item-wrap {
max-height: 60vh;
overflow-y: auto;
}
}
.submitBtn .uv-button .uv-button__text{
font-size: 16px!important;
color: #6D778F!important;
}
.submitBtnSubmit .uv-button .uv-button__text{
color: #FFFFFF!important;
}
</style>