<template>
   <div class="safety-management">
       <van-collapse v-model="activeNames" v-loading="loading">
           <van-collapse-item title="其他信息" name="1" title-class="collClass">
               <ul>
                   <li class="titleLi">
                       主要负责人：
                       <input
                           type="text"
                           placeholder="自动带出"
                           readonly
                           v-model="postData.fddbr"
                       />
                   </li>
                   <li class="titleLi">
                       负责人电话：
                       <input
                           type="text"
                           placeholder="请填写"
                           readonly
                           v-model="postData.legalPersonPhone"
                       />
                   </li>
                   <li class="titleLi">
                       年销售收入（万元）：
                       <input
                           type="text"
                           placeholder="请填写"
                           v-model="postData.yearCollect"
                       />
                   </li>
<!--                   <li class="titleLi" style="padding: 0">-->
<!--                       <span style="color:rgba(170, 170, 170, 1) ">（注：规模以上企业销售额2千万）</span>-->
<!--                   </li>-->
                   <li class="titleLi">
                       是否租赁企业
                       <van-radio-group v-model="postData.isLease" style="display: flex;width: 50vw" @change="change1">
                           <van-radio name="1" shape="square" style="margin-right: 5vw">是</van-radio>
                           <van-radio name="0" shape="square">否</van-radio>
                       </van-radio-group>
                   </li>
                   <li class="titleLi">
                       出租方
                       <input
                           type="text"
                           placeholder="请填写"
                           v-model="postData.leaserName"
                       />
                   </li>
                   <li class="titleLi">
                       安全管理部门
                       <input
                           type="text"
                           placeholder="请填写"
                           v-model="postData.safetyDepartment"
                       />
                   </li>
                   <li class="titleLi">
                       所属区（县）
                       <input
                           type="text"
                           placeholder="请填写"
                           v-model="postData.district"
                       />
                   </li>
                   <li class="titleLi">
                       所属街道（镇）
                       <input
                           type="text"
                           placeholder="请填写"
                           v-model="postData.street"
                       />
                   </li>
                   <li class="titleLi">
                       所属社区（村）
                       <input
                           type="text"
                           placeholder="请填写"
                           v-model="postData.community"
                       />
                   </li>
                   <li class="titleLi">
                       企业员工总数
                       <input
                           type="number"
                           placeholder="请填写"
                           v-model="postData.employeesCount"
                       />
                   </li>
                   <li class="titleLi">
                       两年内新员工数
                       <input
                           type="number"
                           placeholder="请填写"
                           v-model="postData.newEmployeesCount"
                       />
                   </li>
                   <li class="titleLi">
                       所属行业
                       <input
                           type="text"
                           placeholder="请填写"
                           v-model="postData.industry"
                       />
                   </li>
                   <li class="titleLi">
                       行业代码
                       <input
                           type="text"
                           placeholder="请填写"
                           v-model="postData.industryCode"
                       />
                   </li>
                   <li class="titleLi">
                       行业类型
                       <input
                           type="text"
                           placeholder="请填写"
                           v-model="postData.industryType"
                       />
                   </li>
                   <li class="titleLi">
                       登记注册类型
                       <input
                           type="text"
                           placeholder="请填写"
                           v-model="postData.registrationType"
                       />
                   </li>
               </ul>
           </van-collapse-item>
       </van-collapse>
       <van-collapse v-model="activeNames" style="margin: 3vw 0">
        <van-collapse-item title="企业安全管理信息" name="2" title-class="collClass">
            <ul>
                <li class="titleLi">
                    <div>
                        <span class="required">*</span>
                        安全管理员
                    </div>
                    <input
                        type="text"
                        placeholder="请填写"
                        v-model="postData.safetyUser"
                    />
                </li>
                <li class="titleLi">
                    <div>
                        <span class="required">*</span>
                        联系人手机
                    </div>
                    <input
                        type="text"
                        placeholder="请填写"
                        v-model="postData.safetyUserPhone"
                    />
                </li>
                <li class="titleLi">
                    <div>
                        标准化达标登记
                    </div>
                    <input
                        type="text"
                        placeholder="请填写"
                        v-model="postData.complianceLevel"
                    />
                </li>
                <li class="titleLi">
                    <div>
                        达标时间
                    </div>
                    <input
                        type="text"
                        placeholder="请选择"
                        readonly
                        @click="takeshow2"
                        v-model="postData.complianceTime"
                    />
                </li>
                <li class="titleLi titleLiLast" >
                    <div>
                        主要产品
                    </div>
                </li>
                <li class="areaLi">
                      <textarea
                          type="text"
                          placeholder="请填写"
                          rows="5"
                          class="zycpText"
                          v-model="postData.mainProducts"
                      />
                </li>
            </ul>
        </van-collapse-item>
       </van-collapse>
       <ul style="background: white;padding: 10px 16px">
           <li class="titleLi" v-for="(item,index) in typeList" :key="index" @click="toDanger(item)">
               {{item.name}}
               <van-icon name="arrow" />
           </li>
       </ul>
       <div class="tagBox">
            <div
                 v-for="(item,index) in tagList"
                 :key="index"
                 :class="item.isTrue==true?'selectTag':'tag'"
                 @click="chooseTag(item,index)"
            >
                {{item.name}}
            </div>
       </div>
       <div class="buttonBox">
           <button class="turnOff" @click="turnOff">关闭</button>
           <button class="preservation btn2" @click="commitSafety">
               保存
           </button>
       </div>
       <van-popup v-model="show2" position="bottom" :style="{ height: '50%' }">
           <van-datetime-picker
               v-model="currentDate"
               type="date"
               title="选择年月日"
               :min-date="minDate"
               :max-date="maxDate"
               @cancel="show2 = false"
               @confirm="selectTime2"
           /></van-popup>
       <van-dialog v-model="danger" :showConfirmButton="false" :closeOnClickOverlay="true">
              <hazardousOperations v-show="dangerName==='较大危险作业'" :faMsg="operations" @operations="getOp"/>
              <rawMaterial v-show="dangerName==='主要原辅材料产品'" :faMsg="resId" @confirm="getCon"></rawMaterial>
              <useDanger v-show="dangerName==='使用危化品情况'" :faMsg="useDangerObj" @useDan="genDan"/>
              <confinedSpace v-show="dangerName==='有限空间企业'" @space="getSpace" :faMsg="yxkjqy" style="height:60vh;overflow-y:auto"></confinedSpace>
              <liquidNitrogen v-show="dangerName==='液氮企业'" @nitrogen="getNitrogen" :faMsg="ydqy"/>
              <hazardousEquipment v-show="dangerName==='较大危险设备'" :faMsg="equipment" @equipment="geteq"></hazardousEquipment>
              <importantEquipment v-show="dangerName==='重要设备'" :faMsg="importantOp" @importantEq="getImpor"></importantEquipment>
              <metalSmelting v-show="dangerName==='金属冶炼企业'" @semlting="getSemlting" :faMsg="jsylqy"></metalSmelting>
              <explosionProofDust v-show="dangerName==='防爆粉尘企业'" @fcqy="getFcqy" :faMsg="fcqyMsg"/>
              <specialOperation v-show="dangerName==='特种作业人员'" :faMsg="specialWorker" @special="getSpecial" style="height:60vh;overflow-y:auto"></specialOperation>
       </van-dialog>
   </div>
