Browse Source

切换仓库

fix_bug_pro20231227
zhangsiyu 2 years ago
parent
commit
2b5f1ed467
  1. 16
      src/api/work/work.js
  2. 70
      src/page/index/top/index.vue

16
src/api/work/work.js

@ -77,3 +77,19 @@ export const completeTask = data => {
data,
});
};
export const getMyWarehouseList = data => {
return request({
url: '/api/logpm-basicdata/warehouse/getMyWarehouseList',
method: 'get',
data,
});
};
export const preserveCurrentWarehouse = data => {
return request({
url: '/api/logpm-basicdata/warehouse/preserveCurrentWarehouse',
method: 'post',
data,
});
};

70
src/page/index/top/index.vue

@ -43,6 +43,11 @@
<el-dropdown-item>
<router-link to="/">{{ $t('navbar.dashboard') }}</router-link>
</el-dropdown-item>
<el-dropdown-item>
<div @click="showcl(true)">
切换仓库
</div>
</el-dropdown-item>
<el-dropdown-item>
<router-link to="/info/index">{{ $t('navbar.userinfo') }}</router-link>
</el-dropdown-item>
@ -56,6 +61,22 @@
</div>
</div>
</div>
<el-dialog v-model="isshow" title="切换仓库" width="30%">
<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"
: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>
</el-dialog>
</template>
<script>
import { mapGetters } from 'vuex';
@ -67,6 +88,7 @@ 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'
export default {
components: {
@ -81,10 +103,14 @@ export default {
},
name: 'top',
data() {
return {};
return {
isshow:false,
datalist:[],
warehousevalue:''
};
},
mounted(){
},
filters: {},
created() {},
@ -102,6 +128,24 @@ export default {
]),
},
methods: {
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'})
}
},
setCollapse() {
this.$store.commit('SET_COLLAPSE');
},
@ -116,8 +160,28 @@ export default {
});
});
},
showcl(flg){
this.isshow=flg
if(this.isshow){
getMyWarehouseList().then(res=>{
console.log(res.data.data,'getMyWarehouseList')
this.datalist=res.data.data
})
}
},
},
};
</script>
<style lang="scss" scoped></style>
<style lang="scss" scoped>
.copnbx{
margin-top: 30px;
button{
width: 120px;
height: 40px;
}
}
.selecin{
width: 60%;
}
</style>

Loading…
Cancel
Save