<template>
    <div class="dangerousBigProject">
        <div v-if="dialogFormVisible">
            <div class="search-box">
                <el-form :inline="true" :model="formInline" class="demo-form-inline" size="small">
                    <el-form-item label="作业申请单位">
                        <el-select v-model="formInline.enterpriseId" placeholder="请选择">
                            <el-option :label="item.enterpriseName" :value="item.id"
                                v-for="(item, index) in responsibilityList" :key="index">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="作业人">
                        <el-input placeholder="请输入" v-model="formInline.firemanName" clearable style="width: 200px">
                        </el-input>
                    </el-form-item>
                    <el-form-item>
                        <el-button type="primary" @click="onSubmit" plain>{{
                            $t('message.quality.inquire')
                        }}</el-button>
                    </el-form-item>
                    <el-form-item>
                        <el-button type="warning" @click="onRefresh" plain>刷新</el-button>
                    </el-form-item>
                </el-form>
                <!-- 新增 -->
                <!-- <el-button v-permission="{key: 'wdgc_add', menuPath: '/project/dangerousBigProject/parameter'}"  type="primary" @click="showAddDialog()" size="small">
            
            {{ $t('message.dangerousBigProject.add') }}
          </el-button> -->
                <!-- <el-button type="danger" size="small">批量删除</el-button> -->
            </div>
            <div class="table-box">
                <el-table class="tables" :data="tableData" size="small" @cell-click="previewDetail"
                    @selection-change="handleSelectionChange" :header-cell-style="{ 'text-align': 'center' }">
                    <!-- <el-table-column type="selection" align="center" width="60px"></el-table-column> -->
                    <el-table-column label="序号" type="index" align="center" width="60"></el-table-column>
                    <el-table-column align="center" label="作业票编号" prop="workTicketCode">
                        <template slot-scope="scope">
                            <div class="" style="display: flex;justify-content:center;font-weight:bold">
                                <div style="display: flex" :style="tableData.some(item => item.engineeringState == 3) ? 'justify-content:flex-end' : 'justify-content:center;'">
                                    <el-tag type="danger" effect="dark" size="mini"
                                        v-if="scope.row.engineeringState === 3">超期</el-tag>
                                    <!-- <el-tag type="danger" effect="dark" size="mini">超期</el-tag> -->
                                    <p class="item-title" style="margin-left:5px">{{ scope.row.workTicketCode }}</p>
                                </div>
                                <!-- <p>{{scope.row.people}}识别于：{{ scope.row.date }}</p> -->
                            </div>
                        </template>
                    </el-table-column>
                    <el-table-column align="center" label="申请单位" show-overflow-tooltip>
                        <!--  作业申请单位 -->
                        <template slot-scope="scope">
                            {{ scope.row.jobApplicationUnitName }}
                        </template>
                    </el-table-column>
                    <el-table-column align="center" label="涉及相关单位" prop="involveRelatedUnit"></el-table-column>
                    <el-table-column align="center" label="断路原因" prop="breakReason"></el-table-column>
                    <el-table-column align="center" label="作业内容" prop="jobContent"></el-table-column>
                    <el-table-column align="center" label="监护人" prop="guardianName"></el-table-column>
                    <el-table-column align="center" label="作业单位" prop="operatingUnitName"></el-table-column>
                    <el-table-column align="center" label="作业负责人" prop="assignmentPersonInChargeName"></el-table-column>
                    <!-- 状态 -->
                    <el-table-column :label="$t('message.dangerousBigProject.finalAcceptanceStatus')" align="center">
                        <template slot-scope="scope">
                            <span v-if="scope.row.finalAcceptanceStatus === 1"
                                style="color:#DAA520;font-weight:bold;">进行中</span>
                            <span v-if="scope.row.finalAcceptanceStatus === 2"
                                style="color:#008000;font-weight:bold;">已闭合</span>
                        </template>
                    </el-table-column>
                    <!-- 操作 -->
                    <el-table-column align="center" :label="$t('message.dangerousBigProject.operation')" width="120">
                        <template slot-scope="scope">
                            <!-- <el-button
                          @click.native.prevent="viewData(scope.$index, tableData)"
                          type="text"
                          size="small">
                              查看
                          </el-button> -->
                            <!-- <el-button
                          @click.native.prevent="editData(scope.$index, tableData)"
                          type="text"
                          size="small">
                              编辑
                          </el-button> -->
                            <!-- <el-button
                v-permission="{key: 'wdgc_edit', menuPath: '/project/dangerousBigProject/parameter'}" 
                  @click.stop="editRow(scope.$index, tableData)"
                  type="text"
                  size="small"
                >
                  <i class="el-icon-edit"></i>
                </el-button> -->
                            <!-- v-permission="{key: 'wdgc_delete', menuPath: '/project/dangerousBigProject/parameter'}"  -->
                            <el-button @click.stop="deleteRow(scope.$index, tableData)" type="text" size="small">
                                <i class="el-icon-delete"></i>
                                删除
                            </el-button>
                        </template>
                    </el-table-column>
                </el-table>
                <el-pagination class="pagerBox" background @size-change="handleSizeChange"
                    @current-change="handleCurrentChange" :current-page.sync="pageNo" layout="sizes, prev, pager, next"
                    :page-sizes="[10, 20, 30, 40]" :page-size="pageSize" :total="Number(total)">
                </el-pagination>
            </div>
            <el-dialog :modal-append-to-body="false" :title="$t('message.dangerousBigProject.hint')"
                :visible.sync="deleteDialog" width="30%">
                <span>
                    <!-- 是否确定删除该条记录？ -->
                    {{ $t('message.dangerousBigProject.hintContent') }}
                </span>
                <span slot="footer" class="dialog-footer">
                    <el-button @click="deleteDialog = false">
                        <!-- 取 消 -->
                        {{ $t('message.dangerousBigProject.cancel') }}
                    </el-button>
                    <el-button type="primary" @click="checkDelete">
                        <!-- 确 定 -->
                        {{ $t('message.dangerousBigProject.confirm') }}
                    </el-button>
                </span>
            </el-dialog>
        </div>
        <div style="height: 100%" v-else>
            <el-page-header @back="goBack" :content="dialogTitle" class="backText"
                :class="{ dark: styleType == 2 }"></el-page-header>
            <!-- <addPlan @cancleSave="goBack" v-if="isAdd"></addPlan> -->
            <detail :id="detailId" :isSuperDanger="isSuperDanger" :COMPANY_Type="'longguang'" @cancleSave="goBack"
                :workDetail="workDetail" v-if="isEdit">
                <template v-slot:basicinfo>
                    <div class="info-content">
                        <el-form class="form-box" :model="workDetail">
                            <el-form-item label="作业票编号：" :label-width="formLabelWidthDetail">
                                {{ workDetail.workTicketCode }}
                            </el-form-item>
                            <el-form-item label="作业单位：" :label-width="formLabelWidthDetail">
                                <el-select v-model="workDetail.operatingUnit" placeholder="请选择作业单位" disabled>
                                    <el-option :label="item.enterpriseName" :value="item.id"
                                        v-for="(item, index) in responsibilityList" :key="index">
                                    </el-option>
                                </el-select>
                            </el-form-item>
                            <el-form-item label="申请单位：" :label-width="formLabelWidthDetail">
                                <el-select v-model="workDetail.jobApplicationUnit" placeholder="请选择作业申请单位" disabled>
                                    <el-option :label="item.enterpriseName" :value="item.id"
                                        v-for="(item, index) in responsibilityList" :key="index">
                                    </el-option>
                                </el-select>
                            </el-form-item>
                            <el-form-item label="作业负责人：" :label-width="formLabelWidthDetail">
                                {{ workDetail.assignmentPersonInChargeName }}
                            </el-form-item>
                            <!-- <el-form-item label="作业申请时间：" :label-width="formLabelWidthDetail">
                                {{ workDetail.jobApplicationTime }}
                            </el-form-item> -->
                            <el-form-item label="涉及相关单位：" :label-width="formLabelWidthDetail">
                                {{ workDetail.involveRelatedUnit }}
                            </el-form-item>
                            <el-form-item label="断路原因：" :label-width="formLabelWidthDetail">
                                {{ workDetail.breakReason }}
                            </el-form-item>
                            <el-form-item label="断路地段示意图：" :label-width="formLabelWidthDetail">
                                {{ workDetail.breakLocationDiagram }}
                            </el-form-item>
                            <el-form-item label="断路地段相关说明：" :label-width="formLabelWidthDetail">
                                {{ workDetail.breakLocationDescription }}
                            </el-form-item>
                            <el-form-item label="监护人：" :label-width="formLabelWidthDetail">
                                {{ workDetail.guardianName }}
                            </el-form-item>
                            <el-form-item label="风险辨识结果：" :label-width="formLabelWidthDetail">
                                {{ workDetail.riskIdentificationResult }}
                            </el-form-item>
                            <el-form-item label="关联的其他特殊作业：" :label-width="formLabelWidthDetail">
                                {{ workDetail.otherRelatedSpecialTask }}
                            </el-form-item>
                            <el-form-item label="作业实施时间：" :label-width="formLabelWidthDetail">
                                <el-date-picker v-model="workDetail.hotWorkExecutionTime" type="daterange"
                                    value-format="yyyy-MM-dd HH:mm:ss" :disabled="isDisabledDetail" range-separator="至"
                                    start-placeholder="开始日期" end-placeholder="结束日期">
                                </el-date-picker>
                                <!--  -->
                                <!--  :picker-options="pickerOptions" -->
                            </el-form-item>
                            <el-form-item label="安全作业票编码：" :label-width="formLabelWidthDetail">
                                {{ workDetail.safetyWorkTicketCode }}
                            </el-form-item>
                        </el-form>
                    </div>
                </template>
                <!-- <template v-slot:gasanalysis>
                    <div>
                        <el-form :model="detailData">
                            <el-row>
                                <el-col :span="8">
                                    <el-form-item label="分析项目：" :label-width="formLabelWidthDetail">
                                        受限空间
                                    </el-form-item>
                                </el-col>
                                <el-col :span="8">
                                    <el-form-item label="有毒有害气体名称" :label-width="formLabelWidthDetail">
                                        一氧化碳
                                    </el-form-item>
                                </el-col>
                                <el-col :span="8">
                                    <el-form-item label="可燃气体名称：" :label-width="formLabelWidthDetail">
                                        天然气
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row>
                                <el-col :span="8">
                                    <el-form-item label="合格标准：" :label-width="formLabelWidthDetail">
                                        100
                                    </el-form-item>
                                </el-col>
                                <el-col :span="8">
                                    <el-form-item label="氧气含氧量(19.5%~21%)：" :label-width="formLabelWidthDetail">
                                        20%
                                    </el-form-item>
                                </el-col>
                                <el-col :span="8">
                                    <el-form-item label="取样分析时间：" :label-width="formLabelWidthDetail">
                                        <el-date-picker :disabled="isDisabledDetail" v-model="planDate" type="date"
                                            :picker-options="pickerOptions" value-format="yyyy-MM-dd">
                                        </el-date-picker>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row>
                                <el-col :span="8">
                                    <el-form-item label="分析部位：" :label-width="formLabelWidthDetail">
                                        顶部
                                    </el-form-item>
                                </el-col>
                                <el-col :span="8">
                                    <el-form-item label="分析人：" :label-width="formLabelWidthDetail">
                                        刘大大
                                    </el-form-item>
                                </el-col>
                                <el-col :span="10">
                                    <el-form-item label="分析数据：" :label-width="formLabelWidthDetail">

                                        <el-input v-model="detailData.engineeringSurvey" :disabled="isDisabledDetail"
                                            placeholder="一氧化碳/天然气/20%/2024-01-12/顶部/刘大大" autocomplete="off"></el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                        </el-form>
                    </div>
                </template> -->
            </detail>
            <editPlan :title="operateTitle" :editId="editId" @cancleSave="goBack" v-if="isUpdate"></editPlan>
        </div>
    </div>
