index.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <!-- -->
  2. <template>
  3. <div class="sellManage">
  4. <searchAdd isButtom="查询" :inline="true" @event="eventFun">
  5. <template #searchConter>
  6. <el-form-item label="日期">
  7. <el-date-picker v-model="data.initParam.date" type="date" value-format="YYYY-MM-DD" clearable style="width: 200px;"/>
  8. </el-form-item>
  9. <el-form-item label="购货单位">
  10. <el-select v-model="data.initParam.receivingUnit" filterable remote reserve-keyword placeholder="购货单位"
  11. :remote-method="remoteMethod" :loading="loading" clearable style="width: 200px;" @click="click2">
  12. <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
  13. </el-select>
  14. </el-form-item>
  15. </template>
  16. </searchAdd>
  17. <bg istitle="基本信息">
  18. <template #btn>
  19. <down :initParam="data.initParam"></down>
  20. </template>
  21. <template #bg>
  22. <tables ref="TableRef" :requestApi="orderList" :columns="columns" :initParam="data.initParam"></tables>
  23. </template>
  24. </bg>
  25. </div>
  26. </template>
  27. <script setup lang="ts">
  28. import { reactive, ref, onMounted,nextTick} from 'vue'
  29. import { orderList,stockunit } from "@/api";
  30. import tables from "@/components/table.vue";
  31. import searchAdd from "@/components/searchAdd.vue";
  32. import down from "./down.vue";
  33. import bg from '@/components/bg.vue'
  34. const TableRef = ref()
  35. const loading = ref(false)
  36. interface ListItem {
  37. value: string
  38. label: string
  39. }
  40. const list = ref<ListItem[]>([])
  41. const options = ref<ListItem[]>([])
  42. const click2 = async ()=>{options.value = list.value }
  43. onMounted(async() => {
  44. const result:any = await stockunit({type:2,name:''})
  45. let arr = result.data?.list || []
  46. list.value = arr.map((item:any) => {
  47. return { value: item, label: item}
  48. })
  49. })
  50. const remoteMethod = async(query: string) => {
  51. if (query) {
  52. loading.value = true
  53. setTimeout(() => {
  54. loading.value = false
  55. options.value = list.value.filter((item:any) => {
  56. return item.label.toLowerCase().includes(query.toLowerCase())
  57. })
  58. }, 200)
  59. } else {
  60. options.value = []
  61. }
  62. }
  63. // 渲染表格
  64. const columns: any = [
  65. { prop: 'date', label: '日期', width: 120 },
  66. { prop: 'receiving_unit', label: '购货单位', width: 150 },
  67. { prop: 'product_name', label: '品种', width: 150 },
  68. { prop: 'dosage_form_name', label: '剂型', width: 100 },
  69. { prop: 'spec_name', label: '规格(剂/支或粒)', width: 150 },
  70. { prop: 'enterprise_name', label: '生产企业', width: 150 },
  71. { prop: 'batch_number', label: '血液制品批号', width: 150 },
  72. { prop: 'expiry_date', label: '失效日期', width: 120 },
  73. { prop: 'approval_number', label: '批准文号', width: 120 },
  74. { prop: 'quantity', label: '数量', width: 120 },
  75. { prop: 'unit_name', label: '单位', width: 80 },
  76. { prop: 'sales_unit_price', label: '单价', width: 120 },
  77. { prop: 'sales_money', label: '金额', 'min-width': 120 },
  78. ]
  79. //请求参数
  80. const data:any = reactive({
  81. datePicker: [],//时间选择
  82. initParam: {
  83. "date": "",
  84. "receivingUnit": ""
  85. }
  86. })
  87. //搜索
  88. const eventFun = async ()=>{
  89. nextTick(() => {
  90. TableRef.value?.getTableList()
  91. })
  92. }
  93. </script>
  94. <style lang="scss">
  95. /* @import url(); 引入css类 */
  96. </style>