<template>
  <div>
    <div class="Dialog" v-show="index==0" style="width: 16.8rem;">
      <div class="DialogTit" @click="$emit('orderDialog')">
        <span class="iconfont">&#xe6e9;</span>
        <h1 class="name">临时医嘱</h1>
        <span class="success">&nbsp;</span>
      </div>
      <div class="DialogContent choose" id="dialogTop">
        <div class="content clearfix">
          <div class="yzNav" style="width:80%;">
            <span @click="openNewAdvice">新增医嘱</span>
            <span @click="deleteAdvice">删除医嘱</span>
            <span @click="execAdvice">执行医嘱</span>
            <span @click="checkAdvice">医嘱核对</span>
            <span @click="openNewChild">添加子药</span>
          </div>
          <table class="table">
            <tr @click="selectRow(-1, null)">
              <th width="12%">开嘱医生</th>
              <th width="18%">开始时间</th>
              <th width="30%">医嘱内容</th>
              <th width="15%">执行时间</th>
              <th width="12%">执行护士</th>
              <th width="12%">核对人员</th>
            </tr>
            <tr
              v-for="(advice,index) in adviceList"
              :key="index"
              :value="advice.advice_name"
              @click="selectRow(index, advice)"
              :class="index==currentIndex?rowClass:''"
            >
              <td>
                <span v-if="advice.parent_id==0">{{getXuserName(advice.advice_doctor)}}</span>
                <span v-else></span>
              </td>
              <td>
                <span
                  v-if="advice.parent_id==0"
                >{{ uParseTime(advice.start_time, "{y}-{m}-{d} {h}:{i}")}}</span>
                <span v-else></span>
              </td>
              <td>
                <span>{{advice.advice_name }}</span>
                <span
                  v-if="advice.prescribing_number"
                >{{advice.prescribing_number}}{{advice.prescribing_number_unit}}</span>
                <span
                  v-if="advice.single_dose"
                >单次用量 {{advice.single_dose}}{{advice.single_dose_unit}}</span>
                <span>{{advice.delivery_way}}</span>
                <span>{{advice.execution_frequency}}</span>
              </td>
              <td>
                <span
                  v-if="advice.execution_time!=0"
                >{{ uParseTime(advice.execution_time, "{y}-{m}-{d} {h}:{i}")}}</span>
              </td>
              <td>
                <span v-if="advice.parent_id==0">{{getXuserName(advice.execution_staff)}}</span>
              </td>
              <td>{{getXuserName(advice.checker)}}</td>
            </tr>
          </table>
        </div>
        <!-- <div class="footer">
            开嘱医生：{{doctor}} 医生
        </div>-->
      </div>
    </div>
    <div class="Dialog" v-show="index==2&&isShowDialog">
      <div class="DialogTit">
        <div class="back" @click="index=0">
          <span class="iconfont">&#xe720;</span>返回
        </div>
        <h1 class="name">编辑医嘱</h1>
        <span class="success" @click="submitNewAdvice">完成</span>
      </div>
      <div class="DialogContent choose advice-top" id="advice-top">
        <div class="content clearfix">
          <div>
            <div class="cell">
              <label>医嘱类型</label>
              <el-input ref="advice_type" value="临时" disabled></el-input>
            </div>
            <div class="cell">
              <label>医嘱时间</label>
              <el-input v-model="adviceForm.advice_date" readonly></el-input>
            </div>
            <div class="cell">
              <label>开始时间</label>
              <el-input v-model="adviceForm.start_time" readonly @focus="chooseTime"></el-input>
            </div>
            <div class="cell">
              <label>医嘱名称</label>
              <el-input v-model="adviceForm.advice_name"></el-input>
            </div>
            <div class="cell">
              <label>给药途径</label>

              <el-input
                v-model="adviceForm.delivery_way"
                readonly
                @focus="showSubMenu('delivery_way')"
                :disabled="adviceForm.parent_id==0?false:true"
              ></el-input>
            </div>
            <div class="cell">
              <label>执行频率</label>
              <el-input
                v-model="adviceForm.execution_frequency"
                readonly
                @focus="showSubMenu('execution_frequency')"
                :disabled="adviceForm.parent_id==0?false:true"
              ></el-input>
            </div>
            <div class="cell">
              <label>医嘱描述</label>
              <el-input v-model="adviceForm.advice_desc"></el-input>
            </div>
            <div class="cell">
              <label>单次用量</label>
              <input
                type="number"
                class="inputBox"
                style="width:60%"
                v-model="adviceForm.single_dose"
              >
              <input
                type="text"
                readonly
                class="inputBox"
                style="width:35%"
                v-model="adviceForm.single_dose_unit"
                @focus="showSubMenu('single_dose_unit')"
              >
            </div>
            <div class="cell">
              <label>开药数量</label>
              <input
                type="number"
                class="inputBox"
                style="width:60%"
                v-model="adviceForm.prescribing_number"
              >
              <input
                type="text"
                readonly
                class="inputBox"
                style="width:35%"
                v-model="adviceForm.prescribing_number_unit"
                @focus="showSubMenu('prescribing_number_unit')"
              >
            </div>
            <div class="cell width">
              <label>开嘱医生：</label>
              <span>{{doctor}}</span>
            </div>
          </div>
        </div>
      </div>
    </div>

    <add-new-order-dialog
      v-show="index==1&&isShowDialog"
      @back-action="index = 0"
      :patient_id="patient.id"
      :delivery_way_options="deliveryWayOptions"
      :execution_frequency_options="executionFrequencyOptions"
      :single_dose_unit_options="unitsOption"
      :prescribing_number_unit_options="unitsOption"
      :drug_spec_unit_options="unitsOption"
      :advice_templates="adviceTemplates"
      @did-create-advices="didCreateAdvices"
    ></add-new-order-dialog>

    <mt-datetime-picker ref="picker" type="datetime" @confirm="handleConfirm" v-model="nowTime"></mt-datetime-picker>

    <mt-datetime-picker
      ref="exec_time"
      type="datetime"
      @confirm="handleExecTime"
      v-model="nowExecTime"
    ></mt-datetime-picker>

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