</template>

<script>
import moment from 'moment'
//   import addPlan from './addPlan.vue'
import detail from './detail.vue'
import editPlan from './editPlan.vue'
import {
    selectDangerousEngineeringRecordApi,
    addDangerousEngineeringRecordApi,
    deleteDangerousEngineeringRecordApi,
    selectDangerousEngineeringTypeApi,
    editDangerousEngineeringRecordApi
} from "@/assets/js/api/dangerousBigProject"

import {
    getGroundSafetPageApi,
    getEnterpriseInfoListApi,
    getGroundSafetQueryByIdApi,
    getGroundSafetdeleteApi,
} from "@/assets/js/api/specialWork"

import { getCooperatorListApi } from "@/assets/js/api/cooperationUnit";
export default {
    components: {
        //   addPlan,
        detail,
        editPlan
    },
    data() {
        return {
            formInline: {
                firemanName: '',
                enterpriseId: '',
            },
            formLabelWidthDetail: "180px",
            detailData: {},
            responsibilityList: [],
            planDate: "",
            pickerOptions: {
                disabledDate(time) {
                    return time.getTime() < Date.now() - 8.64e7;
                },
            },
            isDisabledDetail: true,
            workDetail: {},

            operateTitle: "新增",
            isAdd: false,
            isEdit: false,
            isDisabled: false,
            engineeringName: "",
            detailId: "",
            isSuperDanger: false,
            tableData: [],
            dialogFormVisible: true,
            multipleSelection: [],
            addForm: {
                name: "",
                category: "",
                points: "",
                describe: "",
                address: "",
                date: [],
                people: "",
                unit: []
            },
            props: {
                multiple: true
            },
            typeOptions: [],
            describeOptions: [],
            options: [{
                label: 111,
                value: 12
            }],
            formLabelWidth: "110px",
            safeStatus: false,
            safeStatus2: false,
            safeStatus3: false,
            fileList: [],
            fileList2: [],
            fileList3: [],
            dialogTitle: "",
            pageNo: 1,
            pageSize: 10,
            total: 10,
            projectSn: "",
            enterpriseTypeId: 1,
            cooperatorList: [],
            file3: "",
            file2: "",
            file1: "",
            deleteId: "",
            editId: "",
            deleteDialog: false,
            isEditDisabled: false,
            editParms: [],
            fileName1: "",
            fileName2: "",
            fileName3: "",
            styleType: 1,
            isUpdate: false
        }
    },
    created() {
        this.projectSn = this.$store.state.projectSn
        this.styleType = this.$store.state.userInfo.styleType;
        // this.getCooperatorList()
        // this.getType()
        this.initData();
        this.getEnterpriseInfoList();
    },
    mounted() {

    },
    watch: {
        "workDetail.hotWorkExecutionTime": {
            handler(newVal) {
                console.log(newVal);
            },
        },
    },
    methods: {
        editRow(index, rows) {
            if (rows[index].finalAcceptanceStatus === 2) {
                this.$message.warning('该项危大工程已闭合，请勿操作')
                return
            }
            // console.log(index,rows[index].id)
            this.editId = rows[index].id
            this.operateTitle = "编辑"
            this.dialogTitle = "编辑"
            this.dialogFormVisible = false
            this.isEdit = false
            this.isAdd = false
            this.isUpdate = true;
        },
        goBack() {
            this.dialogFormVisible = true
            // this.initData()
            this.isAdd = false
            this.isEdit = false
            this.isUpdate = false;
        },
        showAddDialog() {
            this.dialogFormVisible = false
            this.isEdit = false
            this.isUpdate = false;
            this.isAdd = true
            // "新增"
            this.dialogTitle = this.$t('message.dangerousBigProject.add')
            // this.clearData()
            // if(this.isDisabled){
            //     this.isDisabled = false
            // }
            // if(this.isEditDisabled){
            //     this.isEditDisabled = false
            // }
        },
        onSubmit() {
            this.pageNo = 1;
            this.initData();
        },
        onRefresh() {
            this.formInline.enterpriseId = "";
            this.formInline.firemanName = "";
            this.pageNo = 1;
            this.initData();
        },
        getEnterpriseInfoList() {
            getEnterpriseInfoListApi({
                projectSn: this.projectSn
            }).then((res) => {
                if (res.result) {
                    console.log(res.result, 1)
                    this.responsibilityList = res.result;
                }
            })
        },
        initData() {
            let data = {
                jobApplicationUnit: this.formInline.enterpriseId,
                firemanName: this.formInline.firemanName,
                pageNo: this.pageNo,
                pageSize: this.pageSize,
                projectSn: this.projectSn
            }
            getGroundSafetPageApi(data).then((res) => {
                if (res.result) {
                    console.log(res.result.records, 1)
                    // res.result.records.forEach((item) => {
                    //     if (item.planStartTime && item.planEndTime) {
                    //         item.plan = item.planStartTime + "至" + item.planEndTime
                    //     }
                    //     if (item.responsibilityCompany.split(",").length > 0 && item.responsibilityCompany !== "") {
                    //         let arr = []
                    //         for (let i = 0; i < this.options.length; i++) {
                    //             let itm = this.options[i].value
                    //             for (let j = 0; j < item.responsibilityCompany.split(",").length; j++) {
                    //                 if (itm == item.responsibilityCompany.split(",")[j]) {
                    //                     arr.push(this.options[i].label)
                    //                 }
                    //             }
                    //         }
                    //         item.subpackageUnit = arr.join(",")
                    //     }
                    // })
                    // console.log(this.options)
                    this.tableData = res.result.records;
                    this.total = res.result.total;
                }
            });
        },
        editData(index, val) {
            this.viewData(index, val)
            // "编辑"
            this.dialogTitle = this.$t('message.dangerousBigProject.edit')
            this.editParms = val[index]
            if (this.file1) {
                let obj = {
                    name: this.file1.split("/")[this.file1.split("/").length - 1],
                    url: this.file1
                }
                this.fileList.push(obj)
            }
            if (this.file2) {
                let obj2 = {
                    name: this.file2.split("/")[this.file2.split("/").length - 1],
                    url: this.file2
                }
                this.fileList2.push(obj2)
            }
            if (this.file3) {
                let obj3 = {
                    name: this.file3.split("/")[this.file3.split("/").length - 1],
                    url: this.file3
                }
                this.fileList3.push(obj3)
            }
            this.isDisabled = false
            this.isEditDisabled = true
            // console.log(this.editId)
        },
        viewData(index, val) {
            this.clearData()
            this.dialogFormVisible = true
            // "查看"
            this.dialogTitle = this.$t('message.dangerousBigProject.view')
            this.isDisabled = true
            this.isEditDisabled = true
            this.addForm = {
                name: val[index].engineeringName,
                category: val[index].engineeringTypeId,
                points: val[index].engineeringSurvey,
                describe: val[index].describeName,
                address: val[index].constructionLocation,
                date: [val[index].planStartTime, val[index].planEndTime],
                people: val[index].personLiable,
                unit: val[index].responsibilityCompany
            }
            this.safeStatus = val[index].securityConstructionSchemeType == 2 ? true : false
            this.safeStatus2 = val[index].specialConstructionSchemeType == 2 ? true : false
            this.safeStatus3 = val[index].technicalDisclosureType == 2 ? true : false
            this.file1 = val[index].securityConstructionSchemeFile
            this.file2 = val[index].specialConstructionSchemeFile
            this.file3 = val[index].technicalDisclosureFile
            this.fileName1 = this.file1 ? this.file1.split("/")[this.file1.split("/").length - 1] : ""
            this.fileName2 = this.file2 ? this.file2.split("/")[this.file2.split("/").length - 1] : ""
            this.fileName3 = this.file3 ? this.file3.split("/")[this.file3.split("/").length - 1] : ""
        },
        clearData() {
            this.addForm = {
                name: "",
                category: "",
                points: "",
                describe: "",
                address: "",
                date: [],
                people: "",
                unit: ""
            },
                this.safeStatus = false
            this.safeStatus2 = false
            this.safeStatus3 = false
            this.file1 = ""
            this.file2 = ""
            this.file3 = ""
            this.fileList = []
            this.fileList2 = []
            this.fileList3 = []
        },
        // 选择类别
        changeType(value) {
            this.typeOptions.forEach(item => {
                if (item.id == value) {
                    item.describeList.forEach(item => {
                        item.value = item.id
                        if (item.describeName.length > 40) {
                            item.label = item.describeName.substring(0, 40) + '...'
                        } else {
                            item.label = item.describeName
                        }
                    })
                    this.describeOptions = item.describeList
                }
            })
            console.log(value)
        },
        //获取责任分包单位
        getCooperatorList() {
            let data = {
                projectSn: this.projectSn,
                pageNo: this.pageNo,
                pageSize: this.pageSize,
                enterpriseTypeId: this.enterpriseTypeId,
                enterpriseName: "",
            };
            getCooperatorListApi(data).then((res) => {
                if (res.code == 200) {

                    if (res.result.records.length > 0) {
                        this.cooperatorList = JSON.parse(JSON.stringify(res.result.records));
                        this.cooperatorList.forEach((item) => {
                            item.value = item.enterpriseLegalPerson
                            item.label = item.enterpriseName
                        })
                        this.options = this.cooperatorList
                        // console.log(this.options)
                    }
                }
            });
        },
        // 获取类别
        getType() {
            selectDangerousEngineeringTypeApi({ sn: JSON.parse(window.sessionStorage.getItem("vuex")).userInfo.headquartersSn }).then((res) => {
                if (res.result) {
                    // console.log(res.result)
                    res.result.forEach(item => {
                        item.label = item.typeName
                        item.value = item.id
                    })
                    this.typeOptions = res.result
                }
            })
        },
        addData() {
            if (this.addForm.name == "") {
                // 请输入危大工程名称
                this.$message.error(this.$t('message.dangerousBigProject.verifyMessage1'))
                return
            } else if (this.addForm.category == "") {
                // 请选择危大工程类别
                this.$message.error(this.$t('message.dangerousBigProject.verifyMessage2'))
                return
            } else if (this.addForm.describe == "") {
                // 请选择类别描述
                this.$message.error(this.$t('message.dangerousBigProject.verifyMessage3'))
                return
            }
            // console.log(this.addForm)
            let nowDate = new Date()
            let data = {
                constructionLocation: this.addForm.address,
                createTime: moment(nowDate).format('YYYY-MM-DD HH:mm:ss'),
                engineeringName: this.addForm.name,
                engineeringSurvey: this.addForm.points,
                engineeringTypeId: this.addForm.category,
                personLiable: this.addForm.people,
                planEndTime: this.addForm.date[1],
                planStartTime: this.addForm.date[0],
                projectSn: this.projectSn,
                securityConstructionSchemeFile: this.fileList.length > 0 ? this.file1 : "", //安全专项施工方案附件
                securityConstructionSchemeType: this.safeStatus ? 2 : 1,//是否完成安全专项施工方案交底，1未完成，2完成
                specialConstructionSchemeFile: this.fileList2.length > 0 ? this.file2 : '',//专项施工方案附件
                specialConstructionSchemeType: this.safeStatus2 ? 2 : 1,//是否完成专项施工方案交底，1未完成，2完成
                technicalDisclosureFile: this.fileList3.length > 0 ? this.file3 : '',//技术交底文件
                technicalDisclosureType: this.safeStatus3 ? 2 : 1,//是否完成安全技术交底，1未完成，2完成
                typeDescribeId: this.addForm.describe,//危大工程类别描述
                addForm: this.addForm
            }
            // "新增"
            if (this.dialogTitle == this.$t('message.dangerousBigProject.add')) {
                console.log(data)
                data.responsibilityCompany = this.addForm.unit ? this.addForm.unit.join(',') : ""
                addDangerousEngineeringRecordApi(data).then((res) => {
                    if (res.code = 200) {
                        this.$message.success(this.$t('message.dangerousBigProject.add') + this.$t('message.dangerousBigProject.success') + "！")
                        this.initData()
                    }
                    console.log(res)
                })
            } else if (this.dialogTitle == this.$t('message.dangerousBigProject.edit')) {
                // "编辑"
                data.id = this.editParms.id
                data.typeDescribeId = this.editParms.typeDescribeId
                if (this.addForm.unit && Array.isArray(this.addForm.unit)) {
                    data.responsibilityCompany = this.addForm.unit.join(',')
                } else {
                    data.responsibilityCompany = this.addForm.unit
                }
                editDangerousEngineeringRecordApi(data).then((res) => {
                    if (res.code = 200) {
                        // "修改成功！"
                        this.$message.success(this.$t('message.dangerousBigProject.editSuccess'))
                        this.initData()
                    }
                    console.log(res)
                })
            }
            this.dialogFormVisible = false
        },
        handleSelectionChange(val) {
            this.multipleSelection = val;
        },
        deleteRow(index, rows) {
            if (rows[index].finalAcceptanceStatus === 2) {
                this.$message.warning('该项特种作业已闭合，请勿操作')
                return
            }
            // console.log(index,rows[index].id)
            this.deleteId = rows[index].id
            this.deleteDialog = true
        },
        checkDelete() {
            getGroundSafetdeleteApi({ id: this.deleteId }).then((res) => {
                console.log(res)
                if (res.code == 200) {
                    this.$message.success(res.message)
                    this.initData()
                }
            })
            this.deleteDialog = false
        },
        handleSizeChange() {
            this.initData()
        },
        handleCurrentChange() {
            this.initData()
        },
        handleRemove(file, fileList) {
            console.log(fileList);
            this.fileList = fileList;
        },
        handlePreview(file) {
            console.log(file);
        },
        beforeRemove(file, fileList) {
            // 确定移除
            return this.$confirm(this.$t('message.dangerousBigProject.confirmRemove') + ` ${file.name}？`);
        },
        uploadSuccess(response, file, fileList) {
            console.log('fileList')
            console.log(fileList)
            this.fileList = fileList;
            this.file1 = this.$store.state.FILEURL + fileList[0].response.data[0].imageUrl
        },
        uploadError(err, file, fileList) {
            // 上传失败！
            this.$message.error(this.$t('message.dangerousBigProject.uploadFail'));
        },
        handleRemove2(file, fileList) {
            console.log(fileList);
            this.fileList2 = fileList;
        },
        handlePreview2(file) {
            console.log(file);
        },
        beforeRemove2(file, fileList) {
            // 确定移除
            return this.$confirm(this.$t('message.dangerousBigProject.confirmRemove') + `${file.name}？`);
        },
        uploadSuccess2(response, file, fileList) {
            console.log('fileList')
            console.log(fileList)
            this.fileList2 = fileList;
            this.file2 = this.$store.state.FILEURL + fileList[0].response.data[0].imageUrl
        },
        uploadError2(err, file, fileList) {
            // 上传失败！
            this.$message.error(this.$t('message.dangerousBigProject.uploadFail'));
        },
        handleRemove3(file, fileList) {
            console.log(fileList);
            this.fileList3 = fileList;
        },
        handlePreview3(file) {
            console.log(file);
        },
        beforeRemove3(file, fileList) {
            // 确定移除
            return this.$confirm(this.$t('message.dangerousBigProject.confirmRemove') + `${file.name}？`);
        },
        uploadSuccess3(response, file, fileList) {
            console.log('fileList')
            console.log(fileList)
            this.fileList3 = fileList;
            this.file3 = this.$store.state.FILEURL + fileList[0].response.data[0].imageUrl
        },
        uploadError3(err, file, fileList) {
            // 上传失败！
            this.$message.error(this.$t('message.dangerousBigProject.uploadFail'));
        },
        previewDetail(val) {
            console.log('!!!!!!!!!!!!!!!!!!', val)
            this.dialogFormVisible = false
            this.isEdit = true
            this.isAdd = false
            this.isUpdate = false
            // 详细
            this.dialogTitle = this.$t('message.dangerousBigProject.detailed')
            this.detailId = val.id

            getGroundSafetQueryByIdApi({
                id: val.id
            }).then((res) => {
                if (res.result) {
                    console.log(res.result, 1)
                    this.workDetail = {
                        ...val,
                        ...res.result,
                        // xzGasAnalyzeList: res.result.xzGasAnalyzeList,
                        hotWorkExecutionTime: [res.result.workExecutionBeginTime, res.result.workExecutionEndTime]
                    };
                }
            })

            this.isSuperDanger = val.issuperdanger
        }
    }
}
</script>

