<template>
    <el-card shadow="never" style="border-radius: 10px;">
        <el-form :inline="true" :model="formInline" label-width="120" style="display: flex; justify-content: center;">
            <el-form-item label="规则编号">
                <el-input v-model="formInline.user" placeholder="请输入规则编号" clearable />
            </el-form-item>
            <el-form-item label="状态">
                <el-select v-model="formInline.region" placeholder="请输入状态" clearable>
                    <el-option label="Zone one" value="shanghai" />
                    <el-option label="Zone two" value="beijing" />
                </el-select>
            </el-form-item>
            <el-form-item label="更新时间">
                <el-date-picker v-model="formInline.date" type="date" placeholder="请选择时间" clearable />
            </el-form-item>
            <el-form-item>
                <el-button icon="search" type="primary" @click="onSubmit">搜索</el-button>
            </el-form-item>
            <el-form-item>
                <el-button icon="refresh" type="default" @click="onSubmit">重置</el-button>
            </el-form-item>
        </el-form>
        <el-table v-loading="loading" :data="listData" @selection-change="handleSelectionChange">
            <!-- <el-table-column type="index" width="50" label="序号" /> -->
            <el-table-column label="逆变器编号" align="center" prop="id" />
            <!-- <el-table-column label="合同类型" align="center" prop="contractType">
                <template #default="scope">
                    <dict-tag :options="income_contract_type" :value="scope.row.contractType" />
                </template>
</el-table-column> -->
            <el-table-column label="输出功率" align="center" prop="shuchu" />
            <el-table-column label="效率" align="center" prop="xiaolv" />
            <el-table-column label="温度" align="center" prop="wendu" />
            <el-table-column label="今日发电量" align="center" prop="fadian" />
            <el-table-column label="状态" align="center" prop="status">
                <template #default="scope">
                    <!-- <el-button link type="primary">详情</el-button>
                    <el-button link type="danger">处理</el-button>
                    <el-button link type="warning">维护记录</el-button> -->
                    <el-tag :type="statusMap[scope.row.status].type">{{ statusMap[scope.row.status].label }}</el-tag>
                </template>
            </el-table-column>
            <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="200">
                <template #default="scope">
                    <el-button link type="primary">详情</el-button>
                    <el-button link type="danger">处理</el-button>
                    <el-button link type="warning">维护记录</el-button>
                </template>
            </el-table-column>
        </el-table>
        <!-- <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
            v-model:limit="queryParams.pageSize" @pagination="getList" /> -->
        <pagination :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize"
            @pagination="getList" />
    </el-card>
</template>
<script setup>
const formInline = ref({})
const total = ref(0);
const loading = ref(false);
const listData = [
    { id: "INV-2023-001", shuchu: "12.8kw", xiaolv: "98.2%", wendu: "42℃", fadian: "158.5kWh", status: 1 },
    { id: "INV-2023-001", shuchu: "12.8kw", xiaolv: "98.2%", wendu: "42℃", fadian: "158.5kWh", status: 1 },
    { id: "INV-2023-001", shuchu: "12.8kw", xiaolv: "98.2%", wendu: "42℃", fadian: "158.5kWh", status: 2 },
    { id: "INV-2023-001", shuchu: "12.8kw", xiaolv: "98.2%", wendu: "42℃", fadian: "158.5kWh", status: 2 },
    { id: "INV-2023-001", shuchu: "12.8kw", xiaolv: "98.2%", wendu: "42℃", fadian: "158.5kWh", status: 3 },
    { id: "INV-2023-001", shuchu: "12.8kw", xiaolv: "98.2%", wendu: "42℃", fadian: "158.5kWh", status: 3 }
]
const statusMap = {
    1: {
        label: "正常运行",
        type: "success"
    },
    2: {
        label: "异常",
        type: "danger"
    },
    3: {
        label: "维护中",
        type: "warning"
    }
}
const initFormData = {

};
const data = reactive({
    form: { ...initFormData },
    queryParams: {

    },
});
const { queryParams, form, rules } = toRefs(data);

/** 多选框选中数据 */
const handleSelectionChange = (selection) => {
    ids.value = selection.map((item) => item.id);
    single.value = selection.length != 1;
    multiple.value = !selection.length;
};
const getList = async () => {
    //   loading.value = true;
    //   const res = await listIncomeContract(queryParams.value);
    //   incomeContractList.value = res.rows;
    //   total.value = res.total;
    //   loading.value = false;
};
</script>