<script>
import { Dialog, DatetimePicker, Toast } from 'vant'
import {
  getAdviceConfig,
  CreateDoctorAdvice,
  DeleteDoctorAdvice,
  ExecDoctorAdvice,
  CheckDoctorAdvice
} from '@/api/advice'
import { uParseTime } from '@/utils/tools'
import CheckBoxSubMenu from './subMenu/checkBoxSubMenu'
import { getDataConfig } from '@/utils/data'
import AddNewOrderDialog from './new_order/AddNewOrders'

export default {
  name: 'OrdersDialog',
  data () {
    return {
      isShowDialog: true,

      visibility: false,
      propForm: {
        title: '',
        list: [],
        optionList: [],
        isMultiple: 2,
        result: [], // 选中的值
        type: 1, // 用来区分不同子菜单，方便对返回值进行赋值
        selectId: 0
      },

      showDeliveryWayBtn: false,
      showAdviceNameBtn: false,
      showExecutionFrequencyBtn: false,
      rowClass: 'row-class-active',
      currentIndex: -1,
      currentRow: null,
      title: '临时医嘱',
      index: 0,
      doctor: '',
      adviceTemplates: [],
      adviceTemplateMaps: {},
      drugOptions: {},
      deliveryWayOptions: [],
      deliveryWayOjb: {},
      executionFrequencyOptions: [],
      executionFrequencyObj: {},
      unitsOption: [],
      unitsObj: [],
      record_date: '',
      nowTime: new Date(),
      nowExecTime: new Date(),
      patient: {
        id: 0
      },
      admin_users: [],
      adviceForm: {
        id: 0,
        advice_type: 2,
        advice_date: '',
        start_time: '',
        advice_name: '',
        advice_desc: '',
        single_dose: '',
        single_dose_unit: '',
        prescribing_number: '',
        prescribing_number_unit: '',
        delivery_way: '',
        execution_frequency: '',
        advice_doctor: '',
        remark: '',
        parent_id: 0
      },
      adviceList: [],
      parent_id: 0
    }
  },
  methods: {
    didCreateAdvices: function (advices) {
      for (let index = 0; index < advices.length; index++) {
        const advice = advices[index]
        this.adviceList.push(advice)
        this.$emit('new_create', advice)
      }
      this.index = 0
    },
    showSubMenu: function (val) {
      switch (val) {
        case 'advice_name':
          this.propForm.type = 1
          this.isShowDialog = false
          this.propForm.title = '选择'
          this.visibility = true
          this.propForm.list = []
          this.propForm.optionList = this.adviceTemplateMaps
          this.propForm.isMultiple = 1
          this.propForm.selectId = this.adviceForm.template_id
          break
        case 'delivery_way':
          this.propForm.type = 2
          this.isShowDialog = false
          this.propForm.title = '选择'
          this.visibility = true
          this.propForm.list = []
          this.propForm.optionList = this.deliveryWayOptions
          this.propForm.isMultiple = 1
          this.propForm.selectId = this.adviceForm.jjtj_id
          break
        case 'execution_frequency':
          this.propForm.type = 3
          this.isShowDialog = false
          this.propForm.title = '选择'
          this.visibility = true
          this.propForm.list = []
          this.propForm.optionList = this.executionFrequencyOptions
          this.propForm.isMultiple = 1
          this.propForm.selectId = this.adviceForm.zxpl_id
          break
        case 'single_dose_unit':
          this.propForm.type = 4
          this.isShowDialog = false
          this.propForm.title = '选择'
          this.visibility = true
          this.propForm.list = []
          this.propForm.optionList = this.unitsOption
          this.propForm.isMultiple = 1
          this.propForm.selectId = this.adviceForm.sdu_id
          break

        case 'prescribing_number_unit':
          this.propForm.type = 5
          this.isShowDialog = false
          this.propForm.title = '选择'
          this.visibility = true
          this.propForm.list = []
          this.propForm.optionList = this.unitsOption
          this.propForm.isMultiple = 1
          this.propForm.selectId = this.adviceForm.pnu_id
          break
      }
    },
    menuCancle: function () {
      this.visibility = false
      this.isShowDialog = true
    },
    menuComfirm: function (val) {
      this.visibility = false
      this.isShowDialog = true

      switch (val.type) {
        case 1:
          if (val.selectId in this.adviceTemplateMaps) {
            this.selectAdviceName(val.selectId)
            this.adviceForm.template_id = val.selectId
          }
          break
        case 2:
          if (val.selectId in this.deliveryWayOjb) {
            this.adviceForm.jjtj_id = val.selectId
            this.adviceForm.delivery_way = this.deliveryWayOjb[
              val.selectId
            ].name
          }
          break
        case 3:
          if (val.selectId in this.executionFrequencyObj) {
            this.adviceForm.zxpl_id = val.selectId
            this.adviceForm.execution_frequency = this.executionFrequencyObj[
              val.selectId
            ].name
          }
          break
        case 4:
          if (val.selectId in this.unitsObj) {
            this.adviceForm.sdu_id = val.selectId
            this.adviceForm.single_dose_unit = this.unitsObj[val.selectId].name
          }
          break
        case 5:
          if (val.selectId in this.unitsObj) {
            this.adviceForm.pnu_id = val.selectId
            this.adviceForm.prescribing_number_unit = this.unitsObj[
              val.selectId
            ].name
          }
          break
      }
    },

    selectRow (index, row) {
      this.currentIndex = index
      this.currentRow = row
    },
    uParseTime (time, format) {
      return uParseTime(time, format)
    },
    getXuserName (id) {
      if (id <= 0) {
        return ''
      }
      var name = ''
      if (
        this.admin_users == null ||
        typeof this.admin_users.length === 'undefined'
      ) {
        return name
      }
      var leng = this.admin_users.length
      if (leng == 0) {
        return name
      }
      for (let index = 0; index < leng; index++) {
        if (this.admin_users[index].id == id) {
          name = this.admin_users[index].name
          break
        }
      }
      return name
    },
    submitNewAdvice () {
      if (this.adviceForm.advice_name.length == 0) {
        Toast('请填写医嘱名称')
        return
      }
      if (this.adviceForm.start_time.length == 0) {
        Toast('请选择开始时间')
        return
      }
      Toast.loading({ forbidClick: true, duration: 0 })
      CreateDoctorAdvice(this.patient.id, this.adviceForm).then(response => {
        if (response.data.state == 0) {
          Toast.fail(response.data.msg)
          return false
        } else {
          Toast.success('添加成功')
          if (this.adviceForm.parent_id > 0) {
            var spliceIndex = -1
            for (let index = this.adviceList.length - 1; ; index--) {
              if (
                this.adviceList[index].parent_id === this.adviceForm.parent_id
              ) {
                spliceIndex = index
                break
              } else if (
                this.adviceList[index].id === this.adviceForm.parent_id
              ) {
                spliceIndex = index
                break
              }
            }
            if (spliceIndex > -1) {
              spliceIndex += 1
              if (spliceIndex === this.adviceList.length) {
                this.adviceList.push(response.data.data.advice)
              } else {
                var swapData = this.adviceList.splice(spliceIndex)
                this.adviceList.push(response.data.data.advice)
                for (var index in swapData) {
                  this.adviceList.push(swapData[index]) // = this.doctor_advices.concat(swapData);
                }

                // this.adviceList = this.adviceList.concat(swapData);
              }
            }
          } else {
            this.adviceList.unshift(response.data.data.advice)
          }
          this.currentIndex = -1
          this.currentRow = null
          this.index = 0
          this.$emit('new_create', response.data.data.advice)
          return false
        }
      })
    },
    chooseTime () {
      this.$refs.picker.open()
    },
    changeAdviceName (change) {
      this.adviceForm.advice_name = this.drugOptions[change].name
      this.adviceForm.advice_desc = this.drugOptions[change].spec
      this.adviceForm.single_dose_unit = this.drugOptions[change].spec_unit
      this.adviceForm.prescribing_number_unit = this.drugOptions[
        change
      ].form_unit
    },
    selectAdviceName (key) {
      if (key in this.adviceTemplateMaps) {
        this.adviceForm.advice_name = this.adviceTemplateMaps[key].advice_name
        this.adviceForm.advice_desc = this.adviceTemplateMaps[key].advice_desc
        this.adviceForm.single_dose_unit = this.adviceTemplateMaps[
          key
        ].single_dose_unit
        this.adviceForm.prescribing_number_unit = this.adviceTemplateMaps[
          key
        ].prescribing_number_unit
        this.adviceForm.single_dose =
          this.adviceTemplateMaps[key].single_dose + ''
        this.adviceForm.prescribing_number =
          this.adviceTemplateMaps[key].prescribing_number + ''
        this.adviceForm.delivery_way = this.adviceTemplateMaps[
          key
        ].delivery_way
        this.adviceForm.execution_frequency = this.adviceTemplateMaps[
          key
        ].execution_frequency
      }
    },
    getAdviceConfig () {
      getAdviceConfig().then(response => {
        if (response.data.state == 1) {
          this.deliveryWayOptions =
            response.data.data.drugways === null
              ? []
              : response.data.data.drugways
          this.executionFrequencyOptions =
            response.data.data.efs === null ? [] : response.data.data.efs

          var dl = this.deliveryWayOptions.length
          for (let index = 0; index < dl; index++) {
            this.deliveryWayOjb[
              this.deliveryWayOptions[index].id
            ] = this.deliveryWayOptions[index]
          }
          var el = this.executionFrequencyOptions.length
          for (let index = 0; index < el; index++) {
            this.executionFrequencyObj[
              this.executionFrequencyOptions[index].id
            ] = this.executionFrequencyOptions[index]
          }

          this.adviceTemplates =
            response.data.data.advice_templates === null
              ? []
              : response.data.data.advice_templates
          var templateLen = this.adviceTemplates.length
          for (let index = 0; index < templateLen; index++) {
            var item = this.adviceTemplates[index]
            // item['name'] = item.advice_name
            this.$set(
              this.adviceTemplateMaps,
              this.adviceTemplates[index].id,
              item
            )
          }
        }
      })
    },
    handleConfirm (time) {
      this.adviceForm.start_time = this.handleTime(time)
    },

    handleExecTime (time) {
      var exceTime = this.handleTime(time)
      var exceParams = {
        id: this.currentRow.id,
        patient: this.patient.id,
        parent_id: this.currentRow.parent_id,
        execution_time: exceTime
      }

      Toast.loading({ forbidClick: true, duration: 0 })
      ExecDoctorAdvice(exceParams).then(response => {
        if (response.data.state == 0) {
          Toast.fail('执行失败！')
          return false
        } else {
          Toast.success('执行成功！')
          var exid = response.data.data.advice.id
          var pxid = response.data.data.advice.parent_id
          if (pxid > 0) {
            exid = pxid
          }

          this.currentRow.execution_state = 1
          this.currentRow.execution_staff =
            response.data.data.advice.execution_staff
          this.currentRow.execution_time =
            response.data.data.advice.execution_time

          // if (exceParams.parent_id > 0) {
          //   exid = exceParams.parent_id;
          // }
          var alen = this.adviceList.length
          for (let index = 0; index < alen; index++) {
            if (
              this.adviceList[index].id == exid ||
              this.adviceList[index].parent_id == exid
            ) {
              this.adviceList[index].execution_state = 1
              this.adviceList[index].execution_staff =
                response.data.data.advice.execution_staff
              this.adviceList[index].execution_time = Math.round(
                time.getTime() / 1000
              )
              // this.adviceList[index].checker =
              // response.data.data.advice.checker;
              this.$emit('execution', this.adviceList[index])
            }
          }

          return false
        }
      })
    },
    handleTime (time) {
      var year = time.getFullYear()
      var month = time.getMonth() + 1
      var day = time.getDate()
      var hour = time.getHours()
      var minute = time.getMinutes()
      if (month < 10) {
        month = '0' + month
      }
      if (day < 10) {
        day = '0' + day
      }
      if (hour < 10) {
        hour = '0' + hour
      }
      if (minute < 10) {
        minute = '0' + minute
      }
      return year + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':00'
    },
    deleteAdvice () {
      if (this.currentIndex < 0 || this.currentRow == null) {
        Toast.fail('请先选择要删除的医嘱！')
        return false
      }
      Dialog.confirm({
        title: '医嘱删除',
        message: '确认删除些条医嘱?'
      })
        .then(() => {
          Toast.loading({ forbidClick: true, duration: 0 })
          DeleteDoctorAdvice(this.currentRow.id).then(response => {
            if (response.data.state == 0) {
              Toast.fail(response.data.msg)
              return false
            } else {
              Toast.success('医嘱已经删除')
              this.deleteResetData(this.currentIndex, this.currentRow)
              this.$emit('delete', this.adviceList[this.currentIndex])
              this.currentIndex = -1
              this.currentRow = null
            }
          })
        })
        .catch(() => {
          // on cancel
        })
    },
    deleteResetData (index, row) {
      if (row.parent_id > 0) {
        this.adviceList.splice(index, 1)
      } else {
        var spliceIndex = -1
        var splitNums = 0
        for (var kndex in this.adviceList) {
          if (this.adviceList[kndex].id == row.id) {
            spliceIndex = kndex
            splitNums++
          } else if (this.adviceList[kndex].parent_id == row.id) {
            splitNums++
          }
        }
        this.adviceList.splice(spliceIndex, splitNums)
      }
    },
    checkAdvice () {
      if (this.currentIndex < 0 || this.currentRow == null) {
        Toast.fail('请先选择要核对的医嘱！')
        return false
      }
      if (this.currentRow.check_state == 1) {
        Toast.fail('所选医嘱已核对')
        return false
      }

      if (
        this.currentRow.execution_staff > 0 &&
        this.currentRow.execution_staff == this.$store.getters.user.admin.id
      ) {
        Toast.fail('核对与执行不能是同一人')
        return false
      }

      Dialog.confirm({
        title: '医嘱核对',
        message: '确认提交核对?'
      })
        .then(() => {
          Toast.loading({ forbidClick: true, duration: 0 })
          var params = {
            id: this.currentRow.id,
            patient: this.patient.id
          }
          CheckDoctorAdvice(params).then(response => {
            if (response.data.state == 0) {
              Toast.fail(response.data.msg)
              return false
            } else {
              Toast.success('核对成功！')
              var exid = response.data.data.advice.id
              var pxid = response.data.data.advice.parent_id
              if (pxid > 0) {
                exid = pxid
              }
              var alen = this.adviceList.length
              this.currentRow.check_state = 1
              this.currentRow.checker = response.data.data.advice.checker
              this.currentRow.check_time = response.data.data.check_time
              for (let index = 0; index < alen; index++) {
                if (
                  this.adviceList[index].id == exid ||
                  this.adviceList[index].parent_id == exid
                ) {
                  this.adviceList[index].check_state = 1
                  this.adviceList[index].check_time =
                    response.data.data.check_time
                  this.adviceList[index].checker =
                    response.data.data.advice.checker
                  this.$emit('execution', this.adviceList[index])
                }
              }

              return false
            }
          })
        })
        .catch(() => {
          // on cancel
        })
    },
    execAdvice () {
      if (this.currentIndex < 0 || this.currentRow == null) {
        Toast.fail('请先选择要执行的医嘱！')
        return false
      }
      if (
        this.currentRow.stop_state == 1 ||
        this.currentRow.execution_state == 1
      ) {
        Toast.fail('所选医嘱已停止或执行')
        return false
      }

      if (
        this.currentRow.checker > 0 &&
        this.currentRow.checker == this.$store.getters.user.admin.id
      ) {
        Toast.fail('核对与执行不能是同一人')
        return false
      }

      this.$refs.exec_time.open()
    },
    openNewChild () {
      if (this.currentIndex < 0 || this.currentRow == null) {
        Toast.fail('请先选择要添加子药的医嘱！')
        return false
      }
      if (
        this.currentRow.stop_state == 1 ||
        this.currentRow.execution_state == 1
      ) {
        Toast.fail('所选医嘱已停止或执行')
        return false
      }

      this.index = 2 // 1;

      this.adviceForm = {
        id: 0,
        advice_type: 2,
        advice_date: this.record_date,
        start_time: uParseTime(
          this.currentRow.start_time,
          '{y}-{m}-{d} {h}:{i}'
        ),
        advice_name: '',
        advice_desc: '',
        single_dose: '',
        single_dose_unit: '',
        prescribing_number: '',
        prescribing_number_unit: '',
        delivery_way: this.currentRow.delivery_way,
        execution_frequency: this.currentRow.execution_frequency,
        advice_doctor: '',
        remark: '',
        parent_id: this.currentRow.id
      }
    },
    openNewAdvice () {
      this.index = 1
      this.currentIndex = -1
      this.currentRow = null
      this.adviceForm = {
        id: 0,
        advice_type: 2,
        advice_date: this.record_date,
        start_time: '',
        advice_name: '',
        advice_desc: '',
        single_dose: '',
        single_dose_unit: '',
        prescribing_number: '',
        prescribing_number_unit: '',
        delivery_way: '',
        execution_frequency: '',
        advice_doctor: '',
        remark: '',
        parent_id: 0
      }

      // document.getElementById("advice-top").scrollIntoView();

      // document.querySelector("#advice-top").scrollTop = 0;
      this.$el.querySelector('#advice-top').scrollIntoView()
    },
    open: function () {
      this.index = 0
      this.visibility = false
      this.menuCancle()
      this.$refs.picker.close()
      var dialogTop = document.querySelector('#dialogTop')
      if (dialogTop != null) {
        this.$nextTick(() => {
          dialogTop.scrollTop = 0
        })
      }
    }
  },
  props: {
    patient_prop: {
      type: Object
    },
    advice_list_prop: {
      type: Array
    },
    admin_users_prop: {
      type: Array
    }
  },
  created () {
    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.patient = this.patient_prop
    this.adviceList = this.advice_list_prop
    this.admin_users = this.admin_users_prop
    this.doctor = this.$store.getters.user.user.user_name
    this.adviceForm.advice_date = this.record_date
    this.getAdviceConfig()

    this.unitsOption = getDataConfig('hemodialysis', 'units')
    for (var index in this.unitsOption) {
      this.unitsObj[this.unitsOption[index].id] = this.unitsOption[index]
    }
  },

  components: {
    CheckBoxSubMenu,
    AddNewOrderDialog
  }
}
</script>

