<template>

    <div style=" width:100%">
        <el-card style="max-width: 100vw;margin: 1.5vw;">
            <template #header><strong >子系统1</strong></template>
            <div style="display:flex;flex-direction:row;justify-content: space-around ">
                <div>
                    名称
                    <el-input v-model="input" style="width: 240px;margin-left:0.5vw" placeholder="请输入" />
                </div>
                <div>
                    状态
                    <el-input v-model="input" style="width: 240px;margin-left:0.5vw" placeholder="请输入" />
                </div>
                <div>
                    <el-button type="primary" style="width:80px">查询</el-button>
                    <el-button style="width:80px">重置</el-button>

                </div>
            </div>
        </el-card>
        <el-card style="max-width: 100vw;height:60vh;margin:1.3vw">
            <div style="display:flex;flex-direction: row;justify-content: space-between">
                <el-button
                        text
                        type=''
                >子模块列表</el-button
                >
            </div>
            <el-table
                    ref="multipleTableRef"
                    :data="tableData"
                    style="max-width: 100vw;"
                    @selection-change="handleSelectionChange"
            >
                <!--                <el-table-column type="selection" width="55" />-->
                <el-table-column label="序号" width="120">
                    <template #default="scope">{{ scope.row.date }}</template>
                </el-table-column>
                <el-table-column property="name" label="子模块名称" width="120" />
                <el-table-column property="address" label="工作量" show-overflow-tooltip />
                <el-table-column property="address" label="周期"  />
                <el-table-column property="address" label="负责人"  />
                <el-table-column property="address" label="状态"  />
                <el-table-column property="address" label="子模块简介"  />
                <el-table-column property="address" label="截止时间"  />
                <el-table-column property="address" label="操作"  >
                    <el-button
                            link
                            style="color:deepskyblue"
                    >查看详情</el-button
                    >
                </el-table-column>
            </el-table>
            <el-pagination
                    larger
                    background
                    layout="prev, pager, next"
                    :total="50"
                    class="mt-4"
                    style="display: flex;flex-direction: row;justify-content: center;margin-top:5vh"
            />
        </el-card>
    </div>
</template>

<script lang="ts" setup>
import { ref } from 'vue';
import { ElTable } from 'element-plus';

interface User {
    date: string
    name: string
    address: string
}

const multipleTableRef = ref<InstanceType<typeof ElTable>>();
const multipleSelection = ref<User[]>([]);

const handleSelectionChange = (val: User[]) => {
  multipleSelection.value = val;
};

const tableData: User[] = [
  {
    date: '2016-05-03',
    name: 'Tom',
    address: 'No. 189, Grove St, Los Angeles'
  },
  {
    date: '2016-05-02',
    name: 'Tom',
    address: 'No. 189, Grove St, Los Angeles'
  },
  {
    date: '2016-05-04',
    name: 'Tom',
    address: 'No. 189, Grove St, Los Angeles'
  },
  {
    date: '2016-05-01',
    name: 'Tom',
    address: 'No. 189, Grove St, Los Angeles'
  }

];

// 输入框1
import { onMounted } from 'vue';
import { Edit } from '@element-plus/icons-vue';

interface LinkItem {
    value: string
    link: string
}

const state = ref('');
const links = ref<LinkItem[]>([]);

const querySearch = (queryString: string, cb) => {
  const results = queryString
    ? links.value.filter(createFilter(queryString))
    : links.value;
    // call callback function to return suggestion objects
  cb(results);
};
const createFilter = (queryString) => {
  return (restaurant) => {
    return (
      restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0
    );
  };
};
const loadAll = () => {
  return [
    { value: '1' },
    { value: '2' },
    { value: '3' },
    { value: '4' },
    { value: '5' }

  ];
};
const handleSelect = (item: LinkItem) => {
  console.log(item);
};

const handleIconClick = (ev: Event) => {
  console.log(ev);
};

// 时间选择器
const value1 = ref('');
const value2 = ref('');

const shortcuts = [
  {
    text: 'Last week',
    value: () => {
      const end = new Date();
      const start = new Date();
      start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
      return [start, end];
    }
  },
  {
    text: 'Last month',
    value: () => {
      const end = new Date();
      const start = new Date();
      start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
      return [start, end];
    }
  },
  {
    text: 'Last 3 months',
    value: () => {
      const end = new Date();
      const start = new Date();
      start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
      return [start, end];
    }
  }
];
</script>
<style>
.my-autocomplete li {
    line-height: normal;
    padding: 7px;
}
.my-autocomplete li .name {
    text-overflow: ellipsis;
    overflow: hidden;
}
.my-autocomplete li .addr {
    font-size: 12px;
    color: #b4b4b4;
}
.my-autocomplete li .highlighted .addr {
    color: #ddd;
}
</style>