feat:每个货柜独立库存
This commit is contained in:
1 parent
89aa679c75
commit
95c3ad6c39
11 files changed
+340
-26
No files matched your search
@@ -0,0 +1,115 @@
|
||||
<template>
|
||||
<el-select
|
||||
style="width: 100%"
|
||||
v-model="state.selectId"
|
||||
:placeholder="props.placeholder"
|
||||
:clearable="props.clearable"
|
||||
remote-show-suffix
|
||||
filterable
|
||||
remote
|
||||
:disabled="props.disabled"
|
||||
:remote-method="remoteSearch"
|
||||
:loading="state.loading"
|
||||
@visible-change="(e: boolean) => e && getOptions()"
|
||||
@change="change"
|
||||
>
|
||||
<el-option v-for="v in state.options" :key="v.id" :label="`${v.deviceCode}-${v.cabinetNo}`" :value="v.id">
|
||||
<div class="flex items-center">
|
||||
<div class="color-primary">{{ v.deviceCode }}-{{ v.cabinetNo }}</div>
|
||||
<div class="flex items-center justify-center ml5">
|
||||
<el-tag size="small"> {{ v.hardName }} </el-tag>
|
||||
</div>
|
||||
</div>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="select-wallet-type">
|
||||
import { reactive } from "vue"
|
||||
import { useDict } from "/@/hooks/dict"
|
||||
import * as hardDoorManagerApi from "/@/api/hard/hard-door-manager"
|
||||
|
||||
const emit = defineEmits(["change"])
|
||||
|
||||
const selectId = defineModel()
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
placeholder?: string
|
||||
disabled?: boolean
|
||||
clearable?: boolean
|
||||
autoFirst?: boolean
|
||||
apiParams?: any
|
||||
}>(),
|
||||
{
|
||||
placeholder: "请选择",
|
||||
disabled: false,
|
||||
clearable: true,
|
||||
autoFirst: false,
|
||||
apiParams: {},
|
||||
},
|
||||
)
|
||||
|
||||
const queryForm = reactive<any>({
|
||||
cabinetNo: "",
|
||||
current: 1,
|
||||
size: 10,
|
||||
})
|
||||
|
||||
const state = reactive<any>({
|
||||
loading: true,
|
||||
selectId: selectId,
|
||||
options: [],
|
||||
walletType: [],
|
||||
})
|
||||
|
||||
watch(
|
||||
selectId,
|
||||
(newVal, oldValue) => {
|
||||
if (newVal == oldValue) return
|
||||
state.selectId = newVal
|
||||
getOptions()
|
||||
},
|
||||
{ immediate: true },
|
||||
)
|
||||
|
||||
async function getOptions() {
|
||||
try {
|
||||
state.loading = true
|
||||
const _pa = {
|
||||
...queryForm,
|
||||
...props.apiParams,
|
||||
}
|
||||
const { data } = await hardDoorManagerApi.selectCabinet(_pa)
|
||||
state.options = data.records ?? []
|
||||
if (props.autoFirst && state.options.length != 0) {
|
||||
state.selectId = state.options[0].id
|
||||
emit("change", selectId)
|
||||
}
|
||||
const { wallet_type } = useDict("wallet_type")
|
||||
state.walletType = wallet_type
|
||||
} finally {
|
||||
setTimeout(() => (state.loading = false), 500)
|
||||
}
|
||||
}
|
||||
|
||||
function remoteSearch(params: string) {
|
||||
if (params != queryForm.cabinetNo) {
|
||||
queryForm.cabinetNo = params
|
||||
getOptions()
|
||||
}
|
||||
}
|
||||
|
||||
function clear() {
|
||||
state.selectId = null
|
||||
getOptions()
|
||||
}
|
||||
|
||||
function change() {
|
||||
emit("change", selectId)
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
props.autoFirst && getOptions()
|
||||
})
|
||||
</script>
|
||||
@@ -32,6 +32,7 @@ import SelectHard from "/@/components/Select/SelectHard.vue"
|
||||
import SelectHardSpu from "/@/components/Select/SelectHardSpu.vue"
|
||||
import SelectHardGroup from "/@/components/Select/selectHardGroup.vue"
|
||||
import SelectRole from "/@/components/Select/SelectRole.vue"
|
||||
import SelectCabinet from "/@/components/Select/SelectCabinet.vue"
|
||||
|
||||
// 第三方组件
|
||||
import ElementPlus from "element-plus"
|
||||
@@ -85,6 +86,7 @@ export default {
|
||||
app.component("SelectSupplier", SelectSupplier)
|
||||
app.component("SelectMchRule", SelectMchRule)
|
||||
app.component("SelectRole", SelectRole)
|
||||
app.component("SelectCabinet", SelectCabinet)
|
||||
|
||||
// 导入全部的elmenet-plus的图标
|
||||
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
|
||||
|
||||
Reference in new issue
Block a user