<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-8">
        
    </div>
    <el-table :data="tableData" style="width: 100%" border>
        <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="是否启用">
            <template #default="scope">
                <el-switch v-model="scope.row.status" @change="changeSwitch(scope.row)" />
            </template>
        </el-table-column>
        <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 property="address" label="异常记录" width="200" show-overflow-tooltip />
        <el-table-column label="操作" width="220">
            <template #default="scope">
                <el-button size="small" plain type="primary" @click="handleDetails(scope.row)">
                    编辑
                </el-button>
                <el-button size="small" plain type="success" @click="handleDetails(scope.row)">
                    详情
                </el-button>
                <el-button size="small" plain type="danger" @click="handleConfirm(scope.row)">
                    删除
                </el-button>
            </template>
        </el-table-column>
    </el-table>
    <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'

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
    }
])
const pageObj = ref({
    total: 10,
    pageSize: 10,
    pageNo: 1
})
const paginationSize = ref('default')
const disabled = ref(false)
const background = ref(false)
const currentPage4 = ref(4)
const pageSize4 = ref(10)

const changeSwitch = (row: any) => {
    console.log(row);
}
const handleSizeChange = (val: number) => {
}
const handleCurrentChange = (val: number) => {
}
const handleDetails = (row: any) => {
    console.log(row);
}

const handleConfirm = (row: any) => {
    console.log(row);
}

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-date-picker__wrapper {
    border: none;
}

</style>