Commit cc8bc5f0 authored by wangdanlei's avatar wangdanlei

三期出库仓库自定义组件

parent 355b5860
<template> <template>
<div> <div>
<el-select v-model="form.warehouse"> <el-select v-model="form.extWorkCenterId">
<el-option <el-option
v-for="(item,i) in warehouseOptions" v-for="(item,i) in warehouseOptions"
:key="i" :key="i"
:label="item.typeName" :label="item.extname"
:value="item.id" :value="item.id"
/> />
</el-select> </el-select>
...@@ -23,14 +23,19 @@ export default { ...@@ -23,14 +23,19 @@ export default {
data() { data() {
return { return {
warehouseOptions: [], warehouseOptions: [],
areaList: [] areaList: [],
isFirst: true
} }
}, },
computed: {}, computed: {},
watch: { watch: {
async 'form.warehouse'() { async 'form.extProductArea.id'() {
this.$set(this.form, 'extWorkCenterId', this.form.extWorkCenterId || '')
if (!this.isFirst) {
this.$set(this.form, 'extWorkCenterId', '')
}
if (this.areaList.length) { if (this.areaList.length) {
// this.findWarehouse()
} else { } else {
await this.searchApi() await this.searchApi()
} }
...@@ -47,10 +52,16 @@ export default { ...@@ -47,10 +52,16 @@ export default {
}, },
methods: { methods: {
async searchApi() { async searchApi() {
this.isFirst = false
const params = { 'openProps': [{ 'name': 'extDxProductWorkCenters' }] } const params = { 'openProps': [{ 'name': 'extDxProductWorkCenters' }] }
await this.$utils.searchApi('ExtDxProductArea', params).then(res => { await this.$api.searchApi('ExtDxProductArea', params).then(res => {
this.areaList = res.items.content this.areaList = res.items.content
this.findWarehouse()
}) })
},
findWarehouse() {
const warehouse = this.areaList.find(item => item.id === this.form.extProductArea.id)
this.warehouseOptions = warehouse.extDxProductWorkCenters
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment