12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793 |
- <template>
- <view>
- <u-navbar :title="title" :backIconColor="'#ffffff'" title-color="#ffffff"
- :background="backgroundObj"></u-navbar>
- <view class="gradient-header">
- <view class="jpback">
- </view>
- </view>
- <u-picker title="日期选择" :maskCloseAble="true" v-model="body0data.tabsFrom.show"
- :defaultTime="body0data.tabsFrom.showIndex+'-1'" mode="time" :params="body0data.tabsFrom.params"
- @confirm="selector2confirm" @cancel="selector2cancel">
- </u-picker>
- <view class="main">
- <view class="statistics ">
- <view class="data1">
- <view class="item">
- <view class="line">
- <view class="name">
- {{floorlockInfo.name}}
- </view>
- <view class="item-tags">
- <view class="tag tag1" :class="'typeN typeN'+floorlockInfo.type">
- {{floorlockInfo.typeN}}
- </view>
- <!-- <view class="tag" :class="'statusN statusN'+floorlockInfo.status">
- {{floorlockInfo.statusN}}
-
- </view>
- <view class="tag" :class="'lockStatusN lockStatusN'+floorlockInfo.lockStatus">
- {{floorlockInfo.lockStatusN}}
- </view> -->
- </view>
- </view>
- <view class="line">
- 编号:{{floorlockInfo.lockNo}}
- </view>
- <view class="line" style=" color: #909399;">
- 更新时间:{{floorlockInfo.lastOnlineTime}}
- </view>
- </view>
- <view class="value" v-if="0">
- <u-button type="primary" size="mini" shape="circle">
- <img class="img" src="@/assets/img/button/lock.svg" alt="">
- 降锁
- </u-button>
- </view>
- </view>
- <view class="top-span">
- <view class="item-span">
- <img src="@/assets/img/topspan/span1.png">
- <span>地锁</span>
- <span v-if="floorlockInfo.parkingStatus==1" style="color: #1677FF;">有车</span>
- <span v-else-if="floorlockInfo.parkingStatus==0" style="color: #00B962;">无车</span>
- </view>
- <view class="item-span">
- <img src="@/assets/img/topspan/span2.png">
- <span>地锁</span>
- <span style="color: red;" v-if="floorlockInfo.lockStatus==4||floorlockInfo.lockStatus==0">
- 错误</span>
- <span v-else-if="floorlockInfo.lockStatus==1" style="color: #1677FF;">升起</span>
- <span v-else-if="floorlockInfo.lockStatus==2" style="color: #00B962;">降落</span>
- <span v-else>其他</span>
- </view>
- <view class="item-span">
- <img src="@/assets/img/topspan/span3.png">
- <span>电压</span>
- <span v-if="floorlockInfo.batteryLevel">{{floorlockInfo.batteryLevel}}V</span>
- <span v-else>未知</span>
- </view>
- <view class="item-span">
- <img src="@/assets/img/topspan/span4.png">
- <span>网络</span>
- <span v-if="floorlockInfo.status==1" style="color: #00B962;">在线</span>
- <span v-else-if="floorlockInfo.status==0" style="color: red">离线</span>
- </view>
- <view class="item-span">
- <img src="@/assets/img/topspan/span5.png">
- <span>雷达</span>
- <span v-if="floorlockInfo.radarStatus==0" style="color: #00B962;">正常</span>
- <span v-else-if="floorlockInfo.radarStatus==1" style="color: red">故障</span>
- </view>
- </view>
- </view>
- <u-picker v-model="body2data.vue.show" :params="body2data.vue.params"
- :default-time="body2data.query.startTime" @confirm="body2dataconfirm" mode="time"></u-picker>
- <!-- end-->
- <view class="statistics " v-if="0">
- <view class="title">
- <view class="icon">
- <image class="img" src="@/assets/img/circleCopy1@1x.png" mode=""></image>
- </view>
- <view class="text">
- <view>地锁异常记录</view>
- <view class="check-all">查看全部<u-icon name="arrow-right"></u-icon></view>
- </view>
- </view>
- <view class="contentBody">
- <jpContent :status="jpContentMap.body6">
- <view class="body6main">
- <view class="line" v-for="(item,index) in abnormalRecordsList" :key="index">
- <view class="abnormal-item">
- <!-- @click="gotoUrl('/pages/abnormal/abnormalAlarmDetails?id='+item.id)"
- -->
- <view class="item-title">
- <view class="name">
- <span v-if="item.level==1" class="level level1 ">一级</span>
- <span v-if="item.level==2" class="level level2">二级</span>
- {{item.content}}
- </view>
- <view class="date"
- style="display: flex; justify-content: space-between;margin-top: 4rpx;">
- <view>{{item.title}}</view>
- <view>{{item.createTime}}</view>
- </view>
- </view>
- </view>
- <u-icon name="arrow-right" size="24" color="#BBBBBB"></u-icon>
- </view>
- </view>
- </jpContent>
- </view>
- </view>
- <!-- end-->
- <view class="statistics ">
- <view class="title">
- <view class="icon">
- <image class="img" src="@/assets/img/circleCopy1@1x.png" mode=""></image>
- </view>
- <view class="text">
- <view>地锁信息</view>
- <view class="check-all" v-show="listShow" @click="listShow=false">
- 展开<u-icon name="arrow-down" size="32" color="#AAAAAA"></u-icon>
- </view>
- <view class="check-all" v-if="!listShow" @click="listShow=true">
- 收起<u-icon name="arrow-up" size="32" color="#AAAAAA"></u-icon>
- </view>
- </view>
- </view>
- <view class="contentBody">
- <jpContent :status="jpContentMap.body8">
- <view class="body8main">
- <view class="table">
- <view class="row">
- <view class="name">地锁管理者</view>
- <view class="value">
- {{floorlockInfo.contacts?floorlockInfo.contacts:floorlockInfo.administrator}}
- </view>
- </view>
- <view class="row" v-if="floorlockInfo.contacts&&floorlockInfo.contactPhone">
- <view class="name">联系电话</view>
- <view class="value">{{floorlockInfo.contactPhone}}</view>
- </view>
- <view class="row">
- <view class="name">地锁型号</view>
- <view class="value">{{infotext(floorlockInfo.model)}}</view>
- </view>
- <view class="row">
- <view class="name">出厂编号</view>
- <view class="value">{{infotext(floorlockInfo.factoryNumber)}}</view>
- </view>
- <template v-if="!listShow">
- <view class="row">
- <view class="name">固件版号</view>
- <view class="value">{{infotext(floorlockInfo.solidVersion)}}</view>
- </view>
- <view class="row">
- <view class="name">防护等级</view>
- <view class="value">{{infotext(floorlockInfo.protectionGrade)}}</view>
- </view>
- <view class="row">
- <view class="name">生产日期</view>
- <view class="value">{{infotext(floorlockInfo.manufactureDate)}}</view>
- </view>
- <view class="row">
- <view class="name">标准依据</view>
- <view class="value">{{infotext(floorlockInfo.standardBasis)}}</view>
- </view>
- <view class="row">
- <view class="name">联网卡号</view>
- <view class="value">{{infotext(floorlockInfo.internetCard)}}</view>
- </view>
- <view class="row">
- <view class="name">有效期至</view>
- <view class="value">
- {{floorlockInfo.cardExpirationDate?floorlockInfo.cardExpirationDate.split(' ')[0]:''}}
- </view>
- </view>
- <view class="row" v-if="floorlockInfo.tariffStandard">
- <view class="name">资费标准</view>
- <view class="value">{{infotext(floorlockInfo.tariffStandard)}}元/月</view>
- </view>
- <view class="row">
- <view class="name">地锁启动时间</view>
- <view class="value">{{infotext(floorlockInfo.activationTime)}}</view>
- </view>
- <view class="row" v-if="floorlockInfo.shelfLife">
- <view class="name">地锁质保期</view>
- <view class="value">{{infotext(floorlockInfo.shelfLife)}}年</view>
- </view>
- </template>
- </view>
- </view>
- </jpContent>
- </view>
- </view>
- <view class="statistics main_list1 panel">
- <view class="title">
- <view class="icon">
- <image class="img" src="@/assets/img/circleCopy1@1x.png" mode=""></image>
- </view>
- <view class="text">
- <view>故障记录</view>
- <view class="check-all" @click="gotoUrl('/pages/task/listTask?lockId='+floorlockInfo.id+'&lockName='+floorlockInfo.name)">
- 查看详情
- <u-icon name="arrow-right" size="24" color="#BBBBBB"></u-icon>
- </view>
- </view>
- </view>
- <view class="contentBody">
- <jpContent :status="jpContentMap.body9">
- <view class="body9main">
- <view class="list">
- <view class="item" v-for="(item,index) in dataerrList"
- @click="gotoUrl('/pages/task/maintenanceTaks?id='+item.id)" :key="index">
- <view class="icon">
- <image class="img" v-if="item.errorCodeImage" :src="item.errorCodeImage"
- mode=""></image>
- <image class="img" v-else src="@/assets/img/taskstatus/status3.png" mode="">
- </image>
- </view>
- <view class="body">
- <view class="line1">
- <view class="line1title">
- {{item.errorCodeText}}
- </view>
- <view class="status " :class="'status'+item.status">
- {{item.statusN}}
- </view>
- </view>
- <view class="line2">
- <view class="value">
- {{item.createTime}}
- </view>
- <view class="value">
- {{item.parkingName}}
- </view>
- </view>
- <view class="errorDesc" v-if="item.errorDesc">
- 描述:{{item.errorDesc}}
- </view>
- </view>
- <u-icon name="arrow-right" size="24" color="#BBBBBB"></u-icon>
- </view>
- <u-divider color="#F44336" v-if="dataerrRecordsTotal>3"
- @click="gotoUrl('/pages/task/listTask?lockId='+floorlockInfo.id+'&lockName='+floorlockInfo.name)">故障记录{{dataerrRecordsTotal}}条,点击查看更多</u-divider>
- </view>
- </view>
- </jpContent>
- </view>
- </view>
- <!-- end-->
- <u-divider border-color="#CFD2D5">已经到底了</u-divider>
- </view>
- </view>
- </template>
- <script>
- import jpContent from '@/components/JPcontent.vue'
- import * as echarts from 'echarts';
- import * as API from '@/apis/pagejs/deviceTab.js'
- import * as API_index from '@/apis/pagejs/index.js'
- import {
- parseUnixTime,
- beforeTimeStamp,
- newDate
- } from '@/apis/utils'
- export default {
- components: {
- jpContent
- },
- data() {
- return {
- id: "",
- dataerrList: [],
- dataerrRecordsTotal: 0,
- isReadyfloorStatus: false,
- floorlockInfo: {},
- echartsList: {},
- lockUsageRateData: {},
- body2data: {
- query: {},
- vue: {
- queryN: "",
- show: false,
- params: {
- year: true,
- month: true,
- day: false,
- hour: false,
- minute: false,
- second: false
- }
- },
- data: {}
- },
- listShow: true,
- body0data: {
- query: {},
- data: {},
- tabsFrom: {
- show: false,
- showIndex: "",
- params: {
- year: true,
- month: true,
- day: false,
- hour: false,
- minute: false,
- second: false
- }
- }
- },
- body4data: {
- query: {},
- data: {}
- },
- body8data: {
- query: {},
- data: {},
- popup: false,
- },
- body3data: {
- query: {},
- data: {}
- },
- jpContentMap: {
- body1: 2,
- body2: 2,
- body3: 2,
- body4: 2,
- body5: 2,
- body6: 2,
- body7: 2,
- body8: 2,
- body9: 2,
- body10: 2,
- },
- title: "",
- backgroundObj: {
- background: '#307AF6'
- },
- radiovalue: "1",
- radiolist: [{
- name: '上月',
- value: "3"
- },
- {
- name: '当月',
- value: "1"
- },
- {
- name: '今日',
- value: "2"
- }, {
- name: '当年',
- value: "4"
- }, {
- name: '合计',
- value: "5"
- },
- {
- name: '指定月份',
- value: "0"
- }
- ],
- abnormalRecordsList: [{
- level: 1,
- content: "1111111",
- title: "11",
- createTime: "123:123"
- },
- {
- level: 2,
- content: "1111111",
- title: "11",
- createTime: "123:123"
- }
- ],
- };
- },
- onLoad(op) {
- if (op.id) {
- this.id = op.id
- this.init();
- }
- this.body0data.tabsFrom.showIndex = new Date().getFullYear() + '-' + (new Date().getMonth() + 1)
- },
- onReady() {
- // if(this.id){
- // }
- },
- onShow() {
- if (this.isReadyerrList) {
- this.geterrList()
- }
- },
- methods: {
- geterrList() {
- this.jpContentMap.body9 = 0
- API.errList({
- pageIndex: 1,
- pageSize: 3,
- status: 0,
- lockId:this.id
- }).then((response) => {
- this.dataerrList = response.data.data
- this.dataerrRecordsTotal = response.data.recordsTotal
- this.isReadyerrList = true
- if(this.dataerrRecordsTotal ){
- this.jpContentMap.body9 = 2
- }else{
- this.jpContentMap.body9 = 1
- }
-
- }).catch(error => {
- uni.showToast({
- title: error,
- icon: "none"
- })
- })
- },
- infotext(text) {
- if (text) {
- return text
- } else {
- return ""
- }
- },
- durationShow() {
- if (this.lockUsageRateData.duration) {
- var m = this.lockUsageRateData.duration % 60
- var h = parseInt(this.lockUsageRateData.duration / 60)
- if (h > 0) {
- if (h > 24) {
- var day = parseInt(h / 24)
- h = h % 24
- var px = uni.upx2px(12 * 2)
- if (day > 100) {
- return `${day}<span style='font-size: ${px}px;'>天</span>`
- } else {
- return `${day}<span style='font-size: ${px}px;'>天</span>${h}h`
- }
- } else {
- return `${h}h${m}m`
- }
- } else {
- return `${m}m`
- }
- } else {
- return '0m'
- }
- },
- radioChange(e) {
- // console.log(e);
- },
- // 选中任一radio时,由radio-group触发
- selector2confirm(e) {
- var time = e.year + "-" + e.month
- this.radiolist[5].name = e.year + "年" + e.month + "月"
- this.body0data.tabsFrom.showIndex = time
- this.getLockUsageRate()
- },
- selector2cancel() {
- this.radiovalue = "1"
- this.radiolist[5].name = "指定月份"
- this.getLockUsageRate()
- },
- radioGroupChange(e) {
- console.log(e);
- if (e == 0) {
- this.body0data.tabsFrom.show = true
- } else {
- this.radiolist[5].name = "指定月份"
- this.getLockUsageRate()
- }
- },
- init() {
- this.getInfo()
- this.geterrList()
- //this.getLockUsageRate()
- // this.occupancyByTime(1)
- //this.getbody1()
- //this.getbody2()
- //this.occupancyByTimeBar(1);
- //this.getbody3()
- //this.getbody4()
- //this.durationDistribution()
- },
- occupancyByTime(init) {
- if (init) {
- var date = new Date();
- this.body2data.vue.queryN = date.getFullYear() + "年" + (date.getMonth() + 1) + '月';
- this.body2data.query.startTime = date.getFullYear() + "-" + (date.getMonth() + 1) + "-1"
- var endOfMonth = new Date(date.getFullYear(), date.getMonth() + 1, 0)
- this.body2data.query.endTime = parseUnixTime(endOfMonth, '{y}-{m}-{d}')
- }
- this.jpContentMap.body2 = 0
- this.body2data.query.floorId = this.id
- API_index.occupancyByTime(
- this.body2data.query
- ).then((response) => {
- this.body2data.data = [
- ...response.data.locksTimeList,
- // ...response.data.locksTimeList,
- ];
- if (this.body2data.data.length == 0) {
- this.jpContentMap.body2 = 1
- } else {
- this.jpContentMap.body2 = 2
- this.getbody2()
- }
- }).catch(error => {
- uni.showToast({
- title: error,
- icon: "none"
- })
- })
- },
- body2dataconfirm(e) {
- var date = new Date(e.year + "-" + e.month + "-1");
- this.body2data.vue.queryN = date.getFullYear() + "年" + (date.getMonth() + 1) + '月';
- this.body2data.query.startTime = date.getFullYear() + "-" + (date.getMonth() + 1) + "-1"
- var endOfMonth = new Date(date.getFullYear(), date.getMonth() + 1, 0)
- this.body2data.query.endTime = parseUnixTime(endOfMonth, '{y}-{m}-{d}')
- this.occupancyByTime()
- },
- getLockUsageRate() {
- var obj = {
- floorId: this.id,
- queryType: this.radiovalue
- }
- if (this.radiovalue == 0) {
- obj.queryMonth = this.body0data.tabsFrom.showIndex
- }
- API.lockUsageRate(obj).then((res) => {
- this.lockUsageRateData = res.data
- }).catch(error => {
- uni.hideLoading();
- uni.showToast({
- title: error,
- icon: "none"
- })
- })
- },
- durationDistribution() {
- this.jpContentMap.body4 = 0
- var date = new Date();
- //test
- //this.body4data.query.startTime = date.getFullYear() + "-" + (date.getMonth() + 1) + "-1"
- var endOfMonth = new Date(date.getFullYear(), date.getMonth() + 1, 0)
- // this.body4data.query.endTime = parseUnixTime(endOfMonth, '{y}-{m}-{d}')
- this.body4data.query.floorId = this.id
- API_index.durationDistribution(
- this.body4data.query
- ).then((response) => {
- this.body4data.data = response.data.distribution;
- if (this.body4data.data.length == 0) {
- this.jpContentMap.body4 = 1
- } else {
- this.jpContentMap.body4 = 2
- //this.getbody3()
- this.getbody4()
- }
- }).catch(error => {
- uni.showToast({
- title: error,
- icon: "none"
- })
- })
- },
- getInfo() {
- uni.showLoading({
- title: "加载中",
- mask: true,
- })
- var obj = {
- id: this.id
- }
- this.jpContentMap.body8 = 0
- API.lockDetails(obj).then((res) => {
- this.floorlockInfo = res.data.floorlockInfo
- this.title = this.floorlockInfo.parkingName
- uni.hideLoading();
- this.jpContentMap.body8 = 2
- //this.getWhiteList()
- }).catch(error => {
- uni.hideLoading();
- uni.showToast({
- title: error,
- icon: "none"
- })
- })
- },
- getbody1() {
- var key = "body1pie1"
- var myChart = this.echartsList[key];
- if (!myChart) {
- myChart = echarts.init(document.getElementById(key), null, {
- width: uni.upx2px(300 * 2),
- height: uni.upx2px(170 * 2)
- })
- }
- myChart.clear()
- var option = {
- grid: {
- top: 20,
- left: 0,
- right: 0,
- bottom: 0,
- containLabel: true
- },
- series: [{
- type: 'pie',
- radius: ['80%', '50%'],
- radius: [35, 50],
- data: [{
- itemStyle: {
- color: "#EB3C31"
- },
- value: 1048,
- name: '0.5小时\n20%',
- },
- {
- itemStyle: {
- color: "#EF8132"
- },
- value: 735,
- name: '2小时\n10%'
- },
- {
- itemStyle: {
- color: "#929292"
- },
- value: 580,
- name: '2-6小时\n30%'
- },
- ]
- }]
- };
- myChart.setOption(option);
- this.echartsList[key] = myChart;
- },
- getbody4() {
- var key = "body4pie1"
- var myChart = this.echartsList[key];
- if (!myChart) {
- myChart = echarts.init(document.getElementById(key), null, {
- width: uni.upx2px(300 * 2),
- height: uni.upx2px(170 * 2)
- })
- }
- myChart.clear()
- var dataApi = this.body4data.data;
- var data = []
- var num = 0
- var sum = 0
- Object.keys(dataApi).forEach(key1 => {
- num += dataApi[key1]
- });
- var i = 0
- Object.keys(dataApi).forEach(key1 => {
- var value = dataApi[key1]
- if (value != 0) {
- var obj = {
- value: value,
- name: key1
- }
- if (num != 0) {
- var valueInt = parseInt(value / num * 100)
- if (valueInt == 0 && value != 0) {
- valueInt = 1
- }
- sum += valueInt;
- if (i == Object.keys(dataApi).length - 1) {
- if (sum != 100) {
- valueInt += (100 - sum)
- }
- }
- obj.name += '\n' + (valueInt) + '%'
- }
- data.push(obj)
- }
- i++;
- });
- var option = {
- grid: {
- top: 20,
- left: 0,
- right: 0,
- bottom: 0,
- containLabel: true
- },
- series: [{
- type: 'pie',
- radius: ['80%', '50%'],
- radius: [45, 60],
- data: data
- }]
- };
- myChart.setOption(option);
- this.echartsList[key] = myChart;
- },
- occupancyByTimeBar(init) {
- if (init) {
- var date = new Date();
- //test
- //this.body3data.query.startTime = date.getFullYear() + "-" + (date.getMonth() + 1) + "-1"
- var endOfMonth = new Date(date.getFullYear(), date.getMonth() + 1, 0)
- //this.body3data.query.endTime = parseUnixTime(endOfMonth, '{y}-{m}-{d}')
- }
- this.jpContentMap.body3 = 0
- this.body3data.query.floorId = this.id
- API_index.occupancyByTimeBar(
- this.body3data.query
- ).then((response) => {
- this.body3data.data = [
- ...response.data.locksTimeList,
- // ...response.data.locksTimeList,
- ];
- if (this.body3data.data.length == 0) {
- this.jpContentMap.body3 = 1
- } else {
- this.jpContentMap.body3 = 2
- this.getbody3()
- }
- }).catch(error => {
- uni.showToast({
- title: error,
- icon: "none"
- })
- })
- },
- getbody3() {
- var key = "body3bar1"
- var myChart = this.echartsList[key];
- if (!myChart) {
- myChart = echarts.init(document.getElementById(key), null, {
- width: uni.upx2px(300 * 2),
- height: uni.upx2px(170 * 2)
- })
- }
- var dataApi = this.body3data.data;
- myChart.clear()
- var data1 = []
- var data2 = [] //useDays
- var i = 0
- dataApi[0].timeUseList.forEach(item => {
- Object.keys(item).forEach(key1 => {
- data1.push(key1 + '点')
- var num = 0
- dataApi.forEach(item2 => {
- num += item2.timeUseList[i][key1].useDays
- })
- data2.push(num)
- });
- i += 1
- })
- var axisLabel = {
- rotate: 40,
- interval: 0,
- textStyle: {
- color: "#333"
- }
- }
- if (data1.length < 7) {
- axisLabel = {
- interval: 0,
- textStyle: {
- color: "#333"
- },
- }
- } else {
- axisLabel.interval = 0;
- }
- var option = {
- xAxis: {
- type: 'category',
- data: data1,
- axisLabel: axisLabel,
- },
- tooltip: {
- trigger: 'axis',
- axisPointer: {
- type: 'shadow'
- },
- formatter: function(params) {
- var result = params[0].name + '<br/>';
- for (var i = 0; i < params.length; i++) {
- result += params[i].marker + ' ' + params[i].value + '次<br/>';
- }
- return result;
- }
- },
- yAxis: {
- type: 'value'
- },
- grid: {
- top: 20,
- left: 0,
- right: 0,
- bottom: 0,
- containLabel: true
- },
- series: [{
- itemStyle: {
- color: "#5A88E5"
- },
- data: data2,
- type: 'bar'
- }]
- };
- myChart.setOption(option);
- this.echartsList[key] = myChart;
- },
- getbody2() {
- var key = "body2line1"
- var myChart = this.echartsList[key];
- var dataApi = this.body2data.data;
- var head = 20 * (parseInt(dataApi.length / 4)) + 20
- if (!myChart) {
- myChart = echarts.init(document.getElementById(key), null, {
- width: uni.upx2px(300 * 2),
- height: uni.upx2px((170 + head) * 2)
- })
- }
- myChart.clear()
- var data1 = []
- var series = [];
- dataApi.forEach(item => {
- var obj = {
- name: item.lockName,
- areaStyle: {},
- itemStyle: {
- color: "#BBD4FB"
- },
- label: {
- show: true,
- position: 'top',
- color: "#307AF6"
- },
- data: [],
- type: 'line'
- }
- if (dataApi.length == 1) {
- obj.label.color = "#307AF6"
- obj.areaStyle = {}
- obj.itemStyle = {
- color: "#BBD4FB"
- }
- }
- item.timeUseList.forEach(item2 => {
- Object.keys(item2).forEach(key1 => {
- obj.data.push(item2[key1].useRate)
- });
- })
- series.push(obj)
- })
- dataApi[0].timeUseList.forEach(item => {
- Object.keys(item).forEach(key1 => {
- data1.push(key1)
- });
- })
- var axisLabel = {
- rotate: 40,
- interval: 0,
- textStyle: {
- color: "#333"
- }
- }
- if (data1.length < 7) {
- axisLabel = {
- interval: 0,
- textStyle: {
- color: "#333"
- },
- }
- } else {
- axisLabel.interval = 0;
- }
- var option = {
- xAxis: {
- type: 'category',
- data: data1,
- axisLabel: axisLabel,
- },
- tooltip: {
- trigger: 'axis',
- axisPointer: {
- type: 'shadow'
- },
- formatter: function(params) {
- var result = params[0].name + '点<br/>';
- for (var i = 0; i < params.length; i++) {
- result += params[i].marker + params[i].seriesName + ': ' + params[i].value +
- '%<br/>';
- }
- return result;
- }
- },
- yAxis: {
- type: 'value'
- },
- grid: {
- top: (20 + head),
- left: 0,
- right: 0,
- bottom: 0,
- containLabel: true
- },
- series: series,
- };
- myChart.setOption(option);
- this.echartsList[key] = myChart;
- },
- }
- }
- </script>
- <style lang="scss">
- .gradient-header {
- height: 0px;
- }
- .jpback {
- height: 268rpx;
- background: linear-gradient(180deg, rgba(22, 119, 255, 1) 20%, rgba(121, 177, 255, 1) 100%);
- }
- .main {
- padding: 32rpx;
- .no_statistics {
- margin-bottom: 24rpx;
- }
- .statistics {
- border-radius: 8px;
- background-color: rgba(255, 255, 255, 1);
- box-shadow: 0px 1px 6px 0px rgba(0, 59, 142, 0.05);
- margin-bottom: 24rpx;
- padding: 40rpx;
- .title {
- display: flex;
- align-items: center;
- margin-bottom: 32rpx;
- font-weight: bold;
- .img {
- width: 36rpx;
- height: 36rpx;
- vertical-align: middle;
- border-radius: 999px;
- }
- .change {
- display: flex;
- align-items: center;
- .change-img {
- width: 32rpx;
- height: 32rpx;
- vertical-align: middle;
- }
- text {
- margin-left: 8rpx;
- }
- }
- .text {
- color: rgba(16, 16, 16, 1);
- font-size: 36rpx;
- margin-left: 16rpx;
- display: flex;
- justify-content: space-between;
- align-items: center;
- width: 100%;
- .tag {
- border-radius: 4px;
- border: 1px solid rgba(187, 187, 187, 1);
- color: rgba(51, 51, 51, 1);
- font-size: 24rpx;
- padding: 1px 8rpx;
- margin-left: 8rpx;
- }
- }
- .change {
- margin-left: 16rpx;
- font-size: 24rpx;
- color: #838383;
- }
- .check-all {
- margin-left: auto;
- color: rgba(131, 131, 131, 1);
- font-size: 24rpx;
- }
- }
- }
- }
- .data1 {
- display: flex;
- align-items: center;
- justify-content: space-between;
- .item {
- .line {
- display: flex;
- align-items: center;
- }
- .name {
- color: rgba(51, 51, 51, 1);
- font-size: 36rpx;
- font-weight: bold;
- margin-right: 8rpx;
- }
- .item-tags {
- display: flex;
- .tag {
- border-radius: 4px;
- background-color: rgba(39, 177, 72, 1);
- color: rgba(255, 255, 255, 1);
- font-size: 24rpx;
- padding: 2rpx 8rpx;
- margin-right: 8rpx;
- }
- .typeN1 {
- background-color: rgba(22, 119, 255, 1);
- }
- .typeN2 {
- background-color: #8161ff;
- background-color: #8161ff;
- }
- .statusN {
- background-color: #838383
- }
- .lockStatusN {
- background-color: rgba(153, 153, 153, 1);
- }
- .lockStatusN2 {
- background-color: #03A9F4
- }
- }
- }
- .value {
- .img {
- margin-right: 8rpx;
- width: 32rpx;
- height: 32rpx;
- }
- }
- }
- .data2 {
- height: 336rpx;
- padding: 32rpx;
- border-radius: 12px;
- background: linear-gradient(180deg, rgba(222, 222, 222, 1) 3%, rgba(255, 255, 255, 1) 5%, rgba(232, 232, 232, 1) 56%, rgba(255, 255, 255, 1) 59%, rgba(236, 236, 236, 1) 95%, rgba(215, 215, 215, 1) 98%);
- .top {
- background-repeat: round;
- background-image: url('@/assets/img/deviceTab/index3-2.png');
- display: flex;
- justify-content: space-around;
- text-align: center;
- height: 152rpx;
- align-items: center;
- .item {
- .name {
- color: rgba(16, 16, 16, 1);
- font-size: 32rpx;
- }
- .value {
- color: rgba(16, 16, 16, 1);
- font-size: 48rpx;
- font-weight: bold;
- }
- }
- }
- .body {
- padding: 16rpx;
- }
- }
- .body5data {
- .line {
- display: flex;
- align-items: center;
- justify-content: space-between;
- .data {
- display: flex;
- width: 80%;
- justify-content: space-between;
- .item {
- color: rgba(51, 51, 51, 1);
- font-size: 16px;
- }
- .value {
- color: rgba(119, 119, 119, 1);
- font-size: 16px;
- }
- }
- }
- }
- .body7data {
- .line {
- display: flex;
- align-items: center;
- justify-content: space-between;
- .value {
- width: 33%;
- padding: 16rpx;
- color: rgba(51, 51, 51, 1);
- }
- .value:nth-child(3) {
- text-align: center;
- }
- }
- /* 隔行变色: 偶数行设置背景色 */
- .line:nth-child(odd) {
- background-color: #F2F2F2;
- /* 偶数行 */
- }
- .line:nth-child(even) {
- background-color: #FFFFFF
- /* 奇数行 */
- }
- }
- .body8main {
- .line {
- display: flex;
- align-items: center;
- justify-content: space-between;
- .value {
- width: 33%;
- padding: 16rpx;
- text-align: center;
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- }
- }
- /* 隔行变色: 偶数行设置背景色 */
- .line:nth-child(odd) {
- color: rgba(119, 119, 119, 1);
- font-size: 14px;
- /* 偶数行 */
- }
- .line:nth-child(even) {
- color: rgba(16, 16, 16, 1);
- font-size: 16px;
- /* 奇数行 */
- }
- .table {
- .table_v {
- width: 100%;
- }
- .table_tr {
- display: flex;
- justify-content: space-between;
- }
- .row {
- display: flex;
- align-items: center;
- height: 72rpx;
- font-size: 28rpx;
- padding: 0 24rpx;
- .name {
- width: 240rpx;
- }
- }
- .table_td {
- height: 72rpx;
- font-size: 28rpx;
- display: flex;
- align-items: center;
- }
- .table_td1 {
- width: 30%;
- }
- .table_td2 {
- width: 30%;
- }
- .table_td3 {
- width: 30%;
- }
- .table_td4 {
- width: 10%;
- }
- /* 隔行变色: 偶数行设置背景色 */
- .row:nth-child(odd) {
- background-color: #f9f9f9;
- /* 偶数行 */
- }
- .table_tr:nth-child(odd) {
- background-color: #f9f9f9;
- /* 偶数行 */
- }
- .row:nth-child(even) {
- background-color: #ffffff;
- /* 奇数行 */
- }
- .table_tr:nth-child(even) {
- background-color: #ffffff;
- /* 奇数行 */
- }
- }
- }
- .body6main {
- .line {
- display: flex;
- justify-content: space-between;
- }
- .abnormal-item:last-of-type {
- border-bottom: none !important;
- padding-bottom: 0;
- }
- .abnormal-item {
- width: 100%;
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 16rpx;
- border-bottom: 1px solid rgba(245, 245, 245, 1);
- .item-title {
- .level {
- color: #fff;
- border-radius: 8rpx;
- font-weight: 400;
- padding: 4rpx 8rpx;
- font-size: 22rpx;
- margin-right: 2px;
- }
- .level1 {
- background: red;
- }
- .level2 {
- background-color: rgba(255, 123, 0, 1);
- }
- color: rgba(51, 51, 51, 1);
- width: 100%;
- .img {
- width: 32rpx;
- height: 32rpx;
- margin-right: 8rpx;
- }
- .name {
- color: rgba(51, 51, 51, 1);
- font-weight: bold;
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- }
- .date {
- color: rgba(119, 119, 119, 1);
- font-size: 24rpx;
- }
- }
- .item-value {
- text-align: right;
- display: flex;
- align-items: center;
- .more {
- margin-left: 8rpx;
- }
- .value1 {
- font-weight: bold;
- color: rgba(51, 51, 51, 1);
- }
- .value2 {
- color: rgba(119, 119, 119, 1);
- font-size: 24rpx;
- }
- }
- }
- }
- // 地锁信息弹窗
- .body8data-popup {
- .content {
- padding: 32rpx;
- .headline {
- color: rgba(16, 16, 16, 1);
- font-size: 36rpx;
- text-align: center;
- font-weight: bold;
- margin-bottom: 24rpx;
- }
- .infos {
- //padding-bottom: 100rpx;
- .item:last-of-type {
- border: none;
- }
- .item {
- display: flex;
- align-items: center;
- //line-height: 48rpx;
- padding: 20rpx 0;
- border-bottom: 1px solid #cccccc;
- .item-title {
- color: rgba(51, 51, 51, 1);
- width: 200rpx;
- }
- .item-value {
- color: #666666;
- flex: 1;
- margin-left: 16rpx;
- display: flex;
- align-items: center;
- justify-content: space-between;
- .img {
- width: 32rpx;
- height: 32rpx;
- transform: rotate(90deg);
- margin-left: 96rpx;
- }
- }
- }
- }
- .get {
- height: 80rpx;
- line-height: 80rpx;
- border-radius: 4px;
- background-color: rgba(22, 119, 255, 1);
- color: rgba(255, 255, 255, 1);
- font-size: 32rpx;
- }
- }
- }
- .top-span {
- border-top: 1px solid rgba(245, 245, 245, 1);
- display: flex;
- flex-wrap: wrap;
-
- padding-top: 16rpx;
- margin-top: 16rpx;
- .item-span {
- white-space: pre;
- display: flex;
- align-items: center;
- margin-top: 4rpx;
- width: 33%;
- font-size: 28rpx;
- span {
- margin: 0 8rpx;
- }
- img {
- width: 28rpx;
- height: 28rpx;
- }
- }
- .lockStatusX1 {
- color: #00B962;
- }
- .lockStatusX2 {
- color: #1677FF;
- }
- .statusX1 {
- color: #00B962;
- }
- .statusX2 {
- color: #1677FF;
- }
- }
- .main_list1 {
- margin-top: 24rpx;
- padding: 24rpx;
- .list-body {
- padding: 24rpx 0;
- .item {
- border-bottom: 1px solid rgba(232, 232, 232, 1);
- }
- .title {
- display: flex;
- justify-content: space-between;
- .name {
- color: rgba(51, 51, 51, 1);
- font-size: 32rpx;
- font-weight: bold;
- }
- .status {}
- .statusN1 {}
- .statusN2 {}
- .statusN3 {}
- }
- .body {
- display: flex;
- color: rgba(51, 51, 51, 1);
- font-size: 28rpx;
- .name {
- width: 150rpx;
- }
- .value {}
- }
- }
- .list {
- //padding: 24rpx 0;
- .item {
- display: flex;
- border-bottom: 1px solid rgba(232, 232, 232, 1);
- padding: 12rpx 0;
- margin: 12rpx 0;
- .img {
- width: 72rpx;
- height: 72rpx;
- }
- .body {
- margin: 0 12rpx;
- width: 100%;
- .line1,
- .line2 {
- display: flex;
- justify-content: space-between;
- }
- .line2 {
- color: rgba(119, 119, 119, 1);
- font-size: 24rpx;
- margin-top: 8rpx;
- }
- .line1 {
- .line1title {
- color: rgba(51, 51, 51, 1);
- font-size: 28rpx;
- font-weight: bold;
- }
- .status {
- background-color: rgba(255, 61, 0, 1);
- font-size: 24rpx;
- color: #fff;
- padding: 2rpx 8rpx;
- //border-radius: 4px;
- }
- .status0 {
- background-color: rgba(255, 61, 0, 1);
- }
- .status1 {
- background-color: #007aff;
- }
- .status2 {
- background-color: #ff9900;
- }
- .status3 {
- background-color: #19be6b;
- }
- .status4 {
- border: 1px solid rgba(255, 61, 0, 1);
- color: rgba(255, 61, 0, 1);
- }
- }
- .errorDesc {
- margin: 8rpx 0;
- width: 480rpx;
- color: #777777;
- font-size: 24rpx;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- /* 禁止换行,强制单行 */
- }
- }
- }
- // .item:not(:last-child) {
- // border-bottom:1px solid rgba(232,232,232,1);
- // }
- }
- }
- </style>
|