143 lines
3.1 KiB
Vue
143 lines
3.1 KiB
Vue
<template>
|
|
<view>
|
|
<view
|
|
class="status_bar"
|
|
v-if="isStartBar">
|
|
<!-- 这里是状态栏 -->
|
|
</view>
|
|
<u-tabbar
|
|
:value="current"
|
|
@change="changeTab"
|
|
:fixed="true"
|
|
:placeholder="false"
|
|
:safeAreaInsetBottom="true"
|
|
:border="false"
|
|
activeColor="#0095FF"
|
|
inactiveColor="#000000">
|
|
<u-tabbar-item
|
|
v-for="(item, index) in tabBarList"
|
|
:key="index"
|
|
:text="item.text"
|
|
:badge="item.text === '审批' ? doingTotal : 0">
|
|
<image
|
|
class="u-page__item__slot-icon"
|
|
slot="inactive-icon"
|
|
:src="item.iconPath"></image>
|
|
<image
|
|
class="u-page__item__slot-icon"
|
|
slot="active-icon"
|
|
:src="item.selectedIconPath"></image>
|
|
</u-tabbar-item>
|
|
</u-tabbar>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import { mapGetters } from "vuex";
|
|
export default {
|
|
name: "tabBar",
|
|
props: {
|
|
currentPage: String,
|
|
isStartBar: Boolean,
|
|
},
|
|
data() {
|
|
return {
|
|
current: 0,
|
|
};
|
|
},
|
|
computed: {
|
|
...mapGetters(["tabBarList", "doingTotal"]),
|
|
},
|
|
methods: {
|
|
changeTab(e) {
|
|
let page = "/" + this.tabBarList[e].pagePath;
|
|
uni.switchTab({
|
|
url: page,
|
|
success: (res) => {
|
|
console.log(res);
|
|
|
|
},
|
|
fail: (e) => {
|
|
console.log(e);
|
|
},
|
|
});
|
|
},
|
|
//获取审批列表
|
|
async getAppList() {
|
|
let data = {
|
|
ApplyUserID: uni.getStorageSync("oa-userInfo").ID,
|
|
Page: 1,
|
|
PageSize: 9999,
|
|
applyStatus: [1],
|
|
applyType: [
|
|
"leave",
|
|
"sick",
|
|
"dayOff",
|
|
"annualLeave",
|
|
"annualLeaveApply",
|
|
"maritalLeave",
|
|
"maritalLeaveApply",
|
|
"matingCheckLeave",
|
|
"matingCheckLeaveApply",
|
|
"maternityLeave",
|
|
"maternityLeaveApply",
|
|
"paternityLeave",
|
|
"paternityLeaveApply",
|
|
"parentalLeave",
|
|
"parentalLeaveApply",
|
|
"nursingLeave",
|
|
"nursingLeaveApply",
|
|
"funeralLeave",
|
|
"funeralLeaveApply",
|
|
"makeUp",
|
|
"overtime",
|
|
"outWork",
|
|
"turnOver",
|
|
],
|
|
};
|
|
let res = await this.$api.approval.approvalList(data);
|
|
if (res.status == 0) {
|
|
// 存储待审批数量
|
|
this.$store.commit("getDoingTotal", res.data.Total);
|
|
console.log(this.doingTotal);
|
|
|
|
} else {
|
|
uni.$u.toast(res.msg);
|
|
}
|
|
},
|
|
},
|
|
created() {
|
|
//隐藏原生tabbar
|
|
uni.hideTabBar();
|
|
// 当前选中的菜单
|
|
this.getAppList();
|
|
this.tabBarList.forEach((i, index) => {
|
|
if (i.pagePath == this.currentPage) {
|
|
this.current = index;
|
|
}
|
|
});
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.status_bar {
|
|
height: var(--status-bar-height);
|
|
width: 100%;
|
|
background: #fff;
|
|
}
|
|
.u-page__item__slot-icon {
|
|
width: 68rpx;
|
|
height: 68rpx;
|
|
}
|
|
.u-tabbar /deep/ .u-tabbar--fixed {
|
|
width: 92%;
|
|
padding: 9px;
|
|
background: #fff;
|
|
background-size: 100% 100%;
|
|
bottom: 10px;
|
|
left: 1.7%;
|
|
border-radius: 20rpx;
|
|
}
|
|
</style>
|