universities-edit.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <!-- 搜索表单 -->
  2. <template>
  3. <ele-card :body-style="{ paddingBottom: '8px' }">
  4. <ProSearch :columns="columns" v-model:form="form" ref="searchRef">
  5. <el-col :span="6" style="min-width: 160px">
  6. <el-button style="width: 80px" type="primary" plain @click="search"
  7. >查询</el-button
  8. >
  9. <el-button style="width: 80px" type="info" @click="reset"
  10. >重置</el-button
  11. >
  12. </el-col>
  13. </ProSearch>
  14. </ele-card>
  15. </template>
  16. <script setup>
  17. import { reactive, ref, defineEmits } from 'vue';
  18. import { useFormData } from '@/utils/use-form-data';
  19. import ProSearch from '@/components/CommonPage/ProSearch.vue';
  20. const emit = defineEmits(['search']);
  21. const columns = reactive([
  22. { tag: 'el-input', label: '书名', prop: 'bookName', span: 4 },
  23. { tag: 'el-input', label: '条码', prop: 'code', span: 4 },
  24. {
  25. tag: 'el-input',
  26. label: '作者',
  27. prop: 'senderAddress',
  28. span: 4
  29. },
  30. { tag: 'el-input', label: '出版社', prop: 'userName', span: 4 },
  31. {
  32. tag: 'el-select',
  33. label: '人工核实',
  34. prop: 'receivingWarehouse',
  35. span: 3
  36. },
  37. { tag: 'el-select', label: '是否套装', prop: 'allOrders', span: 3 },
  38. {
  39. tag: 'el-select',
  40. label: '商品标记',
  41. prop: 'logisticsCompany',
  42. span: 3
  43. }
  44. ]);
  45. const initKeys = {};
  46. for (let i = 0; i < columns.length; i++) {
  47. initKeys[columns[i].prop] = '';
  48. }
  49. /** 表单数据 */
  50. const [form, resetFields] = useFormData({
  51. ...initKeys
  52. });
  53. const searchRef = ref(null);
  54. /** 搜索 */
  55. const search = () => {
  56. emit('search', { ...form });
  57. };
  58. /** 重置 */
  59. const reset = () => {
  60. resetFields();
  61. search();
  62. };
  63. </script>