<template>
	<el-card>
		<el-row>
			<el-col :span="5">
				<el-select v-model="frleName" placeholder="请选择报表">
					<!-- <el-option label="班次产品产量" value="BCCPCL.cpt" />
					<el-option label="选矿厂金属平衡报表" value="XKCJSPH.cpt" />
					<el-option label="选矿生产报表（日、月报）" value="XKCSCBB.cpt" />
					<el-option label="选矿厂外购粉矿情况报表" value="XKCWGFKQK.cpt" />
					<el-option label="选矿厂自产矿情况报表" value="XKCZCKQK.cpt" />
					<el-option label="选矿厂外矿情况报表" value="XKCWKQK.cpt" /> -->

					<el-option v-for="option in reportData" :key="option.reportFileNm" :label="option.reportNm" :value="option.reportFileNm">
  					</el-option>
				</el-select>
			</el-col>
			<el-col :span="1">
			</el-col>
			<el-col :span="5">
				<el-button type="primary" plain @click="refresh">查看报表</el-button>
			</el-col>
		</el-row>
	</el-card>
	<el-card>
		<div>
			<el-button type="primary" plain v-if="isVisible" @click="refresh">刷新</el-button>
			<fine-report ref="finereport" :reportPath="reportPath"></fine-report>
		</div>
	</el-card>
</template>

<script setup>
import {
	ref,
	onMounted,
	getCurrentInstance
} from 'vue'

import FineReport from '@/components/report/FineReport.vue'

const {
	proxy
} = getCurrentInstance()

onMounted(() => {
	getReportData()
	// refresh()
})


const reportPath = ref('jlyypt/XKCZDZBRBB.cpt')
const finereport = ref(null)
const isVisible = ref(false)//调试用
const refresh = () => {
	reportPath.value = 'jlyypt/' + frleName.value
	finereport.value.refresh()
}
const frleName = ref('XKCZDZBRBB.cpt')




/**
 *   查询
 */

const reportData = ref([])

const query = ref({})
const getReportData = () => {
	var url = 'prd/ReportVer/query'
	var param = {
		page: 1,
		rows: 99999,
		params: JSON.stringify(query.value)
	}
	proxy.$axios.get(url, param).then(response => {
		if (response.data.code == '0') {
			reportData.value = response.data.data.records
			console.log(reportData.value)
		} else {
			ElMessage.error('操作失败！' + response.data.msg)
		}
	})
}
/**
 *   查询
 */



</script>

<style></style>