feat: 只有PENDING可以修改开始时间&结束时间必须大于之前

This commit is contained in:
2026-01-07 16:17:43 +08:00
parent 2b273ec70a
commit 1fa60557df
4 changed files with 69 additions and 12 deletions

View File

@@ -230,7 +230,7 @@
endTime: endDate,
startTime: startDate,
ids: ids,
email: this.email.trim(),
email: this.email?.trim(),
organizationName: this.organizationName,
};
Https.axiosGet(Https.httpUrls.getDesignStatistic, {

View File

@@ -220,7 +220,7 @@ export default defineComponent({
changeEvent:this.changeEvent,
size:this.pageSize,
page:this.currentPage,
email:this.email.trim(),
email:this.email?.trim(),
}
Https.axiosPost(Https.httpUrls.getGenerateFrequency,data).then((rv: any) => {
if (rv) {

View File

@@ -423,7 +423,7 @@ export default defineComponent({
page: filterData.currentPage,
systemUser: filterData.systemUser,
country: filterData.country,
email: filterData.email.trim(),
email: filterData.email?.trim(),
userType: filterData.userType,
ids: filterData.ids,
occupation: filterData.occupation,

View File

@@ -11,13 +11,13 @@
<a-form-item label="ID">
<a-input v-model:value="searchForm.id" allow-clear placeholder="Input the id" />
</a-form-item>
<a-form-item label="Name">
<!-- <a-form-item label="Name">
<a-input
v-model:value="searchForm.name"
allow-clear
placeholder="Input the name"
/>
</a-form-item>
</a-form-item> -->
<a-form-item label="Time Range">
<a-range-picker
v-model:value="searchForm.dateRange"
@@ -255,6 +255,7 @@
<a-date-picker
v-model:value="formState.currentPeriodStart"
value-format="X"
:disabled="isEditMode && formState.status !== 'PENDING'"
style="width: 250px"
:disabledDate="disabledDate"
:show-time="{ format: 'HH:mm' }"
@@ -275,7 +276,9 @@
v-model:value="formState.currentPeriodEnd"
value-format="X"
:show-time="{ format: 'HH:mm' }"
:disabledDate="disabledDate"
:disabledDate="disableEndDate"
:disabledTime="disableEndTime"
:show-now="!isEditMode"
style="width: 250px"
class="range_picker"
placeholder="Select the end time"
@@ -418,10 +421,6 @@ interface SubscriptionPlan {
endStamp: number
}
const disabledDate = (current: Dayjs) => {
return current && current < dayjs().subtract(1, 'days').endOf('day')
}
const countryList = ref([])
const userRef = ref(null)
@@ -492,6 +491,65 @@ const statusOption = ref([
}
])
const disabledDate = (current: Dayjs) => {
return current && current < dayjs().subtract(1, 'days').endOf('day')
}
const disableEndDate = (current: Dayjs) => {
if (isEditMode.value) {
const specificTime = dayjs(formState.currentPeriodEnd)
return current && current < dayjs(formState.currentPeriodEnd * 1000).startOf('day')
}
return disabledDate(current)
}
const range = (start: number, end: number) => {
const result = []
for (let i = start; i < end; i++) {
result.push(i)
}
return result
}
const disableEndTime = date => {
if (!formState.currentPeriodEnd || !isEditMode.value)
return {
disabledHours: () => [],
disabledMinutes: () => [],
disabledSeconds: () => []
}
const specificTime = dayjs.unix(formState.currentPeriodEnd)
if (date && date.isSame(specificTime, 'day')) {
// 如果是指定日期当天,禁用时间戳之前的时间
const hour = specificTime.hour()
const minute = specificTime.minute()
const second = specificTime.second()
return {
disabledHours: () => Array.from({ length: hour }, (_, i) => i), // 禁用小时之前
disabledMinutes: selectedHour => {
if (selectedHour === hour) {
return Array.from({ length: minute }, (_, i) => i) // 同小时,禁用分钟之前
}
return []
},
disabledSeconds: (selectedHour, selectedMinute) => {
if (selectedHour === hour && selectedMinute === minute) {
return Array.from({ length: second }, (_, i) => i) // 同小时分钟,禁用秒之前
}
return []
}
}
}
return {
disabledHours: () => [],
disabledMinutes: () => [],
disabledSeconds: () => []
}
}
const normalizeStatus = (status?: string): PlanStatus | undefined => {
if (!status) return undefined
const upper = status.toUpperCase() as PlanStatus
@@ -633,7 +691,7 @@ const handleReset = () => {
searchForm.adminAccId = undefined
searchForm.status = []
searchForm.id = ''
searchForm.countryOrRegion = ''
searchForm.countryOrRegion = null
handleSearch()
}
@@ -679,7 +737,6 @@ const openEdit = (record: SubscriptionPlan) => {
}
}
if (record.adminAccId) {
console.log(userRef.value)
nextTick(() => {
userRef.value.patchList({
label: record.name,