食堂原料管理

This commit is contained in:
weiwei committed 2025-05-13 11:06:14 +08:00
1 parent 7f1cfdb0e7
commit 5bd138c276
8 files changed
+169 -146

No files matched your search

@@ -0,0 +1,66 @@
<template>
<el-select
style="width: 100%"
v-model="state.selectId"
:placeholder="props.placeholder"
clearable
remote-show-suffix
filterable
remote
:remote-method="remoteSearch"
:loading="state.loading"
@visible-change="(e: boolean) => e && getOptions()"
>
<el-option v-for="v in state.options" :key="v.supplierId" :label="v.supplierName" :value="v.supplierId" />
</el-select>
</template>
<script setup lang="ts" name="SelectSupplier">
import { reactive } from "vue"
import { canteenSupplierSelect } from "/@/api/canteen/canteenSupplier"
const selectId = defineModel()
const props = withDefaults(defineProps<{ placeholder?: string }>(), {
placeholder: "请选择",
})
const queryForm = reactive<any>({
name: "",
supplierId: "",
})
const state = reactive<any>({
loading: true,
selectId: selectId,
options: [],
})
watch(
selectId,
(newVal, oldValue) => {
if (newVal == oldValue) return
state.selectId = newVal
queryForm.supplierId = newVal
getOptions()
},
{ immediate: true },
)
async function getOptions() {
try {
state.loading = true
const { data } = await canteenSupplierSelect(queryForm)
state.options = data ? data : []
} finally {
setTimeout(() => (state.loading = false), 500)
}
}
function remoteSearch(params: string) {
if (params != queryForm.name) {
queryForm.name = params
getOptions()
}
}
</script>
+2
View File
@@ -34,6 +34,7 @@ import SelectHardGroup from "/@/components/Select/selectHardGroup.vue"
import SelectRole from "/@/components/Select/SelectRole.vue"
import SelectCabinet from "/@/components/Select/SelectCabinet.vue"
import SelectMchCatory from "/@/components/Select/SelectMchCatory.vue"
import SelectCanteenSupplier from "/@/components/Select/SelectCanteenSupplier.vue"
// 第三方组件
import ElementPlus from "element-plus"
@@ -89,6 +90,7 @@ export default {
app.component("SelectMchRule", SelectMchRule)
app.component("SelectRole", SelectRole)
app.component("SelectCabinet", SelectCabinet)
app.component("SelectCanteenSupplier", SelectCanteenSupplier)
// 导入全部的elmenet-plus的图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {