hn_ldlz/ldlz-H5/pages/index.vue

832 lines
20 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<page-meta :page-font-size="$store.state.vuex_fontsize+'px'" :root-font-size="$store.state.vuex_fontsize+'px'"></page-meta>
<view class="home">
<!-- <view>
<custom-navigation-bar title="安全履职" :name="userName"></custom-navigation-bar>
</view> -->
<!-- 通知轮播消息 -->
<view class='notice' v-if='projectNotice' style='margin-bottom: 10px;'>
<uni-notice-bar :direction="'row'" :step="true" :duration="1000" show-icon scrollable background-color="#fafafa" color="#b3b3b3" :text="notice"
@click="toNoticeDetail" />
<!-- <u-notice-bar type="error" :list="noticeList" mode='horizontal' :is-circular='false' :volume-icon='true'
font-size='30rpx' padding='8rpx 8rpx' @click="noticeClick"></u-notice-bar> -->
</view>
<!-- 顶部 -->
<view class="top">
<view class="top-icon">
<uni-grid :column="3" :showBorder="false" :square="false">
<uni-grid-item>
<view class="icon-a color1" @click="clickGrid(1)">
<uni-icons type="wallet" size="30" style="color:#ffffff"></uni-icons>
</view>
<view class="grid-text">手册预览</view>
</uni-grid-item>
<uni-grid-item>
<view class="icon-a color2" @click="clickGrid(2)">
<uni-icons type="locked" size="30" style="color:#ffffff"></uni-icons>
</view>
<view class="grid-text">安全履职</view>
</uni-grid-item>
<uni-grid-item>
<view class="icon-a color3" @click="clickGrid(3)">
<uni-icons type="calendar" size="30" style="color:#ffffff"></uni-icons>
</view>
<view class="grid-text">履职记录</view>
</uni-grid-item>
<uni-grid-item>
<view class="icon-a color4" @click="clickGrid(4)">
<uni-icons type="compose" size="30" style="color:#ffffff"></uni-icons>
</view>
<view class="grid-text">问题记录</view>
</uni-grid-item>
<uni-grid-item>
<view class="icon-a color5" @click="qj(0)">
<uni-icons type="calendar" size="30" style="color:#ffffff"></uni-icons>
</view>
<view class="grid-text">请假</view>
</uni-grid-item>
<uni-grid-item>
<view class="icon-a color6" @click="clickGrid(6)">
<uni-icons type="gear" size="30" style="color:#ffffff"></uni-icons>
</view>
<view class="grid-text">设置</view>
</uni-grid-item>
</uni-grid>
</view>
</view>
<!-- 履职标准 -->
<view class='box-div' style='margin-top: 10px;margin-bottom: 10px;'>
<view class="box-div-title">
<view class="box-div-left">
<view class="box-div-left-title">履职标准</view>
</view>
<view class="box-div-right">
<month-picker-vue @chang="getTjDate"></month-picker-vue>
<!-- <month-picker-vue :years="years" :echo-val="echoVal" :years-index1="yearsIndex1" :years-index2="yearsIndex2"></month-picker-vue> -->
<!-- <picker :range="years" :value="echoVal" @change="yearChange" mode="multiSelector">
{{ years[0][yearsIndex1] }}-{{ years[1][yearsIndex2] }}
</picker> -->
</view>
</view>
<view class="lztj-box">
<view class="lztj-div lztj-1">
<view class="lztj-title lztj-title1">现场履职</view>
<view class="lztj-content">
<view>实到</view>
<view class="lztj-num lztj-num1">{{lztj.real_xclz_num}}</view>
<view class="lztj2-num">{{lztj.xclz_unit_type}}</view>
</view>
</view>
<view class="lztj-div lztj-2">
<view class="lztj-title lztj-title2">班组履职</view>
<view class="lztj-content">
<view>实到</view>
<view class="lztj-num lztj-num2">{{lztj.real_bzlz_num}}</view>
<view class="lztj2-num">{{lztj.bzlz_unit_type}}</view>
</view>
</view>
<view class="lztj-div lztj-3">
<view class="lztj-title lztj-title3">发现问题</view>
<view class="lztj-content" @click="clickGrid(4)">
<view class="lztj-num lztj-num3">{{lztj.problemNum}}</view>
<view class="lztj2-num lztj-num3"></view>
</view>
</view>
</view>
<view class="box-div-left-tip">
*单日督察多个现场统计为1次
</view>
</view>
<!-- 履职排名 -->
<view class='box-div' style='margin-bottom: 10px;min-height: 60vh;'>
<view class="box-div-title">
<view class="box-div-left">
<view class="box-div-left-title">履职排名</view>
</view>
<view class="box-div-right">
<!-- <month-picker-vue @chang="getPmDate"></month-picker-vue> -->
</view>
</view>
<view class="lzpm-box">
<view class="uni-padding-wrap uni-common-mt">
<uni-segmented-control :current="current" :values="items" style-type="text" activeColor="#00b27b"
@clickItem="onClickItem" />
</view>
<view class="lzpm-content">
<view class="lzpm-box1" v-if="current === 0">
<view class="lzpm-box1-title">
<view class="lzpm-box1-title-font" style="width: 12%;">排名</view>
<view class="lzpm-box1-title-font" style="width: 20%;">姓名</view>
<view class="lzpm-box1-title-font" style="width: 19%;">应履职</view>
<view class="lzpm-box1-title-font" style="width: 19%;">已履职</view>
<view class="lzpm-box1-title-font" style="width: 30%;">履职进度</view>
</view>
<view class="lzpm-box1-list">
<view class="lzpm-box1-one" v-if="mySelf && mySelf.pm!=1">
<view class="box1-one box1-one-font" style="width: 12%;">
<view class="box1-one-pm"
:class="{'box-pm-color1':mySelf.pm==1,'box-pm-color2':mySelf.pm==2,'box-pm-color3':mySelf.pm==3,'box-pm-color4':mySelf.pm>3}">
{{mySelf.pm}}
</view>
</view>
<view class="box1-one box1-one-font">
{{mySelf.nickName}}
</view>
<view class="box1-one box1-one-font">
{{mySelf.lzTotal}}{{mySelf.bzlzUnitType}}
</view>
<view class="box1-one box1-one-font">
{{mySelf.reallzNum}}{{mySelf.bzlzUnitType||''}}
</view>
<view>
<u-line-progress style="width: 70px;" v-if="mySelf.pm==1"
:percentage="mySelf.lzBfb" activeColor="#ff3232" :showText="false">
</u-line-progress>
<u-line-progress style="width: 70px;" v-if="mySelf.pm==2"
:percentage="mySelf.lzBfb" activeColor="#ff9800" :showText="false">
</u-line-progress>
<u-line-progress style="width: 70px;" v-if="mySelf.pm==3"
:percentage="mySelf.lzBfb" activeColor="#ffd200" :showText="false">
</u-line-progress>
<u-line-progress style="width: 70px;" v-if="mySelf.pm>3"
:percentage="mySelf.lzBfb" activeColor="#00b37d" :showText="false">
</u-line-progress>
</view>
<view style="font-size: 13px;margin-left: 5px;">
{{formatBFb(mySelf.lzBfb)}}%
</view>
</view>
<view class="lzpm-box1-one" v-for="(item,index) in indexList" :key="index"
:style="'background-color:'+(((index+1)%2==0)?'#fff':'#fff')">
<view style="width: 35px;">
<view class="box1-one-pm"
:class="{'box-pm-color1':item.pm==1,'box-pm-color2':item.pm==2,'box-pm-color3':item.pm==3,'box-pm-color4':item.pm>3}">
{{item.pm}}
</view>
</view>
<view class="box1-one box1-one-font">
{{item.nickName}}
</view>
<view class="box1-one box1-one-font">
{{item.lzTotal}}{{item.bzlzUnitType||''}}
</view>
<view class="box1-one box1-one-font">
{{item.reallzNum}}{{item.bzlzUnitType||''}}
</view>
<view>
<u-line-progress style="width: 70px;" v-if="item.pm==1" :percentage="item.lzBfb"
activeColor="#ff3232" :showText="false"></u-line-progress>
<u-line-progress style="width: 70px;" v-if="item.pm==2" :percentage="item.lzBfb"
activeColor="#ff9800" :showText="false"></u-line-progress>
<u-line-progress style="width: 70px;" v-if="item.pm==3" :percentage="item.lzBfb"
activeColor="#ffd200" :showText="false"></u-line-progress>
<u-line-progress style="width: 70px;" v-if="item.pm>3" :percentage="item.lzBfb"
activeColor="#00b37d" :showText="false"></u-line-progress>
</view>
<view style="font-size: 13px;margin-left: 5px;">
{{formatBFb(item.lzBfb)}}%
</view>
</view>
</view>
</view>
<view class="lzpm-box2" v-if="current === 1">
<view class="lzpm-box2-title">
<view class="lzpm-box2-title-font" style="width: 12%;">排名</view>
<view class="lzpm-box2-title-font" style="width: 28%;">分公司</view>
<view class="lzpm-box2-title-font">应履职</view>
<view class="lzpm-box2-title-font">已履职</view>
<view class="lzpm-box2-title-font">履职率</view>
</view>
<view class="lzpm-box2-list">
<view class="lzpm-box2-one" v-for="(item,index) in indexList2" :key="index"
:style="'background-color:'+(((index+1)%2==0)?'#fff':'#fff') ">
<view style="width: 12%;">
<view class="box2-one-pm"
:class="{'box-pm-color1':item.pm==1,'box-pm-color2':item.pm==2,'box-pm-color3':item.pm==3,'box-pm-color5':item.pm>3}">
{{item.pm}}
</view>
</view>
<view style="width: 88%;">
<view style="display: flex;">
<view style="width: 34%;text-align: left;">
{{item.postName}}
</view>
<view class="box2-one">
{{item.lzNum}}{{item.bzlzUnitType||''}}
</view>
<view class="box2-one">
{{item.realLzNum}}{{item.bzlzUnitType||''}}
</view>
<view>
{{formatBFb(item.lzBfb)}}%
</view>
</view>
<view>
<progress stroke-width="3" v-if="item.pm==1" :percent="item.lzBfb"
activeColor="#ff3232" :showText="false" />
<progress stroke-width="3" v-if="item.pm==2" :percent="item.lzBfb"
activeColor="#ff9800" :showText="false" />
<progress stroke-width="3" v-if="item.pm==3" :percent="item.lzBfb"
activeColor="#ffd200" :showText="false" />
<progress stroke-width="3" v-if="item.pm>3" :percent="item.lzBfb"
activeColor="#00b37d" :showText="false" />
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import CustomNavigationBar from '@/components/CustomNavigationBar.vue'
import MonthPickerVue from '../components/MonthPicker.vue';
// import { getNoticAll, } from "../../api/index.js";
import {
performSetUserInfo,
performUserRank,
performDeptRank,
noticeList
} from '@/api/handbook.js'
import {
getUserProfile
} from "@/api/system/user"
export default {
components: {
CustomNavigationBar,
MonthPickerVue
},
data() {
return {
indexList: [],
mySelf: "",
indexList2: [],
projectNotice: [
],
// years: [],
// yearsIndex1: 0,
// yearsIndex2: 0,
// echoVal: [], //当前日期回显
items: ['个人', '单位'],
current: 0,
lztj: {
bzlz_unit_type: "",
problemNum: 0,
real_bzlz_num: 0,
real_xclz_num: 0,
xclz_unit_type: ""
},
notice: "",
noticeId: "",
noticeIndex: 0,
noticesList: [],
nTimeId: "",
userName: "",
dateTime:"",
}
},
onShow() {
this.getNotice();
if(this.dateTime){
this.getTjDate(this.dateTime)
}
// for (let i = 0; i < 30; i++) {
// this.indexList.push({
// url: this.urls[uni.$u.random(0, this.urls.length - 1)]
// })
// }
},
onLoad() {
const _this = this;
this.getUser();
},
methods: {
formatBFb(value) {
if (value == null || value == '' || value == 0) {
return 0;
} else if (value == 100) {
return 100
} else {
return parseFloat(value).toFixed(1);
}
},
getUser() {
getUserProfile().then(response => {
this.userName = response.data.nickName
uni.setNavigationBarTitle({
title: '安全履职-'+this.userName
});
})
},
getTjDate(e) {
this.dateTime=e;
console.log(e);
performSetUserInfo({
yyyyMM: e
}).then(res => {
if (res.code == 200) {
this.lztj = res.data;
} else {
this.lztj = {
bzlz_unit_type: "",
problemNum: 0,
real_bzlz_num: 0,
real_xclz_num: 0,
xclz_unit_type: ""
}
}
})
this.performUserRank(e);
this.performDeptRank(e);
},
getPmDate(e) {
console.log(e);
},
performUserRank(e) {
this.indexList = [];
performUserRank({
yyyymm: e
}).then(res => {
if (res.code == 200) {
this.mySelf = "";
res.rows.forEach((item, index) => {
if (item.userSelf == 1) {
item.pm = index + 1;
this.mySelf = item;
}
item.pm = index + 1;
this.indexList.push(item)
})
}
})
},
performDeptRank(e) {
this.indexList2 = [];
performDeptRank({
yyyymm: e
}).then(res => {
if (res.code == 200) {
res.rows.forEach((item, index) => {
item.pm = index + 1;
this.indexList2.push(item)
})
}
})
},
clickGrid(e) {
if (e == 1) {
// this.$tab.reLaunch('/pages/aqsc/index')
uni.navigateTo({
url: '/pages/aqsc/index'
})
} else if (e == 2) {
uni.navigateTo({
url: '/pages/aqlz/index'
})
} else if (e == 3) {
uni.navigateTo({
url: '/pages/lzjl/index'
})
} else if (e == 4) {
uni.navigateTo({
url: '/pages/wtjl/index'
})
}else if (e == 6) {
uni.navigateTo({
url: '/pages/mine/setting/index'
})
}
},
onClickItem(e) {
if (this.current !== e.currentIndex) {
this.current = e.currentIndex
}
},
onAnimationFinish() {
const nextIndex = (this.notices.indexOf(this.noticeText) + 1) % this.notices.length;
this.noticeText = this.notices[nextIndex];
},
getNotice() {
noticeList().then(res => {
this.noticesList = res.rows;
this.noticeId = this.noticesList[this.noticeIndex].noticeId;
this.notice = this.noticesList[this.noticeIndex].noticeTitle;
this.noticeIndex++;
if (this.nTimeId) {
clearInterval(this.nTimeId)
}
this.nTimeId = setInterval(() => {
if (this.noticeIndex >= this.noticesList.length - 1) {
this.noticeIndex = 0;
}
this.noticeId = this.noticesList[this.noticeIndex].noticeId;
this.notice = this.noticesList[this.noticeIndex].noticeTitle;
this.noticeIndex++;
}, 6000)
})
// getNoticAll({
// isShow: 0
// }).then(res => {
// if (res.code == 0) {
// this.projectNotice = []
// this.noticeList = []
// res.lists.forEach((item, index, ) => {
// this.projectNotice.push(item)
// this.noticeList.push(item.title)
// })
// } else {
// this.projectNotice = []
// this.noticeList = []
// }
// }).catch(e => {
// });
},
toNoticeDetail() {
uni.navigateTo({
url: "/pages/notice/noticeDetail?id=" + this.noticeId
})
},
// 获取轮播图的点击索引
noticeClick(index) {
if (this.mode == 'horizontal' && this.isCircular) {
console.log('此模式无法获取Index值');
} else {
console.log(`点击了第${index }条消息`);
// var noticeId = this.projectNotice[index].id
// uni.navigateTo({
// url: '/pages/home/notice?id=' + noticeId
// })
}
},
qj(index) {
uni.navigateTo({
url: '/pages/qj/index?current=' + index
})
},
}
}
</script>
<style lang="scss" scoped>
.home {
margin-top: 1px;
padding-bottom: 1px;
}
.top {
padding: 10px 10px 0 10px;
/deep/ .uni-grid-item__box {
display: flex;
justify-content: center;
/* 水平居中 */
align-items: center;
}
.uni-grid-item__box {
justify-content: center;
align-items: center;
}
.icon-a {
display: flex;
justify-content: center;
align-items: center;
background-color: #D9292B;
width: 40px;
height: 40px;
text-align: center;
border-radius: 30%;
}
.grid-text {
font-size: 13px;
font-weight: bold;
margin-top: 5px;
margin-bottom: 10px;
}
.color1 {
background: linear-gradient(to top, #4861F0, #53BEFC);
}
.color2 {
background: linear-gradient(to top, #41BAFE, #12e5fe);
}
.color3 {
background: linear-gradient(to top, #26E3AE, #0DB1E7);
}
.color4 {
background: linear-gradient(to top, #FF3F56, #FF8649);
}
.color5 {
background: linear-gradient(to top, #ff55ff, #ffaaff);
}
.color6 {
background: linear-gradient(to top, #00aaff, #55aaff);
}
}
.notice {
width: 100%;
margin: 0 auto;
/deep/ .uni-noticebar {
margin-top: 10px;
padding: 4px 10px;
}
}
.box-div {
width: 100%;
margin: 0 auto;
padding: 0px 15px;
.box-div-title {
display: flex;
justify-content: space-between;
.box-div-left {
display: flex;
.box-div-left-title {
font-size: 15px;
font-weight: bold;
padding: 5px 10px 5px 0px;
position: relative;
}
}
.box-div-right {
padding: 5px;
}
}
}
.box-div-left-tip {
font-size: 10px;
color: rgb(255, 170, 0);
padding: 8px 0;
}
.lztj-box {
display: flex;
padding: 5px 10px;
justify-content: space-between;
border-radius: 5px;
background: linear-gradient(to right, #00aa7c, #00b78f, #00c7a7);
.lztj-div {
height: 100px;
width: 33%;
text-align: center;
border-right: 1px solid #00c19f;
.lztj-title {
padding: 5px;
font-size: 13px;
font-weight: 600;
color: #f0fb34;
}
.lztj-content {
display: flex;
justify-content: center;
align-items: baseline;
height: 65px;
margin-top: 20%;
color: #ffffff;
font-size: 12px;
.lztj-num3 {
color: #ff3d3e;
}
.lztj-num {
font-size: 20px;
font-weight: bold;
}
.lztj2-num {
margin: 1% 0px 0px 1%;
}
}
}
}
.lzpm-box {
margin-bottom: 100px;
.lzpm-content {
.box-pm-color1 {
background-color: #ff3232;
}
.box-pm-color2 {
background-color: #ff9800;
}
.box-pm-color3 {
background-color: #ffd200;
}
.box-pm-color4 {
background-color: #00b37d;
}
.box-pm-color5 {
background-color: #00b37d;
}
.lzpm-box1 {
.lzpm-box1-title {
display: flex;
color: #000000;
font-weight: 500;
padding: 5px 0;
.lzpm-box1-title-font {
width: 20%;
text-align: center;
}
}
.lzpm-box1-list {
.lzpm-box1-one:first-child {
background-color: #aaa;
// color: white;
}
.lzpm-box1-one {
display: flex;
padding: 10px 0;
text-align: center;
.box1-one {
width: 20%;
text-align: center;
}
.box1-one-process {
// width: calc(100% - 500rpx);
// width: 50%;
}
.box1-one-pm {
width: 20px;
height: 20px;
border-radius: 5px;
color: white;
text-align: center;
font-weight: bold;
line-height: 20px;
margin-left: 5px;
}
}
}
}
.lzpm-box2 {
.lzpm-box2-title {
display: flex;
color: #000000;
font-weight: 500;
padding: 3px 0;
.lzpm-box2-title-font {
width: 20%;
text-align: center;
}
}
.lzpm-box2-list {
.lzpm-box2-one {
display: flex;
padding: 10px 0;
text-align: center;
.box2-one {
width: 25%;
}
.box2-one-pm {
width: 20px;
height: 20px;
border-radius: 5px;
color: white;
text-align: center;
font-weight: bold;
line-height: 20px;
margin-left: 5px;
}
}
}
}
}
}
::v-deep .u-line-progress {
width: 95px;
}
::v-deep .segmented-control__item {
flex: none;
margin-right: 30px;
border-color: #00b27b;
}
::v-deep .segmented-control__item--button--first {
border-left-width: 0px;
border-top-left-radius: 10px;
border-bottom-left-radius: 0px;
background-color: #00b27b;
color: #fff;
}
::v-deep .segmented-control__item--button--last {
border-top-right-radius: 10px;
border-bottom-right-radius: 0px;
background-color: #00b27b;
color: #fff;
}
::v-deep .segmented-control__text {}
::v-deep .segmented-control__item--button {
border-left-width: 0px;
border-right-width: 0px;
border-top-width: 0px;
border-bottom-width: 0px;
}
::v-deep .uni-noticebar-icon {
color: #03aff1 !important;
}
::v-deep .uni-noticebar__content-text{
font-size:14px !important;
}
::v-deep .uni-noticebar-icon{
font-size:21px !important;
}
::v-deep .uni-grid-item{
width: 33.3333% !important;
}
</style>