import { shelfList } from '@/api/shelf' const shelfSList = { template: ` {{ item.shelfName }} `, props: { value: { type: [String, Array, Object], }, id: { type: String, default: '' }, mode: { type: String, default: 'default' }, showAll: { type: Boolean, default: false } }, data () { return { defaultVal: this.value, shelfList: [] } }, mounted () { this.getShelf() }, watch: { value (newValue, oldValue) { this.defaultVal = newValue } }, methods: { filterOption (input, option) { console.log(input, option) return ( option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0 ) }, handleChange (value) { console.log(value) const row = this.shelfList.find(item => item.shelfSn == value) this.defaultVal = value this.$emit('input', value, row) this.$emit('change', value, row) }, // 货架列表 getShelf () { const params = {pageNo: 1, pageSize: 1000} if(!this.showAll){ params.stateSet = [ 'ENABLE', 'SUSPEND', 'DISABLED' ] } shelfList(params).then(res => { if (res.status == 200) { this.shelfList = res.data && res.data.list ? res.data.list : [] } else { this.shelfList = [] } }) } } } export default shelfSList