|
@@ -348,7 +348,6 @@
|
|
|
<el-form :model="form" label-width="120px">
|
|
|
<el-form-item label="开始日期">
|
|
|
<el-date-picker
|
|
|
- :disabled-date="disabledStartDate"
|
|
|
v-model="form.startDate"
|
|
|
type="date"
|
|
|
placeholder="请选择开始日期"
|
|
@@ -359,8 +358,8 @@
|
|
|
</el-form-item>
|
|
|
<el-form-item label="结束日期">
|
|
|
<el-date-picker
|
|
|
- :disabled-date="disabledEndDate"
|
|
|
v-model="form.endDate"
|
|
|
+ :disabled-date="disabledEndDate"
|
|
|
type="date"
|
|
|
placeholder="请选择结束日期"
|
|
|
size="default"
|
|
@@ -384,6 +383,7 @@ import { usePublic, showTimeMsg, parseDate } from './hooks/usePublic'
|
|
|
import { parseTime, isValue } from '@/utils/validate'
|
|
|
import * as _ from 'lodash'
|
|
|
import { useLoop } from '@/hooks/useLoop'
|
|
|
+import { ElMessage } from 'element-plus'
|
|
|
|
|
|
const {
|
|
|
optionLeft,
|
|
@@ -418,26 +418,32 @@ const weightNums = ref<number | string>(0)
|
|
|
const specialGoods = ref('全部')
|
|
|
const specialGoodsDatas = ref(['动', '贵', '邮', '鲜', '锂', '全部'])
|
|
|
const weightType = ref('进港')
|
|
|
-const today = parseTime(Date.now(), '{y}-{m}-{d}')
|
|
|
+const today = parseTime(Date.now(), '{y}-{m}-{d}') as string
|
|
|
const sevenDaysAgo = parseTime(
|
|
|
Date.now() - 24 * 60 * 60 * 1000 * 7,
|
|
|
'{y}-{m}-{d}'
|
|
|
-)
|
|
|
+) as string
|
|
|
const form = reactive({
|
|
|
startDate: sevenDaysAgo,
|
|
|
endDate: today,
|
|
|
})
|
|
|
const listData = ref<any>([])
|
|
|
-const disabledStartDate = (time: Date) => {
|
|
|
- const timer: any = form.endDate
|
|
|
- const data = new Date(timer)
|
|
|
- return time.getTime() > data.getTime()
|
|
|
-}
|
|
|
+
|
|
|
+watchEffect(() => {
|
|
|
+ const start = new Date(form.startDate).getTime()
|
|
|
+ const end = new Date(form.endDate).getTime()
|
|
|
+ if (start > end) {
|
|
|
+ ElMessage.warning('开始时间不能晚于结束时间')
|
|
|
+ form.endDate = ''
|
|
|
+ return
|
|
|
+ }
|
|
|
+})
|
|
|
const disabledEndDate = (time: Date) => {
|
|
|
- const timer: any = form.startDate
|
|
|
- let data = new Date(timer)
|
|
|
- return data.getTime() > time.getTime()
|
|
|
+ const start = new Date(form.startDate).setHours(0)
|
|
|
+ const end = time.setHours(0)
|
|
|
+ return start > end
|
|
|
}
|
|
|
+
|
|
|
const resetForm = () => {
|
|
|
flag.value = false
|
|
|
}
|