<style lang="less" scoped>
.el-button--text {
    color: #262d47;
}

.form-box {
    width: 70%;
    display: flex;
    flex-wrap: wrap;

    /deep/.el-form-item {
        width: 50%;
        padding-right: 10px;
        box-sizing: border-box;
    }

    // /deep/.el-col-12{
    //     padding-left: 20px;
    // }
    /deep/.el-input__inner {
        width: 100%;
    }

    /deep/.el-select {
        width: 100%;
    }

    /deep/.el-cascader {
        width: 100%;
    }
}

.gasanalysis-table {
    padding: 10px 20px;

    .el-row:first-child .el-col {
        background-color: #E9E9E9;
    }

    .el-row {
        font-size: 14px;
        color: #000;

        .el-col:first-child {
            background-color: #E9E9E9;
        }

        .el-col {
            height: 40px;
            display: flex;
            align-items: center;
            justify-content: center;
            border: 1px solid #E1E1E1;
        }
    }
}

.dangerousBigProject {
    padding-bottom: 20px;
    height: 100%;
    background: #fff;
    padding: 0 10px;
    padding-top: 20px;
    box-sizing: border-box;

    >div {
        height: 100%;

        .search-box {
            display: flex;
            margin-bottom: 20px;

            .search-input {
                width: 260px;
                margin-right: 20px;
            }
        }
    }
}

