<template>
  <div class="computer">
    <div>
      <div class="warnTxt" v-if="showTxt != ''">
        {{ showTxt }}
      </div>
      <van-collapse v-model="activeNames" accordion @change="showSubMenu">

        <van-collapse-item v-if="isShowFiled('班次')" title="班次" name="1">
          <template slot="title">
              <div><span v-if="isShow_title('班次')" class="warn_tip">*</span>班次</div>
          </template>
          <template #value>
            <div>{{ getSchedualType(schedual_type) }}</div>
          </template>
          <van-radio-group v-model="schedual_type" @change="selectType">
            <van-radio
              :name="item.id"
              v-for="(item, index) in schedules_type"
              :key="index"
              >{{ item.name }}</van-radio
            >
          </van-radio-group>
        </van-collapse-item>
        <van-collapse-item
          v-if="isShowFiled('上机床位')"
          title="上机分区"
          name="2"
        >
        <template slot="title">
              <div><span v-if="isShow_title('上机床位')" class="warn_tip">*</span>上机分区</div>
          </template>
          <template #value>
            <div
              v-if="item.zone_id == zoneId"
              v-for="(item, index) in zoneData"
            >
              {{ item.zone_name }}
            </div>
            <div v-if="zoneId == 0">{{ getBedId(bed_id) }}</div>
          </template>
          <van-radio-group v-model="zoneId" @change="changeZone">
            <van-radio
              :name="item.zone_id"
              v-for="(item, index) in zoneData"
              :key="index"
            >
              {{ item.zone_name }}
            </van-radio>
          </van-radio-group>
        </van-collapse-item>

        <van-collapse-item
          v-if="isShowFiled('上机床位')"
          title="上机床位"
          name="9"
        >
        <template slot="title">
              <div><span v-if="isShow_title('上机床位')" class="warn_tip">*</span>上机床位</div>
          </template>
          <template #value>
            <div v-if="device_number_map[bedId]">
              {{ device_number_map[bedId].number }}
            </div>
          </template>
          <van-radio-group v-model="bedId" @change="changeBed">
            <van-radio
              :name="item.id"
              v-for="(item, index) in bedData"
              :key="index"
              >{{ item.number }}</van-radio
            >
          </van-radio-group>
        </van-collapse-item>

        <van-collapse-item
          v-if="isShowFiled('上机护士') && org_id!=10721"
          title="上机护士"
          name="3"
        >
        <template slot="title">
              <div><span v-if="isShow_title('上机护士')" class="warn_tip">*</span>上机护士</div>
          </template>
          <template #value>
            <div v-if="admin_map[start_nurse]">{{ admin_map[start_nurse].name }}</div>
          </template>
          <van-radio-group v-model="start_nurse">
            <van-radio
              :name="item.id"
              v-for="(item, index) in admins"
              :key="index"
              v-if="item.status == 1"
              >{{ item.name }}</van-radio
            >
          </van-radio-group>
        </van-collapse-item>

        <van-collapse-item
          v-if="isShowFiled('上机护士')  && org_id==10721"
          title="治疗护士"
          name="3"
        >
        <template slot="title">
              <div><span v-if="isShow_title('上机护士')" class="warn_tip">*</span>治疗护士</div>
          </template>
          <template #value>
            <div v-if="admin_map[start_nurse]">{{ admin_map[start_nurse].name }}</div>
          </template>
          <van-radio-group v-model="start_nurse">
            <van-radio
              :name="item.id"
              v-for="(item, index) in admins"
              :key="index"
              v-if="item.status == 1"
              >{{ item.name }}</van-radio
            >
          </van-radio-group>
        </van-collapse-item>

        <van-collapse-item v-if="isShowFiled('穿刺者')" title="穿刺者" name="4">
          <template slot="title">
              <div><span v-if="isShow_title('穿刺者')" class="warn_tip">*</span>穿刺者</div>
          </template>
          <template #value>
            <div v-if="admin_map[puncture_nurse]"><!--puncture_nurse_id-->
              {{ admin_map[puncture_nurse].name }}
            </div>
          </template>
          <van-radio-group v-model="puncture_nurse">
            <van-radio name="" key="-2">请选择</van-radio>
            <van-radio
              :name="item.id"
              v-for="(item, index) in admins"
              :key="index"
              v-if="item.status == 1"
              >{{ item.name }}</van-radio
            >
          </van-radio-group>
        </van-collapse-item>

        <van-collapse-item
          v-if="isShowFiled('质控护士')"
          title="质控护士"
          name="20"
        >
        <template slot="title">
              <div><span v-if="isShow_title('质控护士')" class="warn_tip">*</span>质控护士</div>
          </template>
          <template #value>
            <div v-if="admin_map[quality_nurse]"><!--quality_nurse_id-->
              {{ admin_map[quality_nurse].name }}
            </div>
          </template>
          <van-radio-group v-model="quality_nurse">
            <van-radio name="" key="-2">请选择</van-radio>
            <van-radio
              :name="item.id"
              v-for="(item, index) in admins"
              :key="index"
              v-if="item.status == 1"
              >{{ item.name }}</van-radio
            >
          </van-radio-group>
        </van-collapse-item>

        <van-collapse-item
          v-if="isShowFiled('换药护士')"
          title="换药护士"
          name="5"
        >
        <template slot="title">
              <div><span v-if="isShow_title('换药护士')" class="warn_tip">*</span>换药护士</div>
          </template>
          <template #value>
            <div v-if="admin_map[change_nurse]">
              {{ admin_map[change_nurse].name }}
            </div>
          </template>
          <van-radio-group v-model="change_nurse">
            <van-radio name="" key="-2">请选择</van-radio>
            <van-radio
              :name="item.id"
              v-for="(item, index) in admins"
              :key="index"
              v-if="item.status == 1"
              >{{ item.name }}</van-radio
            >
          </van-radio-group>
        </van-collapse-item>

        <van-collapse-item
          class="newBorder"
          v-if="isShowFiled('冲管护士')"
          title="冲管护士"
          name="6"
        >
        <template slot="title">
              <div><span v-if="isShow_title('冲管护士')" class="warn_tip">*</span>冲管护士</div>
          </template>
          <template #value>
            <div v-if="admin_map[washpipe_nurse]">
              {{ admin_map[washpipe_nurse].name }}
            </div>
          </template>
          <van-radio-group v-model="washpipe_nurse">
            <van-radio name="" key="-2">请选择</van-radio>
            <van-radio
              :name="item.id"
              v-for="(item, index) in admins"
              :key="index"
              v-if="item.status == 1"
              >{{ item.name }}</van-radio
            >
            <!-- @click="changeToggle(item.id)" -->
          </van-radio-group>
        </van-collapse-item>

        <van-collapse-item
          v-if="isShowFiled('疑难穿刺护士')"
          title="疑难穿刺护士"
          name="7"
        >
        <template slot="title">
              <div><span v-if="isShow_title('疑难穿刺护士')" class="warn_tip">*</span>疑难穿刺护士</div>
          </template>
          <template #value>
            <div v-if="admin_map[difficult_puncture_nurse]">
              {{ admin_map[difficult_puncture_nurse].name }}
            </div>
          </template>
          <van-radio-group v-model="difficult_puncture_nurse">
            <van-radio name="" key="-2">请选择</van-radio>
            <van-radio
              :name="item.id"
              v-for="(item, index) in admins"
              :key="index"
              v-if="item.status == 1"
              >{{ item.name }}</van-radio
            >
          </van-radio-group>
        </van-collapse-item>

        <van-collapse-item
          v-if="isShowFiled('新开瘘护士')"
          title="新开瘘护士"
          name="8"
        >
        <template slot="title">
              <div><span v-if="isShow_title('新开瘘护士')" class="warn_tip">*</span>新开瘘护士</div>
          </template>
          <template #value>
            <div v-if="admin_map[new_fistula_nurse]">
              {{ admin_map[new_fistula_nurse].name }}
            </div>
          </template>
          <van-radio-group v-model="new_fistula_nurse">
            <van-radio name="" key="-2">请选择</van-radio>
            <van-radio
              :name="item.id"
              v-for="(item, index) in admins"
              :key="index"
              v-if="item.status == 1"
              >{{ item.name }}</van-radio
            >
          </van-radio-group>
        </van-collapse-item>

        <van-collapse-item
          v-if="isShowFiled('穿刺针')"
          title="穿刺针"
          name="puncture_needle"
        >
        <template slot="title">
              <div><span v-if="isShow_title('穿刺针')" class="warn_tip">*</span>穿刺针</div>
          </template>
          <template #value>
            <div>{{ puncture_needle }}</div>
          </template>
          <checkBoxMenu
            v-if="checkBoxShow"
            v-on:menu-comfirm="getString"
            :propsForm="propForm"
          ></checkBoxMenu>
        </van-collapse-item>
        <van-collapse-item
          v-if="isShowFiled('穿刺方式')"
          title="穿刺方式"
          name="puncture_way"
        >
        <template slot="title">
              <div><span v-if="isShow_title('穿刺方式')" class="warn_tip">*</span>穿刺方式</div>
          </template>
          <template #value>
            <div>{{ puncture_way }}</div>
          </template>
          <checkBoxMenu
            v-if="checkBoxShow"
            v-on:menu-comfirm="getString"
            :propsForm="propForm"
          ></checkBoxMenu>
        </van-collapse-item>

        <van-collapse-item
          v-if="isShowFiled('透析器')"
          title="透析器"
          name="15"
        >
        <template slot="title">
              <div><span v-if="isShow_title('透析器')" class="warn_tip">*</span>透析器</div>
          </template>
          <template #value>
            <div>{{ dialysis_dialyszers }}</div>
          </template>
          <van-radio-group v-model="dialysis_dialyszers">
            <van-radio name="" key="-2">请选择</van-radio>
            <van-radio
              :name="item.specification_name"
              v-for="(item, index) in dialysisDialyszers"
              :key="index"
              >{{ item.specification_name }}</van-radio
            >
          </van-radio-group>
          
        </van-collapse-item>


        <van-collapse-item
          v-if="isShowFiled('灌流器')"
          title="灌流器"
          name="16"
        >
        <template slot="title">
              <div><span v-if="isShow_title('灌流器')" class="warn_tip">*</span>灌流器</div>
          </template>
          <template #value>
            <div>{{ dialysis_irrigation }}</div>
          </template>
          <van-radio-group v-model="dialysis_irrigation">
            <van-radio name="" key="-2">请选择</van-radio>
            <van-radio
              :name="item.specification_name"
              v-for="(item, index) in dialysisIrrigation"
              :key="index"
              >{{ item.specification_name }}</van-radio
            >
          </van-radio-group>
        </van-collapse-item>

     
        <van-collapse-item
          v-if="isShowFiled('血滤器')"
          title="血滤器"
          name="19"
        >
        <template slot="title">
              <div><span v-if="isShow_title('血滤器')" class="warn_tip">*</span>血滤器</div>
          </template>
          <template #value>
            <div>{{ dialysis_strainer }}</div>
          </template>
          <van-radio-group v-model="dialysis_strainer">
            <van-radio name="" key="-2">请选择</van-radio>
            <van-radio
              :name="item.specification_name"
              v-for="(item, index) in dialysisStrainerList"
              :key="index"
              >{{ item.specification_name }}</van-radio
            >
          </van-radio-group>
        </van-collapse-item>

      

        <van-collapse-item
          v-if="isShowFiled('血管通路')"
          title="血管通路"
          name="10"
        >
        <template slot="title">
              <div><span v-if="isShow_title('血管通路')" class="warn_tip">*</span>血管通路</div>
          </template>
          <template #value>
            <div>{{ getBloodAccessTwo(blood_access_part_opera_id) }}</div><!--blood_access_id-->
          </template>
          <van-radio-group v-model="blood_access_part_opera_id" @change="changeOne">
            <van-radio name="" key="-2">请选择</van-radio>
            <van-radio
              :name="item.id"
              v-for="(item, index) in bloodAccessOptions"
              :key="index"
              >{{ item.name }}</van-radio
            >
          </van-radio-group>
        </van-collapse-item>

        <van-cell title='导管备注' v-if="isShowFiled('导管备注') && blood_access_name.indexOf('置管')!==-1" @click="summaryShow = true" is-link value="请选择"></van-cell>
            <van-popup v-model="summaryShow" get-container="#app" class="listBoxPopup newListBoxPopupApp" style="z-index:5000" v-if="isShowFiled('导管备注') && blood_access_name.indexOf('置管')!==-1">
                <div class="listBox">
                    <div @click="toSummary('')">请选择</div>
                    <div v-for="(item,index) in summary" :key="index" @click="toSummary(item.id)">{{ item.text }}</div>
                </div>
            </van-popup>
            <van-field class="bgField" v-if="isShowFiled('导管备注')&& blood_access_name.indexOf('置管')!==-1" v-model="catheter_operation" rows="1" autosize type="textarea" placeholder="请输入"/>

        <van-field
          v-model="blood_drawing"
          v-if="isShowFiled('引血')"
          :required="isShow_title('引血')"
          label="引血"
          input-align="right"
        />
        <van-field
          v-if="isShowFiled('核酸检测日期')"
          :required="isShow_title('核酸检测日期')"
          v-model="nuclein_date_str"
          readonly
          @click="selectNucleinDateAction"
          label="核酸检测日期"
          input-align="right"
        />
        <van-field
          v-model="schedule_remark"
          @focus="inputFocus"
          v-if="isShowFiled('排班备注')"
          :required="isShow_title('排班备注')"
          label="排班备注"
          input-align="right"
        />
        <van-field
          v-model="order_remark"
          @focus="inputFocus"
          v-if="isShowFiled('上机备注')"
          :required="isShow_title('上机备注')"
          label="上机备注"
          input-align="right"
        />
        <van-field
          v-model="start_time_str"
          readonly
          @click="selectStartTimeAction"
          v-if="isShowFiled('上机时间')"
          label="上机时间"
          :required="isShow_title('上机时间')"
          input-align="right"
        />

        <van-field
          v-model="blood_flow_volume"
          @focus="inputFocus"
          v-if="isShowFiled('血流量')"
          :required="isShow_title('血流量')"
          label="血流量(ml/min)"
          input-align="right"
        />
      </van-collapse>
      <div v-if="isShowFiled('患者签名') && this.record.id != 0">
        <div class="myInfo1" @click="toPatientSign">
          <div class="myInfoLeft">
            <p><span v-if="isShow_title('患者签名')" class="warn_tip">*</span>患者签名</p>
          </div>
          <van-icon class="arrow" name="arrow" />
        </div>
      </div>
      <div v-show="showpan == 'image'">
        <img :src="electronicsignature" alt srcset />
      </div>
      <div v-if="this.record.id == 0">
        <img :src="electronicsignature" alt srcset />
      </div>
    </div>

    <div class="preserveBox">
      <div
        class="isComputer"
        @click="commitInfo"
        v-if="record == null || record.id == ''"
      >
        执行上机 <!---->
      </div>
      <div class="unPlane" v-else>已上机</div>
      <div @click="modify" v-if="this.record.id != 0">修改上机</div>
    </div>

    <mt-datetime-picker
      class="datetimePicker"
      ref="start_time_picker"
      type="datetime"
      @confirm="didSelectStartTime"
      v-model="start_time"
    ></mt-datetime-picker>

    <mt-datetime-picker
      class="datetimePicker"
      ref="nuclein_date_picker"
      type="date"
      @confirm="didNucleinDateTime"
      v-model="nuclein_date"
    ></mt-datetime-picker>

    <el-dialog
      title="提示"
      :visible.sync="centerDialogVisible"
      width="70%"
      v-loading="loading"
      element-loading-text="正在保存签名图片"
      element-loading-spinner="el-icon-loading"
      center
      style="margin-top: 8vh"
    >
      <vue-cropper
        ref="cropper"
        :src="imgUrl"
        alt="Source Image"
        :cropmove="cropImage"
      ></vue-cropper>
      <span slot="footer" class="dialog-footer">
        <el-button @click="centerDialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="uploadImage">确 定</el-button>
      </span>
    </el-dialog>

      <van-popup
      v-model="infor_visibility"
      class="advicePopup"
      get-container="#today_panel"
    >
      <infor-sub-menu
      :visibility="infor_visibility"
      v-on:menu-cancle-three="menuCancleFour"
      v-on:menu-comfirm-three="menuComfirmFour"
      >
    </infor-sub-menu>
    </van-popup>
  </div>
