|
@@ -36,6 +36,13 @@
|
|
|
prop: 'typeId',
|
|
|
event: 'typeSelected'
|
|
|
},
|
|
|
+ watch: {
|
|
|
+ typeId (value) {
|
|
|
+ this.value = value
|
|
|
+ // 检查缺失item
|
|
|
+ this.checkItem(value)
|
|
|
+ }
|
|
|
+ },
|
|
|
data () {
|
|
|
return {
|
|
|
value: '',
|
|
@@ -75,10 +82,13 @@
|
|
|
return
|
|
|
}
|
|
|
data.data.records.forEach(item => {
|
|
|
- this.options.push({
|
|
|
- label: item.name,
|
|
|
- value: item.id
|
|
|
- })
|
|
|
+ let i = this.options.findIndex(a => a.value === item.id)
|
|
|
+ if (i < 0) {
|
|
|
+ this.options.push({
|
|
|
+ label: item.name,
|
|
|
+ value: item.id
|
|
|
+ })
|
|
|
+ }
|
|
|
})
|
|
|
} else {
|
|
|
this.options = []
|
|
@@ -93,11 +103,30 @@
|
|
|
this.getList()
|
|
|
},
|
|
|
onChange (item) {
|
|
|
+ console.log(item)
|
|
|
if (item === 'undefined') {
|
|
|
+ // console.log('m1')
|
|
|
this.value = null
|
|
|
}
|
|
|
this.$emit('typeSelected', item)
|
|
|
},
|
|
|
+ checkItem (code) {
|
|
|
+ if (!code || !this.options) return
|
|
|
+ let i = this.options.findIndex(item => item.value === code)
|
|
|
+ if (i > -1) return
|
|
|
+ // info
|
|
|
+ this.$http({
|
|
|
+ url: this.$http.adornUrl(`/biz-service/wh-category/info/${code}`),
|
|
|
+ method: 'get'
|
|
|
+ }).then(({data}) => {
|
|
|
+ if (data && data.code === '200' && data.data) {
|
|
|
+ this.options.push({
|
|
|
+ label: data.data.name,
|
|
|
+ value: data.data.id
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
cancelReadOnly (onOff) {
|
|
|
this.$nextTick(() => {
|
|
|
if (!onOff) {
|