.el-icon-delete {
    color: #f56c6c;
}

.table-box {
    display: flex;
    flex-direction: column;
    height: calc(100% - 72px);

    .tables {
        margin-bottom: auto;
    }
}

.table-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;

    p {
        width: 100%;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
    }

    // .item-status {
    //   background: #f56c6c;
    //   display: block;
    //   color: #fff;
    //   border-radius: 4px;
    //   padding: 0 4px;
    //   height: 20px;
    // }
    .item-status {
        display: flex;
        align-items: center;

        img {
            width: 15px;
            height: 15px;
        }

        span {
            font-size: 14px;
            color: #EA3941;
        }
    }

    .status-none {
        height: 20px;
    }

    .item-title {
        font-weight: 600;
    }
}

.table-category-item {
    display: flex;

    p {
        width: 100%;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
    }

    // .item-status {
    //   background: #f56c6c;
    //   display: block;
    //   color: #fff;
    //   border-radius: 4px;
    //   padding: 0 4px;
    //   height: 20px;
    // }
    .item-status {
        display: flex;
        align-items: center;
        margin-right: 3px;

        img {
            width: 15px;
            height: 15px;
            margin-right: 3px;
        }

        span {
            font-size: 14px;
            color: #EA3941;
        }
    }

    .status-none {
        height: 20px;
    }

    .item-title {
        font-weight: 600;
    }
}