</template>

<script>
import {
  checkSch,
  GetSchedualNumber,
  PostModifyStartDialysis,
  startDialysis,
  savePatientSign,
  getPatientSign,
  saveMobileInformation
} from "@/api/dialysis";
import { Dialog, Toast } from "vant";
import { parseTime } from "@/utils";
import { getDataConfig } from "@/utils/data";
import { getToken } from "@/api/qiniu";
import VueCropper from "vue-cropperjs";
import { setRem } from "@/libs/functionRem";
import { uParseTime } from "@/utils/tools";
import request from "@/utils/request";
import checkBoxMenu from "./components/checkBoxMenu";
const moment = require("moment");
import InforSubMenu from "../dialog/subMenu/InforSubMenu.vue"
export default {
  components: {
    VueCropper,
    checkBoxMenu,
    InforSubMenu
  },
  props: {
    schedule: {
      type: Object,
    },
    patient_prop: {
      type: Object,
    },
    record: {
      type: Object,
    },
    admins: {
      type: Array,
    },
    device_numbers: {
      type: Array,
    },
    admin_map: {
      type: Object,
    },
    device_number_map: {
      type: Object,
    },
    special_premission: {
      type: Array,
    },
    admin_staff: {
      type: Object,
    },
    stockType: {
      type: Array,
      default: function () {
        return new Array();
      },
    },
    last_order: {
      type: Object,
    },
    predialysis: {
      type: Object
    },
  },
  data() {
    return {
      dialogVisible: false,
      showTxt: "",
      activeNames: "",
      start_time_str: "",
      nuclein_date_str: moment(new Date()).format("YYYY-MM-DD"),
      start_time: new Date(),
      bed_id: "",
      start_nurse: 0,
      puncture_nurse: 0,
      washpipe_nurse: 0,
      change_nurse: 0,
      difficult_puncture_nurse: 0,
      new_fistula_nurse: 0,
      quality_nurse: 0,
      schedual_type: 0,
      schedules_type: [
        { id: 1, name: "上午" },
        { id: 2, name: "下午" },
        { id: 3, name: "晚上" },
      ], // 该排班的区里的床位
      blood_drawing: 100,
      zonebedNumber: [],
      zoneData: [],
      bedData: [],
      zoneId: 0,
      bedId: 0,
      org_id: 0,
      zoneList: [],

      showpan: "",
      nobeginAction: true,
      loading: false,
      electronicsignature: "",
      uptoken: "",
      avatarUrl2: null,
      centerDialogVisible: false,
      cropper: "",
      colors: [
        "#fef4ac",
        "#0018ba",
        "#ffc200",
        "#f32f15",
        "#cccccc",
        "#5ab639",
      ],
      brushs: [
        {
          className: "small fa fa-paint-brush",
          lineWidth: 3,
        },
        {
          className: "middle fa fa-paint-brush",
          lineWidth: 6,
        },
        {
          className: "big fa fa-paint-brush",
          lineWidth: 12,
        },
      ],
      context: {},
      imgUrl: "",
      uploadImgUrl: "",
      canvasMoveUse: false,
      // 存储当前表面状态数组-上一步
      preDrawAry: [],
      // 存储当前表面状态数组-下一步
      nextDrawAry: [],
      // 中间数组
      middleAry: [],
      // 配置参数
      config: {
        lineWidth: 6,
        lineColor: "#000",
        shadowBlur: 1,
        fillStyle: "#fff",
      },
      patient_id: 0,
      record_time: 0,
      puncture_needle: 0,
      puncture_way: 0,
      propForm: {
        title: "",
        list: [],
        optionList: [],
        isMultiple: 2,
        result: [], // 选中的值
        type: 1, // 用来区分不同子菜单，方便对返回值进行赋值
        selectId: 0,
        isHasOther: 1, // 是否有其他选项  1是 2否
      },
      checkBoxShow: false,
      punctureNeedleOptions: [],
      dialysisDialyszers: [],
      dialysisIrrigation: [],
      dialysisStrainerList: [],
      dialysis_dialyszers: "",
      dialysis_irrigation: "",
      dialysis_strainer:"",
      blood_access_part_opera_id: 0,
      nuclein_date: new Date(),
      schedule_remark: "",
      order_remark: "",
      nurse_id:0,
      infor_visibility:false,
      catheter_operation: '',
      summaryShow: false,
      summary: [],
      catheter_operation_id: 0,
      blood_access_name: '',
      blood_flow_volume:"",
    };
  },
  created() {
    console.log("透前=======================",this.predialysis)
  
    setRem();
    this.getToken();
    this.getPatientSign();
    this.getPermission();
  
    this.temp_device_numbers = this.device_numbers;

    if (this.record.id == 0) {
      this.isShow = false;
      this.start_time_str =parseTime(this.start_time, "{y}-{m}-{d} {h}:{i}") + ":00";
      let now = new Date();
      let hour = now.getHours();

      if (hour >= 6 && hour < 11) {
        this.schedual_type = 1;
      } else if (hour >= 11 && hour < 18) {
        this.schedual_type = 2;
      } else if (hour >= 18) {
        this.schedual_type = 3;
      }
      this.puncture_needle = this.last_order.puncture_needle;
      this.puncture_way = this.last_order.puncture_way;
      this.dialysis_dialyszers = this.last_order.dialysis_dialyszers;
     
      // this.dialysis_irrigation = this.last_order.dialysis_irrigation;
      this.blood_access_part_opera_id = this.last_order.blood_access_id;
      this.schedule_remark = this.last_order.schedule_remark;
      this.order_remark = this.last_order.order_remark;
      this.electronicsignature = this.last_order.url;
      if(this.last_order.blood_drawing>0){
        this.blood_drawing = this.last_order.blood_drawing
      }else{
        this.blood_drawing = 100
      }
      
      if (this.last_order.nuclein_date == 0) {
        this.nuclein_date_str = moment(new Date()).format("YYYY-MM-DD");
      } else {
        this.nuclein_date_str = this.getTimeOne(this.last_order.nuclein_date);
      }

    } else {
      this.isShow = true;

      if (this.record.start_time == 0) {
        this.start_time_str =
          parseTime(this.start_time, "{y}-{m}-{d} {h}:{i}") + ":00";
        this.schedual_type = this.record.schedual_type;
      } else {
        this.start_time_str =
          parseTime(this.record.start_time, "{y}-{m}-{d} {h}:{i}") + ":00";
        this.schedual_type = this.record.schedual_type;
      }
    }

    this.template_id = this.$store.getters.user.template_info.template_id;
    this.org_id = this.$store.getters.user.template_info.org_id;
    var date = this.$route.query && this.$route.query.date;
    this.patient_id = this.$route.query.patient_id;
    this.record_time = this.$route.query.date;
    date *= 1000;
    var newDate = new Date(date);
    var y = newDate.getFullYear();
    var m = newDate.getMonth() + 1;
    var d = newDate.getDate();
    if (isNaN(y) || isNaN(m) || isNaN(d)) {
      newDate = new Date();
      y = newDate.getFullYear();
      m = newDate.getMonth() + 1;
      d = newDate.getDate();
    }
    this.record_date =
      y + "-" + (m < 10 ? "0" + m : m) + "-" + (d < 10 ? "0" + d : d);

    this.bed_id =
      this.record == null || this.record.id == ""
        ? this.schedule.bed_id
        : this.record.bed_id;


    this.start_nurse =
      this.record == null || this.record.id == ""
        ? this.$store.getters.user.admin.id
        : this.record.start_nurse;

    this.puncture_nurse =
      this.record == null || this.record.id == ""
        ? this.$store.getters.user.admin.id
        : this.record.puncture_nurse;
    console.log("穿刺==================",this.puncture_nurse)
    console.log("admin_map----------------",this.admins)
    this.washpipe_nurse =
      this.record == null || this.record.id == ""
        ? this.$store.getters.user.admin.id
        : this.record.washpipe_nurse;
    if (this.org_id == 10340) {
      this.change_nurse =
        this.record == null || this.record.id == ""
          ? this.$store.getters.user.admin.id
          : this.record.change_nurse;
      this.difficult_puncture_nurse =
        this.record == null || this.record.id == ""
          ? this.$store.getters.user.admin.id
          : this.record.difficult_puncture_nurse;
      this.new_fistula_nurse =
        this.record == null || this.record.id == ""
          ? this.$store.getters.user.admin.id
          : this.record.difficult_puncture_nurse;
    }

    // if (this.puncture_nurse_id == 0) {
    //   this.puncture_nurse_id = this.$store.getters.user.admin.id;
    // }
    this.quality_nurse =
      this.record == null || this.record.id == ""
        ? this.$store.getters.user.admin.id
        : this.record.quality_nurse;
    if (this.record.id > 0) {
      this.schedual_type = this.record.schedual_type;
      this.change_nurse = this.record.change_nurse;
      this.difficult_puncture_nurse = this.record.difficult_puncture_nurse;
      this.new_fistula_nurse = this.record.new_fistula_nurse;
      this.zone_id = this.record.zone_id;
      this.bed_id = this.record.bed_id;
      this.start_nurse = this.record.start_nurse
      this.quality_nurse = this.record.quality_nurse_id;
      this.puncture_needle = this.record.puncture_needle;
      this.puncture_way = this.record.puncture_way;
      this.dialysis_dialyszers = this.record.dialysis_dialyszers;
      this.dialysis_irrigation = this.record.dialysis_irrigation;
      this.dialysis_strainer = this.record.dialysis_strainer;
      this.blood_access_part_opera_id = this.record.blood_access_id;
      this.schedule_remark = this.record.schedule_remark;
      this.order_remark = this.record.order_remark;
      this.catheter_operation = this.record.catheter_operation
      this.blood_drawing = this.record.blood_drawing
      this.nuclein_date_str = this.getTimeOne(this.record.nuclein_date);
    }

    if(this.org_id == 10721){
      if(this.predialysis!=null){
      if(this.predialysis.internal_fistula!=''){
          this.change_nurse = 0
          this.puncture_nurse = this.record == null || this.record.id == ""? this.$store.getters.user.admin.id : this.record.puncture_nurse;
      }
      if(this.predialysis.catheter!=""){
         this.puncture_nurse = 0
         this.change_nurse = this.record == null || this.record.id == ""? this.$store.getters.user.admin.id : this.record.change_nurse;
      }
    }

    }
   
    for (let index = 0; index < this.temp_device_numbers.length; index++) {
      const device_number = this.temp_device_numbers[index];
      this.temp_device_numbers[index]["zoneNumber"] =
        device_number["zone_name"] + "-" + device_number["number"];
    }
    this.zone_beds = this.temp_device_numbers;


    if (this.record.id > 0) {
      if (this.record.creator == 0) {
        this.creator = this.record.start_nurse;
      } else {
        this.creator = this.record.creator;
      }
    }

    this.schedual_type = this.schedule.schedule_type;
    var obj = { id: 0, name: "请选择" };
    this.punctureNeedleOptions.push(obj);

    var arr = getDataConfig("hemodialysis", "puncture_needle");

    for (let i = 0; i < arr.length; i++) {
      this.punctureNeedleOptions.push(arr[i]);
    }

    var arr = [];
    var arrTwo = [];
    var arrThree = []
    var dialyzer = [];
    var irrigation = [];
    var dialysisStrainer = []
    if (this.stockType.length > 0) {
      for (let i = 0; i < this.stockType.length; i++) {
        if (this.stockType[i].stock_attribute == 2) {
          arr.push(this.stockType[i]);
        }
        if (this.stockType[i].stock_attribute == 3) {
          arrTwo.push(this.stockType[i]);
        }
        if (this.stockType[i].stock_attribute == 4) {
          arrThree.push(this.stockType[i]);
        }
      }

      for (let i = 0; i < arr.length; i++) {
        for (let j = 0; j < arr[i].GoodInfo.length; j++) {
          dialyzer.push(arr[i].GoodInfo[j]);
        }
      }

      for (let i = 0; i < arrTwo.length; i++) {
        for (let j = 0; j < arrTwo[i].GoodInfo.length; j++) {
          irrigation.push(arrTwo[i].GoodInfo[j]);
        }
      }
      for (let i = 0; i < arrThree.length; i++) {
        for (let j = 0; j < arrThree[i].GoodInfo.length; j++) {
          dialysisStrainer.push(arrThree[i].GoodInfo[j])
        }
      }
      this.dialysisDialyszers = dialyzer;
      this.dialysisIrrigation = irrigation;
      this.dialysisStrainerList = dialysisStrainer

      this.bloodAccessOptions = getDataConfig(
        "hemodialysis",
        "vascular_access_desc"
      );
    }
    this.summary = getDataConfig('catheter_operation', 'catheter_operation')
    this.GetSchedualNumber();
  },

  mounted() {
  },
  computed: {
    controls() {
      return [
        {
          title: "上一步",
          action: "prev",
          className: this.preDrawAry.length
            ? "active fa fa-reply"
            : "fa fa-reply",
        },
        {
          title: "下一步",
          action: "next",
          className: this.nextDrawAry.length
            ? "active fa fa-share"
            : "fa fa-share",
        },
        {
          title: "清除",
          action: "clear",
          className:
            this.preDrawAry.length || this.nextDrawAry.length
              ? "active fa fa-trash"
              : "fa fa-trash",
        },
      ];
    },
  },
  methods: {
    isShowFiled(name) {
      var filedList = this.$store.getters.user.fileds;

      for (let i = 0; i < filedList.length; i++) {
        if (
          filedList[i].module == 7 &&
          filedList[i].filed_name_cn == name &&
          filedList[i].is_show == 1
        ) {
          return true;
        }
      }
      return false;
    },
    isShow_title(name) {
      var filedList = this.$store.getters.user.fileds;
      console.log("filedList",filedList)
     var arr= []
      for (let i = 0; i < filedList.length; i++) {
        if(filedList[i].module == 7){
           arr.push(filedList[i])
        }
        if (
          filedList[i].module == 7 &&
          filedList[i].filed_name_cn == name &&
          filedList[i].is_show == 1&&
          filedList[i].is_write == 1
        ) {
          return true;
        }
      }
      console.log("arr-----",arr)
      return false;
    },
    getArrEqual(arr1, arr2) {
      let newArr = [];
      for (let i = 0; i < arr2.length; i++) {
        for (let j = 0; j < arr1.length; j++) {
          if (arr1[j].module == 7
          && arr1[j].is_show == 1
          &&arr1[j].filed_name == arr2[i][0]
          &&arr1[j].is_write == 1 ) {
            newArr.push(arr1[j]);
          }
        }
      }
      return newArr;
    },
    open_tips(info) {
      for (let i = 0; i < info.length; i++) {
        if (info[i].is_write == 1) {
          Toast.fail(`${info[i].filed_name_cn}为必填字段，不能为空`)
        }else{
          return
        }
      }
    },
    isWrite(name) {
      var filedList = this.$store.getters.user.fileds;
      for (let i = 0; i < filedList.length; i++) {
        if (
          filedList[i].module == 7 &&
          filedList[i].filed_name_cn == name &&
          filedList[i].is_write == 1 &&
          filedList[i].is_show == 1
        ) {
          return true;
        }
      }

      return false;
    },
    bloodaccess(val){
      this.blood_access_part_opera_id=val
    },
    commitInfo: function () {
        let ParamsQuery = {}
        ParamsQuery['mode'] = '1'
        ParamsQuery['schedual_type'] = this.schedual_type
        ParamsQuery['patient_id'] = this.patient_prop.id
        ParamsQuery['record_date'] = this.record_date
        ParamsQuery['start_nurse'] = this.start_nurse //nurse
        ParamsQuery['bed'] = this.bed_id
        ParamsQuery['start_time'] = this.start_time_str
        ParamsQuery['puncture_nurse'] = this.puncture_nurse //puncture_nurse_id
        ParamsQuery['blood_drawing'] = this.blood_drawing
        ParamsQuery['quality_nurse_id'] = this.quality_nurse //quality_nurse_id
        ParamsQuery['change_nurse'] = this.change_nurse
        ParamsQuery['washpipe_nurse'] = this.washpipe_nurse
        ParamsQuery['difficult_puncture_nurse'] = this.difficult_puncture_nurse
        ParamsQuery['new_fistula_nurse'] = this.new_fistula_nurse
        ParamsQuery['zone_id'] = this.zoneId
        ParamsQuery['puncture_needle'] = this.puncture_needle
        ParamsQuery['puncture_way'] = this.puncture_way
        ParamsQuery['dialysis_dialyszers'] = this.dialysis_dialyszers
        ParamsQuery['dialysis_irrigation'] = this.dialysis_irrigation
      
        ParamsQuery['blood_access_part_opera_id'] = this.blood_access_part_opera_id //blood_access_part_opera_id  blood_access_id
        ParamsQuery['url'] = this.electronicsignature
        ParamsQuery['nuclein_date_str'] = this.nuclein_date_str
        ParamsQuery['schedule_remark'] = this.schedule_remark
        ParamsQuery['order_remark'] = this.order_remark
        ParamsQuery['catheter_operation'] = this.catheter_operation
        ParamsQuery["blood_flow_volume"] = this.blood_flow_volume
        ParamsQuery["dialysis_strainer"] =this.dialysis_strainer
        // console.log('paras', ParamsQuery)
        // console.log('quality_nurse_id',this.quality_nurse);
        // console.log('穿刺者',this.puncture_nurse);
        // console.log('冲管护士',this.washpipe_nurse);
        // console.log('上机护士', this.start_nurse)
        // console.log('bedId', this.bedId)

        if (this.bedId == 0) {
          Toast.fail('请选择床位号')
          return false
        }

        if (this.schedual_type == 0) {
          Toast.fail('请选择班次')
          return false
        }
        if (this.zoneId == 0) {
          Toast.fail('请选择分区')
          return false
        }

        // 必填弹窗开始
        // console.log(ParamsQuery, "提交的参数");

        let result = [];
        let filedList = this.$store.getters.user.fileds;
        let new_arr = Object.entries(ParamsQuery);
        new_arr.forEach((el) => {
          if (el[1] === "" || el[1] === 0 || el[1] == undefined) {
            // result.push(el);
            result.unshift(el)
          }
        });
        // console.log(result, "提交的参数当中过滤出为空的");
        // console.log(this.getArrEqual(filedList, result));
        let warnarr = [];
        warnarr = this.getArrEqual(filedList, result);

        if (warnarr.length > 0) {
          this.open_tips(warnarr);
          // 必填弹窗结束
        } else {
          // Toast.loading({forbidClick: true, duration: 0})
          checkSch(ParamsQuery).then(response => {
          if (response.data.state == 0) {
            Toast.fail(response.data.msg)
            if(response.data.code == 600000008){
              this.infor_visibility = true
            }
            this.selecting = true
            return false
          } else {
            if (response.data.data.status == 1) {
              Dialog.confirm({
                message: response.data.data.msg
              }).then(() => {
                startDialysis(ParamsQuery).then((response) => {
                    if (response.data.state == 0) {
                      Toast.fail(response.data.msg)
                      if(response.data.code == 600000008){
                        this.infor_visibility = true
                       }
                      return false
                    } else {
                     
                      if (this.org_id == 10340 || this.org_id == 3877 || this.org_id == 10164) {
                        this.getPatientSign()
                      }
                      Toast.success('上机成功')
                      var monitor = response.data.data.monitor
                      
                      var did_start = response.data.data.dialysis_order
                    
                      this.$emit('did_add_monitor', monitor)
                      this.$emit('did_start', did_start)
                      var record = this.record
                      // console.log('上机233223', response.data.data.dialysis_order)
                      // this.$parent.newRequestDialysisRecord()
                      for (const key in response.data.data.dialysis_order) {
                        this.$set(record, key, response.data.data.dialysis_order[key])
                      }

                      this.selecting = true
                      // console.log('patient_index2oo3o3o23o23o23', this.patient_index)
                      this.$emit('close')
                      this.$emit('open', this.patient_index)
                    }
                  }).catch((error) => {
                    Toast.fail('保存成功!')
                    this.selecting = true
                    this.$emit('close')
                  // this.$parent.newRequestDialysisRecord()
                  })
              })
            } else if (response.data.data.status == 2) {
              Dialog.confirm({
                message: response.data.data.msg
              }).then(() => {
               
              })
            } else {
             
              startDialysis(ParamsQuery).then((response) => {
                  // console.log("response++++++++11111",response.data.state)
                  if (response.data.state == 0) {
                    Toast.fail(response.data.msg)
                     if(response.data.code == 600000008){
                        this.infor_visibility = true
                     }
                    return false
                  } else {
                    // console.log("进来我")
                    if (this.org_id == 10340 || this.org_id == 3877 || this.org_id == 10164) {
                      this.getPatientSign()
                    }
                    Toast.success('上机成功')
                    var monitor = response.data.data.monitor
                    // console.log('监测数据', monitor)
                    var did_start = response.data.data.dialysis_order
                    // console.log('did_start', did_start)
                    this.$emit('did_add_monitor', monitor)
                    this.$emit('did_start', did_start)
                    var record = this.record
                    // console.log('上机233223', response.data.data.dialysis_order)
                    // this.$parent.newRequestDialysisRecord()
                    for (const key in response.data.data.dialysis_order) {
                      this.$set(record, key, response.data.data.dialysis_order[key])
                    }

                    this.selecting = true
                    // console.log('patient_index2oo3o3o23o23o23', this.patient_index)
                    this.$emit('close')
                    this.$emit('open', this.patient_index)
                  }
                }).catch((error) => {
                  Toast.fail('保存成功!')
                  this.selecting = true
                  this.$emit('close')
                // this.$parent.newRequestDialysisRecord()
                })
            }
          }
        }).catch(error => {
          startDialysis(ParamsQuery).then((response) => {
            // console.log("response++++++++222222",response.data.state)
              if (response.data.state == 0) {
                Toast.fail(response.data.msg)
                 if(response.data.code == 600000008){
                   this.infor_visibility = true
                  }
                return false
              } else {
                if (this.org_id == 10340 || this.org_id == 3877 || this.org_id == 10164) {
                  this.getPatientSign()
                }

                var monitor = response.data.data.monitor
                // console.log('监测数据', monitor)
                var did_start = response.data.data.dialysis_order
                // console.log('did_start', did_start)
                this.$emit('did_add_monitor', monitor)
                this.$emit('did_start', did_start)
                var record = this.record
                // console.log('上机233223', response.data.data.dialysis_order)
                for (const key in response.data.data.dialysis_order) {
                  this.$set(record, key, response.data.data.dialysis_order[key])
                }
                Toast.success('上机成功')
              }
            }).catch((error) => {
              // console.log('error', error)
              Toast.fail('请求失败')
            })
        })
        }
      // }// console.log("paras",ParamsQuery)
    },
    modify() {
      if (this.bedId == 0) {
        Toast.fail("请选择床位号");
        return false;
      }
      let ParamsQuery = {};
      if (this.$store.getters.user.admin.id == this.record.creator) {
        ParamsQuery["mode"] = "2";
      } else {
        ParamsQuery["mode"] = "3";
      }
      ParamsQuery["schedual_type"] = this.schedual_type;
      ParamsQuery["id"] = this.record.id;
      ParamsQuery["start_nurse"] = this.start_nurse;
      ParamsQuery["bed"] = this.bed_id;
      ParamsQuery["start_time"] = this.start_time_str;
      ParamsQuery["puncture_nurse"] = this.puncture_nurse;
      ParamsQuery["washpipe_nurse"] = this.washpipe_nurse;
      ParamsQuery["change_nurse"] = this.change_nurse;
      ParamsQuery["difficult_puncture_nurse"] = this.difficult_puncture_nurse;
      ParamsQuery["new_fistula_nurse"] = this.new_fistula_nurse;
      ParamsQuery["quality_nurse_id"] = this.quality_nurse; //quality_nurse_id
      ParamsQuery["patient_id"] = this.$route.query.patient_id;
      ParamsQuery["record_date"] = this.$route.query.date;
      ParamsQuery["puncture_needle"] = this.puncture_needle;
      ParamsQuery["puncture_way"] = this.puncture_way;
      ParamsQuery["dialysis_dialyszers"] = this.dialysis_dialyszers;
      ParamsQuery["dialysis_irrigation"] = this.dialysis_irrigation;
      ParamsQuery["blood_access_part_opera_id"] = this.blood_access_part_opera_id;
      ParamsQuery["nuclein_date_str"] = this.nuclein_date_str;
      ParamsQuery["order_remark"] = this.order_remark;
      ParamsQuery['catheter_operation'] = this.catheter_operation
      ParamsQuery["schedule_remark"] = this.schedule_remark;
      ParamsQuery["blood_flow_volume"] = this.blood_flow_volume
      ParamsQuery["blood_drawing"] = this.blood_drawing
      ParamsQuery["dialysis_strainer"] = this.dialysis_strainer
      // console.log("ParamsQuery", ParamsQuery);
  
      PostModifyStartDialysis(ParamsQuery)
        .then((response) => {
          if (response.data.state == 0) {
            Toast.fail(response.data.msg);
             if(response.data.code == 600000008){
                this.infor_visibility = true
              }
            return false;
          } else {
            Toast.success("修改成功");
            // console.log("修改", response.data.data.dialysis_order);
            this.$emit("did_start", response.data.data.dialysis_order);
            var record = this.record;
            // console.log("record", this.record);
            for (const key in response.data.data.dialysis_order) {
              this.$set(record, key, response.data.data.dialysis_order[key]);
            }
          }
        })
        .catch((error) => {
          Toast.fail("请求失败");
        });
    },
    getTimeOne(time) {
      return uParseTime(time, "{y}-{m}-{d}");
    },
    // 电子签名
    getPatientSign() {

      var params = {
        patient_id: this.$route.query.patient_id,
        dialysis_date: this.$route.query.date,
      };
      getPatientSign(params).then((response) => {
        if (response.data.state == 1) {
          this.electronicsignature = response.data.data.dialysisOrder.url;
          // console.log("electronicsignature", this.electronicsignature);
          this.showpan = "image";
        } else {
          this.showpan = "canvas";
        }
      });
    },
    getToken() {
      getToken().then((response) => {
        if (response.data.state == 1) {
          this.uptoken = response.data.data.uptoken;
        }
      });
    },
    cropImage(event) {
      var dataurl = this.$refs.cropper.getCroppedCanvas();
      var rectImage = dataurl.toDataURL("image/png");
      this.uploadImgUrl = rectImage;
    },
    isPc() {
      const userAgentInfo = navigator.userAgent;
      const Agents = [
        "Android",
        "iPhone",
        "SymbianOS",
        "Windows Phone",
        "iPad",
        "iPod",
      ];
      let flag = true;
      for (let v = 0; v < Agents.length; v++) {
        if (userAgentInfo.indexOf(Agents[v]) > 0) {
          flag = false;
          break;
        }
      }
      return flag;
    },
    removeImg(src) {
      this.imgUrl = "";
    },
    initDraw() {
      const canvas_fa = document.querySelector(".canvas_fa");
      var divWidth = canvas_fa.clientWidth;
      var divHeight = canvas_fa.clientHeight;
      const preData = this.context.getImageData(
        0,
        0,
        divWidth * 1.3,
        divHeight * 1.1
      );

      // 空绘图表面进栈
      this.middleAry.push(preData);
    },
    canvasMove(e) {
      e.preventDefault();
      if (this.canvasMoveUse) {
        const t = e.target;
        let canvasX;
        let canvasY;
        if (this.isPc()) {
          canvasX = e.clientX - t.parentNode.offsetLeft;
          canvasY = e.clientY - t.parentNode.offsetTop;
        } else {
          canvasX = e.changedTouches[0].clientX - t.parentNode.offsetLeft;
          canvasY = e.changedTouches[0].clientY - t.parentNode.offsetTop;
        }
        this.context.lineTo(canvasX, canvasY);
        this.context.stroke();
      }
    },
    beginPath(e) {
      const canvas = document.querySelector("#canvas");
      if (e.target !== canvas) {
        this.context.beginPath();
      }
    },
    // mouseup
    canvasUp(e) {
      const preData = this.context.getImageData(0, 0, 600, 400);
      if (!this.nextDrawAry.length) {
        // 当前绘图表面进栈
        this.middleAry.push(preData);
      } else {
        this.middleAry = [];
        this.middleAry = this.middleAry.concat(this.preDrawAry);
        this.middleAry.push(preData);
        this.nextDrawAry = [];
      }
      this.canvasMoveUse = false;
      this.nobeginAction = false;
    },
    // mousedown
    canvasDown(e) {
      this.canvasMoveUse = true;
      this.nobeginAction = false;
      // client是基于整个页面的坐标
      // offset是cavas距离顶部以及左边的距离
      const canvasX = e.clientX - e.target.parentNode.offsetLeft;
      const canvasY = e.clientY - e.target.parentNode.offsetTop;

      this.setCanvasStyle();
      // 清除子路径
      this.context.beginPath();
      this.context.moveTo(canvasX, canvasY);
      // 当前绘图表面状态
      const preData = this.context.getImageData(0, 0, 600, 400);
      // 当前绘图表面进栈
      this.preDrawAry.push(preData);
    },
    // 设置颜色
    setColor(color) {
      this.config.lineColor = color;
    },
    // 设置笔刷大小
    setBrush(type) {
      this.config.lineWidth = type;
    },

    // 操作
    clearCanvas() {
      this.dialogVisible = true;
      this.$nextTick(() => {
        const canvas = document.querySelector("#canvas");
        const canvas_fa = document.querySelector(".canvas_fa");
        this.context = canvas.getContext("2d");
        this.context.fillStyle = this.config.fillStyle;
        var divWidth = canvas_fa.clientWidth;
        var divHeight = canvas_fa.clientHeight;

        if (divWidth >= 550 && divWidth <= 600) {

          this.context.canvas.width = divWidth * 0.5;
          this.context.canvas.height = divHeight * 2.1;
        }
        if (divWidth > 600 && divWidth <= 800) {

          this.context.canvas.width = divWidth * 0.95;
          this.context.canvas.height = divHeight * 1.6;
        }
        if (divWidth > 800 && divWidth <= 1240) {
          this.context.canvas.width = divWidth * 1.32;
          this.context.canvas.height = divHeight * 1.6;
        }

        this.context.fillRect(
          0,
          0,
          this.context.canvas.width,
          this.context.canvas.height
        );
        this.initDraw();
        this.setCanvasStyle();

        this.context.clearRect(
          0,
          0,
          this.context.canvas.width,
          this.context.canvas.height
        );

        this.context.fillStyle = this.config.fillStyle;
        this.context.fillRect(
          0,
          0,
          this.context.canvas.width,
          this.context.canvas.height
        );

        this.preDrawAry = [];
        this.nextDrawAry = [];
        this.middleAry = [this.middleAry[0]];
        this.nobeginAction = true;
        this.showpan = "canvas";
      });
    },

    getImageAction() {
      this.getImage();
      this.centerDialogVisible = true;

      if (typeof this.$refs.cropper !== "undefined") {
        this.$refs.cropper.replace(this.imgUrl);
      }
    },
    uploadImage() {
      var dataurl = this.$refs.cropper.getCroppedCanvas();
      var rectImage = dataurl.toDataURL("image/png");
      this.uploadImgUrl = rectImage;

      if (typeof this.uploadImgUrl === "undefined") {
        Toast.fail("获取截图资源失败");
        return false;
      }
      if (this.uptoken == "") {
        Toast.fail("七牛上传token无效，无法上传");
        return false;
      }

      this.loading = true;
      var _this = this;
      var pic = this.uploadImgUrl.split(",")[1];
      var url = "https://upload.qiniup.com/putb64/-1";
      var xhr = new XMLHttpRequest();
      // eslint-disable-next-line camelcase
      var patient_id = this.$route.query.patient_id;
      var date = this.$route.query.date;
      xhr.onreadystatechange = function () {
        if (xhr.readyState == 4) {
          var returnData = JSON.parse(xhr.responseText);
          // console.log("returnData", returnData);
          savePatientSign(returnData, patient_id, date).then((response) => {
            if (response.data.state == 1) {

              _this.electronicsignature =
                response.data.data.electronic_signature.url;
              _this.showpan = "image";
              _this.nobeginAction = true;
              _this.centerDialogVisible = false;
              Toast.success("成功");
              // _this.$router.push({path: "/my"})
            } else {
              Toast.fail("保存图片时失败");
            }
          });
          _this.loading = false;
        }
      };
      xhr.open("POST", url, true);
      xhr.setRequestHeader("Content-Type", "application/octet-stream");
      xhr.setRequestHeader("Authorization", "UpToken " + _this.uptoken);
      xhr.send(pic);
    },
    // 生成图片
    getImage() {
      const canvas = document.querySelector("#canvas");
      const src = canvas.toDataURL("image/png");
      this.imgUrl = src;
    },
    // 设置绘画配置
    setCanvasStyle() {
      this.context.lineWidth = this.config.lineWidth;
      this.context.shadowBlur = this.config.shadowBlur;
      this.context.shadowColor = this.config.lineColor;
      this.context.strokeStyle = this.config.lineColor;
    },
    selectType() {
      let ParamsQuery = {};
      ParamsQuery["schedual_type"] = this.schedual_type;
      ParamsQuery["record_date"] = this.$route.query.date;
      GetSchedualNumber(ParamsQuery).then((response) => {
        if (response.data.state == 0) {
          Toast.fail(response.data.msg);
          return false;
        } else {
          this.temp_device_numbers = response.data.data.number;
          var zonelist = response.data.data.list;
          this.zoneList = zonelist;
          for (
            let index = 0;
            index < this.temp_device_numbers.length;
            index++
          ) {
            const device_number = this.temp_device_numbers[index];
            this.temp_device_numbers[index]["zoneNumber"] =
              device_number["zone_name"] + "-" + device_number["number"];
          }
          this.zone_beds = this.temp_device_numbers;

          let number = response.data.data.number;
          this.zonebedNumber = number;
          let zoneData = [];
          let bedData = [];
          number.map((item) => {
            let status = zoneData.some(
              (it) =>
                it["zone_id"] == item["zone_id"] &&
                it["zone_name"] == item["zone_name"]
            );
            if (!status) {
              let obj = {
                zone_id: "",
                zone_name: "",
              };
              obj.zone_id = item.zone_id;
              obj.zone_name = item.zone_name;
              zoneData.push(obj);
            }
          });
          this.zoneData = zoneData;

          number.map((item) => {
            if (
              this.device_number_map[this.bed_id].zone_id == item.zone_id &&
              this.device_number_map[this.bed_id].zone_name == item.zone_name
            ) {
              bedData.push(item);
              this.zoneId = this.device_number_map[this.bed_id].zone_id;
            }
          });
          this.bedId = this.device_number_map[this.bed_id].id;
          this.bedData = bedData;
        }
      });
    },
    GetSchedualNumber: function () {
      let ParamsQuery = {};
      ParamsQuery["schedual_type"] = this.schedual_type;
      ParamsQuery["record_date"] = this.$route.query.date;
 
      GetSchedualNumber(ParamsQuery).then((response) => {
        if (response.data.state == 0) {
          Toast.fail(response.data.msg);
          return false;
        } else {
          this.temp_device_numbers = response.data.data.number;
          var zonelist = response.data.data.list;

          this.zoneList = zonelist;
          for (
            let index = 0;
            index < this.temp_device_numbers.length;
            index++
          ) {
            const device_number = this.temp_device_numbers[index];
            this.temp_device_numbers[index]["zoneNumber"] =
              device_number["zone_name"] + "-" + device_number["number"];
          }
          this.zone_beds = this.temp_device_numbers;

          let number = response.data.data.number;

          this.zonebedNumber = number;
          let zoneData = [];
          let bedData = [];

          number.map((item) => {
            let status = zoneData.some(
              (it) =>
                it["zone_id"] == item["zone_id"] &&
                it["zone_name"] == item["zone_name"]
            );
            if (!status) {
              let obj = {
                zone_id: "",
                zone_name: "",
              };
              obj.zone_id = item.zone_id;
              obj.zone_name = item.zone_name;
              zoneData.push(obj);
            }
          });

          this.zoneData = zoneData;

          number.map((item) => {
            if (
              this.device_number_map[this.bed_id].zone_id == item.zone_id &&
              this.device_number_map[this.bed_id].zone_name == item.zone_name
            ) {
              bedData.push(item);
              this.zoneId = this.device_number_map[this.bed_id].zone_id;
            }
          });
          this.bedId = this.device_number_map[this.bed_id].id;
          this.bedData = bedData;
        }
      });
    },
    selectStartTimeAction() {
      if (this.record.id != 0) {
        var creator = 0;
        if (this.record.creator == 0) {
          creator = this.record.start_nurse;
        } else {
          creator = this.record.creator;
        }

        this.$refs.start_time_picker.open();
      }
      this.$refs.start_time_picker.open();
    },
    didSelectStartTime: function (time) {
      this.start_time_str = parseTime(time, "{y}-{m}-{d} {h}:{i}") + ":00";
    },
    selectNucleinDateAction() {
      if (this.record.id != 0) {
        var creator = 0;
        if (this.record.creator == 0) {
          creator = this.record.start_nurse;
        } else {
          creator = this.record.creator;
        }

        this.$refs.nuclein_date_picker.open();
      }
      this.$refs.nuclein_date_picker.open();
    },
    didNucleinDateTime: function (time) {
      this.nuclein_date_str = parseTime(time, "{y}-{m}-{d}");
    },
    changeBed(obj) {

      this.temp_device_numbers.map((item, index) => {
        if (item.id == obj) {
          this.bed_id = obj;
          this.bedId = obj;
        }
      });
    },
    changeZone(zone_id) {
      let zone_name = "";
      this.zoneData.map((item) => {
        if (item.zone_id == zone_id) {
          zone_name = item.zone_name;
        }
      });
      this.zoneId = zone_id;
      let bedData = [];
      this.zonebedNumber.map((item) => {
        if (zone_id == item.zone_id && zone_name == item.zone_name) {
          bedData.push(item);
        }
      });
      this.bedData = bedData;
      this.bedId = 0;
    },
    getSchedualType: function (type) {
      for (let i = 0; i < this.schedules_type.length; i++) {
        if (this.schedules_type[i].id == type) {
          return this.schedules_type[i].name;
        }
      }
    },
    getPermission() {
      request
        .get("/m/api/permission/get", {
          params: {
            create_url: "/m/api/dialysis/start?mode=1",
            modify_url: "/m/api/startOrder/edit?mode=2",
            modify_other_url: "/m/api/startOrder/edit?mode=3",
            module: 0,
          },
        })
        .then((res) => {

          if (res.data.state == 0) {
            this.hasPermission = false;
          } else if (res.data.state == 1) {
            if (this.record.id != "" && this.record.creator != 0) {
              // 有数据
              if (this.record.creator == this.$store.getters.user.admin.id) {
                // 创建人是自己
                if (res.data.data.is_has_modify == false) {
                  this.hasPermission = false;
                  this.showTxt = "你没有修改执行上机权限";
                }
              } else {
                // 创建人不是自己
                if (res.data.data.is_has_modify_other == false) {
                  this.hasPermission = false;
                  this.showTxt = "你没有修改他人执行上机权限";
                }
              }
            } else if (this.record.id == "" || this.record.creator == 0) {
              if (res.data.data.is_has_create == false) {
                this.hasPermission = false;
                this.showTxt = "你没有执行上机权限";
              }
            }
          }
        });
    },
    getBedId(id) {
      var zone_name = "";
      for (let i = 0; i < this.zoneList.length; i++) {
        if (id == this.zoneList[i].id) {
          zone_name = this.zoneList[i].zone.name;
        }
      }
      return zone_name;
    },
    toPatientSign() {
      this.$router.push({
        path:
          "/patient_sign?patient_id=" +
          this.patient_id +
          "&record_time=" +
          this.record_time,
      });
    },
    showSubMenu: function (val) {

      this.checkBoxShow = true;
      switch (val) {
        case "puncture_needle":
          this.propForm.type = 18;
          this.isShowDialog = false;
          this.propForm.title = "穿刺针";
          this.visibility = true;
          this.propForm.result = [];
          this.propForm.isHasOther = 2;
          this.propForm.isShowOther = 1;
          this.propForm.list = this.punctureNeedleOptions;
          this.propForm.optionList = [];
          this.propForm.isMultiple = 2;
          if (
            this.puncture_needle != undefined ||
            this.puncture_needle != null
          ) {
            if (this.puncture_needle.length > 0) {
              this.propForm.result = this.puncture_needle.split(",");
            } else {
              this.propForm.result = [];
            }
          } else {
            this.propForm.result = [];
          }
          this.propForm.click_ref = "puncture_needle";

          break;

        case "puncture_way":
          this.propForm.result = [];
          this.isHasOther = 2;
          this.propForm.isShowOther = 1;

          this.propForm.type = 26;
          this.isShowDialog = false;
          this.propForm.title = "穿刺方式";
          this.visibility = true;
          this.propForm.list = getDataConfig("hemodialysis", "puncture_method");
          this.propForm.optionList = [];
          this.propForm.isMultiple = 2;
          if (this.puncture_way != undefined || this.puncture_way != null) {
            if (this.puncture_way.length > 0) {
              this.propForm.result = this.puncture_way.split(",");
            } else {
              this.propForm.result = [];
            }
          } else {
            this.propForm.result = [];
          }
          this.propForm.click_ref = "puncture_way";
          break;

        case "dialysis_dialyszers":
          for (let i = 0; i < this.dialysisDialyszers.length; i++) {
            this.dialysisDialyszers[i].name =
              this.dialysisDialyszers[i].specification_name;
          }
          this.propForm.type = 14;
          this.isShowDialog = false;
          this.propForm.title = "透析器";
          this.visibility = true;
          this.propForm.result = [];
          this.propForm.isHasOther = 2;
          this.propForm.isShowOther = 1;
          this.propForm.list = this.dialysisDialyszers;
          this.propForm.optionList = [];
          this.propForm.isMultiple = 2;
          var apparatus = this.dialysis_dialyszers.split(",");

          var newArr = [];
          for (let i = 0; i < this.dialysisDialyszers.length; i++) {
            for (let j = 0; j < apparatus.length; j++) {
              var name = this.dialysisDialyszers[i].name.toUpperCase();
              var app = apparatus[j].toUpperCase();
              if (name == app) {
                newArr.push(this.dialysisDialyszers[i].name);
              }
            }
          }

          if (
            this.dialysis_dialyszers != undefined ||
            this.dialysis_dialyszers != null
          ) {
            if (this.dialysis_dialyszers.length > 0) {
              this.propForm.result = newArr;
            } else {
              this.propForm.result = [];
            }
          } else {
            this.propForm.result = [];
          }
          this.propForm.click_ref = "dialysis_dialyszers";
          break;

        case "dialysis_irrigation":
          for (let i = 0; i < this.dialysisIrrigation.length; i++) {
            this.dialysisIrrigation[i].name =
              this.dialysisIrrigation[i].specification_name;
          }

          this.propForm.type = 15;
          this.isShowDialog = false;
          this.propForm.title = "灌流器";
          this.visibility = true;
          this.propForm.result = [];
          this.propForm.isHasOther = 2;
          this.propForm.isShowOther = 1;
          this.propForm.list = this.dialysisIrrigation;
          this.propForm.optionList = [];
          this.propForm.isMultiple = 2;

          var apps = this.dialysis_irrigation.split(",");

          var newArr = [];
          for (let i = 0; i < this.dialysisIrrigation.length; i++) {
            for (let j = 0; j < apps.length; j++) {
              var name = this.dialysisIrrigation[i].name.toUpperCase();
              var app = apps[j].toUpperCase();
              if (name == app) {
                newArr.push(this.dialysisIrrigation[i].name);
              }
            }
          }

          if (
            this.dialysis_irrigation != undefined ||
            this.dialysis_irrigation != null
          ) {
            if (this.dialysis_irrigation.length > 0) {
            } else {
              this.propForm.result = [];
            }
          } else {
            this.propForm.result = [];
          }
          this.propForm.result = newArr;
          this.propForm.click_ref = "dialysis_irrigation";
          break;


         case "dialysis_strainer":
          for (let i = 0; i < this.dialysisStrainerList.length; i++) {
            this.dialysisStrainerList[i].name =
              this.dialysisStrainerList[i].specification_name;
          }

          this.propForm.type = 19;
          this.isShowDialog = false;
          this.propForm.title = "血滤器";
          this.visibility = true;
          this.propForm.result = [];
          this.propForm.isHasOther = 2;
          this.propForm.isShowOther = 1;
          this.propForm.list = this.dialysisStrainerList;
          this.propForm.optionList = [];
          this.propForm.isMultiple = 2;

          var apps = this.dialysis_strainer.split(",");

          var newArr = [];
          for (let i = 0; i < this.dialysisStrainerList.length; i++) {
            for (let j = 0; j < apps.length; j++) {
              var name = this.dialysisStrainerList[i].name.toUpperCase();
              var app = apps[j].toUpperCase();
              if (name == app) {
                newArr.push(this.dialysisStrainerList[i].name);
              }
            }
          }

          if (
            this.dialysis_strainer != undefined ||
            this.dialysis_strainer != null
          ) {
            if (this.dialysis_strainer.length > 0) {
            } else {
              this.propForm.result = [];
            }
          } else {
            this.propForm.result = [];
          }
          this.propForm.result = newArr;
          this.propForm.click_ref = "dialysis_strainer";
          break; 

        case "blood_access_part_opera_id":
          this.propForm.type = 10;
          this.isShowDialog = false;
          this.propForm.title = "血管通路";
          this.visibility = true;
          this.propForm.list = [];
          this.propForm.optionList = this.bloodAccessOptions;
          this.propForm.isMultiple = 1;
          this.propForm.selectId = this.blood_access;
          this.propForm.click_ref = "blood_access";
          break;
      }
    },
    getBloodAccessTwo: function (val) {
      let blood_access_name = ''
      for (let i = 0; i < this.bloodAccessOptions.length; i++) {
        if (val == this.bloodAccessOptions[i].id) {
          blood_access_name = this.bloodAccessOptions[i].name
        }
      }

      this.blood_access_name = blood_access_name
      return blood_access_name
    },
    getString(val) {
      switch (val.type) {
        case 18:
          this.puncture_needle = val.result.join(",");
          break;
        case 26:
          this.puncture_way = val.result.join(",");
          break;
        case 10:
          this.blood_access_part_opera_id = val.result.join(",");
          break;
      }
    },
    inputFocus(){

    },
    menuComfirmFour:function(start_time,remark){
       var params = {
         patient_id:this.$route.query.patient_id,
         record_date:this.$route.query.date,
         start_time:start_time,
         module:6,
         remark:remark,
       }
      
      saveMobileInformation(params).then(response=>{
        if(response.data.state == 1){
           this.infor_visibility = false
           Toast.success('申请成功')
        }
      })
    },
    menuCancleFour:function(){
     this.infor_visibility = false
    
    },
    toSummary (val) {
      if (val >= 0) {
        this.summary.map(item => {
          if (item.id == val) {
            var theValue = item.value
            this.dialysisSummarySelectChange(theValue)
          }
        })
      }
      this.summaryShow = false
    },
    dialysisSummarySelectChange: function (values) {

      this.catheter_operation_id = values
      if (this.catheter_operation == null) {
        this.catheter_operation == ''
      }

      if (this.catheter_operation == '') {
        this.catheter_operation = values
      } else {
        if (this.catheter_operation.indexOf(values) == -1) {
          if (
            this.catheter_operation
              .charAt(this.catheter_operation.length - 1)
              .indexOf('。') == -1
          ) {
            this.catheter_operation =
                    this.catheter_operation + ',' + values
          } else {
            this.catheter_operation = this.catheter_operation + values
          }
        }
      }
    },
    changeOne(val){

     if(val!=-2 && val!=11 && val!=37 && val!=15 && val!=1){
        this.catheter_operation ="予换药，置管处无渗液，无红肿，无特殊"
     }
     if(val==-2 || val==11 || val==37 || val==15 || val==1){
       this.catheter_operation = ""
     }
   }
  },
  watch: {

    "record.id": function (val) {
      if (val > 0) {
        if (this.record.creator == 0) {
          this.creator = this.record.start_nurse;
        } else {
          this.creator = this.record.creator;
        }


      }
    
    },
    schedual_type: {
      handler(newVal, oldVal) {

      },
    },
  },
};
</script>

