index.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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></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. list.value = result.data.list.map((item:any) => {
  46. return { value: item, label: item}
  47. })
  48. })
  49. const remoteMethod = async(query: string) => {
  50. if (query) {
  51. loading.value = true
  52. setTimeout(() => {
  53. loading.value = false
  54. options.value = list.value.filter((item:any) => {
  55. return item.label.toLowerCase().includes(query.toLowerCase())
  56. })
  57. }, 200)
  58. } else {
  59. options.value = []
  60. }
  61. }
  62. // 渲染表格
  63. const columns: any = [
  64. { prop: 'date', label: '日期', width: 120 },
  65. { prop: 'receiving_unit', label: '购货单位', width: 150 },
  66. { prop: 'product_name', label: '品种', width: 150 },
  67. { prop: 'dosage_form_name', label: '剂型', width: 100 },
  68. { prop: 'spec_name', label: '规格(剂/支或粒)', width: 150 },
  69. { prop: 'enterprise_name', label: '生产企业', width: 150 },
  70. { prop: 'batch_number', label: '疫苗批号', width: 150 },
  71. { prop: 'expiry_date', label: '效期', width: 120 },
  72. { prop: 'approval_number', label: '批准文号', width: 120 },
  73. { prop: 'quantity', label: '数量', width: 120 },
  74. { prop: 'unit_name', label: '单位', width: 80 },
  75. { prop: 'sales_unit_price', label: '销售单价', width: 120 },
  76. { prop: 'sales_money', label: '销售金额', 'min-width': 120 },
  77. ]
  78. //请求参数
  79. const data:any = reactive({
  80. datePicker: [],//时间选择
  81. initParam: {
  82. "date": "",
  83. "receivingUnit": ""
  84. }
  85. })
  86. //搜索
  87. const eventFun = async ()=>{
  88. nextTick(() => {
  89. TableRef.value?.getTableList()
  90. })
  91. }
  92. </script>
  93. <style lang="scss">
  94. /* @import url(); 引入css类 */
  95. </style>