<template>
    <TableHeader area datePicker ref="TableHeaderRef">

        <template #operation>
            <el-button icon="el-icon-Plus" type="primary" @click="add">新增</el-button>
            <el-button icon="el-icon-Delete" type="primary">删除</el-button>
            <el-button icon="el-icon-Download" type="primary">导出</el-button>
        </template>
    </TableHeader ref="tableRef">
    <Table ref="tableRef" />


<!-- 新增 -->
<listForm ref="listFormRef"/>


</template>
<script setup lang="ts">
import { ref, onMounted, provide, nextTick } from 'vue'
import TableStore from '@/utils/tableStore'
import Table from '@/components/table/index.vue'
import TableHeader from '@/components/table/header/index.vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { useDictData } from '@/stores/dictData'
import listForm from "./listForm.vue"
const dictData = useDictData()
const tableRef = ref()
const planAddRef = ref()
const TableHeaderRef = ref()
const listFormRef = ref()
const tableStore = new TableStore({
    url: '/supervision-boot/generalSurvey/getSurvey',
    publicHeight: 65,
    method: 'POST',
    column: [
        { width: '60', type: 'checkbox' },
           {
            title: '序号',
            type: 'seq',
            align: 'center',
            width: 60,
            formatter: (row: any) => {
                return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1
            }
        },
        { field: 'billNo', title: '单据编号', minWidth: '150' },
        { field: 'billName', title: '单据名称', minWidth: '150' },
        { field: 'createrOrgName', title: '编制单位名称', minWidth: '150' },
        { field: 'specialityType', title: '所属专业', minWidth: '150' },
        { field: 'orgName', title: '责任单位名称', minWidth: '150' },
        { field: 'receiveUserName', title: '接收人名称', minWidth: '150' },
        { field: 'createrTime', title: '编制时间', minWidth: '150' },
        { field: 'managerDeptName', title: '主管部门名称', minWidth: '150' },
        { field: 'mainSenderName', title: '主送单位名称', minWidth: '150' },
        { field: 'copySenderName', title: '抄送单位名称', minWidth: '150' },
        { field: 'techSupvBasis', title: '依据标准', minWidth: '150' },
        { field: 'problemDesc', title: '问题描述', minWidth: '150' },
        { field: 'dealAdvise', title: '处理建议', minWidth: '150' },



        {
            title: '操作',
            width: '180',
            align: 'center',
            render: 'buttons',
            fixed: 'right',
            buttons: [
                {
                    name: 'productSetting',
                    title: '反馈数据',
                    type: 'primary',
                    icon: 'el-icon-EditPen',
                    render: 'basicButton',
                    click: row => {
                        // planAddRef.value.open('查看计划', row)
                    }
                },
                {
                    name: 'edit',
                    title: '修改',
                    type: 'warning',
                    icon: 'el-icon-Open',
                    render: 'basicButton',

                    click: row => {
                        // deviceQuitPopup.value.open('重新发起退运', row)
                        planAddRef.value.open('重新发起计划', row)
                    }
                },


            ]
        }
    ],
    beforeSearchFun: () => {
        tableStore.table.params.orgNo = tableStore.table.params.deptIndex
        tableStore.table.params.currentPage = tableStore.table.params.pageNum
    },
    loadCallback: () => {
        tableStore.table.data = [{
            alarmId: "49cb012b06df8cde948230d29e8a3c30",
            provinceId: "13B9B47F1E483324E05338297A0A0595",
            provinceName: "国网河北电力有限公司",
            billType: "eba0f69f3a36826a1771d813a6eee0fc",
            billNo: "衡供[告]2023年--09015号",
            billName: "220千伏站544线技术监督工作预警单",
            createrOrgId: "13B9B47F23B83324E05338297A0A0595",
            createrOrgName: "国网衡水供电公司",
            specialityType: "电能质量",
            orgId: "13B9B47F23CB3324E05338297A0A0595",
            orgName: "国网桃城区供电公司",
            receiveUserId: null,
            receiveUserName: "",
            createrTime: "2023-09-14 00:00:00",
            time: null,
            managerDeptId: "13B9B47F23B83324E05338297A0A0595",
            managerDeptName: "国网衡水供电公司",
            mainSenderId: "13B9B47F23CB3324E05338297A0A0595",
            mainSenderName: "国网桃城区供电公司",
            copySenderId: "",
            copySenderName: "",
            techSupvBasis: "GB/T12325-2008《电能质量供电电压偏差》GB/T12326-2008《电能质量电压波动和闪变》GB/T14549-1993《电能质量公用电网诺波》GB/T15543-20088电能质量三相电压不平衡》GB/T15945-2008名电能质量电力系统频率偷差》 GB/T18481-2001名电能质量暂时过电压和瞬态过电压》GB/T30137-2013《电能质量电压暂降与短时中断》",
            problemDesc: "2023年9月10日11日，国网衡水供电公司组织对220千伏站前铺站开展电能质量专项监督检测，发现544胡村站在此次检测时间段内，电压上下偏差不满足国标要求，电压长时闪变不满足国标要求，并存在2次暂态事件。",
            dealAdvise: "国网衡水市桃城区供电公司运检部组织排查544所带用户是否存在非线性、冲击性等负荷，组织开展重点用户电能质量检测，对存在问题用户提出治理要求，跟踪落实治理措施，并向市公司设备部反馈治理报告。",
            isUploadHead: 0
        },
        {
            alarmId: "4b854eebe09172eff780db3368f64e9d",
            provinceId: "13B9B47F1E483324E05338297A0A0595",
            provinceName: "国网河北电力有限公司",
            billType: "eba0f69f3a36826a1771d813a6eee0fc",
            billNo: "沧供[预]2023年--09003号",
            billName: "220kV大张庄光伏电场技术监督工作预警单",
            createrOrgId: "13B9B47F2C183324E05338297A0A0595",
            createrOrgName: "国网沧州供电公司",
            specialityType: "电能质量",
            orgId: "13B9B47F2D623324E05338297A0A0595",
            orgName: "国网海兴县供电公司",
            receiveUserId: null,
            receiveUserName: "",
            createrTime: "2023-09-28 00:00:00",
            time: null,
            managerDeptId: "13B9B47F2C183324E05338297A0A0595",
            managerDeptName: "国网沧州供电公司",
            mainSenderId: "13B9B47F2D623324E05338297A0A0595",
            mainSenderName: "国网海兴县供电公司",
            copySenderId: "",
            copySenderName: "",
            techSupvBasis: "GB/T 12325-2008《电能质量 供电电压偏差》 GB/T12326-2008《电能质量电压波动和闪变》GB/T14549-1993《电能质量 公用电网谐波》 GB/T15543-2008《电能质量三相电压不平衡》GB/T15945-2008《电能质量 电力系统频率偏差》GB/T 18481-2001《电能质量暂时过电压和瞬态过电压》GB/T30137-2013 《电能质量 电压暂降与短时中断》",
            problemDesc: "国网河北电科院、国网沧州供电公司组织对220千伏边务站开展电能质量专项监督时发现235庄边线电压总谐波畸变率最大值5.22%，95%概率值4.85%，3、5、7次谐波电压含有率最大值分别为2.71%、3.52%、2.35%，95%概率值分别为2.53%、3.31%、2.22%，不满足国标限制要求，怀疑光伏电场内SVG存在缺陷。",
            dealAdvise: "220kV大张庄光伏电场相关管理单位组织排查光伏电场站内设备设备是否存在缺陷，开展电能质量检测，并向国网沧州供电公司技术监督办公室(设备部)反馈排查治理情况。",
            isUploadHead: 0
        },
        ]
    }
})

tableStore.table.params.status = ''

provide('tableStore', tableStore)
// 新增计划
const add = () => {
    // title.value = '普测计划新增'
    listFormRef.value.open('新增告警单')
}


onMounted(() => {
    tableStore.index()
})
</script>

<style scoped lang="scss"></style>