.add-dialog {
    /deep/ .el-dialog {
        width: 80%;
    }

    .form-title {
        margin-bottom: 20px;
    }

    /deep/ .el-form-item__label {
        text-align: left;
        white-space: nowrap;
    }

    /deep/ .el-form {
        padding-left: 36px;
        padding-right: 26px;
        margin-bottom: 20px;
    }

    /deep/ .el-select {
        width: 100%;
    }

    /deep/ .el-date-editor.el-input {
        width: 100%;
    }

    /deep/ .el-date-editor {
        width: 100%;
    }

    /deep/ .el-cascader {
        width: 100%;
    }

    .upload-item {
        display: flex;
        margin-bottom: 10px;
        align-items: center;

        span {
            margin-right: 16px;
        }

        .switch-check {
            margin-left: 8px;
            color: #409eff;
            line-height: 20px;
        }

        .switch-uncheck {
            margin-left: 8px;
            line-height: 20px;
        }
    }

    .upload-file {
        width: 50%;
        padding-left: 26px;
        box-sizing: border-box;
        margin-bottom: 20px;

        a {
            color: #409eff;
            text-decoration: none;
            margin-left: 6px;
        }
    }

    .upload-box {
        display: flex;
        flex-wrap: wrap;
    }
}

.el-pagination {
    display: flex;
    justify-content: center;
}

.backText {
    padding: 8px 0;
    padding-left: 10px;

    /deep/.el-page-header__content {
        font-size: 14px;
    }
}

.dark {
    /deep/.el-page-header__content {
        color: #fff;
    }

    /deep/ .print-btn {
        background: none;
        color: #262d47;
        font-size: 14px;
    }
}
</style>