<script lang="ts" setup>
import { ref } from 'vue'
import Aside from './aside/Aside.vue'
import Content from './content/Content.vue'
import ListContent from './content/ListContent.vue'
import Robot from '@/components/Robot/index.vue'

defineOptions({
  name: 'FinalMain',
})
const showList = ref(true)
const contentRef: any = ref(null)
const ListRef: any = ref(null)
const asideref=ref(null)
const taskvalue=ref("")
function inputChange(keyword) {
if(asideref.value?.showSearch){
  taskvalue.value=keyword
}else{
  taskvalue.value=""
}
  if (ListRef.value!=null) {
    ListRef.value.initData(1,20,{},keyword);
  } else {
    contentRef.value.filterTableData(keyword);
  }

}
</script>

<template>
  <div class="main">
    <!-- 侧边 -->
    <Aside ref="asideref" @input-change="inputChange" />

    <!-- 任务管理 -->
    <!-- TODO:本地演示即可 上传注释注释 -->
    <ListContent v-if="showList" ref="ListRef" @change-show="showList = false" :taskvalue="taskvalue"/>

    <!-- 内容 -->
    <Content v-if="!showList" ref="contentRef" @change-show="showList = true" :taskvalue="taskvalue"/>

    <!-- 机器人 -->
    <Robot />
  </div>
</template>

<style lang="less" scoped>
.main {
  display: flex;
  flex-direction: row;
  box-sizing: border-box;
  width: 100%;
}
</style>