<style lang="scss" scoped>
.perform {
  text-align: center;
  font-size: 0.3rem;
  padding-top: 2rem;
  .crew {
    color: $pgh-color;
  }
  button {
    background: $main-color;
    color: #fff;
    font-size: 0.45rem;
    text-align: center;
    width: 3rem;
    height: 1.2rem;
    line-height: 1.2rem;
    border-radius: 4px;
    margin-top: 10px;
  }
}
.computer {
  display: flex;
  flex-direction: column;
  height: 100%;
  > :first-child {
    flex: 1;
    overflow-y: auto;
  }
}
.van-radio-group {
  display: flex;
  flex-wrap: wrap;
  .van-radio {
    width: 50%;
    margin-bottom: 0.625rem;
  }
}
.imagename {
  width: 40%;
  margin: 0 auto;
  text-align: center;
  padding: 10px 0;
  min-height: 200px;
  overflow-x: hidden;
  background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA3NCSVQICAjb4U/gAAAABlBMVEXMzMz////TjRV2AAAACXBIWXMAAArrAAAK6wGCiw1aAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAABFJREFUCJlj+M/AgBVhF/0PAH6/D/HkDxOGAAAAAElFTkSuQmCC");
  img {
    width: 100%;
  }
}
.information {
  width: 100%;
  margin: 0 auto;
  .imagename {
    width: 40%;
    margin: 0 auto;
    text-align: center;
    padding: 10px 0;
    min-height: 200px;
    overflow-x: hidden;
    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA3NCSVQICAjb4U/gAAAABlBMVEXMzMz////TjRV2AAAACXBIWXMAAArrAAAK6wGCiw1aAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAABFJREFUCJlj+M/AgBVhF/0PAH6/D/HkDxOGAAAAAElFTkSuQmCC");
    img {
      width: 100%;
    }
  }
  .name {
    background: #fff;
    width: 100%;
    height: 220px;
    margin: 0 auto;
    border-radius: 4px;
    overflow: hidden;
    // @media only screen and (max-width: 812px) {
    //   width: 500px !important;
    //   height: 200px !important;
    // }
    .item {
      padding: 0.37rem 0.4rem;
      @include align-items-center;
      @include display-flex;
      @include justify-content-between;
      @include text-align;
      height: 500px;
      .tx {
        @include display-flex;
        @include align-items-center;
        @include text-align;
        img {
          width: 1.24rem;
          height: 1.24rem;
          border-radius: 50%;
          display: inline-block;
          margin-right: 0.26rem;
        }
      }
    }
    h2 {
      color: #34495e;
      font-size: 0.34rem;
    }
  }
  .set {
    width: 70%;
    margin: 0 auto;
    border-radius: 4px;
    margin-top: 0.6rem;
    text-align: center;
  }
}
.fl {
  @media only screen and (max-width: 500px) {
    width: 17.35rem !important;
    height: 26rem !important;
  }
  @media only screen and (min-width: 768px) {
    width: 37rem !important;
    height: 20rem !important;
  }

  @media only screen and (min-width: 1024px) {
    width: 37.35rem !important;
    height: 26rem !important;
  }
  @media only screen and (max-width: 768px) and (min-height: 1024px) {
    width: 27.35rem !important;
    height: 26rem !important;
  }

  @media only screen and (max-width: 820px) and (min-height: 1180px) {
    width: 29.35rem !important;
    height: 26rem !important;
  }

  @media only screen and (max-width: 1180px) and (min-height: 820px) {
    width: 43.35rem !important;
    height: 26rem !important;
  }
  @media only screen and (max-width: 1024px) and (min-height: 1366px) {
    width: 37.35rem !important;
    height: 26rem !important;
  }
  @media only screen and (width: 1366px) and (min-height: 1024px) {
    width: 50.35rem !important;
    height: 26rem !important;
  }
  @media only screen and (width: 820px) and (max-height: 1180px) {
    width: 29.35rem !important;
    height: 26rem !important;
  }
  @media only screen and (max-width: 768px) and (max-height: 1024px) {
    width: 27.35rem !important;
    height: 26rem !important;
  }
  @media only screen and (max-width: 414px) {
    width: 18.35rem !important;
    height: 26rem !important;
  }
  @media only screen and (max-width: 375px) {
    width: 16.35rem !important;
    height: 26rem !important;
  }
}
.mainBox {
  height: 100%;
  display: flex;
  overflow: hidden;
  flex-direction: column;
  > :first-child {
    flex: 1;
    overflow-y: auto;
  }
}
.preserveBox {
  height: 3.125rem;
  display: flex;
  justify-content: space-around;
  padding: 0 1rem;
  align-items: center;
  font-size: 1rem;
  .isComputer {
    width: 100%;
  }
  > div {
    text-align: center;
    height: 2.5rem;
    width: 48%;
    line-height: 2.5rem;
    background: #409eff;
    color: #fff;
    border-radius: 4px;
  }
  .unPlane {
    background-color: lightgray;
  }
}
.warnTxt {
  font-size: 1rem;
  height: 1.875rem;
  line-height: 1.875rem;
  text-align: center;
  background: #faa331;
  color: #fff;
}
.newBorder {
  border-bottom: 0.0625rem solid #ebedf0;
}
.warn_tip{
  color: red;
}
</style>

