stock-in-search.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <!-- 搜索表单 -->
  2. <template>
  3. <ele-card :body-style="{ paddingBottom: '8px' }">
  4. <ProSearch :items="formItems" ref="searchRef" @search="search" :initKeys="initKeys"></ProSearch>
  5. </ele-card>
  6. </template>
  7. <script setup>
  8. import { reactive, ref, computed, getCurrentInstance } from 'vue';
  9. import ProSearch from '@/components/CommonPage/ProSearch2.vue';
  10. import request from '@/utils/request';
  11. const { proxy } = getCurrentInstance();
  12. const emit = defineEmits(['search']);
  13. // 仓库列表
  14. const godownList = ref([]);
  15. function getStoreList(name = '') {
  16. return proxy.$http.post(`/baseinfo/godown/searchGodown?name=${name}`);
  17. }
  18. getStoreList().then((res) => {
  19. godownList.value = res.data.data;
  20. });
  21. // 用户列表
  22. const userList = ref([]);
  23. function getUserList(query = '') {
  24. return proxy.$http.get(`/system/user/list?username=${query}`);
  25. }
  26. const formItems = computed(() => {
  27. return [
  28. {
  29. type: 'select',
  30. label: '仓库名称',
  31. prop: 'godownId',
  32. options: godownList.value.map((item) => ({
  33. label: item.name,
  34. value: item.id
  35. }))
  36. },
  37. { type: 'input', label: '入库库位', prop: 'positionCode' },
  38. { type: 'input', label: '物流单号', prop: 'waybillCode' },
  39. { type: 'input', label: '订单编号', prop: 'orderId' },
  40. { type: 'input', label: '入库单号', prop: 'stockCode' },
  41. {
  42. type: 'select',
  43. label: '操作员',
  44. prop: 'userId',
  45. options: userList.value.map((item) => ({
  46. label: item.userName,
  47. value: item.userId
  48. })),
  49. props: {
  50. filterable: true,
  51. remote: true,
  52. reserveKeyword: true,
  53. remoteMethod: (query) => {
  54. getUserList(query).then((res) => {
  55. userList.value = res.data.rows;
  56. });
  57. }
  58. }
  59. },
  60. { type: 'input', label: '入库备注', prop: ' remark' },
  61. {
  62. type: 'datetimerange',
  63. label: '入库时间',
  64. prop: 'dateRange',
  65. startProp: 'startTime',
  66. endProp: 'endTime',
  67. colProps: { span: 6 },
  68. props: {
  69. format: 'YYYY-MM-DD HH:mm:ss',
  70. valueFormat: 'YYYY-MM-DD HH:mm:ss',
  71. rangeSeparator: '至',
  72. onChange: (val) => {
  73. searchRef.value?.setData({ startTime: val?.[0] || '', endTime: val?.[1] || '' });
  74. }
  75. }
  76. }
  77. ];
  78. });
  79. const initKeys = reactive({
  80. godownId: '',
  81. positionCode: '',
  82. waybillCode: '',
  83. orderId: '',
  84. inputCode: '',
  85. userId: '',
  86. inputRemark: '',
  87. startTime: '',
  88. endTime: '',
  89. dateRange: []
  90. });
  91. const searchRef = ref(null);
  92. /** 搜索 */
  93. const search = (data) => {
  94. emit('search', { ...data });
  95. };
  96. </script>