feat(warehouse): 添加仓库选择组件和查询接口
This commit is contained in:
parent
a2d85cd307
commit
e400aadb14
11
api/warehouse.js
Normal file
11
api/warehouse.js
Normal 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,
|
||||
})
|
||||
}
|
||||
47
components/Warehouse/WareHouse.vue
Normal file
47
components/Warehouse/WareHouse.vue
Normal 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>
|
||||
Loading…
x
Reference in New Issue
Block a user