|
|
@@ -130,7 +130,7 @@ function toggleScore(taskIndex: number, score: number | null) {
|
|
130
|
130
|
|
|
131
|
131
|
const lastIndex = ref(0)
|
|
132
|
132
|
|
|
133
|
|
-async function saveCheckLog({ index }: { index: number }) {
|
|
|
133
|
+async function saveCheckLog({ index, isSubmit = false }: { index: number, isSubmit: boolean }) {
|
|
134
|
134
|
try {
|
|
135
|
135
|
// 获取当前数据
|
|
136
|
136
|
const logs = []
|
|
|
@@ -153,11 +153,13 @@ async function saveCheckLog({ index }: { index: number }) {
|
|
153
|
153
|
|
|
154
|
154
|
// 做一些判断,比如必填项
|
|
155
|
155
|
if (item.hasPhoto === 2 && !item.photoUrl?.length) {
|
|
156
|
|
- throw new Error('请上传照片')
|
|
|
156
|
+ // throw new Error('请上传照片')
|
|
|
157
|
+ // return
|
|
157
|
158
|
}
|
|
158
|
159
|
|
|
159
|
160
|
if (item.hasInput === 1 && !item.inputItem) {
|
|
160
|
|
- throw new Error('请输入内容')
|
|
|
161
|
+ // throw new Error('请输入内容')
|
|
|
162
|
+ // return
|
|
161
|
163
|
}
|
|
162
|
164
|
|
|
163
|
165
|
if (logInfo.result === 2) {
|
|
|
@@ -169,6 +171,7 @@ async function saveCheckLog({ index }: { index: number }) {
|
|
169
|
171
|
// })
|
|
170
|
172
|
// return
|
|
171
|
173
|
// }
|
|
|
174
|
+ // return
|
|
172
|
175
|
}
|
|
173
|
176
|
|
|
174
|
177
|
logs.push(logInfo)
|
|
|
@@ -181,6 +184,13 @@ async function saveCheckLog({ index }: { index: number }) {
|
|
181
|
184
|
// title: '提交成功',
|
|
182
|
185
|
// icon: 'success',
|
|
183
|
186
|
// })
|
|
|
187
|
+ if (isSubmit) {
|
|
|
188
|
+ // 回到详情页
|
|
|
189
|
+ uni.navigateBack({
|
|
|
190
|
+ delta: 1,
|
|
|
191
|
+ })
|
|
|
192
|
+ }
|
|
|
193
|
+
|
|
184
|
194
|
lastIndex.value = index
|
|
185
|
195
|
currentCheckList.value = checkSubItems.value[index]?.items || []
|
|
186
|
196
|
}
|
|
|
@@ -205,13 +215,29 @@ async function saveCheckLog({ index }: { index: number }) {
|
|
205
|
215
|
|
|
206
|
216
|
// 提交任务
|
|
207
|
217
|
function submitTasks() {
|
|
208
|
|
- saveCheckLog({ index: activeArea.value }).then(() => {
|
|
|
218
|
+ saveCheckLog({ index: activeArea.value, isSubmit: false }).then(() => {
|
|
209
|
219
|
// 提交任务
|
|
210
|
|
- handleCheckTask(checkId.value).then(() => {
|
|
211
|
|
- uni.showToast({
|
|
212
|
|
- title: '提交成功',
|
|
213
|
|
- icon: 'success',
|
|
214
|
|
- })
|
|
|
220
|
+ handleCheckTask(checkId.value).then((res: any) => {
|
|
|
221
|
+ // uni.showToast({
|
|
|
222
|
+ // title: '提交成功',
|
|
|
223
|
+ // icon: 'success',
|
|
|
224
|
+ // })
|
|
|
225
|
+ if (res.code === 200) {
|
|
|
226
|
+ uni.showToast({
|
|
|
227
|
+ title: '提交成功',
|
|
|
228
|
+ icon: 'success',
|
|
|
229
|
+ })
|
|
|
230
|
+
|
|
|
231
|
+ uni.navigateBack({
|
|
|
232
|
+ delta: 1,
|
|
|
233
|
+ })
|
|
|
234
|
+ }
|
|
|
235
|
+ else {
|
|
|
236
|
+ uni.showToast({
|
|
|
237
|
+ title: res.msg || '提交失败',
|
|
|
238
|
+ icon: 'none',
|
|
|
239
|
+ })
|
|
|
240
|
+ }
|
|
215
|
241
|
}).catch(() => {
|
|
216
|
242
|
uni.showToast({
|
|
217
|
243
|
title: '提交失败',
|
|
|
@@ -260,6 +286,20 @@ function init() {
|
|
260
|
286
|
})
|
|
261
|
287
|
}
|
|
262
|
288
|
|
|
|
289
|
+const toastHtml = ref('')
|
|
|
290
|
+const popupShow = ref({
|
|
|
291
|
+ centerShow: false,
|
|
|
292
|
+ bottomShow: false,
|
|
|
293
|
+})
|
|
|
294
|
+function helpClick(task: any) {
|
|
|
295
|
+ toastHtml.value = task.checkDescription
|
|
|
296
|
+ popupShow.value.centerShow = true
|
|
|
297
|
+}
|
|
|
298
|
+function helpClose() {
|
|
|
299
|
+ toastHtml.value = ''
|
|
|
300
|
+ popupShow.value.centerShow = false
|
|
|
301
|
+}
|
|
|
302
|
+
|
|
263
|
303
|
onMounted(async () => {
|
|
264
|
304
|
await init()
|
|
265
|
305
|
})
|
|
|
@@ -295,10 +335,10 @@ onMounted(async () => {
|
|
295
|
335
|
<text class="task-text">
|
|
296
|
336
|
{{ task.itemName }}
|
|
297
|
337
|
<wd-icon
|
|
298
|
|
- v-if="task?.icon"
|
|
299
|
|
- :name="task?.icon"
|
|
|
338
|
+ v-if="task?.checkDescription"
|
|
|
339
|
+ name="help-circle"
|
|
300
|
340
|
size="32rpx"
|
|
301
|
|
- @click="() => (popShow.centerShow = true)"
|
|
|
341
|
+ @click="helpClick(task)"
|
|
302
|
342
|
/>
|
|
303
|
343
|
</text>
|
|
304
|
344
|
</view>
|
|
|
@@ -333,8 +373,7 @@ onMounted(async () => {
|
|
333
|
373
|
<view v-if="task.hasPhoto > 0 || (task?.images?.length > 0)" class="image-upload-container">
|
|
334
|
374
|
<!-- 上传按钮 -->
|
|
335
|
375
|
<view
|
|
336
|
|
- v-if="task.hasPhoto > 0"
|
|
337
|
|
- class="upload-btn"
|
|
|
376
|
+ v-if="task.hasPhoto > 0" :class="[task.hasPhoto === 2 ? 'upload-btn-req' : 'upload-btn']"
|
|
338
|
377
|
@tap="chooseImage(+index)"
|
|
339
|
378
|
>
|
|
340
|
379
|
<view class="btn-content">
|
|
|
@@ -389,6 +428,9 @@ onMounted(async () => {
|
|
389
|
428
|
<text class="link-text" @tap="toggleTaskStatus(task)">{{ task.formOperationIssue ? '点击查看异常' : '点击填写异常(未满分必填)' }}</text>
|
|
390
|
429
|
</view>
|
|
391
|
430
|
</view>
|
|
|
431
|
+ <wd-divider color="#EEEEEE" />
|
|
|
432
|
+ <!-- 分割线 -->
|
|
|
433
|
+ <!-- <view class="my-4 border-b border-gray-300" /> -->
|
|
392
|
434
|
</view>
|
|
393
|
435
|
</view>
|
|
394
|
436
|
</scroll-view>
|
|
|
@@ -406,10 +448,27 @@ onMounted(async () => {
|
|
406
|
448
|
<button class="btn" @click="submitTasks">
|
|
407
|
449
|
提交
|
|
408
|
450
|
</button>
|
|
409
|
|
- <button class="btn" @click="saveCheckLog({ index: activeArea.value })">
|
|
|
451
|
+ <button class="btn" @click="saveCheckLog({ index: activeArea.value, isSubmit: true })">
|
|
410
|
452
|
保存
|
|
411
|
453
|
</button>
|
|
412
|
454
|
</view>
|
|
|
455
|
+ <wd-popup
|
|
|
456
|
+ v-model="popupShow.centerShow"
|
|
|
457
|
+ custom-style="border-radius:32rpx;"
|
|
|
458
|
+ @close="helpClose"
|
|
|
459
|
+ >
|
|
|
460
|
+ <view class="popup-content">
|
|
|
461
|
+ <view style="font-size: 36rpx; font-weight: 500; color: #020917">
|
|
|
462
|
+ 说明
|
|
|
463
|
+ </view>
|
|
|
464
|
+ <view style="font-size: 32rpx; font-weight: 400; color: #343a45" v-html="toastHtml" />
|
|
|
465
|
+ <view style="width: 100%">
|
|
|
466
|
+ <button class="btn" @click="helpClose">
|
|
|
467
|
+ 我 知 道 了
|
|
|
468
|
+ </button>
|
|
|
469
|
+ </view>
|
|
|
470
|
+ </view>
|
|
|
471
|
+ </wd-popup>
|
|
413
|
472
|
</view>
|
|
414
|
473
|
</template>
|
|
415
|
474
|
|
|
|
@@ -468,6 +527,7 @@ onMounted(async () => {
|
|
468
|
527
|
// 任务项
|
|
469
|
528
|
.task-item {
|
|
470
|
529
|
margin-bottom: 40rpx;
|
|
|
530
|
+ padding-right: 20px;
|
|
471
|
531
|
|
|
472
|
532
|
// 任务描述
|
|
473
|
533
|
.task-description {
|
|
|
@@ -608,6 +668,35 @@ onMounted(async () => {
|
|
608
|
668
|
}
|
|
609
|
669
|
}
|
|
610
|
670
|
|
|
|
671
|
+ .upload-btn-req {
|
|
|
672
|
+ width: 140rpx;
|
|
|
673
|
+ height: 100rpx;
|
|
|
674
|
+ border: 2rpx dashed red;
|
|
|
675
|
+ border-radius: 8rpx;
|
|
|
676
|
+ display: flex;
|
|
|
677
|
+ align-items: center;
|
|
|
678
|
+ justify-content: center;
|
|
|
679
|
+ flex-shrink: 0;
|
|
|
680
|
+
|
|
|
681
|
+ .btn-content {
|
|
|
682
|
+ display: flex;
|
|
|
683
|
+ flex-direction: column;
|
|
|
684
|
+ align-items: center;
|
|
|
685
|
+
|
|
|
686
|
+ .btn-icon {
|
|
|
687
|
+ font-size: 40rpx;
|
|
|
688
|
+ color: red;
|
|
|
689
|
+ line-height: 40rpx;
|
|
|
690
|
+ }
|
|
|
691
|
+
|
|
|
692
|
+ .btn-text {
|
|
|
693
|
+ font-size: 24rpx;
|
|
|
694
|
+ color: red;
|
|
|
695
|
+ margin-top: 4rpx;
|
|
|
696
|
+ }
|
|
|
697
|
+ }
|
|
|
698
|
+ }
|
|
|
699
|
+
|
|
611
|
700
|
// 已上传图片
|
|
612
|
701
|
.uploaded-images {
|
|
613
|
702
|
display: flex;
|
|
|
@@ -815,4 +904,26 @@ onMounted(async () => {
|
|
815
|
904
|
}
|
|
816
|
905
|
}
|
|
817
|
906
|
}
|
|
|
907
|
+
|
|
|
908
|
+.popup-content {
|
|
|
909
|
+ width: 600rpx;
|
|
|
910
|
+ display: flex;
|
|
|
911
|
+ flex-direction: column;
|
|
|
912
|
+ justify-content: space-between;
|
|
|
913
|
+ align-items: center;
|
|
|
914
|
+ padding: 40rpx;
|
|
|
915
|
+ box-sizing: border-box;
|
|
|
916
|
+ gap: 40rpx;
|
|
|
917
|
+ .btn {
|
|
|
918
|
+ width: 100%;
|
|
|
919
|
+ height: 80rpx;
|
|
|
920
|
+ background-color: #215acd;
|
|
|
921
|
+ color: white;
|
|
|
922
|
+ font-size: 32rpx;
|
|
|
923
|
+ border-radius: 12rpx;
|
|
|
924
|
+ font-weight: 400;
|
|
|
925
|
+ border: none;
|
|
|
926
|
+ outline: none;
|
|
|
927
|
+ }
|
|
|
928
|
+}
|
|
818
|
929
|
</style>
|