<template>
    <div id="main-contain">
      <div class="position">
        <bread-crumb :crumbs='crumbs'></bread-crumb>
      </div>
      <div class="app-container">
          <div style="float: left; margin-bottom: 10px;">
            <el-date-picker
              v-model="startvalue"
              type="date"
              placeholder="选择日期"
              style="width: 150px;"
              value-format="yyyy-MM-dd"
              >
            </el-date-picker>
            <span>-</span>
            <el-date-picker
              v-model="endvalue"
              type="date"
              placeholder="选择日期"
              style="width: 150px;"
              value-format="yyyy-MM-dd"
              >
            </el-date-picker>
            <el-button type="primary" style="margin-left: 10px;" @click="toSeach">搜索</el-button>
          </div>
          <div style="float:right;margin-bottom:10px;">
            <el-button type="primary" @click="printCard">打印</el-button>
            <el-button type="primary" @click="dialogFormVisible = true">新增</el-button>

          </div>
          <div>
            <el-table  :data="tableData"  border style="width: 100%">
                <el-table-column prop="fenopda" label="登记日期" align="center" min-width="60">
                    <template slot-scope="scope">
                        {{getTimes(scope.row.record_date) }}
                    </template>
                </el-table-column>

                <el-table-column prop="fenopda" label="品名型号" align="center" min-width="60">
                    <template slot-scope="scope">
                        {{ scope.row.model_number }}
                    </template>
                </el-table-column>

                <el-table-column prop="fenopda" label="使用数量" align="center" min-width="60">
                    <template slot-scope="scope">
                        {{ scope.row.user_count }}
                    </template>
                </el-table-column>

                <el-table-column prop="fenopda" label="生产日期" align="center" min-width="60">
                    <template slot-scope="scope">
                        {{getTimes(scope.row.product_date) }}
                    </template>
                </el-table-column>

                <el-table-column prop="fenopda" label="失效日期" align="center" min-width="60">
                    <template slot-scope="scope">
                        {{getTimes(scope.row.expiry_date) }}
                    </template>
                </el-table-column>

                <el-table-column prop="fenopda" label="包装标识(完整,清晰,无破损不清)" align="center" min-width="60">
                    <template slot-scope="scope">
                       <span v-if="scope.row.packaging_identification == 1">✔</span>
                    </template>
                </el-table-column>

                <el-table-column prop="fenopda" label="经手人" align="center" min-width="60">
                    <template slot-scope="scope">
                       {{getName(scope.row.destroy_people) }}
                    </template>
                </el-table-column>

                <el-table-column prop="fenopda" label="销毁数量" align="center" min-width="60">
                    <template slot-scope="scope">
                      {{ scope.row.destroy_nubmer }}
                    </template>
                </el-table-column>

                <el-table-column prop="fenopda" label="销毁方式(交医疗废物处理机构)" align="center" min-width="60">
                    <template slot-scope="scope">
                       <span v-if="scope.row.destroy_way == 1">✔</span>
                    </template>
                </el-table-column>

                <el-table-column prop="fenopda" label="负责人" align="center" min-width="60">
                    <template slot-scope="scope">
                        {{getName(scope.row.leader) }}
                    </template>
                </el-table-column>
             
             
                <el-table-column prop="city" label="操作" align="center" min-width="100">
                    <template slot-scope="scope">
                        <el-button
                        size="mini"
                        type="primary"
                        @click="handleEdit(scope.row.id)">编辑</el-button>
                        <el-button
                        size="mini"
                        type="danger"
                        @click="handleDelete(scope.row.id)">删除</el-button>
                    </template>
                </el-table-column>
            </el-table>
            <el-pagination
              :page-sizes="[500, 1000, 1500, 2000,2500]"
              :page-size="500"
              background
              style="margin-top:20px;float: right"
              layout="total, sizes, prev, pager, next, jumper"
              :total="total"
              @size-change="handleSizeChange"
              @current-change="handleCurrentChange"
          >
            
          </el-pagination>
         </div>

            <!-- 新增 -->

            <el-dialog
                title="新增"
                :visible.sync="dialogFormVisible"
                width="55%">
                <el-form :model="form" ref="form">
                    <el-row :span="24">
                      <el-col :span="8">
                        <el-form-item label="登记日期:" label-width="110px" prop="record_date">
                            <el-date-picker
                            value-format="yyyy-MM-dd"
                            v-model="form.record_date"
                            type="date"
                            placeholder="选择日期时间"
                            style="width: 150px;"
                            @change="changeModelNumber">
                            </el-date-picker>
                        </el-form-item>
                      </el-col>

                      <el-col :span="8">
                        <el-form-item label="品名、型号:" label-width="110px" prop="record_date">
                           <!-- <el-input v-model="form.model_number" style="width: 150px;"></el-input> -->
                           <el-select v-model="form.model_number" filterable  placeholder="请选择" @change="changeModelNumber">
                              <el-option
                                v-for="item in goodList"
                                :key="item.id"
                                :label="item.specification_name"
                                :value="item.id">
                              </el-option>
                           </el-select>
                        </el-form-item>
                      </el-col>
                    
                      <el-col :span="8">
                        <el-form-item label="使用数量:" label-width="110px" prop="record_date">
                          <el-input v-model="form.user_count" style="width: 150px;"></el-input>
                        </el-form-item>
                      </el-col>
                      
                    </el-row>

                    <el-row :span="24">
                      <el-col :span="8">
                        <el-form-item label="生产日期:" label-width="110px" prop="record_date" >
                            <el-date-picker
                            value-format="yyyy-MM-dd"
                            v-model="form.product_date"
                            type="date"
                            placeholder="选择日期时间"
                            style="width: 150px;">
                            </el-date-picker>
                        </el-form-item>
                      </el-col>

                      <el-col :span="8">
                        <el-form-item label="失效日期:" label-width="110px" prop="record_date">
                            <el-date-picker
                            value-format="yyyy-MM-dd"
                            v-model="form.expiry_date"
                            type="date"
                            placeholder="选择日期时间"
                            style="width: 150px;">
                            </el-date-picker>
                        </el-form-item>
                      </el-col>
                    
                      <el-col :span="8">
                        <el-form-item label="包装标识(完整,清晰,无破损不清):" label-width="250px" prop="record_date">
                            <el-checkbox v-model="form.packaging_identification"></el-checkbox>
                        </el-form-item>
                      </el-col>
                      
                    </el-row>

                    <el-row :span="24">
                      <el-col :span="8">
                        <el-form-item label="经手人:" label-width="110px" prop="record_date" >
                            <el-select v-model="form.destroy_people" placeholder="请选择" filterable >
                            <el-option
                            v-for="(item,index) in docList"
                            :key="index"
                            :label="item.user_name"
                            :value="item.admin_user_id"
                            style="width:150x">
                            </el-option>
                            </el-select>
                        </el-form-item>
                      </el-col>

                      <el-col :span="8">
                        <el-form-item label="销毁数量:" label-width="110px" prop="record_date">
                          <el-input v-model="form.destroy_nubmer" style="width:150x"></el-input>
                        </el-form-item>
                      </el-col>
                    
                      <el-col :span="8">
                        <el-form-item label="销毁方式(交医疗废物处理机构):" label-width="250px" prop="destroy_way">
                            <el-checkbox v-model="form.destroy_way"></el-checkbox>
                        </el-form-item>
                      </el-col>
                      
                    </el-row>

                    <el-row :span="24">
                      <el-col :span="8">
                        <el-form-item label="负责人:" label-width="110px" prop="record_date" >
                          <el-select v-model="form.leader" placeholder="请选择" filterable>
                            <el-option
                            v-for="(item,index) in docList"
                            :key="index"
                            :label="item.user_name"
                            :value="item.admin_user_id"
                            style="width:150x">
                            </el-option>
                            </el-select>
                        </el-form-item>
                      </el-col>
                    </el-row>
                </el-form>
                <span slot="footer" class="dialog-footer">
                    <el-button @click="dialogFormVisible = false">取 消</el-button>
                    <el-button type="primary" @click="saveObjectRegistration('form')">确 定</el-button>
                </span>
            </el-dialog>
        
          <!-- 编辑 -->
          <el-dialog
                title="新增"
                :visible.sync="editDialogFormVisible"
                width="55%">
                <el-form :model="form" ref="form">
                    <el-row :span="24">
                      <el-col :span="8">
                        <el-form-item label="登记日期:" label-width="110px" prop="record_date" >
                            <el-date-picker
                            value-format="yyyy-MM-dd"
                            v-model="form.record_date"
                            type="date"
                            placeholder="选择日期时间"
                            style="width: 150px;"
                            @change="changeModelNumber">
                            </el-date-picker>
                        </el-form-item>
                      </el-col>

                      <el-col :span="8">
                        <el-form-item label="品名、型号:" label-width="110px" prop="model_number">
                           <!-- <el-input v-model="form.model_number" style="width: 150px;"></el-input> -->
                           <el-select v-model="form.model_number" filterable  placeholder="请选择" @change="changeModelNumber">
                              <el-option
                                v-for="item in goodList"
                                :key="item.id"
                                :label="item.specification_name"
                                :value="item.id">
                              </el-option>
                           </el-select>
                        </el-form-item>
                      </el-col>
                    
                      <el-col :span="8">
                        <el-form-item label="使用数量:" label-width="110px" prop="user_count">
                          <el-input v-model="form.user_count" style="width: 150px;"></el-input>
                        </el-form-item>
                      </el-col>
                      
                    </el-row>

                    <el-row :span="24">
                      <el-col :span="8">
                        <el-form-item label="生产日期:" label-width="110px" prop="product_date" >
                            <el-date-picker
                            value-format="yyyy-MM-dd"
                            v-model="form.product_date"
                            type="date"
                            placeholder="选择日期时间"
                            style="width: 150px;">
                            </el-date-picker>
                        </el-form-item>
                      </el-col>

                      <el-col :span="8">
                        <el-form-item label="失效日期:" label-width="110px" prop="expiry_date">
                            <el-date-picker
                            value-format="yyyy-MM-dd"
                            v-model="form.expiry_date"
                            type="date"
                            placeholder="选择日期时间"
                            style="width: 150px;">
                            </el-date-picker>
                        </el-form-item>
                      </el-col>
                    
                      <el-col :span="8">
                        <el-form-item label="包装标识(完整,清晰,无破损不清):" label-width="250px" prop="packaging_identification">
                          <el-checkbox v-model="form.packaging_identification"></el-checkbox>
                        </el-form-item>
                      </el-col>
                      
                    </el-row>

                    <el-row :span="24">
                      <el-col :span="8">
                        <el-form-item label="经手人:" label-width="110px" prop="destroy_people" >
                           
                           <el-select v-model="form.destroy_people" placeholder="请选择" filterable>
                            <el-option
                            v-for="(item,index) in docList"
                            :key="index"
                            :label="item.user_name"
                            :value="item.admin_user_id"
                            style="width:150x">
                            </el-option>
                            </el-select>
                        </el-form-item>
                      </el-col>

                      <el-col :span="8">
                        <el-form-item label="销毁数量:" label-width="110px" prop="destroy_nubmer">
                          <el-input v-model="form.destroy_nubmer" style="width:150x"></el-input>
                        </el-form-item>
                      </el-col>
                    
                      <el-col :span="8">
                        <el-form-item label="销毁方式(交医疗废物处理机构):" label-width="250px" prop="destroy_way">
                            <el-checkbox v-model="form.destroy_way"></el-checkbox>
                        </el-form-item>
                      </el-col>
                      
                    </el-row>

                    <el-row :span="24">
                      <el-col :span="8">
                        <el-form-item label="负责人:" label-width="110px" prop="leader" >
                            <el-select v-model="form.leader" placeholder="请选择" filterable>
                            <el-option
                            v-for="(item,index) in docList"
                            :key="index"
                            :label="item.user_name"
                            :value="item.admin_user_id"
                            style="width:150x">
                            </el-option>
                            </el-select>
                        </el-form-item>
                      </el-col>
                    </el-row>
                </el-form>
                <span slot="footer" class="dialog-footer">
                    <el-button @click="editDialogFormVisible = false">取 消</el-button>
                    <el-button type="primary" @click="UpdateObjectRegistration('form')">确 定</el-button>
                </span>
            </el-dialog>
        

            <div hidden="hidden">
            <div id="print-card-info" v-show="hiddenShow">
                <div>
                    <h1 style="text-align: center;">一次性无菌医疗器械使用前检查、用后销毁记录</h1>
                    <div>
                        <table border="1" style="text-align: center;margin: auto;border-collapse: collapse;">
                            <tr>
                              
                                <td>登记日期</td>
                                <td>品名型号</td>
                                <td>使用数量</td>
                                <td>生产日期</td>
                                <td>失效日期</td>
                                <td>包装标识(完整,清晰,无破损不清)</td>
                                <td>经手人</td>
                                <td>销毁数量</td>
                                <td>销毁方式(交医疗废物处理机构)</td>
                                <td>负责人</td>
                               
                            </tr>

                            <tr v-for="(item,index) in tableData" :key="index">
                                <td>{{getTimes(item.record_date) }}</td>
                                <td>{{ item.model_number }}</td>
                                <td>{{ item.user_count }}</td>
                                <td>{{ getTimes(item.product_date) }}</td>
                                <td>{{ getTimes(item.expiry_date) }}</td>
                                <td>
                                  <span v-if="item.packaging_identification == 1">√</span>
                                </td>
                                <td>
                                    <span v-if="setAdminUserES(item.destroy_people?item.destroy_people:item.destroy_people) == ''">
                                    {{getName(item.destroy_people)}}
                                    </span>
                                    <span v-else>
                                        <img style="height:30px;" :src="setAdminUserES(item.destroy_people?item.destroy_people:item.destroy_people)" alt="" srcset="">
                                    </span>   
                                </td>
                                <td>{{ item.destroy_nubmer }}</td>
                                <td>
                                  <span v-if="item.destroy_way == 1">√</span>
                                </td>
                                <td>
                                    <span v-if="setAdminUserES(item.leader?item.leader:item.leader) == ''">
                                    {{getName(item.leader)}}
                                    </span>
                                    <span v-else>
                                        <img style="height:30px;" :src="setAdminUserES(item.leader?item.leader:item.leader)" alt="" srcset="">
                                    </span>   
                                </td>
                            </tr>
                         </table>   

                    </div>
                </div>
            </div>
         </div>
        
      </div>
    </div>
  </template>

  <script>
    import print from "print-js";
    import BreadCrumb from '@/xt_pages/components/bread-crumb'
    import {
        getAllDoctorList,
        saveObjectRegistration,
        getRegistrationDisInfectList,
        getObjectRegistrationByIdList,
        UpdateObjectRegistration,
        deleteObjectRegistration,
        getRegistGoodInforList,
        getRegistNumber 
    } from "@/api/device"
    import { uParseTime } from '@/utils/tools'
    const moment = require('moment')
    export default {
      name: 'airDisinfect',
      components: {
        BreadCrumb
      },
      data() {
        return {
          crumbs: [
            { path: false, name: '院感管理' },
            { path: false, name: '透析室医疗器械记录表' }
          ],

          dialogFormVisible:false,
          editDialogFormVisible:false,
          startvalue:'',
          endvalue:'',
          form: {
            id:0,
            record_date:moment(new Date()).add('year',0).format("YYYY-MM-DD"), //创建日期
            model_number:"",
            user_count:"",
            product_date:"",
            expiry_date:"",
            packaging_identification:"",
            destroy_people:this.$store.getters.xt_user.user.id,
            destroy_nubmer:"",
            destroy_way:"",
            leader:this.$store.getters.xt_user.user.id
          },
        //   value1:'',
          docList:[],
          options:[
            {id:1,name:"正常"},
            {id:2,name:"撤销"}
          ],
         airRules: {
          created_time:[{required:true,message:"请选择创建时间",trigger:"blur"}],
          start_time:[{required:true,message:"请选择开始时间",trigger:"blur"}],
          end_time:[{required:true,message:"请选择结束时间",trigger:"blur"}]
         },
         limit:10,
         page:1,
         total:0,
         tableData: [],
         hiddenShow:false,
         disInfectionWaterList:[
         { id: 1, name: "0.22%季铵盐" },
         { id: 2, name: "500mg/l含氯消毒剂" },
         { id: 3, name: "1000mg/l含氯消毒剂" },
         { id: 4, name: "1500mg/l含氯消毒剂" },
         { id: 5, name: "消毒湿巾" },
         {  id:6, name:"75%酒精"}
         ],
         DisinfectionMode: [
            { id: 1, name: "擦拭" },
            { id: 2, name: "浸泡" },
            { id: 3, name: "喷洒" }
         ],
         operators: [],
         operatorMaps:{},
         goodList:[],
        }
      },
      created(){
        this.getRegistGoodInforList()
        this.getAllDoctorList()
        this.getlist()
      },
   
      methods:{
      printCard() {
        this.hiddenShow = true;
        var ptime = Math.round(new Date().getTime() / 1000);
        this.print_time = uParseTime(ptime, "{y}年{m}月{d}日");

        const style =
            "@media print { .print_main_content { background-color: white; width:960px; margin:0 auto; padding: 0 0 20px 0;font-size:15px } .print_main_content .order_title { text-align: center; font-size: 15px; line-height: 50px;} .print_main_content table { width: 100%; border: 1px solid; border-collapse: collapse; padding: 2px;font-size:15px } .print_main_content table tbody tr td { border: 1px solid; text-align: center; padding: 10px 8px;font-size:15px } .td_proj_title { font-size: 15px; line-height: 25px;} .td_proj_content { font-size: 15px; line-height: 25px; } .td_align_left { text-align: left; } .print_footnote_panel { font-size: 15px; line-height: 40px; } .print_footnote_panel .proj { display: inline-block; width: 49%; } .print_footnote_panel .proj}";

        setTimeout(() => {
            printJS({
            printable: "print-card-info",
            type: "html",
            style: style,
            scanStyles: false
            });
        }, 1);
       },
       getTimes(time) {
         return uParseTime(time, '{y}-{m}-{d}')
       },
       getTimeTwo(time) {
         return uParseTime(time, '{h}:{i}')
       },
       getTimeThree(time) {
         return uParseTime(time, '{y}-{m}-{d} {h}:{i}')
       },
       getName(creator){
         var name = ""
         for(let i=0;i<this.docList.length;i++){
          if(creator == this.docList[i].admin_user_id){
             name = this.docList[i].user_name
          }
         }
         return name
       },
        getAllDoctorList(){
          getAllDoctorList().then(response=>{
            if(response.data.state == 1){
               var list = response.data.data.list
               console.log("list222222",list)
               this.docList = list
               this.operators = response.data.data.operators
            }
          })  
        },
        saveObjectTableDisinfect(formName){
          this.$refs[formName].validate((valid=>{
            if(valid){
                if(this.form.first_is_check!=""){
                  this.form.first_is_check = parseInt(this.form.first_is_check) 
                }else{
                    this.form.first_is_check=0
                }

                if(this.form.sencond_is_check!=""){
                  this.form.sencond_is_check = parseInt(this.form.sencond_is_check) 
                }else{
                    this.form.sencond_is_check=0  
                }

                if(this.form.third_is_check!=""){
                  this.form.third_is_check = parseInt(this.form.third_is_check)
                }else{
                    this.form.third_is_check = 0
                }
                
                if(this.form.fourth_is_check!=""){
                  this.form.fourth_is_check = parseInt(this.form.fourth_is_check)
                }else{
                    this.form.fourth_is_check =0  
                }

                if(this.form.last_is_check!=""){
                    this.form.last_is_check = parseInt(this.form.last_is_check)
                }else{
                    this.form.last_is_check = 0
                }


                if(this.form.first_modifications!=""){
                  this.form.first_modifications = parseInt(this.form.first_modifications) 
                }else{
                    this.form.first_modifications=0
                }

                if(this.form.sencond_modifications!=""){
                  this.form.sencond_modifications = parseInt(this.form.sencond_modifications) 
                }else{
                    this.form.sencond_modifications=0  
                }

                if(this.form.third_modifications!=""){
                  this.form.third_modifications = parseInt(this.form.third_modifications)
                }else{
                    this.form.third_modifications = 0
                }
                
                if(this.form.fourth_modifications!=""){
                  this.form.fourth_modifications = parseInt(this.form.fourth_modifications)
                }else{
                    this.form.fourth_modifications =0  
                }

                if(this.form.last_modifications!=""){
                    this.form.last_modifications = parseInt(this.form.last_modifications)
                }else{
                    this.form.last_modifications = 0
                }

                if(this.form.first_start_time == null){
                   this.form.first_start_time = ""
                }

                if(this.form.first_end_time == null){
                   this.form.first_end_time = ""
                }

                if(this.form.sencond_start_time == null){
                   this.form.sencond_start_time = ""
                }

                if(this.form.sencond_end_time == null){
                   this.form.sencond_end_time = ""
                }

                if(this.form.third_start_time == null){
                   this.form.third_start_time = ""
                }

                if(this.form.third_end_time == null){
                   this.form.third_end_time = ""
                }

                if(this.form.fourth_start_time == null){
                   this.form.fourth_start_time = ""
                }

                if(this.form.fourth_end_time == null){
                   this.form.fourth_end_time = ""
                }
              
                if(this.form.last_start_time == null){
                   this.form.last_start_time = ""
                }

                if(this.form.last_end_time == null){
                   this.form.last_end_time = ""
                }
               console.log("param23333333333333333",this.form)
               
              saveObjectTableDisinfect(this.form).then(response=>{
                 if(response.data.state == 1){
                   var objectDisinfect =  response.data.data.objectDisinfect
                   this.$message.success("保存成功!")
                   this.dialogFormVisible = false
                   this.getlist()
                 }
              })
            }
          }))
        },
        getlist(){
             var params = {
                start_time:this.startvalue,
                end_time:this.endvalue,
                limit:this.limit,
                page:this.page,
             }
            getRegistrationDisInfectList(params).then(response=>{
              if(response.data.state == 1){
                var list = response.data.data.list
                this.tableData = list
                this.total = response.data.data.total
              }
            })  
        },
        handleEdit(id){
          getObjectRegistrationByIdList(id).then(response=>{
            if(response.data.state == 1){
              var list = response.data.data.list
              console.log("list",list)
              this.form.id = list.id
              this.form.record_date = this.getTimes(list.record_date)
              this.form.model_number = list.model_number
              this.form.user_count = list.user_count
              this.form.product_date = this.getTimes(list.product_date)
              this.form.expiry_date = this.getTimes(list.expiry_date)
              if(list.packaging_identification == 1){
                this.form.packaging_identification = true
              }else{
                this.form.packaging_identification = false
              }

              this.form.destroy_people = list.destroy_people
              this.form.destroy_nubmer = list.destroy_nubmer
              if(list.destroy_way == 1){
                this.form.destroy_way = true
              }else{
                this.form.destroy_way = false
              }
           
              this.form.leader = list.leader
              this.editDialogFormVisible = true
            }
          })
        },
        UpdateObjectRegistration(formName){
          this.$refs[formName].validate((valid=>{
            if(valid){
                var destroy_way_one = 0
                if(this.form.destroy_way == true){
                    destroy_way_one = 1
                }
                if(this.form.destroy_way == false){
                    destroy_way_one  = 2
                }
                var packaging_identification_one = 0
                if(this.form.packaging_identification ==true ){
                    packaging_identification_one = 1
                }
                if(this.form.packaging_identification ==false ){
                    packaging_identification_one = 2
                }
                var model_number = ""
                for(let i=0;i<this.goodList.length;i++){
                  if(this.form.model_number == this.goodList[i].id){
                    model_number = this.goodList[i].specification_name
                  }
                }
                var params = {
                    id:this.form.id,
                    record_date:this.form.record_date,
                    model_number:model_number,
                    user_count:this.form.user_count.toString(),
                    product_date:this.form.product_date,
                    expiry_date:this.form.expiry_date,
                    packaging_identification:packaging_identification_one,
                    destroy_people:this.form.destroy_people,
                    destroy_nubmer:this.form.destroy_nubmer.toString(),
                    destroy_way:destroy_way_one,
                    leader:this.form.leader,
                }
                console.log("param223322323wo",params)
                UpdateObjectRegistration(params).then(response=>{
                 if(response.data.state == 1){
                   var registration =  response.data.data.registration
                   this.$message.success("保存成功!")
                   this.editDialogFormVisible = false
                   this.getlist()
                 }
              })
            }
          }))
        },
        handleDelete(id){
          deleteObjectRegistration(id).then(response=>{
            if(response.data.state ==1){
              var msg = response.data.data.msg
              this.$message.success("删除成功!")
              this.getlist()
            }
          })
        },
        firststartime(val){
            this.form.first_start_time = val
            this.form.first_disinfection_time = this.firstdisinfection_time
        },
        firstendtime(val){
            this.form.first_disinfection_time = this.firstdisinfection_time
            this.form.first_end_time = val   
        },
        sencondstarttime(val){
            this.form.sencond_start_time = val
            this.form.sencond_disinfection_time = this.senconddisinfection_time
        },
         sencondendtime(val){
            this.form.sencond_end_time = val
            this.form.sencond_disinfection_time = this.senconddisinfection_time
        },
        thirdstarttime(val){
            this.form.third_start_time = val
            this.form.third_disinfection_time = this.thirddisinfection_time
        },
        thirdendtime(val){
            this.form.third_end_time = val
            this.form.third_disinfection_time = this.thirddisinfection_time
        },
        fourthstarttime(val){
            this.form.fourth_start_time = val
            this.form.fourth_disinfection_time = this.fourthdisinfection_time
        },
        fourthendtime(val){
            this.form.fourth_end_time = val
            this.form.fourth_disinfection_time = this.fourthdisinfection_time
        },
        laststarttime(val){
            this.form.last_start_time = val
            this.form.last_disinfection_time = this.lastdisinfection_time
        },
        lastendtime(val){
            this.form.last_end_time = val
            this.form.last_disinfection_time = this.lastdisinfection_time
        },
        setAdminUserES(id) {
           
           if (id === 0) {
           return ''
           }
           var user_name = ""
           for(let i=0;i<this.operators.length;i++){
              if(id == this.operators[i].admin_user_id){
                 user_name = this.operators[i].url
              }
           }
           return user_name
           // if (id in this.operatorMaps) {

           // return this.operatorMaps[id].url

           // } else {
           // return ''
           // }
       },

       handleSizeChange(val) {
        this.limit = val;
        this.getlist()
      },
      handleCurrentChange(val) {
        this.page = val;
        this.getlist()
      },

      saveObjectRegistration(formName){
        this.$refs[formName].validate((valid=>{
           if(valid){
              var destroy_way_one = 0
              if(this.form.destroy_way == true){
                 destroy_way_one = 1
              }
              if(this.form.destroy_way == false){
                destroy_way_one  = 2
              }
              var packaging_identification_one = 0
              if(this.form.packaging_identification ==true ){
                packaging_identification_one = 1
              }
              if(this.form.packaging_identification ==false ){
                packaging_identification_one = 2
              }
              var model_number = ""
              for(let i=0;i<this.goodList.length;i++){
                if(this.form.model_number == this.goodList[i].id){
                   model_number = this.goodList[i].specification_name
                }
              }
              var params = {
                record_date:this.form.record_date,
                model_number:model_number,
                user_count:this.form.user_count.toString(),
                product_date:this.form.product_date,
                expiry_date:this.form.expiry_date,
                packaging_identification:packaging_identification_one,
                destroy_people:this.form.destroy_people,
                destroy_nubmer:this.form.destroy_nubmer.toString(),
                destroy_way:destroy_way_one,
                leader:this.form.leader,
              }
             console.log("param223322323wo",params)
            saveObjectRegistration(params).then(response=>{
               if(response.data.state ==1){
                 var registration = response.data.data.registration
                 this.dialogFormVisible = false
                 this.$message.success("保存成功!")
                 this.getlist()
               }
            })
           }   
        }))
      },
      toSeach(){
        this.getlist()
      },
      getRegistGoodInforList(){
        getRegistGoodInforList().then(response=>{
           if(response.data.state == 1){
             var  goodList =  response.data.data.list
             this.goodList = goodList
           } 
        })
      },

      changeModelNumber(val){
        console.log("val23233223",val)

        getRegistNumber(val,this.form.record_date).then(response=>{
          if(response.data.state ==1 ){
            var list =  response.data.data.list
            var count = 0
            if(list!=null && list.length >0){
              for(let i=0;i<list.length;i++){
                count +=list[i].count
              }
            }
            this.form.user_count = ""
            this.form.user_count = count
          }
        })
      }
        
      }
    }
  </script>

  <style lang="scss" scoped>
  .airForm{
      display: flex;
      justify-content: space-between;
      flex-wrap: wrap;
      .el-form-item{
          width:33%;
      }
      .el-date-editor.el-input, .el-date-editor.el-input__inner{
          width: 200px;
      }
      .el-input{
          width: 200px;
      }
      .el-select{
          width: 200px;
      }
      .form_title{
        width: 100%;
        margin-bottom: 10px;
        span{
            font-size: 20px;
            font-weight: bold;
        }
      }
  }
  </style>

  <style lang="scss">
   #main-contain{
    .app-container{
        // display: flex;
        // justify-content: space-between;
        // flex-wrap: wrap;
        .tab_air{
        // 斜杠表格
        .el-table{
            th{
                padding: 0px !important;
            }
            tr:first-of-type th:first-of-type div.cell {
                text-align: right;/*上边文字靠右*/
            }
            tr:last-of-type th:first-of-type div.cell {
                text-align: left;/*下边文字靠左*/
            }
            tr:first-of-type th:first-of-type:before {
                content: "";
                position: absolute;
                width: 1px;
                height: 100px;/*斜线的长度*/
                top: 0;
                left: 75px;
                background-color: rgb(172, 171, 171);
                opacity: 1.2;
                display: block;
                transform: rotate(-47deg);/*调整斜线的角度*/
                -webkit-transform-origin: top;
                transform-origin: top;
            }
            tr:nth-of-type(2) th:nth-of-type(1):before{
                content: "";
                position: absolute;
                width: 1px;
                height: 80px;/*斜线的长度*/
                top: 0;
                left: 100px;
                background-color: rgb(172, 171, 171);
                opacity: 1.2;
                display: block;
                transform: rotate(-47deg);/*调整斜线的角度*/
                -webkit-transform-origin: top;
                transform-origin: top;
            }
            tr:last-of-type th:first-of-type:before {
                content: "";
                position: absolute;
                width: 1px;
                height: 80px;/*斜线的长度*/
                top: 0;
                left: 125px;
                background-color: rgb(172, 171, 171);
                opacity: 1.2;
                display: block;
                transform: rotate(-48deg);/*调整斜线的角度*/
                -webkit-transform-origin: top;
                transform-origin: top;
            }
            tr:nth-of-type(2) th:nth-of-type(1):after{
                content: "";
                position: absolute;
                width: 1px;
                height: 80px;/*斜线的长度*/
                top: 8px;
                left: 0px;
                background-color: rgb(172, 171, 171);
                opacity: 1.2;
                display: block;
                transform: rotate(-76deg);/*调整斜线的角度*/
                -webkit-transform-origin: top;
                transform-origin: top;
            }
            tr:last-of-type th:first-of-type:after {
                content: "";
                position: absolute;
                width: 1px;
                height: 92px;/*斜线的长度*/
                top: 0;
                left: 59px;
                background-color: rgb(172, 171, 171);
                opacity: 1.2;
                display: block;
                transform: rotate(-76deg);/*调整斜线的角度*/
                -webkit-transform-origin: top;
                transform-origin: top;
            }
        }
        .el-table--border th, .el-table__fixed-right-patch {
            border-bottom: none !important;
        }
        .el-table td .cell, .el-table th .cell {
            padding: 0 5px !important;
        }
        .el-table .cell {
            white-space: pre-line;
        }
     }
    }


   }
  ::-webkit-scrollbar{
    height: 15px;
  }

  </style>
