<a-form-model-item label="物料" prop="MaterialId"> <a-select v-model="entity.MaterialId" allowClear @select="onMaterialChanged"> <a-select-option v-for="item in MaterialList" :key="item.Id" :value="item.Id">{{ item.MaterialNumber }}</a-select-option> </a-select> </a-form-model-item>
data() { return {
entity: {},
MaterialList: [], } }, methods: { init() { this.loading = true this.$http .post('/Base_Manage/Base_Material/GetDataList', { PageIndex: 1, PageRows: 1000, SortField: 'Id', SortType: '', Search: this.queryParam, ...this.filters, }) .then((resJson) => { this.loading = false this.MaterialList = resJson.Data }) },
onMaterialChanged(obj) {
var item = this.MaterialList.find((p) => {
if (p.Id == obj) {
return p
}
})
this.entity.MaterialNumber=item.MaterialNumber
this.entity.MaterialName=item.MaterialName
}
}