| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397 |
- <template>
- <view>
- <view class="page-body">
- <view class="utabs">
- <view style="width: 95%;margin: 0 auto;">
- <u-tabs :list="list" :is-scroll="true" :current="current" @change="change" item-width="140" font-size="24" gutter="20"
- bar-width="60" active-color="#42b983"></u-tabs>
- </view>
- </view>
- <view class="page-section page-section-gap">
- <map :style="style" scale="3" :latitude="latitude" :longitude="longitude" :markers="covers" :enable-zoom="true"
- @markertap="markertap" :include-points="covers">
- </map>
- <view class="particulars">
- <view class="search_btn_top">
- 已点击设备:
- <span style="padding: 0 20rpx;">{{list[listindex-1].name=="全部"?"未选中":list[listindex-1].name}}</span>
- <span>{{punctuation_id}}</span>
- </view>
- <view class="search_btn_bot">
- <view class="particulars_par" @click="eqinfo">
- 查看详情
- </view>
- <view class="particulars_ser" @click="serTFs">
- 搜索
- </view>
- </view>
- </view>
- <view class="distri_ser" v-if="serTF" :style="disstyle">
- <view class="distri_ser_input">
- <input type="number" v-model="device_id" placeholder="请输入设备ID" @confirm="doSearch" :adjust-position="false" @focus="focus" auto-blur @blur="disblur"/>
- <u-icon name="search" size="38rpx" @click="search"></u-icon>
- </view>
- <p class="distri_ser_title">请选择设备类型(点击选择)</p>
- <view class="distri_ser_type">
- <view :class="typeindex==index?'type_items_bor':'type_items'" v-for="item,index in 6" :key="index" @click="typeselect(index)">
- <image :src="icon[item].url" mode="" class="type_items_img"></image>
- <p class="type_items_p">{{list[item].name}}</p>
- </view>
- </view>
- <view class="search_btn">
- <view class="btn_f" @click="btnF">
- 取 消
- </view>
- <view class="btn_t" @click="btnT">
- 确 定
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- id: 0, // 使用 marker点击事件 需要填写id
- title: 'map',
- latitude: 39.909,
- longitude: 116.39742,
- covers: [],
- list: [{
- name: "全部"
- }, {
- name: "杀虫灯"
- }, {
- name: "测报灯"
- }, {
- name: "性诱测报"
- }, {
- name: "环境检测"
- }, {
- name: "监控设备"
- }, {
- name: "孢子仪",
- }],
- current: 0,
- icon: [{
- id: '', //全部
- url: "../../static/image/distribution/7610e3983eb33ed5b9ad72ebdfc8ed2.png"
- },
- {
- id: 2, //杀虫灯
- url: "../../static/image/distribution/1bd535eb7dbb0809940030d40c64b4c.png"
- },
- {
- id: 3, //测报灯
- url: "../../static/image/distribution/0b551e50be351dbc14f0dd6470e3443.png"
- },
- {
- id: 4, //性诱测报
- url: "../../static/image/distribution/be5c1cfed22713a9544f020cf41c25f.png"
- },
- {
- id: 5, //环境检测
- url: "../../static/image/distribution/8325b1b6079456ce43f952ce13d2919.png"
- },
- {
- id: 6, //监控设备
- url: "../../static/image/distribution/2eb9e550709430a1bd8178568c14785.png"
- },
- {
- id: 7, //孢子仪
- url: "../../static/image/distribution/54a96e2b0ad4efeecbd4a7b5e6deda3.png"
- },
- ],
- type: '', //设备类型
- typeindex: null, //设备选择
- device_id: '', //设备号
- serTF: false, //设备搜索显示隐藏
- punctuationTF: false, //判断是否以点击标点
- punctuation_id: "", //点击标点的id
- punctuation_did: '',
- punctuation_type: '',
- style: {
- width: "100%",
- height: "85%",
- },
- listindex:1,//以选择设备名称
- disstyle:{
- position:"absolute",
- bottom:"0rpx"
- }
- }
- },
- onLoad() {
- this.history()
- },
- methods: {
- async history() { //获取分布位置
- const res = await this.$myRequest({
- url: '/api/api_gateway?method=home.homes.equip_map_location',
- data: {
- equip_type: this.type,
- device_id: this.device_id
- }
- })
- console.log(res)
- this.covers = []
- for (var i = 0; i < res.length; i++) {
- var obj = {}
- obj.latitude = res[i].lat
- obj.longitude = res[i].lng
- obj.id = [res[i].device_id, res[i].d_id, res[i].device_type_id]
- obj.title = res[i].device_name || res[i].device_id
- // obj.width = 25
- for (var j = 0; j < this.icon.length; j++) {
- if (res[i].device_type_id == this.icon[j].id) {
- obj.iconPath = this.icon[j].url
- }
- }
- this.covers.push(obj)
- }
- console.log(res)
- },
- change(index) {
- this.current = index
- if (index == 0) {
- this.type = ''
- } else {
- this.type = index + 1
- }
- this.history()
- },
- markertap(e) {
- console.log(e)
- this.punctuation_id = e.detail.markerId[0]
- this.punctuation_did = e.detail.markerId[1]
- this.punctuation_type = e.detail.markerId[2]
- this.listindex = e.detail.markerId[2]
- },
- typeselect(index) { //选择设备类型
- this.typeindex = index
- this.type = this.icon[index + 1].id
- console.log(this.type)
- },
- doSearch() { //按下回车键
- this.search()
- },
- search() { //点击搜索
- if (this.type == '') {
- uni.showToast({
- title: '请选择设备类型',
- duration: 2000,
- icon: "none"
- });
- } else {
- this.history()
- this.serTF = !this.serTF
- this.style.height = "85%"
- }
- },
- serTFs() {
- this.serTF = !this.serTF
- this.style.height = "65%"
- },
- btnF() { //取消
- this.serTF = !this.serTF
- this.style.height = "85%"
- },
- btnT() { //确定
- this.search()
- },
- focus(e){
- this.disstyle.bottom = e.detail.height-170+"rpx"
- this.style.height = "55%"
- },
- disblur(){
- this.disstyle.bottom = 0
- this.style.height = "65%"
- },
- eqinfo() { //设备信息
- if (this.punctuation_id == '') {
- uni.showToast({
- title: '请点击需查看的设备',
- duration: 2000,
- icon: "none"
- });
- } else {
- switch (this.punctuation_type) {
- case 2:
- uni.navigateTo({
- url: "../prevention/ucharts?d_id=" + this.punctuation_did + "&imei=" + this.punctuation_id
- })
- break;
- case 3:
- uni.navigateTo({
- url: "../cb/cbd/equip-set/historyfile?d_id=" + this.punctuation_did + "&device_id=" + this.punctuation_id
- })
- break;
- case 4:
- uni.navigateTo({
- url: "../cb/xy/equip-set/xyhistoryile?d_id=" + this.punctuation_did + "&device_id=" + this.punctuation_id
- })
- break;
- case 5:
- uni.navigateTo({
- url: "../environment/history?d_id=" + this.punctuation_did + "&device_id=" + this.punctuation_id
- })
- break;
- case 6:
- // uni.navigateTo({
- // url: "../prevention/ucharts?d_id=" + this.punctuation_did + "&device_id=" + this.punctuation_id
- // })
- break;
- case 7:
- uni.navigateTo({
- url: "../cb/bzy/equip-set/bzyhistoryile?d_id=" + this.punctuation_did + "&device_id=" + this.punctuation_id
- })
- break;
- }
- }
- }
- }
- }
- </script>
- <style lang="scss">
- .utabs {
- width: 100%;
- position: fixed;
- top: 0px;
- z-index: 100;
- background-color: #FFFFFF;
- }
- .page-section {
- margin-top: 44px;
- height: 94vh;
- }
- .particulars {
- width: 100%;
- height: 160rpx;
- position: absolute;
- bottom: 0;
- .search_btn_top {
- width: 100%;
- height: 80rpx;
- line-height: 80rpx;
- font-size: 32rpx;
- padding-left: 30rpx;
- box-sizing: border-box;
- }
- .search_btn_bot {
- width: 100%;
- display: flex;
- }
- .particulars_par {
- background-color: #F1F1F1;
- text-align: center;
- width: 50%;
- height: 80rpx;
- line-height: 80rpx;
- font-size: 28rpx;
- }
- .particulars_ser {
- background-color: #57C87B;
- text-align: center;
- width: 50%;
- height: 80rpx;
- line-height: 80rpx;
- font-size: 28rpx;
- color: #FFFFFF;
- }
- }
- .distri_ser {
- position: absolute;
- bottom: 0rpx;
- right: 0px;
- width: 100%;
- height: 440rpx;
- background-color: #FFFFFF;
- .distri_ser_input {
- width: 90%;
- margin: 20rpx auto;
- display: flex;
- background-color: #F1F1F1;
- height: 60rpx;
- border-radius: 30rpx;
- padding: 10rpx 20rpx;
- box-sizing: border-box;
- input {
- width: 90%;
- font-size: 28rpx;
- margin-right: 20rpx;
- }
- }
- .distri_ser_title {
- width: 90%;
- margin: 0 auto;
- padding-left: 20rpx;
- border-left: 4rpx solid #57C87B;
- font-size: 28rpx;
- }
- .distri_ser_type {
- width: 90%;
- margin: 20rpx auto;
- display: flex;
- justify-content: space-around;
- .type_items {
- height: 120rpx;
- width: 120rpx;
- padding: 20rpx 0;
- }
- .type_items_bor {
- height: 120rpx;
- width: 120rpx;
- border: 2rpx solid #57C87B;
- padding: 20rpx 0;
- }
- .type_items_img {
- width: 70rpx;
- height: 70rpx;
- margin-left: 20rpx;
- }
- .type_items_p {
- font-size: 24rpx;
- text-align: center;
- }
- }
- }
- .search_btn {
- width: 100%;
- display: flex;
- .btn_f,
- .btn_t {
- width: 50%;
- text-align: center;
- height: 80rpx;
- line-height: 80rpx;
- font-size: 28rpx;
- }
- .btn_f {
- background-color: #F1F1F1;
- }
- .btn_t {
- background-color: #57C87B;
- color: #FFFFFF;
- }
- }
- </style>
|