前端日期控件改为从接口获取开始截止时间

main
rogersun 2 weeks ago
parent 0865e2ffbf
commit 6d3f7b2a96
  1. 7
      src/apis/ai_show.js
  2. 25
      src/views/ai_show/index.vue

@ -15,3 +15,10 @@ export const get_ai_show_data = (cinema_code, show_date, force) => {
} }
}) })
} }
export const get_report_date = () => {
return request({
url: 'ai/report_date',
method: 'get'
})
}

@ -1,7 +1,7 @@
<script setup> <script setup>
import {onBeforeMount, ref, reactive, computed} from 'vue'; import {onBeforeMount, ref, reactive, computed} from 'vue';
import {ElMessage} from 'element-plus' import {ElMessage} from 'element-plus'
import {get_ai_show_data} from "@/apis/ai_show.js"; import {get_ai_show_data, get_report_date} from "@/apis/ai_show.js";
// region // region
const tableData = ref([]) const tableData = ref([])
@ -26,6 +26,10 @@ const loading = ref(false)
const think = ref('') const think = ref('')
const aiModel = ref('') const aiModel = ref('')
//
const calendarStart = ref('')
const calendarEnd = ref('')
// //
// //
const getDefaultDate = () => { const getDefaultDate = () => {
@ -49,6 +53,17 @@ const show_alter = () => {
ElMessage.error('没有查询到有效的智能排片数据,请调整日期和影院后再试!') ElMessage.error('没有查询到有效的智能排片数据,请调整日期和影院后再试!')
} }
async function get_calendar_date() {
await get_report_date().then(res => {
if (res.status === 'success') {
calendarStart.value = res.start
calendarEnd.value = res.end
}
}).catch(err => {
console.log(err)
})
}
// //
async function get_data() { async function get_data() {
showData.value = [] showData.value = []
@ -168,10 +183,9 @@ const objectSpanMethod = ({row, column, rowIndex, columnIndex}) => {
// //
const disabledDate = (time) => { const disabledDate = (time) => {
const start = new Date('2026-06-11T00:00:00Z') const start = new Date(calendarStart.value)
const today = new Date(); const end = new Date(calendarEnd.value);
today.setDate(today.getDate() + 3) return time.getTime() < start || time.getTime() > end
return time.getTime() < start || time.getTime() > today
} }
const tableHeader = computed(() => { const tableHeader = computed(() => {
@ -188,6 +202,7 @@ const tableHeader = computed(() => {
onBeforeMount( onBeforeMount(
async () => { async () => {
await get_data() await get_data()
await get_calendar_date()
} }
) )

Loading…
Cancel
Save