| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321 |
- <template>
- <view>
- <view class="status_bar"></view>
- <view class="" style="position: relative;top: 40px;">
- <view style="position: fixed;z-index: 100;background-color: #FFFFFF;height: 80px;">
- <uni-nav-bar @clickLeft="clickLeft" left-icon="back" left-text="返回" title="设备搜索"></uni-nav-bar>
- <view class="search_top_input">
- <input type="text" value="" placeholder="请输入设备ID或设备名称" v-model="imports" @input="searchinp" />
- <u-icon name="search" size="40" class="icon" @click="search"></u-icon>
- </view>
- </view>
- <view class="nonetishi" v-if="none">
- 暂无此设备
- </view>
- <view class="prevents" v-else>
- <view class="prevents_item" v-for="item,index in eqlistdata" :key="index" @click="eqdetails(item)">
- <image :src="item.is_online==1? $imageURL+ '/bigdata_app/image/prevention/6.png':$imageURL+ '/bigdata_app/image/prevention/7.png'" mode=""
- class="prevents_item_img"></image>
- <view class="prevents_item_top">
- <p>设备 ID:{{item.imei || item.device_id}}</p>
- <p :class="item.is_online==1?'green':'red'" v-text="item.is_online==1?'在线':'离线'"></p>
- </view>
- <view class="prevents_item_bot">
- <p>设备名称:{{item.device_name}}</p>
- <p>最新上报时间:{{item.addtime|timeFormat()}}</p>
- </view>
- </view>
- </view>
- </view>
- <view class="top" v-if="isTop" @click="top">
- <image :src="$imageURL+'/bigdata_app'+'/image/6209a98f0cb3b5086f2ca36152c9269.png'" mode=""></image>
- </view>
- </view>
- </template>
- <script>
- import {
- Debounce,
- Throttle
- } from "../../../util/anitthro.js"
- export default {
- data() {
- return {
- imports:"",
- device_id:'',
- page:1,
- eqlistdata:[],
- isTop:false,
- none:false
- }
- },
- methods: {
- async searchEquip() {
- const res = await this.$myRequest({
- url: '/api/api_gateway?method=forecast.worm_lamp.lamp_list',
- data: {
- device_type_id: this.device_id,
- device_id: this.imports,
- page:this.page
- }
- })
- this.eqlistdata = this.eqlistdata.concat(res.data)
- console.log(res)
- if(this.eqlistdata.length==0){
- this.none = true
- }else{
- this.none = false
- }
- },
- async getxyEquipList(act) {
- const res = await this.$myRequest({
- url: '/api/api_gateway?method=sex_lure_nl.sex_lure.nl_device_list',
- data: {
- device_type_id: this.device_id,
- device_id: this.imports,
- page: this.page,
- page_size: 10,
- }
- })
- this.eqlistdata = this.eqlistdata.concat(res.data)
- console.log(res)
- if(this.eqlistdata.length==0){
- this.none = true
- }else{
- this.none = false
- }
- },
- async getthxyEquipList(act) {
- this.loadingtf = true
- const res = await this.$myRequest({
- url: '/api/api_gateway?method=forecast.worm_lamp.xy_three_list',
- data: {
- device_type_id: this.device_id,
- page: this.page,
- page_size: 10,
- device_id: this.imports,
- }
- })
- this.eqlistdata = this.eqlistdata.concat(res.data)
- console.log(res)
- if(this.eqlistdata.length==0){
- this.none = true
- }else{
- this.none = false
- }
- },
- async getxctEquipList(act) {
- this.loadingtf = true
- const res = await this.$myRequest({
- url: '/api/api_gateway?method=forecast.worm_lamp.xct_list',
- data: {
- device_type_id: this.device_id,
- page: this.page,
- page_size: 10,
- device_id: this.imports,
- }
- })
- this.eqlistdata = this.eqlistdata.concat(res.data)
- this.eqlistdata.forEach(item => {
- item.addtime = item.uptime;
- })
- console.log(res)
- if(this.eqlistdata.length==0){
- this.none = true
- }else{
- this.none = false
- }
- },
- searchinp(){
- Debounce(() => {
- this.eqlistdata = []
- this.page = 1
- if (this.device_id == 8) {
- this.getthxyEquipList(8)
- } else if (this.device_id == 12) {
- this.getxctEquipList(12)
- } else if (this.device_id == 10) {
- this.getxyEquipList(10)
- } else {
- this.searchEquip(this.device_id)
- }
- }, 1000)()
- },
- search(){
- this.eqlistdata = []
- this.page = 1
- if (this.device_id == 8) {
- this.getthxyEquipList(8)
- } else if (this.device_id == 12) {
- this.getxctEquipList(12)
- } else if (this.device_id == 10) {
- this.getxyEquipList(10)
- } else {
- this.searchEquip(this.device_id)
- }
- },
- clickLeft(){
- uni.navigateTo({
- url:"./index"
- })
- },
- top() {
- uni.pageScrollTo({
- scrollTop: 0,
- duration: 500
- })
- },
- eqdetails(item){
- item.type = Number(this.device_id)
- console.log(item)
- item.pur_id = this.pur_id
- let data = JSON.stringify(item)
- if (item.type == 10) {
- uni.navigateTo({
- url: '/pages/cb/xy2.0/particulars?info=' + data
- });
- } else if (item.type == 8) {
- console.log(data)
- uni.navigateTo({
- url: '/pages/cb/thxydetail/thxydetail?imei=' + item.imei
- });
- } else if (item.type == 12) {
- uni.navigateTo({
- url: '/pages/cb/xctdetail/xctdetail?info=' + data
- });
- }else if (item.type == 32||item.type == 33||item.type == 34||item.type == 35) {
- uni.navigateTo({
- url: '/pages/cb/equip-detail/equip-detail-new?info=' + data
- });
- }else{
- uni.navigateTo({
- url: '/pages/cb/equip-detail/equip-detail?info=' + data
- });
- }
- }
- },
- onLoad(option){
- this.device_id = option.device_id
- this.pur_id = option.pur_id
- },
- onReachBottom() {
- this.page++
- console.log(1)
- if (this.device_id == 8) {
- this.getthxyEquipList(8)
- } else if (this.device_id == 12) {
- this.getxctEquipList(12)
- } else if (this.device_id == 10) {
- this.getxyEquipList(10)
- } else {
- this.searchEquip(this.device_id)
- }
- },
- onBackPress(options) {
- if (options.from === 'navigateBack') {
- return false;
- }
- this.clickLeft();
- return true;
- },
- onPageScroll(e) { //nvue暂不支持滚动监听,可用bindingx代替
- if (e.scrollTop > 200) { //距离大于200时显示
- this.isTop = true
- } else { //距离小于200时隐藏
- this.isTop = false
- }
- },
- }
- </script>
- <style lang="scss">
- .search_top_input {
- width: 90%;
- height: 54rpx;
- background-color: #E4E4E4;
- border-radius: 27rpx;
- position: absolute;
- top: 100rpx;
- right: 5%;
- padding-top: 8rpx;
- box-sizing: border-box;
- input {
- width: 85%;
- // text-indent: 1rem;
- font-size: 26rpx;
- padding-left: 20px;
- // box-sizing: border-box;
- }
-
- .icon {
- position: absolute;
- top: 8rpx;
- right: 26rpx;
- }
- }
- .nonetishi{
- width: 100%;
- position: absolute;
- top: 60px;
- height: 200rpx;
- text-align: center;
- line-height: 200rpx;
- font-size: 16px;
- }
- .prevents {
- width: 100%;
- position: absolute;
- top: 100px;
- .prevents_item {
- width: 95%;
- margin: 0 auto 30rpx;
- border-radius: 10rpx;
- box-shadow: 0 0 10rpx #bcb9ca;
- padding: 20rpx 40rpx 20rpx 80rpx;
- box-sizing: border-box;
- position: relative;
-
- .prevents_item_img {
- width: 30rpx;
- height: 50rpx;
- position: absolute;
- top: -4rpx;
- left: 30rpx;
- }
-
- .prevents_item_top {
- display: flex;
- justify-content: space-between;
- height: 60rpx;
- border-bottom: 2rpx solid #F4F4F4;
- line-height: 60rpx;
- font-size: 26rpx;
-
- .red {
- color: #ff0000;
- }
-
- .green {
- color: #7DBB91;
- }
- }
-
- .prevents_item_bot {
- margin-top: 20rpx;
- font-size: 26rpx;
- color: #BDBDBD;
- }
- }
- }
- .top {
- position: fixed;
- right: 30px;
- bottom: 100px;
- z-index: 100;
- image{
- width: 100rpx;
- height: 100rpx;
- }
- }
- </style>
|