<script setup name="prepare">
import excelCop from '@/components/excel.vue'
import treeCop from '@/components/tree.vue'
import tableCop from './components/table.vue'
import { ElMessage } from 'element-plus';
import { onMounted, ref, onActivated } from 'vue'
import request from '@/api/axios.js'
import {baseURL, socketURL} from '@/api/axios.js'
/**配置参数 */
const treeHeight = ref(window.innerHeight - 260 + 'px') //tree高度
const excelHeight = ref(window.innerHeight - 260 + 'px') //excel高度
const tableHeight = ref(window.innerHeight - 260 + 'px')
/**excel 开始 */

/**tree 开始 */
// const disable =ref()
// const sjulist=async()=>{
// 	const res = await request.get("/taos/create/database")
// 	// console.log(res);
// 		webSocket.onerror = () => setTimeout(() => { funWebSocket() }, 2000)
//          ElMessage.success('响应完成')

// }
//  const cjblist=async()=>{
// 	 const res = await request.get("/taos/create/supertable")
	
// 	webSocket.onerror = () => setTimeout(() => { funWebSocket() }, 2000)
//          ElMessage.success('响应完成')
//  }

// const redislist=async()=>{
// 	 const res = await request.get("/taos/create/table")
// 	console.log(res);
// 	webSocket.onerror = () => setTimeout(() => { funWebSocket() }, 2000)
//          ElMessage.success('响应完成')
//  }

//  const funlist=async()=>{
// 		const res=await request.get("/taos/2redis/status")
// 	    console.log('zh',res);

// 	}



onMounted(() => {
	tableHeight.value = window.innerHeight - 260 + 'px'
	excelHeight.value = window.innerHeight - 260 + 'px'
	treeHeight.value = window.innerHeight - 260 + 'px'
	window.addEventListener('resize', () => {
		tableHeight.value = window.innerHeight - 260 + 'px'
		excelHeight.value = window.innerHeight - 260 + 'px'
		treeHeight.value = window.innerHeight - 260 + 'px'
	})
	console.log(123);
	funlist()
		
})

    


onActivated(() => {
	// funGetTree()
})
</script>
<template>
	<div class="bg-white py-[10px] px-[10px] relative">
	<div class="pl-[20px] flex items-center h-[80px] relative">
		<div class="absolute top-[-7px] left-[20px] text-[#838383] text-[14px]">操作面板</div>
	
			<el-form-item class="!mb-0 ml-5">
				<el-button @click="sjklist" type="primary" :disabled="disable">建数据库</el-button>
			</el-form-item>
			<el-form-item class="!mb-0 ml-5">
				<el-button @click="cjblist" type="primary">建超级表</el-button>
			</el-form-item>
			<el-form-item class="!mb-0 ml-5">
				<el-button @click="redislist" type="primary">按采集Redis建点</el-button>
			</el-form-item>
			<el-form-item class="!mb-0 ml-5">
				<el-button @click="funSubmit" type="primary">启动读redis写taos</el-button>
			</el-form-item>
			<el-form-item class="!mb-0 ml-5">
				<el-button @click="funSubmit" type="primary">redis新增建点</el-button>
			</el-form-item>
			<el-form-item class="!mb-0 ml-5">
				<el-button @click="funSubmit" type="primary">停止读redis写taos</el-button>
			</el-form-item>
		
	</div>
		<div class="relative shadow rounded-[6px] shadow-blue-500 px-[10px] pt-[20px] pb-[10px]">
			<div class="text-[14px] absolute top-[-7px] text-[#838383] left-[20px]">数据展示</div>
			<el-row :gutter="10">
				<el-col :span="5">
					<!-- <tree-cop :data="treeData" :height="treeHeight" @currentChange="funCurrentChange" @refresh="funGetTree">
					</tree-cop> -->
				</el-col>
				<el-col :span="3">
					<!-- <excel-cop :data="excelList" :height="excelHeight" @excelChange="funExcelChange"></excel-cop> -->
				</el-col>
				<el-col :span="16">
					<!-- <div>
						<table-cop class="" :data="tableData" :column="tableColumn" :loading="tableLoading"
							:height="tableHeight" :tableId="tableShowId" :tableName="tableName" @export="funExport"></table-cop>
					</div> -->
				</el-col>
			</el-row>
		</div>

		<el-progress :percentage="progress" v-if="progress" class="!absolute top-0 right-0 left-0" :indeterminate="false"
			color="rgb(19,206,102)" :stroke-width="4" :show-text="false" />
	</div>
</template>