<template>
	<cl-crud ref="Crud">
		<el-row>
			<!-- 刷新按钮 -->
			<cl-refresh-btn />
			<!-- 新增按钮 -->
			<cl-add-btn />
			<!-- 删除按钮 -->
			<cl-multi-delete-btn />
			<cl-flex1 />
			<!-- 关键字搜索 -->
			<cl-search-key />
		</el-row>

		<el-row>
			<!-- 数据表格 -->
			<cl-table ref="Table" />
		</el-row>

		<el-row>
			<cl-flex1 />
			<!-- 分页控件 -->
			<cl-pagination />
		</el-row>

		<!-- 新增、编辑 -->
		<cl-upsert ref="Upsert" />
	</cl-crud>
</template>

<script lang="ts" name="sys-angle" setup>
import { useCrud, useTable, useUpsert } from "@cool-vue/crud";
import { useCool } from "/@/cool";

const { service } = useCool();

// cl-upsert 配置
const Upsert = useUpsert({
	items: [
		{ label: "名称", prop: "name", required: true, component: { name: "el-input" } },
		{ label: "经度", prop: "x", required: true, component: { name: "el-input" } },
		{ label: "纬度", prop: "y", required: true, component: { name: "el-input" } },
		{ label: "高度", prop: "z", required: true, component: { name: "el-input" } },
		{ label: "偏航角", prop: "heading", required: true, component: { name: "el-input" } },
		{ label: "俯仰角", prop: "pitch", required: true, component: { name: "el-input" } },
		{ label: "翻转角", prop: "roll", required: true, component: { name: "el-input" } },
		{ label: "位置截图", prop: "screenshot", required: true, component: { name: "el-input" } }
	]
});

// cl-table 配置
const Table = useTable({
	columns: [
		{ type: "selection" },
		// { label: "ID", prop: "id" },
		{ label: "名称", prop: "name" },
		{ label: "经度", prop: "x" },
		{ label: "纬度", prop: "y" },
		{ label: "高度", prop: "z" },
		{ label: "偏航角", prop: "heading" },
		{ label: "俯仰角", prop: "pitch" },
		{ label: "翻转角", prop: "roll" },
		// { label: "位置截图", prop: "screenshot" },
		{ label: "创建时间", prop: "createTime" },
		{ label: "更新时间", prop: "updateTime" },
		{ type: "op", buttons: ["edit", "delete"] }
	]
});

// cl-crud 配置
const Crud = useCrud(
	{
		service: service.base.sys.angle
	},
	(app) => {
		app.refresh();
	}
);
</script>
