<template>
    <PageWrapper dense contentFullHeight fixedHeight contentClass="flex">
      <div class="w-1/4 xl:w-1/5 leftbox flex column">
        <div class="flex ai-c jc-sb titlesbox">
          <div class="textbox">
            <p>模板名称</p>
          </div>
          <a-button type="primary" size="small" @click="createAddClick">
            <template #icon><PlusOutlined /></template>
            新建模板
          </a-button>
        </div>
        <div class="flex column ulbox">
          <div class="descbox" v-for="(item, index) in 41" :class="navsIndex==index?'active':''" @click="navsClick(index)">
            <ProfileOutlined />
            项目名称{{ index+1 }}
          </div>
        </div>
      </div>
      <!-- <BasicTable
        class="w-3/4 xl:w-4/5"
        @register="registerTable"
        @fetch-success="onFetchSuccess"
        :searchInfo="searchInfo"
      >
       
      </BasicTable> -->
      <Modal
        @submitsuccess="submitsuccess"
        @register="registerModal"
        @submit-reload="submitReload"
      />
    </PageWrapper>
  </template>
  <script lang="ts" setup>
    import { reactive, nextTick, ref } from 'vue';
    import { PlusOutlined, ProfileOutlined } from '@ant-design/icons-vue';
    import { BasicTable, useTable } from '@/components/Table';
    import { getButtonList, getMenuDetail, deleteButton } from '@/api/demo/system';
    import { PageWrapper } from '@/components/Page';
    import { columns, searchFormSchema } from './index.data';
    import { useMessage } from '@/hooks/web/useMessage';
    import Modal from './modal.vue';
    import { useModal } from '@/components/Modal';
  
    const { createConfirm, createMessage } = useMessage();
    defineOptions({ name: 'MenuManagement' });
    const searchInfo = reactive<Recordable>({});
    const navsIndex = ref(0);
  
    const [registerTable, { reload, expandAll, getSelectRows, clearSelectedRowKeys }] = useTable({
      title: '列表',
      // api: getButtonList,
      columns,
      rowKey: 'id',
      formConfig: {
        labelWidth: 120,
        schemas: searchFormSchema,
      },
      isTreeTable: true,
      striped: false,
      useSearchForm: true,
      showTableSetting: true,
      bordered: true,
      showIndexColumn: false,
      rowSelection: {
        //多选框
        // type: 'checkbox',
        type: 'radio',
      },
      handleSearchInfoFn(info) {
        return info;
      },
    });
    const [registerModal, { openModal }] = useModal();
    function createAddClick(){
       
    }
    function navsClick(e){
      navsIndex.value = e
    }
  
    function onFetchSuccess() {
      // 演示默认展开所有表项
      nextTick(expandAll);
    }
  </script>
  <style scoped>
  .flex{
    display: flex;
  }
  .flex-1{
    flex: 1;
  }
  .column{
    flex-direction: column;
  }
  .ai-c{
    align-items: center;
  }
  .jc-sb{
    justify-content: space-between;
  }
  .jc-c{
    justify-content: center;
  }
  .pt-2{
    padding-top: 20px;
  }
  .leftbox{
    background: #fff;
    margin: 16px 0 16px 16px;
    padding: 16px 0;
    .titlesbox{
      padding:  0 16px;
      .textbox{
        p{
          font-weight: 500;
          font-size: 16px;
          color: #060606;
          line-height: 22px;
          margin-bottom: 0;
        }
      }
    }
  }
  .ulbox{
    overflow: auto;
    margin-top: 20px;
  }
  .descbox{
    font-size: 14px;
    color: #504E4E;
    line-height: 30px;
    padding-left: 30px;
  }
  .descbox.active{
    background: #F3F3F3;
    border-left: 3px solid #3A57E8;
    color: #3A57E8;
  }
  </style>
  