1、智能排片支持只展示定时任务+手动测试的数据

main
rogersun 3 days ago
parent bc5a9c9607
commit 52450e1546
  1. 100
      src/views/ai_show/index.vue

@ -29,6 +29,7 @@ const result = ref(false)
const loading = ref(false)
const think = ref('')
const aiModel = ref('')
const promptVersion = ref('')
//
const calendarStart = ref('')
@ -57,14 +58,17 @@ const getDefaultDate = () => {
return `${year}-${month}-${day}`
}
const show_date = ref(`2026-06-12`)
const show_date_old = ref(`2026-06-12`)
// const show_date_old = ref(`2026-06-12`)
show_date.value = getDefaultDate()
// show_date_old.value = getDefaultDate()
const cinema_code = ref('11078801')
const cinema_code_old = ref('11078801')
// const cinema_code_old = ref('11078801')
const force = ref(true)
const templateSwitch = ref(false)
const compareSwitch = ref('new') // template target new
//
const set_default = ['mount', 'cinema', 'date']
const show_alter = () => {
ElMessage.error('没有查询到有效的智能排片数据,请调整日期和影院后再试!')
@ -82,7 +86,7 @@ async function get_calendar_date() {
}
//
async function get_data() {
async function get_data(type) {
showData.value = []
loading.value = true
prompt.value = ''
@ -93,22 +97,19 @@ async function get_data() {
showResult.value = ''
aiCount.value = ''
aiTotal.value = ''
compareTotal.value = ''
compareCount.value = ''
result.value = false
createTime.value = ''
think.value = ''
aiModel.value = ''
force.value = compareSwitch.value === 'new'
if (compareSwitch.value !== 'new') {
test_date.value = ''
}
if (show_date.value !== show_date_old.value) {
test_date.value = ''
}
if (cinema_code.value !== cinema_code_old.value) {
test_date_option.value = []
promptVersion.value = ''
console.log('get_test_date-type', type)
if (set_default.includes(type)) {
test_date.value = ''
}
test_date_option.value = []
await get_ai_show_data(cinema_code.value, show_date.value, force.value, test_date.value).then(res => {
if (res.status === 'success') {
console.log(res)
@ -126,6 +127,7 @@ async function get_data() {
createTime.value = res.data.create_time
think.value = res.data.think
aiModel.value = res.data.ai_model
promptVersion.value = res.data.prompt_version
if (compareSwitch.value === 'template') {
showData.value = res.data.template_obj
compareCount.value = res.data.template_count
@ -142,14 +144,15 @@ async function get_data() {
console.log(showData.value, prompt.value, tokens.value, takeTimes.value, realSales.value, aiSales.value, showResult.value)
formatTableData()
loading.value = false
cinema_code_old.value = cinema_code.value
show_date_old.value = show_date.value
get_test_date()
// cinema_code_old.value = cinema_code.value
// show_date_old.value = show_date.value
get_test_date(type)
} else {
tableData.value = []
result.value = true
show_alter()
loading.value = false
get_test_date()
get_test_date(type)
}
}).catch(err => {
console.log(err)
@ -194,13 +197,19 @@ function formatTableData() {
}
//
const get_test_date = () => {
// type mount,date,cinema,test, compare
const get_test_date = (type) => {
get_test_date_api(cinema_code.value, show_date.value).then(res => {
if (res.status === 'success') {
res.date.forEach((item) => {
test_date_option.value.push({'value': item, label: item})
test_date_option.value = []
res.date.forEach((item, index) => {
const test_label = item[1] === true?item[0]+'-手工测试':item[0]
test_date_option.value.push({'value': item[0], label: test_label})
})
console.log('get_test_date-type', type)
if (set_default.includes(type)) {
test_date.value = test_date_option.value[0]['value']
}
}
})
}
@ -211,14 +220,7 @@ async function requestTest() {
dialogFormVisible.value = false
await test_prompt(form.cinema_code, form.show_date, form.prompt).then(res => {
if (res.status === 'success') {
get_test_date_api(form.cinema_code, form.show_date).then(res => {
if (res.status === 'success') {
test_date_option.value = []
res.date.forEach((item) => {
test_date_option.value.push({'value': item, label: item})
})
}
})
get_test_date()
console.log(res)
}
}).catch(err => {
@ -316,8 +318,8 @@ const compareDesc = computed(() => {
//
onBeforeMount(
async () => {
await get_data()
await get_calendar_date()
await get_data('mount')
}
)
@ -339,12 +341,12 @@ onBeforeMount(
size="default"
:disabled-date="disabledDate"
value-format="YYYY-MM-DD"
@change="get_data"
@change="get_data('date')"
style="width: 140px"
/>
</el-col>
<el-col :span="12">
<el-radio-group v-model="cinema_code" @change="get_data">
<el-radio-group v-model="cinema_code" @change="get_data('cinema')">
<el-radio-button value="11078801" label="11078801">保利国际影城北京凯德大峡谷店</el-radio-button>
<el-radio-button value="31073101" label="31073101">SFC上影(永华店)</el-radio-button>
<el-radio-button value="33040301" label="33040301">宁波影都东门口店</el-radio-button>
@ -369,12 +371,26 @@ onBeforeMount(
</el-tooltip>
</el-col>
<el-col :span="9">
<el-radio-group v-model="compareSwitch" @change="get_data">
<el-radio-group v-model="compareSwitch" @change="get_data('compare')">
<el-radio value="new" label="new">最新排片数据</el-radio>
<el-radio value="template" label="template">模板日期排片数据</el-radio>
<el-radio value="target" label="target">目标日期排片数据</el-radio>
</el-radio-group>
</el-col>
<el-col :span="2" align="right">
<el-text>选择数据</el-text>
</el-col>
<el-col :span="4">
<el-select v-model="test_date" placeholder="请选择" :clearable="true"
@change="get_data('test')" style="width: 240px">
<el-option
v-for="item in test_date_option"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-col>
<el-col :span="4" v-if="compareSwitch==='template'">
<el-text>模板日期{{ templateDate }}</el-text>
</el-col>
@ -385,20 +401,6 @@ onBeforeMount(
{{ testButton }}
</el-button>
</el-col>
<el-col :span="3" v-if="compareSwitch==='new'" align="right">
<el-text>手动测试数据</el-text>
</el-col>
<el-col :span="4" v-if="compareSwitch==='new'">
<el-select v-model="test_date" placeholder="请选择" v-if="compareSwitch==='new'" :clearable="true"
@change="get_data" style="width: 240px">
<el-option
v-for="item in test_date_option"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-col>
</el-row>
<el-dialog v-model="dialogFormVisible" title="测试提示词" width="800" style="max-height: 800px">
<el-form :model="form">
@ -538,6 +540,14 @@ onBeforeMount(
<el-text>{{ showResult }}</el-text>
</el-col>
</el-row>
<el-row>
<el-col :span="3" align="right">
<el-text style="font-weight: bold">提示词版本</el-text>
</el-col>
<el-col :span="21" align="left">
<el-text>{{ promptVersion }}</el-text>
</el-col>
</el-row>
<el-row>
<el-col :span="3" align="right">
<el-text style="font-weight: bold">提示词</el-text>

Loading…
Cancel
Save