<template>
	<div class="app-container" v-loading="loading">
		<!--顶部-->
		<div class="flex align-center mb-20">
			<el-icon @click="proxy.$router.go(-1)" class="mr-6 cursor">
				<ArrowLeftBold />
			</el-icon>
			{{ data && timerToStr(data.reportTime, 'YYYY-MM-DD HH:mm:ss') }}
		</div>
		
		<el-row :gutter="20" v-if="!loading && data && data.report" >
			<el-col :xs="24" :sm="24" :md="24" :lg="24">
				<el-card class="update-log" >
					<template v-slot:header>
						<div class="clearfix">
							<span>赛事分析 {{ data && data.matchCode }}</span>
						</div>
					</template>
					<div class="body">
						<!-- <MdPreview 
							ref="editorRef" 
							editorId="preview-only" 
							:modelValue="data.report"
							class="maxkb-md" 
						/> -->

						<h3>1.比赛基础信息</h3>
						<el-table v-loading="loading" :data="basicList" :show-header="false" border>
							<el-table-column label="比赛编号" prop="name" :show-overflow-tooltip="true" />
							<el-table-column label="联赛" prop="value" :show-overflow-tooltip="true" />
						</el-table>

						<h3 class="mt-20">2.关键影响因素</h3>
						<el-table v-loading="loading" :data="influencingList" :show-header="false" border>
							<el-table-column :show-overflow-tooltip="true" >
								<template v-slot="{row}">
									{{ row }}
								</template>
							</el-table-column>
						</el-table>

						<h3 class="mt-20">3.核心预测结果</h3>
						<el-table class="mb-20" v-loading="loading" :data="coreList" border>
							<el-table-column label="预测类型" prop="name" :show-overflow-tooltip="true" />
							<el-table-column label="预测结果" prop="prediction" :show-overflow-tooltip="true" />
							<el-table-column label="分析依据" prop="analysis" :show-overflow-tooltip="true" />
						</el-table>
						
					</div>
				</el-card>
			</el-col>
		</el-row>
		<lz-page-empty 
			v-else 
			:type="'4'"
			text1="暂无赛事分析报告"
			text2="请稍后再试..."
		>
			<lz-svg-icon icon-class="empty1" style="font-size: 312px;"/>
		</lz-page-empty>

	</div>
</template>

<script setup name="EventAnalysisReportDetail">
import { detail } from '@/api/tc/eventAnalysisReport'
import MdPreview from '@/components/Markdown/MdPreview'
import { timerToStr } from '@/utils/timer'
const route = useRoute()

let { proxy } = getCurrentInstance()
const editorRef = ref(null)
const id = ref(0)
const modelType = ref('')
const data = ref({})
const loading = ref(false)
const basicList = ref([
	{
		name: "比赛编号",
		value: "周三001"
	},
	{
		name: "主队",
		value: "北马其顿"
	},
	{
		name: "客队",
		value: "哈萨克斯坦"
	},
	{
		name: "时间",
		value: "2022-03-01 19:00"
	}
])
const influencingList = ref([
	"北马其顿联赛排名领先且状态稳定，防守坚固（近10场仅1负，同主客胜率60%）",
    "历史交锋北马其顿占优（近2场全胜），心理优势明显",
    "哈萨克斯坦客场表现差（同主客负率60%，失球多）"
])
const coreList = ref([
	{
	  "name": "最终赛果",
	  "key": "result_final",
      "prediction": "北马其顿胜",
      "analysis": "北马其顿积分排名第一，近10场胜率60%且不败率高，哈萨克斯坦客场负率60%，历史交锋北马其顿全胜，优势明显。"
    },
    {
	  "name": "让球结果",
	  "key": "result_handicap",
      "prediction": "北马其顿让球胜",
      "analysis": "北马其顿实力占优，历史交锋让盘时均赢盘，哈萨克斯坦客场赢盘率仅28.5%，支持北马其顿覆盖盘口。"
    },
    {
	  "name": "比分预测",
	  "key": "score_prediction",
      "prediction": "2-0",
      "analysis": "北马其顿场均进1.6球且防守稳固（场均失0.4球），哈萨克斯坦客场场均失球多，可能零封小胜。"
    },
    {
	  "name": "总进球数",
	  "key": "total_goals",
      "prediction": "小于2.5球",
      "analysis": "北马其顿近10场大球率仅30%，防守强；哈萨克斯坦客场进攻乏力，总进球倾向小球。"
    },
    {
	  "name": "半全场赛果",
	  "key": "half_full_time",
      "prediction": "胜胜",
      "analysis": "北马其顿近场半全场多领先（如对列支敦士登半场1-0全场5-0），哈萨克斯坦客场半场易落后。"
    },
    {
	  "name": "亚洲盘口",
	  "key": "asian_handicap",
      "prediction": "北马其顿-0.75",
      "analysis": "基于实力差距和历史盘口（如上次交锋北马其顿受让半球赢盘），北马其顿有望让球获胜。"
    },

])

function getDetail() {
	loading.value = true
	detail({id: id.value, modelType: modelType.value}).then(res => {
		data.value = res.data
	}).finally(() => {
		loading.value = false
	})
}

onMounted(() => {
	if (route.query.id && route.query.modelType) {
		id.value = route.query.id
		modelType.value = route.query.modelType
		getDetail()
	}
})


</script>
