<template>
  <div class="plane">
    <div>
      <div class="warnTxt" v-if="showTxt != ''">
        {{ showTxt }}
      </div>
      <van-collapse v-model="activeNames" accordion @change="showSubMenu">
        <van-collapse-item
          title="下机护士"
          name="1"
          style="border: 1px solid #e5e5e5"
        >
          <template slot="title">
            <div>
              <span v-if="isShow_title('下机护士')" class="warn_tip">*</span
              >下机护士
            </div>
          </template>
          <template #value>
            <div v-if="admin_map[nurse_id]">
              {{ nurse_id == 0 ? "" : admin_map[nurse_id].name }}
            </div>
          </template>
          <van-radio-group v-model="nurse_id">
            <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-field
          v-model="end_time_str"
          readonly
          @click="selectStartTimeAction"
          label="下机时间"
          input-align="right"
          :required="isShow_title('下机时间')"
        />

        <van-collapse-item
          v-if="isShow('穿刺处血肿')"
          title="穿刺处血肿"
          name="0"
        >
          <template slot="title">
            <div>
              <span v-if="isShow_title('穿刺处血肿')" class="warn_tip">*</span
              >穿刺处血肿
            </div>
          </template>
          <template #value>
            <span
              v-if="formValue.puncture_point_haematoma == 0"
              class="text"
              style="width: 50px"
            ></span>
            <span
              v-if="formValue.puncture_point_haematoma == 1"
              class="text"
              style="width: 50px"
              >有</span
            >
            <span
              v-if="formValue.puncture_point_haematoma == 2"
              class="text"
              style="width: 50px"
              >无</span
            >
          </template>
          <van-radio-group v-model="formValue.puncture_point_haematoma">
            <van-radio name="" key="-2">请选择</van-radio>
            <van-radio :name="1">有</van-radio>
            <van-radio :name="2">无</van-radio>
          </van-radio-group>
        </van-collapse-item>
        <van-collapse-item
          v-if="isShow('内瘘')"
          title="内瘘"
          name="internal_fistula"
        >
          <template slot="title">
            <div>
              <span v-if="isShow_title('内瘘')" class="warn_tip">*</span>内瘘
            </div>
          </template>
          <template #value>
            <div>{{ formValue.internal_fistula }}</div>
          </template>
          <checkBoxMenu
            v-if="checkBoxShow"
            v-on:menu-comfirm="getString"
            :propsForm="propForm"
          ></checkBoxMenu>
        </van-collapse-item>
        <van-collapse-item v-if="isShow('导管')" title="导管" name="catheter">
          <template slot="title">
            <div>
              <span v-if="isShow_title('导管')" class="warn_tip">*</span>导管
            </div>
          </template>
          <template #value>
            <div>{{ formValue.catheter }}</div>
          </template>
          <checkBoxMenu
            v-if="checkBoxShow"
            v-on:menu-comfirm="getString"
            :propsForm="propForm"
          ></checkBoxMenu>
        </van-collapse-item>
        <van-collapse-item
          v-if="isShow('透析器凝血')"
          title="透析器凝血"
          name="cruor"
        >
          <template slot="title">
            <div>
              <span v-if="isShow_title('透析器凝血')" class="warn_tip">*</span
              >透析器凝血
            </div>
          </template>
          <template #value>
            <div>{{ formValue.cruor }}</div>
          </template>
          <checkBoxMenu
            v-if="checkBoxShow"
            v-on:menu-comfirm="getString"
            :propsForm="propForm"
          ></checkBoxMenu>
        </van-collapse-item>

        <van-collapse-item
          v-if="isShow('灌流器凝血')"
          title="灌流器凝血"
          name="condenser"
        >
          <template slot="title">
            <div>
              <span v-if="isShow_title('灌流器凝血')" class="warn_tip">*</span
              >灌流器凝血
            </div>
          </template>
          <template #value>
            <div>{{ formValue.condenser }}</div>
          </template>
          <checkBoxMenu
            v-if="checkBoxShow"
            v-on:menu-comfirm="getString"
            :propsForm="propForm"
          ></checkBoxMenu>
        </van-collapse-item>

        <van-cell
          title="宣教知识"
          v-if="isShow('宣教知识')"
          @click="teachShow = true"
          is-link
          value="请选择"
          :required="isShow_title('宣教知识')"
        ></van-cell>
        <van-popup
          v-model="teachShow"
          get-container="#app"
          class="listBoxPopup newListBoxPopupApp"
          style="z-index: 5000"
        >
          <div class="listBox">
            <div @click="toTeach('')">请选择</div>
            <div
              v-for="(item, index) in teach"
              :key="index"
              @click="toTeach(item.id)"
            >
              {{ item.text }}
            </div>
          </div>
        </van-popup>
        <van-field
          class="bgField"
          v-if="isShow('宣教知识')"
          v-model="formValue.mission"
          rows="1"
          autosize
          type="textarea"
          placeholder="请输入宣教知识"
          :required="isShow_title('宣教知识')"
        />
      </van-collapse>
    </div>
    <div class="preserveBox">
      <div
        @click="commitInfo"
        class="isPlane"
        v-show="record != null && record.id != '' && record.stage == 1"
      >
        执行下机
        <!--  -->
      </div>
      <div
        class="unPlane"
        v-show="record != null && record.id != '' && record.stage == 2"
      >
        已下机
      </div>
      <div class="unPlane isPlane" v-show="record == null || record.id == ''">
        未上机
      </div>
      <div
        @click="modify"
        v-if="record != null && record.id != '' && this.record.stage != 1"
      >
        修改下机
      </div>
    </div>
    <mt-datetime-picker
      class="datetimePicker"
      ref="start_time_picker"
      type="datetime"
      @confirm="didSelectStartTime"
      v-model="end_time"
    ></mt-datetime-picker>

   <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 { finish, PostModifyEndDialysis,saveMobileInformation } from "@/api/dialysis";
