<template>
   <div class="global">
    <div class="mainContainer">
    <div class="select">
      <el-form>
        <el-form-item label="选择设施种类">
          <el-select v-model="type" @change="headChange()">
            <el-option
              v-for="item in process"
              :key="item.type"
              :label="item.label"
              :value="item.type"
            />
          </el-select>
        </el-form-item>
      </el-form>
    </div>
    <div class="table">
      <el-table :data="tableData" border stripe highlight-current-row>
        <el-table-column
            type="index"
            align="center"
            label="序号"
            width="50px"
          />
        <el-table-column label="记录时间" prop="recordTime" align="center" />
        <el-table-column label="标题" prop="title" align="center" > </el-table-column>
         <el-table-column label="选项" prop="details" align="center">
            <template slot-scope="scope">
              <!-- <div>{{scope.row}}</div>  -->
              <el-radio-group
                v-model="scope.row.subData"
                @change="radioChange(scope.row)"
              >
                <el-radio label="1" :disabled="disabled">{{
                  scope.row.details.split(",")[0]
                }}</el-radio>
                <el-radio label="0" :disabled="disabled">{{
                  scope.row.details.split(",")[1]
                }}</el-radio>
              </el-radio-group>
            </template>
          </el-table-column>
      </el-table>
    </div>
    <div class="btns">
      <el-button type="success" @click="goBack()">返回</el-button>
      <el-button type="success" @click="btnSave()">保存</el-button>
    </div>
    </div>
  </div>
</template>
<script>
//时间格式的转化
import { getNowFormatDate } from "@/utils"

