<template>
  <div>
    <div class="Dialog" v-show="!selecting">
      <div class="DialogTit">
        <span @click="close()" class="iconfont">&#xe6e9;</span>
        <h1 class="name">透析下机</h1>

        <span class="success" v-if="this.record.stage == 1"></span>
        <span v-else class="success" @click="modify()">修改</span>
      </div>
      <div class="warnTxt" v-if="showTxt != ''">
        {{ showTxt }}
      </div>

      <div class="DialogContent">

        <van-collapse v-model="activeNames" accordion @change="showSubMenu">
          <van-collapse-item
            title="下机护士"
            name="1"
            style="border: 1px solid #e5e5e5"
          >
            <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"
                >{{ item.name }}</van-radio
              >
            </van-radio-group>
          </van-collapse-item>
          <van-field
            v-model="end_time_str"
            readonly
            @click="selectStartTimeAction"
            label="下机时间"
            input-align="right"
          />

          <van-collapse-item
            v-if="isShow('穿刺处血肿')"
            title="穿刺处血肿"
            name="0"
          >
            <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="-2" 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 #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 #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 #value>
              <div>{{ formValue.cruor }}</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="请选择"
          ></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="请输入宣教知识"
          />
        </van-collapse>
        <div class="perform">
          <button
            @click="commitInfo"
            v-show="record != null && record.id != '' && record.stage == 1"
          >
            执行下机
          </button>
          <button
            :disabled="true"
            style="background-color: lightgray"
            v-show="record != null && record.id != '' && record.stage == 2"
          >
            已下机
          </button>
        </div>
      </div>
    </div>
    <two-menu ref="selector"></two-menu>
    <mt-datetime-picker
      ref="start_time_picker"
      type="datetime"
      @confirm="didSelectStartTime"
      v-model="end_time"
    ></mt-datetime-picker>

    <check-box-sub-menu
      :visibility="visibility"
      v-on:menu-cancle="menuCancle"
      v-on:menu-comfirm="menuComfirm"
      v-on:menu-empty="menuEmpty"
      :propsForm="propForm"
    ></check-box-sub-menu>

     <infor-sub-menu
      :visibility="infor_visibility"
      v-on:menu-cancle-three="menuCancleFour"
      v-on:menu-comfirm-three="menuComfirmFour"
      >
     </infor-sub-menu>
  </div>
</template>

