Files
klp-mono/apps/hand-factory/components/klp-product-select/klp-product-select.vue
砂糖 771f4ab006 feat(扫码功能): 重构扫码页面并新增分卷录入功能
- 重构扫码页面结构,采用标签页形式组织功能模块
- 新增分卷录入功能组件(apart.vue)和基础录入功能组件(typing.vue)
- 新增物料选择组件(klp-product-select)和标签页组件(klp-tabs)
- 新增WMS相关API接口(product.js, warehouse.js等)
- 更新uni-data-select组件支持多选和插槽功能
- 更新uni-icons和uni-load-more组件版本及功能
- 移除冗余样式和代码,优化现有组件结构

refactor(组件): 优化acidity.vue组件使用新的标签页组件
style: 移除冗余CSS样式代码
chore: 更新多个uni_modules组件的package.json版本号
2025-10-28 18:11:46 +08:00

74 lines
1.2 KiB
Vue

<template>
<view>
<uni-data-select v-model="itemId" :localdata="localData"></uni-data-select>
</view>
</template>
<script>
import {
listProduct
} from '@/api/wms/product.js'
import {
listRawMaterial
} from '@/api/wms/rawMaterial.js'
export default {
name: "klp-product-select",
props: {
itemType: {
type: String,
},
value: {
type: String
}
},
watch: {
itemType() {
this.$emit('input', undefined)
}
},
mounted() {
listProduct({ pageSize: 9999, pageNum: 1 }).then(res => {
this.products = res.rows
})
listRawMaterial({ pageSize: 9999, pageNum: 1 }).then(res => {
this.raws = res.rows
})
},
computed: {
itemId: {
get() {
this.value
},
set(v) {
this.$emit('input', v)
}
},
localData() {
if (this.itemType == 'raw_material') {
return this.raws.map(item => ({
text: item.rawMaterialName,
value: item.rawMaterialId
}))
} else if (this.itemType == 'product') {
return this.products.map(item => ({
text: item.productName,
value: item.productId
}))
} else {
return []
}
}
},
data() {
return {
raws: [],
products: []
};
},
}
</script>
<style>
</style>