<template>
  <div>
    <el-form :model="formData" class="order-el-form" ref="formData" label-width="120px" @submit.native.prevent>
      <el-card>
        <el-descriptions title="单据信息" :column="4" border style="margin-top: 15px">
          <el-descriptions-item label="业务单号">{{ formData.billNo }}</el-descriptions-item>
          <el-descriptions-item label="往来信息">{{ formData.fromCorp }}</el-descriptions-item>
          <el-descriptions-item label="单据类型">{{ formData.busTypeName }}</el-descriptions-item>
          <el-descriptions-item label="来源系统">{{ formData.fromType }}</el-descriptions-item>
          <el-descriptions-item label="单据时间">{{ formData.billTime }}</el-descriptions-item>
          <el-descriptions-item label="单据备注">{{ formData.remark }}</el-descriptions-item>
        </el-descriptions>
      </el-card>

      <el-tabs type="border-card" style="margin: 15px" v-model="editableTabsValue">
        <el-tab-pane label="扫码详情" name="prescribeOriginPanel">
          <prescribeOriginPanel
            v-if="panelALive"
            :prescribeData="curRow"
          ></prescribeOriginPanel>
        </el-tab-pane>

<!--        <el-tab-pane label="拆零详情" name="prescribeCodePanel1">-->
        <!--          <prescribeCodePanel-->
        <!--            v-if="panelALive"-->
        <!--            :prescribeData="curRow"-->
        <!--            :fifoSplit="1"-->
        <!--          ></prescribeCodePanel>-->
        <!--        </el-tab-pane>-->
        <!--        <el-tab-pane label="整取详情" name="prescribeCodePanel2">-->
        <!--          <prescribeCodePanel-->
        <!--            v-if="panelALive"-->
        <!--            :prescribeData="curRow"-->
        <!--            :fifoSplit="2"-->
        <!--          ></prescribeCodePanel>-->
        <!--        </el-tab-pane>-->
        <!--        <el-tab-pane label="整单详情" name="PanelOrderAllDetail">-->
        <!--          <PanelOrderAllDetail-->
        <!--            v-if="panelALive"-->
        <!--            :prescribeData="curRow"-->
        <!--          ></PanelOrderAllDetail>-->
        <!--        </el-tab-pane>-->
      </el-tabs>

    </el-form>
  </div>
</template>

<script>
import addOrder from '@/views/inout/DialogCreateOrder'
import errOrder from '@/views/inout/IoCreateErrorOrder'
import { executeFuc, getHead } from '@/utils/customConfig'
import { convertDate } from '@/utils/date'
import selectPrescribeDialog from '@/views/collect/selectCollectOrderDialog'

import prescribeOriginPanel from './PannelOrderBiz'
import prescribeCodePanel from './PanelOrderTagCode'
import PanelOrderAllDetail from '@/views/collect/PanelOrderAllDetail'

export default {
  /**
   * 处理处方
   */
  name: 'prescribeTagCodeDeal',
  props: {
    orderData: {
      type: Object,
      required: true
    }
  },
  data() {
    return {
      tabsName: [
        'prescribeOriginPanel',
        'prescribeCodePanel1',
        'prescribeCodePanel2',
        'PanelOrderAllDetail'
      ],
      editableTabsValue: 'prescribeOriginPanel',
      //界面配置相关
      //患者处方
      loading: false,
      tableHeader: [],
      queryList: [],
      tableObj: [],
      fromList: [],
      convertDateFun: convertDate,
      //界面配置-------------end

      list: [],
      total: 0,
      defaultSort: { prop: 'createTime', order: 'desc' },
      curWorkPlaces: [],
      erpList: [],
      formData: {
        billNo: null,
        tagStatus: -1,
        invCode: null,
        busType: null,
        workPlaceCode: null,
        fromCorp: null,
        confirmFinish: false
      },
      curRow: null,
      panelALive: false
    }
  },

  components: {
    prescribeCodePanel,
    prescribeOriginPanel,
    PanelOrderAllDetail
  },
  methods: {
    //界面配置相关------------
    executeFuc(row, type, clickFuc, value) {
      return executeFuc(this, row, type, clickFuc, value)
    },
    executeEval(row, expression, defaultRet) {
      if (expression) {
        return eval(expression)
      }
      return defaultRet
    },
    ///界面配置相关------------end
    refreshCodesPanel(_this) {
      _this.panelALive = false
      _this.$nextTick(() => {
        _this.panelALive = true
      })
    },
    startDeal() {
      this.curRow = this.formData
      this.refreshCodesPanel(this)
    }
    // toggleBusType() {
    //   //隐藏下拉框内容
    //   // this.$refs.selectHeadEmpId.blur();
    //   this.selectBusTypeDisabled = true
    // },
  },
  created() {
    getHead('prescribeTagCodeDeal', '1').then((re) => {
      // 处理返回的数据
      this.tableObj = re.data
      this.tableHeader = re.data.tableList
      this.queryList = re.data.queryList
      this.fromList = re.data.fromList
    })
    this.formData = this.orderData
    this.startDeal()

  }

}
</script>

<style scoped>
.el-col {
  margin-top: -5px;
  margin-bottom: -5px;
}

.el-dropdown {
  vertical-align: top;
}

.el-dropdown + .el-dropdown {
  margin-left: 15px;
}

.el-icon-arrow-down {
  font-size: 12px;
}
</style>
