|
|
|
@ -44,9 +44,7 @@
|
|
|
|
|
<router-link to="/">{{ $t('navbar.dashboard') }}</router-link> |
|
|
|
|
</el-dropdown-item> |
|
|
|
|
<el-dropdown-item> |
|
|
|
|
<div @click="showcl(true)"> |
|
|
|
|
切换仓库 |
|
|
|
|
</div> |
|
|
|
|
<div @click="showcl(true)">切换仓库</div> |
|
|
|
|
</el-dropdown-item> |
|
|
|
|
<el-dropdown-item> |
|
|
|
|
<router-link to="/info/index">{{ $t('navbar.userinfo') }}</router-link> |
|
|
|
@ -62,19 +60,19 @@
|
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
<el-dialog v-model="isshow" title="切换仓库" width="30%"> |
|
|
|
|
<div style="display: flex;flex-direction: column;align-items: center;"> |
|
|
|
|
<div style="display: flex; flex-direction: column; align-items: center"> |
|
|
|
|
<el-select class="selecin" v-model="warehousevalue" placeholder="请选择切换的仓库"> |
|
|
|
|
<el-option |
|
|
|
|
v-for="(item,index) in datalist" |
|
|
|
|
v-for="(item, index) in datalist" |
|
|
|
|
:key="item.id" |
|
|
|
|
:label="item.name" |
|
|
|
|
:value="index" |
|
|
|
|
/> |
|
|
|
|
</el-select> |
|
|
|
|
<div class="copnbx"> |
|
|
|
|
<el-button @click="showcl(false)">取消</el-button> |
|
|
|
|
<el-button type="primary" @click="confirmcks">确认</el-button> |
|
|
|
|
</div> |
|
|
|
|
<div class="copnbx"> |
|
|
|
|
<el-button @click="showcl(false)">取消</el-button> |
|
|
|
|
<el-button type="primary" @click="confirmcks">确认</el-button> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</el-dialog> |
|
|
|
|
</template> |
|
|
|
@ -88,7 +86,11 @@ import topLogs from './top-logs.vue';
|
|
|
|
|
import topLang from './top-lang.vue'; |
|
|
|
|
import topFull from './top-full.vue'; |
|
|
|
|
import topSetting from '../setting.vue'; |
|
|
|
|
import { getMyWarehouseList , preserveCurrentWarehouse } from '@/api/work/work' |
|
|
|
|
import { |
|
|
|
|
getMyWarehouseList, |
|
|
|
|
preserveCurrentWarehouse, |
|
|
|
|
getclearWarehouseCache, |
|
|
|
|
} from '@/api/work/work'; |
|
|
|
|
|
|
|
|
|
export default { |
|
|
|
|
components: { |
|
|
|
@ -104,14 +106,12 @@ export default {
|
|
|
|
|
name: 'top', |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
|
isshow:false, |
|
|
|
|
datalist:[], |
|
|
|
|
warehousevalue:'' |
|
|
|
|
isshow: false, |
|
|
|
|
datalist: [], |
|
|
|
|
warehousevalue: '', |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
mounted(){ |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
mounted() {}, |
|
|
|
|
filters: {}, |
|
|
|
|
created() {}, |
|
|
|
|
computed: { |
|
|
|
@ -128,22 +128,40 @@ export default {
|
|
|
|
|
]), |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
async confirmcks(){ |
|
|
|
|
if(typeof this.warehousevalue !='number'){ |
|
|
|
|
return |
|
|
|
|
async confirmcks() { |
|
|
|
|
if (typeof this.warehousevalue != 'number') { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
console.log(this.warehousevalue) |
|
|
|
|
let res=await preserveCurrentWarehouse(this.datalist[this.warehousevalue]) |
|
|
|
|
if(res.data.code==200){ |
|
|
|
|
this.$message({message:'切换成功',type:'success'}) |
|
|
|
|
this.$router.push({ |
|
|
|
|
path:'/' |
|
|
|
|
}) |
|
|
|
|
setTimeout(() => { |
|
|
|
|
window.location.reload(); |
|
|
|
|
}, 1000); |
|
|
|
|
}else{ |
|
|
|
|
this.$message({message:res.data.msg,type:'error'}) |
|
|
|
|
console.log(this.warehousevalue); |
|
|
|
|
if ( |
|
|
|
|
this.datalist[this.warehousevalue].id == '0' && |
|
|
|
|
this.datalist[this.warehousevalue].name == '全部' |
|
|
|
|
) { |
|
|
|
|
let res = await getclearWarehouseCache({}); |
|
|
|
|
if (res.data.code == 200) { |
|
|
|
|
this.$message({ message: '切换成功', type: 'success' }); |
|
|
|
|
this.$router.push({ |
|
|
|
|
path: '/', |
|
|
|
|
}); |
|
|
|
|
setTimeout(() => { |
|
|
|
|
window.location.reload(); |
|
|
|
|
}, 1000); |
|
|
|
|
} else { |
|
|
|
|
this.$message({ message: res.data.msg, type: 'error' }); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
let res = await preserveCurrentWarehouse(this.datalist[this.warehousevalue]); |
|
|
|
|
if (res.data.code == 200) { |
|
|
|
|
this.$message({ message: '切换成功', type: 'success' }); |
|
|
|
|
this.$router.push({ |
|
|
|
|
path: '/', |
|
|
|
|
}); |
|
|
|
|
setTimeout(() => { |
|
|
|
|
window.location.reload(); |
|
|
|
|
}, 1000); |
|
|
|
|
} else { |
|
|
|
|
this.$message({ message: res.data.msg, type: 'error' }); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
setCollapse() { |
|
|
|
@ -160,13 +178,14 @@ export default {
|
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
showcl(flg){ |
|
|
|
|
this.isshow=flg |
|
|
|
|
if(this.isshow){ |
|
|
|
|
getMyWarehouseList().then(res=>{ |
|
|
|
|
console.log(res.data.data,'getMyWarehouseList') |
|
|
|
|
this.datalist=res.data.data |
|
|
|
|
}) |
|
|
|
|
showcl(flg) { |
|
|
|
|
this.isshow = flg; |
|
|
|
|
if (this.isshow) { |
|
|
|
|
getMyWarehouseList().then(res => { |
|
|
|
|
console.log(res.data.data, 'getMyWarehouseList'); |
|
|
|
|
let arr = [{ name: '全部', id: '0' }]; |
|
|
|
|
this.datalist = arr.concat(res.data.data); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
@ -174,14 +193,14 @@ export default {
|
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped> |
|
|
|
|
.copnbx{ |
|
|
|
|
margin-top: 30px; |
|
|
|
|
button{ |
|
|
|
|
width: 120px; |
|
|
|
|
height: 40px; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
.selecin{ |
|
|
|
|
width: 60%; |
|
|
|
|
.copnbx { |
|
|
|
|
margin-top: 30px; |
|
|
|
|
button { |
|
|
|
|
width: 120px; |
|
|
|
|
height: 40px; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
.selecin { |
|
|
|
|
width: 60%; |
|
|
|
|
} |
|
|
|
|
</style> |
|
|
|
|