<template>
  <page-layer>
    <template #header>
      <xc-combo-grid
          style="width: 240px"
          ref="searchRef"
          :table-header="tableHeader"
          :query-data-func="searchOrders"
          @rowClick="orderFunc.add">
      </xc-combo-grid>
      <el-select v-model="groupNo" style="width: 90px">
        <el-option value="73" label="住院"/>
        <el-option value="71" label="门诊"/>
      </el-select>
    </template>
    <template #main>
      <xc-table :local-data="orderData" :height="200">
        <el-table-column label="操作" fixed='left'>
          <template #default="{row,$index}">
            <el-button @click="orderFunc.delete($index)" type="danger" icon="Delete"/>
          </template>
        </el-table-column>

        <el-table-column label="编码" prop="orderCode">

        </el-table-column>

      </xc-table>
    </template>
  </page-layer>

</template>

<script setup name='OrderTemplateMaintain'>
import XcTable from "@/components/xiao-chan/xc-table/XcTable.vue";
import {
  tableHeader
} from "@/views/hospitalization/zhu-yuan-yi-sheng/public-js/zhu-yuan-yi-sheng";
import {huoQuXiangMu} from "@/api/zhu-yuan-yi-sheng/yi-zhu-lu-ru";
import XcComboGrid from "@/components/xiao-chan/combo-grid/XcComboGrid.vue";
import PageLayer from "@/layout/PageLayer.vue";

const orderData = ref([])
const groupNo = ref('73')

const orderFunc = ref({
  add: (val) => {
    console.log(val)
    orderData.value.push(val)
  },
  delete: (index) => {
    orderData.value.splice(index, 1)
  }
})

const searchOrders = (val) => {
  return huoQuXiangMu(val, groupNo.value)
}

const order = {
  actOrderNo: null,
  orderCode: '',
  frequCode: '',
  drugFlag: '',
  supplyCode: '',
  drugQuan: '',
  instruction: '',
  drugSpecification: '',
  miniUnit: '',
  drugWeight: '',
  drugWeightUnit: '',
  parentNo: '',
  drugVolume: '',
  drugVolUnit: '',
  dose: 0,
  doseUnit: '',
  drugOcc: '',
  excluActOrderNo: '',
  orderName: '',
  discription: '',
  patternCode: '',
  orderType: '',
  serial: '',
  groupNo: '',
  selfBuy: '',
  execUnit: ''
}

onMounted(() => {
  // orderData.value = [
  //   {code: '123', name: '123'},
  //   {code: '123', name: '123'}
  // ]
  // console.log(orderData.value)
})

</script>

<style scoped lang="scss">

</style>
