import { supplierAllList } from '@/api/supplier.js' const Employee = { template: ` {{ item.supplierName }} `, props: { value: { type: String, defatut: '' }, id: { type: String, default: '' }, placeholder: { type: String, default: '请选择供应商' }, enableFlag: { type: String, default: '' } }, data() { return { defaultVal: this.value, list: [] }; }, mounted() { this.getList() }, watch: { value(newValue, oldValue) { this.defaultVal = newValue }, }, methods: { filterOption (input, option) { return ( option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0 ) }, handleChange(value) { this.defaultVal = value; const item = this.list.find(item => item.supplierSn == value) this.$emit('change', value, item); this.$emit('input', value); }, getList () { supplierAllList().then(res => { if (res.status == 200) { if(this.enableFlag!=''){ this.list = res.data.filter(item => item.enableFlag == this.enableFlag) }else{ this.list = res.data } } else { this.list = [] } }) }, }, }; export default Employee