export default {
  name: "AddType",
  data() {
    return {
      //初始化是否禁用
      disabled:false,
      // 表格数据初始化
      tableData:this.warehouse,
      // 头部下拉选的值
      type: "cfss",

      // 流程下拉选
      process: [
        {
          label: "仓房设施",
          type: "cfss",
        },
        {
          label: "消防设施",
          type: "xfss",
        },
        {
          label: "计量设施",
          type: "jlss",
        },
        {
          label: "药品库设施",
          type: "ypkss",
        },
        {
          label: "配电室设施",
          type: "pdsss",
        },
      ],

      //仓房设施表格数据
      warehouse:[
        {
          recordTime:"",
          title:"仓房主体是否完好",
          subData:"",
          details:"是,否",
        },
         {
          recordTime:"",
          title:"门窗是否完好",
          subData:"",
          details:"是,否",
        },
          {
          recordTime:"",
          title:"屋面防水是否完好",
          subData:"",
          details:"是,否",
        },
          {
          recordTime:"",
          title:"屋面隔热是否完好",
          subData:"",
          details:"是,否",
        },
          {
          recordTime:"",
          title:"仓内吊顶是否完好",
          subData:"",
          details:"是,否",
        },

           {
          recordTime:"",
          title:"爬梯是否完好",
          subData:"",
          details:"是,否",
        },
          {
          recordTime:"",
          title:"挡粮门是否完好",
          subData:"",
          details:"是,否", 
        },
          {
          recordTime:"",
          title:"粮情测温是否完好",
          subData:"",
          details:"是,否",
        },

        {
          recordTime:"",
          title:"远程监控设施是否完好",
          subData:"",
          details:"是,否",
        },
        {
          recordTime:"",
          title:"通风设施（轴流风机、内环流系统）是否完好",
          subData:"",
          details:"是,否",
        },
        
      ],

      //消防设施
      fire:[
        {
          recordTime:"",
          title:"是否有水塔",
          subData:"",
          details:"是,否",
        },
        {
          recordTime:"",
          title:"水塔是否完好",
          subData:"",
          details:"是,否",
        },
         {
          recordTime:"",
          title:"是否有消防水池",
          subData:"",
          details:"是,否",
        },
         {
          recordTime:"",
          title:"消防水池是否完好",
          subData:"",
          details:"是,否",
        },
          {
          recordTime:"",
          title:"是否有消防管网",
          subData:"",
          details:"是,否",
        },
          {
          recordTime:"",
          title:"消防官网是否完好",
          subData:"",
          details:"是,否",
        },
         {
          recordTime:"",
          title:"是否有泡沫灭火系统",
          subData:"",
          details:"是,否",
        },

         {
          recordTime:"",
          title:"消防泡沫系统是否完",
          subData:"",
          details:"是,否",     


        },
          {
          recordTime:"",
          title:"是否有火灾报警系统",
          subData:"",
          details:"是,否",
        },
         {
          recordTime:"",
          title:"是否有感温火灾探测系统",
          subData:"",
          details:"是,否",
        },
          {
          recordTime:"",
          title:"是否有消防广播系统",
          subData:"",
          details:"是,否",
        },
      ],


      //计量设施
      metering:[
         {
          recordTime:"",
          title:"是否有地磅",
          subData:"",
          details:"是,否",
        },
         {
          recordTime:"",
          title:"地磅是否完好",
          subData:"",
          details:"是,否",
        },
         {
          recordTime:"",
          title:"地磅是否定期年检",
          subData:"",
          details:"是,否",
        },
         {
          recordTime:"",
          title:"地磅是否有专人管理",
          subData:"",
          details:"是,否",
        },
          {
          recordTime:"",
          title:"每日地磅使用前是否由专人检查",
          subData:"",
          details:"是,否",
        },
            {
          recordTime:"",
          title:"是否有定量包装秤",
          subData:"",
          details:"是,否",
        },
         
              {
          recordTime:"",
          title:"定量包装秤是否定期检修、校正",
          subData:"",
          details:"是,否",
        },
      ],

     //药品库设施
      drugStorehouse:[
          {
          recordTime:"",
          title:"药品库主体是否完好",
          subData:"",
          details:"是,否",
        },
           {
          recordTime:"",
          title:"药品库是否上不漏、下不潮",
          subData:"",
          details:"是,否",
        },
             {
          recordTime:"",
          title:"药品库门窗是否完好",
          subData:"",
          details:"是,否",
        },
              {
          recordTime:"",
          title:"药品库通风设施是否完好",
          subData:"",
          details:"是,否",
        },
                {
          recordTime:"",
          title:"药品存放处是否距地50cm",
          subData:"",
          details:"是,否",
        },

                   {
          recordTime:"",
          title:"药品库照明是否防爆灯具",
          subData:"",
          details:"是,否",
        },
      ],

      //配电室设施
      electricityDistribution:[
           {
          recordTime:"",
          title:"配电室主体是否完好",
          subData:"",
          details:"是,否",
        },
            {
          recordTime:"",
          title:"配电室是否上不漏、下不潮",
          subData:"",
          details:"是,否",
        },

             {
          recordTime:"",
          title:"配电室绝缘设施是否完好",
          subData:"",
          details:"是,否",
        },

              {
          recordTime:"",
          title:" 配电室各类用品是否年检",
          subData:"",
          details:"是,否",
        },

               {
          recordTime:"",
          title:"是否配备发电机",
          subData:"",
          details:"是,否",
        },
                 {
          recordTime:"",
          title:"发电机是否定期进行检查",
          subData:"",
          details:"是,否",
        },
                  {
          recordTime:"",
          title:"发电机是否进行年检",
          subData:"",
          details:"是,否",
        },

      ]
    }
  },

  methods: {
   
   
    // 头部下拉选的值发生改变时
    headChange() {
      if (this.type == "cfss") {
        this.tableData = this.warehouse;
      } else if (this.type == "xfss") {
        this.tableData = this.fire;
      } else if (this.type == "jlss") {
        this.tableData = this.metering;
      } else if (this.type == "ypkss") {
        this.tableData = this.drugStorehouse;
      }else if(this.type == "pdsss"){
        this.tableData = this.electricityDistribution;
      }
    },


    //改变选项的值时
    radioChange(row){
      console.log(row)
      row.recordTime=getNowFormatDate();
    }
  

  

   
  },

  mounted() {
    this.tableData=this.warehouse;
    
  },
}
</script>
<style lang="scss" scoped>
.container {
  width: 100%;
}

.table {
  width: 100%;
  text-align: center;

  margin: 20px 0 50px;
}
.btns {
  text-align: right;
}
</style>
