develop
ihzero 2024-01-29 22:21:44 +08:00
commit be897f3391
48 changed files with 1363 additions and 1036 deletions

View File

@ -1,2 +1,6 @@
<!DOCTYPE html><html lang="zh-CN"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><title></title><script>var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || CSS.supports('top: constant(a)')) <!DOCTYPE html><html lang="zh-CN"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><title></title><script>var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || CSS.supports('top: constant(a)'))
<<<<<<< HEAD
document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />')</script><link rel="stylesheet" href="https://lcny.sk797.cn/h5/static/index.97465e7b.css"></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id="app"></div><script src="https://lcny.sk797.cn/h5/static/js/chunk-vendors.959091ef.js"></script><script src="https://lcny.sk797.cn/h5/static/js/index.4daeafb1.js"></script></body></html> document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />')</script><link rel="stylesheet" href="https://lcny.sk797.cn/h5/static/index.97465e7b.css"></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id="app"></div><script src="https://lcny.sk797.cn/h5/static/js/chunk-vendors.959091ef.js"></script><script src="https://lcny.sk797.cn/h5/static/js/index.4daeafb1.js"></script></body></html>
=======
document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />')</script><link rel="stylesheet" href="/static/index.97465e7b.css"></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id="app"></div><script src="/static/js/chunk-vendors.959091ef.js"></script><script src="/static/js/index.d07e9c1f.js"></script></body></html>
>>>>>>> master

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,9 +1,9 @@
<template> <template>
<view class="h-full w-full"> <view class="relative video-box">
<iframe class="w-full h-full" v-if="type=='iframe'" :src="url"></iframe> <view class="absolute top-0 left-0 w-full h-full">
<div ref="muiPlayer" v-else> <iframe class="w-full h-full" :src="url" v-if="type == 'iframe'"></iframe>
<div ref="muiPlayer" v-else></div>
</div> </view>
</view> </view>
</template> </template>
<script> <script>
@ -27,7 +27,7 @@ export default {
methods: { methods: {
videoPlayer() { videoPlayer() {
if (this.type == 'iframe') { if (this.type == 'iframe') {
console.log("====="); console.log('=====')
} else { } else {
let parse = {} let parse = {}
if (this.type == 'm3u8') { if (this.type == 'm3u8') {
@ -101,4 +101,9 @@ export default {
}, },
} }
</script> </script>
<style lang="scss"></style> <style lang="scss">
.video-box {
width: 100%;
padding-top: 56.2%;
}
</style>

View File

@ -1,10 +1,37 @@
<template> <template>
<view>
<!-- <u-dropdown-item v-if="filterable">
<u-input v-model="filterValue" placeholder="筛选"></u-input>
</u-dropdown-item> -->
<u-dropdown-item <u-dropdown-item
:title="label" :title="label"
v-model="status" v-model="status"
@change="handleChange" @change="handleChange"
:options="getOptions" :options="getOptions"
></u-dropdown-item> >
<view class="bg-white">
<view class="px-34rpx" v-if="filterable">
<u-input v-model="filterValue" placeholder="筛选"></u-input>
</view>
<scroll-view
scroll-y="true"
:style="{
height: $u.addUnit(getOptions.length > 8 ? 930 : 'auto'),
}"
>
<u-cell-group>
<u-cell-item
@click="handleSelect(item)"
v-for="(item, i) in getOptions"
:key="i"
:title="item.label"
:arrow="false"
></u-cell-item>
</u-cell-group>
</scroll-view>
</view>
</u-dropdown-item>
</view>
</template> </template>
<script> <script>
import { omit } from 'lodash-es' import { omit } from 'lodash-es'
@ -33,6 +60,10 @@ export default {
type: String, type: String,
default: 'value', default: 'value',
}, },
filterable: {
type: Boolean,
default: false,
},
}, },
computed: { computed: {
status: { status: {
@ -46,7 +77,7 @@ export default {
}, },
getOptions() { getOptions() {
const { labelField, valueField } = this const { labelField, valueField } = this
return this.options.reduce((prev, next) => { const arr = this.options.reduce((prev, next) => {
if (next) { if (next) {
const value = next[valueField] const value = next[valueField]
prev.push({ prev.push({
@ -57,10 +88,13 @@ export default {
} }
return prev return prev
}, []) }, [])
if (!this.filterValue) return arr
return arr.filter((e) => e.label.includes(this.filterValue))
}, },
}, },
data() { data() {
return { return {
filterValue: '',
options: [], options: [],
emitData: null, emitData: null,
isFirstLoad: true, isFirstLoad: true,
@ -70,6 +104,10 @@ export default {
this.fetch() this.fetch()
}, },
methods: { methods: {
handleSelect(e) {
this.status = e.value
this.$emit('close-dropdown', this.status)
},
async fetch() { async fetch() {
const api = this.api const api = this.api
if (!api || !this.isFunction(api)) return if (!api || !this.isFunction(api)) return

View File

@ -1,7 +1,7 @@
<template> <template>
<u-dropdown-item :title="label"> <u-dropdown-item :title="label">
<view class="bg-white p-30rpx"> <view class="bg-white p-30rpx">
<u-input v-model="status" :placeholder="placeholder" class="flex-1" /> <u-input v-model="status" :placeholder="placeholder" :clearable="false" class="flex-1" />
<view class="my-20rpx"> <view class="my-20rpx">
<u-line></u-line> <u-line></u-line>
</view> </view>

View File

@ -239,8 +239,9 @@
"path" : "pages/basics/profile-detail", "path" : "pages/basics/profile-detail",
"style" : "style" :
{ {
"navigationBarTitleText": "", "navigationBarTitleText": "基地概况",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"navigationStyle":"custom"
} }
},{ },{
"path" : "pages/crop/town-crop", "path" : "pages/crop/town-crop",

View File

@ -86,7 +86,6 @@ export default {
const resData = data.data const resData = data.data
Object.keys(resData).map((e) => { Object.keys(resData).map((e) => {
const zindex = this.list.findIndex(({ key }) => key == e) const zindex = this.list.findIndex(({ key }) => key == e)
if (zindex >= 0) this.list[zindex].value = resData[e].slice(1) if (zindex >= 0) this.list[zindex].value = resData[e].slice(1)
}) })
}) })

View File

@ -13,12 +13,12 @@
<view class="flex items-center"> <view class="flex items-center">
<view class="w-16rpx h-16rpx bg-hex-F7B379"></view> <view class="w-16rpx h-16rpx bg-hex-F7B379"></view>
<view class="ml-10rpx">离线</view> <view class="ml-10rpx">离线</view>
<view class="ml-10rpx text-32rpx">{{ data.value[0] }}</view> <view class="ml-10rpx text-32rpx">{{ data.value[1] }}</view>
</view> </view>
<view class="flex items-center"> <view class="flex items-center">
<view class="w-16rpx h-16rpx bg-hex-EB313E"></view> <view class="w-16rpx h-16rpx bg-hex-EB313E"></view>
<view class="ml-10rpx">故障</view> <view class="ml-10rpx">故障</view>
<view class="ml-10rpx text-32rpx">{{ data.value[0] }}</view> <view class="ml-10rpx text-32rpx">{{ data.value[2] }}</view>
</view> </view>
</view> </view>
</view> </view>

View File

@ -8,6 +8,17 @@
<u-line></u-line> <u-line></u-line>
</view> </view>
<view class="py-20rpx"> <view class="py-20rpx">
<u-tabs
:list="desList"
bar-height="4"
height="50"
font-size="28"
gutter="18"
:current="current"
@change="changeTab"
></u-tabs>
</view>
<view class="pb-20rpx">
<qiun-data-charts <qiun-data-charts
:loadingType="loadingType" :loadingType="loadingType"
type="area" type="area"
@ -21,6 +32,39 @@
<script> <script>
import QiunDataCharts from '@/components/qiun-data-charts/qiun-data-charts.vue' import QiunDataCharts from '@/components/qiun-data-charts/qiun-data-charts.vue'
import { http } from '@/api/index.js' import { http } from '@/api/index.js'
const desList = [
{
key: 'turbidity',
unit: 'NTU',
name: '浊度',
},
{
key: 'chlorine',
unit: 'mg/L',
name: '余氯',
},
{
key: 'ph',
unit: 'PH',
name: 'PH值',
},
{
key: 'temperature',
unit: '℃',
name: '温度',
},
{
key: 'oxygen',
unit: 'mg/L',
name: '溶解氧',
},
{
key: 'conductivity',
unit: 'uS/cm',
name: '电导率',
},
]
export default { export default {
props: { props: {
baseId: { baseId: {
@ -30,6 +74,8 @@ export default {
components: { QiunDataCharts }, components: { QiunDataCharts },
data() { data() {
return { return {
desList,
current: 0,
loadingType: 1, loadingType: 1,
opts: { opts: {
dataLabel: false, // dataLabel: false, //
@ -53,16 +99,26 @@ export default {
}, },
} }
}, },
computed: {
currentTab() {
return this.desList[this.current]
},
},
mounted() { mounted() {
this.init() this.init()
}, },
methods: { methods: {
changeTab(e) {
this.current = e
this.init()
},
async init() { async init() {
try { try {
const { data } = await http.get('/api/device-base-data-statics', { const { data } = await http.get('/api/device-base-data-statics', {
params: { params: {
base_id: this.baseId, base_id: this.baseId,
device_type: 3, device_type: 3,
device_column: this.currentTab.key,
}, },
}) })
const resData = data.data const resData = data.data

View File

@ -8,6 +8,17 @@
<u-line></u-line> <u-line></u-line>
</view> </view>
<view class="py-20rpx"> <view class="py-20rpx">
<u-tabs
:list="desList"
bar-height="4"
height="50"
font-size="28"
gutter="18"
:current="current"
@change="changeTab"
></u-tabs>
</view>
<view class="pb-20rpx">
<qiun-data-charts <qiun-data-charts
:loadingType="loadingType" :loadingType="loadingType"
type="area" type="area"
@ -62,6 +73,8 @@ export default {
components: { QiunDataCharts }, components: { QiunDataCharts },
data() { data() {
return { return {
desList,
current: 0,
loadingType: 1, loadingType: 1,
opts: { opts: {
dataLabel: false, // dataLabel: false, //
@ -85,16 +98,26 @@ export default {
}, },
} }
}, },
computed: {
currentTab() {
return this.desList[this.current]
},
},
mounted() { mounted() {
this.init() this.init()
}, },
methods: { methods: {
changeTab(e) {
this.current = e
this.init()
},
async init() { async init() {
try { try {
const { data } = await http.get('/api/device-base-data-statics', { const { data } = await http.get('/api/device-base-data-statics', {
params: { params: {
base_id: this.baseId, base_id: this.baseId,
device_type: 2, device_type: 2,
device_column: this.currentTab.key,
}, },
}) })
const resData = data.data const resData = data.data

View File

@ -1,5 +1,15 @@
<template> <template>
<view> <view>
<u-navbar
:isBack="showAppbar"
:title="title"
:background="background"
:custom-back="goback"
:title-color="titleColor"
v-if="showAppbar"
:back-icon-color="titleColor"
>
</u-navbar>
<view class="space-y-20rpx"> <view class="space-y-20rpx">
<BaseChat <BaseChat
:baseId="id" :baseId="id"
@ -18,6 +28,7 @@
</view> </view>
</template> </template>
<script> <script>
import { navigateBack } from '@/com/utils.js'
import { http } from '@/api/index.js' import { http } from '@/api/index.js'
import BaseChat from './components/base-chat.vue' import BaseChat from './components/base-chat.vue'
import SBYXZT from './components/sbyxzt.vue' import SBYXZT from './components/sbyxzt.vue'
@ -32,10 +43,14 @@ export default {
QXSJ, QXSJ,
TRJC, TRJC,
SZJC, SZJC,
JK JK,
}, },
data() { data() {
return { return {
background: {
backgroundColor: '#2a7dc9',
},
titleColor: '#ffffff',
id: '', id: '',
devices: [], devices: [],
crops: [], crops: [],
@ -57,7 +72,7 @@ export default {
}, },
isSB() { isSB() {
return this.devices.length > 0 return this.devices.length > 0
} },
}, },
onLoad({ id }) { onLoad({ id }) {
this.id = id this.id = id
@ -77,8 +92,20 @@ export default {
this.devices = devices this.devices = devices
uni.setNavigationBarTitle({ title: name }) uni.setNavigationBarTitle({ title: name })
this.crops = crops this.crops = crops
try {
uni.postMessage({
data: {
even:'xxxxxi'
}
});
} catch (error) {
}
}) })
}, },
goback() {
navigateBack()
},
}, },
} }
</script> </script>

View File

@ -1,13 +1,13 @@
<template> <template>
<view> <view>
<u-sticky :h5NavHeight="h5NavHeightP"> <!-- <u-sticky :h5NavHeight="h5NavHeightP"> -->
<view class="bg-white"> <view class="bg-white">
<SearchForm <SearchForm
:schemas="searchFormSchema" :schemas="searchFormSchema"
@submit="handleSubmit" @submit="handleSubmit"
></SearchForm> ></SearchForm>
</view> </view>
</u-sticky> <!-- </u-sticky> -->
<mescroll-body <mescroll-body
@init="mescrollInit" @init="mescrollInit"
@up="upCallback" @up="upCallback"
@ -147,14 +147,6 @@ export default {
formShow: false, formShow: false,
baseShow: false, baseShow: false,
searchFormSchema: [ searchFormSchema: [
{
field: 'name',
label: '名称',
component: 'Input',
componentProps: {
placeholder: '请输入名称',
},
},
{ {
field: 'industry', field: 'industry',
label: '农业类型', label: '农业类型',
@ -172,6 +164,36 @@ export default {
} }
}, },
}, },
{
field: 'name',
label: '名称',
component: 'ApiSelect',
componentProps: ({ formActionType }) => {
return {
api: async (e) => {
const { data } = await http.get('/api/agricultural-basic', {
params: {
page: 1,
per_page: 10000,
},
})
return [{name:'全部',key:''}].concat(data.data.map(e => ({name:e.name,key:e.name})))
},
filterable: true,
filterMethod: (e) => {},
labelField: 'name',
valueField: 'key',
}
},
},
// {
// field: 'name',
// label: '',
// component: 'Input',
// componentProps: {
// placeholder: ''
// },
// }
], ],
} }
}, },

View File

@ -94,7 +94,7 @@ export default {
{ {
label: '基地概况', label: '基地概况',
url: '/pages/basics/profile', url: '/pages/basics/profile',
permission: 'super', permission: 'endpoint.agricultural_base_overview.index',
}, },
], ],
}, },

View File

@ -139,7 +139,7 @@
<view class="video_cd"> <view class="video_cd">
<!-- #ifdef H5 --> <!-- #ifdef H5 -->
<!-- {{ video.video_url }} --> <!-- {{ video.video_url }} -->
<LiveVideo :id="video.id"></LiveVideo> <LiveVideo :id="video.id" :key="video.id"></LiveVideo>
<!-- <LiveVideo :url="video.video_url" :type="video.video_type"></LiveVideo> --> <!-- <LiveVideo :url="video.video_url" :type="video.video_type"></LiveVideo> -->
<!-- <videoM3u8H5 v-if="video.video_type=='m3u8'" :url="video.video_url" :id="`m_${index}_refsM3u8`"></videoM3u8H5> <!-- <videoM3u8H5 v-if="video.video_type=='m3u8'" :url="video.video_url" :id="`m_${index}_refsM3u8`"></videoM3u8H5>
<video-flv-h5 v-else :url="video.video_url"></video-flv-h5> --> <video-flv-h5 v-else :url="video.video_url"></video-flv-h5> -->

View File

@ -3,48 +3,75 @@
<view class="content-box"> <view class="content-box">
<view class="secreen-section"> <view class="secreen-section">
<u-dropdown ref="uDropdown" @open="openDropDown"> <u-dropdown ref="uDropdown" @open="openDropDown">
<u-dropdown-item v-model="addressValue" title="基地" <u-dropdown-item
:options="deviceAddressList" @change="change"></u-dropdown-item> v-model="addressValue"
<u-dropdown-item v-model="device_id" title="检测点" title="基地"
:options="options2" @change="change2"></u-dropdown-item> :options="deviceAddressList"
@change="change"
></u-dropdown-item>
<u-dropdown-item
v-model="device_id"
title="检测点"
:options="options2"
@change="change2"
></u-dropdown-item>
<u-dropdown-item title="日期"> <u-dropdown-item title="日期">
<view class="slot-content" style="background-color: #FFFFFF;"> <view class="slot-content" style="background-color: #ffffff">
<view class="select-date u-border-bottom"> <view class="select-date u-border-bottom">
<view class="name" @click="calendarShow = true"> <view class="name" @click="calendarShow = true">
<u-icon name="calendar" color="#333" size="32"></u-icon> <u-icon name="calendar" color="#333" size="32"></u-icon>
<text style="margin-left: 6rpx;">选择日期</text> <text style="margin-left: 6rpx">选择日期</text>
</view> </view>
<view class="time_box"> <view class="time_box">
<view class="tip_txt" v-if="!start_date_c" <view
@click="calendarShow = true">开始日期-结束日期</view> class="tip_txt"
<view class="tile_val" v-else v-if="!start_date_c"
@click="calendarShow = true">{{start_date_c}} ~ {{end_date_c}}</view> @click="calendarShow = true"
<view class="delete_btn" v-if="start_date_c" @click="deleteDateFn()"> >开始日期-结束日期</view
>
<view class="tile_val" v-else @click="calendarShow = true"
>{{ start_date_c }} ~ {{ end_date_c }}</view
>
<view
class="delete_btn"
v-if="start_date_c"
@click="deleteDateFn()"
>
<u-icon name="close-circle" color="#333" size="34"></u-icon> <u-icon name="close-circle" color="#333" size="34"></u-icon>
</view> </view>
</view> </view>
</view> </view>
<u-button type="primary" @click="selectedDateConform()"></u-button> <u-button type="primary" @click="selectedDateConform()"
>确定</u-button
>
</view> </view>
</u-dropdown-item> </u-dropdown-item>
</u-dropdown> </u-dropdown>
<view class="quick_times"> <view class="quick_times">
<view class="tab-section"> <view class="tab-section">
<view class="tab-item" :class="currentIndex==index?'active':''" <view
class="tab-item"
:class="currentIndex == index ? 'active' : ''"
v-for="(item, index) in sublist" v-for="(item, index) in sublist"
@click="subChange1(index)" :key="index" > @click="subChange1(index)"
:key="index"
>
<view class="name">{{ item.name }}</view> <view class="name">{{ item.name }}</view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<view class="warning-section"> <view class="warning-section">
<view class="top_box"> <view class="top_box">
<view class="tit">预警数据统计</view> <view class="tit">预警数据统计</view>
<view class="set_warning"> <view class="set_warning">
<u-button v-auth="['endpoint.water.setting','endpoint.water.setting_edit']" class="set_btn" @click="setWarnInfo()" size="mini"></u-button> <u-button
v-auth="['endpoint.water.setting', 'endpoint.water.setting_edit']"
class="set_btn"
@click="setWarnInfo()"
size="mini"
>设置</u-button
>
</view> </view>
</view> </view>
<view class="mb-20rpx"> <view class="mb-20rpx">
@ -53,25 +80,37 @@
<view class="cont-box"> <view class="cont-box">
<view class="warning-item" @click="warningClickFn(1)"> <view class="warning-item" @click="warningClickFn(1)">
<view class="name">Ⅰ级预警</view> <view class="name">Ⅰ级预警</view>
<view class="val">{{deviceWarning[1]?deviceWarning[1]:0}}<text class="unit"></text></view> <view class="val"
>{{ deviceWarning[1] ? deviceWarning[1] : 0
}}<text class="unit"></text></view
>
</view> </view>
<view class="warning-item" @click="warningClickFn(2)"> <view class="warning-item" @click="warningClickFn(2)">
<view class="name">Ⅱ级预警</view> <view class="name">Ⅱ级预警</view>
<view class="val">{{deviceWarning[2]?deviceWarning[2]:0}}<text class="unit"></text></view> <view class="val"
>{{ deviceWarning[2] ? deviceWarning[2] : 0
}}<text class="unit"></text></view
>
</view> </view>
<view class="warning-item" @click="warningClickFn(3)"> <view class="warning-item" @click="warningClickFn(3)">
<view class="name">Ⅲ级预警</view> <view class="name">Ⅲ级预警</view>
<view class="val">{{deviceWarning[3]?deviceWarning[3]:0}}<text class="unit"></text></view> <view class="val"
>{{ deviceWarning[3] ? deviceWarning[3] : 0
}}<text class="unit"></text></view
>
</view> </view>
<view class="warning-item" @click="warningClickFn(4)"> <view class="warning-item" @click="warningClickFn(4)">
<view class="name">Ⅳ级预警</view> <view class="name">Ⅳ级预警</view>
<view class="val">{{deviceWarning[4]?deviceWarning[4]:0}}<text class="unit"></text></view> <view class="val"
>{{ deviceWarning[4] ? deviceWarning[4] : 0
}}<text class="unit"></text></view
>
</view> </view>
</view> </view>
</view> </view>
<template v-if="loadingType != 0"> <template v-if="loadingType != 0">
<!-- --> <!-- -->
<view class="chart_section"> <view class="chart_section" v-if="chart_chlorine">
<view class="top_box"> <view class="top_box">
<view class="tit"><text class="unit">mg/L</text></view> <view class="tit"><text class="unit">mg/L</text></view>
<view class="name">{{ addressName }}</view> <view class="name">{{ addressName }}</view>
@ -89,7 +128,7 @@
</view> </view>
</view> </view>
<!-- 电导率 --> <!-- 电导率 -->
<view class="chart_section"> <view class="chart_section" v-if="chart_conductivity">
<view class="top_box"> <view class="top_box">
<view class="tit">电导率<text class="unit">us/cm</text></view> <view class="tit">电导率<text class="unit">us/cm</text></view>
<view class="name">{{ addressName }}</view> <view class="name">{{ addressName }}</view>
@ -108,7 +147,7 @@
</view> </view>
<!-- 氧气 --> <!-- 氧气 -->
<view class="chart_section"> <view class="chart_section" v-if="chart_oxygen">
<view class="top_box"> <view class="top_box">
<view class="tit">氧气<text class="unit">mg/L</text></view> <view class="tit">氧气<text class="unit">mg/L</text></view>
<view class="name">{{ addressName }}</view> <view class="name">{{ addressName }}</view>
@ -126,7 +165,7 @@
</view> </view>
</view> </view>
<!-- PH --> <!-- PH -->
<view class="chart_section"> <view class="chart_section" v-if="chart_ph">
<view class="top_box"> <view class="top_box">
<view class="tit">PH<text class="unit"></text></view> <view class="tit">PH<text class="unit"></text></view>
<view class="name">{{ addressName }}</view> <view class="name">{{ addressName }}</view>
@ -144,7 +183,7 @@
</view> </view>
</view> </view>
<!-- 温度 --> <!-- 温度 -->
<view class="chart_section"> <view class="chart_section" v-if="chart_temperature">
<view class="top_box"> <view class="top_box">
<view class="tit">温度<text class="unit"></text></view> <view class="tit">温度<text class="unit"></text></view>
<view class="name">{{ addressName }}</view> <view class="name">{{ addressName }}</view>
@ -162,7 +201,7 @@
</view> </view>
</view> </view>
<!-- 浊度 --> <!-- 浊度 -->
<view class="chart_section"> <view class="chart_section" v-if="chart_turbidity">
<view class="top_box"> <view class="top_box">
<view class="tit">浊度<text class="unit">NTU</text></view> <view class="tit">浊度<text class="unit">NTU</text></view>
<view class="name">{{ addressName }}</view> <view class="name">{{ addressName }}</view>
@ -182,8 +221,16 @@
</template> </template>
</view> </view>
<!-- 设置预警值 --> <!-- 设置预警值 -->
<u-popup v-model="warningShow" border-radius="28" width="94%" height="70%" <u-popup
mode="center" :closeable="true" :mask-close-able="false" z-index="910"> v-model="warningShow"
border-radius="28"
width="94%"
height="70%"
mode="center"
:closeable="true"
:mask-close-able="false"
z-index="910"
>
<view class="u-popup-section"> <view class="u-popup-section">
<view class="top_box"> <view class="top_box">
<view class="title">设置预警值</view> <view class="title">设置预警值</view>
@ -192,39 +239,67 @@
<view class="form_cont"> <view class="form_cont">
<u-form v-for="(info, k) in formInfo" :key="k"> <u-form v-for="(info, k) in formInfo" :key="k">
<view class="title2 u-border-bottom">{{ keyToName[k] }}</view> <view class="title2 u-border-bottom">{{ keyToName[k] }}</view>
<u-form-item v-for="(cd2,k2) in info" <u-form-item
:label="numberToString[k2]+'级预警'" label-width="140" :key="k2"> v-for="(cd2, k2) in info"
:label="numberToString[k2] + '级预警'"
label-width="140"
:key="k2"
>
<view class="row"> <view class="row">
<view class="input_box flex-row u-margin-bottom-20" <view
v-for="(item,index) in cd2" :key="index"> class="input_box flex-row u-margin-bottom-20"
v-for="(item, index) in cd2"
:key="index"
>
<view class="input_unit_ibox flex-row u-border"> <view class="input_unit_ibox flex-row u-border">
<u-input type="number" v-model="item.min" placeholder="请输入" :clearable="false"/> <u-input
type="number"
v-model="item.min"
placeholder="请输入"
:clearable="false"
/>
<view class="unit">{{ keyToUnit[k] }}</view> <view class="unit">{{ keyToUnit[k] }}</view>
</view> </view>
<view class="pdlr12">~</view> <view class="pdlr12">~</view>
<view class="input_unit_ibox flex-row u-border"> <view class="input_unit_ibox flex-row u-border">
<u-input type="number" v-model="item.max" placeholder="请输入" :clearable="false"/> <u-input
type="number"
v-model="item.max"
placeholder="请输入"
:clearable="false"
/>
<view class="unit">{{ keyToUnit[k] }}</view> <view class="unit">{{ keyToUnit[k] }}</view>
</view> </view>
</view> </view>
</view> </view>
</u-form-item> </u-form-item>
</u-form> </u-form>
</view> </view>
</scroll-view> </scroll-view>
<view class="buttom_section"> <view class="buttom_section">
<u-button class="btn" type="default" @click="warningShow = false">取消</u-button> <u-button class="btn" type="default" @click="warningShow = false"
<u-button class="btn" @click="warningInfoBtn()" type="primary">确定</u-button> >取消</u-button
>
<u-button class="btn" @click="warningInfoBtn()" type="primary"
>确定</u-button
>
</view> </view>
</view> </view>
</u-popup> </u-popup>
<u-calendar v-model="calendarShow" :mode="'range'" @change="calendarChange"></u-calendar> <u-calendar
v-model="calendarShow"
:mode="'range'"
@change="calendarChange"
></u-calendar>
</view> </view>
</template> </template>
<script> <script>
import {showLoading,getLastWeekRange,getLastMonthRange} from '@/com/utils.js' import {
showLoading,
getLastWeekRange,
getLastMonthRange,
} from '@/com/utils.js'
import QiunDataCharts from '@/components/qiun-data-charts/qiun-data-charts.vue' import QiunDataCharts from '@/components/qiun-data-charts/qiun-data-charts.vue'
export default { export default {
components: { QiunDataCharts }, components: { QiunDataCharts },
@ -238,24 +313,23 @@
xAxis: { xAxis: {
disableGrid: true, disableGrid: true,
labelCount: 5, labelCount: 5,
}, },
yAxis: { yAxis: {
gridType: "dash", gridType: 'dash',
data: [ data: [
{ {
min:0 min: 0,
} },
] ],
}, },
extra: { extra: {
area: { area: {
type: "curve", type: 'curve',
opacity: 0.9, opacity: 0.9,
addLine: true, addLine: true,
gradient: true, gradient: true,
}, },
} },
}, },
chart_conductivity: {}, // chart_conductivity: {}, //
chart_chlorine: {}, // chart_chlorine: {}, //
@ -276,13 +350,13 @@
end_date_c: '', end_date_c: '',
sublist: [ sublist: [
{ {
name: '今天' name: '今天',
}, },
{ {
name: '近一周' name: '近一周',
}, },
{ {
name: '近一月' name: '近一月',
}, },
], ],
currentIndex: 0, currentIndex: 0,
@ -309,182 +383,183 @@
1: '', 1: '',
2: 'Ⅱ', 2: 'Ⅱ',
3: 'Ⅲ', 3: 'Ⅲ',
4:'Ⅳ' 4: 'Ⅳ',
}, },
device_type: 3, device_type: 3,
}; }
}, },
onLoad() { onLoad() {
this.queryDeviceBasics(); this.queryDeviceBasics()
this.optsc = JSON.parse(JSON.stringify(this.opts)); this.optsc = JSON.parse(JSON.stringify(this.opts))
},
onShow(){
}, },
onShow() {},
methods: { methods: {
warningClickFn(lv) { warningClickFn(lv) {
let urlparams = `?lv=${lv}&base=${this.addressValue}&device=${this.device_id}&title=水质监控`
let urlparams = `?lv=${lv}&base=${this.addressValue}&device=${this.device_id}&title=水质监控`;
uni.navigateTo({ uni.navigateTo({
url:`/pages/index/warning-list${urlparams}` url: `/pages/index/warning-list${urlparams}`,
}) })
}, },
// //
setWarnInfo() { setWarnInfo() {
this.getDeviceWarningRules(); this.getDeviceWarningRules()
this.warningShow = true; this.warningShow = true
}, },
// //
change(val) { change(val) {
console.log(val); console.log(val)
let narray = this.deviceAddressList.filter(item=>{ let narray = this.deviceAddressList.filter((item) => {
return item.value==val; return item.value == val
}) })
console.log(narray); console.log(narray)
this.addressName = narray[0].name; this.addressName = narray[0].name
this.$refs.uDropdown.highlight(0); this.$refs.uDropdown.highlight(0)
this.queryAddressDevicePoints(val); this.queryAddressDevicePoints(val)
}, },
//id //id
change2(val) { change2(val) {
this.$refs.uDropdown.highlight(1); this.$refs.uDropdown.highlight(1)
this.queryMonitoringData(); this.queryMonitoringData()
this.getDeviceWarningNums();// this.getDeviceWarningNums() //
}, },
// //
calendarChange(e) { calendarChange(e) {
console.log(e, '日期范围') console.log(e, '日期范围')
this.start_date_c = e.startDate; this.start_date_c = e.startDate
this.end_date_c = e.endDate; this.end_date_c = e.endDate
}, },
selectedDateConform() { selectedDateConform() {
this.q_start_time = this.start_date_c; this.q_start_time = this.start_date_c
this.q_end_time = this.end_date_c; this.q_end_time = this.end_date_c
this.queryMonitoringData(); this.queryMonitoringData()
this.$refs.uDropdown.close(); this.$refs.uDropdown.close()
if (this.q_start_time != this.q_end_time) { if (this.q_start_time != this.q_end_time) {
this.currentIndex = -1; this.currentIndex = -1
} else { } else {
this.currentIndex = 0; this.currentIndex = 0
} }
}, },
// //
deleteDateFn() { deleteDateFn() {
this.start_date_c = ''; this.start_date_c = ''
this.end_date_c = ''; this.end_date_c = ''
}, },
// //
openDropDown(index) { openDropDown(index) {
console.log(index,'openDropDown'); console.log(index, 'openDropDown')
if(index==2){// if (index == 2) {
this.start_date_c = this.q_start_time; //
this.end_date_c = this.q_end_time; this.start_date_c = this.q_start_time
this.end_date_c = this.q_end_time
} }
}, },
// //
subChange1(index) { subChange1(index) {
console.log(index) console.log(index)
this.currentIndex = index; this.currentIndex = index
if (index == 1) { if (index == 1) {
let lastWeekDate = getLastWeekRange()
let lastWeekDate = getLastWeekRange(); let startDate = this.$u.timeFormat(lastWeekDate.startDate, 'yyyy-mm-dd')
let startDate = this.$u.timeFormat(lastWeekDate.startDate, 'yyyy-mm-dd'); let endDate = this.$u.timeFormat(lastWeekDate.endDate, 'yyyy-mm-dd')
let endDate = this.$u.timeFormat(lastWeekDate.endDate, 'yyyy-mm-dd'); console.log(startDate, endDate)
console.log(startDate,endDate); this.q_start_time = startDate
this.q_start_time = startDate; this.q_end_time = endDate
this.q_end_time = endDate;
} else if (index == 2) { } else if (index == 2) {
let lastMonthRange = getLastMonthRange(); let lastMonthRange = getLastMonthRange()
let startDate = this.$u.timeFormat(lastMonthRange.startDate, 'yyyy-mm-dd'); let startDate = this.$u.timeFormat(
let endDate = this.$u.timeFormat(lastMonthRange.endDate, 'yyyy-mm-dd'); lastMonthRange.startDate,
console.log(startDate,endDate); 'yyyy-mm-dd'
this.q_start_time = startDate; )
this.q_end_time = endDate; let endDate = this.$u.timeFormat(lastMonthRange.endDate, 'yyyy-mm-dd')
console.log(startDate, endDate)
this.q_start_time = startDate
this.q_end_time = endDate
} else { } else {
this.q_start_time = ''; this.q_start_time = ''
this.q_end_time = ''; this.q_end_time = ''
} }
this.queryMonitoringData(); this.queryMonitoringData()
}, },
// //
warningInfoBtn() { warningInfoBtn() {
let params = { let params = {
slug: "device_warning_rule_waterquality", slug: 'device_warning_rule_waterquality',
value:this.formInfo value: this.formInfo,
} }
this.$http.put('/api/device-warning-rules',params).then(({data})=>{ this.$http
this.warningShow = false; .put('/api/device-warning-rules', params)
.then(({ data }) => {
this.warningShow = false
if (data.code == 200) { if (data.code == 200) {
uni.showToast({ title: '设置成功', icon: 'none' }); uni.showToast({ title: '设置成功', icon: 'none' })
} else { } else {
uni.showToast({ title: '设置失败', icon: 'none' }); uni.showToast({ title: '设置失败', icon: 'none' })
} }
}).catch(()=>{ })
uni.showToast({ title: '设置失败', icon: 'none' }); .catch(() => {
uni.showToast({ title: '设置失败', icon: 'none' })
}) })
}, },
// //
queryDeviceBasics() { queryDeviceBasics() {
let params = { let params = {
device_type: this.device_type, device_type: this.device_type,
_t: new Date().getTime() _t: new Date().getTime(),
} }
this.$http.get('/api/agricultural-device-basic',{params:params}).then(({data})=>{ this.$http
console.log(data); .get('/api/agricultural-device-basic', { params: params })
.then(({ data }) => {
if (data.code == 200) { if (data.code == 200) {
let _data = data.data; let _data = data.data
if (_data.length == 0) { if (_data.length == 0) {
this.loadingType = 0 this.loadingType = 0
return this.$u.toast('没有关联基地'); return this.$u.toast('没有关联基地')
} }
for (let item of _data) { for (let item of _data) {
item['label'] = item.name; item['label'] = item.name
item['value'] = item.id; item['value'] = item.id
} }
this.deviceAddressList = _data; this.deviceAddressList = _data
this.addressValue = _data[0].id; this.addressValue = _data[0].id
this.addressName = _data[0].name; this.addressName = _data[0].name
this.queryAddressDevicePoints(this.addressValue); this.queryAddressDevicePoints(this.addressValue)
} }
}).catch(()=>{
}) })
.catch(() => {})
}, },
// //
queryAddressDevicePoints(id) { queryAddressDevicePoints(id) {
let params = { let params = {
device_type: this.device_type, device_type: this.device_type,
agricultural_basic: id, agricultural_basic: id,
_t: new Date().getTime() _t: new Date().getTime(),
} }
this.$http.get(`/api/agricultural-device-point/${id}`,{params:params}).then(({data})=>{ this.$http
console.log(data); .get(`/api/agricultural-device-point/${id}`, { params: params })
.then(({ data }) => {
console.log(data)
if (data.code == 200) { if (data.code == 200) {
let _data = data.data; let _data = data.data
if (_data.length == 0) { if (_data.length == 0) {
// return this.$u.toast(''); // return this.$u.toast('');
} }
let options = []; let options = []
for (let k in _data) { for (let k in _data) {
let item = {}; let item = {}
item['label'] = _data[k]; item['label'] = _data[k]
item['value'] = k; item['value'] = k
options.push(item); options.push(item)
} }
this.options2 = options; this.options2 = options
this.device_id = options[0].value; this.device_id = options[0].value
console.log(this.options2, this.device_id, 'this.options2') console.log(this.options2, this.device_id, 'this.options2')
this.queryMonitoringData(); this.queryMonitoringData()
this.getDeviceWarningNums();// this.getDeviceWarningNums() //
} }
}).catch(()=>{
}) })
.catch(() => {})
}, },
// //
queryMonitoringData() { queryMonitoringData() {
@ -492,67 +567,81 @@
device_id: this.device_id, device_id: this.device_id,
start_time: this.q_start_time, start_time: this.q_start_time,
end_time: this.q_end_time, end_time: this.q_end_time,
_t: new Date().getTime() _t: new Date().getTime(),
} }
this.$http.get('/api/monitoring-data',{params:params}).then(({data})=>{ this.$http
.get('/api/monitoring-data', { params: params })
.then(({ data }) => {
if (data.code == 200) { if (data.code == 200) {
let info = data.data; let info = data.data
let chartInfo = {};
let chartInfo = {}
for (let fk in info) { for (let fk in info) {
let _item = { let _item = {
categories: [], categories: [],
data:[] data: [],
} }
if (info[fk]) {
for (let k in info[fk]) { for (let k in info[fk]) {
_item.data.push(info[fk][k])
_item.data.push(info[fk][k]); let timestamp = new Date(k).getTime()
let timestamp = new Date(k).getTime();
// let time1 = k.split(/\s+/); // let time1 = k.split(/\s+/);
if (params.start_time != params.end_time) { if (params.start_time != params.end_time) {
let time1 = this.$u.timeFormat(timestamp, 'yyyy-mm-dd'); let time1 = this.$u.timeFormat(timestamp, 'yyyy-mm-dd')
_item.categories.push(time1); _item.categories.push(time1)
} else { } else {
let time2 = this.$u.timeFormat(timestamp, 'hh:ss'); let time2 = this.$u.timeFormat(timestamp, 'hh:ss')
_item.categories.push(time2); _item.categories.push(time2)
} }
} }
chartInfo[fk] = _item; chartInfo[fk] = _item
}
} }
console.log(chartInfo, 'chartDatas--') console.log(chartInfo, 'chartDatas--')
if(params.start_time!=params.end_time){// if (params.start_time != params.end_time) {
this.opts.xAxis.labelCount = 3; //
this.optsc.xAxis.labelCount = 3; this.opts.xAxis.labelCount = 3
this.optsc.xAxis.labelCount = 3
} else { } else {
let len = chartInfo.oxygen.categories.length - 1
let v = 5
let aw = len > 10 ? len % 6 : len % 5
let len = chartInfo.conductivity.categories.length-1;
let v = 5;
let aw = len>10?len%6:len%5;
if (aw == 3 || aw == 0 || aw == 1) { if (aw == 3 || aw == 0 || aw == 1) {
v = 4; v = 4
} else if (aw == 2) { } else if (aw == 2) {
v = 3; v = 3
}else{v=5} } else {
this.opts.xAxis.labelCount = v; v = 5
this.optsc.xAxis.labelCount = v; }
this.opts.xAxis.labelCount = v
this.optsc.xAxis.labelCount = v
console.log(this.opts, v, len, '配置', aw) console.log(this.opts, v, len, '配置', aw)
} }
//start //start
if (chartInfo.chlorine) {
let res2 = { let res2 = {
categories: chartInfo.chlorine.categories, categories: chartInfo.chlorine.categories,
series: [ series: [
{ {
name: '氯', name: '氯',
legendShape: 'circle', legendShape: 'circle',
data: chartInfo.chlorine.data data: chartInfo.chlorine.data,
},
],
}
this.chart_chlorine = JSON.parse(JSON.stringify(res2))
}else{
this.chart_chlorine = null
} }
]
};
this.chart_chlorine = JSON.parse(JSON.stringify(res2));
//end //end
//start conductivity //start conductivity
if (chartInfo.conductivity) {
let res = { let res = {
categories: chartInfo.conductivity.categories, categories: chartInfo.conductivity.categories,
series: [ series: [
@ -560,30 +649,37 @@
name: '电导率', name: '电导率',
legendShape: 'circle', legendShape: 'circle',
data: chartInfo.conductivity.data, data: chartInfo.conductivity.data,
},
],
} }
]
};
this.chart_conductivity = JSON.parse(JSON.stringify(res)); this.chart_conductivity = JSON.parse(JSON.stringify(res))
console.log(this.chart_conductivity, '电导率') console.log(this.chart_conductivity, '电导率')
}else{
this.chart_conductivity = null
}
//end conductivity //end conductivity
//start oxygen //start oxygen
if (chartInfo.oxygen) {
let res3 = { let res3 = {
categories: chartInfo.oxygen.categories, categories: chartInfo.oxygen.categories,
series: [ series: [
{ {
name: '氧气', name: '氧气',
legendShape: 'circle', legendShape: 'circle',
data: chartInfo.oxygen.data data: chartInfo.oxygen.data,
},
],
} }
]
};
this.chart_oxygen = JSON.parse(JSON.stringify(res3)); this.chart_oxygen = JSON.parse(JSON.stringify(res3))
}else{
this.chart_oxygen = null
}
//end //end
//start PH //start PH
if (chartInfo.ph) {
let res4 = { let res4 = {
categories: chartInfo.ph.categories, categories: chartInfo.ph.categories,
series: [ series: [
@ -591,11 +687,15 @@
name: 'PH', name: 'PH',
legendShape: 'circle', legendShape: 'circle',
data: chartInfo.ph.data, data: chartInfo.ph.data,
},
],
}
this.chart_ph = JSON.parse(JSON.stringify(res4))
}else{
this.chart_ph = null
} }
]
};
this.chart_ph = JSON.parse(JSON.stringify(res4));
//start temperature //start temperature
if (chartInfo.temperature) {
let res5 = { let res5 = {
categories: chartInfo.temperature.categories, categories: chartInfo.temperature.categories,
series: [ series: [
@ -603,21 +703,25 @@
name: '温度', name: '温度',
legendShape: 'circle', legendShape: 'circle',
data: chartInfo.temperature.data, data: chartInfo.temperature.data,
},
],
} }
] let min_temperature = 0
};
let min_temperature = 0;
for (let val of chartInfo.temperature.data) { for (let val of chartInfo.temperature.data) {
if (val < 0) { if (val < 0) {
min_temperature = val; min_temperature = val
} }
} }
if (min_temperature < 0) { if (min_temperature < 0) {
this.optsc.yAxis.data = []; this.optsc.yAxis.data = []
}
this.chart_temperature = JSON.parse(JSON.stringify(res5))
}else{
this.chart_temperature = null
} }
this.chart_temperature = JSON.parse(JSON.stringify(res5));
//end temperature //end temperature
//start turbidity //start turbidity
if (chartInfo.turbidity) {
let res6 = { let res6 = {
categories: chartInfo.turbidity.categories, categories: chartInfo.turbidity.categories,
series: [ series: [
@ -625,17 +729,17 @@
name: '浊度', name: '浊度',
legendShape: 'circle', legendShape: 'circle',
data: chartInfo.turbidity.data, data: chartInfo.turbidity.data,
},
],
}
this.chart_turbidity = JSON.parse(JSON.stringify(res6))
}else{
this.chart_turbidity = null
} }
]
};
this.chart_turbidity = JSON.parse(JSON.stringify(res6));
//end turbidity //end turbidity
} }
}).catch(()=>{
}) })
.catch(() => {})
}, },
// //
getDeviceWarningNums() { getDeviceWarningNums() {
@ -643,35 +747,38 @@
base: this.addressValue, base: this.addressValue,
device: this.device_id, device: this.device_id,
status: 0, status: 0,
_t: new Date().getTime() _t: new Date().getTime(),
} }
this.$http.get('/api/device-warning-nums',{params:params}).then(({data})=>{ this.$http
.get('/api/device-warning-nums', { params: params })
.then(({ data }) => {
if (data.code == 200) { if (data.code == 200) {
this.deviceWarning = data.data; this.deviceWarning = data.data
} }
}).catch(()=>{
}) })
.catch(() => {})
}, },
// //
getDeviceWarningRules() { getDeviceWarningRules() {
this.$http.get('/api/device-warning-rules',{params:{}}).then(({data})=>{ this.$http
.get('/api/device-warning-rules', { params: {} })
.then(({ data }) => {
if (data.code == 200) { if (data.code == 200) {
let _data = data.data; let _data = data.data
let info = {}; let info = {}
for (let item of _data) { for (let item of _data) {
if(item.slug=='device_warning_rule_waterquality'){// if (item.slug == 'device_warning_rule_waterquality') {
info = item; //
break; info = item
break
} }
} }
this.formInfo = info.value; this.formInfo = info.value
} }
}).catch(()=>{
}) })
} .catch(() => {})
} },
},
} }
</script> </script>
@ -702,7 +809,6 @@
.cont-box { .cont-box {
display: flex; display: flex;
padding-bottom: 12rpx; padding-bottom: 12rpx;
} }
.warning-item { .warning-item {
flex: 1; flex: 1;

View File

@ -129,7 +129,7 @@
<view class="handle-btns"> <view class="handle-btns">
<view v-auth="['endpoint.admin_users.destroy']" class="btn_del" @click="deleteInfoId(formInfo.id)"></view> <view v-auth="['endpoint.admin_users.destroy']" class="btn_del" @click="deleteInfoId(formInfo.id)"></view>
<view v-auth="['endpoint.admin_users.edit_password']" class="btn_edit" @click="editPwdPopup(formInfo.id)"></view> <view v-auth="['endpoint.admin_users.edit_password']" class="btn_edit" @click="editPwdPopup(formInfo.id)"></view>
<view v-if="formInfo.banned_at" v-auth="['super']" class="btn_edit" @click="unlock(formInfo.id)"></view> <view v-if="formInfo.banned_at" v-auth="['endpoint.admin_users.unban']" class="btn_edit" @click="unlock(formInfo.id)"></view>
<view v-auth="['endpoint.admin_users.edit']" class="btn_edit" @click="editInfoId(formInfo.id)"></view> <view v-auth="['endpoint.admin_users.edit']" class="btn_edit" @click="editInfoId(formInfo.id)"></view>
</view> </view>
</view> </view>