<template>
|
<!-- <u-card :title="title" > -->
|
<view class="" slot="body">
|
<!-- <view v-for="(item,index) in tree" :key="item.id"> -->
|
<u-grid :col="2">
|
<u-grid-item @tap="clickCoupon(item.url)" v-for="(item) in tree" :key="item.menuId">
|
<u-icon :name="item.icon" custom-prefix="custom-icon" size="50" color="#888888"></u-icon>
|
<view class="grid-text">{{item.menuName}}</view>
|
</u-grid-item>
|
</u-grid>
|
<!-- </view> -->
|
<u-toast ref="uToast" />
|
</view>
|
|
<!-- </u-card> -->
|
</template>
|
|
<script>
|
import {
|
config
|
} from '../../common/config.js'
|
export default {
|
data() {
|
return {
|
// title: '操作功能'
|
datas: [],
|
tree: [],
|
warehouseId: "",
|
version: ""
|
}
|
},
|
onShow() {
|
|
},
|
onLoad(res) {
|
// var id = this.$mp.query.id;
|
// this.warehouseId = this.$mp.query.warehouseId;
|
this.warehouseId = res.warehouseId;
|
uni.setNavigationBarTitle({
|
title: res.menuName
|
});
|
this.getCurrentTree(res.menuId);
|
},
|
mounted() {
|
|
},
|
methods: {
|
getCurrentTree(id) {
|
this.$u.post('/api/Sys_Menu/GetTreeMenuPDAStash?ParentId=' + id, {}).then(result => {
|
this.tree = result;
|
})
|
},
|
getTree(id, data, isRootId) {
|
this.datas.forEach((x) => {
|
if (x.pid == id) {
|
x.lv = data.lv + 1;
|
if (isRootId) {
|
x.rootId = id;
|
}
|
if (!data.children) data.children = [];
|
data.children.push(x);
|
this.getTree(x.id, x, isRootId);
|
}
|
});
|
},
|
getPermission(text) {
|
// return true;
|
return this.datas.find(x => x.text == text);
|
},
|
clickCoupon(url) {
|
var _this = this;
|
if (url == "出空托") {
|
uni.showModal({
|
title: '提示!',
|
content: '是否确定空托出库?',
|
success: function(res) {
|
if (res.confirm) {
|
_this.PdaOutEmpty()
|
//console.log('确认')
|
} else if (res.cancel) {
|
// console.log('取消')
|
}
|
}
|
})
|
} else if (url == "入库放货完成") {
|
uni.showModal({
|
title: '提示!',
|
content: '是否确定放货完成?',
|
success: function(res) {
|
if (res.confirm) {
|
_this.ReleaseCompleted()
|
//console.log('确认')
|
} else if (res.cancel) {
|
// console.log('取消')
|
}
|
}
|
})
|
}
|
// console.log("clickCoupon")
|
else if (this.hasLogin()) {
|
// this.$u.route(url)
|
this.$u.route({
|
url: url,
|
params: {
|
warehouseId: this.warehouseId
|
}
|
})
|
} else {
|
this.$t.message.loading('登录失效请重新登录')
|
uni.reLaunch({
|
url: '/pages/login/login'
|
});
|
}
|
},
|
PdaOutEmpty() {
|
this.$u.post('/api/PDA/OutEmpty').then(
|
res => {
|
if (res.status) {
|
this.$refs.uToast.show({
|
title: "空托出库成功",
|
type: "success"
|
})
|
this.qty = "";
|
} else {
|
this.$refs.uToast.show({
|
title: res.message,
|
type: "error"
|
})
|
}
|
})
|
},
|
ReleaseCompleted() {
|
this.$u.post('http://192.168.10.88:8099/api/AGV/ReleaseCompleted').then(
|
res => {
|
if (res.status) {
|
this.$refs.uToast.show({
|
title: "放货完成成功",
|
type: "success"
|
})
|
this.qty = "";
|
} else {
|
this.$refs.uToast.show({
|
title: res.message,
|
type: "error"
|
})
|
}
|
})
|
},
|
lock() {
|
console.log("lock")
|
if (this.hasLogin()) {
|
this.$u.route("pages/feeding/feeding")
|
} else {
|
this.$t.message.loading('登录失效请重新登录')
|
uni.reLaunch({
|
url: '/pages/login/login'
|
});
|
}
|
},
|
|
//判断是否登录
|
hasLogin() {
|
let haslogin = uni.getStorageSync('jo_user')
|
if (haslogin == null || haslogin == "") {
|
return false
|
} else {
|
return true
|
}
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
.grid-text {
|
font-size: 28rpx;
|
margin-top: 4rpx;
|
color: $u-type-info;
|
}
|
</style>
|