<template>
    <div class="m-t-7">
    </div>
    <div class="text-left p-6 toolbarStyle">
        <div class="formStyle">
            <el-form inline>
                <el-form-item>
                    <el-text class="mx-1">任务名称:</el-text>
                </el-form-item>
                <el-form-item>
                    <div>
                        <el-select v-model="taskValue" placeholder="请选择" style="width: 220px">
                            <el-option v-for="item in taskOptions" :key="item.value" :label="item.label"
                                :value="item.value" />
                        </el-select>
                    </div>
                </el-form-item>
                <el-form-item>
                    <el-text class="mx-1">时间:</el-text>
                </el-form-item>
                <el-form-item>
                    <el-date-picker v-model="timeValue" type="datetimerange" start-placeholder="Start date"
                        end-placeholder="End date" format="YYYY-MM-DD HH:mm:ss" date-format="YYYY/MM/DD ddd"
                        time-format="A hh:mm:ss" />
                </el-form-item>
                <el-form-item>
                    <el-text class="mx-1">调度状态:</el-text>
                </el-form-item>
                <el-form-item>
                    <div>
                        <el-select v-model="taskValue" placeholder="请选择" style="width: 220px">
                            <el-option v-for="item in taskOptions" :key="item.value" :label="item.label"
                                :value="item.value" />
                        </el-select>
                    </div>
                </el-form-item>
                <el-form-item>
                    <el-space>
                        <el-button type="primary">查询</el-button>
                    </el-space>
                </el-form-item>
            </el-form>
        </div>
    </div>
    <div class="m-t-10">

    </div>
    <div>
        <el-table :data="tableData" style="width: 100%" border :header-cell-style="{textAlign: 'center'}" :cell-style="{ textAlign: 'center' }">
        <el-table-column type="selection" width="40" />
        <el-table-column property="name" label="序号" width="55" />
        <el-table-column property="address" label="任务名称" show-overflow-tooltip />
        <el-table-column property="address" label="调度模式" show-overflow-tooltip />
        <el-table-column property="status" label="调度状态"  show-overflow-tooltip />
        <el-table-column property="address" label="错误消息" show-overflow-tooltip />
        <el-table-column property="address" label="运行状态" show-overflow-tooltip />
        <el-table-column property="address" label="持续时间" show-overflow-tooltip />
        <el-table-column property="address" label="调度时间" width="200" show-overflow-tooltip />
        <el-table-column label="运行日志" width="120">
            <template #default="scope">
                <el-button size="small" plain type="primary" @click="handleDetails(scope.row)">
                    日志
                </el-button>
            </template>
        </el-table-column>
    </el-table>
    </div>
    
    <div class="pagination w-full flex flex-row-reverse pr-4 m-t-4">
        <Pagination :total="pageObj.total" v-model:page="pageObj.pageNo" v-model:limit="pageObj.pageSize"
            @pagination="getData" />
    </div>



</template>

<script setup lang="ts">
import { ref } from 'vue'
import Pagination from '@/components/pagination/index.vue'
import { Search } from '@element-plus/icons-vue'
import { useRouter } from 'vue-router'
 
const router = useRouter()
const searchInput = ref('')
const errorValue = ref('')
const taskValue = ref('')
const timeValue = ref('')
const taskOptions = [
    {
        value: 'task1',
        label: 'sk网',
    },
    {
        value: 'task2',
        label: 'nasa网',
    },
    {
        value: 'task3',
        label: '网',
    },
]
const errorOptions = [
    {
        value: 'task1',
        label: '网络中断',
    },
    {
        value: 'task2',
        label: '地址不存在',
    },
    {
        value: 'task3',
        label: '反爬虫',
    },
]
const tableData = ref([
    {
        name: '1',
        address: 'sk网',
        address1: '成功',
        address2: '100',
        address3: '0',
        address4: '无',
        address5: '10s',
        address6: '2023-05-13 10:00:00',
        status: 0
    },
    {
        name: '1',
        address: 'sk网',
        address1: '成功',
        address2: '100',
        address3: '0',
        address4: '无',
        address5: '10s',
        address6: '2023-05-13 10:00:00',
        status: 0
    },
    {
        name: '1',
        address: 'sk网',
        address1: '成功',
        address2: '100',
        address3: '0',
        address4: '无',
        address5: '10s',
        address6: '2023-05-13 10:00:00',
        status: 0
    },
    {
        name: '1',
        address: 'sk网',
        address1: '成功',
        address2: '100',
        address3: '0',
        address4: '无',
        address5: '10s',
        address6: '2023-05-13 10:00:00',
        status: 0
    },
    {
        name: '1',
        address: 'sk网',
        address1: '成功',
        address2: '100',
        address3: '0',
        address4: '无',
        address5: '10s',
        address6: '2023-05-13 10:00:00',
        status: 0
    },
    {
        name: '1',
        address: 'sk网',
        address1: '成功',
        address2: '100',
        address3: '0',
        address4: '无',
        address5: '10s',
        address6: '2023-05-13 10:00:00',
        status: 0
    }, {
        name: '1',
        address: 'sk网',
        address1: '成功',
        address2: '100',
        address3: '0',
        address4: '无',
        address5: '10s',
        address6: '2023-05-13 10:00:00',
        status: 0
    }
    , {
        name: '1',
        address: 'sk网',
        address1: '成功',
        address2: '100',
        address3: '0',
        address4: '无',
        address5: '10s',
        address6: '2023-05-13 10:00:00',
        status: 0
    },
    {
        name: '1',
        address: 'sk网',
        address1: '成功',
        address2: '100',
        address3: '0',
        address4: '无',
        address5: '10s',
        address6: '2023-05-13 10:00:00',
        status: 0
    },
    {
        name: '1',
        address: 'sk网',
        address1: '成功',
        address2: '100',
        address3: '0',
        address4: '无',
        address5: '10s',
        address6: '2023-05-13 10:00:00',
        status: 0
    }
])
const pageObj = ref({
    total: 10,
    pageSize: 10,
    pageNo: 1
})
const handleDetails = (row: any) => {
    console.log(row);
    router.push({
        path: '/os-log/list',
        query: {
            id: row.id
        }
    })
}

const getData = () => {
    console.log('getData');
}
</script>

<style scoped>
/* 工具栏样式 */
.toolbarStyle {
    background-image: url("@/assets/picture/box3.png");
    background-size: 100% 100%;
    background-repeat: no-repeat;
}
/* 表格样式 */
.formStyle {
    display: flex;
    justify-content: space-around;
    padding: 3px;
}
/* 文字样式 */
.el-text {
    color: #FFFFFF;
}
</style>
<style>

/* 修改el选择器的样式 */
.el-select__wrapper {
    background-color: #1d5484;
    box-shadow: none;
}

/* 删除el选择器选中时的边框 */
.is-hovering {
    box-shadow: none !important;
}

/* 修改el输入框的样式 */
.el-input__wrapper {
    background-color: #1d5484;
    box-shadow: none;
}

/* 修改el下拉框的背景颜色 */
.el-select-dropdown {
    background-color: #1d5484;
}

/* 修改el下拉框选项的字体颜色 */
.el-select-dropdown__item {
    color: #FFFFFF;
}

/* 修改el下拉框选项选中时的文字颜色 */
.el-select-dropdown__item:hover {
    color: #409eff;
}

.el-button:focus {
    outline: none;
}
</style>