import { Toast } from "vant";
import { Dialog } from "vant";
import { parseTime } from "@/utils";
import request from "@/utils/request";
import { getDataConfig } from "@/utils/data";
import checkBoxMenu from "./components/checkBoxMenu";
import InforSubMenu from "../dialog/subMenu/InforSubMenu.vue"
import { type } from "os";
export default {
  components: {
    checkBoxMenu,
    InforSubMenu
  },
  props: {
    prescription_prop: {
      type: Object,
    },
    patient_prop: {
      type: Object,
    },
    record: {
      type: Object,
    },
    admins: {
      type: Array,
    },
    admin_map: {
      type: Object,
    },
    last_monitor_record: {
      type: Object,
    },
    last_order: {
      type: Object,
    },
    monitor_records:{
      type:Object
    }
  },
  data() {
    return {
      showTxt: "",
      activeNames: "",
      end_time_str: "",
      end_time: new Date(),
      nurse_id: 0,
      creator: 0,
      formValue: {
        puncture_point_haematoma: 0,
        internal_fistula: 0,
        catheter: "",
        cruor: "",
        mission: "",
        condenser:""
      },
      checkBoxShow: false,
      propForm: {
        title: "",
        list: [],
        optionList: [],
        isMultiple: 2,
        result: [], // 选中的值
        type: 1, // 用来区分不同子菜单，方便对返回值进行赋值
        selectId: 0,
        isHasOther: 1,
      },
      teachShow: false,
      teach: [],
      infor_visibility:false,
    };
  },
  created() {
    if(this.formValue.internal_fistula == ''){
      this.formValue.internal_fistula = "正常"
    }
    this.teach = getDataConfig("education", "education");
    this.getPermission();
    var date = this.$route.query && 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.teach = getDataConfig('education', 'education')
    this.getPermission()
    var date = this.$route.query && 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)

    if (this.record == null || this.record.id == "") {
      this.nurse_id = this.$store.getters.user.admin.id;
    } else if (this.record.stage == 1) {
      this.nurse_id = this.$store.getters.user.admin.id;
    } else {
      this.nurse_id = this.record.finish_nurse;
    }
   if (this.record == null || this.record.id == '') {
     this.nurse_id = this.$store.getters.user.admin.id

   } else if (this.record.stage == 1) {
     this.nurse_id = this.$store.getters.user.admin.id
   } else {
     this.nurse_id = this.record.finish_nurse
   }
    if (this.record == null || this.record.id == '') {
      this.nurse_id = this.$store.getters.user.admin.id

    } else if (this.record.stage == 1) {
      this.nurse_id = this.$store.getters.user.admin.id
    } else {
      this.nurse_id = this.record.finish_nurse
    }

    if (this.record.id > 0) {
      if (this.record.finish_creator == 0) {
        this.creator = this.record.finish_nurse;
      } else {
        this.creator = this.record.finish_creator;
        this.formValue.catheter = this.record.catheter;
        this.formValue.puncture_point_haematoma =this.record.puncture_point_haematoma;
        this.formValue.internal_fistula =this.record.blood_access_internal_fistula;
        this.formValue.cruor = this.record.cruor;
        this.formValue.mission = this.record.mission;
        this.formValue.condenser = this.record.condenser
      }
    }
    if (
      this.record != null &&
      this.last_order != null &&
      this.record.stage == 1
    ) {
      this.formValue.catheter = this.last_order.catheter;
      this.formValue.puncture_point_haematoma =
        this.last_order.puncture_point_haematoma;
      // this.formValue.internal_fistula = this.last_order.blood_access_internal_fistula
      this.formValue.internal_fistula = "正常"
      this.formValue.cruor = this.last_order.cruor;
      this.formValue.mission = this.last_order.mission;
      this.formValue.condenser = this.last_order.condenser

    
    }
  },
  mounted() {
    if (this.record.id == "") {
   if (this.record.id > 0) {
     if (this.record.finish_creator == 0) {
       this.creator = this.record.finish_nurse
     } else {
       this.creator = this.record.finish_creator
       this.formValue.catheter = this.record.catheter
       this.formValue.puncture_point_haematoma = this.record.puncture_point_haematoma
       this.formValue.internal_fistula = this.record.blood_access_internal_fistula
       this.formValue.cruor = this.record.cruor
       this.formValue.mission = this.record.mission


     }
   }
   if (this.record != null && this.last_order != null && this.record.stage == 1) {
     this.formValue.catheter = this.last_order.catheter
     // this.formValue.puncture_point_haematoma = this.last_order.puncture_point_haematoma
     this.formValue.internal_fistula = "正常"
     // this.formValue.cruor = this.last_order.cruor
     this.formValue.mission = this.last_order.mission
     
    }
   }
  },
  mounted () {
    if (this.record.id == '') {
      // 没有上下机记录
      this.end_time_str = parseTime(Date.parse(new Date()) / 1000, "{y}-{m}-{d} {h}:{i}") + ":00";
    } else {
      if (this.record.start_time > 0) {
        if (this.prescription_prop.id != "") {
          console.log("上机时间---------------------",this.record.start_time)
          let endTime = 0;
          endTime =this.record.start_time +this.prescription_prop.dialysis_duration_hour * 3600 + this.prescription_prop.dialysis_duration_minute * 60;
          this.end_time_str = parseTime(endTime, "{y}-{m}-{d} {h}:{i}") + ":00";
        } else {
          this.end_time_str =
            parseTime(Date.parse(new Date()) / 1000, "{y}-{m}-{d} {h}:{i}") +
            ":00";
        }
        if (this.record.end_time > 0) {
          this.end_time_str =
            parseTime(this.record.end_time, "{y}-{m}-{d} {h}:{i}") + ":00";
        }
      } else {
        this.end_time_str =
          parseTime(Date.parse(new Date()) / 1000, "{y}-{m}-{d} {h}:{i}") +
          ":00";
      }
    }
    this.end_time = this.end_time_str;

    if (this.$store.getters.user.template_info.org_id == 9671 || this.$store.getters.user.template_info.org_id == 10340) {
      console.log("hhhhhhhhhhhhhhhhhhhhhhhhwowowowo",this.monitor_records)
      if (this.monitor_records != null && this.monitor_records.length > 0) {
        this.end_time_str = parseTime(this.monitor_records[this.monitor_records.length - 1].operate_time,"{y}-{m}-{d} {h}:{i}") + ":00";
        console.log("下机时间",this.end_time_str)
      }
    }
  },  
  methods: {
    selectStartTimeAction: function () {
      if (this.record.id != 0) {
        if (this.record.end_time > 0) {
          this.$refs.start_time_picker.open();
        } else {
          this.$refs.start_time_picker.open();
        }
      } else {
        this.$refs.start_time_picker.open();
      }
    },
    didSelectStartTime: function (time) {
      this.end_time_str = parseTime(time, "{y}-{m}-{d} {h}:{i}") + ":00";
    },
    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 == 9 &&
            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}为必填字段，不能为空`)
        }
      }
    },
    commitInfo: function () {

        let ParamsQuery = {};
        ParamsQuery["record_date"] = this.record_date;
        ParamsQuery["nurse"] = this.nurse_id;
        ParamsQuery["end_time"] = this.end_time_str;
        ParamsQuery["mode"] = "1";
        ParamsQuery["patient"] = parseInt(this.$route.query.patient_id);
        ParamsQuery["puncture_point_haematoma"] = parseInt(
          this.formValue.puncture_point_haematoma
        );
        ParamsQuery["internal_fistula"] = this.formValue.internal_fistula;
        ParamsQuery["catheter"] = this.formValue.catheter;
        ParamsQuery["cruor"] = this.formValue.cruor;
        ParamsQuery["mission"] = this.formValue.mission;
        ParamsQuery["condenser"] = this.formValue.condenser
        // 必填弹窗开始
        // let ParamsQuery = this.doubleReview

        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] == "0") {
            // result.push(el);
            result.unshift(el)
          }
        });
        let warnarr = [];
        warnarr = this.getArrEqual(filedList, result);
        if (warnarr.length > 0) {
          this.open_tips(warnarr);
          // 必填弹窗结束
        } else {
          Toast.loading({ forbidClick: true, duration: 0 });
          finish(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 {
                let orgId = parseInt(sessionStorage.getItem("org_id"));

                Toast.success("下机成功");
                this.$emit("did_off", response.data.data.assessmentAfterDislysis);
                var record = this.record;
                for (const key in response.data.data.dialysisOrder) {
                  this.$set(record, key, response.data.data.dialysisOrder[key]);
                }
              }
            }).catch((err) => {
              Toast.fail("透前评估未保存!");
            });
        }

    },
    modify() {
      if (
        this.isWrite("穿刺处血肿") == true &&
        this.formValue.puncture_point_haematoma == ""
      ) {
        Toast.fail("请选择穿刺处血肿");
        return;
      }
      if (
        this.isWrite("内瘘") == true &&
        this.formValue.internal_fistula == ""
      ) {
        Toast.fail("请选择内瘘");
        return;
      }
      if (this.isWrite("导管") == true && this.formValue.catheter == "") {
        Toast.fail("请选择导管");
        return;
      }
      if (this.isWrite("透析器凝血") == true && this.formValue.cruor == "") {
        Toast.fail("请选择透析器凝血");
        return;
      }
      let ParamsQuery = {};
      ParamsQuery["id"] = this.record.id;
      ParamsQuery["nurse"] = this.nurse_id;
      ParamsQuery["end_time"] = this.end_time_str;
      ParamsQuery["mode"] = "2";
      ParamsQuery["puncture_point_haematoma"] = parseInt(
        this.formValue.puncture_point_haematoma
      );
      ParamsQuery["blood_access_internal_fistula"] =
        this.formValue.internal_fistula;
      ParamsQuery["catheter"] = this.formValue.catheter;
      ParamsQuery["cruor"] = this.formValue.cruor;
      ParamsQuery["mission"] = this.formValue.mission;
      ParamsQuery["condenser"]= this.formValue.condenser
      if (this.$store.getters.user.admin.id != this.record.finish_creator) {
        ParamsQuery["mode"] = "3";
      }
      // 必填弹窗开始
      // let ParamsQuery = this.doubleReview


      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] == "0") {
          result.push(el);
        }
      });
 
      let warnarr = [];
      warnarr = this.getArrEqual(filedList, result);
      if (warnarr.length > 0) {
        this.open_tips(warnarr);
        // 必填弹窗结束
      } else {
        PostModifyEndDialysis(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 {
              // console.log("上机", response.data.data.dialysis_order);
              Toast.success("修改成功");
              this.$emit("did_off", response.data.data.dialysis_order);
              var record = this.record;
              for (const key in response.data.data.dialysis_order) {
                this.$set(record, key, response.data.data.dialysis_order[key]);
              }
            }
          })
          .catch((err) => {
            Toast.fail(err);
          });
      }
    },
    getPermission() {
      request
        .get("/m/api/permission/get", {
          params: {
            create_url: "/m/api/dialysis/finish?mode=1",
            modify_url: "/m/api/finishOrder/edit?mode=2",
            modify_other_url: "/m/api/finishOrder/edit?mode=3",
            module: 6,
          },
        })
        .then((res) => {

          if (res.data.state == 0) {
            this.hasPermission = false;
          } else if (res.data.state == 1) {
            if (this.record.id != "" && this.record.finish_creator != 0) {
              // 有数据
              if (
                this.record.finish_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.finish_creator == 0
            ) {
              if (res.data.data.is_has_create == false) {
                this.hasPermission = false;
                this.showTxt = "你没有执行下机权限";
              }
            }
          }
        });
    },
    showSubMenu: function (val) {
      this.checkBoxShow = true;
      switch (val) {
        case "internal_fistula":
          this.propForm.type = 7;
          this.isShowDialog = false;
          this.propForm.title = "内瘘";
          this.visibility = true;
          this.propForm.list = [];
          this.propForm.list = getDataConfig(
            "hemodialysis",
            "internal_fistula"
          );

          this.propForm.optionList = [];
          this.propForm.isMultiple = 2;
          this.propForm.isHasOther = 2;

          if (
            this.formValue.internal_fistula != undefined ||
            this.formValue.internal_fistula != null
          ) {
            if (this.formValue.internal_fistula.length > 0) {
              this.propForm.result = this.formValue.internal_fistula.split(",");
            } else {
              this.propForm.result = [];
            }
          } else {
            this.propForm.result = [];
          }
          this.propForm.click_ref = "internal_fistula";
          break;
        case "catheter":
          this.propForm.type = 3;
          this.isShowDialog = false;
          this.propForm.title = "导管";
          this.visibility = true;
          this.propForm.isHasOther = 2;
          this.propForm.list = [];

          this.propForm.list = getDataConfig("hemodialysis", "catheter");
          this.propForm.optionList = [];
          this.propForm.isMultiple = 2;
          if (
            this.formValue.catheter != undefined ||
            this.formValue.catheter != null
          ) {
            if (this.formValue.catheter.length > 0) {
              this.propForm.result = this.formValue.catheter.split(",");
            } else {
              this.propForm.result = [];
            }
          } else {
            this.propForm.result = [];
          }
          this.propForm.click_ref = "catheter";
          break;
        case "cruor":
          this.propForm.type = 1;
          this.isShowDialog = false;
          this.propForm.title = "透析器凝血";
          this.propForm.isHasOther = 2;
          this.visibility = true;
          this.propForm.list = [];
          this.propForm.list = getDataConfig("hemodialysis", "cruor");
          this.propForm.optionList = [];
          this.propForm.isMultiple = 2;
          if (
            this.formValue.cruor != undefined ||
            this.formValue.cruor != null
          ) {
            if (this.formValue.cruor.length > 0) {
              this.propForm.result = this.formValue.cruor.split(",");
            } else {
              this.propForm.result = [];
            }
          } else {
            this.propForm.result = [];
          }
          this.propForm.click_ref = "cruor";
          break;
        case "condenser":
          this.propForm.type = 8;
          this.isShowDialog = false;
          this.propForm.title = "灌流器凝血";
          this.propForm.isHasOther = 8;
          this.visibility = true;
          this.propForm.list = [];
          this.propForm.list = getDataConfig("hemodialysis", "cruor");
          this.propForm.optionList = [];
          this.propForm.isMultiple = 2;
          if (
            this.formValue.condenser != undefined ||
            this.formValue.condenser != null
          ) {
            if (this.formValue.condenser.length > 0) {
              this.propForm.result = this.formValue.condenser.split(",");
            } else {
              this.propForm.result = [];
            }
          } else {
            this.propForm.result = [];
          }
          this.propForm.click_ref = "condenser";
          break;
      }
    },
    getString: function (val) {
      this.visibility = false;
      this.isShowDialog = true;
      this.$nextTick(() => {
        if (
          this.$refs[this.propForm.click_ref] != undefined &&
          this.$refs[this.propForm.click_ref] != null
        ) {
          this.$refs[this.propForm.click_ref].scrollIntoView();
        }
      });
      switch (val.type) {
        case 1:
          this.formValue.cruor = val.result.join(",");
          break;
        case 7:
          this.formValue.internal_fistula = val.result.join(",");
          break;
        case 3:
          this.formValue.catheter = val.result.join(",");
          break;
        case 8:
          console.log("酒叟哦哦我",this.formValue.condenser)
          this.formValue.condenser = val.result.join(",")
          break
      }
    },
    isShow_title(name) {
      var filedList = this.$store.getters.user.fileds;
      for (let i = 0; i < filedList.length; i++) {
        if (
          filedList[i].module == 9 &&
          filedList[i].filed_name_cn == name &&
          filedList[i].is_show == 1 &&
          filedList[i].is_write == 1
        ) {
          return true;
        }
      }
      return false;
    },
    isShow(name) {
      var filedList = this.$store.getters.user.fileds;
      for (let i = 0; i < filedList.length; i++) {
        if (
          filedList[i].module == 9 &&
          filedList[i].filed_name_cn == name &&
          filedList[i].is_show == 1
        ) {
          return true;
        }
      }
      return false;
    },
    isWrite(name) {
      var filedList = this.$store.getters.user.fileds;

      for (let i = 0; i < filedList.length; i++) {
        if (
          filedList[i].module == 9 &&
          filedList[i].filed_name_cn == name &&
          filedList[i].is_write == 1 &&
          filedList[i].is_show == 1
        ) {
          return true;
        }
      }

      return false;
    },
    toTeach(val) {
      if (val >= 0) {
        this.teach.map((item) => {
          if (item.id == val) {
            var theValue = item.value;
            this.dialysisAfterTeachSelectChange(theValue);
          }
        });
      }
      this.teachShow = false;
    },
    dialysisAfterTeachSelectChange: function (values) {
      if (this.formValue.mission == null) {
        this.formValue.mission == "";
      }
      if (this.formValue.mission == "") {
        this.formValue.mission = values;
      } else {
        if (this.formValue.mission.indexOf(values) == -1) {
          if (
            this.formValue.mission
              .charAt(this.formValue.mission.length - 1)
              .indexOf("。") == -1
          ) {
            this.formValue.mission = this.formValue.mission + "," + values;
          } else {
            this.formValue.mission = this.formValue.mission + values;
          }
        }
      }
    },
    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:8,
         remark:remark,
       }

      saveMobileInformation(params).then(response=>{
        if(response.data.state == 1){
           this.infor_visibility = false
           Toast.success('申请成功')
        }
      })
    },
    menuCancleFour:function(){
     this.infor_visibility = false
    },
  },
  watch: {
    "record.stage": function (val) {
      if (val == 2) {
        if (this.record.finish_nurse == 0) {
          this.creator = this.record.finish_nurse;
        } else {
          this.creator = this.record.finish_creator;
        }
      }
    },
  },
};
</script>

<style lang="scss" scoped>
.plane {
  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;
  }
}
.preserveBox {
  height: 3.125rem;
  display: flex;
  justify-content: space-around;
  padding: 0 1rem;
  align-items: center;
  font-size: 1rem;
  .isPlane {
    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;
}
.warn_tip {
  color: red;
}
</style>
<style lang="scss">
.van-field__label {
  // width: 9.375rem;
  width: initial;
}
.bgField {
  .van-field__control {
    border: 1px solid #ccc;
    background: #f6f6f6;
    border-radius: 4px;
    min-height: 6.25rem !important;
  }
  ::placeholder {
    //通过这个设置
    color: #999 !important;
  }
}

.newListBoxPopupApp {
  width: 80%;
  height: 80%;
  left: 50% !important;
  top: 50% !important;
  transform: translate3d(-50%, -50%, 0) !important;
  overflow-y: auto;
  border-radius: 0.625rem;
  z-index: 5002 !important;
}
.newListBoxPopupApp {
  .listBox {
    > div {
      padding: 1rem 0.625rem;
      border-bottom: 1px solid #e5e5e5;
      font-size: 0.875rem;
      color: #323233;
    }
  }
}
.plane {
  .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>
