| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516 |
- <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"
- font-size="24" gutter="20" bar-width="60" active-color="#42b983"></u-tabs>
- </view>
- </view>
- <view class="LocationAndDetails">
- <view class="search_bot_input">
- <input type="text" value="" placeholder="请输入设备ID" @input="searchinput" />
- <u-icon name="search" size="40" class="icon" @click="search"></u-icon>
- </view>
- </view>
- <view class="page-section page-section-gap">
- <map class="map" :markers="covers" scale="3" @markertap="markertap">
- <cover-view slot="callout">
- <block v-for="(item,index) in covers" :key="index">
- <cover-view class="customCallout" :marker-id="item.id">
- <cover-view class="content">
- {{item.title}}
- </cover-view>
- </cover-view>
- </block>
- </cover-view>
- </map>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- id: 0, // 使用 marker点击事件 需要填写id
- title: 'map',
- covers: [],
- list: [],
- current: 0,
- icon: [
- // {
- // id: '', //全部
- // url: "../../static/images/distribution/7610e3983eb33ed5b9ad72ebdfc8ed2.png",
- // name: "全部"
- // },
- {
- id: 2, //杀虫灯
- name: "杀虫灯"
- },
- {
- id: 3, //测报灯
- name: "测报灯"
- },
- {
- id: 4, //性诱测报
- name: "性诱测报"
- },
- {
- id: 5, //环境检测
- name: "环境监测"
- },
- {
- id: 6, //监控设备
- name: "监控设备"
- },
- {
- id: 7, //孢子仪
- name: "孢子仪",
- },
- {
- id: 10, //性诱2.0
- name: "性诱2.0"
- },
- ],
- type: '5', //设备类型
- typeindex: null, //设备选择
- device_id: '', //设备号
- serTF: false, //设备搜索显示隐藏
- punctuationTF: false, //判断是否以点击标点
- punctuation_id: "", //点击标点的id
- punctuation_did: '',
- punctuation_type: '',
- listindex: 1, //以选择设备名称
- disstyle: {
- position: "absolute",
- bottom: "0rpx"
- },
- facilitydatas: [],
- }
- },
- onLoad() {
- this.device_id = ""
- this.usertype()
- },
- methods: {
- async history() { //获取分布位置
- const res = await this.$myRequest({
- url: '/api/api_gateway?method=home.homes.equip_map_location_list',
- data: {
- equip_type: this.type,
- device_id: this.device_id
- }
- })
- console.log(res)
- this.covers = []
- var arr = []
- for (var i = 0; i < res.length; i++) {
- if (res[i].lat !== "" && res[i].lng !== "") {
- // if (i < 2000) {
- var obj = {}
- obj.latitude = Number(res[i].lat)
- obj.longitude = Number(res[i].lng)
- obj.id = i
- obj.title = res[i].device_id
- obj.width = 30
- obj.height = 30
- obj.joinCluster = true
- arr.push(obj)
- // }
- }
- }
- this.covers = arr
- this.facilitydatas = res
- if (res.length == 0) {
- uni.showToast({
- title: '未查询到设备',
- duration: 2000,
- icon: "none"
- });
- }
- },
- async usertype() { //设备列表
- const res = await this.$myRequest({
- url: '/api/api_gateway?method=home.homes.user_device_type',
- })
- for (var i = 0; i < res.length; i++) {
- if (res[i].id == 8 ||
- res[i].id == 12 ||
- res[i].id == 14 ||
- res[i].id == 16
- ) {
- continue;
- }
- var obj = {
- name: res[i].type_name,
- id: res[i].id
- }
- this.list.push(obj)
- }
- this.type = this.list[0].id
- this.history(this.device_id)
- // console.log(this.list)
- },
- change(index) {
- console.log(index)
- this.device_id = ""
- this.current = index
- for (var i = 0; i < this.icon.length; i++) {
- if (this.list[index].name == this.icon[i].name) {
- console.log(this.icon[i].id)
- this.type = this.icon[i].id
- }
- }
- this.history()
- },
- markertap(e) {
- console.log(e)
- console.log(this.facilitydatas[e.detail.markerId])
- this.device_id = this.facilitydatas[e.detail.markerId].device_id
- this.punctuation_did = this.facilitydatas[e.detail.markerId].d_id
- this.punctuation_type = this.facilitydatas[e.detail.markerId].device_type_id
- uni.showModal({
- title: '设备详情查询',
- content: "设备id:" + this.device_id,
- cancelText: "取消",
- confirmText: "设备详情",
- success: (res) => {
- if (res.confirm) {
- this.eqinfo(this.facilitydatas[e.detail.markerId])
- } else if (res.cancel) {
- // this.serTFs()
- }
- }
- });
- },
- serTFs() {
- this.history()
- },
- async eqinfo(item) { //设备信息
- item.type = this.punctuation_type
- if (this.punctuation_type == '') {
- uni.showToast({
- title: '请点击需查看的设备',
- duration: 2000,
- icon: "none"
- });
- } else {
-
- const resDefault = await this.$myRequest({
- url: '/api/api_gateway?method=forecast.worm_lamp.lamp_list',
- data: {
- device_type_id: this.punctuation_type,
- page: 1,
- page_size: "10",
- device_id: item.device_id,
- }
- })
- let itemDefault = {
- ...item
- }
- if (resDefault.counts == 1) {
- itemDefault = {
- ...item,
- ...resDefault.data[0]
- }
- }
- switch (this.punctuation_type) {
- case 15:
- uni.navigateTo({
- url: '../environment/gsequipment?shebei=' + JSON.stringify(itemDefault),
- });
- break;
- case 2:
- uni.navigateTo({
- url: "../prevention/equipmentdetails?shebei=" + JSON.stringify(itemDefault)
- })
- break;
- // case 3:
-
- // case 4:
- // uni.navigateTo({
- // url: "../cb/xy/equip-set/xyhistoryile?d_id=" + this.punctuation_did + "&device_id=" + this.device_id
- // })
- // break;
- case 5:
- const res = await this.$myRequest({
- url: '/api/api_gateway?method=weather.weather.qxz_page',
- data: {
- page: 1,
- device_status: '',
- page_size: 10,
- device_id: item.device_id,
- },
- })
- let items = {
- ...item
- }
- if (res.nums == 1) {
- items = {
- ...item,
- ...res.ids[0]
- }
- }
- uni.navigateTo({
- url: "../environment/equipment?shebei=" + JSON.stringify(items)
- })
- break;
- case 45:
- const res45 = await this.$myRequest({
- url: '/api/api_gateway?method=weather.weather.shang_qing_qxz_page',
- data: {
- page: 1,
- page_size: "10",
- device_id: item.device_id,
- }
- })
- let item45 = {
- ...item
- }
- if (res45.nums == 1) {
- item45 = {
- ...items,
- ...res45.ids[0]
- }
- }
- uni.navigateTo({
- url: "../environment/equipment?shebei=" + JSON.stringify(item45)
- })
- break;
- case 6:
- uni.navigateTo({
- url: "/pages/webview?device_id=" + item.device_id + "&accessToken=" + uni
- .getStorageSync('session_key')
- })
- break;
- case 43:
- uni.navigateTo({
- url: "../fmSys/details?info=" + JSON.stringify(itemDefault)
- })
- break;
- case 44:
- uni.navigateTo({
- url: "/pages/webview?device_id=" + item.device_id + "&accessToken=" + uni
- .getStorageSync('session_key') +
- '&type=dgp'
- })
- break;
- // case 7:
- // uni.navigateTo({
- // url: "../cb/bzy/equip-set/bzyhistoryile?d_id=" + this.punctuation_did + "&device_id=" + this.device_id
- // })
- // break;
- case 10:
- uni.navigateTo({
- url: "../cb/xy2.0/particulars?info=" + JSON.stringify(itemDefault)
- })
- break;
- case 26:
- case 11:
- uni.navigateTo({
- url: '../disease/cmb?shebei=' + JSON.stringify(itemDefault),
- });
- break;
- default:
- uni.navigateTo({
- url: "../cb/equip-detail/equip-detail?info=" + JSON.stringify(itemDefault)
- })
- break;
- }
-
- }
- }
- }
- }
- </script>
- <style lang="scss">
- .utabs {
- width: 100%;
- position: fixed;
- top: 0px;
- z-index: 100;
- background-color: #FFFFFF;
- }
- .LocationAndDetails {
- width: 100%;
- height: 60rpx;
- position: fixed;
- top: 54px;
- .search_bot_input {
- width: 90%;
- height: 54rpx;
- background-color: #E4E4E4;
- border-radius: 27rpx;
- position: relative;
- box-sizing: border-box;
- padding-top: 8rpx;
- margin: 0 auto;
- input {
- width: 85%;
- // text-indent: 1rem;
- font-size: 26rpx;
- padding-left: 40rpx;
- box-sizing: border-box;
- }
- .icon {
- position: absolute;
- top: 8rpx;
- right: 26rpx;
- }
- }
- // .Location{
- // display: flex;
- // margin-top: 20rpx;
- // justify-content: space-around;
- // .particulars_par {
- // background-color: #F1F1F1;
- // text-align: center;
- // width: 40%;
- // height: 80rpx;
- // line-height: 80rpx;
- // font-size: 28rpx;
- // border-radius: 40rpx;
- // }
- // .particulars_ser {
- // background-color: #57C87B;
- // text-align: center;
- // width: 40%;
- // height: 80rpx;
- // line-height: 80rpx;
- // font-size: 28rpx;
- // color: #FFFFFF;
- // border-radius: 40rpx;
- // }
- // }
- }
- .page-section {
- margin-top: 100px;
- height: 80vh;
- // position: fixed;
- // top: 144px;
- .map {
- width: 100%;
- height: 100%;
- }
- }
- .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;
- }
- }
- .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>
|