page-search.vue 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <!-- 搜索表单 -->
  2. <template>
  3. <ele-card :body-style="{ paddingBottom: '8px' }">
  4. <ProSearch
  5. :items="formItems"
  6. ref="searchRef"
  7. @search="search"
  8. :initKeys="initKeys"
  9. :offset="1"
  10. ></ProSearch>
  11. </ele-card>
  12. </template>
  13. <script setup>
  14. import { reactive, ref, defineEmits } from 'vue';
  15. import ProSearch from '@/components/CommonPage/ProSearch2.vue';
  16. let { proxy } = getCurrentInstance();
  17. const emit = defineEmits(['search']);
  18. const godownList = ref([]);
  19. const formItems = computed(() => {
  20. return [
  21. {
  22. type: 'input',
  23. label: '审核员',
  24. prop: 'auditName'
  25. },
  26. {
  27. type: 'daterange',
  28. label: ' ',
  29. prop: 'time',
  30. props: {
  31. format: 'YYYY-MM-DD',
  32. valueFormat: 'YYYY-MM-DD',
  33. onChange: (value) => {
  34. initKeys.startTime = value ? value[0] : '';
  35. initKeys.endTime = value ? value[1] : '';
  36. searchRef.value?.setData(initKeys);
  37. }
  38. },
  39. colProps: {
  40. span: 6
  41. }
  42. }
  43. ];
  44. });
  45. const initKeys = reactive({
  46. startTime: '',
  47. endTime: '',
  48. godownId: ''
  49. });
  50. function getStoreList(name = '') {
  51. return proxy.$http.post(`/baseinfo/godown/searchGodown?name=${name}`);
  52. }
  53. getStoreList().then((res) => {
  54. godownList.value = res.data.data;
  55. });
  56. const searchRef = ref(null);
  57. /** 搜索 */
  58. const search = (data) => {
  59. emit('search', { ...data});
  60. };
  61. </script>