巡检-早于巡检时间,禁止提交
This commit is contained in:
@@ -77,6 +77,7 @@
|
||||
file-field-name="file"
|
||||
uploadUrl="/api/butler/file/uploadImage"
|
||||
@fail="onUploadFail"
|
||||
:disabled="disableUpload"
|
||||
></filePicker>
|
||||
</view>
|
||||
<view class="filePickerbox showimagegrid" v-else>
|
||||
@@ -92,7 +93,14 @@
|
||||
</view>
|
||||
</view>
|
||||
</uni-forms>
|
||||
<view class="submitbox" @tap="handleSubmit(ite)" v-if="!ite.complated">
|
||||
<view
|
||||
class="submitbox"
|
||||
@tap="handleSubmit(ite)"
|
||||
v-if="!ite.complated"
|
||||
:class="{
|
||||
disable: disableUpload
|
||||
}"
|
||||
>
|
||||
<text>提交</text>
|
||||
</view>
|
||||
<view class="line" v-if="ind + 1 < item.points.length"> </view>
|
||||
@@ -149,6 +157,26 @@ const rules = {
|
||||
}
|
||||
}
|
||||
|
||||
// 限制提交任务时间段 true 不可以提交 false 可以提交
|
||||
const disableUpload = computed(() => {
|
||||
if (info.value) {
|
||||
const day = new Date()
|
||||
const [start, end] = info.value.taskTime.split('-') ?? []
|
||||
if (start && end) {
|
||||
const startTime = day.toLocaleDateString() + ' ' + start + ':00'
|
||||
const endTime = day.toLocaleDateString() + ' ' + end + ':00'
|
||||
if (new Date(startTime).getTime() <= day.getTime()) {
|
||||
return false
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
})
|
||||
function init() {
|
||||
if (!taskid.value) return
|
||||
getInspectionMain(taskid.value)
|
||||
@@ -168,7 +196,6 @@ function init() {
|
||||
files: ite.imgUrl ? ite.imgUrl.split(',') : []
|
||||
}
|
||||
})
|
||||
console.log(points)
|
||||
return {
|
||||
routeName: item.routeName,
|
||||
routeId: item.routeId,
|
||||
@@ -192,7 +219,6 @@ onLoad(options => {
|
||||
})
|
||||
|
||||
// ----------------------------------------------
|
||||
|
||||
function onUploadFail() {
|
||||
uni.showToast({
|
||||
icon: 'error',
|
||||
@@ -200,14 +226,28 @@ function onUploadFail() {
|
||||
})
|
||||
}
|
||||
|
||||
let isSubmit = false
|
||||
|
||||
/** 提交巡检点 检查情况 */
|
||||
function handleSubmit(item) {
|
||||
if (isSubmit) return
|
||||
isSubmit = true
|
||||
if (disableUpload.value) {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '不在任务时间段内',
|
||||
mask: true
|
||||
})
|
||||
isSubmit = false
|
||||
return
|
||||
}
|
||||
if (item.files.length <= 0) {
|
||||
uni.showToast({
|
||||
icon: 'error',
|
||||
mask: true,
|
||||
title: '必须拍照'
|
||||
})
|
||||
isSubmit = false
|
||||
return
|
||||
}
|
||||
uni.showLoading({
|
||||
@@ -243,6 +283,7 @@ function handleSubmit(item) {
|
||||
})
|
||||
.finally(() => {
|
||||
uni.hideLoading()
|
||||
isSubmit = false
|
||||
})
|
||||
}
|
||||
|
||||
@@ -393,6 +434,11 @@ function previewImages(images, currentIndex) {
|
||||
color: #ffffff;
|
||||
line-height: 80rpx;
|
||||
margin-top: 40rpx;
|
||||
|
||||
&.disable {
|
||||
background-color: #ccc;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user