自动填入单位
This commit is contained in:
@@ -4,8 +4,6 @@
|
||||
:placeholder="placeholder"
|
||||
filterable
|
||||
clearable
|
||||
remote
|
||||
:remote-method="debouncedRemoteMethod"
|
||||
:loading="loading"
|
||||
@change="onChange"
|
||||
style="width: 100%"
|
||||
@@ -67,25 +65,19 @@ export default {
|
||||
this.fetchOptions("");
|
||||
},
|
||||
methods: {
|
||||
fetchOptions(keyword) {
|
||||
fetchOptions() {
|
||||
this.loading = true;
|
||||
listRawMaterial({ pageNum: 1, pageSize: 10, rawMaterialName: keyword }).then(res => {
|
||||
listRawMaterial({ pageNum: 1, pageSize: 9999 }).then(res => {
|
||||
this.options = res.rows || [];
|
||||
this.loading = false;
|
||||
}).catch(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
remoteMethod(keyword) {
|
||||
this.fetchOptions(keyword);
|
||||
async onChange(val) {
|
||||
const rawMaterial = this.options.find(p => p.rawMaterialId === val);
|
||||
this.$emit('change', rawMaterial);
|
||||
},
|
||||
debouncedRemoteMethod: debounce(function(keyword) {
|
||||
this.remoteMethod(keyword);
|
||||
}, 400),
|
||||
onChange(val) {
|
||||
this.$emit("input", val);
|
||||
this.$emit("change", val);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user