<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/banner.jpg" 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/basic-info">
							<view class="home-apps-item-img">
								<image src="../../static/icon-apps/ico1.png" mode=""></image>
							</view>
							<view class="text">
								<text>人员信息</text>
							</view>
						</navigator>
						<navigator 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/ico2.png" mode=""></image>
							</view>
							<view class="text">
								<text>工作安排</text>
							</view>
						</navigator>
						<navigator 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/ico3.png" mode=""></image>
							</view>
							<view class="text">
								<text>风险分布</text>
							</view>
						</navigator>
            <navigator class="home-apps-item" hover-class="none" url="/pages/application/safetymeeting/index">
              <view class="home-apps-item-img">
                <image src="../../static/icon-apps/ico11.png" mode=""></image>
              </view>
              <view class="text">
                <text>安全例会</text>
              </view>
            </navigator>
						<!-- <navigator 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/ico4.png" mode=""></image>
							</view>
							<view class="text">
								<text>法律法规</text>
							</view>
						</navigator> -->
					</view>
					<view class="home-apps-list">
						<navigator class="home-apps-item" hover-class="none" url="/pages/application/eight-assignments"
							>
							<view class="home-apps-item-img" style="position: relative;">
								<image src="../../static/icon-apps/ico5.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/safety-environmental-inspection/home">-->

<!--              <view class="home-apps-item-img" style="position: relative;">-->
<!--                <image src="../../static/icon-apps/ico9.png" mode=""></image>-->
<!--                <view v-if="safetyEnvironmentalInspection>0" class="cu-tag badge">-->
<!--                  {{ safetyEnvironmentalInspection }}-->
<!--                </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/ico7.png" 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/ico8.png" mode=""></image>
							</view>
							<view class="text">
								<text>学习园地</text>
							</view>
						</navigator>
            <navigator class="home-apps-item" hover-class="none" url="/pages/application/speEquip/index"
            >
              <view class="home-apps-item-img">
                <image src="../../static/icon-apps/ico10.png" mode=""></image>
              </view>
              <view class="text">
                <text>设备巡检</text>
              </view>
            </navigator>
					</view>
					<view class="home-apps-list">
            <navigator class="home-apps-item" hover-class="none" url="/pages/application/recordItems/index">
              <view class="home-apps-item-img">
                <image src="../../static/icon-apps/ico12.png" mode=""></image>
              </view>
              <view class="text">
                <text>点检清单</text>
              </view>
            </navigator>
           <!-- <navigator class="home-apps-item" hover-class="none" url="/pages/application/fire-management/hidden-trouble-app/hidden-trouble-app">
              <view class="home-apps-item-img">
                <image src="../../static/icon-apps/ico13.png" mode=""></image>
              </view>
              <view class="text">
                <text>消防管理</text>
              </view>
            </navigator> -->
					</view>
				</view>

				<view 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-confirm?isIndex=1">
								<view class="job-list">
									<view class="job-list-img">
										<image src="../../static/icon-apps/jobico6.png" mode=""></image>
									</view>
									<view class="job-list-main">
										<view class="job-list-num">
											{{ hidCount.dqr }}
										</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 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 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: {},
				deptCount: {},
				superviseDeptCount: {},
				today: '',
				triggered: false,
				count: {},
				totalList: [],
				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: ''
			};
		},
		mounted() {
			loginSession()
			this.getSafetyEnvironmentalInspectionCount();
			this.getUpdateInfo()
			let now = new Date();
			var today = formatDate(now, 'yyyy-MM-dd');
			this.getIsRest();
			this.getData();
			this.getSurveyData();
			// this.getUserId();
			this.getListData();
			// 获取隐患播报滚动
			this.getHiddenRoll();
			// 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 || 0)
							})
						}
					}
				})
			},

			async downCallback(page) {
				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() {
				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);
					}
				})
			},
			// 获得滚动隐患
			getHiddenRoll() {

				var _this = this;
				uni.showLoading({
					title: '加载中'
				})
				uni.request({
					url: basePath + '/app/hidden/getHiddenByCorp2',
					method: 'POST',
					dataType: 'json',
					header: {
						'Content-type': 'application/x-www-form-urlencoded'
					},
					data: {
						CORPINFO_ID: loginUser.CORPINFO_ID,
            HIDDENFINDDEPT: loginUser.DEPARTMENT_ID,
            DEPARTMENT_ID: loginUser.DEPARTMENT_ID,
            HIDDENLEVEL: 'hiddenLevel0001'
					},
					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;
									_this.goToList({
										listId: _this.totalList[i].LISTMANAGER_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
				// });
			},
			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: 26upx;
		padding: 40upx 0;
		border-bottom: 1upx solid #eee;
		text-align: center;
	}

	.notice-warp .notice {
		color: #555;
	}

	.notice-warp .btn-change {
		display: inline-block;
		margin-top: 28upx;
		padding: 6upx 16upx;
		border: 1upx solid #FF6990;
		border-radius: 40upx;
		color: #FF6990;
	}

	.notice-warp .btn-change:active {
		opacity: .5;
	}

	.main {
		padding: 0 30upx;
	}

	.flex-line {
		display: flex;
		justify-content: space-between;
		align-items: center;
	}

	.flex-line .oline {
		flex: 1;
	}

	.flex-line .otext {
		width: 200upx;
		text-align: center;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}

	.container {
		width: 100%;
		padding: 20upx;
		background-color: #f7f8f8;
		padding-top: 0;
	}

	.noticeer {
		width: 100%;
		background: #ffffff;
		border-radius: 10upx;
		padding: 20upx;
		margin-bottom: 20upx;
	}

	.noticeer image {
		width: 40upx;
		height: 40upx;
		vertical-align: middle;
		margin-top: -5upx;
		margin-right: 5upx;
	}

	.answerico {

		position: fixed;
		right: 20upx;
		top: 50%;
		transform: translateY(-50%);
		z-index: 9;
	}

	.answerico uni-image img {
		width: 70px;
		height: 70px;
	}

	.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>
