book-push-erp-log-search.vue 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <template>
  2. <ele-card :body-style="{ paddingBottom: '8px' }">
  3. <ProSearch
  4. :items="formItems"
  5. ref="searchRef"
  6. @search="search"
  7. :initKeys="initKeys"
  8. />
  9. </ele-card>
  10. </template>
  11. <script setup>
  12. import { reactive, ref, defineEmits } from 'vue';
  13. import ProSearch from '@/components/CommonPage/ProSearch2.vue';
  14. const emit = defineEmits(['search']);
  15. const formItems = reactive([
  16. {
  17. type: 'datetimerange',
  18. label: '更新时间',
  19. prop: 'time',
  20. props: {
  21. format: 'YYYY-MM-DD HH:mm:ss',
  22. valueFormat: 'YYYY-MM-DD HH:mm:ss',
  23. onChange: (value) => {
  24. initKeys.startTime = value ? value[0] : '';
  25. initKeys.endTime = value ? value[1] : '';
  26. searchRef.value?.setData(initKeys);
  27. }
  28. },
  29. colProps: {
  30. span: 6
  31. }
  32. }
  33. ]);
  34. const initKeys = reactive({
  35. startTime: '',
  36. endTime: ''
  37. });
  38. const searchRef = ref(null);
  39. function search(data) {
  40. delete data.time;
  41. emit('search', { ...data });
  42. }
  43. </script>