</template>

<script>
import dayjs from 'dayjs'
import hazardousOperations from '@/pages/homeItems/components/hazardous-operations.vue'
import rawMaterial from '@/pages/homeItems/components/raw-material.vue'
import useDanger from '@/pages/homeItems/components/useDanger.vue'
import confinedSpace from '@/pages/homeItems/components/confined-space.vue'
import liquidNitrogen from '@/pages/homeItems/components/liquid-nitrogen.vue'
import hazardousEquipment from '@/pages/homeItems/components/hazardous-equipment.vue'
import importantEquipment from '@/pages/homeItems/components/important-equipment.vue'
import metalSmelting from '@/pages/homeItems/components/metal-smelting.vue'
import explosionProofDust from '@/pages/homeItems/components/explosion-proof-dust.vue'
import specialOperation from '@/pages/homeItems/components/special-operation.vue'
import { getSafetyCompanyInfoByCompanyId, addOrEditSafetyCompanyInfo, getSafetyCompanyInfoMaterialListBySafetyCompanyInfoId } from '@/service/api_savety'
import auth from '@/service/auth'
import myBus from '@/pages/homeItems/myBus'
import { getByCodes } from '@/service/api_settle_out'
import { Toast } from 'vant'
export default {
    name: 'SafetyManagement',
    components: {
        hazardousOperations,
        rawMaterial,
        useDanger,
        confinedSpace,
        liquidNitrogen,
        hazardousEquipment,
        importantEquipment,
        metalSmelting,
        explosionProofDust,
        specialOperation
    },
    data() {
        return {
            loading: false,
            dc_key: ['hazardous_equipment', 'metal_melting_furnace', 'hazardous_operations', 'refrigeration_operation', 'dust_areas_operation', 'use_hazardous_chemicals'],
            postData: {},
            activeNames: ['1', '2'],
            selectBor: 0,
            borderList: [
                { name: '规模以上', id: 0 },
                { name: '规模以下', id: 1 }
            ],
            radio: '1',
            show2: false,
            minDate: new Date(1980, 0, 1),
            maxDate: new Date(2025, 10, 1),
            currentDate: new Date(),
            dbsj: '',
            typeList: [
                { name: '主要原辅材料产品' },
                { name: '较大危险设备' },
                { name: '较大危险作业' },
                { name: '使用危化品情况' },
                { name: '重要设备' },
                { name: '特种作业人员' },
                { name: '相关资质' }
            ],
            tagList: [
                { name: '防爆粉尘企业', isTrue: false },
                { name: '有限空间企业', isTrue: false },
                { name: '液氮企业', isTrue: false },
                { name: '金属冶炼企业', isTrue: false }
            ],
            selectTag: 0,
            danger: false,
            dangerName: '',
            fddbr: '',
            frdh: '',
            resId: '',
            equipment: {
                hazardousEquipmentList: '',
                metalMeltingFurnaceList: '',
                hazardousEquipment: '',
                metalMeltingFurnace: '',
                hazardousEquipmentOther: ''
            },
            operations: {
                hazardousOperationsList: '',
                refrigerationOperationList: '',
                dustAreasOperationList: '',
                hazardousOperations: '',
                refrigerationOperation: '',
                dustAreasOperation: '',
                dustAreasOperationOther: ''
            },
            useDangerObj: {
                resId: '',
                storageMethod: '',
                isHazardSource: '',
                isHazardousProcesses: '',
                isHazardousChemicals: ''
            },
            importantOp: {
                useHazardousChemicalsList: '',
                useHazardousChemicals: '',
                hazardLess3tonsCount: '',
                hazardOver3tonsCount: '',
                hazardOtherCount: ''
            },
            specialWorker: {
                electricianWork: '',
                weldingCuttingWork: '',
                heightsWork: '',
                refrigerationAirWork: '',
                forkliftWork: '',
                elevatorWork: '',
                liftingMachineryWork: '',
                motorVehicleWork: '',
                gasWork: '',
                hazardousChemicalsSafeWork: '',
                otherWork: ''
            },
            fcqyMsg: {},
            yxkjqy: {},
            ydqy: {},
            jsylqy: {},
            newMap: {}
        }
    },
    mounted() {
        this.getCodes()
        this.getById()
    },
    methods: {
        change1(e) {
            this.postData.isLease = e.toString()
        },
        // 接收相关资质图片字段
        getMapImage() {
            if (this.$route.query.related) {
                const List = JSON.parse(this.$route.query.related)
                console.log('List', List)
                List.forEach(e => {
                    if (e.title === '组织框架图：') {
                        this.postData.frameworkMap = e.frameworkMap
                    }
                    if (e.title === '安全风险四色分布图：') {
                        this.postData.fourColorMap = e.frameworkMap
                    }
                    if (e.title === '企业平面图：') {
                        this.postData.companyMap = e.frameworkMap
                    }
                    if (e.title === '车间岗位布置图：') {
                        this.postData.workshopPositionMap = e.frameworkMap
                    }
                    if (e.title === '消防疏散路线图：') {
                        this.postData.fireEvacuationRouteMap = e.frameworkMap
                    }
                    if (e.title === '生产工艺流程图及简介：') {
                        this.postData.productionProcessFlowMap = e.frameworkMap
                    }
                })
                console.log(this.postData.frameworkMap)
            }
        },
        getCodes() {
            getByCodes({ codes: JSON.stringify(this.dc_key) }).then(res => {
                // 较大危险设备传值
                this.equipment.hazardousEquipmentList = JSON.parse(res.hazardous_equipment.dictValue)
                this.equipment.metalMeltingFurnaceList = JSON.parse(res.metal_melting_furnace.dictValue)
                this.equipment.hazardousEquipment = this.postData.hazardousEquipment
                this.equipment.metalMeltingFurnace = this.postData.metalMeltingFurnace
                this.equipment.hazardousEquipmentOther = this.postData.hazardousEquipmentOther
                //  较大危险作业传值
                this.operations.hazardousOperationsList = JSON.parse(res.hazardous_operations.dictValue)
                this.operations.refrigerationOperationList = JSON.parse(res.refrigeration_operation.dictValue)
                this.operations.dustAreasOperationList = JSON.parse(res.dust_areas_operation.dictValue)
                this.operations.hazardousOperations = this.postData.hazardousOperations
                this.operations.refrigerationOperation = this.postData.refrigerationOperation
                this.operations.dustAreasOperation = this.postData.dustAreasOperation
                //   重要设备传值
                this.importantOp.useHazardousChemicalsList = JSON.parse(res.use_hazardous_chemicals.dictValue)
                this.importantOp.useHazardousChemicals = this.postData.useHazardousChemicals
                this.importantOp.hazardOtherCount = this.postData.hazardOtherCount
            })
        },
        takeshow2() {
            this.show2 = true
        },
        selectTime2(e) {
            const dayjs = require('dayjs')
            this.postData.complianceTime = dayjs(e).format('YYYY-MM-DD')
            this.show2 = false
        },
        turnOff() {
            this.$router.push('/home/home')
        },
        changeMap(map) {
            const list = []
            if (map && map.length > 0) {
                map.forEach(d => {
                    list.push(d.data)
                })
            }
            return list.toString()
        },
        toDanger(item) {
            if (item.name === '相关资质') {
                if (!this.postData.safetyUserPhone || !this.postData.safetyUser) {
                    Toast('请优先填写安全管理员信息与联系方式并保存')
                }
                if (this.$route.query.related) {
                    const List = JSON.parse(this.$route.query.related)
                    console.log('List', List)
                    List.forEach(e => {
                        if (e.title === '组织框架图：') {
                            this.postData.frameworkMap = e.frameworkMap
                        }
                        if (e.title === '安全风险四色分布图：') {
                            this.postData.fourColorMap = e.frameworkMap
                        }
                        if (e.title === '企业平面图：') {
                            this.postData.companyMap = e.frameworkMap
                        }
                        if (e.title === '车间岗位布置图：') {
                            this.postData.workshopPositionMap = e.frameworkMap
                        }
                        if (e.title === '消防疏散路线图：') {
                            this.postData.fireEvacuationRouteMap = e.frameworkMap
                        }
                        if (e.title === '生产工艺流程图及简介：') {
                            this.postData.productionProcessFlowMap = e.frameworkMap
                        }
                    })
                    const zzObj = {
                        frameworkMap: this.postData.frameworkMap ? this.postData.frameworkMap : [],
                        fourColorMap: this.postData.fourColorMap ? this.postData.fourColorMap : [],
                        companyMap: this.postData.companyMap ? this.postData.companyMap : [],
                        workshopPositionMap: this.postData.workshopPositionMap ? this.postData.workshopPositionMap : [],
                        fireEvacuationRouteMap: this.postData.fireEvacuationRouteMap ? this.postData.fireEvacuationRouteMap : [],
                        productionProcessFlowMap: this.postData.productionProcessFlowMap ? this.postData.productionProcessFlowMap : []
                    }
                    this.$router.push({ path: '/related-qualifications', query: { imageList: JSON.stringify(zzObj) }})
                } else {
                    const zzObj = {
                        frameworkMap: this.newMap.frameworkMap ? this.newMap.frameworkMap : [],
                        fourColorMap: this.newMap.fourColorMap ? this.newMap.fourColorMap : [],
                        companyMap: this.newMap.companyMap ? this.newMap.companyMap : [],
                        workshopPositionMap: this.newMap.workshopPositionMap ? this.newMap.workshopPositionMap : [],
                        fireEvacuationRouteMap: this.newMap.fireEvacuationRouteMap ? this.newMap.fireEvacuationRouteMap : [],
                        productionProcessFlowMap: this.newMap.productionProcessFlowMap ? this.newMap.productionProcessFlowMap : []
                    }
                    this.$router.push({ path: '/related-qualifications', query: { imageList: JSON.stringify(zzObj) }})
                }
            } else {
                this.dangerName = item.name
                this.danger = true
            }
        },
        chooseTag(item, index) {
            this.dangerName = item.name
            // item.isTrue = !item.isTrue
            this.danger = true
        },
        commitSafety() {
            this.getMapImage()
            this.postData.companyId = auth.currUser().id
            addOrEditSafetyCompanyInfo(this.postData).then(res => {
                if (res.code == 200) {
                    Toast('保存成功')
                    this.getById()
                    // location.reload()
                } else {
                    Toast(res.msg)
                }
            })
        },
        //     获取信息
        getById() {
            // 获取主要信息
            getSafetyCompanyInfoByCompanyId({ id: auth.currUser().id }).then(res => {
                this.postData = res
                // 取图
                this.newMap = {
                    frameworkMap: this.changeMap(JSON.parse(this.postData.frameworkMap)),
                    fourColorMap: this.changeMap(JSON.parse(this.postData.fourColorMap)),
                    companyMap: this.changeMap(JSON.parse(this.postData.companyMap)),
                    workshopPositionMap: this.changeMap(JSON.parse(this.postData.workshopPositionMap)),
                    fireEvacuationRouteMap: this.changeMap(JSON.parse(this.postData.fireEvacuationRouteMap)),
                    productionProcessFlowMap: this.changeMap(JSON.parse(this.postData.productionProcessFlowMap))
                }
                this.resId = res.id
                this.useDangerObj.resId = res.id
                this.useDangerObj.storageMethod = res.storageMethod
                this.useDangerObj.isHazardousChemicals = res.isHazardousChemicals
                this.useDangerObj.isHazardSource = res.isHazardSource
                this.useDangerObj.isHazardousProcesses = res.isHazardousProcesses
                // 三吨上下
                this.importantOp.hazardLess3tonsCount = res.hazardLess3tonsCount
                this.importantOp.hazardOver3tonsCount = res.hazardOver3tonsCount
                // 特种作业人员
                this.specialWorker.electricianWork = res.electricianWork
                this.specialWorker.weldingCuttingWork = res.weldingCuttingWork
                this.specialWorker.heightsWork = res.heightsWork
                this.specialWorker.refrigerationAirWork = res.refrigerationAirWork
                this.specialWorker.forkliftWork = res.forkliftWork
                this.specialWorker.elevatorWork = res.elevatorWork
                this.specialWorker.liftingMachineryWork = res.liftingMachineryWork
                this.specialWorker.motorVehicleWork = res.motorVehicleWork
                this.specialWorker.gasWork = res.gasWork
                this.specialWorker.hazardousChemicalsSafeWork = res.hazardousChemicalsSafeWork
                this.specialWorker.otherWork = res.otherWork
                // 防爆粉尘企业
                this.fcqyMsg.dustType = res.dustType
                this.fcqyMsg.preventionWoodenDustType = res.preventionWoodenDustType
                this.fcqyMsg.sander = res.sander
                this.fcqyMsg.paint = res.paint
                this.fcqyMsg.employeesCount2 = res.employeesCount2
                this.fcqyMsg.dustproofWorkerCount = res.dustproofWorkerCount
                // 有限空间企业
                this.yxkjqy.limitedSpaceName = res.limitedSpaceName
                this.yxkjqy.harmfulFactors = res.harmfulFactors
                this.yxkjqy.limitedSpaceType = res.limitedSpaceType
                this.yxkjqy.setWarningSigns = res.setWarningSigns
                this.yxkjqy.limitedSpaceLocation = res.limitedSpaceLocation
                this.yxkjqy.testingInstruments = res.testingInstruments
                this.yxkjqy.responsibleDepartment = res.responsibleDepartment
                this.yxkjqy.emergencyEquipment = res.emergencyEquipment
                this.yxkjqy.measuresTaken = res.measuresTaken
                this.yxkjqy.haveSewageTreatment = res.haveSewageTreatment
                this.yxkjqy.limitedSpaceRemark = res.limitedSpaceRemark
                // 液氮企业
                this.ydqy.liquidNitrogenMain = res.liquidNitrogenMain
                // 金属冶炼企业
                this.jsylqy.metalSmeltingTonnage = res.metalSmeltingTonnage
                this.jsylqy.metalSmeltingCount = res.metalSmeltingCount
                this.jsylqy.isMetallurgicalCrane = res.isMetallurgicalCrane
                this.jsylqy.metalSmeltingRemark = res.metalSmeltingRemark
                this.tagList.forEach(e => {
                    if (e.name === '防爆粉尘企业') {
                        e.isTrue = res.isExplosionProofDust == 1
                    }
                    if (e.name === '有限空间企业') {
                        e.isTrue = res.isLimitedSpace == 1
                    }
                    if (e.name === '液氮企业') {
                        e.isTrue = res.isLiquidNitrogen == 1
                    }
                    if (e.name === '金属冶炼企业') {
                        e.isTrue = res.isMetalSmelting == 1
                    }
                })
                // -------------------------------------------------------------------------------
            })
        },
        // 获取主要原辅材料数据
        getCon(e) {
            this.danger = false
            this.postData.safetyCompanyInfoMaterial = JSON.stringify(e)
            console.log(this.postData.safetyCompanyInfoMaterial)
            this.$nextTick(() => {
                this.commitSafety()
            })
        },
        // 获取较大危险设备
        geteq(e) {
            this.danger = false
            this.postData.hazardousEquipment = e.hazardousEquipmentList ? e.hazardousEquipmentList.toString() : ''
            this.postData.metalMeltingFurnace = e.metalMeltingFurnaceList ? e.metalMeltingFurnaceList.toString() : ''
            this.postData.hazardousEquipmentOther = e.hazardousEquipmentOther
            console.log(this.postData.metalMeltingFurnace)
            this.$nextTick(() => {
                this.commitSafety()
            })
        },
        getOp(e) {
            this.danger = false
            this.postData.hazardousOperations = e.hazardousOperationsList ? e.hazardousOperationsList.toString() : ''
            this.postData.refrigerationOperation = e.refrigerationOperationList ? e.refrigerationOperationList.toString() : ''
            this.postData.dustAreasOperation = e.dustAreasOperationList ? e.dustAreasOperationList.toString() : ''
            this.postData.dustAreasOperationOther = e.dustAreasOperationOther
            this.$nextTick(() => {
                this.commitSafety()
            })
        },
        // 获取使用危化品
        genDan(e) {
            this.danger = false
            this.postData.storageMethod = e.storageMethod ? e.storageMethod : ''
            this.postData.isHazardSource = e.isHazardSource ? e.isHazardSource : null
            this.postData.isHazardousProcesses = e.isHazardousProcesses ? e.isHazardousProcesses : null
            this.postData.isHazardousChemicals = e.isHazardousChemicals ? e.isHazardousChemicals : null
            this.postData.safetyCompanyInfoHazardous = e.safetyList ? e.safetyList : ''
            this.$nextTick(() => {
                this.commitSafety()
            })
        },
        // 获取重要设备
        getImpor(e) {
            this.danger = false
            this.postData.useHazardousChemicals = e.useHazardousChemicalsList ? e.useHazardousChemicalsList.toString() : ''
            this.postData.hazardOtherCount = e.hazardOtherCount
            this.postData.hazardLess3tonsCount = e.hazardLess3tonsCount
            this.postData.hazardOver3tonsCount = e.hazardOver3tonsCount
            this.$nextTick(() => {
                this.commitSafety()
            })
        },
        //  获取特殊工作人员
        getSpecial(e) {
            this.danger = false
            this.postData.electricianWork = e.electricianWork
            this.postData.weldingCuttingWork = e.weldingCuttingWork
            this.postData.heightsWork = e.heightsWork
            this.postData.refrigerationAirWork = e.refrigerationAirWork
            this.postData.forkliftWork = e.forkliftWork
            this.postData.elevatorWork = e.elevatorWork
            this.postData.liftingMachineryWork = e.liftingMachineryWork
            this.postData.motorVehicleWork = e.motorVehicleWork
            this.postData.gasWork = e.gasWork
            this.postData.hazardousChemicalsSafeWork = e.hazardousChemicalsSafeWork
            this.postData.otherWork = e.otherWork
            this.$nextTick(() => {
                this.commitSafety()
            })
        },
        //  获取防尘企业数据
        getFcqy(e) {
            this.danger = false
            this.postData.dustType = e.dustType
            this.postData.preventionWoodenDustType = e.preventionWoodenDustType
            this.postData.sander = e.sander
            this.postData.paint = e.paint
            this.postData.employeesCount2 = e.employeesCount2
            this.postData.dustproofWorkerCount = e.dustproofWorkerCount
            if (e.dustType && e.dustproofWorkerCount) {
                this.postData.isExplosionProofDust = 1
            } else {
                this.postData.isExplosionProofDust = 0
            }
            this.$nextTick(() => {
                this.commitSafety()
            })
        },
        //  获取有限空间企业
        getSpace(e) {
            this.danger = false
            this.postData.limitedSpaceName = e.limitedSpaceName
            this.postData.harmfulFactors = e.harmfulFactors
            this.postData.limitedSpaceType = e.limitedSpaceType
            this.postData.setWarningSigns = e.setWarningSigns
            this.postData.limitedSpaceLocation = e.limitedSpaceLocation
            this.postData.testingInstruments = e.testingInstruments
            this.postData.responsibleDepartment = e.responsibleDepartment
            this.postData.emergencyEquipment = e.emergencyEquipment
            this.postData.measuresTaken = e.measuresTaken
            this.postData.haveSewageTreatment = e.haveSewageTreatment
            this.postData.limitedSpaceRemark = e.limitedSpaceRemark
            if (e.limitedSpaceName && e.limitedSpaceType) {
                this.postData.isLimitedSpace = 1
            } else {
                this.postData.isLimitedSpace = 0
            }
            this.$nextTick(() => {
                this.commitSafety()
            })
        },
        //     获取液氮企业
        getNitrogen(e) {
            this.danger = false
            this.postData.liquidNitrogenMain = e.liquidNitrogenMain
            if (e.liquidNitrogenMain) {
                this.postData.isLiquidNitrogen = 1
            } else {
                this.postData.isLiquidNitrogen = 0
            }
            this.$nextTick(() => {
                this.commitSafety()
            })
        },
        //     金属冶炼企业
        getSemlting(e) {
            this.danger = false
            this.postData.metalSmeltingTonnage = e.metalSmeltingTonnage
            this.postData.metalSmeltingCount = e.metalSmeltingCount
            this.postData.isMetallurgicalCrane = e.isMetallurgicalCrane
            this.postData.metalSmeltingRemark = e.metalSmeltingRemark
            if (e.metalSmeltingTonnage && e.metalSmeltingCount) {
                this.postData.isMetalSmelting = 1
            } else {
                this.postData.isMetalSmelting = 0
            }
            this.$nextTick(() => {
                this.commitSafety()
            })
        }
    }
}
</script>
<style lang="scss">
.safety-management{
    font-size: 4vw;
    margin: 3vw 2vw !important;
    .collClass{
        color:rgba(29, 24, 188, 1) ;
        font-size: 4.2vw;
    }
    .titleLi {
        font-size: 3.5vw;
        //font-weight: 700;
        white-space: nowrap;
        color: #333333;
        display: flex;
        align-items: center;
        justify-content: space-between;
        height: 8vw;
        padding: 1vw 0 2vw 0;
        border-bottom: 1px solid rgb(243, 236, 236);
        input{
            width: 50vw;
        }
        .required {
            color: red;
        }
    }
    .areaLi{
        padding: 1vw 0 2vw 0;
    }
    .titleLiLast {
        border-bottom: none;
        padding: 2vw 0 0 0;
        align-items: flex-end;
    }
    .handle{
        display: flex;
        .handleItem{
            display: flex;
            align-items: center;
            justify-content: space-around;
            border: 1px solid #CCCCCC;
            border-radius: 1.5vw;
            padding: 1vw 2vw;
            color: #CCCCCC;
            margin-right: 3vw;
        }
        .handleItem1{
            border: 1px solid rgba(29, 24, 188, 1);
            background: rgba(29, 24, 188, 0.05);
            color: rgba(29, 24, 188, 1);
        }
        .border1{
            border: 1px solid rgba(29, 24, 188, 1);
            border-radius: 50%;
            width: 3vw;
            height: 3vw;
            display: flex;
            align-items: center;
            justify-content: center;
            margin-right: 1.5vw;
        }
        .border1-un{
            border: 1px solid #CCCCCC;
        }
        .border2{
            width: 1.5vw;
            height: 1.5vw;
            background: rgba(29, 24, 188, 1);
            border-radius: 50%;
        }
    }
    .zycpText{
        background: rgba(249, 249, 249, 1);
        padding: 2vw;
        width: 95%;
        resize: none;
        font-size: 3.8vw;
    }
    .tagBox{
        background: white;
        padding: 4vw 16px;
        display: grid;
        margin: 3vw 0;
        grid-template-columns: 1fr 1fr 1fr;
        gap: 2vw;
        font-size: 3.2vw;
        .selectTag{
            color: rgba(29, 24, 188, 1);
            width: 28vw;
            height: 7.5vw;
            display: flex;
            align-items: center;
            justify-content: center;
            background:rgba(32, 65, 172, 0.05);
            border-radius: 10px;
        }
        .tag{
            color: rgba(119, 119, 119, 1);
            width: 28vw;
            height: 7.5vw;
            display: flex;
            align-items: center;
            justify-content: center;
            border: 1px solid rgba(119, 119, 119, 1);
            box-sizing: border-box;
            border-radius: 10px;
        }
    }
    .buttonBox {
        //background: white;
        display: flex;
        align-items: center;
        justify-content: space-evenly;
        margin-top: 3vw;
        margin-bottom: 5vw;
        padding: 5vw 0;
        button {
            padding: 2vw 10vw;
            border-radius: 15px;
        }
        .turnOff {
            background: white;
            border: 1px solid rgb(0, 47, 167);
            color: rgb(0, 47, 167);
        }
        .btn2 {
            background-color: rgb(0, 47, 167);
            color: white;
            border: white solid 1px;
        }
    }
}
</style>
