integrated_traffic_uniapp/pages/basics/home.vue

1689 lines
52 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<template name="basics">
<view>
<yk-authpup ref="authpup" type="top" @changeAuth="$noMultipleClicks(scan)" :permissionID="permissionID"></yk-authpup>
<cu-custom bgColor="bg-gradual-blueness" :isRingt="true">
<block slot="content">交运安全首页</block>
<block slot="right">
<!-- <view class="icon-ui" @click="$noMultipleClicks(scan)">-->
<!-- <text class="cuIcon-scan"></text>-->
<!-- </view>-->
<view @tap.stop="openAuth('CAMERA')">
<view class="icon-ui">
<text class="cuIcon-scan"></text>
</view>
</view>
</block>
</cu-custom>
<view class="answerico" v-if="this.SURVEY_ID !='' " style="position: fixed; right: 20px; box-shadow: 0 0 5px #ccc; border-radius: 100%; ">
<navigator class="swiper-item" hover-class="none" :url="'/pages/questionnaire/questionnaire?SURVEY_ID=' + this.SURVEY_ID">
<image src="../../static/icon-apps/wenjuan.png" mode="" style="width: 35px; height: 35px;"></image>
</navigator>
</view>
<view class="cu-modal" :class="modalName=='Modal'?'show':''">
<view class="up-mainer">
<view class="title">更新通知</view>
<view class="up-info">
<rich-text :nodes="updataPd.UPLOAD_CONTENT"></rich-text>
</view>
<view class="done-btn" @click="IKnow()">
<view class="know-btn">
我知道了
</view>
</view>
</view>
</view>
<!-- #ifdef APP-PLUS -->
<!-- <view class="status_bar">
<view class="top_view"></view>
</view> -->
<!-- #endif -->
<mescroll-uni ref="mescrollRef" :top="StatusBar+'px'" @init="mescrollInit" @down="downCallback" :up="upOption"
@up="upCallback">
<view class="banner">
<view class="cu-bar search">
<!-- <view class="search-form radius">
<text class="cuIcon-search"></text>
<input type="text" placeholder="搜索" confirm-type="search"></input>
</view> -->
<!-- <view></view>
<view class="icon-ui" @click="$noMultipleClicks(scan)">
<text class="cuIcon-scan"></text>
</view> -->
</view>
<view class="banner_img">
<image src="../../static/apps-banner.png" mode=""></image>
</view>
</view>
<view class="container">
<!-- <view class="noticeer">
<image src="../../static/noticimg.png" mode="" ></image>
秦安双控平台将于2022年9月1日系统升级欢迎访问
</view> -->
<view class="home-apps">
<view class="home-apps-list">
<navigator class="home-apps-item" hover-class="none" url="/pages/basics/basic-info/home"> <!-- /pages/basics/basic-info/basic-info -->
<view class="home-apps-item-img">
<image src="../../static/icon-apps/home-base.png" mode=""></image>
</view>
<view class="text">
<text>人员信息</text>
</view>
</navigator>
<navigator v-if="loginCorpId" class="home-apps-item" hover-class="none" url="/pages/basics/work-plan/work-plan">
<view class="home-apps-item-img">
<image src="../../static/icon-apps/home-rili.png" mode=""></image>
</view>
<view class="text">
<text>工作安排</text>
</view>
</navigator>
<navigator v-if="loginCorpId" class="home-apps-item" hover-class="none"
url="/pages/basics/risk-distribution/risk-distribution">
<view class="home-apps-item-img">
<image src="../../static/icon-apps/home-risk.png" mode=""></image>
</view>
<view class="text">
<text>风险分布</text>
</view>
</navigator>
<navigator v-if="loginCorpId" class="home-apps-item" hover-class="none" url="/pages/basics/study-files/study-files">
<view class="home-apps-item-img">
<image src="../../static/icon-apps/home-fl.png" mode=""></image>
</view>
<view class="text">
<text>法律法规</text>
</view>
</navigator>
</view>
<view v-if="loginCorpId" class="home-apps-list">
<!-- <navigator class="home-apps-item" hover-class="none" url="/pages/application/eight-assignments"
v-show="premission.eightWork">
<view class="home-apps-item-img" style="position: relative;">
<image src="../../static/icon-apps/home-gw.png" mode=""></image>
<view v-if="eight_work_count>0" class="cu-tag badge">{{ eight_work_count }}</view>
</view>
<view class="text">
<text>高危作业</text>
</view>
</navigator>-->
<!-- <navigator class="home-apps-item" hover-class="none" url="/pages/application/key-project-management/index/index">
<view class="home-apps-item-img">
<image src="../../static/icon-apps/home-zdgcgl.jpg" mode=""></image>
</view>
<view class="text">
<text>重点工程管理</text>
</view>
<view v-if="keyProjectManagement" class="cu-tag badge">{{ keyProjectManagement }}</view>
</navigator>-->
<!-- <navigator class="home-apps-item" hover-class="none" url="/pages/application/commitment">
<view class="home-apps-item-img">
<image src="../../static/icon-apps/home-cns.png" mode=""></image>
</view>
<view class="text">
<text>安全承诺</text>
</view>
</navigator>-->
<navigator class="home-apps-item" hover-class="none"
url="/pages/application/safetymeeting/home">
<view class="home-apps-item-img">
<image src="../../static/icon-apps/home-risk.png" mode=""></image>
</view>
<view class="text">
<text>安全例会</text>
</view>
</navigator>
<navigator class="home-apps-item" hover-class="none"
url="/pages/application/driving-inspections/dirving-inspections-list">
<view class="home-apps-item-img">
<image src="../../static/icon-apps/home-speEquip.jpg" mode=""></image>
</view>
<view class="text">
<text>行车三检</text>
</view>
</navigator>
<navigator class="home-apps-item" hover-class="none" url="/pages/application/onlinexxks/home"
>
<view class="home-apps-item-img">
<image src="../../static/icon-apps/home-study.png" mode=""></image>
</view>
<view class="text">
<text>学习园地</text>
</view>
</navigator>
</view>
<view v-if="loginCorpId" class="home-apps-list">
<!-- <navigator class="home-apps-item" hover-class="none" url="/pages/application/safety-environmental-inspection/home">
<view class="home-apps-item-img">
<image src="../../static/icon-apps/home-base.png" mode=""></image>
</view>
<view class="text">
<text>安全环保检查</text>
</view>
<view v-if="safetyEnvironmentalInspection>0" class="cu-tag badge">{{ safetyEnvironmentalInspection }}</view>
</navigator>-->
<!-- <navigator class="home-apps-item" hover-class="none" url="/pages/application/speEquip/index"
v-show="premission.speEquip">
<view class="home-apps-item-img">
<image src="../../static/icon-apps/home-speEquip.jpg" mode=""></image>
</view>
<view class="text">
<text>设备巡检</text>
</view>
</navigator>-->
<!-- <navigator class="home-apps-item" hover-class="none" url="/pages/application/onlinexxks/face/index">
<view class="home-apps-item-img">
<image src="../../static/icon-apps/home-study.png" mode=""></image>
</view>
<view class="text">
<text>人脸识别</text>
</view>
</navigator> -->
</view>
</view>
<view v-if="loginCorpId" class="home-work">
<view class="home-work-title">
<view class="title">
<view class="q_title"></view>
<view class="text-black f30b">我的工作</view>
</view>
<!-- <view class="this-date">{{today}}</view> -->
</view>
<view class="work-list">
<view class="work-box">
<navigator v-if="isRest=='1'" class="swiper-item" hover-class="none" url="../" @click="showRest()">
<view class="job-list">
<view class="job-list-img">
<image src="../../static/icon-apps/jobico1.png" mode=""></image>
</view>
<view class="job-list-main">
<view class="job-list-num">
{{ hidCount.dpc }}
</view>
<view class="">
待排查
</view>
</view>
</view>
</navigator>
<navigator v-else class="swiper-item" hover-class="none"
url="/pages/application/hidden-trouble-investigation/hidden-trouble-app/hidden-trouble-uncheck?isIndex=1">
<view class="job-list">
<view class="job-list-img">
<image src="../../static/icon-apps/jobico1.png" mode=""></image>
</view>
<view class="job-list-main">
<view class="job-list-num">
{{ hidCount.dpc }}
</view>
<view class="">
待排查
</view>
</view>
</view>
</navigator>
<navigator class="swiper-item" hover-class="none"
url="/pages/application/hidden-danger-management/hidden-danger-no-change/hidden-danger-no-change?isIndex=1">
<!-- <view class="work-border">
{{hidCount.dzg}}
</view>
<view class="mt10">
待整改
</view> -->
<view class="job-list">
<view class="job-list-img">
<image src="../../static/icon-apps/jobico2.png" mode=""></image>
</view>
<view class="job-list-main">
<view class="job-list-num">
{{ hidCount.dzg }}
</view>
<view class="">
待整改
</view>
</view>
</view>
</navigator>
<navigator class="swiper-item" hover-class="none"
url="/pages/application/hidden-danger-management/hidden-danger-overdue/hidden-danger-overdue?isIndex=1">
<!-- <view class="work-border">
{{hidCount.ycq}}
</view>
<view class="mt10">
已超期
</view>
-->
<view class="job-list">
<view class="job-list-img">
<image src="../../static/icon-apps/jobico3.png" mode=""></image>
</view>
<view class="job-list-main">
<view class="job-list-num">
{{ hidCount.ycq }}
</view>
<view class="">
已超期
</view>
</view>
</view>
</navigator>
<!-- <view class="swiper-item">-->
<!-- <view class="work-border">-->
<!-- {{hidCount.dfc}}-->
<!-- </view>-->
<!-- <view class="mt10">-->
<!-- 待整改-->
<!-- </view>-->
<!-- </view>-->
<navigator class="swiper-item" hover-class="none"
url="/pages/application/hidden-danger-management/hidden-danger-check/hidden-danger-check?isIndex=1">
<!-- <view class="work-border">
{{hidCount.dys}}
</view>
<view class="mt10">
待验收
</view>
-->
<view class="job-list">
<view class="job-list-img">
<image src="../../static/icon-apps/jobico4.png" mode=""></image>
</view>
<view class="job-list-main">
<view class="job-list-num">
{{ hidCount.dys }}
</view>
<view class="">
待验收
</view>
</view>
</view>
</navigator>
<navigator class="swiper-item" hover-class="none"
url="/pages/application/hidden-danger-management/hidden-danger-finish/hidden-danger-finish?isIndex=1">
<!-- <view class="work-border">
{{hidCount.yys}}
</view>
<view class="mt10">
已验收
</view> -->
<view class="job-list">
<view class="job-list-img">
<image src="../../static/icon-apps/jobico5.png" mode=""></image>
</view>
<view class="job-list-main">
<view class="job-list-num">
{{ hidCount.yys }}
</view>
<view class="">
已验收
</view>
</view>
</view>
</navigator>
</view>
<!-- <swiper-item>
<view class="work-box">
<view class="swiper-item">
<view class="work-border">
1
</view>
<view class="mt10">
未提交
</view>
</view>
<view class="swiper-item">
<view class="work-border">
1
</view>
<view class="mt10">
未提交
</view>
</view>
</view>
</swiper-item> -->
</view>
</view>
<view v-if="loginCorpId" class="home-hidden">
<view class="home-work-title">
<view class="title">
<view class="q_title"></view>
<view class="text-black f30b">隐患播报</view>
</view>
<!-- <view class="this-date">更多</view> -->
</view>
<view class="main">
<view>
<maoScroll :data="rollData" :showNum="showNum" :lineHeight="lineHeight" :animationScroll="animationScroll"
:animation="animation">
<template v-slot="{line}">
<view class="flex-line" @click="$noMultipleClicks(gotRectify,line.HIDDEN_ID)">
<view class="oline" v-if="line.HIDDENDESCR">
{{ line.HIDDENDESCR.length > 10 ? line.HIDDENDESCR.substr(0, 10) + '...' : line.HIDDENDESCR }}
</view>
<view class="otext">
{{ line.CREATORNAME }}
</view>
<view>
{{ line.CREATTIME }}
</view>
</view>
</template>
</maoScroll>
</view>
</view>
</view>
<!-- <view class="home-date">-->
<!-- <view class="home-work-title">-->
<!-- <view class="title">-->
<!-- <view class="q_title"></view>-->
<!-- <view class="text-black f30b">排查数据</view>-->
<!-- </view>-->
<!-- &lt;!&ndash; <view class="this-date">更多</view> &ndash;&gt;-->
<!-- </view>-->
<!-- <view class="home-date-list">-->
<!-- <view class="qd-date">-->
<!-- <view class="qd-date-item">-->
<!-- <view class="date text-blue">-->
<!-- {{ hdCount.monthTotal }}-->
<!-- </view>-->
<!-- <view class="name">-->
<!-- 发现隐患数-->
<!-- </view>-->
<!-- </view>-->
<!-- <view class="qd-date-item">-->
<!-- <view class="date text-orange">-->
<!-- {{ hdCount.monthChecked }}-->
<!-- </view>-->
<!-- <view class="name">-->
<!-- 已验收隐患数-->
<!-- </view>-->
<!-- </view>-->
<!-- <view class="qd-date-item">-->
<!-- <view class="date text-green">-->
<!-- {{ hdCount.monthTotal == 0 ? 0 : ((hdCount.monthChecked / hdCount.monthTotal * 100).toFixed(2)) }}%-->
<!-- </view>-->
<!-- <view class="name">-->
<!-- 隐患整改率-->
<!-- </view>-->
<!-- </view>-->
<!-- <view class="qd-tag bg-blue">-->
<!-- <text>月</text>-->
<!-- <text>度</text>-->
<!-- </view>-->
<!-- </view>-->
<!-- <view class="qd-date">-->
<!-- <view class="qd-date-item">-->
<!-- <view class="date text-blue">-->
<!-- {{ hdCount.yearTotal }}-->
<!-- </view>-->
<!-- <view class="name">-->
<!-- 发现隐患数-->
<!-- </view>-->
<!-- </view>-->
<!-- <view class="qd-date-item">-->
<!-- <view class="date text-orange">-->
<!-- {{ hdCount.yearChecked }}-->
<!-- </view>-->
<!-- <view class="name">-->
<!-- 已验收隐患数-->
<!-- </view>-->
<!-- </view>-->
<!-- <view class="qd-date-item">-->
<!-- <view class="date text-green">-->
<!-- {{ hdCount.yearTotal == 0 ? 0 : ((hdCount.yearChecked / hdCount.yearTotal * 100).toFixed(2)) }}%-->
<!-- </view>-->
<!-- <view class="name">-->
<!-- 隐患整改率-->
<!-- </view>-->
<!-- </view>-->
<!-- <view class="qd-tag bg-red">-->
<!-- <text>年</text>-->
<!-- <text>度</text>-->
<!-- </view>-->
<!-- </view>-->
<!-- </view>-->
<!-- </view>-->
<view v-if="loginCorpId" class="home-date">
<view class="home-work-title">
<view class="title">
<view class="q_title"></view>
<view class="text-black f30b">排查数据</view>
</view>
</view>
<view class="home-date-list">
<view class="qd-date">
<view class="qd-date-item">
<view class="date text-blue">
{{ userCount.check_count }}
</view>
<view class="name">
检查数
</view>
</view>
<view class="qd-date-item">
<view class="date text-orange">
{{ userCount.hidden_count }}
</view>
<view class="name">
发现隐患数
</view>
</view>
<view class="qd-date-item">
<view class="date text-green">
{{ userCount.rectify_count }}
</view>
<view class="name">
已验收隐患数
</view>
</view>
<view class="qd-tag bg-red">
<text>我</text>
<text>的</text>
</view>
</view>
<view class="qd-date">
<view class="qd-date-item">
<view class="date text-blue">
{{ deptCount.check_count }}
</view>
<view class="name">
检查数
</view>
</view>
<view class="qd-date-item">
<view class="date text-orange">
{{ deptCount.hidden_count }}
</view>
<view class="name">
发现隐患数
</view>
</view>
<view class="qd-date-item">
<view class="date text-green">
{{ deptCount.rectify_count }}
</view>
<view class="name">
已验收隐患数
</view>
</view>
<view class="qd-tag bg-blue">
<text>部</text>
<text>门</text>
</view>
</view>
<view class="qd-date">
<view class="qd-date-item">
<view class="date text-blue">
{{ superviseDeptCount.check_count?superviseDeptCount.check_count : '0' }}
</view>
<view class="name">
检查数
</view>
</view>
<view class="qd-date-item">
<view class="date text-orange">
{{ superviseDeptCount.hidden_count?superviseDeptCount.hidden_count : '0' }}
</view>
<view class="name">
发现隐患数
</view>
</view>
<view class="qd-date-item">
<view class="date text-green">
{{ superviseDeptCount.rectify_count?superviseDeptCount.rectify_count : '0' }}
</view>
<view class="name">
已验收隐患数
</view>
</view>
<view class="qd-tag bg-blue">
<text>监</text>
<text>管</text>
</view>
</view>
</view>
</view>
</view>
<view class="cu-tabbar-height"></view>
</mescroll-uni>
</view>
</template>
<script>
import {
basePath,
loginSession,
loginUserId,
formatDate,
loginUser,
setloginUserId,
setCorpinfoId,
setloginUser,
setDeptId,
isRest,
corpinfoId,
setIsRest,
setPremission,
premission,
projectManagerUrl,
setUpdateInfo,
updateInfo
} from '@/common/tool.js';
import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
import maoScroll from '@/components/mao-scroll/mao-scroll.vue';
import ykAuthpup from "@/components/yk-authpup/yk-authpup";
export default {
components: {
maoScroll,
ykAuthpup
},
mixins: [MescrollMixin], // 使用mixin (在main.js注册全局组件)
data() {
return {
keyProjectManagement: '',
safetyEnvironmentalInspection: 0, //安全环保总数
permissionID: '',
premission: {},
noClick: true,
StatusBar: this.StatusBar,
StatusBarb: this.StatusBar + 50,
hidCount: [],
hdCount: {},
userCount: {
check_count: 0,
hidden_count: 0,
rectify_count: 0
},
deptCount: {
check_count: 0,
hidden_count: 0,
rectify_count: 0
},
superviseDeptCount: {
check_count: 0,
hidden_count: 0,
rectify_count: 0
},
today: '',
triggered: false,
count: {},
totalList: [],
hiddenList: [],
SURVEY_ID: '',
IS_PUBLISH: '',
isGoodsEdit: false, // 是否加载编辑后的数据
downOption: {
mustToTop: true,
},
upOption: {
use: false, // 禁止上拉
toTop: {
src: '' // 不显示回到顶部按钮
}
},
isRest: '',
showNum: 4,
lineHeight: 60,
animationScroll: 180,
animation: 3000,
rollData: [],
eight_work_count: 0,
updataPd: {},
modalName: '',
loginCorpId: ''
};
},
mounted() {
loginSession()
this.getUpdateInfo()
let now = new Date();
var today = formatDate(now, 'yyyy-MM-dd');
this.loginCorpId = loginUser.CORPINFO_ID
if (loginUser.CORPINFO_ID) {
this.getSafetyEnvironmentalInspectionCount();
this.getIsRest();
this.getData();
// this.getSurveyData();
this.getListData();
// 获取隐患播报滚动
this.getHiddenRoll();
}
// this.getUserId();
// this._freshing = false;
// setTimeout(() => {
// this.triggered = true;
// }, 1000)
this.eight_work_count = 0
this.getRedPoint()
},
// onPullDownRefresh() {
// console.log('refresh');
// setTimeout(function () {
// uni.stopPullDownRefresh();
// }, 1000);
// },
methods: {
getSafetyEnvironmentalInspectionCount() {
var _this = this;
return new Promise((resolve, reject) => {
uni.request({
url: basePath + '/app/safetyenvironmental/countCheck',
method: 'POST',
dataType: 'json',
header: {
'Content-type': 'application/x-www-form-urlencoded'
},
data: {
CORPINFO_ID: corpinfoId,
INSPECTION_USER_ID: loginUser.USER_ID,
INSPECTED_SITEUSER_ID: loginUser.USER_ID,
INSPECTION_ORIGINATOR_ID: loginUser.USER_ID,
tm: new Date().getTime()
},
success: (res) => {
if ("success" == res.data.result) {
_this.safetyEnvironmentalInspection = res.data.confirmCount
.confirmCount +
res.data.checkedCount.checkedCount + res.data.repulseCount
.repulseCount +
res.data.repulseAndCheckCount.repulseAndCheckCount
resolve();
}
}
});
})
},
getUpdateInfo() {
// console.info(updateInfo)
if (!updateInfo) {
var _this = this;
uni.request({
url: projectManagerUrl + 'projectDetails/findUpdate?code=cloud&type=APP',
method: 'POST',
dataType: 'json',
header: {
'Content-type': 'application/x-www-form-urlencoded'
},
data: {},
success: (res) => {
// console.info(res)
if (res.data.pd) {
// console.info(res.data.pd)
_this.modalName = 'Modal'
_this.updataPd = res.data.pd
}
}
});
}
},
IKnow() {
this.modalName = ''
setUpdateInfo(true)
// console.info(updateInfo)
},
getRedPoint() {
uni.request({
url: basePath + '/app/eightwork/checkWork',
method: 'POST',
dataType: 'json',
header: {
'Content-type': 'application/x-www-form-urlencoded'
},
data: {
USER_ID: loginUser.USER_ID,
},
success: (res) => {
if ("success" == res.data.result) {
Object.values(res.data.count).forEach(item => {
this.eight_work_count += (item)
})
}
}
})
},
getMenu() {
var _this = this;
uni.showLoading({
title: '请稍候'
})
uni.request({
url: basePath + '/app/main/index',
method: 'POST',
dataType: 'json',
header: {
'Content-type': 'application/x-www-form-urlencoded'
},
data: {
USER_ID: loginUser.USER_ID,
},
success: (res) => {
console.log(res.data.result)
if ("success" == res.data.result) {
var menuList = res.data.menuList
var premissionList = new Map()
menuList.map(item => {
if (item.menu_NAME == '安全承诺' && item.hasMenu) {
premissionList.set('commitment', true)
if (item.subMenu && item.subMenu.length > 0) {
item.subMenu.map(child => {
if (child.menu_NAME == '公司级承诺公告' && child.hasMenu) {
premissionList.set('commitment-company', true)
}
if (child.menu_NAME == '车间级承诺公告' && child.hasMenu) {
premissionList.set('commitment-workshop', true)
}
if (child.menu_NAME == '班组级承诺公告' && child.hasMenu) {
premissionList.set('commitment-team', true)
}
})
}
}
if (item.menu_NAME == '受限空间作业管理' && item.hasMenu) {
premissionList.set('eightWork', true)
premissionList.set('confinedspace', true)
}
if (item.menu_NAME == '动火作业管理' && item.hasMenu) {
premissionList.set('eightWork', true)
premissionList.set('hotwork', true)
}
if (item.menu_NAME == '高处作业管理' && item.hasMenu) {
premissionList.set('eightWork', true)
premissionList.set('high-work', true)
}
if (item.menu_NAME == '吊装作业管理' && item.hasMenu) {
premissionList.set('eightWork', true)
premissionList.set('hoisting', true)
}
if (item.menu_NAME == '盲板抽堵作业管理' && item.hasMenu) {
premissionList.set('eightWork', true)
premissionList.set('blind-board', true)
}
if (item.menu_NAME == '动土作业管理' && item.hasMenu) {
premissionList.set('eightWork', true)
premissionList.set('break-ground', true)
}
if (item.menu_NAME == '临时用电作业管理' && item.hasMenu) {
premissionList.set('eightWork', true)
premissionList.set('electricity', true)
}
if (item.menu_NAME == '断路作业管理' && item.hasMenu) {
premissionList.set('eightWork', true)
premissionList.set('open-circuit', true)
}
if (item.menu_NAME == '在线学习与考试' && item.hasMenu) {
premissionList.set('education', true)
}
// console.info(premissionList)
if (item.menu_NAME == '设备设施管理' && item.hasMenu) {
premissionList.set('speEquip', true)
}
})
this.premission = (Object.fromEntries(premissionList));
setPremission(Object.fromEntries(premissionList));
uni.hideLoading();
} else {
setloginUserId(null);
setCorpinfoId(null);
setDeptId(null);
setloginUser(null);
uni.removeStorage({key: 'USER'});
uni.reLaunch({
url: '/pages/login/home'
});
// uni.showToast({
// title: res.data.message,
// duration: 2000
// });
}
},
fail: (res) => {
uni.showToast({
icon: 'none',
title: "服务器正在升级,请稍后再试。",
duration: 2000
});
}
});
},
async downCallback(page) {
if (loginUser.CORPINFO_ID) {
await this.getWork();
await this.getUserData();
await this.getDeptData();
await this.getSuperviseDeptData();
}
// await this.getMonth();
// await this.getYear();
await this.mescroll.endSuccess();
this.mescroll.scrollTo(0, 100)
},
getWork() {
return new Promise((resolve, reject) => {
var _this = this;
uni.request({
url: basePath + '/app/hidden/getCountByUserId', // /app/hidden/getCountByUserId
method: 'POST',
dataType: 'json',
header: {
'Content-type': 'application/x-www-form-urlencoded'
},
data: {
userId: loginUserId,
USER_NAME: loginUser.NAME,
CHECK_DEPARTMENT_ID: loginUser.DEPARTMENT_ID,
IS_MAIN: loginUser.ISMAIN,
CORPINFO_ID: loginUser.CORPINFO_ID,
USER_ID: loginUser.USER_ID,
},
success: (res) => {
if (res.data != null) {
_this.hidCount = res.data.hidCount;
}
resolve();
}
});
})
},
getUserData() {
return new Promise((resolve, reject) => {
var _this = this;
uni.request({
url: basePath + '/app/hidden/getUserIndexData',
method: 'POST',
dataType: 'json',
header: {
'Content-type': 'application/x-www-form-urlencoded'
},
data: {
userId: loginUserId,
USER_NAME: loginUser.NAME,
CHECK_DEPARTMENT_ID: loginUser.DEPARTMENT_ID,
IS_MAIN: loginUser.ISMAIN,
CORPINFO_ID: loginUser.CORPINFO_ID,
USER_ID: loginUser.USER_ID,
},
success: (res) => {
if (res.data != null) {
_this.userCount = res.data.pd;
resolve();
}
}
});
})
},
getDeptData() {
return new Promise((resolve, reject) => {
var _this = this;
uni.request({
url: basePath + '/app/hidden/getDeptIndexData',
method: 'POST',
dataType: 'json',
header: {
'Content-type': 'application/x-www-form-urlencoded'
},
data: {
userId: loginUserId,
USER_NAME: loginUser.NAME,
DEPARTMENT_ID: loginUser.DEPARTMENT_ID,
IS_MAIN: loginUser.ISMAIN,
CORPINFO_ID: loginUser.CORPINFO_ID,
USER_ID: loginUser.USER_ID,
},
success: (res) => {
if (res.data != null) {
_this.deptCount = res.data.pd;
}
resolve();
}
});
})
},
getSuperviseDeptData() {
// console.log('getSuperviseDeptData')
return new Promise((resolve, reject) => {
var _this = this;
uni.request({
url: basePath + '/app/hidden/getSuperviseDeptIndexData',
method: 'POST',
dataType: 'json',
header: {
'Content-type': 'application/x-www-form-urlencoded'
},
data: {
userId: loginUserId,
USER_NAME: loginUser.NAME,
DEPARTMENT_ID: loginUser.DEPARTMENT_ID,
IS_MAIN: loginUser.ISMAIN,
CORPINFO_ID: loginUser.CORPINFO_ID,
USER_ID: loginUser.USER_ID,
},
success: (res) => {
if (res.data != null) {
// console.log(loginUser.ISSUPERVISE)
// console.log(loginUser.ISMAIN)
// console.log(res.data.pd)
if(loginUser.ISSUPERVISE == '1'){
_this.superviseDeptCount = res.data.pd;
}
}
resolve();
}
});
})
},
showRest() {
uni.showModal({
title: '提示',
showCancel: false,
content: '您处于离岗状态,无需检查清单。',
confirmText: "返回", // 确认按钮文字
success: (res) => {
}
})
},
getMonth() {
return new Promise((resolve, reject) => {
var _this = this;
//月隐患数
uni.request({
url: basePath + '/app/hidden/getIndexCount',
method: 'POST',
dataType: 'json',
header: {
'Content-type': 'application/x-www-form-urlencoded'
},
data: {
userId: loginUserId,
IS_MONTH: '1',
CORPINFO_ID: loginUser.CORPINFO_ID,
USER_ID: loginUser.USER_ID,
},
success: (res) => {
if (res.data != null) {
_this.hdCount.monthTotal = res.data.total;
_this.hdCount.monthChecked = res.data.checked;
_this.hdCount.monthUncheck = res.data.uncheck;
this.$forceUpdate();
resolve();
}
}
});
})
},
getYear() {
return new Promise((resolve, reject) => {
var _this = this;
//年隐患数
uni.request({
url: basePath + '/app/hidden/getIndexCount',
method: 'POST',
dataType: 'json',
header: {
'Content-type': 'application/x-www-form-urlencoded'
},
data: {
userId: loginUserId,
IS_YEAR: '1',
CORPINFO_ID: loginUser.CORPINFO_ID,
USER_ID: loginUser.USER_ID,
},
success: (res) => {
if (res.data != null) {
_this.hdCount.yearTotal = res.data.total;
_this.hdCount.yearChecked = res.data.checked;
_this.hdCount.yearUncheck = res.data.uncheck;
this.$forceUpdate();
resolve();
}
}
});
})
},
getSurveyData() {
if (loginUser.CORPINFO_ID) {
var _this = this;
uni.showLoading({
title: '请稍候'
})
uni.request({
url: basePath + '/app/survey/goEdit',
method: 'POST',
dataType: 'json',
header: {
'Content-type': 'application/x-www-form-urlencoded'
},
data: {
CORPINFO_ID: loginUser.CORPINFO_ID,
USER_ID: loginUser.USER_ID,
},
success: (res) => {
if ("success" == res.data.result) {
uni.hideLoading();
_this.SURVEY_ID = res.data.pd.SURVEY_ID
_this.IS_PUBLISH = res.data.pd.IS_PUBLISH
console.log(res.data)
// console.log(_this.SURVEY_ID)
console.log(_this.IS_PUBLISH)
} else if ("exception" == data.result) {
uni.showToast({
title: '错误',
duration: 2000
});
}
}
});
}
},
getUserId() {
var _this = this;
uni.showLoading({
title: '请稍候'
})
uni.request({
url: basePath + '/app/surveyanswer/getUserId',
method: 'POST',
dataType: 'json',
header: {
'Content-type': 'application/x-www-form-urlencoded'
},
data: {
CORPINFO_ID: loginUser.CORPINFO_ID,
USER_ID: loginUser.USER_ID
},
success: (res) => {
if ("success" == res.data.result) {
uni.hideLoading();
_this.count = res.data.count.count
// console.log(_this.count)
// console.log(res.data.count.count)
} else if ("exception" == data.result) {
uni.showToast({
title: '错误',
duration: 2000
});
}
}
});
},
getData() {
var _this = this;
let now = new Date();
_this.today = formatDate(now, 'yyyy-MM-dd');
uni.request({
url: basePath + '/app/hidden/getCountByUserId',
method: 'POST',
dataType: 'json',
header: {
'Content-type': 'application/x-www-form-urlencoded'
},
data: {
userId: loginUserId,
USER_NAME: loginUser.NAME,
CHECK_DEPARTMENT_ID: loginUser.DEPARTMENT_ID,
IS_MAIN: loginUser.ISMAIN,
CORPINFO_ID: loginUser.CORPINFO_ID,
USER_ID: loginUser.USER_ID,
},
success: (res) => {
if (res.data != null) {
_this.hidCount = res.data.hidCount;
}
},
fail: (res) => {
uni.showToast({
icon: 'none',
title: "服务器正在升级,请稍后再试。",
duration: 2000
});
setTimeout(function () {
plus.runtime.quit();
// ios quit方法无效退出到登陆页
setloginUserId(null);
setCorpinfoId(null);
setDeptId(null);
setloginUser(null);
uni.removeStorage({key: 'USER'});
uni.navigateTo({
url: '/pages/login/home'
});
}, 2000);
}
});
//月隐患数
uni.request({
url: basePath + '/app/hidden/getIndexCount',
method: 'POST',
dataType: 'json',
header: {
'Content-type': 'application/x-www-form-urlencoded'
},
data: {
userId: loginUserId,
IS_MONTH: '1',
CORPINFO_ID: loginUser.CORPINFO_ID,
USER_ID: loginUser.USER_ID,
},
success: (res) => {
if (res.data != null) {
_this.hdCount.monthTotal = res.data.total;
_this.hdCount.monthChecked = res.data.checked;
_this.hdCount.monthUncheck = res.data.uncheck;
this.$forceUpdate();//强制刷新
}
}
});
//年隐患数
uni.request({
url: basePath + '/app/hidden/getIndexCount',
method: 'POST',
dataType: 'json',
header: {
'Content-type': 'application/x-www-form-urlencoded'
},
data: {
userId: loginUserId,
IS_YEAR: '1',
CORPINFO_ID: loginUser.CORPINFO_ID,
USER_ID: loginUser.USER_ID,
},
success: (res) => {
if (res.data != null) {
_this.hdCount.yearTotal = res.data.total;
_this.hdCount.yearChecked = res.data.checked;
_this.hdCount.yearUncheck = res.data.uncheck;
this.$forceUpdate();//强制刷新
}
}
});
},
// 获取清单数量
getListData() {
var _this = this;
uni.showLoading({
title: '加载中'
})
uni.request({
url: basePath + '/app/listmanager/checkList',
method: 'POST',
dataType: 'json',
header: {
'Content-type': 'application/x-www-form-urlencoded'
},
data: {
USER_NAME: loginUser.NAME,
CHECK_DEPARTMENT_ID: loginUser.DEPARTMENT_ID,
IS_MAIN: loginUser.ISMAIN,
CORPINFO_ID: loginUser.CORPINFO_ID,
USER_ID: loginUser.USER_ID,
},
success: (res) => {
if ("success" == res.data.result) {
uni.hideLoading();
var content = res.data.varList;
for (var i = 0; i < content.length; i++) {
if (content[i].checkCount == 0) {
this.totalList.push(content[i]);
} else {
this.totalList.push(content[i]);
}
}
} else {
uni.showToast({
icon: 'none',
title: '系统异常',
duration: 2000
});
}
},
fail: (res) => {
uni.showToast({
icon: 'none',
title: "服务器正在升级,请稍后再试。",
duration: 2000
});
setTimeout(function () {
plus.runtime.quit();
}, 2000);
}
})
uni.request({
url: basePath + '/app/hiddenDangerCheckStandardCustom/checkList',
method: 'POST',
dataType: 'json',
header: {
'Content-type': 'application/x-www-form-urlencoded'
},
data: {
USER_NAME: loginUser.NAME,
CHECK_DEPARTMENT_ID: loginUser.DEPARTMENT_ID,
IS_MAIN: loginUser.ISMAIN,
CORPINFO_ID: loginUser.CORPINFO_ID,
USER_ID: loginUser.USER_ID,
},
success: (res) => {
if ("success" == res.data.result) {
uni.hideLoading();
var content = res.data.varList;
for (var i = 0; i < content.length; i++) {
if (content[i].checkCount == 0) {
this.totalList.push(content[i]);
} else {
this.totalList.push(content[i]);
}
}
} else {
uni.showToast({
icon: 'none',
title: '系统异常',
duration: 2000
});
}
},
fail: (res) => {
uni.showToast({
icon: 'none',
title: "服务器正在升级,请稍后再试。",
duration: 2000
});
setTimeout(function () {
plus.runtime.quit();
}, 2000);
}
})
},
// 获得滚动隐患
getHiddenRoll() {
var _this = this;
uni.showLoading({
title: '加载中'
})
uni.request({
url: basePath + '/app/hidden/getHiddenByCorp',
method: 'POST',
dataType: 'json',
header: {
'Content-type': 'application/x-www-form-urlencoded'
},
data: {
CORPINFO_ID: loginUser.CORPINFO_ID,
USER_ID: loginUser.USER_ID,
ISSUPERVISE: loginUser.ISSUPERVISE,
DEPARTMENT_ID: loginUser.DEPARTMENT_ID,
},
success: (res) => {
if ("success" == res.data.result) {
uni.hideLoading();
for (var i = 0; i < res.data.hiddenList.length; i++) {
if (res.data.hiddenList[i].CREATTIME) {
var subStr = new RegExp('-', 'ig');//创建正则表达式对象,不区分大小写,全局查找
let date = new Date(res.data.hiddenList[i].CREATTIME.replace(subStr, "/"))
res.data.hiddenList[i].CREATTIME = formatDate(date, 'MM-dd hh:mm')
}
}
_this.rollData = res.data.hiddenList;
_this.$forceUpdate(); //强制刷新
} else {
uni.showToast({
icon: 'none',
title: '系统异常',
duration: 2000
});
}
},
fail: (res) => {
uni.showToast({
icon: 'none',
title: "服务器正在升级,请稍后再试。",
duration: 2000
});
setTimeout(function () {
plus.runtime.quit();
}, 2000);
}
})
},
//跳转事件
gotRectify(e) {
uni.navigateTo({
url: '/pages/application/hidden-danger-management/hidden-danger-record/hidden-danger-record-detail?id=' + e,
});
},
// refresh() {
// if (this._freshing) return;
// this._freshing = true;
// this.getData();
// setTimeout(() => {
// this.triggered = false;
// this._freshing = false;
// }, 1000)
// },
// refreshEnd() {
// this.triggered = 'restore'; // 需要重置
// console.log("onRestore");
// },
// scan(){
// let _this=this;
// uni.scanCode({
// success: function (res) {
// let flag=false;
// let listId = res.result;
// for(var i=0;i<_this.totalList.length;i++){
// if(_this.totalList[i].LISTMANAGER_ID==listId){
// flag=true;
// _this.goToList({listId:_this.totalList[i].LISTMANAGER_ID,listName:_this.totalList[i].NAME});
// break;
// }
// }
// if(!flag){
// uni.showToast({
// title: "无法检查该清单",
// duration: 2000
// });
// }
// }
// });
// },
openAuth(permissionID){
this.permissionID = permissionID;
setTimeout(()=>{
this.$refs['authpup'].open();
},200)
},
scan() {
let _this = this;
uni.scanCode({
success: function (res) {
if (res.result.indexOf('%_face') > 0) {
_this.goToFace(res.result.substring(0, res.result.indexOf('%_face')))
} else {
let flag = false;
let listId = res.result;
for (var i = 0; i < _this.totalList.length; i++) {
if (_this.totalList[i].LISTMANAGER_ID == listId) {
flag = true;
if(_this.totalList[i].PERIOD) {
_this.goToList({listId: _this.totalList[i].LISTMANAGER_ID, listName: _this.totalList[i].NAME});
break;
}
} else if (_this.totalList[i].CUSTOM_ID == listId) {
flag = true;
_this.goTohidden({listId: _this.totalList[i].CUSTOM_ID, listName: _this.totalList[i].NAME});
break;
}
}
if (!flag) {
uni.showToast({
title: "无法检查该清单",
duration: 2000
});
}
}
}
});
},
getIsRest() {
var _this = this;
// 查看是否离岗
uni.request({
url: basePath + '/app/offduty/isRest',
method: 'POST',
dataType: 'json',
header: {
'Content-type': 'application/x-www-form-urlencoded'
},
data: {
CORPINFO_ID: loginUser.CORPINFO_ID,
USER_ID: loginUser.USER_ID,
},
success: (res) => {
if (res.data.ISREST != null) {
setIsRest(res.data.ISREST);
_this.isRest = res.data.ISREST;
}
_this.$forceUpdate();
},
fail: (res) => {
uni.showToast({
icon: 'none',
title: "服务器正在升级,请稍后再试。",
duration: 2000
});
}
});
},
// scan(){
// let _this=this;
// uni.scanCode({
// success: function (res) {
// let flag=false;
// let unit = res.result;
// uni.navigateTo({
// url: '/pages/basics/risk-distribution/risk-distribution-forunit?unit='+unit
// });
// // _this.goToList({listId:_this.totalList[i].LISTMANAGER_ID,listName:_this.totalList[i].NAME});
// }
// });
// },
//跳转事件
goToexclude(e) {
this.$emit('setInit', true);
uni.navigateTo({
url: '/pages/basics/hidden-danger-exclude/exclude-list',
});
},
goToDanger(e) {
this.$emit('setInit', true);
uni.navigateTo({
url: '/pages/basics/danger-exclude/danger-exclude-list',
});
},
toSetinit(e) {
this.$emit('setInit', true);
},
//跳转事件
goToList(e) {
uni.navigateTo({
url: '/pages/application/hidden-trouble-investigation/hidden-trouble-app/hidden-trouble-spot?listId=' + e.listId + '&listName=' + e.listName
});
// uni.navigateTo({
// url: '/pages/application/hidden-trouble-investigation/hidden-trouble-app/check-items-list?listId='+e.listId+'&listName='+e.listName
// });
},
goTohidden(e) {
uni.navigateTo({
url: '/pages/application/hidden-danger-check-standard/custom/list-item?listId=' + e.listId + '&listName=' + e.listName
});
},
goToFace(userId) {
uni.navigateTo({
url: '/pages/basics/recognitionFace/index?userId=' + userId
});
}
}
}
</script>
<style>
.status_bar {
height: var(--status-bar-height);
width: 100%;
background-color: #2068d0;
}
.top_view {
height: var(--status-bar-height);
width: 100%;
position: fixed;
background-color: #2068d0;
top: 0;
z-index: 999;
}
/*说明*/
.notice-warp {
font-size: 26 upx;
padding: 40 upx 0;
border-bottom: 1 upx solid #eee;
text-align: center;
}
.notice-warp .notice {
color: #555;
}
.notice-warp .btn-change {
display: inline-block;
margin-top: 28 upx;
padding: 6 upx 16 upx;
border: 1 upx solid #FF6990;
border-radius: 40 upx;
color: #FF6990;
}
.notice-warp .btn-change:active {
opacity: .5;
}
.main {
padding: 0 30 upx;
}
.flex-line {
display: flex;
justify-content: space-between;
align-items: center;
}
.flex-line .oline {
flex: 1;
}
.flex-line .otext {
width: 200 upx;
text-align: center;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.container {
width: 100%;
padding: 20 upx;
background-color: #f7f8f8;
padding-top: 0;
}
.noticeer {
width: 100%;
background: #ffffff;
border-radius: 10 upx;
padding: 20 upx;
margin-bottom: 20 upx;
}
.noticeer image {
width: 40 upx;
height: 40 upx;
vertical-align: middle;
margin-top: -5 upx;
margin-right: 5 upx;
}
.answerico {
position: fixed;
right: 20 upx;
top: 50%;
transform: translateY(-50%);
z-index: 9;
}
.answerico uni-image img {
width: 70 px;
height: 70 px;
}
.cu-modal{ z-index: 999999999;}
.up-mainer{
position: fixed;
top: 50%;
background: #ffffff;
width:80%;
margin: 0 auto;
border-radius: 4px;
margin-left: 10%;
padding-bottom: 20px;
transform: translateY(-50%);
}
.up-mainer .title{
font-size: 16px;
font-weight: bold;
border-bottom: 1px solid #eee;
line-height: 40px;
}
.up-info{
width: 100%;
padding:0 20px;
line-height: 36px;
text-align: left;
height: 200px;
overflow-y: auto;
}
.know-btn{
width: 50%;
padding: 8px 10px;
background: #359ae1;
margin: 0 auto;
margin-top: 20px;
border-radius: 4px;
color: #ffffff;
}
</style>