|
@@ -1,8 +1,10 @@
|
|
|
<template>
|
|
|
- <scroll-view scroll-x>
|
|
|
- <view style="margin-bottom: 50px" class="padding-sm">
|
|
|
- <!-- 下拉选择 -->
|
|
|
- <!-- <view class="searchSelect shadow" v-if="flag">
|
|
|
+ <!-- <u-sticky bgColor="#fff"> </u-sticky> -->
|
|
|
+
|
|
|
+ <scroll-view scroll-x>
|
|
|
+ <view>
|
|
|
+ <!-- 下拉选择 -->
|
|
|
+ <!-- <view class="searchSelect shadow" v-if="flag">
|
|
|
<view class="cu-bar search bg-white">
|
|
|
<view class="search-form round" style="margin-top: 0">
|
|
|
<input
|
|
@@ -35,10 +37,10 @@
|
|
|
>
|
|
|
</view>
|
|
|
</view> -->
|
|
|
- <!-- 下拉选择 end -->
|
|
|
+ <!-- 下拉选择 end -->
|
|
|
|
|
|
- <!-- 图表 -->
|
|
|
- <!-- <view class="section1 section bg-white padding-xs">
|
|
|
+ <!-- 图表 -->
|
|
|
+ <!-- <view class="section1 section bg-white padding-xs">
|
|
|
<view
|
|
|
class="
|
|
|
static-tabs
|
|
@@ -73,33 +75,33 @@
|
|
|
<view v-if="Inv == 1"> </view>
|
|
|
<view v-if="Inv == 2" class="chart3-box">
|
|
|
<ul class="chart3-icon">
|
|
|
- <li @tap="goOfflineList()">
|
|
|
+ <li>
|
|
|
<image
|
|
|
- src="../../static/chart3-1.png"
|
|
|
+ src="@/static/index/chart3-1.png"
|
|
|
style="width: 64rpx; height: 64rpx"
|
|
|
></image>
|
|
|
</li>
|
|
|
<li>
|
|
|
<image
|
|
|
- src="../../static/chart3-2.png"
|
|
|
+ src="@/static/index/chart3-2.png"
|
|
|
style="width: 64rpx; height: 64rpx"
|
|
|
></image>
|
|
|
</li>
|
|
|
<li>
|
|
|
<image
|
|
|
- src="../../static/chart3-3.png"
|
|
|
+ src="@/static/index/chart3-3.png"
|
|
|
style="width: 64rpx; height: 64rpx"
|
|
|
></image>
|
|
|
</li>
|
|
|
<li>
|
|
|
<image
|
|
|
- src="../../static/chart3-4.png"
|
|
|
+ src="@/static/index/chart3-4.png"
|
|
|
style="width: 64rpx; height: 64rpx"
|
|
|
></image>
|
|
|
</li>
|
|
|
- <li @tap="goNormalList()">
|
|
|
+ <li>
|
|
|
<image
|
|
|
- src="../../static/chart3-5.png"
|
|
|
+ src="@/static/index/chart3-5.png"
|
|
|
style="width: 64rpx; height: 64rpx"
|
|
|
></image>
|
|
|
</li>
|
|
@@ -107,403 +109,440 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
</view> -->
|
|
|
- <!-- 图表 end-->
|
|
|
-
|
|
|
- <!-- 宫格列表 -->
|
|
|
- <view class="section2 section bg-white margin-top-sm">
|
|
|
- <view class="cu-list grid col-3 no-border">
|
|
|
- <view
|
|
|
- class="cu-item justify-center align-center"
|
|
|
- @tap="navItemClick(item.redirectUrl)"
|
|
|
- v-for="(item, index) in cuIconList"
|
|
|
- :key="index"
|
|
|
- >
|
|
|
- <image
|
|
|
- :src="item.imgUrl"
|
|
|
- style="width: 100rpx; height: 100rpx"
|
|
|
- ></image>
|
|
|
- <view class="cu-tag badge" v-if="item.badge != 0">
|
|
|
- <block v-if="item.badge != 0">{{
|
|
|
- item.badge > 99 ? "99+" : item.badge
|
|
|
- }}</block>
|
|
|
- </view>
|
|
|
- <text>{{ item.name }}</text>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- <!-- 宫格列表 end -->
|
|
|
- </view>
|
|
|
- </scroll-view>
|
|
|
+ <!-- 图表 end-->
|
|
|
+
|
|
|
+ <!-- 轮播图 开始 -->
|
|
|
+ <u-swiper :list="arrayList.swiperList" indicator indicatorMode="line" radius="0" height="160" circular>
|
|
|
+ </u-swiper>
|
|
|
+ <!-- 轮播图 结束 -->
|
|
|
+
|
|
|
+ <!-- 宫格列表 -->
|
|
|
+ <view class="section2 section bg-white" style="margin-bottom: 10px"
|
|
|
+ v-if="arrayList.recentlyUsed.length > 0">
|
|
|
+ <view style="color: #000000; font-size: 16px; padding: 10px 10px 5px 10px">最近使用</view>
|
|
|
+ <view class="cu-list grid col-5 no-border">
|
|
|
+ <view class="cu-item justify-center align-center" @tap="navItemClick(item)"
|
|
|
+ v-for="(item, index) in arrayList.recentlyUsed" :key="index">
|
|
|
+ <image :src="item.imgUrl" style="width: 40px; height: 40px"></image>
|
|
|
+ <view class="cu-tag badge" v-if="item.badge != 0">
|
|
|
+ <block v-if="item.badge != 0">{{ item.badge > 99 ? "99+" : item.badge }}</block>
|
|
|
+ </view>
|
|
|
+ <text style="font-size: 14px">{{ item.name }}</text>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <!-- 宫格列表 end -->
|
|
|
+
|
|
|
+ <!-- 宫格列表 -->
|
|
|
+ <view class="section2 section bg-white">
|
|
|
+ <view style="color: #000000; font-size: 16px; padding: 10px 10px 5px 10px">常用功能</view>
|
|
|
+ <view class="cu-list grid col-5 no-border">
|
|
|
+ <view class="cu-item justify-center align-center" @tap="navItemClick(item)"
|
|
|
+ v-for="(item, index) in arrayList.cuIconList" :key="index">
|
|
|
+ <image :src="item.imgUrl" style="width: 40px; height: 40px"></image>
|
|
|
+ <view class="cu-tag badge" v-if="item.badge != 0">
|
|
|
+ <block v-if="item.badge != 0">{{ item.badge > 99 ? "99+" : item.badge }}</block>
|
|
|
+ </view>
|
|
|
+ <text style="font-size: 14px">{{ item.name }}</text>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <!-- 宫格列表 end -->
|
|
|
+ </view>
|
|
|
+ </scroll-view>
|
|
|
</template>
|
|
|
|
|
|
-<script>
|
|
|
-import searchSelect from "./components/searchSelect/searchSelect.vue";
|
|
|
-
|
|
|
-import json from "@/data/json.js"; //引入api请求封装方法
|
|
|
-import * as jwx from "@/utils/jssdk.js"; //引入js sdk的封装
|
|
|
-
|
|
|
-export default {
|
|
|
- components: {
|
|
|
- searchSelect,
|
|
|
- },
|
|
|
-
|
|
|
- data() {
|
|
|
- return {
|
|
|
- staticData: "",
|
|
|
- indicator: [],
|
|
|
- datavalue: [],
|
|
|
- dataname: [],
|
|
|
- alarmCount: json.staticData.data[0].alarmCount,
|
|
|
- cuIconList: json.cuIconList,
|
|
|
- Inv: 0,
|
|
|
- defaultSite: 0,
|
|
|
- flag: false,
|
|
|
- searchList: [],
|
|
|
- searchList2: [],
|
|
|
- searchInput: "",
|
|
|
- selectedCode: 10012,
|
|
|
- getData: [],
|
|
|
- codeResult: "",
|
|
|
- };
|
|
|
- },
|
|
|
-
|
|
|
- // 自定义导航事件
|
|
|
- onNavigationBarButtonTap(e) {
|
|
|
- if (e.float == "right") {
|
|
|
- // alert("你点击了扫一扫");
|
|
|
- this.scanQRCode();
|
|
|
- } else {
|
|
|
- // alert("你点击了获取位置");
|
|
|
- // this.getLocation()
|
|
|
- this.showTag();
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
- onLoad(option) {
|
|
|
- //获取首页标题
|
|
|
- uni.setNavigationBarTitle({
|
|
|
- title: uni.getStorageSync("homeTitle")
|
|
|
- });
|
|
|
- // var res = uni.getStorageSync("selectedCode");
|
|
|
- // var res2 = uni.getStorageSync("selectedName");
|
|
|
- // if (res) {
|
|
|
- // uni.setNavigationBarTitle({
|
|
|
- // title: res2,
|
|
|
- // });
|
|
|
- // }
|
|
|
-
|
|
|
- // // 图表切换渲染
|
|
|
- // this.hackReset = false;
|
|
|
- // this.$nextTick(() => {
|
|
|
- // this.hackReset = true;
|
|
|
- // });
|
|
|
- },
|
|
|
- methods: {
|
|
|
- //登录请求
|
|
|
- async getLogin() {
|
|
|
- const res = await this.$myRequest({
|
|
|
- url: "/system/appLogin",
|
|
|
- header: {
|
|
|
- "Content-Type": "application/json;charset=utf-8",
|
|
|
- },
|
|
|
- method: "POST",
|
|
|
- data: {
|
|
|
- username: "fire_admin",
|
|
|
- password: "fire_admin",
|
|
|
- tenantId: 1002,
|
|
|
- },
|
|
|
- });
|
|
|
-
|
|
|
- uni.setStorageSync("Authorization", res.data.data.access_token);
|
|
|
- if (res.data.status == "SUCCESS") {
|
|
|
- uni.switchTab({
|
|
|
- url: "/pages/index/index",
|
|
|
- });
|
|
|
- } else {
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
- async init() {
|
|
|
- window.location.href = this.$BASE_URL + "Com/getPageAuthorization1";
|
|
|
- },
|
|
|
- //扫码
|
|
|
- scanQRCode() {
|
|
|
- // console.log(1);
|
|
|
- // this.scanCode();
|
|
|
- // 将this赋值给that
|
|
|
- let that = this;
|
|
|
- // 微信公众号获取位置
|
|
|
- jwx.configWeiXin((jweixin) => {
|
|
|
- jweixin.scanQRCode({
|
|
|
- needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
|
|
|
- scanType: ["qrCode", "barCode"], // 可以指定扫二维码还是一维码,默认二者都有
|
|
|
- success: function (res) {
|
|
|
- setTimeout(function () {
|
|
|
- /* 放1000ms后执行的代码 */
|
|
|
- alert(res.resultStr);
|
|
|
- that.getCodeResult({
|
|
|
- ercode: res.resultStr,
|
|
|
- });
|
|
|
- }, 1000);
|
|
|
- },
|
|
|
- });
|
|
|
- });
|
|
|
- },
|
|
|
-
|
|
|
- scanCode() {
|
|
|
- uni.scanCode({
|
|
|
- scanType: ["qrCode"],
|
|
|
- success: (res) => {
|
|
|
- console.log("扫码成功", res);
|
|
|
- },
|
|
|
- fail: (err) => {
|
|
|
- console.log("扫码失败", err);
|
|
|
- },
|
|
|
- complete: () => {
|
|
|
- console.log("扫码结束");
|
|
|
- },
|
|
|
- });
|
|
|
- },
|
|
|
-
|
|
|
- // 扫码成功后请求
|
|
|
- async getCodeResult(param = {}) {
|
|
|
- const res = await this.$myRequest({
|
|
|
- url: "ScanPush/scan_push",
|
|
|
- data: param,
|
|
|
- });
|
|
|
- if (res.data.flag) {
|
|
|
- uni.showToast({
|
|
|
- title: "扫码成功",
|
|
|
- icon: "none",
|
|
|
- });
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
- //获取地理位置
|
|
|
- getLocation() {
|
|
|
- alert(2);
|
|
|
- // 将this赋值给that
|
|
|
- let that = this;
|
|
|
- // 微信公众号获取位置
|
|
|
- jwx.configWeiXin((jweixin) => {
|
|
|
- alert(22);
|
|
|
- jweixin.getLocation({
|
|
|
- type: "gcj02", // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'
|
|
|
- success: function (res) {
|
|
|
- alert(res.longitude);
|
|
|
- },
|
|
|
- });
|
|
|
- });
|
|
|
- },
|
|
|
-
|
|
|
- // 九宫格页面跳转
|
|
|
- navItemClick(url) {
|
|
|
- if (url) {
|
|
|
- uni.navigateTo({
|
|
|
- url: url,
|
|
|
- });
|
|
|
- } else {
|
|
|
- uni.showModal({
|
|
|
- title: "Tips",
|
|
|
- content: "此模块开发中~",
|
|
|
- showCancel: false,
|
|
|
- success: function (res) {
|
|
|
- if (res.confirm) {
|
|
|
- } else if (res.cancel) {
|
|
|
- }
|
|
|
- },
|
|
|
- });
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
- // 页面跳转
|
|
|
- goOfflineList() {
|
|
|
- uni.navigateTo({
|
|
|
- url: "/pages/deviceOffLine/deviceOffLine?status_type=1",
|
|
|
- });
|
|
|
- },
|
|
|
- goNormalList() {
|
|
|
- uni.navigateTo({
|
|
|
- url: "/pages/deviceOffLine/deviceOffLine?status_type=2",
|
|
|
- });
|
|
|
- },
|
|
|
-
|
|
|
- showTag() {
|
|
|
- this.flag = !this.flag;
|
|
|
- },
|
|
|
- // 下拉选择
|
|
|
- clickSelectItem(item, index) {
|
|
|
- this.staticData = "";
|
|
|
- this.selectedCode = item.owner_code;
|
|
|
- uni.setStorageSync("selectedCode", item.owner_code);
|
|
|
- uni.setStorageSync("selectedName", item.owner_name);
|
|
|
- this.searchInput = item.owner_name;
|
|
|
- uni.setNavigationBarTitle({
|
|
|
- title: this.searchInput,
|
|
|
- });
|
|
|
- this.getHomeData({
|
|
|
- company_code: uni.getStorageSync("selectedCode"),
|
|
|
- });
|
|
|
- this.getHandleData({
|
|
|
- company_code: uni.getStorageSync("selectedCode"),
|
|
|
- });
|
|
|
- this.flag = false;
|
|
|
- },
|
|
|
- handleInput() {
|
|
|
- var newlist = this.searchList2.filter(
|
|
|
- (item) => item.owner_name.indexOf(this.searchInput) > -1
|
|
|
- );
|
|
|
- this.searchList = newlist;
|
|
|
- },
|
|
|
- InputFocus(e) {
|
|
|
- this.InputBottom = e.detail.height;
|
|
|
- },
|
|
|
- InputBlur(e) {
|
|
|
- this.InputBottom = 0;
|
|
|
- },
|
|
|
- changeTab(Inv) {
|
|
|
- that.navIdx = Inv;
|
|
|
- },
|
|
|
-
|
|
|
- //echarts图表请求
|
|
|
- async getHomeData(param = {}) {
|
|
|
- const res = await this.$myRequest({
|
|
|
- url: "Index/getHomePageData",
|
|
|
- data: param,
|
|
|
- });
|
|
|
- // console.log('首页请求staticData')
|
|
|
- // console.log(res.data.data[0])
|
|
|
- this.staticData = res.data.data[0];
|
|
|
-
|
|
|
- // var data = res.data.data[0]
|
|
|
-
|
|
|
- var datavalue = [
|
|
|
- this.staticData.fire_water_count,
|
|
|
- this.staticData.alarm_host_count,
|
|
|
- this.staticData.electrical_fire_count,
|
|
|
- this.staticData.other_count,
|
|
|
- this.staticData.video_monitoring_count,
|
|
|
- ];
|
|
|
- var dataname = ["消防水系统", "报警主机", "电气火灾", "其他", "监控视频"];
|
|
|
- var color = ["#3C8BF0", "#06CDF8", "#0ECB70", "#6744EF", "#FFD803"];
|
|
|
-
|
|
|
- var aa = [
|
|
|
- this.staticData.fire_water_count,
|
|
|
- this.staticData.alarm_host_count,
|
|
|
- this.staticData.electrical_fire_count,
|
|
|
- this.staticData.other_count,
|
|
|
- this.staticData.video_monitoring_count,
|
|
|
- ];
|
|
|
- aa.sort(function (a, b) {
|
|
|
- return a - b;
|
|
|
- });
|
|
|
- aa = aa.pop();
|
|
|
- var datamax = [aa, aa, aa, aa, aa];
|
|
|
-
|
|
|
- this.datavalue = datavalue;
|
|
|
- this.dataname = dataname;
|
|
|
-
|
|
|
- dataname.map((val, ind) => {
|
|
|
- this.indicator.push({
|
|
|
- name: val,
|
|
|
- max: datamax[ind],
|
|
|
- color: color[ind],
|
|
|
- });
|
|
|
- });
|
|
|
- this.indicator = this.indicator.slice(-5);
|
|
|
- },
|
|
|
-
|
|
|
- // 未处理告警请求
|
|
|
- async getHandleData(param = {}) {
|
|
|
- const res = await this.$myRequest({
|
|
|
- url: "Index/getFunctionalModuleStatistics",
|
|
|
- showLoading: true,
|
|
|
- data: param,
|
|
|
- });
|
|
|
- this.cuIconList[0].badge = res.data.data[0].comprehensive_alarm_count;
|
|
|
- this.cuIconList[2].badge = res.data.data[0].fire_brigade_inspector_count;
|
|
|
- },
|
|
|
- },
|
|
|
-};
|
|
|
+<script setup>
|
|
|
+ import searchSelect from "./components/searchSelect/searchSelect.vue";
|
|
|
+
|
|
|
+ import json from "@/data/json.js"; //引入api请求封装方法
|
|
|
+ import * as jwx from "@/utils/jssdk.js"; //引入js sdk的封装
|
|
|
+
|
|
|
+ import {
|
|
|
+ onReady,
|
|
|
+ onLoad,
|
|
|
+ onShow,
|
|
|
+ onNavigationBarButtonTap
|
|
|
+ } from "@dcloudio/uni-app";
|
|
|
+ import {
|
|
|
+ ref,
|
|
|
+ onMounted,
|
|
|
+ inject,
|
|
|
+ shallowRef,
|
|
|
+ reactive
|
|
|
+ } from "vue";
|
|
|
+ import useXunJianStore from "@/store/modules/xunJian.js";
|
|
|
+
|
|
|
+ const myRequest = inject("$myRequest"); //全局接口请求
|
|
|
+ const settingsStore = useXunJianStore(); //全局变量值Store
|
|
|
+ const BASE_URL = inject("$BASE_URL");
|
|
|
+
|
|
|
+ const arrayList = reactive({
|
|
|
+ InputBottom: 0,
|
|
|
+ staticData: "",
|
|
|
+ indicator: [],
|
|
|
+ datavalue: [],
|
|
|
+ dataname: [],
|
|
|
+ Inv: 0,
|
|
|
+ flag: false,
|
|
|
+ searchList: [],
|
|
|
+ searchList2: [],
|
|
|
+ searchInput: "",
|
|
|
+ selectedCode: 10012,
|
|
|
+ codeResult: "",
|
|
|
+
|
|
|
+ swiperList: ["../../static/index/banner1.png", "../../static/index/banner2.jpg",
|
|
|
+ "../../static/index/banner3.jpg"
|
|
|
+ ],
|
|
|
+ cuIconList: json.cuIconList,
|
|
|
+ recentlyUsed: [],
|
|
|
+ });
|
|
|
+
|
|
|
+ onLoad((option) => {
|
|
|
+ //获取首页标题
|
|
|
+ if (uni.getStorageSync("homeTitle")) {
|
|
|
+ uni.setNavigationBarTitle({
|
|
|
+ title: uni.getStorageSync("homeTitle"),
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ uni.setNavigationBarTitle({
|
|
|
+ title: "首页",
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ if (uni.getStorageSync("recentlyUsed")) {
|
|
|
+ arrayList.recentlyUsed = uni.getStorageSync("recentlyUsed");
|
|
|
+ }
|
|
|
+
|
|
|
+ // var res = uni.getStorageSync("selectedCode");
|
|
|
+ // var res2 = uni.getStorageSync("selectedName");
|
|
|
+ // if (res) {
|
|
|
+ // uni.setNavigationBarTitle({
|
|
|
+ // title: res2,
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+
|
|
|
+ // // 图表切换渲染
|
|
|
+ // this.hackReset = false;
|
|
|
+ // this.$nextTick(() => {
|
|
|
+ // this.hackReset = true;
|
|
|
+ // });
|
|
|
+ });
|
|
|
+
|
|
|
+ //登录请求
|
|
|
+ async function getLogin() {
|
|
|
+ const res = await myRequest({
|
|
|
+ url: "/system/appLogin",
|
|
|
+ header: {
|
|
|
+ "Content-Type": "application/json;charset=utf-8",
|
|
|
+ },
|
|
|
+ method: "POST",
|
|
|
+ data: {
|
|
|
+ username: "fire_admin",
|
|
|
+ password: "fire_admin",
|
|
|
+ tenantId: 1002,
|
|
|
+ },
|
|
|
+ });
|
|
|
+
|
|
|
+ uni.setStorageSync("Authorization", res.data.data.access_token);
|
|
|
+ if (res.data.status == "SUCCESS") {
|
|
|
+ uni.switchTab({
|
|
|
+ url: "/pages/index/index",
|
|
|
+ });
|
|
|
+ } else {}
|
|
|
+ }
|
|
|
+
|
|
|
+ async function init() {
|
|
|
+ window.location.href = BASE_URL + "Com/getPageAuthorization1";
|
|
|
+ }
|
|
|
+ //扫码
|
|
|
+ function scanQRCode() {
|
|
|
+ // console.log(1);
|
|
|
+ // this.scanCode();
|
|
|
+ // 将this赋值给that
|
|
|
+ let that = this;
|
|
|
+ // 微信公众号获取位置
|
|
|
+ jwx.configWeiXin((jweixin) => {
|
|
|
+ jweixin.scanQRCode({
|
|
|
+ needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
|
|
|
+ scanType: ["qrCode", "barCode"], // 可以指定扫二维码还是一维码,默认二者都有
|
|
|
+ success: function(res) {
|
|
|
+ setTimeout(function() {
|
|
|
+ /* 放1000ms后执行的代码 */
|
|
|
+ alert(res.resultStr);
|
|
|
+ that.getCodeResult({
|
|
|
+ ercode: res.resultStr,
|
|
|
+ });
|
|
|
+ }, 1000);
|
|
|
+ },
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ function scanCode() {
|
|
|
+ uni.scanCode({
|
|
|
+ scanType: ["qrCode"],
|
|
|
+ success: (res) => {
|
|
|
+ console.log("扫码成功", res);
|
|
|
+ },
|
|
|
+ fail: (err) => {
|
|
|
+ console.log("扫码失败", err);
|
|
|
+ },
|
|
|
+ complete: () => {
|
|
|
+ console.log("扫码结束");
|
|
|
+ },
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ // 扫码成功后请求
|
|
|
+ async function getCodeResult(param = {}) {
|
|
|
+ const res = await myRequest({
|
|
|
+ url: "ScanPush/scan_push",
|
|
|
+ data: param,
|
|
|
+ });
|
|
|
+ if (res.data.flag) {
|
|
|
+ uni.showToast({
|
|
|
+ title: "扫码成功",
|
|
|
+ icon: "none",
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //获取地理位置
|
|
|
+ function getLocation() {
|
|
|
+ alert(2);
|
|
|
+ // 将this赋值给that
|
|
|
+ let that = this;
|
|
|
+ // 微信公众号获取位置
|
|
|
+ jwx.configWeiXin((jweixin) => {
|
|
|
+ alert(22);
|
|
|
+ jweixin.getLocation({
|
|
|
+ type: "gcj02", // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'
|
|
|
+ success: function(res) {
|
|
|
+ alert(res.longitude);
|
|
|
+ },
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ // 九宫格页面跳转
|
|
|
+ function navItemClick(item) {
|
|
|
+ if (item.redirectUrl) {
|
|
|
+ item.sort = 0;
|
|
|
+
|
|
|
+ arrayList.recentlyUsed.push(item);
|
|
|
+
|
|
|
+ if (arrayList.recentlyUsed.length > 0) {
|
|
|
+ arrayList.recentlyUsed = arrayList.recentlyUsed.filter((currentValue, currentIndex, selfArr) => {
|
|
|
+ return selfArr.findIndex((x) => x.redirectUrl === currentValue.redirectUrl) === currentIndex;
|
|
|
+ });
|
|
|
+
|
|
|
+ arrayList.recentlyUsed.filter((el) => {
|
|
|
+ if (el.redirectUrl === item.redirectUrl) {
|
|
|
+ el.sort++;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ arrayList.recentlyUsed = settingsStore.sortEvent(arrayList.recentlyUsed, 1);
|
|
|
+
|
|
|
+ uni.setStorageSync("recentlyUsed", arrayList.recentlyUsed);
|
|
|
+
|
|
|
+ uni.navigateTo({
|
|
|
+ url: item.redirectUrl,
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ uni.showModal({
|
|
|
+ title: "Tips",
|
|
|
+ content: "此模块开发中~",
|
|
|
+ showCancel: false,
|
|
|
+ success: function(res) {
|
|
|
+ if (res.confirm) {} else if (res.cancel) {}
|
|
|
+ },
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ function showTag() {
|
|
|
+ arrayList.flag = !arrayList.flag;
|
|
|
+ }
|
|
|
+ // 下拉选择
|
|
|
+ function clickSelectItem(item, index) {
|
|
|
+ arrayList.staticData = "";
|
|
|
+ arrayList.selectedCode = item.owner_code;
|
|
|
+ uni.setStorageSync("selectedCode", item.owner_code);
|
|
|
+ uni.setStorageSync("selectedName", item.owner_name);
|
|
|
+ arrayList.searchInput = item.owner_name;
|
|
|
+ uni.setNavigationBarTitle({
|
|
|
+ title: arrayList.searchInput,
|
|
|
+ });
|
|
|
+
|
|
|
+ getHomeData({
|
|
|
+ company_code: uni.getStorageSync("selectedCode"),
|
|
|
+ });
|
|
|
+ getHandleData({
|
|
|
+ company_code: uni.getStorageSync("selectedCode"),
|
|
|
+ });
|
|
|
+
|
|
|
+ arrayList.flag = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ function handleInput() {
|
|
|
+ var newlist = arrayList.searchList2.filter((item) => item.owner_name.indexOf(arrayList.searchInput) > -1);
|
|
|
+ arrayList.searchList = newlist;
|
|
|
+ }
|
|
|
+
|
|
|
+ function InputFocus(e) {
|
|
|
+ arrayList.InputBottom = e.detail.height;
|
|
|
+ }
|
|
|
+
|
|
|
+ function InputBlur(e) {
|
|
|
+ arrayList.InputBottom = 0;
|
|
|
+ }
|
|
|
+ //echarts图表请求
|
|
|
+ async function getHomeData(param = {}) {
|
|
|
+ const res = await myRequest({
|
|
|
+ url: "Index/getHomePageData",
|
|
|
+ data: param,
|
|
|
+ });
|
|
|
+ // console.log('首页请求staticData')
|
|
|
+ // console.log(res.data.data[0])
|
|
|
+ arrayList.staticData = res.data.data[0];
|
|
|
+
|
|
|
+ // var data = res.data.data[0]
|
|
|
+
|
|
|
+ var datavalue = [
|
|
|
+ arrayList.staticData.fire_water_count,
|
|
|
+ arrayList.staticData.alarm_host_count,
|
|
|
+ arrayList.staticData.electrical_fire_count,
|
|
|
+ arrayList.staticData.other_count,
|
|
|
+ arrayList.staticData.video_monitoring_count,
|
|
|
+ ];
|
|
|
+ var dataname = ["消防水系统", "报警主机", "电气火灾", "其他", "监控视频"];
|
|
|
+ var color = ["#3C8BF0", "#06CDF8", "#0ECB70", "#6744EF", "#FFD803"];
|
|
|
+
|
|
|
+ var aa = [
|
|
|
+ arrayList.staticData.fire_water_count,
|
|
|
+ arrayList.staticData.alarm_host_count,
|
|
|
+ arrayList.staticData.electrical_fire_count,
|
|
|
+ arrayList.staticData.other_count,
|
|
|
+ arrayList.staticData.video_monitoring_count,
|
|
|
+ ];
|
|
|
+ aa.sort(function(a, b) {
|
|
|
+ return a - b;
|
|
|
+ });
|
|
|
+ aa = aa.pop();
|
|
|
+ var datamax = [aa, aa, aa, aa, aa];
|
|
|
+
|
|
|
+ arrayList.datavalue = datavalue;
|
|
|
+ arrayList.dataname = dataname;
|
|
|
+
|
|
|
+ dataname.map((val, ind) => {
|
|
|
+ arrayList.indicator.push({
|
|
|
+ name: val,
|
|
|
+ max: datamax[ind],
|
|
|
+ color: color[ind],
|
|
|
+ });
|
|
|
+ });
|
|
|
+ arrayList.indicator = arrayList.indicator.slice(-5);
|
|
|
+ }
|
|
|
+ // 未处理告警请求
|
|
|
+ async function getHandleData(param = {}) {
|
|
|
+ const res = await myRequest({
|
|
|
+ url: "Index/getFunctionalModuleStatistics",
|
|
|
+ showLoading: true,
|
|
|
+ data: param,
|
|
|
+ });
|
|
|
+ arrayList.cuIconList[0].badge = res.data.data[0].comprehensive_alarm_count;
|
|
|
+ arrayList.cuIconList[2].badge = res.data.data[0].fire_brigade_inspector_count;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 自定义导航事件
|
|
|
+ onNavigationBarButtonTap((e) => {
|
|
|
+ if (e.float == "right") {
|
|
|
+ // alert("你点击了扫一扫");
|
|
|
+ this.scanQRCode();
|
|
|
+ } else {
|
|
|
+ // alert("你点击了获取位置");
|
|
|
+ // this.getLocation()
|
|
|
+ this.showTag();
|
|
|
+ }
|
|
|
+ });
|
|
|
</script>
|
|
|
|
|
|
<style>
|
|
|
-.select-items {
|
|
|
- overflow: auto;
|
|
|
- height: 80vh;
|
|
|
-}
|
|
|
-
|
|
|
-.static-tabs {
|
|
|
- border-radius: 50rpx;
|
|
|
- border: 1rpx solid #4074e7;
|
|
|
-}
|
|
|
-
|
|
|
-.static-tabs > view {
|
|
|
- color: #4074e7;
|
|
|
- font-size: 30rpx;
|
|
|
-}
|
|
|
-
|
|
|
-.static-tabs > view.active {
|
|
|
- color: #fff;
|
|
|
- background: #4074e7;
|
|
|
-}
|
|
|
-
|
|
|
-.static-tabs > view:first-child {
|
|
|
- border-top-left-radius: 50rpx;
|
|
|
- border-bottom-left-radius: 50rpx;
|
|
|
-}
|
|
|
-
|
|
|
-.static-tabs > view:nth-child(2) {
|
|
|
- border-left: 1px solid #4074e7;
|
|
|
- border-right: 1px solid #4074e7;
|
|
|
-}
|
|
|
-
|
|
|
-.static-tabs > view:last-child {
|
|
|
- border-top-right-radius: 50rpx;
|
|
|
- border-bottom-right-radius: 50rpx;
|
|
|
-}
|
|
|
-
|
|
|
-/* 检测时间 */
|
|
|
-.time {
|
|
|
- border-radius: 50rpx;
|
|
|
- background: #fafcff;
|
|
|
- border: 1px solid #e8f1ff;
|
|
|
- padding: 20rpx;
|
|
|
- color: #666666;
|
|
|
- font-size: 30rpx;
|
|
|
-}
|
|
|
-
|
|
|
-.chart3-box {
|
|
|
- position: relative;
|
|
|
-}
|
|
|
-
|
|
|
-.chart3-icon {
|
|
|
- width: 90%;
|
|
|
- position: absolute;
|
|
|
- top: 60rpx;
|
|
|
- left: 30rpx;
|
|
|
- z-index: 1;
|
|
|
-}
|
|
|
-
|
|
|
-.chart3-icon li {
|
|
|
- padding-top: 25rpx;
|
|
|
-}
|
|
|
-
|
|
|
-ul,
|
|
|
-li {
|
|
|
- padding: 0;
|
|
|
- margin: 0;
|
|
|
- list-style: none;
|
|
|
-}
|
|
|
-
|
|
|
-.shadow {
|
|
|
- box-shadow: 1px 1px 4px rgb(26 26 26 / 10%);
|
|
|
-}
|
|
|
+ .select-items {
|
|
|
+ overflow: auto;
|
|
|
+ height: 80vh;
|
|
|
+ }
|
|
|
+
|
|
|
+ .static-tabs {
|
|
|
+ border-radius: 50rpx;
|
|
|
+ border: 1rpx solid #4074e7;
|
|
|
+ }
|
|
|
+
|
|
|
+ .static-tabs>view {
|
|
|
+ color: #4074e7;
|
|
|
+ font-size: 30rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ .static-tabs>view.active {
|
|
|
+ color: #fff;
|
|
|
+ background: #4074e7;
|
|
|
+ }
|
|
|
+
|
|
|
+ .static-tabs>view:first-child {
|
|
|
+ border-top-left-radius: 50rpx;
|
|
|
+ border-bottom-left-radius: 50rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ .static-tabs>view:nth-child(2) {
|
|
|
+ border-left: 1px solid #4074e7;
|
|
|
+ border-right: 1px solid #4074e7;
|
|
|
+ }
|
|
|
+
|
|
|
+ .static-tabs>view:last-child {
|
|
|
+ border-top-right-radius: 50rpx;
|
|
|
+ border-bottom-right-radius: 50rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ /* 检测时间 */
|
|
|
+ .time {
|
|
|
+ border-radius: 50rpx;
|
|
|
+ background: #fafcff;
|
|
|
+ border: 1px solid #e8f1ff;
|
|
|
+ padding: 20rpx;
|
|
|
+ color: #666666;
|
|
|
+ font-size: 30rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ .chart3-box {
|
|
|
+ position: relative;
|
|
|
+ }
|
|
|
+
|
|
|
+ .chart3-icon {
|
|
|
+ width: 90%;
|
|
|
+ position: absolute;
|
|
|
+ top: 60rpx;
|
|
|
+ left: 30rpx;
|
|
|
+ z-index: 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ .chart3-icon li {
|
|
|
+ padding-top: 25rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ ul,
|
|
|
+ li {
|
|
|
+ padding: 0;
|
|
|
+ margin: 0;
|
|
|
+ list-style: none;
|
|
|
+ }
|
|
|
</style>
|
|
|
|
|
|
<style scoped>
|
|
|
-uni-page-body,
|
|
|
-uni-page-refresh {
|
|
|
- background: rgb(241, 241, 241);
|
|
|
-}
|
|
|
+ uni-page-body,
|
|
|
+ uni-page-refresh {
|
|
|
+ background: rgb(241, 241, 241);
|
|
|
+ }
|
|
|
</style>
|