123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229 |
- <template>
- <view class="wrap">
- <view>
- <u-navbar
- :title="title"
- title-color="#fff"
- :custom-back="customBack"
- :border-bottom="false"
- back-icon-color="#CCE8FF"
- :background="{background: 'linear-gradient(99deg, #7A4398 0%, #5A5DB9 100%)' }"></u-navbar>
- </view>
- {{deviceType}}
-
- <u-cell-item icon="setting-fill" :title="deviceTypeName" :arrow="true" @click="selectShow = true" arrow-direction="right"></u-cell-item>
- <u-select v-model="selectShow" :list="deviceTypeListData" @confirm="selectConfirm"></u-select>
-
- <u-cell-item class="road-select-cell" icon="map-fill" bg-color="#fff" :border-bottom="false" :title="roadName" :arrow="true" @click="roadSelectShow = true" arrow-direction="right"></u-cell-item>
- <u-select v-model="roadSelectShow" :list="roadListData" value-name="roadNo" label-name="roadName" @confirm="roadSelectConfirm"></u-select>
-
- <u-gap height="12" bg-color="#e7e7e7"></u-gap>
-
- <mescroll-uni ref="mescrollRef" @init="mescrollInit" :top="config.platform=='h5'?300:400" @down="downCallback" :up="upOption" @up="upCallback" @emptyclick="emptyClick">
- <view class="g-device-item u-flex u-row-between u-m-b-24" v-for="item in dataList" :key="item.id">
- <view class="u-font-30" style="color: #414141;">
- <view class="u-m-b-10 ">
- <text>{{item.deviceType|deviceType}}</text>
- <text class="u-p-l-40" style="font-weight: bold;">{{item.roadName}}-{{item.spaceName}}</text>
- </view>
- <view class="u-m-b-10" v-if="item.deviceType==3">
- <text>{{item.entranceName}}</text>
- <text class="u-m-l-20">{{item.roadwayName}}</text>
- </view>
- <view class="u-font-26">设备编号:{{item.deviceNo}}</view>
- </view>
- <view class="">
- <view class="" :class="{'c-offline':item.deviceStatus=='0','c-online':item.deviceStatus=='1','c-repair':item.deviceStatus=='2'}">
- {{item.deviceStatus|deviceStatus}}
- </view>
- </view>
- </view>
- </mescroll-uni>
- </view>
- </template>
- <script>
- import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
- export default{
- mixins: [MescrollMixin],
- data(){
- return{
- selectShow:false,
- roadSelectShow:false,
- title:"设备列表",
- deviceTypeName:'全部类型',
- deviceType:null,
- roadName:'全部路段/停车场',
- roadNo:'',
- deviceRunStatus:'',
- upOption:{
-
-
-
-
-
- noMoreSize: 4,
- empty:{
- tip: '~ 暂无数据 ~',
-
- }
- },
- dataList: [],
- deviceTypeId:'',
- deviceTypeListData:this.config.deviceTypeList,
- roadListData:[],
- dictData:[],
- }
- },
- onLoad(page){
-
- this.deviceRunStatus = page.param;
- if(this.deviceRunStatus==''){
- this.title = "全部设备"
- }else if(this.deviceRunStatus=='0'){
- this.title = "离线设备"
- } else if(this.deviceRunStatus=='1'){
- this.title = "运行中"
- }else if(this.deviceRunStatus=='2'){
- this.title = "未检测"
- }
- this.getRoadList();
-
-
- },
- onShow(){
- },
- computed:{
- filterDeviceStatus(){
- return function(value){
- let v = '';
- for (let i = 0; i < this.dictData.length; i++){
-
-
- let item = this.dictData[i];
- if (value == item.status) {
- v = item.dictLabel;
- break;
- }
- }
- return v
- }
- }
- },
- methods:{
-
- upCallback(page) {
-
-
-
- let params ={
- roadNo:this.roadNo,
- deviceType:this.deviceType,
- deviceStatus:this.deviceRunStatus,
- pageNum:page.num,
- pageSize:page.size
- }
- this.$u.api.getDeviceList(params).then(curPageData=>{
- console.log('curPageData',curPageData)
-
- this.mescroll.endSuccess(curPageData.total);
- this.mescroll.endBySize(curPageData.data.rows.length, curPageData.total);
-
- if(page.num == 1) this.dataList = [];
- this.dataList=this.dataList.concat(curPageData.data.rows);
- }).catch((err)=>{
- uni.showToast({
- title:'链接失败'
- });
- console.log('err',err)
-
- this.mescroll.endErr();
- })
- },
-
- emptyClick(){
-
- },
-
- tabChange(index) {
- this.dataList = [];
- this.tabIndex = index;
- this.mescroll.resetUpScroll();
-
- },
- customBack(){
- uni.reLaunch({
- url: '/pages/index/index'
- });
- },
- handlegetDictData(device_status){
- let that = this;
- this.$u.api.getDictData(device_status).then(res=>{
- if(res.code==200){
- res.data.data.map(function(currentValue,index,arr){
- that.dictData.push({status:currentValue.dictValue,dictLabel:currentValue.dictLabel})
-
- })
-
- console.log('getDeviceStatis',this.dictData);
- }else{
- uni.showToast({
- icon:'none',
- title:res.msg
- })
- }
- console.log('res',res);
- }).catch(err=>{
- console.log('err',err);
- })
- },
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- selectConfirm(e){
- console.log('selectConfirm',e);
- this.deviceTypeName = e[0].label;
- this.deviceType = e[0].value;
- this.mescroll.resetUpScroll();
- },
- getRoadList(){
- let that = this;
- that.$u.api.getRoadList()
- .then(res=>{
- this.roadListData = res.data;
- console.log('this.getRoadList',res)
- }).catch(err=>{
- this.$refs.uToast.show({
- title: err.msg,
- type: 'error',
- });
- });
- },
- roadSelectConfirm(e){
-
- this.roadName = e[0].label;
- this.roadNo = e[0].value;
- console.log('this.roadNo',this.roadNo);
- this.mescroll.resetUpScroll();
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- // @import './equipmentList.scss'
- </style>
|