diff --git a/src/api/modules/user.js b/src/api/modules/user.js index bf973e1..1b2aca7 100644 --- a/src/api/modules/user.js +++ b/src/api/modules/user.js @@ -34,6 +34,5 @@ export function deleteUser(ItemId) { return service({ method: "delete", url: `/application/role/${ItemId}`, - data: query, }); } \ No newline at end of file diff --git a/src/views/order/index.vue b/src/views/order/index.vue index 1bae733..022adc3 100644 --- a/src/views/order/index.vue +++ b/src/views/order/index.vue @@ -39,12 +39,44 @@ /> - +
+ + + + + + + + + @@ -378,6 +410,7 @@ import {nextTick, onMounted, reactive, ref} from 'vue' import {exportOrder, getOrderList} from "../../api/modules/order"; +import {ElMessage} from "element-plus"; const tableData = ref([]) const table = ref() @@ -441,11 +474,98 @@ const handleCurrentChange = (val) => { initData(formSearch.value) } +// 清空年份 +const clearYearDate = () => { + formSearch.value.year = '' +} + +// 清空月份 +const clearMonthDate = () => { + formSearch.value.month = '' +} + // 清空日期 const clearDate = () => { formSearch.value.date = '' } +// 禁止选择之后的年份 +const disablePastAndSpecificYear = (date) => { + // 获取当前日期 + const currentDate = new Date(); + + currentDate.setDate(currentDate.getDate() - 1); + + // 禁止选择今天的前一天及之前的日期(不包含今天) + if (date > currentDate) { + return true; + } + + // 禁止选择特定的未来日期,例如节假日 + const disabledDates = [new Date(2023, 9, 1), new Date(2023, 10, 1)]; + return disabledDates.some((disabledDate) => { + return ( + date.getFullYear() === disabledDate.getFullYear() && + date.getMonth() === disabledDate.getMonth() && + date.getDate() === disabledDate.getDate() + ); + }); +}; + +// 选中年份 +const isYearClick = () => { + formSearch.value.month = ''; + formSearch.value.day = ''; +} + +// 选中月份 +const isMonthClick = () => { + formSearch.value.day = ''; +} + +// 选中天 +const isDayClick = () => { + +} + +// 选中月份禁止调整年份 +const disablePastAndSpecificMonth = (date) => { + + if (!formSearch.value.year) { + return true; // 未选择年份时,禁用所有月份 + } + + const selectedYear = formatDate(formSearch.value.year).year; + const year = date.getFullYear(); + + // 只允许选择选中年份的月份 + if (year !== selectedYear) { + return true; + } + + return false; +}; + +// 选中年月禁止调整天 +const disablePastAndSpecificDay = (date) => { + + if (!formSearch.value.month) { + return true; // 未选择月份时,禁用所有日期 + } + + const selectedYear = formatDate(formSearch.value.year).year; + const selectedMonth = formatDate(formSearch.value.month).month; + const year = date.getFullYear(); + const month = date.getMonth()+1; + + if (year !== selectedYear || month != selectedMonth) { + return true; + } + + return false; + +} + const excelDown = async () => { const url = downloadFile(); @@ -512,13 +632,31 @@ const onSearchSubmit = ()=> { params.status = parseInt(params.status, 10); } - if(params.date !== '') + if(params.year !== '') + { + let { + year + } = {...formatDate(params.year)}; + + params.year = year; + } + + if(params.month !== '') + { + let { + month + } = {...formatDate(params.month)}; + + params.month = month; + } + + if(params.day !== '') { let { year, month, day - } = {...formatDate(params.date)}; + } = {...formatDate(params.day)}; params.year = year; params.month = month; @@ -535,6 +673,15 @@ const onSearchSubmit = ()=> { // 日期格式 const formatDate = (date) => { + if(date === '') + { + return { + year: 1999, + month: 1, + day: 1, + }; + } + if (typeof date === 'string') { // 检查是否已经是格式化的字符串 const regex = /^\d{4}-\d{2}-\d{2}$/; @@ -547,13 +694,11 @@ const formatDate = (date) => { const month = String(date.getMonth() + 1).padStart(2, '0'); const day = String(date.getDate()).padStart(2, '0'); - let data = { + return { year: year, month: month, day: day, }; - - return data; }; onMounted(() => { initData() @@ -561,54 +706,5 @@ onMounted(() => {