<style style="stylesheet/scss" lang="scss"  scoped>
.DialogContent {
  // padding-bottom: 2.5rem !important;
}
.table {
  width: 100%;
  tr {
    th {
      background: $main-color;
      color: #fff;
      height: 0.88rem;
      line-height: 0.88rem;
    }
    td {
      line-height: 0.4rem;
    }
  }
}
.content {
  .cell {
    float: left;
    width: 3.42rem;
    // width: 100%;
    margin: 0.35rem 0.3rem 0 0.4rem;
    label {
      display: block;
      height: 0.55rem;
      line-height: 0.55rem;
      color: $pgh-color;
    }
    select {
      width: 100%;
      padding: 0.2rem 0;
      border: 1px $border-color solid;
      border-radius: 2px;
      padding-left: 5px;
    }

    .inputBox {
      border: 1px $border-color solid;
      border-radius: 2px;
      padding: 0.18rem 0;
      padding-left: 5px;
    }

    .textarea {
      width: 100%;
      height: 1.22rem;
      border: 1px $border-color solid;
      border-radius: 2px;
      padding-left: 5px;
    }
  }
  .width {
    width: 90%;
    @include box-sizing;
    margin-top: 1rem;
    label {
      display: inline-block;
    }
    button {
      background: $main-color;
      color: #fff;
      border-radius: 6px;
      width: 3rem;
      height: 0.9rem;
      line-height: 0.9rem;
      text-align: center;
      margin: 0 0.1rem 0.6rem 0.1rem;
      border: 1px $main-color solid;
      &.smt-danger {
        background: #fff;
        color: $main-color;
      }
    }
  }
  .center {
    text-align: center;
  }
  .row-class-active > td {
    background: #badcff;
  }
}
</style>
