123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389 |
- <template>
- <view style="background:#f1f1f1;" class="padding-sm">
- <view class="searchSelect shadow" v-if="flag">
- <view class="cu-bar search bg-white">
- <view class="search-form round">
- <input @focus="InputFocus" @blur="InputBlur" @input="handleInput()" v-model="searchInput"
- :adjust-position="false" type="text" placeholder="" />
- <text class="cuIcon-search "></text>
- </view>
- </view>
- <view class="select-items">
- <view class="select-item" v-for="(item,index) in searchList" @click="clickSelectItem(item,index)"
- :key="index">{{item}}</view>
- </view>
- </view>
- <view class="section1 section bg-white padding-xs">
- <view class=" static-tabs grid margin-bottom text-center col-3 margin-top-sm margin-bottom-sm">
- <view :class="['padding-sm ',Inv==0?'active':'']" @click="Inv=0">报警信息统计</view>
- <view :class="['padding-sm ',Inv==1?'active':'']" @click="Inv=1">数据等级统计</view>
- <view :class="['padding-sm ',Inv==2?'active':'']" @click="Inv=2">设备运行状态</view>
- </view>
- <view class="time text-center">统计时段:{{staticData.statisticalPeriod}}
- </view>
- <view style="height:570rpx">
- <view v-if="Inv == 0">
- <chart :bindData="staticData" v-if="hackReset"></chart>
- </view>
- <view v-if="Inv == 1">
- <chart2 :bindData="staticData"></chart2>
- </view>
- <view v-if="Inv == 2" class="chart3-box">
- <ul class="chart3-icon">
- <li>
- <image src="../../static/chart3-1.png" style="width:64rpx;height:64rpx"></image>
- </li>
- <li>
- <image src="../../static/chart3-2.png" style="width:64rpx;height:64rpx"></image>
- </li>
- <li>
- <image src="../../static/chart3-3.png" style="width:64rpx;height:64rpx"></image>
- </li>
- <li>
- <image src="../../static/chart3-4.png" style="width:64rpx;height:64rpx"></image>
- </li>
- <li>
- <image src="../../static/chart3-5.png" style="width:64rpx;height:64rpx"></image>
- </li>
- </ul>
- <chart3 :bindData="staticData">
- </chart3>
- </view>
- </view>
- </view>
- <!-- 宫格列表 -->
- <!-- <square :cuIconList="cuIconList"></square> -->
- <view class="section2 section bg-white margin-top-sm margin-bottom-sm">
- <view class="cu-list grid col-3 no-border">
- <view class="cu-item justify-center align-center" @tap=navItemClick(index)
- v-for="(item,index) in cuIconList" :key="index">
- <div v-if="item.onShow">
- <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>
- </div>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import chart from "./components/chart/chart.vue";
- import chart2 from "./components/chart2/chart2.vue";
- import chart3 from "./components/chart3/chart3.vue";
- import chart4 from "./components/chart4/chart4.vue";
- import json from "../../data/json.js";
- export default {
- components: {
- chart,
- chart2,
- chart3,
- chart4,
- },
- data() {
- return {
- componentKey: 0,
- arr: [],
- searchInput: "",
- alarmCount: "",
- flag: false,
- // 宫格列表数据
- cuIconList: [{
- imgUrl: "../../static/square1.png",
- badge: 0,
- name: "综合报警",
- redirectUrl: "/pages/siteList/siteList?type=1",
- onShow: true,
- },
- {
- imgUrl: "../../static/square2.png",
- badge: 0,
- name: "运行监测",
- redirectUrl: "/pages/siteList/siteList?type=2",
- onShow: true,
- },
- {
- imgUrl: "../../static/square-wb.png",
- badge: 0,
- name: "维保",
- redirectUrl: "",
- onShow: true,
- },
- {
- imgUrl: "../../static/square-bx.png",
- badge: 0,
- name: "报修",
- redirectUrl: "",
- onShow: true,
- },
- {
- imgUrl: "../../static/square-rl.png",
- badge: 0,
- name: "人脸识别",
- redirectUrl: "",
- onShow: true,
- },
- {
- imgUrl: "../../static/square-xj.png",
- badge: 0,
- name: "巡检",
- redirectUrl: "",
- onShow: true,
- },
- {
- imgUrl: "../../static/square-bz.png",
- badge: 0,
- name: "风险保障",
- redirectUrl: "",
- onShow: true,
- },
- {
- imgUrl: "../../static/square-dljc.png",
- badge: 0,
- name: "电力监察",
- redirectUrl: "",
- onShow: true,
- },
- ],
- Inv: 0,
- searchList: [],
- searchList2: [],
- staticData: {},
- };
- },
- onNavigationBarButtonTap(e) {
- if (e.float == "right") {
- console.log("你点击了扫一扫");
- uni.scanCode({
- // success: function(res) {
- // console.log('条码类型:' + res.scanType);
- // console.log('条码内容:' + res.result);
- // }
- success: function(res) {
- let result = res.result;
- if (
- result.indexOf("http://") == 0 ||
- result.indexOf("https://") == 0
- ) {
- //是网址,直接跳转
- plus.runtime.openURL(result); //调用手机浏览器
- //怎么在APP内跳转网址?
- } else {
- //不是网址,打印出结果
- uni.showToast({
- title: res.result,
- });
- }
- },
- fail: function(err) {
- console.log("扫码失败", err);
- },
- });
- } else {
- this.showTag();
- }
- },
- created: function() {},
- mounted() {
- document.querySelector(".uni-page-head-hd").style.display = "none";
- },
- beforeCreate: function() {},
- onLoad: function(option) {
- if (option.op) {
- this.getData();
- } else {
- if (window.location.host.indexOf("localhost") == -1) {
- this.init();
- } else {
- this.getData();
- }
- }
- this.hackReset = false;
- this.$nextTick(() => {
- this.hackReset = true;
- });
- },
- methods: {
- async init() {
- window.location.href = this.$BASE_URL + "Com/getPageAuthorization1";
- },
- // end
- async getData() {
- const res = await this.$myRequest({
- url: "Index/getDataStatistics",
- showLoading: true,
- });
- this.staticData = res.data.data[0];
- this.alarmCount = this.staticData.alarmCount;
- this.cuIconList[0].badge = this.staticData.unprocessedCount;
- const resOne = await this.$myRequest({
- url: "Com/getAuthorization",
- showLoading: true,
- data: undefined,
- });
- var permissionLabel = resOne.data.permissionLabel;
- this.cuIconList.forEach((el) => {
- if (el.name === "电力监察" && permissionLabel == 4) {
- el.onShow = false;
- }
- });
- },
- handleInput() {
- var newlist = this.searchList2.filter(
- (item) => item.indexOf(this.searchInput) > -1
- );
- this.searchList = newlist;
- },
- navItemClick(index) {
- let url = "";
- switch (index) {
- case 0:
- url = "/pages/siteListAlarming/siteListAlarming";
- break;
- case 1:
- url = "/pages/siteList/siteList";
- break;
- case 7:
- url = "/pages/eleControl/eleControl";
- break;
- default:
- break;
- }
- if (url) {
- uni.navigateTo({
- url: url,
- });
- } else {
- uni.showModal({
- title: "Tips",
- content: "此模块开发中~",
- showCancel: false,
- success: function(res) {
- if (res.confirm) {} else if (res.cancel) {}
- },
- });
- }
- },
- showTag() {
- this.flag = !this.flag;
- },
- InputFocus(e) {
- this.InputBottom = e.detail.height;
- },
- InputBlur(e) {
- this.InputBottom = 0;
- },
- changeTab(Inv) {
- that.navIdx = Inv;
- },
- },
- };
- //解决IOS返回页面不刷新的问题
- history.pushState(null, null, document.URL); //禁止网页返回上一页
- window.addEventListener("popstate", function() {
- // alert('点击返回按钮了!')
- });
- </script>
- <style lang="scss">
- body {
- background: #f1f1f1 !important;
- }
- .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: 28rpx;
- }
- .chart3-box {
- position: relative;
- }
- .chart3-icon {
- position: absolute;
- top: 60rpx;
- left: 30rpx;
- }
- .chart3-icon li {
- padding-top: 25rpx;
- }
- ul,
- li {
- padding: 0;
- margin: 0;
- list-style: none;
- }
- </style>
- <style>
- .shadow {
- box-shadow: 1px 1px 4px rgb(26 26 26 / 10%);
- }
- </style>
|