<template>
    <div class="notificationAll">
        <el-dialog title="通告数据" custom-class="notificationAllOver" v-model="dialogVisible" :fullscreen="true" :close-on-click-modal="false">
            <div style="display: flex;">
                <div class="exceed">
                    <span class="exceedSpan">通告标题：</span>
                    <el-input v-model="noticeTitle" placeholder="请输入通告标题"></el-input>
                </div>
                <seachs :showRest="false" @handleSeach="getSeachData" @handleRest="resetSeach"></seachs>
            </div>
            <div class="notificationTableData">
                <el-table :data="notificationData.slice((page.currentPage-1)*page.pagesize, page.currentPage*page.pagesize)" style="width: 100%">
                    <el-table-column label="发布状态" prop="releaseState" width="100" align="center">
                        <template #default="scope">
                            <span class="statusSty"
                             :style="scope.row.releaseState === '已发布'?'background:#61C760':scope.row.releaseState === '未发布'?'background:#5093E1':'background:#9DA5BE'">
                             {{scope.row.releaseState}}
                             </span>
                        </template>
                    </el-table-column>
                    <el-table-column label="通告标题" width="200">
                        <template #default="scope">
                            <el-tooltip
                                class="box-item"
                                effect="customized"
                                :content="scope.row.noticeTitle"
                                placement="right"
                            >
                                <span class="tooltipCCDes">{{scope.row.noticeTitle}}</span>
                            </el-tooltip>
                        </template>
                    </el-table-column>
                    <el-table-column label="通告内容" width="400">
                        <template #default="scope">
                            <el-tooltip
                                class="box-item"
                                effect="customized"
                                :content="scope.row.noticeContent"
                                placement="right"
                            >
                                <span class="tooltipCC">{{scope.row.noticeContent}}</span>
                            </el-tooltip>
                        </template>
                    </el-table-column>
                    <el-table-column label="发布部门" prop="releaseDeptName" width="200" />
                    <el-table-column label="发布至" prop="sendTo" />
                    <el-table-column label="发布人" prop="releasePeopleName" />
                    <el-table-column label="发布时间" prop="createTime" />
                    <el-table-column label="操作" width="80">
                        <template #default="scope">
                            <p class="indicitem" @click="watchDetail(scope.row)">详情</p>
                        </template>
                    </el-table-column>
                </el-table>
                <el-pagination
                    @size-change="handleSizeChange"
                    @current-change="handleCurrentChange"
                    :current-page="page.currentPage"
                    :page-size="page.pagesize"
                    layout="total, prev, pager, next, jumper"
                    :total="page.total">
                </el-pagination>
            </div>
        </el-dialog>
        <notification-detail ref="notificationDetail"></notification-detail>
    </div>
</template>

<script>
import seachs from '../seachGroup.vue'
import notificationDetail from './gateWayNotificationDetail.vue'
import {apiGetevaluationdeptnoticeList} from '../../api/api'
export default {
    components: {
        seachs,
        notificationDetail
    },
    data() {
        return {
            dialogVisible: false,
            noticeTitle: '',
            notificationData: [],
            page:{
                pagesize: 12,
                currentPage: 1,
                total: 0
            },
        }
    },
    methods: {
        init() {
            this.dialogVisible = true
            this.getevalunotificationList()
        },
        // 查询列表页面
        getevalunotificationList() {
            let that = this
            let userMes = JSON.parse(window.sessionStorage.getItem('user'))
            if (userMes.deptId) {
                let params = {
                    deptId: userMes.deptId,
                    noticeTitle: that.noticeTitle
                }
                apiGetevaluationCircularDisplaylist(params).then(datas =>{
                    if (datas && datas.data) {
                        that.notificationData = datas.data
                        that.page.total = datas.data.length
                    }
                })
            }
        },
        watchDetail(row) {
            this.$refs.notificationDetail.init(row)
        },
    }
}
</script>

<style lang="less">
.notificationAll{
    .el-overlay{
        .notificationAllOver{
            .el-dialog__body{
                padding: 30px 20px !important;
                .exceed{
                    display: flex;
                    .exceedSpan{
                        width: 100px;
                        height: 12px;
                        font-size: 14px;
                        font-family: Microsoft YaHei;
                        font-weight: 400;
                        color: #8991B0;
                        line-height: 12px;
                        margin-top: 14px;
                    }
                    .el-input{
                        margin-right:10px;
                        height: 40px;
                        .el-input__inner{
                            height:40px;
                        }
                        .el-input__suffix{
                            .el-select__caret{
                                line-height:30px;
                            }
                        }
                    }
                }
                .notificationTableData{
                    margin-top: 20px;
                    .el-table{
                        .el-table__body-wrapper{
                            height: 65vh !important;
                        }
                        .el-input__inner{
                            height: 30px !important;
                        }
                        .el-radio__label{
                            display: none;
                        }
                        .statusSty{
                            width: 52px;
                            height: 21px;
                            line-height: 21px;
                            display: inline-block;
                            border-radius: 3px;
                            color: #fff;
                        }
                        .tooltipCC{
                            width: 300px !important;
                            display: inline-block;
                            overflow: hidden;
                            text-overflow: ellipsis;
                            white-space: nowrap;
                        }
                        .tooltipCCDes{
                            width: 200px;
                            display: inline-block;
                            overflow: hidden;
                            text-overflow: ellipsis;
                            white-space: nowrap;
                        }
                        .indicitem{
                            color: #409EFF;
                            font-size: 12px;
                            margin-right: 20px;
                            cursor:pointer;
                            &:hover{
                                text-decoration: underline;
                            }
                        }
                    }
                    .el-pagination{
                        margin-top: 20px;
                        text-align: end;
                        position: relative;
                    }
                }
            }
        }
    }
}
</style>