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

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

@ -14,4 +14,11 @@ export const get_ai_show_data = (cinema_code, show_date, force) => {
force: force_string
}
})
}
export const get_report_date = () => {
return request({
url: 'ai/report_date',
method: 'get'
})
}

@ -1,7 +1,7 @@
<script setup>
import {onBeforeMount, ref, reactive, computed} from 'vue';
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
const tableData = ref([])
@ -26,6 +26,10 @@ const loading = ref(false)
const think = ref('')
const aiModel = ref('')
//
const calendarStart = ref('')
const calendarEnd = ref('')
//
//
const getDefaultDate = () => {
@ -49,6 +53,17 @@ const show_alter = () => {
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() {
showData.value = []
@ -168,10 +183,9 @@ const objectSpanMethod = ({row, column, rowIndex, columnIndex}) => {
//
const disabledDate = (time) => {
const start = new Date('2026-06-11T00:00:00Z')
const today = new Date();
today.setDate(today.getDate() + 3)
return time.getTime() < start || time.getTime() > today
const start = new Date(calendarStart.value)
const end = new Date(calendarEnd.value);
return time.getTime() < start || time.getTime() > end
}
const tableHeader = computed(() => {
@ -188,6 +202,7 @@ const tableHeader = computed(() => {
onBeforeMount(
async () => {
await get_data()
await get_calendar_date()
}
)
@ -224,7 +239,7 @@ onBeforeMount(
<el-text>智能排片生成时间:</el-text>
</el-col>
<el-col :span="3">
<el-text>{{createTime}}</el-text>
<el-text>{{ createTime }}</el-text>
</el-col>
</el-row>
<el-row style="margin: 10px 0 20px 14px" align="middle">

Loading…
Cancel
Save