<script>
import axios from 'axios'
import InforSubMenu from './subMenu/InforSubMenu'
import { finish, PostModifyEndDialysis,saveMobileInformation } from '@/api/dialysis'
import { Toast } from 'vant'
import TwoMenu from './TwoMenu'
import { parseTime } from '@/utils'
import request from '@/utils/request'
import CheckBoxSubMenu from './subMenu/checkBoxSubMenu'
import { getDataConfig } from '@/utils/data'
import checkBoxMenu from './components/checkBoxMenu'
export default {
  name: 'PlaneDialog',
  components: {
    TwoMenu,
    CheckBoxSubMenu,
    checkBoxMenu,
    InforSubMenu
  },
  data () {
    return {
      showTxt: '',
      hasPermission: true,
      selecting: false,
      end_time_str: '',
      end_time: new Date(),
      formValue: {
        puncture_point_haematoma: '',
        internal_fistula: '',
        catheter: '',
        cruor: '',
        mission: ''
      },
      nurse_id: 0,
      isPremission: false,
      activeNames: '',
      checkBoxShow: false,
      creator: 0,
      puncture_point_haematoma: '',
      isShowDialog: true,
      visibility: false,
      propForm: {
        title: '',
        list: [],
        optionList: [],
        isMultiple: 2,
        result: [], // 选中的值
        type: 1, // 用来区分不同子菜单，方便对返回值进行赋值
        selectId: 0,
        isHasOther: 1
      },
      puncture_point_haematomas: [
        { id: 1, name: '有' },
        { id: 2, name: '无' }
      ],
      internal_fistula: '',
      catheter: '',
      cruor: '',
      propagandaAndEducationContentSelect: '',
      teach: [],
      propagandaAndEducationContent: '',
      teachObj: {},
      teachShow: false,
      infor_visibility:false,
    }
  },
  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
    }
  },
  mounted () {
    console.log("prescription_prop",this.prescription_prop)
    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 != '') {
          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 = ""
          this.end_time_str = parseTime(endTime, '{y}-{m}-{d} {h}:{i}') + ':00'
        } else {
           this.end_time_str = ""
          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 = ""
          this.end_time_str =
            parseTime(this.record.end_time, '{y}-{m}-{d} {h}:{i}') + ':00'
        }
      } else {
        this.end_time_str = ""
        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.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.last_order.blood_access_internal_fistula
      this.formValue.cruor = this.last_order.cruor
      this.formValue.mission = this.last_order.mission
    }
  },
  created () {
    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 = 0
    } 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
      }
    }
  },
  methods: {
    set_last_monitor_record (monitor) {
      this.last_monitor_record = monitor
      this.end_time_str =
        parseTime(
          this.last_monitor_record.operate_time,
          '{y}-{m}-{d} {h}:{i}'
        ) + ':00'
    },
    modify () {
      let ParamsQuery = {}
      ParamsQuery['id'] = this.record.id
      ParamsQuery['nurse'] = this.nurse_id
      ParamsQuery['end_time'] = this.end_time_str
      ParamsQuery['mode'] = '2'
      if (this.$store.getters.user.admin.id != this.record.finish_creator) {
        ParamsQuery['mode'] = '3'
      }

      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 {
            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)
        })
    },
    didSelectStartTime: function (time) {
      this.end_time_str = parseTime(time, '{y}-{m}-{d} {h}:{i}') + ':00'
    },
    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()
      }
    },
    toTeach (val) {

      if (val >= 0) {
        this.teach.map(item => {
          if (item.id == val) {
            var theValue = item.value
            if (this.formValue.mission == null) {
              this.formValue.mission == ''
            }
            if (this.formValue.mission == '') {
              this.formValue.mission = theValue
            } else {
              if (this.formValue.mission.indexOf(theValue) == -1) {
                if (this.formValue.mission.charAt(this.formValue.mission.length - 1).indexOf('。') == -1) {
                  this.formValue.mission = this.formValue.mission + ',' + theValue
                  // console.log('formValue32332323', this.formValue.mission)
                } else {
                  this.formValue.mission = this.formValue.mission + 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
          }
        }
      }
    },
    commitInfo: function () {
      // console.log('h2h33232332', this.patient_prop)
      // console.log('formvalue', this.formValue)
      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
      }
      Toast.loading({ forbidClick: true, duration: 0 })
      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'] = this.patient_prop.id
      ParamsQuery['puncture_point_haematoma'] = parseInt(
        this.formValue.puncture_point_haematoma
      )
        ? parseInt(this.formValue.puncture_point_haematoma)
        : 0

      ParamsQuery['blood_access_internal_fistula'] =
        this.formValue.internal_fistula
      ParamsQuery['catheter'] = this.formValue.catheter
      ParamsQuery['cruor'] = this.formValue.cruor
      ParamsQuery['mission'] = this.formValue.mission

      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
      if (this.$store.getters.user.admin.id != this.record.finish_creator) {
        ParamsQuery['mode'] = '3'
      }

      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)
        })
    },
    close: function () {
      this.$emit('close')
    },
    select_nurse: function () {
      if (this.record != null && this.record.id != '') {
        if (this.record.stage == 1) {
          this.selecting = true
          var t = this
          this.$refs.selector.showSingleSelect(
            this.admins,
            this.nurse_id,
            '选择下机护士',
            'name',
            'id',
            function (select_id) {
              // console.log('nurse id: ', select_id)
              t.nurse_id = select_id
            },
            function () {
              t.selecting = false
            }
          )
        } else {
          this.selecting = true
          var t = this
          this.$refs.selector.showSingleSelect(
            this.admins,
            this.nurse_id,
            '选择下机护士',
            'name',
            'id',
            function (select_id) {
              // console.log('nurse id: ', select_id)
              t.nurse_id = select_id
            },
            function () {
              t.selecting = false
            }
          )
        }
      }
    },
    open: function () {
      this.selecting = false
      this.$refs.selector.hide()
    },
    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) => {
          // console.log(res)
          // console.log('下机', this.record)
          // console.log("上机",this.record)
          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 = '你没有执行下机权限'
              }
            }
          }
        })
    },
    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
    },
    showSubMenu: function (val) {
      this.checkBoxShow = true
      switch (val) {
        case 'puncture_point_haematoma':
          this.propForm.type = 21
          this.isShowDialog = false
          this.propForm.title = '穿刺处血肿'
          this.propForm.isHasOther = 2
          this.propForm.list = []
          this.propForm.optionList = this.puncture_point_haematomas
          this.propForm.isMultiple = 1
          this.propForm.selectId = this.puncture_point_haematoma
          this.propForm.click_ref = 'puncture_point_haematoma'
          break
        case 'internal_fistula':
          this.propForm.type = 7
          this.isShowDialog = false
          this.propForm.title = '内瘘'
          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
      }
    },
    menuComfirm: 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:
          if (val.selectId in this.teachObj) {
            var theValue = this.teachObj[val.selectId].value
            this.dialysisAfterTeachSelectChange(theValue)
            this.dialysisSummary.xjid = val.selectId
            this.dialysisSummary.propagandaAndEducationContentSelect =
              this.teachObj[val.selectId].name
          }
          break
        case 21:
          this.puncture_point_haematoma = val.selectId
          break
        case 8:
          this.internal_fistula = val.result.join(',')
          break
        case 4:
          this.catheter = val.result.join(',')
          break
      }
    },
    menuCancle: function () {
      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()
        }
      })
    },
    menuEmpty: function (val) {
      this.visibility = false
      this.isShowDialog = true
      switch (val.type) {
        case 4:
          this.catheter = ''
          break
        case 8:
          this.internal_fistula = ''
          break
        case 21:
          this.puncture_point_haematoma = ''
          break
      }
    },
    getPuncturePoint (id) {
      var name = ''
      for (let i = 0; i < this.puncture_point_haematomas.length; i++) {
        if (id == this.puncture_point_haematomas[i].id) {
          name = this.puncture_point_haematomas[i].name
        }
      }
      return name
    },
    dialysisAfterTeachSelectChange: function (values) {
      if (this.propagandaAndEducationContent == null) {
        // eslint-disable-next-line no-unused-expressions
        this.propagandaAndEducationContent == ''
      }
      if (this.propagandaAndEducationContent == '') {
        this.propagandaAndEducationContent = values
      } else {
        if (this.propagandaAndEducationContent.indexOf(values) == -1) {
          if (
            this.propagandaAndEducationContent
              .charAt(this.propagandaAndEducationContent.length - 1)
              .indexOf('。') == -1
          ) {
            this.propagandaAndEducationContent =
              this.propagandaAndEducationContent + ',' + values
          } else {
            this.propagandaAndEducationContent =
              this.propagandaAndEducationContent + values
          }
        }
      }
    },
    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
        ) {
          return true
        }
      }

      return false
    },
    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
      }
    },

    menuCancleFour:function(){
      this.infor_visibility = false
      },
    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('申请成功')
          }
        })
      },
  },
  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 style="stylesheet/scss" lang="scss" scoped>
.perform {
  text-align: center;
  font-size: 0.3rem;
  padding-top: 1.5rem;
  .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;
  }
}
.warnTxt {
  font-size: 0.5rem;
  height: 1rem;
  line-height: 1rem;
  text-align: center;
  background: #faa331;
  color: #fff;
}

  .DialogContent {
    @media only screen and (min-width: 415px) {
      height: 18.8rem !important;
    }
  }

</style>
<style scoped>
.DialogContent {
  @media only screen and (min-width: 415px) {
    height: 18.8rem !important;
  }
}
/deep/ .DialogContent .van-collapse .van-collapse-item .van-cell {
  padding: 0.425rem 0.425rem;
  font-size: 0.525rem;
}

/deep/
  .DialogContent
  .van-collapse
  .van-collapse-item
  .van-cell
  .van-cell__right-icon {
  font-size: 0.525rem;
}
/deep/ .DialogContent .van-collapse .van-cell {
  font-size: 0.525rem;
  padding: 0.425rem 0.425rem;
}
</style>
