47 lines
1.1 KiB
Vue
47 lines
1.1 KiB
Vue
<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> |