<template>
  <div id="user-form">
    <el-row class="c">
      <el-col :span="11">
        <span class="machineClass">日期查询:</span>
        <el-date-picker
          v-model="form.start_time"
          prefix-icon="none"
          type="date"
          placeholder="请选择"
          format="yyyy-MM-dd"
          value-format="yyyy-MM-dd"
          style="width:145px"
        ></el-date-picker
        >-
        <el-date-picker
          v-model="form.end_time"
          prefix-icon="none"
          type="date"
          placeholder="请选择"
          format="yyyy-MM-dd"
          value-format="yyyy-MM-dd"
          style="width:145px"
        ></el-date-picker>
      </el-col>
      <el-col :span="4">
        <span class="machineClass">分区:</span>
        <el-select style="width:90px" v-model="form.zone" @change="changeBed">
          <el-option
            v-for="item in this.zones"
            :key="item.id"
            :label="item.name"
            :value="item.id"
          ></el-option>
        </el-select>
      </el-col>
      <el-col :span="4">
        <span class="machineClass">机位号:</span>
        <el-select style="width:80px" v-model="form.bed">
          <el-option
            v-for="item in this.bedNumberTwo"
            :key="item.id"
            :label="item.number"
            :value="item.id"
          ></el-option>
        </el-select>
      </el-col>
      <el-col :span="5">
        <el-button @click="queryInfo()">查询</el-button>
      </el-col>
    </el-row>
    <el-row :span="24">
      <el-col :span="2">
        <el-checkbox
          :indeterminate="isIndeterminate"
          v-model="checkAllStatus"
          @change="changeCheck"
          >全选</el-checkbox
        >
      </el-col>
      <el-col :span="3">
        <el-button size="small" @click="BatchDelete">批量删除</el-button>
      </el-col>
      <el-col :span="6" class="a">
        <el-button @click="printCard">打印</el-button>
      </el-col>
    </el-row>
    <el-row>
      <el-table
        ref="multipleTable"
        @selection-change="handleSelectionChange"
        :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)' }"
        :data="tableData"
        border
        fit
        highlight-current-row
        style="width: 100%;margin-top: 10px;"
      >
        <el-table-column
          align="center"
          type="selection"
          width="55"
        ></el-table-column>
        <el-table-column label="机号" align="center" width="50">
          <template slot-scope="scope">{{ scope.row.bed }}</template>
        </el-table-column>
        <el-table-column label="日期" align="center" width="100">
          <template slot-scope="scope">{{ getTime(scope.row.date) }}</template>
        </el-table-column>
        <el-table-column label="班次" align="center" min-width="110px">
          <template slot-scope="scope">{{ scope.row.class }}</template>
        </el-table-column>
        <el-table-column label="患者" align="center" min-width="110px">
          <template slot-scope="scope">{{ scope.row.name }}</template>
        </el-table-column>
        <el-table-column label="透析方式" align="center" min-width="90px">
          <template slot-scope="scope">{{ scope.row.dialysis_mode }}</template>
        </el-table-column>
        <!-- <el-table-column label="使用次数" align="center" min-width="110px">
          <template slot-scope="scope">{{ scope.row.user_total }}</template>
        </el-table-column>-->
        <el-table-column label="运行" align="center" min-width="110px">
          <template slot-scope="scope">{{ scope.row.move }}</template>
        </el-table-column>
        <el-table-column label="机表消毒" align="center" min-width="110px">
          <el-table-column label="消毒方式" align="center" min-width="110px">
            <template slot-scope="scope">
              {{ scope.row.disinfect_type }}
            </template>
          </el-table-column>
          <el-table-column label="消毒液" align="center" min-width="110px">
            <template slot-scope="scope">
              {{ scope.row.disinfectant_type }}
            </template>
          </el-table-column>
          <el-table-column label="消毒状态" align="center" min-width="110px">
            <template slot-scope="scope">{{ scope.row.disinfection }}</template>
          </el-table-column>
          <el-table-column label="消毒液浓度" align="center" min-width="110px">
            <template slot-scope="scope">
              {{ scope.row.dialysis_concentration }}
            </template>
          </el-table-column>
        </el-table-column>
        <el-table-column label="液路消毒" align="center" min-width="110px">
          <el-table-column label="消毒方式" align="center" min-width="110px">
            <template slot-scope="scope">{{ scope.row.fluid_path }}</template>
          </el-table-column>
          <el-table-column label="消毒液" align="center" min-width="110px">
            <template slot-scope="scope">{{ scope.row.disinfectant }}</template>
          </el-table-column>
          <el-table-column
            label="开始消毒时间"
            align="center"
            min-width="110px"
          >
            <template slot-scope="scope">{{
              getTimes(scope.row.disinfec_startime)
            }}</template>
          </el-table-column>
          <el-table-column
            label="结束消毒时间"
            align="center"
            min-width="110px"
          >
            <template slot-scope="scope">
              {{ getTimes(scope.row.disinfec_endtime) }}
            </template>
          </el-table-column>
          <el-table-column
            label="消毒时长/min"
            align="center"
            min-width="110px"
          >
            <template slot-scope="scope">{{ scope.row.long_time }}</template>
          </el-table-column>
          <el-table-column label="消毒状态" align="center" min-width="110px">
            <template slot-scope="scope">
              {{ scope.row.disinfection_status }}
            </template>
          </el-table-column>
          <el-table-column label="消毒液残留" align="center" min-width="110px">
            <template slot-scope="scope">
              {{ scope.row.disinfection_residue }}
            </template>
          </el-table-column>
        </el-table-column>
        <el-table-column
          label="透析机消毒液(更换)"
          align="center"
          min-width="110px"
        >
          <template slot-scope="scope">
            {{ scope.row.dialysis_checked }}
          </template>
        </el-table-column>
        <el-table-column
          label="细菌过滤器(更换)"
          align="center"
          min-width="110px"
        >
          <template slot-scope="scope">{{ scope.row.germ_checked }}</template>
        </el-table-column>
        <el-table-column label="空气滤网" align="center" min-width="110px">
          <template slot-scope="scope">{{ scope.row.clean }}</template>
        </el-table-column>
        <el-table-column label="签名" align="center" min-width="110px">
          <template slot-scope="scope">{{ scope.row.user_name }}</template>
        </el-table-column>
        <el-table-column label="操作" align="center" min-width="150px">
          <template slot-scope="scope">
            <el-tooltip
              class="item"
              effect="dark"
              content="编辑"
              placement="top"
            >
              <el-button
                size="mini"
                type="primary"
                icon="el-icon-edit-outline"
                @click="
                  EditUser(scope.row.id, scope.row.patient_id, scope.$index)
                "
              ></el-button>
            </el-tooltip>

            <el-tooltip
              class="item"
              effect="dark"
              content="删除"
              placement="top"
            >
              <el-button
                size="mini"
                type="primary"
                icon="el-icon-delete"
                @click="DeleteUserLogin(scope.row.id, scope.$index)"
              ></el-button>
            </el-tooltip>
          </template>
        </el-table-column>
      </el-table>
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :page-sizes="[10, 20, 50, 100]"
        :page-size="10"
        background
        style="margin-top:20px;float: right"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total"
      ></el-pagination>
    </el-row>

    <el-dialog
      title="使用登记"
      :visible.sync="dialogVisible"
      width="65%"
      center
    >
      <el-form :model="userform" ref="userform">
        <el-row>
          <el-col :span="8">
            <el-form-item label="日期:">
              <el-date-picker
                v-model="userform.spling_date"
                prefix-icon="none"
                type="date"
                placeholder="请选择"
                format="yyyy-MM-dd"
                value-format="yyyy-MM-dd"
                style="width:150px"
              ></el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="班次:">
              <el-select
                v-model="userform.classtype"
                placeholder="请选择"
                class="a"
              >
                <el-option
                  v-for="item in classType"
                  :key="item.id"
                  :label="item.name"
                  :value="item.id"
                  style="width:100px"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="分区:">
              <el-select v-model="userform.zone" placeholder="请选择" class="a">
                <el-option
                  v-for="item in zones"
                  :key="item.id"
                  :label="item.name"
                  :value="item.id"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="床位号:">
              <el-select style="width:150px" v-model="userform.bed_number">
                <el-option
                  v-for="item in this.bedNumber"
                  :key="item.id"
                  :label="item.number"
                  :value="item.id"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="患者:">
              <el-autocomplete
                popper-class="my-autocomplete"
                v-model="userform.patient_name"
                :fetch-suggestions="querySearchAsync"
                placeholder="请输入内容"
                @select="handleSelect"
              >
                <i class="el-icon-search el-input__icon" slot="suffix"> </i>
                <template slot-scope="{ item }">
                  <span class="addr">{{ item.name }}</span>
                </template>
              </el-autocomplete>
            </el-form-item>
            <!-- <el-autocomplete
                  style="margin:16px 5px"
                  popper-class="my-autocomplete"
                  v-model="value"
                 :fetch-suggestions="querySearchAsync"
                 :trigger-on-focus="false"
                 placeholder="病人名字"
                  @select="handleSelect"
            >
             <i
               class="el-icon-search el-input__icon"
               slot="suffix"
              >
            </i>
           <template slot-scope="{ item }">
              <div class="name">{{ item.name }}</div>
             </template>
            </el-autocomplete>-->
          </el-col>
          <el-col :span="8">
            <el-form-item label="传染病:">
              <el-input
                style="width:180px"
                v-model="userform.contagion"
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="透析方式:">
              <el-select
                v-model="userform.dialysis_mode"
                placeholder="请选择"
                class="a"
              >
                <el-option
                  v-for="item in treatmode"
                  :key="item.id"
                  :label="item.name"
                  :value="item.id"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="上机时间:">
              <el-date-picker
                type="datetime"
                format="yyyy-MM-dd HH:mm"
                value-format="yyyy-MM-dd HH:mm"
                placeholder="选择时间"
                v-model="userform.start_time"
                style="width:200px;"
              ></el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="下机时间:">
              <el-date-picker
                type="datetime"
                format="yyyy-MM-dd HH:mm"
                value-format="yyyy-MM-dd HH:mm"
                placeholder="选择时间"
                v-model="userform.end_time"
                style="width:200px;"
              ></el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="透析时长:">
              <el-input
                style="width:180px"
                v-model="userform.dialysis_time"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="实际超滤量:">
              <el-input
                style="width:180px"
                v-model="userform.hyperfiltratio"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="体重减少:">
              <el-input
                style="width:180px"
                v-model="userform.weight_loss"
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="预警值:">
              <el-input
                style="width:180px"
                v-model="userform.warning_value"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="使用次数:">
              <el-input
                style="width:180px"
                v-model="userform.user_total"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="运行:">
              <el-radio-group v-model="userform.run" @change="changeRun">
                <el-radio
                  :label="gender.id"
                  :value="gender.id"
                  v-for="(gender, index) in runOption"
                  :key="index"
                  >{{ gender.name }}</el-radio
                >
              </el-radio-group>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col>
            <el-form-item label="故障发生阶段:">
              <el-radio-group v-model="userform.failure_stage" :disabled="four">
                <el-radio
                  :label="gender.id"
                  :value="gender.id"
                  v-for="(gender, index) in faultPhase"
                  :key="index"
                  >{{ gender.name }}</el-radio
                >
              </el-radio-group>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="故障描述:">
              <el-input
                style="width:600px"
                v-model="userform.fault_description"
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item class="stoppage" label="故障提示信息及代码:">
              <el-input
                style="width:600px"
                v-model="userform.code_information"
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-form-item label="机器消毒:"></el-form-item>
        </el-row>
        <el-row>
          <el-col :span="2">
            <el-form-item label="①机表"></el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="消毒方式:">
              <el-select v-model="userform.disinfect_type" placeholder="请选择">
                <el-option
                  v-for="item in disinfectType"
                  :key="item.id"
                  :label="item.name"
                  :value="item.id"
                  style="width:150px"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="消毒液:">
              <el-select
                v-model="userform.disinfectant_type"
                placeholder="请选择"
              >
                <el-option
                  v-for="item in disinfectantType"
                  :key="item.id"
                  :label="item.name"
                  :value="item.id"
                  style="width:150px"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="消毒状态:">
              <el-select v-model="userform.disinfection" placeholder="请选择">
                <el-option
                  v-for="item in disinfection"
                  :key="item.id"
                  :label="item.name"
                  :value="item.id"
                  style="width:100px"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="运行:">
              <el-radio-group v-model="userform.machine_run">
                <el-radio
                  :label="gender.id"
                  :value="gender.id"
                  v-for="(gender, index) in runOptions"
                  :key="index"
                  >{{ gender.name }}</el-radio
                >
              </el-radio-group>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="2">
            <el-form-item label="②液路"></el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="消毒方式:">
              <el-select v-model="userform.fluid_path" placeholder="请选择">
                <el-option
                  v-for="item in sterilizeType"
                  :key="item.id"
                  :label="item.name"
                  :value="item.id"
                  style="width:135px"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="消毒液:">
              <el-select v-model="userform.disinfectant" placeholder="请选择">
                <el-option
                  v-for="item in fluidPathType"
                  :key="item.id"
                  :label="item.name"
                  :value="item.id"
                  style="width:100px"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="消毒状态:">
              <el-select
                v-model="userform.disinfection_status"
                placeholder="请选择"
              >
                <el-option
                  v-for="item in disinfection"
                  :key="item.id"
                  :label="item.name"
                  :value="item.id"
                  style="width:100px"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="消毒液残留:">
              <el-radio-group v-model="userform.disinfection_residue">
                <el-radio
                  :label="gender.id"
                  :value="gender.id"
                  v-for="(gender, index) in Disinfectant"
                  :key="index"
                  >{{ gender.name }}</el-radio
                >
              </el-radio-group>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="消毒时长:">
              <el-input
                style="width:135px"
                v-model="userform.longtime"
              ></el-input
              >分钟
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="开始消毒时间:">
              <el-date-picker
                type="datetime"
                format="yyyy-MM-dd HH:mm"
                value-format="yyyy-MM-dd HH:mm"
                placeholder="选择时间"
                v-model="userform.starttime"
                style="width:200px;"
              ></el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="结束消毒时间:">
              <el-date-picker
                type="datetime"
                format="yyyy-MM-dd HH:mm"
                value-format="yyyy-MM-dd HH:mm"
                placeholder="选择时间"
                v-model="userform.endtime"
                style="width:200px;"
              ></el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="3">
            <el-form-item label="透析机消毒液:"></el-form-item>
          </el-col>
          <el-col :span="2">
            <el-checkbox v-model="userform.dialysis_checked">更换</el-checkbox>
          </el-col>
          <el-col :span="8">
            <el-form-item label="名称:">
              <el-select v-model="userform.dialysis_name" placeholder="请选择">
                <el-option
                  v-for="item in names"
                  :key="item.id"
                  :label="item.name"
                  :value="item.id"
                  style="width:200px"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="规格:">
              <el-input style="width:100px" v-model="userform.norms"></el-input
              >桶
            </el-form-item>
            <span style="color:red" v-show="showone"
              >您已一个月未更换,请注意检测</span
            >
          </el-col>
        </el-row>
        <el-row>
          <el-col>
            <el-form-item label="浓度:">
              <el-radio-group v-model="userform.dialysis_concentration">
                <el-radio
                  :label="gender.id"
                  :value="gender.id"
                  v-for="(gender, index) in potency"
                  :key="index"
                  >{{ gender.name }}</el-radio
                >
              </el-radio-group>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="3">
            <el-form-item label="细菌过滤器:"></el-form-item>
          </el-col>
          <el-col :span="7">
            <el-checkbox v-model="userform.germ_checked">更换</el-checkbox>
            <span style="color:red" v-show="showone"
              >您已一个月未更换,请注意检测</span
            >
          </el-col>
          <el-col :span="8">
            <el-form-item label="名称:">
              <el-select v-model="userform.germ_name" placeholder="请选择">
                <el-option
                  v-for="item in germs"
                  :key="item.id"
                  :label="item.name"
                  :value="item.id"
                  style="width:200px"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="数量:">
              <el-input
                style="width:100px"
                v-model="userform.germ_number"
              ></el-input
              >支
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="3">
            <el-form-item label="空气滤网清洁:"></el-form-item>
          </el-col>
          <el-col :span="10">
            <el-checkbox v-model="userform.clean">清洁:</el-checkbox>
            <span style="color:red" v-show="showone"
              >您已一个月未清洁,请检查</span
            >
          </el-col>
          <el-col :span="10">
            <el-form-item label="签名:">
              <el-select v-model="userform.sign_name" placeholder="请选择">
                <el-option
                  v-for="item in autograph"
                  :key="item.admin_user_id"
                  :label="item.user_name"
                  :value="item.admin_user_id"
                  style="width:100px"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="UpdateForm('userform')"
          >保存</el-button
        >
      </span>
    </el-dialog>

    <div hidden="hidden">
      <div id="print-card-info" v-show="hiddenShow">
        <div>
          <div class="print_main_content">
            <div class="order_title">设备使用记录清单</div>
          </div>
          <div>
            <div class="printClass">打印日期:{{ nowTime }}</div>
            <table
              border="1"
              style="width:100%"
              cellspacing="0"
              cellpadding="0"
            >
              <tr>
                <th :rowspan="2">机号</th>
                <th :rowspan="2">日期</th>
                <th :rowspan="2">班次</th>
                <th :rowspan="2">患者</th>
                <th :rowspan="2">透析方式</th>
                <th :rowspan="2">使用次数</th>
                <th :rowspan="2">运行</th>
                <th :colspan="4">基表消毒</th>
                <th :colspan="7">液路消毒</th>
                <th :rowspan="2">签名</th>
              </tr>
              <tr>
                <th>消毒方式</th>
                <th>消毒液</th>
                <th>消毒状态</th>
                <th>消毒液浓度</th>

                <th>消毒方式</th>
                <th>消毒液</th>
                <th>开始消毒时间</th>
                <th>结束消毒时间</th>
                <th>消毒时长/min</th>
                <th>消毒状态</th>
                <th>消毒液残留</th>
              </tr>
              <tr v-for="item in this.tableData" :key="item.id">
                <td>{{ item.bed_number }}</td>
                <td>{{ getTime(item.date) }}</td>
                <td>{{ item.class }}</td>
                <td>{{ item.name }}</td>
                <td>{{ item.dialysis_mode }}</td>
                <td>{{ item.user_total }}</td>

                <td>{{ item.move }}</td>
                <td>{{ item.disinfect_type }}</td>
                <td>{{ item.disinfectant_type }}</td>
                <td>{{ item.disinfection }}</td>
                <td>{{ item.dialysis_concentration }}</td>
                <td>{{ item.fluid_path }}</td>
                <td>{{ item.disinfectant }}</td>
                <td>{{ getTimes(item.disinfec_startime) }}</td>
                <td>{{ getTimes(item.disinfec_endtime) }}</td>
                <td>{{ item.long_time }}</td>
                <td>{{ item.disinfection_status }}</td>
                <td>{{ item.disinfection_residue }}</td>
                <td>{{ item.user_name }}</td>
              </tr>
            </table>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import {
  getAllSubregion,
  getInformationData,
  getAllOrganization,
  EditUser,
  DeleteUserform,
  UpdateForm,
  queryInfo,
  getUserForm,
  getBedForm,
  getPatientDetail,
  DeleteUserLogin
} from "@/api/manage";
import { uParseTime } from "@/utils/tools";
import { PostSearch } from "@/api/patient";
import { changeBed } from "@/api/manage";
// eslint-disable-next-line no-unused-vars
import print from "print-js";
const moment = require("moment");
export default {
  name: "UserForm",
  props: {
    userdata: Number
  },
  data() {
    return {
      nowTime: moment(new Date()).format("YYYY-MM-DD HH:MM:SS"),
      tableData: [],
      value: "",
      zones: [],
      bedNumber: [],
      patientName: [],
      isIndeterminate: false,
      dialogVisible: false,
      checkAllStatus: false,
      form: {
        zone: "",
        bed: "",
        start_time: "",
        end_time: ""
      },
      checkAll: false,
      limit: 10,
      page: 1,
      total: 0,
      classType: [
        { id: 1, name: "上午" },
        { id: 2, name: "下午" },
        { id: 3, name: "晚上" }
      ],
      treatmode: [
        { id: 0, name: "请选择" },
        { id: 1, name: "HD" },
        { id: 2, name: "HDF" },
        { id: 3, name: "HD + HP" },
        { id: 4, name: "HP" },
        { id: 5, name: "HF" },
        { id: 6, name: "SCUF" },
        { id: 7, name: "IUF" },
        { id: 8, name: "HFHD" },
        { id: 9, name: "HFHD+HP" },
        { id: 10, name: "PHF" },
        { id: 11, name: "HFR" },
        { id: 12, name: "HDF+HP" },
        { id: 13, name: "CRRT" },
        { id: 14, name: "腹水回输" },
        { id: 15, name: "HD前置换" },
        { id: 16, name: "HD后置换" },
        { id: 17, name: "HDF前置换" },
        { id: 18, name: "HDF后置换" }
      ],
      // 基表消毒方式
      disinfectType: [
        { id: 0, name: "请选择" },
        { id: 1, name: "擦拭" },
        { id: 2, name: "化学消毒" }
      ],
      // 基表消毒液
      disinfectantType: [
        { id: 0, name: "请选择" },
        { id: 1, name: "0.22%季铵盐" },
        { id: 2, name: "500mg/l含氯消毒剂" },
        { id: 3, name: "1000mg/l含氯消毒剂" },
        { id: 4, name: "1500mg/l含氯消毒剂" }
      ],
      // 夜路消毒方式
      sterilizeType: [
        { id: 0, name: "请选择" },
        { id: 1, name: "热化学消毒" },
        { id: 2, name: "化学消毒 + 除钙" },
        { id: 3, name: "热化学消毒 + 除钙" },
        { id: 4, name: "热消毒" },
        { id: 5, name: "化学消毒" },
        { id: 6, name: "除钙" },
        { id: 7, name: "清洗" }
      ],
      // 夜路消毒液
      fluidPathType: [
        { id: 0, name: "请选择" },
        { id: 1, name: "20%柠檬酸" },
        { id: 2, name: "25%柠檬酸" },
        { id: 3, name: "50%柠檬酸" },
        { id: 4, name: "50%柠檬酸 + 5%次氯酸钠" },
        { id: 5, name: "20%柠檬酸 + 10%冰醋酸" },
        { id: 6, name: "0.2%过氧化乙酸" },
        { id: 7, name: "10%冰醋酸" },
        { id: 8, name: "50%冰醋酸" },
        { id: 9, name: "5%次氯酸钠" }
      ],
      runOption: [
        { id: 1, name: "正常" },
        { id: 2, name: "故障" }
      ],
      runOptions: [
        { id: 1, name: "达标" },
        { id: 2, name: "未达标" }
      ],
      faultPhase: [
        { id: 1, name: "开机启动" },
        { id: 2, name: "自检" },
        { id: 3, name: "准备" },
        { id: 4, name: "治疗" },
        { id: 5, name: "消毒" }
      ],
      Disinfectant: [
        { id: 1, name: "有" },
        { id: 2, name: "无" }
      ],
      potency: [
        { id: 1, name: "达标" },
        { id: 2, name: "未达标" }
      ],
      disinfection: [
        { id: 1, name: "已消毒" },
        { id: 2, name: "未消毒" },
        { id: 3, name: "消毒未完成" }
      ],
      names: [
        { id: 0, name: "请选择" },
        { id: 1, name: "20%柠檬酸" },
        { id: 2, name: "50%柠檬酸" },
        { id: 3, name: "次氯酸钠" }
      ],
      germs: [
        { id: 0, name: "请选择" },
        { id: 1, name: "费森细菌过滤器" },
        { id: 2, name: "日机装细菌过滤器" },
        { id: 3, name: "贝朗机细菌过滤器" },
        { id: 4, name: "东丽机细菌过滤器" }
      ],
      autograph: [],
      selectCulture: [],
      userform: {
        id: "",
        spling_date: "", // 日期
        classtype: "", // 班次
        zone: "", // 分区
        bed_number: "", // 床位号
        patient_name: "", // 患者
        contagion: "", // 传染病
        dialysis_mode: "", // 透析方式
        start_time: "", // 上机时间
        end_time: "", // 下机时间
        dialysis_time: "", // 透析时长
        hyperfiltratio: "", // 实际超滤量
        weight_loss: "", // 体重减少
        warning_value: "", // 预警值
        user_total: "", // 使用次数
        run: 1, // 运行
        failure_stage: "", // 故事发生阶段
        fault_description: "", // 故障描述
        code_information: "", // 故障提示及代码

        // 机器消毒
        disinfect_type: 1, // 消毒方式
        disinfectant_type: 2, // 消毒液
        disinfection: 1, // 消毒状态
        machine_run: 1, // 运行

        // 液路
        fluid_path: 3, // 消毒方式
        disinfectant: 3, // 消毒液
        disinfection_status: 1, // 消毒状态
        disinfection_residue: 1, // 消毒液残留
        longtime: "", // 消毒时长
        starttime: "", // 开始消毒时间
        endtime: "", // 结束消毒时间
        dialysis_checked: "", // 更换
        dialysis_name: "", // 名称
        norms: "", // 规格
        dialysis_concentration: 1, // 浓度
        germ_checked: "", // 更换
        germ_name: "", // 名称
        germ_number: "", // 数量
        clean: "", // 清洁
        sign_name: "", // 签名
        patient_id: ""
      },
      hiddenShow: false,
      searchArray: [],
      bed: "",
      bedNumberTwo: [],
      four: true,
      showone: false
    };
  },
  methods: {
    handleSelectionChange(val) {
      this.selectCulture = val;
    },
    changeCheck() {
      this.$refs.multipleTable.clearSelection();
      if (this.checkAllStatus) {
        this.$refs.multipleTable.toggleAllSelection();
      }
    },
    getAllSubregion() {
      getAllSubregion().then(response => {
        if (response.data.state === 1) {
          var zones = response.data.data.zones;
          var zone = [{ id: 0, name: "全部" }];
          for (let i = 0; i < zones.length; i++) {
            const item = zones[i];
            zone.push({ id: item.id, name: item.name });
          }
          this.zones = zone;
          //  console.log('zones', zones)
          var numbers = response.data.data.numbers;
          var number = [{ id: 0, number: "全部" }];
          for (let index = 0; index < numbers.length; index++) {
            const item = numbers[index];
            number.push({ id: item.id, number: item.number });
          }
          this.bedNumber = number;
        }
      });
    },
    getInformationData() {
      getInformationData(this.limit, this.page).then(response => {
        if (response.data.state === 1) {
          var information = response.data.data.information;
          // console.log('information是什么', information)
          for (let index = 0; index < information.length; index++) {
            if (information[index].class === 1) {
              information[index].class = "上午";
            }
            if (information[index].class === 2) {
              information[index].class = "下午";
            }
            if (information[index].class === 3) {
              information[index].class = "晚上";
            }
            if (information[index].dialysis_mode === 1) {
              information[index].dialysis_mode = "HD";
            }
            if (information[index].dialysis_mode === 2) {
              information[index].dialysis_mode = "HDF";
            }
            if (information[index].dialysis_mode === 3) {
              information[index].dialysis_mode = "HD + HP";
            }
            if (information[index].dialysis_mode === 4) {
              information[index].dialysis_mode = "HP";
            }
            if (information[index].dialysis_mode === 5) {
              information[index].dialysis_mode = "HF";
            }
            if (information[index].dialysis_mode === 6) {
              information[index].dialysis_mode = "SCUF";
            }
            if (information[index].dialysis_mode === 7) {
              information[index].dialysis_mode = "IUF";
            }
            if (information[index].dialysis_mode === 8) {
              information[index].dialysis_mode = "HFHD";
            }
            if (information[index].dialysis_mode === 9) {
              information[index].dialysis_mode = "HFHD+HP";
            }
            if (information[index].dialysis_mode === 10) {
              information[index].dialysis_mode = "PHF";
            }
            if (information[index].dialysis_mode === 11) {
              information[index].dialysis_mode = "HFR";
            }
            if (information[index].dialysis_mode === 12) {
              information[index].dialysis_mode = "HDF+HP";
            }
            if (information[index].dialysis_mode === 13) {
              information[index].dialysis_mode = "CRRT";
            }
            if (information[index].dialysis_mode === 14) {
              information[index].dialysis_mode = "腹水回输";
            }
            if (information[index].dialysis_mode === 15) {
              information[index].dialysis_mode = "HD前置换";
            }
            if (information[index].dialysis_mode === 16) {
              information[index].dialysis_mode = "HD后置换";
            }
            if (information[index].dialysis_mode === 17) {
              information[index].dialysis_mode = "HDF前置换";
            }
            if (information[index].dialysis_mode === 18) {
              information[index].dialysis_mode = "HDF后置换";
            }

            if (information[index].move === 0) {
              information[index].move = "";
            }

            if (information[index].move === 1) {
              information[index].move = "正常";
            }
            if (information[index].move === 2) {
              information[index].move = "故障";
            }

            if (information[index].disinfect_type === 0) {
              information[index].disinfect_type = "/";
            }

            if (information[index].disinfect_type === 1) {
              information[index].disinfect_type = "擦拭";
            }
            if (information[index].disinfect_type === 2) {
              information[index].disinfect_type = "化学消毒";
            }

            if (information[index].disinfectant_type === 0) {
              information[index].disinfectant_type = "/";
            }

            if (information[index].disinfectant_type === 1) {
              information[index].disinfectant_type = "0.22%季铵盐";
            }
            if (information[index].disinfectant_type === 2) {
              information[index].disinfectant_type = "500mg/l含氯消毒剂";
            }
            if (information[index].disinfectant_type === 3) {
              information[index].disinfectant_type = "1000mg/l含氯消毒剂";
            }
            if (information[index].disinfectant_type === 4) {
              information[index].disinfectant_type = "1500mg/l含氯消毒剂";
            }

            if (information[index].disinfection === 1) {
              information[index].disinfection = "已消毒";
            }
            if (information[index].disinfection === 2) {
              information[index].disinfection = "未消毒";
            }
            if (information[index].disinfection === 3) {
              information[index].disinfection = "消毒未完成";
            }

            // eslint-disable-next-line eqeqeq
            if (information[index].dialysis_concentration == 0) {
              information[index].dialysis_concentration = "";
            }

            if (information[index].dialysis_concentration === 1) {
              information[index].dialysis_concentration = "达标";
            }
            if (information[index].dialysis_concentration === 2) {
              information[index].dialysis_concentration = "未达标";
            }

            if (information[index].fluid_path === 0) {
              information[index].fluid_path = "/";
            }
            if (information[index].fluid_path === 1) {
              information[index].fluid_path = "热化学消毒";
            }
            if (information[index].fluid_path === 2) {
              information[index].fluid_path = "化学消毒 + 除钙";
            }
            if (information[index].fluid_path === 3) {
              information[index].fluid_path = "热化学消毒 + 除钙";
            }
            if (information[index].fluid_path === 4) {
              information[index].fluid_path = "热消毒";
            }
            if (information[index].fluid_path === 5) {
              information[index].fluid_path = "化学消毒";
            }
            if (information[index].fluid_path === 6) {
              information[index].fluid_path = "除钙";
            }
            if (information[index].fluid_path === 7) {
              information[index].fluid_path = "清洗";
            }

            if (information[index].disinfectant === 0) {
              information[index].disinfectant = "/";
            }

            if (information[index].disinfectant === 1) {
              information[index].disinfectant = "20%柠檬酸";
            }
            if (information[index].disinfectant === 2) {
              information[index].disinfectant = "25%柠檬酸";
            }
            if (information[index].disinfectant === 3) {
              information[index].disinfectant = "50%柠檬酸";
            }
            if (information[index].disinfectant === 4) {
              information[index].disinfectant = "50%柠檬酸 + 5%次氯酸钠";
            }
            if (information[index].disinfectant === 5) {
              information[index].disinfectant = "20%柠檬酸 + 10%冰醋酸";
            }
            if (information[index].disinfectant === 6) {
              information[index].disinfectant = "0.2%过氧化乙酸";
            }
            if (information[index].disinfectant === 7) {
              information[index].disinfectant = "10%冰醋酸";
            }
            if (information[index].disinfectant === 8) {
              information[index].disinfectant = "50%冰醋酸";
            }
            if (information[index].disinfectant === 9) {
              information[index].disinfectant = "5%次氯酸钠";
            }
            if (information[index].disinfection_status === 0) {
              information[index].disinfection_status = "";
            }
            if (information[index].disinfection_status === 1) {
              information[index].disinfection_status = "已消毒";
            }
            if (information[index].disinfection_status === 2) {
              information[index].disinfection_status = "未消毒";
            }
            if (information[index].disinfection_status === 3) {
              information[index].disinfection_status = "消毒未完成";
            }
            if (information[index].disinfection_residue === 1) {
              information[index].disinfection_residue = "有残留";
            }
            if (information[index].disinfection_residue === 2) {
              information[index].disinfection_residue = "无残留";
            }
            if (information[index].dialysis_checked === 1) {
              information[index].dialysis_checked = "√";
            }
            if (information[index].dialysis_checked === 0) {
              information[index].dialysis_checked = "";
            }
            if (information[index].dialysis_checked === 2) {
              information[index].dialysis_checked = "";
            }
            if (information[index].germ_checked === 1) {
              information[index].germ_checked = "√";
            }

            if (information[index].germ_checked === 2) {
              information[index].germ_checked = "";
            }

            if (information[index].germ_checked === 0) {
              information[index].germ_checked = "";
            }
            if (information[index].clean === 1) {
              information[index].clean = "√";
            }
            if (information[index].clean === 0) {
              information[index].clean = "";
            }
            if (information[index].clean === 2) {
              information[index].clean = "";
            }
          }
          // var total = response.data.data.total
          // console.log('total', total)
          // this.tableData = information
          // this.total = total
        }
      });
    },
    handleSizeChange(limit) {
      this.limit = limit;
      this.queryInfo();
    },
    handleCurrentChange(page) {
      this.page = page;
      this.queryInfo();
    },
    getTime(time) {
      return uParseTime(time, "{y}-{m}-{d}");
    },
    getTimes(time) {
      if (time < 0) {
        return "";
      }
      if (time === 0) {
        return "";
      } else {
        return uParseTime(time, "{y}-{m}-{d} {h}:{i}:{s}");
      }
    },
    // 获取签名
    getAllOrganization() {
      getAllOrganization().then(response => {
        if (response.data.state === 1) {
          var approle = response.data.data.approle;
          this.autograph = approle;
        }
      });
    },
    EditUser(id, patientid) {
      this.dialogVisible = true;
      EditUser(id, patientid).then(response => {
        if (response.data.state === 1) {
          var device = response.data.data.device;
          // console.log('device', device)
          var patients = response.data.data.patients;
          // console.log('patients', patients)
          // eslint-disable-next-line no-sequences
          (this.userform.id = device.id),
            (this.userform.spling_date = uParseTime(
              device.date,
              "{y}-{m}-{d}"
            ));
          this.userform.patient_id = device.patient_id;
          this.userform.classtype = device.class;
          this.userform.zone = device.zone;
          this.userform.bed_number = device.bed_number;
          this.userform.contagion = device.contagion;
          this.userform.patient_name = patients.name;
          this.userform.dialysis_mode = device.dialysis_mode;
          // this.userform.start_time = uParseTime(
          // device.start_time,
          //  '{y}-{m}-{d} {h}:{i}'
          // )
          this.userform.start_time = this.updateTimes(device.start_time);
          this.userform.end_time = this.updateTimes(device.end_time);
          // this.userform.end_time = uParseTime(
          // device.end_time,
          // '{y}-{m}-{d} {h}:{i}'
          // )

          this.userform.dialysis_hour = device.dialysis_hour;
          this.userform.hyperfiltratio = device.hyperfiltratio;
          this.userform.weight_loss = device.weight_loss;
          this.userform.warning_value = device.warning_value;
          this.userform.user_total = device.user_total;
          this.userform.run = device.move;

          this.userform.failure_stage = device.failure_stage;
          this.userform.fault_description = device.fault_description;
          this.userform.code_information = device.code_information;
          this.userform.disinfect_type = device.disinfect_type;
          this.userform.disinfectant_type = device.disinfectant_type;
          this.userform.disinfection = device.disinfection;
          this.userform.machine_run = device.machine_run;
          this.userform.fluid_path = device.fluid_path;
          this.userform.disinfectant = device.disinfectant;
          this.userform.disinfection_status = device.disinfection_status;
          this.userform.disinfection_residue = device.disinfection_residue;
          this.userform.longtime = device.long_time;
          this.userform.dialysis_time = device.dialysis_hour;
          // this.userform.starttime = uParseTime(
          //   device.disinfec_startime,
          //  '{y}-{m}-{d} {h}:{i}'
          // )
          // this.userform.endtime = uParseTime(
          //  device.disinfec_endtime,
          // '{y}-{m}-{d} {h}:{i}'
          // )
          this.userform.starttime = this.updateTimes(device.disinfec_startime);
          this.userform.endtime = this.updateTimes(device.disinfec_endtime);
          if (device.dialysis_checked === 1) {
            this.userform.dialysis_checked = true;
          }
          if (device.dialysis_checked === 0) {
            this.userform.dialysis_checked = false;
          }
          if (device.dialysis_checked === 2) {
            this.userform.dialysis_checked = false;
          }
          this.userform.dialysis_name = device.dialysis_name;
          this.userform.norms = device.norms;
          this.userform.dialysis_concentration = device.dialysis_concentration;
          if (device.germ_checked === 1) {
            this.userform.germ_checked = true;
          }
          if (device.germ_checked === 0) {
            this.userform.germ_checked = false;
          }
          if (device.germ_checked === 2) {
            this.userform.germ_checked = false;
          }

          this.userform.germ_name = device.germ_name;
          this.userform.germ_number = device.germ_number;
          if (device.clean === 1) {
            this.userform.clean = true;
          }
          if (device.clean === 0) {
            this.userform.clean = false;
          }
          if (device.clean === 2) {
            this.userform.clean = false;
          }
          this.userform.sign_name = device.sign_name;
          if (device.disinfection === 0) {
            this.userform.disinfection = "";
          }
        }
      });
    },
    getTimestamp(time) {
      // 把时间日期转成时间戳
      return new Date(time).getTime() / 1000;
    },
    BatchDelete() {
      if (this.selectCulture.length == 0) {
        this.$message.error("请选择要删除的信息");
        return false;
      }
      this.$confirm(
        "确认要删除所选记录吗? <br>删除后,该信息将无法恢复",
        "删除提示",
        {
          dangerouslyUseHTMLString: true,
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }
      ).then(() => {
        var ids = [];
        var idMap = {};
        for (const index in this.selectCulture) {
          ids.push(this.selectCulture[index].id);
          idMap[this.selectCulture[index].id] = this.selectCulture[index].id;
        }
        DeleteUserform({ ids: ids }).then(response => {
          if (response.data.state === 1) {
            var msg = response.data.data.msg;
            var planDataLength = this.tableData.length;
            for (let index = planDataLength - 1; index >= 0; index--) {
              if (this.tableData[index].id in idMap) {
                this.tableData.splice(index, 1);
              }
            }
            this.$message.success("删除成功");
          }
        });
      });
    },
    updateTimes(time) {
      if (time < 0) {
        return "";
      } else {
        return uParseTime(time, "{y}-{m}-{d} {h}:{i}");
      }
    },
    UpdateForm(formName) {
      if (this.userform.dialysis_checked === "") {
        this.userform.dialysis_checked = 0;
      }
      // eslint-disable-next-line no-empty
      if (this.userform.dialysis_checked === true) {
        this.userform.dialysis_checked = 1;
      }
      if (this.userform.dialysis_checked === false) {
        this.userform.dialysis_checked = 2;
      }

      if (this.userform.germ_checked === "") {
        this.userform.germ_checked = 0;
      }
      if (this.userform.germ_checked === true) {
        this.userform.germ_checked = 1;
      }
      if (this.userform.germ_checked === false) {
        this.userform.germ_checked = 2;
      }

      if (this.userform.clean === "") {
        this.userform.clean = 0;
      }
      if (this.userform.clean === true) {
        this.userform.clean = 1;
      }
      if (this.userform.clean === false) {
        this.userform.clean = 2;
      }
      // this.userform.start_time = this.getTimes(this.userform.start_time)
      // this.userform.end_time = this.getTimes(this.userform.end_time)
      // this.userform.starttime = this.getTimes(this.userform.starttime)
      // this.userform.endtime = this.getTimes(this.userform.endtime)
      // eslint-disable-next-line eqeqeq
      if (this.userform.start_time == "") {
        this.userform.start_time = "0";
      }
      // eslint-disable-next-line eqeqeq
      if (this.userform.end_time == "") {
        this.userform.end_time = "0";
      }

      // eslint-disable-next-line eqeqeq
      if (this.userform.starttime == "") {
        this.userform.starttime = "0";
      }
      // eslint-disable-next-line eqeqeq
      if (this.userform.endtime == "") {
        this.userform.endtime = "0";
      }
      if (this.userform.disinfection === "") {
        this.userform.disinfection = 0;
      }
      var status = this.userform.disinfection;
      var statu = parseInt(status);
      this.userform.disinfection = statu;

      this.$refs[formName].validate(valid => {
        if (valid) {
          UpdateForm(this.userform).then(response => {
            if (response.data.state === 1) {
              var information = response.data.data.information;
              this.dialogVisible = false;
              this.$message.success("修改成功");
              this.getInformationData();
              this.$forceUpdate();
            }
          });
        }
      });
    },
    queryInfo() {
      queryInfo(
        this.form.zone,
        this.form.bed,
        this.form.start_time,
        this.form.end_time,
        this.limit,
        this.page
      ).then(response => {
        if (response.data.state === 1) {
          var information = response.data.data.infor;
          console.log("information", information);
          for (let index = 0; index < information.length; index++) {
            if (information[index].class === 0) {
              information[index].class = "";
            }
            if (information[index].class === 1) {
              information[index].class = "上午";
            }
            if (information[index].class === 2) {
              information[index].class = "下午";
            }
            if (information[index].class === 3) {
              information[index].class = "晚上";
            }

            if (information[index].dialysis_mode === 0) {
              information[index].dialysis_mode = "";
            }

            if (information[index].dialysis_mode === 1) {
              information[index].dialysis_mode = "HD";
            }
            if (information[index].dialysis_mode === 2) {
              information[index].dialysis_mode = "HDF";
            }
            if (information[index].dialysis_mode === 3) {
              information[index].dialysis_mode = "HD + HP";
            }
            if (information[index].dialysis_mode === 4) {
              information[index].dialysis_mode = "HP";
            }
            if (information[index].dialysis_mode === 5) {
              information[index].dialysis_mode = "HF";
            }
            if (information[index].dialysis_mode === 6) {
              information[index].dialysis_mode = "SCUF";
            }
            if (information[index].dialysis_mode === 7) {
              information[index].dialysis_mode = "IUF";
            }
            if (information[index].dialysis_mode === 8) {
              information[index].dialysis_mode = "HFHD";
            }
            if (information[index].dialysis_mode === 9) {
              information[index].dialysis_mode = "HFHD+HP";
            }
            if (information[index].dialysis_mode === 10) {
              information[index].dialysis_mode = "PHF";
            }
            if (information[index].dialysis_mode === 11) {
              information[index].dialysis_mode = "HFR";
            }
            if (information[index].dialysis_mode === 12) {
              information[index].dialysis_mode = "HDF+HP";
            }
            if (information[index].dialysis_mode === 13) {
              information[index].dialysis_mode = "CRRT";
            }
            if (information[index].dialysis_mode === 14) {
              information[index].dialysis_mode = "腹水回输";
            }
            if (information[index].dialysis_mode === 15) {
              information[index].dialysis_mode = "HD前置换";
            }
            if (information[index].dialysis_mode === 16) {
              information[index].dialysis_mode = "HD后置换";
            }
            if (information[index].dialysis_mode === 17) {
              information[index].dialysis_mode = "HDF前置换";
            }
            if (information[index].dialysis_mode === 18) {
              information[index].dialysis_mode = "HDF后置换";
            }

            if (information[index].move === 0) {
              information[index].move = "";
            }

            if (information[index].move === 1) {
              information[index].move = "正常";
            }
            if (information[index].move === 2) {
              information[index].move = "故障";
            }

            if (information[index].disinfect_type === 0) {
              information[index].disinfect_type = "/";
            }

            if (information[index].disinfect_type === 1) {
              information[index].disinfect_type = "擦拭";
            }
            if (information[index].disinfect_type === 2) {
              information[index].disinfect_type = "化学消毒";
            }

            if (information[index].disinfectant_type === 0) {
              information[index].disinfectant_type = "/";
            }
            if (information[index].disinfectant_type === 1) {
              information[index].disinfectant_type = "0.22%季铵盐";
            }
            if (information[index].disinfectant_type === 2) {
              information[index].disinfectant_type = "500mg/l含氯消毒剂";
            }
            if (information[index].disinfectant_type === 3) {
              information[index].disinfectant_type = "1000mg/l含氯消毒剂";
            }
            if (information[index].disinfectant_type === 4) {
              information[index].disinfectant_type = "1500mg/l含氯消毒剂";
            }

            if (information[index].disinfection === 0) {
              information[index].disinfection = "";
            }
            if (information[index].disinfection === 1) {
              information[index].disinfection = "已消毒";
            }
            if (information[index].disinfection === 2) {
              information[index].disinfection = "未消毒";
            }
            if (information[index].disinfection === 3) {
              information[index].disinfection = "消毒未完成";
            }

            if (information[index].dialysis_concentration === 0) {
              information[index].dialysis_concentration = "";
            }

            if (information[index].dialysis_concentration === 1) {
              information[index].dialysis_concentration = "达标";
            }
            if (information[index].dialysis_concentration === 2) {
              information[index].dialysis_concentration = "未达标";
            }

            if (information[index].fluid_path === 0) {
              information[index].fluid_path = "/";
            }
            if (information[index].fluid_path === 1) {
              information[index].fluid_path = "热化学消毒";
            }
            if (information[index].fluid_path === 2) {
              information[index].fluid_path = "化学消毒 + 除钙";
            }
            if (information[index].fluid_path === 3) {
              information[index].fluid_path = "热化学消毒 + 除钙";
            }
            if (information[index].fluid_path === 4) {
              information[index].fluid_path = "热消毒";
            }
            if (information[index].fluid_path === 5) {
              information[index].fluid_path = "化学消毒";
            }
            if (information[index].fluid_path === 6) {
              information[index].fluid_path = "除钙";
            }
            if (information[index].fluid_path === 7) {
              information[index].fluid_path = "清洗";
            }

            if (information[index].disinfectant === 0) {
              information[index].disinfectant = "/";
            }

            if (information[index].disinfectant === 1) {
              information[index].disinfectant = "20%柠檬酸";
            }
            if (information[index].disinfectant === 2) {
              information[index].disinfectant = "25%柠檬酸";
            }
            if (information[index].disinfectant === 3) {
              information[index].disinfectant = "50%柠檬酸";
            }
            if (information[index].disinfectant === 4) {
              information[index].disinfectant = "50%柠檬酸 + 5%次氯酸钠";
            }
            if (information[index].disinfectant === 5) {
              information[index].disinfectant = "20%柠檬酸 + 10%冰醋酸";
            }
            if (information[index].disinfectant === 6) {
              information[index].disinfectant = "0.2%过氧化乙酸";
            }
            if (information[index].disinfectant === 7) {
              information[index].disinfectant = "10%冰醋酸";
            }
            if (information[index].disinfectant === 8) {
              information[index].disinfectant = "50%冰醋酸";
            }
            if (information[index].disinfectant === 9) {
              information[index].disinfectant = "5%次氯酸钠";
            }
            if (information[index].disinfection_status === 1) {
              information[index].disinfection_status = "已消毒";
            }
            if (information[index].disinfection_status === 2) {
              information[index].disinfection_status = "未消毒";
            }
            if (information[index].disinfection_status === 3) {
              information[index].disinfection_status = "消毒未完成";
            }

            if (information[index].disinfection_residue === 0) {
              information[index].disinfection_residue = "";
            }

            if (information[index].disinfection_residue === 1) {
              information[index].disinfection_residue = "有残留";
            }
            if (information[index].disinfection_residue === 2) {
              information[index].disinfection_residue = "无残留";
            }
            if (information[index].dialysis_checked === 1) {
              information[index].dialysis_checked = "√";
            }
            if (information[index].dialysis_checked === 0) {
              information[index].dialysis_checked = "";
            }

            if (information[index].dialysis_checked === 2) {
              information[index].dialysis_checked = "";
            }
            if (information[index].germ_checked === 1) {
              information[index].germ_checked = "√";
            }

            if (information[index].germ_checked === 0) {
              information[index].germ_checked = "";
            }
            if (information[index].germ_checked === 2) {
              information[index].germ_checked = "";
            }
            if (information[index].clean === 1) {
              information[index].clean = "√";
            }
            if (information[index].clean === 0) {
              information[index].clean = "";
            }
            if (information[index].clean === 2) {
              information[index].clean = "";
            }
          }
          // console.log('消毒时间', information)
          this.tableData = information;
          var total = response.data.data.total;
          console.log("total是什么", total);
          this.total = total;
        }
      });
    },
    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; } .print_main_content .order_title { text-align: center; font-size: 23px; line-height: 50px; font-weight: 500; } .print_main_content table { width: 100%; border: 1px solid; border-collapse: collapse; padding: 2px; } .print_main_content table tbody tr td { border: 1px solid; text-align: center; padding: 10px 8px; } .td_proj_title { font-size: 18px; line-height: 25px; font-weight: 500; } .td_proj_content { font-size: 18px; line-height: 25px; } .td_align_left { text-align: left; } .print_footnote_panel { font-size: 17px; line-height: 40px; } .print_footnote_panel .proj { display: inline-block; width: 49%; } .print_footnote_panel .proj .proj_title { font-weight: 500;} }";

      setTimeout(() => {
        printJS({
          printable: "print-card-info",
          type: "html",
          style: style,
          scanStyles: false
        });
      }, 1);
    },

    querySearchAsync(keyword, cb) {
      let key = "";
      if (keyword != undefined) {
        key = keyword;
      }
      let searchArray = [];
      PostSearch(key).then(response => {
        if (response.data.state == 1) {
          searchArray = response.data.data.patient;
          cb(searchArray);
        } else {
          this.$message.error(response.data.msg);
          cb([]);
        }
      });
    },
    getUserForm(id) {
      getUserForm(id, this.limit, this.page).then(response => {
        if (response.data.state === 1) {
          var information = response.data.data.information;
          // console.log('information====================', information)
          // eslint-disable-next-line no-unused-vars
          var addmacher = response.data.data.addmacher;
          // console.log('addmacher', addmacher)
          // this.bed = addmacher.bed_number

          for (let index = 0; index < information.length; index++) {
            if (information[index].class === 1) {
              information[index].class = "上午";
            }
            if (information[index].class === 2) {
              information[index].class = "下午";
            }
            if (information[index].class === 3) {
              information[index].class = "晚上";
            }
            if (information[index].dialysis_mode === 0) {
              information[index].dialysis_mode = "";
            }

            if (information[index].dialysis_mode === 1) {
              information[index].dialysis_mode = "HD";
            }
            if (information[index].dialysis_mode === 2) {
              information[index].dialysis_mode = "HDF";
            }
            if (information[index].dialysis_mode === 3) {
              information[index].dialysis_mode = "HD + HP";
            }
            if (information[index].dialysis_mode === 4) {
              information[index].dialysis_mode = "HP";
            }
            if (information[index].dialysis_mode === 5) {
              information[index].dialysis_mode = "HF";
            }
            if (information[index].dialysis_mode === 6) {
              information[index].dialysis_mode = "SCUF";
            }
            if (information[index].dialysis_mode === 7) {
              information[index].dialysis_mode = "IUF";
            }
            if (information[index].dialysis_mode === 8) {
              information[index].dialysis_mode = "HFHD";
            }
            if (information[index].dialysis_mode === 9) {
              information[index].dialysis_mode = "HFHD+HP";
            }
            if (information[index].dialysis_mode === 10) {
              information[index].dialysis_mode = "PHF";
            }
            if (information[index].dialysis_mode === 11) {
              information[index].dialysis_mode = "HFR";
            }
            if (information[index].dialysis_mode === 12) {
              information[index].dialysis_mode = "HDF+HP";
            }
            if (information[index].dialysis_mode === 13) {
              information[index].dialysis_mode = "CRRT";
            }
            if (information[index].dialysis_mode === 14) {
              information[index].dialysis_mode = "腹水回输";
            }
            if (information[index].dialysis_mode === 15) {
              information[index].dialysis_mode = "HD前置换";
            }
            if (information[index].dialysis_mode === 16) {
              information[index].dialysis_mode = "HD后置换";
            }
            if (information[index].dialysis_mode === 17) {
              information[index].dialysis_mode = "HDF前置换";
            }
            if (information[index].dialysis_mode === 18) {
              information[index].dialysis_mode = "HDF后置换";
            }

            if (information[index].move === 0) {
              information[index].move = "";
            }
            if (information[index].move === 1) {
              information[index].move = "正常";
            }
            if (information[index].move === 2) {
              information[index].move = "故障";
            }

            if (information[index].disinfect_type === 0) {
              information[index].disinfect_type = "/";
            }

            if (information[index].disinfect_type === 1) {
              information[index].disinfect_type = "擦拭";
            }
            if (information[index].disinfect_type === 2) {
              information[index].disinfect_type = "化学消毒";
            }

            if (information[index].disinfectant_type === 0) {
              information[index].disinfectant_type = "/";
            }

            if (information[index].disinfectant_type === 1) {
              information[index].disinfectant_type = "0.22%季铵盐";
            }
            if (information[index].disinfectant_type === 2) {
              information[index].disinfectant_type = "500mg/l含氯消毒剂";
            }
            if (information[index].disinfectant_type === 3) {
              information[idnex].disinfectant_type = "1000mg/l含氯消毒剂";
            }
            if (information[index].disinfectant_type === 4) {
              information[index].disinfectant_type = "1500mg/l含氯消毒剂";
            }

            if (information[index].disinfection === 0) {
              information[index].disinfection = "";
            }
            if (information[index].disinfection === 1) {
              information[index].disinfection = "已消毒";
            }
            if (information[index].disinfection === 2) {
              information[index].disinfection = "未消毒";
            }
            if (information[index].disinfection === 3) {
              information[index].disinfection = "消毒未完成";
            }

            if (information[index].dialysis_concentration === 0) {
              information[index].dialysis_concentration = "";
            }
            if (information[index].dialysis_concentration === 1) {
              information[index].dialysis_concentration = "达标";
            }
            if (information[index].dialysis_concentration === 2) {
              information[index].dialysis_concentration = "未达标";
            }

            if (information[index].fluid_path === 0) {
              information[index].fluid_path = "/";
            }
            if (information[index].fluid_path === 1) {
              information[index].fluid_path = "热化学消毒";
            }
            if (information[index].fluid_path === 2) {
              information[index].fluid_path = "化学消毒 + 除钙";
            }
            if (information[index].fluid_path === 3) {
              information[index].fluid_path = "热化学消毒 + 除钙";
            }
            if (information[index].fluid_path === 4) {
              information[index].fluid_path = "热消毒";
            }
            if (information[index].fluid_path === 5) {
              information[index].fluid_path = "化学消毒";
            }
            if (information[index].fluid_path === 6) {
              information[index].fluid_path = "除钙";
            }
            if (information[index].fluid_path === 7) {
              information[index].fluid_path = "清洗";
            }

            if (information[index].disinfectant === 0) {
              information[index].disinfectant = "/";
            }

            if (information[index].disinfectant === 1) {
              information[index].disinfectant = "20%柠檬酸";
            }
            if (information[index].disinfectant === 2) {
              information[index].disinfectant = "25%柠檬酸";
            }
            if (information[index].disinfectant === 3) {
              information[index].disinfectant = "50%柠檬酸";
            }
            if (information[index].disinfectant === 4) {
              information[index].disinfectant = "50%柠檬酸 + 5%次氯酸钠";
            }
            if (information[index].disinfectant === 5) {
              information[index].disinfectant = "20%柠檬酸 + 10%冰醋酸";
            }
            if (information[index].disinfectant === 6) {
              information[index].disinfectant = "0.2%过氧化乙酸";
            }
            if (information[index].disinfectant === 7) {
              information[index].disinfectant = "10%冰醋酸";
            }
            if (information[index].disinfectant === 8) {
              information[index].disinfectant = "50%冰醋酸";
            }
            if (information[index].disinfectant === 9) {
              information[index].disinfectant = "5%次氯酸钠";
            }
            if (information[index].disinfection_status === 1) {
              information[index].disinfection_status = "已消毒";
            }
            if (information[index].disinfection_status === 2) {
              information[index].disinfection_status = "未消毒";
            }
            if (information[index].disinfection_status === 3) {
              information[index].disinfection_status = "消毒未完成";
            }

            if (information[index].disinfection_residue === 0) {
              information[index].disinfection_residue = "";
            }
            if (information[index].disinfection_residue === 1) {
              information[index].disinfection_residue = "有残留";
            }
            if (information[index].disinfection_residue === 2) {
              information[index].disinfection_residue = "无残留";
            }
            if (information[index].dialysis_checked === 1) {
              information[index].dialysis_checked = "√";
            }
            if (information[index].dialysis_checked === 0) {
              information[index].dialysis_checked = "";
            }
            if (information[index].dialysis_checked === 2) {
              information[index].dialysis_checked = "";
            }
            if (information[index].germ_checked === 1) {
              information[index].germ_checked = "√";
            }
            if (information[index].germ_checked === 0) {
              information[index].germ_checked = "";
            }
            if (information[index].germ_checked === 2) {
              information[index].germ_checked = "";
            }
            if (information[index].clean === 1) {
              information[index].clean = "√";
            }
            if (information[index].clean === 0) {
              information[index].clean = "";
            }
            if (information[index].clean === 2) {
              information[index].clean = "";
            }

            // this.form.zone = information[index].zone
            // this.form.bed = information[index].bed_number
          }
          var total = response.data.data.total;
          this.tableData = information;
          this.total = total;
        }
      });
    },
    getBedForm(id) {
      getBedForm(id).then(response => {
        if (response.data.state === 1) {
          var addmacher = response.data.data.addmacher;
          // console.log('addmacher=============', addmacher)
          var number = response.data.data.number;
          // console.log('number', number)
          this.form.zone = addmacher.zone_id;
          this.form.bed = addmacher.bed_id;

          var bed = [{ id: 0, number: "全部" }];
          for (let i = 0; i < number.length; i++) {
            const item = number[i];
            bed.push({ id: item.id, number: item.number });
          }
          this.bedNumberTwo = bed;
        }
      });
    },
    // eslint-disable-next-line no-dupe-keys
    querySearchAsync(keyword, cb) {
      let key = "";
      if (keyword != undefined) {
        key = keyword;
      }
      let searchArray = [];
      PostSearch(key).then(response => {
        if (response.data.state == 1) {
          searchArray = response.data.data.patient;
          // console.log("ser=================",searchArray)

          cb(searchArray);
        }
      });

      return searchArray;
    },
    createFilter(queryString) {
      return searchArray => {
        return (
          searchArray.id.toLowerCase().indexOf(queryString.toLowerCase()) === 0
        );
      };
    },
    handleSelect(item) {
      this.userform.patient_id = item.id;
      this.userform.patient_name = item.name;
      // eslint-disable-next-line no-undef
      this.userform.contagion = "";
      getPatientDetail(item.id).then(response => {
        // eslint-disable-next-line eqeqeq
        if (response.data.state == 1) {
          var patient = response.data.data.patient;
          // console.log('patient', patient)
          // eslint-disable-next-line no-undef
          if (patient.is_infectious === 0) {
            this.userform.contagion = "";
          }
          // eslint-disable-next-line no-undef
          if (patient.is_infectious === 1) {
            this.userform.contagion = "无";
          }
          // eslint-disable-next-line no-undef
          if (patient.is_infectious === 2) {
            this.userform.contagion = "有";
          }
        }
      });
    },
    changeBed(id) {
      // eslint-disable-next-line no-undef
      changeBed(id).then(response => {
        if (response.data.state === 1) {
          var bed = response.data.data.bed;
          console.log("aa", bed.length);
          if (bed.length !== 0) {
            this.form.bed = "";
            this.bedNumberTwo = bed;
          }
        }
      });
    },
    changeRun(val) {
      // eslint-disable-next-line eqeqeq
      if (val == 1) {
        this.four = true;
        this.userform.failure_stage = "";
      }
      // eslint-disable-next-line eqeqeq
      if (val == 2) {
        this.four = false;
      }
    },
    DeleteUserLogin(id, index) {
      this.$confirm(
        "确认要删除所选记录吗? <br>删除后,信息将无法恢复",
        "删除提示",
        {
          dangerouslyUseHTMLString: true,
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }
      ).then(() => {
        // eslint-disable-next-line no-undef
        DeleteUserLogin(id, index).then(response => {
          if (response.data.state === 1) {
            var msg = response.data.data.msg;
            this.tableData.splice(index, 1);
          }
        });
      });
    }
  },
  created() {
    this.getAllSubregion();
    this.getInformationData();
    this.getAllOrganization();
  },
  watch: {
    userdata(newvalue, oldvalue) {
      this.getUserForm(newvalue);
      this.getBedForm(newvalue);
    }
  }
};
</script>
<style scoped>
.a {
  .el-col-2 {
    width: 8.33333%;
    margin-bottom: 20px;
  }
}
.print_main_content {
  background-color: white;
  width: 960px;
  margin: 0 auto;
  padding: 0 0 20px 0;
}
</style>
<style lang="scss">
.machineClass {
  font-size: 14px;
}
.c {
  margin-bottom: 10px;
}
</style>
