|
@@ -23,7 +23,7 @@ const warehouse = {
|
|
|
type: Boolean,
|
|
|
default: false
|
|
|
},
|
|
|
- allowClear:{
|
|
|
+ allowClear: {
|
|
|
type: Boolean,
|
|
|
default: true
|
|
|
},
|
|
@@ -42,6 +42,10 @@ const warehouse = {
|
|
|
modeType: {
|
|
|
type: String,
|
|
|
default: 'default'
|
|
|
+ },
|
|
|
+ isDefault: { // 是否有默认值
|
|
|
+ type: Boolean,
|
|
|
+ default: undefined
|
|
|
}
|
|
|
},
|
|
|
data () {
|
|
@@ -53,7 +57,7 @@ const warehouse = {
|
|
|
}
|
|
|
},
|
|
|
mounted () {
|
|
|
- if(this.isPermission){
|
|
|
+ if (this.isPermission) {
|
|
|
this.$store.state.app.defWarehouse = null
|
|
|
this.$store.state.app.isWarehouse = false
|
|
|
}
|
|
@@ -81,19 +85,28 @@ const warehouse = {
|
|
|
ajaxName({}).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
// 有权限控制的
|
|
|
- if(this.isPermission){
|
|
|
+ if (this.isPermission) {
|
|
|
this.$store.state.app.isWarehouse = res.data && res.data.length > 1
|
|
|
this.$store.state.app.defWarehouse = res.data && res.data[0]
|
|
|
}
|
|
|
this.warehouseData = res.data || []
|
|
|
+ let defaultWarehouseVal = {}
|
|
|
+ if (this.isDefault) {
|
|
|
+ defaultWarehouseVal = res.data.find(con => {
|
|
|
+ return con.defaultFlag == 1 ? con.warehouseSn : ''
|
|
|
+ })
|
|
|
+ this.defaultVal = defaultWarehouseVal.warehouseSn
|
|
|
+ this.$emit('load', defaultWarehouseVal.warehouseSn)
|
|
|
+ } else {
|
|
|
+ this.$emit('load')
|
|
|
+ }
|
|
|
} else {
|
|
|
- if(this.isPermission){
|
|
|
+ if (this.isPermission) {
|
|
|
this.$store.state.app.isWarehouse = false
|
|
|
this.$store.state.app.defWarehouse = null
|
|
|
}
|
|
|
this.warehouseData = []
|
|
|
}
|
|
|
- this.$emit('load')
|
|
|
})
|
|
|
},
|
|
|
clearData () {
|