feat(warehouse): 添加仓库选择组件和查询接口

This commit is contained in:
lonewolfyx 2026-02-07 16:16:33 +08:00
parent a2d85cd307
commit e400aadb14
2 changed files with 58 additions and 0 deletions

11
api/warehouse.js Normal file
View File

@ -0,0 +1,11 @@
import request from '@/utils/request'
// 查询列表仓库
export const listwarehouse = (data, query) => {
return request({
method: 'post',
url: '/baseInfo/warehouse/list',
data: data,
params: query,
})
}

View File

@ -0,0 +1,47 @@
<template>
<uni-data-select
v-model="modelValue"
:localdata="options"
v-bind="omit($attrs,['change'])"
/>
</template>
<script setup>
import {defineModel, defineOptions, defineProps, onMounted, ref, watch} from 'vue'
import {omit} from "radash";
import UniDataSelect from "../../uni_modules/uni-data-select/components/uni-data-select/uni-data-select.vue";
import {listwarehouse} from "../../api/warehouse";
defineOptions({
name: "WareHouse"
})
const modelValue = defineModel()
const props = defineProps(['companyId'])
const options = ref([])
const handleQuery = async () => {
const {rows} = await listwarehouse({
state: 1,
companyid: props.companyId
}, {
pageNum: 1,
pageSize: 1000
})
options.value = rows.filter(i => !i.warehousename.includes('其他')).map(i => ({
value: i.warehouseid,
text: i.warehousename
}))
}
onMounted(async () => {
await handleQuery()
})
watch(() => props.companyId, async (newValue) => {
if (newValue || newValue === '') {
await handleQuery()
}
})
</script>