import { createApp } from 'vue'
import App from './App.vue'

import router from './router'
import store from './store'

import '@/style/index.scss'
// import 'ant-design-vue/dist/reset.css'
import 'ant-design-vue/dist/reset.css'
import '@/assets/iconfont/iconfont.css'
import * as echarts from 'echarts/core'
import { BarChart, LineChart } from 'echarts/charts'
import {
  TitleComponent,
  TooltipComponent,
  GridComponent,
  DatasetComponent,
  LegendComponent,
  TransformComponent,
  DataZoomComponent
} from 'echarts/components'

// 标签自动布局、全局过渡动画等特性
import { LabelLayout, UniversalTransition } from 'echarts/features'
// 引入 Canvas 渲染器，注意引入 CanvasRenderer 或者 SVGRenderer 是必须的一步
import { CanvasRenderer } from 'echarts/renderers'
import { setWidth } from '@/utils/column'
import { getBtns } from '@/utils/btnList'
import { message, Modal } from 'ant-design-vue'
import VueTianditu from 'vue-tianditu'
import SearchBox from '@/components/SearchBox.vue'
import ComTable from '@/components/ComTable.vue'
import OperateCom from '@/components/OperateCom'
import TreeTable from '@/components/TreeTable.vue'

// 注册必须的组件
echarts.use([
  TitleComponent,
  TooltipComponent,
  GridComponent,
  DatasetComponent,
  TransformComponent,
  DataZoomComponent,
  BarChart,
  LineChart,
  LabelLayout,
  UniversalTransition,
  CanvasRenderer,
  LegendComponent
])

const app = createApp(App)

app.component('SearchBox', SearchBox)
app.component('ComTable', ComTable)
app.component('OperateCom', OperateCom)
app.component('TreeTable', TreeTable)

app.config.globalProperties.$echarts = echarts // 挂载到全局属性
app.config.globalProperties.$setWidth = setWidth // 挂载到全局属性
app.config.globalProperties.$getBtns = getBtns
app.config.globalProperties.$message = message
app.config.globalProperties.$Modal = Modal

app.use(store).use(router)

app.use(VueTianditu).mount('#app')