<style lang="scss">
.computer {
  .datetimePicker {
    z-index: 4010 !important;
    .picker-item {
      font-size: 0.875rem !important;
      height: 44px;
      line-height: 44px;
    }
    .mint-datetime-action {
      font-size: 0.9375rem !important;
    }
  }
}
</style>
<style lang="scss">
.newStyle {
  .el-button {
    @media only screen and (min-width: 768px) {
      padding: 22px 42px;
      font-size: 0.45rem;
      // height: 0;
    }
  }
}

.signal_name {
  @media only screen and (max-width: 500px) {
    font-size: 0.9375rem;
  }
  @media only screen and (min-width: 768px) {
    font-size: 0.9375rem;
  }
}

.myInfo1 {
  width: 100%;
  height: 3.125rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.875rem;
  background: #fff;
  .myInfoLeft {
    display: flex;
    align-items: center;
    height: 100%;
    img {
      width: 1.125rem;
      height: 1.125rem;
      margin-right: 0.5rem;
      border-radius: 50%;
    }
    p {
      margin-top: 0.125rem;
      font-size: 1rem;
      color: #323233;
    }
  }
  .arrow {
    font-size: 1rem;
    color: #9f9f9f;
  }
}

.bgField{
        .van-field__control{
            border:1px solid #ccc;
            background: #f6f6f6;
            border-radius: 4px;
            min-height: 6.25rem !important;
        }
        ::placeholder{  //通过这个设置
            color: #999 !important;
        }
    }
</style>
