You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.vue 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <template>
  2. <a-drawer :width="500" title="搜索" placement="right" :open="openSearchModel" @close="onClose">
  3. <template #extra>
  4. <a-button style="margin-right: 8px" @click="clearSearch">清空搜索</a-button>
  5. <a-button type="primary" @click="getData">搜索</a-button>
  6. </template>
  7. <a-form :model="commomParams.search">
  8. <a-row :gutter="[10]">
  9. <a-col span="24">
  10. <a-form-item>
  11. <a-input addon-before="投放位置" v-model:value="commomParams.search.keyword" placeholder="请输入投放位置" @keyup.enter="getData"/>
  12. </a-form-item>
  13. </a-col>
  14. </a-row>
  15. </a-form>
  16. </a-drawer>
  17. </template>
  18. <script lang="ts" setup>
  19. import { ref, onMounted, watch, computed } from 'vue';
  20. import { useCommon } from '@/hooks/useCommon';
  21. let { store, commomParams, openSearchModel, hideSearch } = useCommon();
  22. let props = defineProps(['search_params']);
  23. const emit = defineEmits();
  24. openSearchModel = computed(() => {
  25. return store.state.openSearchModel;
  26. })
  27. // watch(() => props.search_params, (newVal) => {
  28. // emit('searchData', commomParams.value.search)
  29. // })
  30. const getData = () => {
  31. emit('searchData', commomParams.value.search);
  32. hideSearch()
  33. }
  34. // 清空搜索
  35. const clearSearch = () => {
  36. commomParams.value.search = {
  37. page: 1,
  38. pagesize: 10,
  39. sort: 'id',
  40. sortby: 'desc',
  41. keyword: ''
  42. }
  43. emit('clearData', commomParams.value.search);
  44. hideSearch()
  45. }
  46. const onClose = () => {
  47. clearSearch()
  48. hideSearch()
  49. }
  50. </script>
  51. <style>
  52. </style>