fix: 后台接口对接,问题修复及线上提交测试。
This commit is contained in:
1
components.d.ts
vendored
1
components.d.ts
vendored
@@ -7,6 +7,7 @@ export {}
|
|||||||
|
|
||||||
declare module 'vue' {
|
declare module 'vue' {
|
||||||
export interface GlobalComponents {
|
export interface GlobalComponents {
|
||||||
|
ChartFullscreen: typeof import('./src/components/other/chartFullscreen.vue')['default']
|
||||||
CustomNavigationBar: typeof import('./src/components/custom-navigation-bar/index.vue')['default']
|
CustomNavigationBar: typeof import('./src/components/custom-navigation-bar/index.vue')['default']
|
||||||
Fish: typeof import('./src/components/other/fish.vue')['default']
|
Fish: typeof import('./src/components/other/fish.vue')['default']
|
||||||
NutBadge: typeof import('@nutui/nutui-taro')['Badge']
|
NutBadge: typeof import('@nutui/nutui-taro')['Badge']
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ const API_PATHS = {
|
|||||||
},
|
},
|
||||||
// 获取短信验证码
|
// 获取短信验证码
|
||||||
SMS_CODE: {
|
SMS_CODE: {
|
||||||
v1: '/resource/sms/code',
|
|
||||||
v2: '/resource/sms/code',
|
v2: '/resource/sms/code',
|
||||||
},
|
},
|
||||||
// 微信手机号登录
|
// 微信手机号登录
|
||||||
@@ -50,23 +49,19 @@ const API_PATHS = {
|
|||||||
HOME: {
|
HOME: {
|
||||||
// 塘口列表模式1
|
// 塘口列表模式1
|
||||||
POND_LIST: {
|
POND_LIST: {
|
||||||
v1: '/fishery/pond/list',
|
|
||||||
v2: '/fishery/pond/list_mode1',
|
v2: '/fishery/pond/list_mode1',
|
||||||
},
|
},
|
||||||
// 塘口列表模式2
|
// 塘口列表模式2
|
||||||
POND_LIST_MODE2: {
|
POND_LIST_MODE2: {
|
||||||
v1: '/api/pond/list_mode2',
|
v2: '/fishery/pond/list_mode2',
|
||||||
v2: '/fishery/pond/list/mode2',
|
|
||||||
},
|
},
|
||||||
// 公告列表
|
// 公告列表
|
||||||
NOTICE_LIST: {
|
NOTICE_LIST: {
|
||||||
v1: '/api/sys-notice/notice_list',
|
v2: '/system/notice/list',
|
||||||
v2: '/fishery/notice/list',
|
|
||||||
},
|
},
|
||||||
// 即将到期设备列表
|
// 即将到期设备列表
|
||||||
DEVICE_DEAD: {
|
DEVICE_DEAD: {
|
||||||
v1: '/api/device/list_device_dead',
|
v2: '/fishery/device/list_device_dead',
|
||||||
v2: '/fishery/device/expiring',
|
|
||||||
},
|
},
|
||||||
// 获取设备票据
|
// 获取设备票据
|
||||||
DEVICE_TICKET: {
|
DEVICE_TICKET: {
|
||||||
@@ -99,12 +94,10 @@ const API_PATHS = {
|
|||||||
},
|
},
|
||||||
// 塘口下设备信息
|
// 塘口下设备信息
|
||||||
DEVICE_INFO: {
|
DEVICE_INFO: {
|
||||||
v1: '/api/pond/pond_device_info',
|
|
||||||
v2: '/fishery/pond/devices',
|
v2: '/fishery/pond/devices',
|
||||||
},
|
},
|
||||||
// 将设备及开关绑定到塘口
|
// 将设备及开关绑定到塘口
|
||||||
BIND_DEVICE: {
|
BIND_DEVICE: {
|
||||||
v1: '/api/pond/select_device_switch',
|
|
||||||
v2: '/fishery/pond/bind/device',
|
v2: '/fishery/pond/bind/device',
|
||||||
},
|
},
|
||||||
// 夜间防误触
|
// 夜间防误触
|
||||||
@@ -118,42 +111,34 @@ const API_PATHS = {
|
|||||||
DEVICE: {
|
DEVICE: {
|
||||||
// 设备列表
|
// 设备列表
|
||||||
LIST_ALL: {
|
LIST_ALL: {
|
||||||
v1: '/api/device/list_all_device',
|
|
||||||
v2: '/fishery/device/list_all_device',
|
v2: '/fishery/device/list_all_device',
|
||||||
},
|
},
|
||||||
// 设备详情
|
// 设备详情
|
||||||
INFO: {
|
INFO: {
|
||||||
v1: '/api/device/one_device_info',
|
v2: '/fishery/device/one_device_info',
|
||||||
v2: '/fishery/device/info',
|
|
||||||
},
|
},
|
||||||
// 解除绑定
|
// 解除绑定
|
||||||
UNBIND: {
|
UNBIND: {
|
||||||
v1: '/api/device/break_pond',
|
v2: '/fishery/device/break_pond',
|
||||||
v2: '/fishery/device/unbind',
|
|
||||||
},
|
},
|
||||||
// 设备图表数据
|
// 设备图表数据
|
||||||
HISTORY: {
|
HISTORY: {
|
||||||
v1: '/api/device/data_history',
|
v2: '/td/device/getHistoryData',
|
||||||
v2: '/fishery/device/history',
|
|
||||||
},
|
},
|
||||||
// 修改设备名称
|
// 修改设备名称
|
||||||
UPDATE_NAME: {
|
UPDATE_NAME: {
|
||||||
v1: '/api/device/update_name',
|
v2: '/fishery/device/update_name',
|
||||||
v2: '/fishery/device/name',
|
|
||||||
},
|
},
|
||||||
// 修改设备关联塘口
|
// 修改设备关联塘口
|
||||||
UPDATE_POND: {
|
UPDATE_POND: {
|
||||||
v1: '/api/device/update_pond',
|
v2: '/fishery/pond/update_pond',
|
||||||
v2: '/fishery/device/pond',
|
|
||||||
},
|
},
|
||||||
// 修改设备接电方式
|
// 修改设备接电方式
|
||||||
UPDATE_VOLTAGE: {
|
UPDATE_VOLTAGE: {
|
||||||
v1: '/api/device/update_voltage_type',
|
v2: '/iot/device/voltage_type',
|
||||||
v2: '/fishery/device/voltage',
|
|
||||||
},
|
},
|
||||||
// 删除设备
|
// 删除设备
|
||||||
DELETE: {
|
DELETE: {
|
||||||
v1: '/api/device/delete',
|
|
||||||
v2: '/fishery/device',
|
v2: '/fishery/device',
|
||||||
},
|
},
|
||||||
// 扫描设备编码
|
// 扫描设备编码
|
||||||
@@ -167,13 +152,11 @@ const API_PATHS = {
|
|||||||
},
|
},
|
||||||
// 盐度设置
|
// 盐度设置
|
||||||
SET_SALINITY: {
|
SET_SALINITY: {
|
||||||
v1: '/api/device/detector_salinitycompensation',
|
v2: '/iot/device/salinity-compensation',
|
||||||
v2: '/fishery/device/salinity',
|
|
||||||
},
|
},
|
||||||
// 设备校准
|
// 设备校准
|
||||||
CALIBRATE: {
|
CALIBRATE: {
|
||||||
v1: '/api/device/detector_calibrate',
|
v2: '/iot/device/calibrate',
|
||||||
v2: '/fishery/device/calibrate',
|
|
||||||
},
|
},
|
||||||
// 添加水质检测仪
|
// 添加水质检测仪
|
||||||
ADD_DETECTOR: {
|
ADD_DETECTOR: {
|
||||||
@@ -181,38 +164,31 @@ const API_PATHS = {
|
|||||||
},
|
},
|
||||||
// 设置溶解氧/水温告警
|
// 设置溶解氧/水温告警
|
||||||
SET_WARN_CALL: {
|
SET_WARN_CALL: {
|
||||||
v1: '/api/device/set_oxy_warn_call',
|
v2: '/fishery/device/set_oxy_warn_call',
|
||||||
v2: '/fishery/device/warn/call',
|
|
||||||
},
|
},
|
||||||
// 设置溶解氧上下限
|
// 设置溶解氧上下限
|
||||||
SET_OXY_WARN: {
|
SET_OXY_WARN: {
|
||||||
v1: '/api/device/set_oxy_warn_value',
|
v2: '/fishery/device/set_oxy_warn_value',
|
||||||
v2: '/fishery/device/warn/oxy',
|
|
||||||
},
|
},
|
||||||
// 设置温度上下限
|
// 设置温度上下限
|
||||||
SET_TEMP_WARN: {
|
SET_TEMP_WARN: {
|
||||||
v1: '/api/device/set_temp_warn_value',
|
v2: '/fishery/device/set_temp_warn_value',
|
||||||
v2: '/fishery/device/warn/temp',
|
|
||||||
},
|
},
|
||||||
// 溶解氧饱和度
|
// 溶解氧饱和度
|
||||||
GET_SATURABILITY: {
|
GET_SATURABILITY: {
|
||||||
v1: '/api/device/get_saturability',
|
v2: '/fishery/device/get_saturability',
|
||||||
v2: '/fishery/device/saturability',
|
|
||||||
},
|
},
|
||||||
// 添加控制一体机
|
// 添加控制一体机
|
||||||
ADD_CONTROLLER: {
|
ADD_CONTROLLER: {
|
||||||
v1: '/api/device/add_device_controller',
|
|
||||||
v2: '/iot/device/add_device_controller',
|
v2: '/iot/device/add_device_controller',
|
||||||
},
|
},
|
||||||
// 启停溶解氧
|
// 启停溶解氧
|
||||||
SET_OXY_OPEN: {
|
SET_OXY_OPEN: {
|
||||||
v1: '/api/device/set_controller_oxy_open',
|
v2: '/fishery/device/set_controller_oxy_open',
|
||||||
v2: '/fishery/device/oxy/switch',
|
|
||||||
},
|
},
|
||||||
// 电压告警开关
|
// 电压告警开关
|
||||||
VOLTAGE_CHECK: {
|
VOLTAGE_CHECK: {
|
||||||
v1: '/api/device/voltage_check_open',
|
v2: '/fishery/device/voltage_check_open',
|
||||||
v2: '/fishery/device/voltage/check',
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -220,28 +196,23 @@ const API_PATHS = {
|
|||||||
LINKED_CTRL: {
|
LINKED_CTRL: {
|
||||||
// 设备控制器列表
|
// 设备控制器列表
|
||||||
LIST: {
|
LIST: {
|
||||||
v1: '/api/linked-ctrl/fetch',
|
v2: '/fishery/linkedCtrl/fetch',
|
||||||
v2: '/fishery/linked-ctrl/list',
|
|
||||||
},
|
},
|
||||||
// 添加联动控制
|
// 添加联动控制
|
||||||
ADD: {
|
ADD: {
|
||||||
v1: '/api/linked-ctrl/add',
|
v2: '/fishery/linkedCtrl/add',
|
||||||
v2: '/fishery/linked-ctrl',
|
|
||||||
},
|
},
|
||||||
// 修改联动控制
|
// 修改联动控制
|
||||||
UPDATE: {
|
UPDATE: {
|
||||||
v1: '/api/linked-ctrl/update',
|
v2: '/fishery/linkedCtrl/update',
|
||||||
v2: '/fishery/linked-ctrl',
|
|
||||||
},
|
},
|
||||||
// 删除联动控制
|
// 删除联动控制
|
||||||
DELETE: {
|
DELETE: {
|
||||||
v1: '/api/linked-ctrl/delete',
|
v2: '/fishery/linkedCtrl',
|
||||||
v2: '/fishery/linked-ctrl',
|
|
||||||
},
|
},
|
||||||
// 设置联动控制上下限开关
|
// 设置联动控制上下限开关
|
||||||
SET_OPEN: {
|
SET_OPEN: {
|
||||||
v1: '/api/linked-ctrl/set_open',
|
v2: '/fishery/linkedCtrl/set_open',
|
||||||
v2: '/fishery/linked-ctrl/switch',
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -249,48 +220,39 @@ const API_PATHS = {
|
|||||||
SWITCH: {
|
SWITCH: {
|
||||||
// 开关列表
|
// 开关列表
|
||||||
POND_LIST: {
|
POND_LIST: {
|
||||||
v1: '/api/device-switch/get_pond_switch',
|
v2: '/fishery/deviceSwitch/get_pond_switch',
|
||||||
v2: '/fishery/switch/list',
|
|
||||||
},
|
},
|
||||||
// 开关详情
|
// 开关详情
|
||||||
INFO: {
|
INFO: {
|
||||||
v1: '/api/device-switch/one_switch_info',
|
v2: '/fishery/deviceSwitch/one_switch_info',
|
||||||
v2: '/fishery/switch/info',
|
|
||||||
},
|
},
|
||||||
// 修改开关名称
|
// 修改开关名称
|
||||||
UPDATE_NAME: {
|
UPDATE_NAME: {
|
||||||
v1: '/api/device-switch/update_name',
|
v2: '/fishery/deviceSwitch/update_name',
|
||||||
v2: '/fishery/switch/name',
|
|
||||||
},
|
},
|
||||||
// 修改关联塘口
|
// 修改关联塘口
|
||||||
UPDATE_POND: {
|
UPDATE_POND: {
|
||||||
v1: '/api/device-switch/update_pond',
|
v2: '/iot/switch/update_pond',
|
||||||
v2: '/fishery/switch/pond',
|
|
||||||
},
|
},
|
||||||
// 修改接线方式
|
// 修改接线方式
|
||||||
UPDATE_VOLTAGE: {
|
UPDATE_VOLTAGE: {
|
||||||
v1: '/api/device-switch/update_voltage_type',
|
v2: '/iot/switch/update_voltage_type',
|
||||||
v2: '/fishery/switch/voltage',
|
|
||||||
},
|
},
|
||||||
// 单个开关启停
|
// 单个开关启停
|
||||||
TURN: {
|
TURN: {
|
||||||
v1: '/api/device-switch/turn_switch',
|
v2: '/iot/switch/turn_switch',
|
||||||
v2: '/fishery/switch/turn',
|
|
||||||
},
|
},
|
||||||
// 所有开关启停
|
// 所有开关启停
|
||||||
TURN_POND: {
|
TURN_POND: {
|
||||||
v1: '/api/device-switch/turn_pond_switch',
|
v2: '/iot/switch/turn_pond_switch',
|
||||||
v2: '/fishery/switch/turn/all',
|
|
||||||
},
|
},
|
||||||
// 电流告警开关
|
// 电流告警开关
|
||||||
ELECTRIC_CHECK: {
|
ELECTRIC_CHECK: {
|
||||||
v1: '/api/device-switch/electric_check_open',
|
v2: '/fishery/deviceSwitch/electric_check_open',
|
||||||
v2: '/fishery/switch/electric/check',
|
|
||||||
},
|
},
|
||||||
// 电流告警设置
|
// 电流告警设置
|
||||||
ELECTRIC_SET: {
|
ELECTRIC_SET: {
|
||||||
v1: '/api/device-switch/electric_set',
|
v2: '/iot/switch/electric_set',
|
||||||
v2: '/fishery/switch/electric/set',
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import httpService from '@/utils/request'
|
import httpService from '@/utils/request'
|
||||||
import API from './config'
|
import API from './config'
|
||||||
|
import Taro from '@tarojs/taro'
|
||||||
/** 设备相关接口---------------------------------------- */
|
/** 设备相关接口---------------------------------------- */
|
||||||
|
|
||||||
// 设备列表
|
// 设备列表
|
||||||
@@ -8,27 +9,31 @@ export function allDeviceList(params) {
|
|||||||
}
|
}
|
||||||
// 设备详情
|
// 设备详情
|
||||||
export function deviceInfo(data){
|
export function deviceInfo(data){
|
||||||
return httpService.post(API.DEVICE.INFO(), {data})
|
const userId = Taro.getStorageSync('UserId');
|
||||||
|
return httpService.post(`${API.DEVICE.INFO()}?rootUserId=${userId}`, {data})
|
||||||
}
|
}
|
||||||
// 解除绑定
|
// 解除绑定
|
||||||
export function deviceUnbind(data){
|
export function deviceUnbind(data){
|
||||||
return httpService.post(API.DEVICE.UNBIND(), {data})
|
const userId = Taro.getStorageSync('UserId');
|
||||||
|
return httpService.post(`${API.DEVICE.UNBIND()}?rootUserId=${userId}`, {data})
|
||||||
}
|
}
|
||||||
// 将设备及开关绑定到塘口
|
// 将设备及开关绑定到塘口
|
||||||
export function bandDeviceToPond(data){
|
export function bandDeviceToPond(data){
|
||||||
return httpService.put(API.POND.BIND_DEVICE(), {data})
|
return httpService.put(API.POND.BIND_DEVICE(), {data})
|
||||||
}
|
}
|
||||||
// 设备图表数据
|
// 设备图表数据
|
||||||
export function deviceHistory(data){
|
export function deviceHistory(params){
|
||||||
return httpService.post(API.DEVICE.HISTORY(), {data})
|
return httpService.get(API.DEVICE.HISTORY(), {params})
|
||||||
}
|
}
|
||||||
// 修改设备名称
|
// 修改设备名称
|
||||||
export function deviceUpdateName(data){
|
export function deviceUpdateName(data){
|
||||||
return httpService.put(API.DEVICE.UPDATE_NAME(), {data})
|
const userId = Taro.getStorageSync('UserId');
|
||||||
|
return httpService.put(`${API.DEVICE.UPDATE_NAME()}?rootUserId=${userId}`, {data})
|
||||||
}
|
}
|
||||||
// 修改设备关联塘口
|
// 修改设备关联塘口
|
||||||
export function deviceUpdatePond(data){
|
export function deviceUpdatePond(data){
|
||||||
return httpService.put(API.DEVICE.UPDATE_POND(), {data})
|
const userId = Taro.getStorageSync('UserId');
|
||||||
|
return httpService.put(`${API.DEVICE.UPDATE_POND()}?rootUserId=${userId}`, {data})
|
||||||
}
|
}
|
||||||
// 修改设备接电方式
|
// 修改设备接电方式
|
||||||
export function deviceUpdateV(data){
|
export function deviceUpdateV(data){
|
||||||
@@ -36,7 +41,8 @@ export function deviceUpdateV(data){
|
|||||||
}
|
}
|
||||||
// 删除设备
|
// 删除设备
|
||||||
export function deviceDel(data){
|
export function deviceDel(data){
|
||||||
return httpService.delete(API.DEVICE.DELETE(), {data})
|
// 后端需要 /{ids} 路径参数,传入 ID 数组
|
||||||
|
return httpService.delete(`${API.DEVICE.DELETE()}/${data.id}`)
|
||||||
}
|
}
|
||||||
// 扫描设备编码
|
// 扫描设备编码
|
||||||
export function deviceScan(params){
|
export function deviceScan(params){
|
||||||
@@ -61,15 +67,18 @@ export function addDeviceDetector(data) {
|
|||||||
}
|
}
|
||||||
// 设置溶解氧/水温告警
|
// 设置溶解氧/水温告警
|
||||||
export function setWarnCall(data){
|
export function setWarnCall(data){
|
||||||
return httpService.post(API.DEVICE.SET_WARN_CALL(), {data})
|
const userId = Taro.getStorageSync('UserId');
|
||||||
|
return httpService.post(`${API.DEVICE.SET_WARN_CALL()}?rootUserId=${userId}`, {data})
|
||||||
}
|
}
|
||||||
// 设置溶解氧上下限
|
// 设置溶解氧上下限
|
||||||
export function setOxyWarn(data){
|
export function setOxyWarn(data){
|
||||||
return httpService.put(API.DEVICE.SET_OXY_WARN(), {data})
|
const userId = Taro.getStorageSync('UserId');
|
||||||
|
return httpService.put(`${API.DEVICE.SET_OXY_WARN()}?rootUserId=${userId}`, {data})
|
||||||
}
|
}
|
||||||
// 设置温度上下限
|
// 设置温度上下限
|
||||||
export function setTempWarn(data){
|
export function setTempWarn(data){
|
||||||
return httpService.put(API.DEVICE.SET_TEMP_WARN(), {data})
|
const userId = Taro.getStorageSync('UserId');
|
||||||
|
return httpService.put(`${API.DEVICE.SET_TEMP_WARN()}?rootUserId=${userId}`, {data})
|
||||||
}
|
}
|
||||||
// 溶解氧饱和度
|
// 溶解氧饱和度
|
||||||
export function getSaturability(data){
|
export function getSaturability(data){
|
||||||
@@ -82,7 +91,8 @@ export function addDeviceController(data) {
|
|||||||
}
|
}
|
||||||
// 启停溶解氧
|
// 启停溶解氧
|
||||||
export function setOxyOpen(data){
|
export function setOxyOpen(data){
|
||||||
return httpService.put(API.DEVICE.SET_OXY_OPEN(), {data})
|
const userId = Taro.getStorageSync('UserId');
|
||||||
|
return httpService.put(`${API.DEVICE.SET_OXY_OPEN()}?rootUserId=${userId}`, {data})
|
||||||
}
|
}
|
||||||
/** 联动控制------------------------------------- */
|
/** 联动控制------------------------------------- */
|
||||||
// 设备控制器列表
|
// 设备控制器列表
|
||||||
@@ -99,7 +109,9 @@ export function updateLinkerCtrl(data){
|
|||||||
}
|
}
|
||||||
// 删除联动控制
|
// 删除联动控制
|
||||||
export function delLinkerCtrl(data){
|
export function delLinkerCtrl(data){
|
||||||
return httpService.delete(API.LINKED_CTRL.DELETE(), {data})
|
const userId = Taro.getStorageSync('UserId');
|
||||||
|
// 后端需要 /{ids} 路径参数
|
||||||
|
return httpService.delete(`${API.LINKED_CTRL.DELETE()}/${data.id}?rootUserId=${userId}`)
|
||||||
}
|
}
|
||||||
// 设置联动控制上下限开关
|
// 设置联动控制上下限开关
|
||||||
export function setLinkOpen(data){
|
export function setLinkOpen(data){
|
||||||
@@ -137,7 +149,8 @@ export function turnPondSwitch(data){
|
|||||||
|
|
||||||
// 电压告警开关 开启或关闭
|
// 电压告警开关 开启或关闭
|
||||||
export function voltageCheckOpen(data){
|
export function voltageCheckOpen(data){
|
||||||
return httpService.put(API.DEVICE.VOLTAGE_CHECK(), {data})
|
const userId = Taro.getStorageSync('UserId');
|
||||||
|
return httpService.put(`${API.DEVICE.VOLTAGE_CHECK()}?rootUserId=${userId}`, {data})
|
||||||
}
|
}
|
||||||
// 电流告警开关 开启或关闭
|
// 电流告警开关 开启或关闭
|
||||||
export function electricCheckOpen(data){
|
export function electricCheckOpen(data){
|
||||||
|
|||||||
@@ -14,7 +14,12 @@ export function getPond1() {
|
|||||||
|
|
||||||
// 塘口模式2
|
// 塘口模式2
|
||||||
export function getPond2(){
|
export function getPond2(){
|
||||||
return httpService.get(API.HOME.POND_LIST_MODE2())
|
const userId = Taro.getStorageSync("UserId");
|
||||||
|
return httpService.get(API.HOME.POND_LIST_MODE2(), {
|
||||||
|
params: {
|
||||||
|
rootUserId: userId || undefined
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 公告列表
|
// 公告列表
|
||||||
@@ -24,7 +29,12 @@ export function noticeList(){
|
|||||||
|
|
||||||
// 即将到期设备列表
|
// 即将到期设备列表
|
||||||
export function deviceDead(){
|
export function deviceDead(){
|
||||||
return httpService.get(API.HOME.DEVICE_DEAD())
|
const userId = Taro.getStorageSync("UserId");
|
||||||
|
return httpService.get(API.HOME.DEVICE_DEAD(), {
|
||||||
|
params: {
|
||||||
|
rootUserId: userId || undefined
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取设备票据
|
// 获取设备票据
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ export default defineAppConfig({
|
|||||||
'pages/main/home',
|
'pages/main/home',
|
||||||
'pages/msg/index',
|
'pages/msg/index',
|
||||||
'pages/main/my',
|
'pages/main/my',
|
||||||
|
'components/other/chartFullscreen',
|
||||||
],
|
],
|
||||||
requiredPrivateInfos: [
|
requiredPrivateInfos: [
|
||||||
"getLocation", "chooseLocation"
|
"getLocation", "chooseLocation"
|
||||||
|
|||||||
5
src/components/other/chartFullscreen.config.ts
Normal file
5
src/components/other/chartFullscreen.config.ts
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
export default definePageConfig({
|
||||||
|
navigationBarTitleText: '曲线图',
|
||||||
|
navigationStyle: 'custom',
|
||||||
|
enablePullDownRefresh: false,
|
||||||
|
})
|
||||||
388
src/components/other/chartFullscreen.vue
Normal file
388
src/components/other/chartFullscreen.vue
Normal file
@@ -0,0 +1,388 @@
|
|||||||
|
<template>
|
||||||
|
<view class="chart-fullscreen-page">
|
||||||
|
<!-- 顶部标题栏 -->
|
||||||
|
<view class="header">
|
||||||
|
<view class="back-btn" @click="goBack">
|
||||||
|
<text class="icon">←</text>
|
||||||
|
</view>
|
||||||
|
<view class="title">{{ chartTitle }}</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 时间选择 -->
|
||||||
|
<view class="time-selector">
|
||||||
|
<view
|
||||||
|
class="time-item"
|
||||||
|
:class="{ active: dayType === 1 }"
|
||||||
|
@click="changeDay(1)"
|
||||||
|
>
|
||||||
|
1天
|
||||||
|
</view>
|
||||||
|
<view
|
||||||
|
class="time-item"
|
||||||
|
:class="{ active: dayType === 3 }"
|
||||||
|
@click="changeDay(3)"
|
||||||
|
>
|
||||||
|
3天
|
||||||
|
</view>
|
||||||
|
<view
|
||||||
|
class="time-item"
|
||||||
|
:class="{ active: dayType === 7 }"
|
||||||
|
@click="changeDay(7)"
|
||||||
|
>
|
||||||
|
7天
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 图表容器 -->
|
||||||
|
<view class="chart-container">
|
||||||
|
<canvas
|
||||||
|
class="chart-canvas"
|
||||||
|
canvas-id="fullscreen-chart"
|
||||||
|
id="fullscreen-chart"
|
||||||
|
></canvas>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, onMounted, onUnmounted } from 'vue';
|
||||||
|
import Taro from '@tarojs/taro';
|
||||||
|
import { deviceHistory } from '@/api/device';
|
||||||
|
import { formatDateMin } from '@/utils/tools';
|
||||||
|
import uCharts from '@/utils/js-sdk/u-charts/u-charts.js';
|
||||||
|
|
||||||
|
const dayType = ref(1);
|
||||||
|
const chartTitle = ref('溶解氧曲线图');
|
||||||
|
const chartData = ref<any[]>([]);
|
||||||
|
let chartInstance: any = null;
|
||||||
|
|
||||||
|
// 接收的参数
|
||||||
|
const serialNum = ref('');
|
||||||
|
const dataType = ref(1); // 1-溶解氧, 2-水温, 3-饱和度, 4-PH, 5-盐度
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
// 获取页面参数
|
||||||
|
const instance = Taro.getCurrentInstance();
|
||||||
|
const params = instance.router?.params || {};
|
||||||
|
|
||||||
|
serialNum.value = params.serialNum || '';
|
||||||
|
dataType.value = Number(params.dataType) || 1;
|
||||||
|
dayType.value = Number(params.dayType) || 1;
|
||||||
|
|
||||||
|
// 设置标题
|
||||||
|
const titles = ['', '溶解氧曲线图', '水温曲线图', '饱和度曲线图', 'PH曲线图', '盐度曲线图'];
|
||||||
|
chartTitle.value = titles[dataType.value] || '曲线图';
|
||||||
|
|
||||||
|
// 初始化图表
|
||||||
|
setTimeout(() => {
|
||||||
|
initChart();
|
||||||
|
}, 500);
|
||||||
|
});
|
||||||
|
|
||||||
|
onUnmounted(() => {
|
||||||
|
if (chartInstance) {
|
||||||
|
chartInstance = null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 初始化图表
|
||||||
|
function initChart() {
|
||||||
|
// 横屏后的尺寸计算:
|
||||||
|
// 页面宽度 = 屏幕高度(100vh)
|
||||||
|
// 页面高度 = 屏幕宽度(100vw)
|
||||||
|
// header(50px) + time-selector(50px) = 100px
|
||||||
|
|
||||||
|
const screenWidth = window.innerWidth; // 屏幕宽度
|
||||||
|
const screenHeight = window.innerHeight; // 屏幕高度
|
||||||
|
|
||||||
|
// 横屏后:
|
||||||
|
const cWidth = screenHeight - 40; // 页面宽度(100vh) - padding
|
||||||
|
const cHeight = screenWidth - 120; // 页面高度(100vw) - header - time-selector - padding
|
||||||
|
|
||||||
|
console.log('📊 横屏图表尺寸计算:', {
|
||||||
|
屏幕宽: screenWidth,
|
||||||
|
屏幕高: screenHeight,
|
||||||
|
图表宽: cWidth,
|
||||||
|
图表高: cHeight
|
||||||
|
});
|
||||||
|
|
||||||
|
// 加载数据
|
||||||
|
loadChartData(cWidth, cHeight, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 返回上一页
|
||||||
|
function goBack() {
|
||||||
|
Taro.navigateBack();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 返回首页
|
||||||
|
function goHome() {
|
||||||
|
Taro.switchTab({
|
||||||
|
url: '/pages/main/home'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 切换天数
|
||||||
|
function changeDay(day: number) {
|
||||||
|
dayType.value = day;
|
||||||
|
|
||||||
|
// 重新计算尺寸
|
||||||
|
const screenWidth = window.innerWidth;
|
||||||
|
const screenHeight = window.innerHeight;
|
||||||
|
const cWidth = screenHeight - 40;
|
||||||
|
const cHeight = screenWidth - 120;
|
||||||
|
|
||||||
|
loadChartData(cWidth, cHeight, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 加载图表数据
|
||||||
|
function loadChartData(cWidth: number, cHeight: number, pixelRatio: number) {
|
||||||
|
if (!serialNum.value) return;
|
||||||
|
|
||||||
|
const now = new Date();
|
||||||
|
const start = new Date(now.getTime() - dayType.value * 24 * 60 * 60 * 1000);
|
||||||
|
|
||||||
|
const params = {
|
||||||
|
serialNum: serialNum.value,
|
||||||
|
startTime: formatDateMin(start),
|
||||||
|
endTime: formatDateMin(now),
|
||||||
|
intervalType: dayType.value === 1 ? 1 : dayType.value === 3 ? 2 : 3,
|
||||||
|
};
|
||||||
|
|
||||||
|
Taro.showLoading({ title: '加载中...' });
|
||||||
|
|
||||||
|
deviceHistory(params).then((res: any) => {
|
||||||
|
Taro.hideLoading();
|
||||||
|
|
||||||
|
if (Array.isArray(res)) {
|
||||||
|
chartData.value = res;
|
||||||
|
} else if (res.code == 200) {
|
||||||
|
chartData.value = res.data || [];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 绘制图表
|
||||||
|
drawChart(cWidth, cHeight, pixelRatio);
|
||||||
|
}).catch(() => {
|
||||||
|
Taro.hideLoading();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 绘制图表
|
||||||
|
function drawChart(cWidth: number, cHeight: number, pixelRatio: number) {
|
||||||
|
if (!chartData.value || chartData.value.length === 0) {
|
||||||
|
console.log('❌ 数据为空');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const fieldMap: any = {
|
||||||
|
1: 'dissolvedOxygen',
|
||||||
|
2: 'temperature',
|
||||||
|
3: 'saturability',
|
||||||
|
4: 'ph',
|
||||||
|
5: 'salinity',
|
||||||
|
};
|
||||||
|
|
||||||
|
const nameMap: any = {
|
||||||
|
1: '溶解氧',
|
||||||
|
2: '水温',
|
||||||
|
3: '饱和度',
|
||||||
|
4: 'PH',
|
||||||
|
5: '盐度',
|
||||||
|
};
|
||||||
|
|
||||||
|
const fieldName = fieldMap[dataType.value] || 'dissolvedOxygen';
|
||||||
|
const seriesName = nameMap[dataType.value] || '溶解氧';
|
||||||
|
|
||||||
|
const xAxisData: string[] = [];
|
||||||
|
const seriesData: number[] = [];
|
||||||
|
|
||||||
|
chartData.value.forEach((item: any) => {
|
||||||
|
const timeStr = item.time || item.createTime || '';
|
||||||
|
const timeParts = timeStr.split(' ');
|
||||||
|
if (timeParts.length > 1) {
|
||||||
|
const datePart = timeParts[0]; // YYYY-MM-DD
|
||||||
|
const timePart = timeParts[1]; // HH:mm:ss.0
|
||||||
|
|
||||||
|
// 提取 MM-DD HH:mm
|
||||||
|
const dateMatch = datePart.match(/\d{4}-(\d{2})-(\d{2})/);
|
||||||
|
const monthDay = dateMatch ? `${dateMatch[1]}-${dateMatch[2]}` : '';
|
||||||
|
const hourMin = timePart.substring(0, 5); // HH:mm
|
||||||
|
|
||||||
|
const formattedTime = `${monthDay} ${hourMin}`;
|
||||||
|
xAxisData.push(formattedTime);
|
||||||
|
}
|
||||||
|
const value = item[fieldName];
|
||||||
|
seriesData.push(value !== null && value !== undefined ? Number(value) : 0);
|
||||||
|
});
|
||||||
|
|
||||||
|
// H5 环境,延迟获取 Canvas 确保 DOM 渲染完成
|
||||||
|
setTimeout(() => {
|
||||||
|
// Taro 在 H5 下会在容器内部生成 <canvas> 标签
|
||||||
|
const canvasElement = document.querySelector('#fullscreen-chart canvas') as HTMLCanvasElement;
|
||||||
|
|
||||||
|
if (!canvasElement) {
|
||||||
|
console.error('❌ Canvas 元素未找到');
|
||||||
|
console.log('尝试查找所有 canvas...');
|
||||||
|
const allCanvas = document.querySelectorAll('canvas');
|
||||||
|
console.log('页面中所有 canvas:', allCanvas);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('✅ 找到 Canvas 元素:', canvasElement);
|
||||||
|
|
||||||
|
const ctx = canvasElement.getContext('2d');
|
||||||
|
if (!ctx) {
|
||||||
|
console.error('❌ 无法获取 Canvas Context');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('✅ 获取 Context 成功');
|
||||||
|
|
||||||
|
chartInstance = new uCharts({
|
||||||
|
type: 'line',
|
||||||
|
context: ctx,
|
||||||
|
width: cWidth,
|
||||||
|
height: cHeight,
|
||||||
|
categories: xAxisData,
|
||||||
|
series: [
|
||||||
|
{
|
||||||
|
name: seriesName,
|
||||||
|
data: seriesData,
|
||||||
|
}
|
||||||
|
],
|
||||||
|
pixelRatio: 1,
|
||||||
|
dataPointShape: false,
|
||||||
|
animation: true,
|
||||||
|
background: '#FFFFFF',
|
||||||
|
color: ['#1890FF'],
|
||||||
|
padding: [15, 30, 35, 45],
|
||||||
|
enableScroll: false,
|
||||||
|
boundaryGap: 'justify',
|
||||||
|
legend: {
|
||||||
|
show: false
|
||||||
|
},
|
||||||
|
dataLabel: false,
|
||||||
|
xAxis: {
|
||||||
|
disableGrid: true,
|
||||||
|
axisLine: true,
|
||||||
|
type: 'grid',
|
||||||
|
gridType: 'dash',
|
||||||
|
itemCount: 0,
|
||||||
|
scrollShow: false,
|
||||||
|
scrollAlign: 'left',
|
||||||
|
labelCount: 10,
|
||||||
|
rotateLabel: true,
|
||||||
|
rotateAngle: 25,
|
||||||
|
},
|
||||||
|
yAxis: {
|
||||||
|
disableGrid: false,
|
||||||
|
gridType: 'dash',
|
||||||
|
tofix: 2,
|
||||||
|
},
|
||||||
|
extra: {
|
||||||
|
line: {
|
||||||
|
type: 'curve',
|
||||||
|
width: 2,
|
||||||
|
activeType: 'hollow',
|
||||||
|
linearType: 'custom',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log('✅ 图表绘制完成');
|
||||||
|
}, 300);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.chart-fullscreen-page {
|
||||||
|
position: fixed;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
width: 100vh; // 横屏后的宽度 = 屏幕高度
|
||||||
|
height: 100vw; // 横屏后的高度 = 屏幕宽度
|
||||||
|
transform: translate(-50%, -50%) rotate(90deg);
|
||||||
|
background: #fff;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
z-index: 9999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header {
|
||||||
|
height: 50px;
|
||||||
|
background: #fff;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: 0 15px;
|
||||||
|
border-bottom: 1px solid #eee;
|
||||||
|
flex-shrink: 0;
|
||||||
|
|
||||||
|
.back-btn {
|
||||||
|
width: 40px;
|
||||||
|
height: 40px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
font-size: 28px;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.title {
|
||||||
|
font-size: 28px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.home-btn {
|
||||||
|
width: 40px;
|
||||||
|
height: 40px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
|
.home-icon {
|
||||||
|
font-size: 24px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.time-selector {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
padding: 10px;
|
||||||
|
gap: 12px;
|
||||||
|
background: #fff;
|
||||||
|
flex-shrink: 0;
|
||||||
|
height: 50px;
|
||||||
|
|
||||||
|
.time-item {
|
||||||
|
padding: 8px 24px;
|
||||||
|
background: #f5f5f5;
|
||||||
|
border-radius: 6px;
|
||||||
|
font-size: 24px;
|
||||||
|
color: #666;
|
||||||
|
|
||||||
|
&.active {
|
||||||
|
background: #1890FF;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.chart-container {
|
||||||
|
flex: 1;
|
||||||
|
position: relative;
|
||||||
|
background: #fff;
|
||||||
|
padding: 10px;
|
||||||
|
|
||||||
|
.chart-canvas {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -92,7 +92,8 @@
|
|||||||
<!-- <nut-tag class="tagErr font_28" v-else> 未开启联动控制 </nut-tag> -->
|
<!-- <nut-tag class="tagErr font_28" v-else> 未开启联动控制 </nut-tag> -->
|
||||||
</view>
|
</view>
|
||||||
<view
|
<view
|
||||||
class="font_32 c_1589E9"
|
class="font_28 c_1589E9"
|
||||||
|
:style="{ display: 'flex', alignItems: 'center', justifyContent: 'flex-end', gap: '12px', margin: '0 15px' }"
|
||||||
@click="setParams(item.id, item.deviceName, item.deviceType)"
|
@click="setParams(item.id, item.deviceName, item.deviceType)"
|
||||||
>参数设置</view
|
>参数设置</view
|
||||||
>
|
>
|
||||||
@@ -267,8 +268,11 @@
|
|||||||
7天
|
7天
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="font_32 c_1589E9" :style="{ textAlign: 'right' }">
|
<view :style="{ display: 'flex', alignItems: 'center', justifyContent: 'flex-end', gap: '12px', margin: '0 7px' }">
|
||||||
<view @click="changeShow">{{ setTitle }}</view>
|
<view @click="fullscreenChart" class="zoom-btn">
|
||||||
|
放大
|
||||||
|
</view>
|
||||||
|
<view @click="changeShow" class="hide-btn">{{ setTitle }}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- <nut-col :span="8" class="font_32 f_weight c_222">
|
<!-- <nut-col :span="8" class="font_32 f_weight c_222">
|
||||||
@@ -339,7 +343,6 @@
|
|||||||
String(dayDev)
|
String(dayDev)
|
||||||
"
|
"
|
||||||
@TouchEnd="touchEnd"
|
@TouchEnd="touchEnd"
|
||||||
type="2d"
|
|
||||||
@TouchStart="touchCandle"
|
@TouchStart="touchCandle"
|
||||||
@TouchMove="moveCandle"
|
@TouchMove="moveCandle"
|
||||||
:style="{
|
:style="{
|
||||||
@@ -624,6 +627,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
</nut-dialog>
|
</nut-dialog>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts" name="PondInfo">
|
<script setup lang="ts" name="PondInfo">
|
||||||
import { IconFont, Loading, RectRight, Uploader } from "@nutui/icons-vue-taro";
|
import { IconFont, Loading, RectRight, Uploader } from "@nutui/icons-vue-taro";
|
||||||
@@ -689,10 +693,10 @@ const themeVarsOther = ref({
|
|||||||
});
|
});
|
||||||
// 图表参数
|
// 图表参数
|
||||||
const paramsHistory = ref({
|
const paramsHistory = ref({
|
||||||
id: null,
|
serialNum: "", // 设备序列号
|
||||||
StartTime: "",
|
startTime: "", // 开始时间
|
||||||
EndTime: "",
|
endTime: "", // 结束时间
|
||||||
dataTypeId: 1,
|
intervalType: 1, // 时间间隔类型:1-1天, 2-3天, 3-7天
|
||||||
});
|
});
|
||||||
// 图表数据
|
// 图表数据
|
||||||
const chartsDatas = ref<any>({
|
const chartsDatas = ref<any>({
|
||||||
@@ -873,6 +877,10 @@ function getDeviceList() {
|
|||||||
: res.data.listDetector[0].id
|
: res.data.listDetector[0].id
|
||||||
? res.data.listDetector[0].id
|
? res.data.listDetector[0].id
|
||||||
: undefined;
|
: undefined;
|
||||||
|
// 初始化 serialNum
|
||||||
|
if (res.data.listDetector[0].serialNum) {
|
||||||
|
paramsHistory.value.serialNum = res.data.listDetector[0].serialNum;
|
||||||
|
}
|
||||||
if (doDev.value) {
|
if (doDev.value) {
|
||||||
if (!oxyIds.includes(doDev.value)) {
|
if (!oxyIds.includes(doDev.value)) {
|
||||||
doDev.value = res.data.listDetector[0].id
|
doDev.value = res.data.listDetector[0].id
|
||||||
@@ -908,32 +916,68 @@ function getDeviceList() {
|
|||||||
// 选择日期
|
// 选择日期
|
||||||
function changeDay(e) {
|
function changeDay(e) {
|
||||||
dayDev.value = e;
|
dayDev.value = e;
|
||||||
if (e > 1) {
|
// 直接传递天数,getDaysAgo 会自动设置正确的 intervalType
|
||||||
getDaysAgo(e - 1);
|
|
||||||
} else {
|
|
||||||
getDaysAgo(e);
|
getDaysAgo(e);
|
||||||
}
|
}
|
||||||
}
|
// 显隐控制器
|
||||||
// 显隐控制器
|
// 显隐控制器
|
||||||
function changeShow() {
|
function changeShow() {
|
||||||
if (setTitle.value == "显示") {
|
showChart.value = !showChart.value;
|
||||||
|
if (showChart.value) {
|
||||||
setTitle.value = "隐藏";
|
setTitle.value = "隐藏";
|
||||||
// 显隐图标控制器
|
|
||||||
showChart.value = true;
|
|
||||||
// 绘制图表
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
getDaysAgo(dayDev.value);
|
getDaysAgo(dayDev.value);
|
||||||
}, 200);
|
}, 200);
|
||||||
} else {
|
} else {
|
||||||
setTitle.value = "显示";
|
setTitle.value = "显示";
|
||||||
showChart.value = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 全屏显示图表 - 跳转到单独页面
|
||||||
|
function fullscreenChart() {
|
||||||
|
console.log('🔍 设备数据结构:', pondDeviceRes.value);
|
||||||
|
console.log('🔍 当前设备ID:', doDev.value);
|
||||||
|
|
||||||
|
// 获取当前设备的 serialNum(注意:数据结构直接在 pondDeviceRes.value 下,没有 data 字段)
|
||||||
|
const currentDevice = pondDeviceRes.value?.listDetector?.find(
|
||||||
|
(item: any) => item.id === doDev.value
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log('🔍 找到的设备:', currentDevice);
|
||||||
|
|
||||||
|
if (!currentDevice) {
|
||||||
|
Taro.showToast({
|
||||||
|
title: '设备信息不存在',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 尝试多种字段名
|
||||||
|
const serialNum = currentDevice.serialNum || currentDevice.serialNumber || currentDevice.deviceSerialNum || currentDevice.sn;
|
||||||
|
|
||||||
|
if (!serialNum) {
|
||||||
|
console.error('❗ 设备没有序列号字段,设备信息:', currentDevice);
|
||||||
|
Taro.showToast({
|
||||||
|
title: '设备序列号不存在',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('✅ 跳转参数:', { serialNum, dataType: prDev.value, dayType: dayDev.value });
|
||||||
|
|
||||||
|
// 跳转到全屏图表页面
|
||||||
|
Taro.navigateTo({
|
||||||
|
url: `/components/other/chartFullscreen?serialNum=${serialNum}&dataType=${prDev.value}&dayType=${dayDev.value}`
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// 切换检测指标
|
// 切换检测指标
|
||||||
function selectCharts(e) {
|
function selectCharts(e) {
|
||||||
prDev.value = e;
|
prDev.value = e;
|
||||||
const id = props.modelValue;
|
const id = props.modelValue;
|
||||||
paramsHistory.value.dataTypeId = e;
|
// 不再需要 dataTypeId,一次查询返回所有数据
|
||||||
if (!id) {
|
if (!id) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1049,397 +1093,180 @@ function changeDev(item: any) {
|
|||||||
oxyWarnLower.value = item.oxyWarnLower;
|
oxyWarnLower.value = item.oxyWarnLower;
|
||||||
tempWarnUpper.value = item.tempWarnUpper;
|
tempWarnUpper.value = item.tempWarnUpper;
|
||||||
tempWarnLower.value = item.tempWarnLower;
|
tempWarnLower.value = item.tempWarnLower;
|
||||||
paramsHistory.value.id = item.id;
|
paramsHistory.value.serialNum = item.serialNum; // 使用设备序列号
|
||||||
dayDev.value = 1;
|
dayDev.value = 1;
|
||||||
getDaysAgo(1);
|
getDaysAgo(1);
|
||||||
}
|
}
|
||||||
// 设备历史数据图表
|
// 设备历史数据图表
|
||||||
function getDeviceHistory() {
|
function getDeviceHistory() {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
paramsHistory.value.id = doDev.value;
|
console.log('📊 开始获取历史数据,参数:', paramsHistory.value);
|
||||||
if (!doDev.value) {
|
|
||||||
|
if (!paramsHistory.value.serialNum) {
|
||||||
|
console.error('❌ serialNum 为空,无法查询');
|
||||||
|
loading.value = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
deviceHistory(paramsHistory.value)
|
deviceHistory(paramsHistory.value)
|
||||||
.then((res: any) => {
|
.then((res: any) => {
|
||||||
if (res.statusCode == 200) {
|
console.log('📥 历史数据接口返回:', res);
|
||||||
// if (res.data && res.data.length > 0) {
|
|
||||||
const result = groupByDate(processData(res.data));
|
// 后端直接返回数组,而不是 {code: 200, data: []}
|
||||||
const r: any = [];
|
if (Array.isArray(res)) {
|
||||||
Object.keys(result).forEach((res) => {
|
console.log('✅ 数据获取成功(数组格式),数据量:', res.length);
|
||||||
const arr = {};
|
console.log('📋 数据内容:', res);
|
||||||
arr["time"] = getRelativeDay(res);
|
chartsDatas.value = res;
|
||||||
arr["day"] = res.split("-")[1] + "-" + res.split("-")[2];
|
console.log('💾 chartsDatas 已赋值:', chartsDatas.value);
|
||||||
arr["info"] = result[res];
|
|
||||||
r.push(arr);
|
|
||||||
});
|
|
||||||
chartsDatas.value = {
|
|
||||||
r,
|
|
||||||
};
|
|
||||||
drawCharts(1);
|
drawCharts(1);
|
||||||
// }
|
} else if (res.code == 200) {
|
||||||
|
// 兼容标准响应格式
|
||||||
|
console.log('✅ 数据获取成功(标准格式),数据量:', res.data?.length);
|
||||||
|
console.log('📋 数据内容:', res.data);
|
||||||
|
chartsDatas.value = res.data || [];
|
||||||
|
console.log('💾 chartsDatas 已赋值:', chartsDatas.value);
|
||||||
|
drawCharts(1);
|
||||||
|
} else {
|
||||||
|
console.error('❌ 接口返回失败:', res);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.error('❌ 接口请求异常:', err);
|
||||||
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// 监测图表
|
// 监测图表 - 重构版本
|
||||||
function drawCharts(type) {
|
function drawCharts(type) {
|
||||||
|
console.log('🎨 开始绘制图表, type:', type);
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
Taro.nextTick(() => {
|
Taro.nextTick(() => {
|
||||||
const data = chartsDatas.value;
|
const data = chartsDatas.value; // 后端直接返回的数据数组
|
||||||
const dayType = dayDev.value;
|
const paramsType = prDev.value; // 当前选中的指标类型
|
||||||
const paramsType = prDev.value;
|
|
||||||
|
console.log('📊 chartsDatas.value:', data);
|
||||||
|
console.log('🎯 当前指标类型:', paramsType);
|
||||||
|
console.log('📅 天数:', dayDev.value);
|
||||||
|
|
||||||
|
if (!data || data.length === 0) {
|
||||||
|
console.error('❌ 数据为空,无法绘制图表');
|
||||||
|
loading.value = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let series: any = [];
|
let series: any = [];
|
||||||
let x: any = timeX();
|
let x_time_list: any = []; // x轴时间列表
|
||||||
x7.value = generateTimeSlotsEndingToday();
|
let seriesData: any = []; // y轴数据
|
||||||
let x_time_list: any = [];
|
let warnLines: any = []; // 告警线
|
||||||
let markLineData: any = 0;
|
|
||||||
let oxyMl: any = [];
|
// 根据 paramsType 选择对应的数据字段
|
||||||
let suMl: any = [];
|
let fieldName = '';
|
||||||
let sdMl: any = [];
|
let seriesName = '';
|
||||||
|
|
||||||
if (paramsType == 1) {
|
if (paramsType == 1) {
|
||||||
|
fieldName = 'dissolvedOxygen';
|
||||||
|
seriesName = '溶解氧';
|
||||||
|
// 添加告警下限
|
||||||
if (oxyWarnLower.value) {
|
if (oxyWarnLower.value) {
|
||||||
markLineData = [
|
warnLines = data.map(() => oxyWarnLower.value);
|
||||||
{
|
series.push({
|
||||||
value: oxyWarnLower.value,
|
name: '告警下限',
|
||||||
showLabel: true,
|
data: warnLines,
|
||||||
labelOffsetX: 0,
|
color: '#c12e34',
|
||||||
labelOffsetY: 0,
|
lineType: 'dash',
|
||||||
labelAlign: "right",
|
});
|
||||||
labelText: "告警下限",
|
|
||||||
labelFontColor: "#666666",
|
|
||||||
labelBgColor: "#DFE8FF",
|
|
||||||
labelBgOpacity: 0.8,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
} else if (paramsType == 2) {
|
} else if (paramsType == 2) {
|
||||||
if (tempWarnUpper.value && tempWarnLower.value) {
|
fieldName = 'temperature';
|
||||||
markLineData = [
|
seriesName = '水温';
|
||||||
{
|
// 添加告警上下限
|
||||||
value: tempWarnUpper.value,
|
if (tempWarnLower.value) {
|
||||||
showLabel: true,
|
warnLines = data.map(() => tempWarnLower.value);
|
||||||
labelOffsetX: 0,
|
series.push({
|
||||||
labelOffsetY: 0,
|
name: '告警下限',
|
||||||
labelAlign: "right",
|
data: warnLines,
|
||||||
labelText: "告警上限",
|
color: '#c12e34',
|
||||||
labelFontColor: "#666666",
|
lineType: 'dash',
|
||||||
labelBgColor: "#DFE8FF",
|
|
||||||
labelBgOpacity: 0.8,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: tempWarnLower.value,
|
|
||||||
showLabel: true,
|
|
||||||
labelOffsetX: 0,
|
|
||||||
labelOffsetY: 0,
|
|
||||||
labelAlign: "right",
|
|
||||||
labelText: "告警下限",
|
|
||||||
lineColor: "#DE4A42",
|
|
||||||
labelFontColor: "#666666",
|
|
||||||
labelBgColor: "#DFE8FF",
|
|
||||||
labelBgOpacity: 0.8,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 时间筛选
|
|
||||||
if (dayType == 1) {
|
|
||||||
let name = "";
|
|
||||||
let arr = [];
|
|
||||||
let j = undefined;
|
|
||||||
let z = undefined;
|
|
||||||
let rows: any = [[], []];
|
|
||||||
|
|
||||||
x.forEach((time: string) => {
|
|
||||||
x_time_list.push(time.x_time);
|
|
||||||
let found_a = false;
|
|
||||||
let found_b = false;
|
|
||||||
data.r.forEach((res: any, index) => {
|
|
||||||
if (res.time == "今日") {
|
|
||||||
j = index;
|
|
||||||
}
|
|
||||||
if (res.time == "昨日") {
|
|
||||||
z = index;
|
|
||||||
}
|
|
||||||
for (const item of res.info) {
|
|
||||||
let value = Number(toDecimal(item.value, 2));
|
|
||||||
|
|
||||||
if (item.createdTime == time.time && res.time == "今日") {
|
|
||||||
if (j || j == 0) {
|
|
||||||
rows[j].push(value);
|
|
||||||
|
|
||||||
found_a = true;
|
|
||||||
}
|
|
||||||
} else if (item.createdTime == time.time && res.time == "昨日") {
|
|
||||||
if (z || z == 0) {
|
|
||||||
rows[z].push(value);
|
|
||||||
found_b = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
if (!found_a && (j || j == 0)) {
|
|
||||||
rows[j].push(null);
|
|
||||||
}
|
|
||||||
if (!found_b && (z || z == 0)) {
|
|
||||||
rows[z].push(null);
|
|
||||||
}
|
|
||||||
if (oxyWarnLower.value) {
|
|
||||||
oxyMl.push(oxyWarnLower.value);
|
|
||||||
}
|
}
|
||||||
if (tempWarnUpper.value) {
|
if (tempWarnUpper.value) {
|
||||||
suMl.push(tempWarnUpper.value);
|
const upperLines = data.map(() => tempWarnUpper.value);
|
||||||
}
|
series.push({
|
||||||
if (tempWarnLower.value) {
|
name: '告警上限',
|
||||||
sdMl.push(tempWarnLower.value);
|
data: upperLines,
|
||||||
}
|
color: '#e098c7',
|
||||||
|
lineType: 'dash',
|
||||||
});
|
});
|
||||||
if (paramsType == 1) {
|
}
|
||||||
name = "溶解氧";
|
|
||||||
arr = rows;
|
|
||||||
} else if (paramsType == 2) {
|
|
||||||
name = "水温";
|
|
||||||
arr = rows;
|
|
||||||
} else if (paramsType == 3) {
|
} else if (paramsType == 3) {
|
||||||
name = "饱和度";
|
fieldName = 'saturability';
|
||||||
arr = rows;
|
seriesName = '饱和度';
|
||||||
} else if (paramsType == 4) {
|
} else if (paramsType == 4) {
|
||||||
name = "PH";
|
fieldName = 'ph';
|
||||||
arr = rows;
|
seriesName = 'PH';
|
||||||
} else if (paramsType == 5) {
|
} else if (paramsType == 5) {
|
||||||
name = "盐度";
|
fieldName = 'salinity';
|
||||||
arr = rows;
|
seriesName = '盐度';
|
||||||
}
|
}
|
||||||
|
|
||||||
series = [
|
// 提取时间和数据
|
||||||
{
|
data.forEach((item: any, index: number) => {
|
||||||
name: "今日" + name,
|
console.log(`📋 处理第 ${index + 1} 条数据:`, item);
|
||||||
data: j || j == 0 ? arr[j] : [],
|
|
||||||
},
|
// 格式化时间:2026-01-12 09:38:32.0 -> 01-12 09:38
|
||||||
{
|
const timeStr = item.time || item.createTime || '';
|
||||||
name: "昨日" + name,
|
console.log(`⏰ 时间字符串:`, timeStr);
|
||||||
lineType: "dash",
|
|
||||||
data: z || z == 0 ? arr[z] : [],
|
const timeParts = timeStr.split(' ');
|
||||||
},
|
if (timeParts.length > 1) {
|
||||||
];
|
const datePart = timeParts[0]; // YYYY-MM-DD
|
||||||
if (paramsType == 1) {
|
const timePart = timeParts[1]; // HH:mm:ss.0
|
||||||
series.push({
|
|
||||||
name: "告警下限",
|
// 提取 MM-DD HH:mm
|
||||||
data: oxyMl,
|
const dateMatch = datePart.match(/\d{4}-(\d{2})-(\d{2})/);
|
||||||
color: "#c12e34",
|
const monthDay = dateMatch ? `${dateMatch[1]}-${dateMatch[2]}` : '';
|
||||||
lineType: "dash",
|
const hourMin = timePart.substring(0, 5); // HH:mm
|
||||||
});
|
|
||||||
} else if (paramsType == 2) {
|
const formattedTime = `${monthDay} ${hourMin}`;
|
||||||
series.push({
|
x_time_list.push(formattedTime);
|
||||||
name: "告警下限",
|
console.log(`✅ 时间格式化成功: ${formattedTime}`);
|
||||||
data: sdMl,
|
|
||||||
color: "#c12e34",
|
|
||||||
lineType: "dash",
|
|
||||||
});
|
|
||||||
series.push({
|
|
||||||
name: "告警上限",
|
|
||||||
data: suMl,
|
|
||||||
color: "#e098c7",
|
|
||||||
lineType: "dash",
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} else if (dayType == 3) {
|
|
||||||
let name = "";
|
|
||||||
let arr = [];
|
|
||||||
let j = undefined;
|
|
||||||
let z = undefined;
|
|
||||||
let q = undefined;
|
|
||||||
let rows: any = [[], [], []];
|
|
||||||
x.forEach((time: any) => {
|
|
||||||
let found_a = false;
|
|
||||||
let found_b = false;
|
|
||||||
let found_c = false;
|
|
||||||
x_time_list.push(time.x_time);
|
|
||||||
if (oxyWarnLower.value) {
|
|
||||||
oxyMl.push(oxyWarnLower.value);
|
|
||||||
}
|
|
||||||
if (tempWarnUpper.value) {
|
|
||||||
suMl.push(tempWarnUpper.value);
|
|
||||||
}
|
|
||||||
if (tempWarnLower.value) {
|
|
||||||
sdMl.push(tempWarnLower.value);
|
|
||||||
}
|
|
||||||
data.r.forEach((res: any, index) => {
|
|
||||||
if (res.time == "今日") {
|
|
||||||
j = index;
|
|
||||||
}
|
|
||||||
if (res.time == "昨日") {
|
|
||||||
z = index;
|
|
||||||
}
|
|
||||||
if (res.time == "前日") {
|
|
||||||
q = index;
|
|
||||||
}
|
|
||||||
for (const item of res.info) {
|
|
||||||
let value = Number(toDecimal(item.value, 2));
|
|
||||||
if (item.createdTime == time.time && res.time == "今日") {
|
|
||||||
if (j || j == 0) {
|
|
||||||
rows[j].push(value);
|
|
||||||
found_a = true;
|
|
||||||
}
|
|
||||||
} else if (item.createdTime == time.time && res.time == "昨日") {
|
|
||||||
if (z || z == 0) {
|
|
||||||
rows[z].push(value);
|
|
||||||
found_b = true;
|
|
||||||
}
|
|
||||||
} else if (item.createdTime == time.time && res.time == "前日") {
|
|
||||||
if (q || q == 0) {
|
|
||||||
rows[q].push(value);
|
|
||||||
found_c = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (!found_a && (j || j == 0)) {
|
|
||||||
rows[j].push(null);
|
|
||||||
}
|
|
||||||
if (!found_b && (z || z == 0)) {
|
|
||||||
rows[z].push(null);
|
|
||||||
}
|
|
||||||
if (!found_c && (q || q == 0)) {
|
|
||||||
rows[q].push(null);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (paramsType == 1) {
|
|
||||||
name = "溶解氧";
|
|
||||||
arr = rows;
|
|
||||||
} else if (paramsType == 2) {
|
|
||||||
name = "水温";
|
|
||||||
arr = rows;
|
|
||||||
} else if (paramsType == 3) {
|
|
||||||
name = "饱和度";
|
|
||||||
arr = rows;
|
|
||||||
} else if (paramsType == 4) {
|
|
||||||
name = "PH";
|
|
||||||
arr = rows;
|
|
||||||
} else if (paramsType == 5) {
|
|
||||||
name = "盐度";
|
|
||||||
arr = rows;
|
|
||||||
}
|
|
||||||
series = [
|
|
||||||
{
|
|
||||||
name: "今日",
|
|
||||||
data: j || j == 0 ? arr[j] : [],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "昨日",
|
|
||||||
lineType: "dash",
|
|
||||||
data: z || z == 0 ? arr[z] : [],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "前日",
|
|
||||||
lineType: "dash",
|
|
||||||
data: q || q == 0 ? arr[q] : [],
|
|
||||||
},
|
|
||||||
];
|
|
||||||
if (paramsType == 1) {
|
|
||||||
series.push({
|
|
||||||
name: "告警下限",
|
|
||||||
data: oxyMl,
|
|
||||||
color: "#c12e34",
|
|
||||||
lineType: "dash",
|
|
||||||
});
|
|
||||||
} else if (paramsType == 2) {
|
|
||||||
series.push({
|
|
||||||
name: "告警下限",
|
|
||||||
data: sdMl,
|
|
||||||
color: "#c12e34",
|
|
||||||
lineType: "dash",
|
|
||||||
});
|
|
||||||
series.push({
|
|
||||||
name: "告警上限",
|
|
||||||
data: suMl,
|
|
||||||
color: "#e098c7",
|
|
||||||
lineType: "dash",
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
let name = "";
|
console.warn(`⚠️ 时间格式错误,跳过: ${timeStr}`);
|
||||||
let arr = [];
|
x_time_list.push('--:--'); // 占位符
|
||||||
let rows: any = [];
|
|
||||||
x7.value.forEach((time: any) => {
|
|
||||||
x_time_list.push(time.time2);
|
|
||||||
let found_a = false;
|
|
||||||
if (oxyWarnLower.value) {
|
|
||||||
oxyMl.push(oxyWarnLower.value);
|
|
||||||
}
|
|
||||||
if (tempWarnUpper.value) {
|
|
||||||
suMl.push(tempWarnUpper.value);
|
|
||||||
}
|
|
||||||
if (tempWarnLower.value) {
|
|
||||||
sdMl.push(tempWarnLower.value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
data.r.forEach((res: any) => {
|
// 提取对应字段的数据
|
||||||
for (const item of res.info) {
|
const value = item[fieldName];
|
||||||
let value = Number(toDecimal(item.value, 2));
|
console.log(`📊 ${fieldName} 字段值:`, value);
|
||||||
if (item.createdTime == time.time && res.day == time.time2) {
|
|
||||||
rows.push(value);
|
if (value !== null && value !== undefined) {
|
||||||
found_a = true;
|
const numValue = Number(value.toFixed(2));
|
||||||
}
|
seriesData.push(numValue);
|
||||||
|
console.log(`✅ 数据添加成功: ${numValue}`);
|
||||||
|
} else {
|
||||||
|
seriesData.push(null);
|
||||||
|
console.warn(`⚠️ ${fieldName} 字段为空`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (!found_a) {
|
|
||||||
rows.push(null);
|
console.log('⏰ x轴时间列表:', x_time_list);
|
||||||
}
|
console.log('📊 y轴数据列表:', seriesData);
|
||||||
|
console.log('📝 数据字段名:', fieldName);
|
||||||
|
console.log('🏷️ 系列名称:', seriesName);
|
||||||
|
|
||||||
|
// 添加主数据系列
|
||||||
|
series.unshift({
|
||||||
|
name: seriesName,
|
||||||
|
data: seriesData,
|
||||||
});
|
});
|
||||||
if (paramsType == 1) {
|
|
||||||
name = "溶解氧";
|
|
||||||
arr = rows;
|
|
||||||
} else if (paramsType == 2) {
|
|
||||||
name = "水温";
|
|
||||||
arr = rows;
|
|
||||||
} else if (paramsType == 3) {
|
|
||||||
name = "饱和度";
|
|
||||||
arr = rows;
|
|
||||||
} else if (paramsType == 4) {
|
|
||||||
name = "PH";
|
|
||||||
arr = rows;
|
|
||||||
} else if (paramsType == 5) {
|
|
||||||
name = "盐度";
|
|
||||||
arr = rows;
|
|
||||||
}
|
|
||||||
series = [
|
|
||||||
{
|
|
||||||
name: name,
|
|
||||||
data: arr,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
if (paramsType == 1) {
|
|
||||||
series.push({
|
|
||||||
name: "告警下限",
|
|
||||||
data: oxyMl,
|
|
||||||
color: "#c12e34",
|
|
||||||
lineType: "dash",
|
|
||||||
});
|
|
||||||
} else if (paramsType == 2) {
|
|
||||||
series.push({
|
|
||||||
name: "告警下限",
|
|
||||||
data: sdMl,
|
|
||||||
color: "#c12e34",
|
|
||||||
lineType: "dash",
|
|
||||||
});
|
|
||||||
series.push({
|
|
||||||
name: "告警上限",
|
|
||||||
data: suMl,
|
|
||||||
color: "#e098c7",
|
|
||||||
lineType: "dash",
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
const ids =
|
const ids = "GdHQcFQYzLhfeEvZbEJnhDxJzBlbCxhE" + String(doDev.value) + String(prDev.value) + String(dayDev.value);
|
||||||
"GdHQcFQYzLhfeEvZbEJnhDxJzBlbCxhE" +
|
console.log('🎯 Canvas ID:', ids);
|
||||||
String(doDev.value) +
|
console.log('📦 准备创建图表, series:', series);
|
||||||
String(prDev.value) +
|
|
||||||
String(dayDev.value);
|
|
||||||
const query = Taro.createSelectorQuery();
|
const query = Taro.createSelectorQuery();
|
||||||
query.select("#" + ids).boundingClientRect();
|
query.select("#" + ids).boundingClientRect();
|
||||||
query.selectViewport().scrollOffset();
|
query.selectViewport().scrollOffset();
|
||||||
@@ -1448,10 +1275,13 @@ function drawCharts(type) {
|
|||||||
chartConf.top = res[0] ? res[0].top : 0;
|
chartConf.top = res[0] ? res[0].top : 0;
|
||||||
chartConf.left = res[0] ? res[0].left : 0;
|
chartConf.left = res[0] ? res[0].left : 0;
|
||||||
}
|
}
|
||||||
|
console.log('📏 Canvas 位置:', { top: chartConf.top, left: chartConf.left });
|
||||||
});
|
});
|
||||||
if (type == 1) {
|
if (type == 1) {
|
||||||
|
console.log('✅ 调用 createCharts');
|
||||||
createCharts(x_time_list, series, ids);
|
createCharts(x_time_list, series, ids);
|
||||||
} else {
|
} else {
|
||||||
|
console.log('✅ 调用 updateCharts');
|
||||||
updateCharts(x_time_list, series, ids);
|
updateCharts(x_time_list, series, ids);
|
||||||
}
|
}
|
||||||
}, 200);
|
}, 200);
|
||||||
@@ -1503,43 +1333,69 @@ function moveCandle(e) {
|
|||||||
e.changedTouches.unshift(tmpe);
|
e.changedTouches.unshift(tmpe);
|
||||||
uChartsOp.value[e.target.id].scroll(e);
|
uChartsOp.value[e.target.id].scroll(e);
|
||||||
}
|
}
|
||||||
// 创建图表
|
// 创建图表 - 兼容模式(支持微信小程序和H5)
|
||||||
function createCharts(x, series, ids) {
|
function createCharts(x, series, ids) {
|
||||||
|
console.log('🎨 createCharts 被调用,使用旧版 Canvas 模式');
|
||||||
|
console.log(' - x轴数据:', x);
|
||||||
|
console.log(' - series数据:', series);
|
||||||
|
console.log(' - Canvas ID:', ids);
|
||||||
|
console.log(' - 当前环境:', Taro.getEnv());
|
||||||
|
|
||||||
Taro.nextTick(() => {
|
Taro.nextTick(() => {
|
||||||
let cWidth = chartConf.cWidth;
|
let cWidth = chartConf.cWidth;
|
||||||
let cHeight = chartConf.cHeight;
|
let cHeight = chartConf.cHeight;
|
||||||
let pixelRatio = chartConf.pixelRatio;
|
let pixelRatio = chartConf.pixelRatio;
|
||||||
const query = Taro.createSelectorQuery();
|
|
||||||
query
|
// 判断环境
|
||||||
.select("#" + ids)
|
const env = Taro.getEnv();
|
||||||
.fields({ node: true, size: true })
|
console.log('📱 运行环境:', env);
|
||||||
.exec((res) => {
|
|
||||||
if (res.length > 0 && res[0]) {
|
if (env === 'WEB' || env === 'h5') {
|
||||||
const canvas = res[0].node;
|
// H5 环境需要特殊处理
|
||||||
const ctx = canvas.getContext("2d");
|
console.log('🌐 H5 环境,使用 DOM 方式获取 Canvas');
|
||||||
canvas.width = res[0].width * pixelRatio;
|
|
||||||
canvas.height = res[0].height * pixelRatio;
|
setTimeout(() => {
|
||||||
|
// H5 下需要找到真实的 canvas 元素,不是 Taro 的封装组件
|
||||||
|
const canvasElement = document.querySelector(`#${ids} canvas`);
|
||||||
|
|
||||||
|
if (!canvasElement) {
|
||||||
|
console.error('❌ 未找到 Canvas 元素:', ids);
|
||||||
|
console.log('尝试直接查找 canvas 标签...');
|
||||||
|
const allCanvas = document.querySelectorAll('canvas');
|
||||||
|
console.log('页面中所有 canvas:', allCanvas);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('✅ 找到 Canvas 元素:', canvasElement);
|
||||||
|
const ctx = canvasElement.getContext('2d');
|
||||||
|
|
||||||
|
if (!ctx) {
|
||||||
|
console.error('❌ 无法获取 Canvas Context');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('✅ 获取 Context 成功');
|
||||||
|
|
||||||
uChartsOp.value[ids] = new uCharts({
|
uChartsOp.value[ids] = new uCharts({
|
||||||
type: "line",
|
type: "line",
|
||||||
context: ctx,
|
context: ctx,
|
||||||
canvas2d: true,
|
width: cWidth,
|
||||||
width: cWidth * pixelRatio,
|
height: cHeight,
|
||||||
height: cHeight * pixelRatio,
|
|
||||||
categories: x,
|
categories: x,
|
||||||
series: series,
|
series: series,
|
||||||
pixelRatio: pixelRatio,
|
pixelRatio: 1,
|
||||||
dataPointShape: false,
|
dataPointShape: false,
|
||||||
animation: true,
|
animation: true,
|
||||||
background: "#FFFFFF",
|
background: "#FFFFFF",
|
||||||
color: ["#17B4B2", "#5470c6", "#fac858"],
|
color: ["#17B4B2", "#5470c6", "#fac858"],
|
||||||
padding: [10, 60, 0, 20],
|
padding: [15, 30, 35, 45],
|
||||||
enableScroll: false,
|
enableScroll: false,
|
||||||
boundaryGap: "justify",
|
boundaryGap: "justify",
|
||||||
update: true,
|
update: true,
|
||||||
legend: {
|
legend: {
|
||||||
fontColor: "#222222",
|
fontColor: "#222222",
|
||||||
itemGap: 10,
|
itemGap: 10,
|
||||||
float: prDev.value == 2 || prDev.value == 1 ? "left" : "center",
|
position: "top",
|
||||||
},
|
},
|
||||||
dataLabel: false,
|
dataLabel: false,
|
||||||
xAxis: {
|
xAxis: {
|
||||||
@@ -1550,8 +1406,9 @@ function createCharts(x, series, ids) {
|
|||||||
itemCount: 0,
|
itemCount: 0,
|
||||||
scrollShow: false,
|
scrollShow: false,
|
||||||
scrollAlign: "left",
|
scrollAlign: "left",
|
||||||
// labelCount: dayDev.value == 7 ? 7 : 6,
|
|
||||||
labelCount: 7,
|
labelCount: 7,
|
||||||
|
rotateLabel: true,
|
||||||
|
rotateAngle: 25,
|
||||||
},
|
},
|
||||||
yAxis: {
|
yAxis: {
|
||||||
disableGrid: false,
|
disableGrid: false,
|
||||||
@@ -1590,8 +1447,88 @@ function createCharts(x, series, ids) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
console.log('✅ H5 图表创建完成');
|
||||||
|
}, 300);
|
||||||
|
} else {
|
||||||
|
// 小程序环境
|
||||||
|
console.log('📱 小程序环境,使用 canvasId 方式');
|
||||||
|
|
||||||
|
uChartsOp.value[ids] = new uCharts({
|
||||||
|
type: "line",
|
||||||
|
canvasId: ids,
|
||||||
|
canvas2d: false,
|
||||||
|
width: cWidth * pixelRatio,
|
||||||
|
height: cHeight * pixelRatio,
|
||||||
|
categories: x,
|
||||||
|
series: series,
|
||||||
|
pixelRatio: pixelRatio,
|
||||||
|
dataPointShape: false,
|
||||||
|
animation: true,
|
||||||
|
background: "#FFFFFF",
|
||||||
|
color: ["#17B4B2", "#5470c6", "#fac858"],
|
||||||
|
padding: [15, 30, 35, 45],
|
||||||
|
enableScroll: false,
|
||||||
|
boundaryGap: "justify",
|
||||||
|
update: true,
|
||||||
|
legend: {
|
||||||
|
fontColor: "#222222",
|
||||||
|
itemGap: 10,
|
||||||
|
position: "top",
|
||||||
|
},
|
||||||
|
dataLabel: false,
|
||||||
|
xAxis: {
|
||||||
|
disableGrid: true,
|
||||||
|
axisLine: true,
|
||||||
|
type: "grid",
|
||||||
|
gridType: "dash",
|
||||||
|
itemCount: 0,
|
||||||
|
scrollShow: false,
|
||||||
|
scrollAlign: "left",
|
||||||
|
labelCount: 7,
|
||||||
|
rotateLabel: true,
|
||||||
|
rotateAngle: 25,
|
||||||
|
},
|
||||||
|
yAxis: {
|
||||||
|
disableGrid: false,
|
||||||
|
gridType: "dash",
|
||||||
|
tofix: 2,
|
||||||
|
},
|
||||||
|
extra: {
|
||||||
|
tooltip: {
|
||||||
|
showBox: true,
|
||||||
|
showArrow: true,
|
||||||
|
showCategory: true,
|
||||||
|
borderWidth: 0,
|
||||||
|
borderRadius: 0,
|
||||||
|
borderColor: "#000000",
|
||||||
|
borderOpacity: 0.7,
|
||||||
|
bgColor: "#000000",
|
||||||
|
bgOpacity: 0.7,
|
||||||
|
gridType: "solid",
|
||||||
|
dashLength: 4,
|
||||||
|
gridColor: "#CCCCCC",
|
||||||
|
boxPadding: 3,
|
||||||
|
fontSize: 13,
|
||||||
|
lineHeight: 20,
|
||||||
|
fontColor: "#FFFFFF",
|
||||||
|
legendShow: true,
|
||||||
|
legendShape: "auto",
|
||||||
|
splitLine: true,
|
||||||
|
labelBgColor: "#FFFFFF",
|
||||||
|
labelBgOpacity: 0.7,
|
||||||
|
labelFontColor: "#666666",
|
||||||
|
},
|
||||||
|
line: {
|
||||||
|
type: "curve",
|
||||||
|
width: 1,
|
||||||
|
activeType: "hollow",
|
||||||
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
console.log('✅ 小程序图表创建完成');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// 更新图表数据
|
// 更新图表数据
|
||||||
@@ -1624,10 +1561,39 @@ function updateCharts(x, series, ids) {
|
|||||||
}
|
}
|
||||||
// 切换日期
|
// 切换日期
|
||||||
function getDaysAgo(days) {
|
function getDaysAgo(days) {
|
||||||
const day = getStartDate(days);
|
const now = new Date();
|
||||||
paramsHistory.value.StartTime = day + " 00:00:00";
|
// days = 1 表示 1 天,从昨天到今天,所以往前推 1 天
|
||||||
|
// days = 3 表示 3 天,从 3 天前到今天,所以往前推 3 天
|
||||||
|
const start = new Date(now.getTime() - days * 24 * 60 * 60 * 1000);
|
||||||
|
|
||||||
|
// 格式化为 YYYY-MM-DD HH:mm:ss
|
||||||
|
paramsHistory.value.startTime = formatDateTime(start);
|
||||||
|
paramsHistory.value.endTime = formatDateTime(now);
|
||||||
|
|
||||||
|
console.log(`📅 选择 ${days} 天,时间范围: ${paramsHistory.value.startTime} ~ ${paramsHistory.value.endTime}`);
|
||||||
|
|
||||||
|
// 设置 intervalType:1天->1, 3天->2, 7天->3
|
||||||
|
if (days === 1) {
|
||||||
|
paramsHistory.value.intervalType = 1;
|
||||||
|
} else if (days === 3) {
|
||||||
|
paramsHistory.value.intervalType = 2;
|
||||||
|
} else if (days === 7) {
|
||||||
|
paramsHistory.value.intervalType = 3;
|
||||||
|
}
|
||||||
|
|
||||||
getDeviceHistory();
|
getDeviceHistory();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 格式化时间为 YYYY-MM-DD HH:mm:ss
|
||||||
|
function formatDateTime(date: Date): string {
|
||||||
|
const year = date.getFullYear();
|
||||||
|
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||||
|
const day = String(date.getDate()).padStart(2, '0');
|
||||||
|
const hours = String(date.getHours()).padStart(2, '0');
|
||||||
|
const minutes = String(date.getMinutes()).padStart(2, '0');
|
||||||
|
const seconds = String(date.getSeconds()).padStart(2, '0');
|
||||||
|
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
||||||
|
}
|
||||||
function getStartDate(days) {
|
function getStartDate(days) {
|
||||||
// 获取当前日期时间
|
// 获取当前日期时间
|
||||||
const currentDate = new Date();
|
const currentDate = new Date();
|
||||||
@@ -1650,15 +1616,13 @@ function getStartDate(days) {
|
|||||||
// 加载时间参数
|
// 加载时间参数
|
||||||
function getNowDate() {
|
function getNowDate() {
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
let year = now.getFullYear(); //得到年份
|
const yesterday = new Date(now.getTime() - 24 * 60 * 60 * 1000); // 昨天
|
||||||
let month = now.getMonth(); //得到月份
|
|
||||||
let date = now.getDate(); //得到日期
|
paramsHistory.value.startTime = formatDateTime(yesterday);
|
||||||
month = month + 1;
|
paramsHistory.value.endTime = formatDateTime(now);
|
||||||
month = month.toString().padStart(2, "0");
|
paramsHistory.value.intervalType = 1; // 默认 1 天
|
||||||
date = date.toString().padStart(2, "0");
|
|
||||||
let day = `${year}-${month}-${date}`;
|
console.log(`🕒 初始化时间: ${paramsHistory.value.startTime} ~ ${paramsHistory.value.endTime}`);
|
||||||
paramsHistory.value.StartTime = day + " 00:00:00";
|
|
||||||
paramsHistory.value.EndTime = day + " 23:59:59";
|
|
||||||
}
|
}
|
||||||
function groupByDate(data) {
|
function groupByDate(data) {
|
||||||
const result = {};
|
const result = {};
|
||||||
@@ -2016,6 +1980,19 @@ defineExpose({
|
|||||||
background: #09b8c2;
|
background: #09b8c2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.zoom-btn {
|
||||||
|
font-size: 28px;
|
||||||
|
white-space: nowrap;
|
||||||
|
cursor: pointer;
|
||||||
|
color: #1589E9;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hide-btn {
|
||||||
|
font-size: 28px;
|
||||||
|
white-space: nowrap;
|
||||||
|
color: #1589E9;
|
||||||
|
}
|
||||||
|
|
||||||
.gridRight {
|
.gridRight {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
color: #1589e9;
|
color: #1589e9;
|
||||||
|
|||||||
@@ -285,7 +285,7 @@ function getBhd(){
|
|||||||
};
|
};
|
||||||
getSaturability(data)
|
getSaturability(data)
|
||||||
.then((res: any) => {
|
.then((res: any) => {
|
||||||
if (res.statusCode == 200) {
|
if (res.code == 200) {
|
||||||
const bhd = Number(res.data);
|
const bhd = Number(res.data);
|
||||||
saturability.value = bhd
|
saturability.value = bhd
|
||||||
}
|
}
|
||||||
|
|||||||
234
src/home/ctr.vue
234
src/home/ctr.vue
@@ -333,70 +333,58 @@
|
|||||||
>
|
>
|
||||||
<!-- 绘制表格 -->
|
<!-- 绘制表格 -->
|
||||||
<view class="m_t_15">
|
<view class="m_t_15">
|
||||||
|
<view class="linked-table">
|
||||||
|
<!-- 表头 -->
|
||||||
|
<view class="table-row table-header">
|
||||||
|
<view class="table-cell"></view>
|
||||||
<view
|
<view
|
||||||
style="
|
class="table-cell"
|
||||||
display: flex;
|
v-for="(item, index) in deviceInfoRes.listLinkedCtr"
|
||||||
flex-direction: row;
|
|
||||||
justify-content: space-around;
|
|
||||||
"
|
|
||||||
class="tr"
|
|
||||||
>
|
|
||||||
<view class="tableTR tableTou"> 上限 </view>
|
|
||||||
<view
|
|
||||||
class="tableTR"
|
|
||||||
v-for="item in deviceInfoRes.listLinkedCtr"
|
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
>
|
>
|
||||||
{{
|
联动{{ index + 1 }}
|
||||||
item.oxyUpperOpen
|
|
||||||
? item.oxyUpperValue + "Mg/L"
|
|
||||||
: "-"
|
|
||||||
}}
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<!-- 上限行 -->
|
||||||
|
<view class="table-row">
|
||||||
|
<view class="table-cell table-label">上限</view>
|
||||||
<view
|
<view
|
||||||
style="
|
class="table-cell table-value"
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
justify-content: space-around;
|
|
||||||
"
|
|
||||||
class="tr"
|
|
||||||
>
|
|
||||||
<view class="tableTR tableTou"> 下限 </view>
|
|
||||||
<view
|
|
||||||
class="tableTR"
|
|
||||||
v-for="item in deviceInfoRes.listLinkedCtr"
|
v-for="item in deviceInfoRes.listLinkedCtr"
|
||||||
:key="item.id"
|
:key="'up_' + item.id"
|
||||||
>
|
>
|
||||||
{{
|
{{ item.oxyUpperOpen ? item.oxyUpperValue + 'Mg/L' : '-' }}
|
||||||
item.oxyLowerOpen
|
|
||||||
? item.oxyLowerValue + "Mg/L"
|
|
||||||
: "-"
|
|
||||||
}}
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<!-- 下限行 -->
|
||||||
|
<view class="table-row">
|
||||||
|
<view class="table-cell table-label">下限</view>
|
||||||
<view
|
<view
|
||||||
style="
|
class="table-cell table-value"
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
justify-content: space-around;
|
|
||||||
"
|
|
||||||
class="tr"
|
|
||||||
>
|
|
||||||
<view class="tableTR tableTou"> 开关 </view>
|
|
||||||
<view
|
|
||||||
class="tableTR"
|
|
||||||
v-for="item in deviceInfoRes.listLinkedCtr"
|
v-for="item in deviceInfoRes.listLinkedCtr"
|
||||||
:key="item.id"
|
:key="'low_' + item.id"
|
||||||
>
|
>
|
||||||
<text
|
{{ item.oxyLowerOpen ? item.oxyLowerValue + 'Mg/L' : '-' }}
|
||||||
class="truncate"
|
</view>
|
||||||
:style="{
|
</view>
|
||||||
maxWidth: '100rpx',
|
<!-- 开关行 -->
|
||||||
textAlign: 'center',
|
<view class="table-row">
|
||||||
}"
|
<view class="table-cell table-label">开关</view>
|
||||||
>{{ formatName(item.listSwitch) }}</text
|
<view
|
||||||
|
class="table-cell table-switch"
|
||||||
|
v-for="item in deviceInfoRes.listLinkedCtr"
|
||||||
|
:key="'sw_' + item.id"
|
||||||
>
|
>
|
||||||
|
<view class="switch-names">
|
||||||
|
<view
|
||||||
|
class="switch-name"
|
||||||
|
v-for="(sw, idx) in item.listSwitch"
|
||||||
|
:key="sw.id"
|
||||||
|
>
|
||||||
|
{{ sw.switchName }}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -941,7 +929,7 @@ Taro.useDidShow(() => {
|
|||||||
// 查询塘口列表
|
// 查询塘口列表
|
||||||
function getPondList() {
|
function getPondList() {
|
||||||
getPond2().then((res: any) => {
|
getPond2().then((res: any) => {
|
||||||
if (res.statusCode == 200) {
|
if (res.code == 200) {
|
||||||
const arr = [{ id: 0, pondName: "无" }];
|
const arr = [{ id: 0, pondName: "无" }];
|
||||||
res.data.forEach((r) => {
|
res.data.forEach((r) => {
|
||||||
arr.push({ id: r.id, pondName: r.pondName });
|
arr.push({ id: r.id, pondName: r.pondName });
|
||||||
@@ -953,9 +941,18 @@ function getPondList() {
|
|||||||
// 设备详情
|
// 设备详情
|
||||||
function getDevInfo() {
|
function getDevInfo() {
|
||||||
deviceInfo({ id }).then((res: any) => {
|
deviceInfo({ id }).then((res: any) => {
|
||||||
if (res.statusCode == 200) {
|
if (res.code == 200) {
|
||||||
res.data.bindTime = formatDate(new Date(res.data.bindTime));
|
res.data.bindTime = formatDate(new Date(res.data.bindTime));
|
||||||
res.data.deadTime = formatDate(new Date(res.data.deadTime));
|
res.data.deadTime = formatDate(new Date(res.data.deadTime));
|
||||||
|
|
||||||
|
// 将后端返回的 0/1 转换为布尔值
|
||||||
|
res.data.isOxygenUsed = res.data.isOxygenUsed === 1;
|
||||||
|
res.data.oxyWarnTelOpen = res.data.oxyWarnTelOpen === 1;
|
||||||
|
res.data.oxyWarnTelNoDis = res.data.oxyWarnTelNoDis === 1;
|
||||||
|
res.data.tempWarnTelOpen = res.data.tempWarnTelOpen === 1;
|
||||||
|
res.data.tempWarnTelNoDis = res.data.tempWarnTelNoDis === 1;
|
||||||
|
res.data.voltageWarnOpen = res.data.voltageWarnOpen === 1;
|
||||||
|
|
||||||
deviceInfoRes.value = res.data;
|
deviceInfoRes.value = res.data;
|
||||||
pondId.value = res.data.pondInfo ? [res.data.pondInfo.id] : [0];
|
pondId.value = res.data.pondInfo ? [res.data.pondInfo.id] : [0];
|
||||||
voltageType.value = res.data.inputVoltage;
|
voltageType.value = res.data.inputVoltage;
|
||||||
@@ -980,7 +977,7 @@ function unbind() {
|
|||||||
success: function (res) {
|
success: function (res) {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
deviceDel({ id }).then((res: any) => {
|
deviceDel({ id }).then((res: any) => {
|
||||||
if (res.statusCode == 200) {
|
if (res.code == 200) {
|
||||||
state.show = true;
|
state.show = true;
|
||||||
state.msg = "解绑成功";
|
state.msg = "解绑成功";
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@@ -1025,7 +1022,7 @@ function confirm({ selectedValue, selectedOptions }) {
|
|||||||
};
|
};
|
||||||
deviceUpdatePond(data)
|
deviceUpdatePond(data)
|
||||||
.then((res: any) => {
|
.then((res: any) => {
|
||||||
if (res.statusCode == 200) {
|
if (res.code == 200) {
|
||||||
state.show = true;
|
state.show = true;
|
||||||
state.msg = "设置成功";
|
state.msg = "设置成功";
|
||||||
}
|
}
|
||||||
@@ -1044,10 +1041,11 @@ function changeO2(value, event) {
|
|||||||
const data = {
|
const data = {
|
||||||
deviceId: id,
|
deviceId: id,
|
||||||
type: 1,
|
type: 1,
|
||||||
isOpen: deviceInfoRes.value.oxyWarnTelOpen,
|
isOpen: deviceInfoRes.value.oxyWarnTelOpen ? 1 : 0,
|
||||||
|
isNoDisturb: deviceInfoRes.value.oxyWarnTelNoDis ? 1 : 0,
|
||||||
};
|
};
|
||||||
setWarnCall(data).then((res) => {
|
setWarnCall(data).then((res) => {
|
||||||
if (res.statusCode == 200) {
|
if (res.code == 200) {
|
||||||
state.show = true;
|
state.show = true;
|
||||||
state.msg = "设置成功";
|
state.msg = "设置成功";
|
||||||
}
|
}
|
||||||
@@ -1059,10 +1057,11 @@ function changeTem(value, event) {
|
|||||||
const data = {
|
const data = {
|
||||||
deviceId: id,
|
deviceId: id,
|
||||||
type: 2,
|
type: 2,
|
||||||
isOpen: deviceInfoRes.value.tempWarnTelOpen,
|
isOpen: deviceInfoRes.value.tempWarnTelOpen ? 1 : 0,
|
||||||
|
isNoDisturb: deviceInfoRes.value.tempWarnTelNoDis ? 1 : 0,
|
||||||
};
|
};
|
||||||
setWarnCall(data).then((res) => {
|
setWarnCall(data).then((res) => {
|
||||||
if (res.statusCode == 200) {
|
if (res.code == 200) {
|
||||||
state.show = true;
|
state.show = true;
|
||||||
state.msg = "设置成功";
|
state.msg = "设置成功";
|
||||||
}
|
}
|
||||||
@@ -1086,7 +1085,7 @@ function setOxyEvent() {
|
|||||||
oxyWarnLower: oxy.value,
|
oxyWarnLower: oxy.value,
|
||||||
};
|
};
|
||||||
setOxyWarn(data).then((res) => {
|
setOxyWarn(data).then((res) => {
|
||||||
if (res.statusCode == 200) {
|
if (res.code == 200) {
|
||||||
state.show = true;
|
state.show = true;
|
||||||
state.msg = "设置成功";
|
state.msg = "设置成功";
|
||||||
deviceInfoRes.value.oxyWarnLower = oxy.value;
|
deviceInfoRes.value.oxyWarnLower = oxy.value;
|
||||||
@@ -1101,7 +1100,7 @@ function setNameEvent() {
|
|||||||
newName: deviceName.value,
|
newName: deviceName.value,
|
||||||
};
|
};
|
||||||
deviceUpdateName(data).then((res) => {
|
deviceUpdateName(data).then((res) => {
|
||||||
if (res.statusCode == 200) {
|
if (res.code == 200) {
|
||||||
state.show = true;
|
state.show = true;
|
||||||
state.msg = "设置成功";
|
state.msg = "设置成功";
|
||||||
deviceInfoRes.value.deviceName = deviceName.value;
|
deviceInfoRes.value.deviceName = deviceName.value;
|
||||||
@@ -1122,7 +1121,7 @@ function setTempEvent() {
|
|||||||
tempWarnUpper: tempUp.value,
|
tempWarnUpper: tempUp.value,
|
||||||
};
|
};
|
||||||
setTempWarn(data).then((res) => {
|
setTempWarn(data).then((res) => {
|
||||||
if (res.statusCode == 200) {
|
if (res.code == 200) {
|
||||||
state.show = true;
|
state.show = true;
|
||||||
state.msg = "设置成功";
|
state.msg = "设置成功";
|
||||||
deviceInfoRes.value.tempWarnUpper = tempUp.value;
|
deviceInfoRes.value.tempWarnUpper = tempUp.value;
|
||||||
@@ -1156,7 +1155,7 @@ function setNameSwitchEvent() {
|
|||||||
newName: switchName.value,
|
newName: switchName.value,
|
||||||
};
|
};
|
||||||
updateSwitchName(data).then((res) => {
|
updateSwitchName(data).then((res) => {
|
||||||
if (res.statusCode == 200) {
|
if (res.code == 200) {
|
||||||
state.show = true;
|
state.show = true;
|
||||||
state.msg = "设置成功";
|
state.msg = "设置成功";
|
||||||
openSetNameSwitch.value = false;
|
openSetNameSwitch.value = false;
|
||||||
@@ -1204,9 +1203,10 @@ function setSalinity() {
|
|||||||
salinityCompensation: salinity.value,
|
salinityCompensation: salinity.value,
|
||||||
};
|
};
|
||||||
setSal(data).then((res) => {
|
setSal(data).then((res) => {
|
||||||
if (res.statusCode == 200) {
|
if (res.code == 200) {
|
||||||
state.show = true;
|
state.show = true;
|
||||||
state.msg = "设置成功";
|
state.msg = "设置成功";
|
||||||
|
deviceInfoRes.value.salinityCompensation = salinity.value;
|
||||||
openSalinity.value = false;
|
openSalinity.value = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -1222,7 +1222,7 @@ function removeDev() {
|
|||||||
success: function (res) {
|
success: function (res) {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
deviceUnbind({ id }).then((res) => {
|
deviceUnbind({ id }).then((res) => {
|
||||||
if (res.statusCode == 200) {
|
if (res.code == 200) {
|
||||||
// alertRes.value = true
|
// alertRes.value = true
|
||||||
state.show = true;
|
state.show = true;
|
||||||
state.msg = "移除成功";
|
state.msg = "移除成功";
|
||||||
@@ -1242,13 +1242,13 @@ function changeTemDis(value, event) {
|
|||||||
const data = {
|
const data = {
|
||||||
deviceId: id,
|
deviceId: id,
|
||||||
type: 2,
|
type: 2,
|
||||||
isOpen: deviceInfoRes.value.tempWarnTelOpen,
|
isOpen: deviceInfoRes.value.tempWarnTelOpen ? 1 : 0,
|
||||||
isNoDisturb: deviceInfoRes.value.tempWarnTelOpen
|
isNoDisturb: deviceInfoRes.value.tempWarnTelOpen
|
||||||
? deviceInfoRes.value.tempWarnTelNoDis
|
? (deviceInfoRes.value.tempWarnTelNoDis ? 1 : 0)
|
||||||
: false,
|
: 0,
|
||||||
};
|
};
|
||||||
setWarnCall(data).then((res) => {
|
setWarnCall(data).then((res) => {
|
||||||
if (res.statusCode == 200) {
|
if (res.code == 200) {
|
||||||
state.show = true;
|
state.show = true;
|
||||||
state.msg = "设置成功";
|
state.msg = "设置成功";
|
||||||
}
|
}
|
||||||
@@ -1265,10 +1265,10 @@ function changeIsOxygenUsed(value, event) {
|
|||||||
if (event) {
|
if (event) {
|
||||||
const data = {
|
const data = {
|
||||||
id: id,
|
id: id,
|
||||||
isOpen: deviceInfoRes.value.isOxygenUsed,
|
isOpen: deviceInfoRes.value.isOxygenUsed ? 1 : 0,
|
||||||
};
|
};
|
||||||
setOxyOpen(data).then((res) => {
|
setOxyOpen(data).then((res) => {
|
||||||
if (res.statusCode == 200) {
|
if (res.code == 200) {
|
||||||
state.show = true;
|
state.show = true;
|
||||||
state.msg = "设置成功";
|
state.msg = "设置成功";
|
||||||
}
|
}
|
||||||
@@ -1277,11 +1277,11 @@ function changeIsOxygenUsed(value, event) {
|
|||||||
}
|
}
|
||||||
function setTypeEvent() {
|
function setTypeEvent() {
|
||||||
const data = {
|
const data = {
|
||||||
id: Number(id),
|
id: id,
|
||||||
voltageType: voltageType.value,
|
voltageType: voltageType.value,
|
||||||
};
|
};
|
||||||
deviceUpdateV(data).then((res) => {
|
deviceUpdateV(data).then((res) => {
|
||||||
if (res.statusCode == 200) {
|
if (res.code == 200) {
|
||||||
state.show = true;
|
state.show = true;
|
||||||
state.msg = "设置成功";
|
state.msg = "设置成功";
|
||||||
deviceInfoRes.value.inputVoltage = voltageType.value;
|
deviceInfoRes.value.inputVoltage = voltageType.value;
|
||||||
@@ -1295,10 +1295,10 @@ function changeV(value, event) {
|
|||||||
if (event) {
|
if (event) {
|
||||||
const data = {
|
const data = {
|
||||||
id: id,
|
id: id,
|
||||||
isOpen: deviceInfoRes.value.voltageWarnOpen,
|
isOpen: deviceInfoRes.value.voltageWarnOpen ? 1 : 0,
|
||||||
};
|
};
|
||||||
voltageCheckOpen(data).then((res) => {
|
voltageCheckOpen(data).then((res) => {
|
||||||
if (res.statusCode == 200) {
|
if (res.code == 200) {
|
||||||
state.show = true;
|
state.show = true;
|
||||||
state.msg = "设置成功";
|
state.msg = "设置成功";
|
||||||
}
|
}
|
||||||
@@ -1310,13 +1310,13 @@ function changeOxyDis(value, event) {
|
|||||||
const data = {
|
const data = {
|
||||||
deviceId: id,
|
deviceId: id,
|
||||||
type: 1,
|
type: 1,
|
||||||
isOpen: deviceInfoRes.value.oxyWarnTelOpen,
|
isOpen: deviceInfoRes.value.oxyWarnTelOpen ? 1 : 0,
|
||||||
isNoDisturb: deviceInfoRes.value.oxyWarnTelOpen
|
isNoDisturb: deviceInfoRes.value.oxyWarnTelOpen
|
||||||
? deviceInfoRes.value.oxyWarnTelNoDis
|
? (deviceInfoRes.value.oxyWarnTelNoDis ? 1 : 0)
|
||||||
: false,
|
: 0,
|
||||||
};
|
};
|
||||||
setWarnCall(data).then((res) => {
|
setWarnCall(data).then((res) => {
|
||||||
if (res.statusCode == 200) {
|
if (res.code == 200) {
|
||||||
state.show = true;
|
state.show = true;
|
||||||
state.msg = "设置成功";
|
state.msg = "设置成功";
|
||||||
}
|
}
|
||||||
@@ -1448,4 +1448,82 @@ function changeOxyDis(value, event) {
|
|||||||
color: #17b4b2;
|
color: #17b4b2;
|
||||||
font-size: 28px;
|
font-size: 28px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 联动控制表格优化样式 */
|
||||||
|
.linked-table {
|
||||||
|
width: 100%;
|
||||||
|
border-radius: 8px;
|
||||||
|
overflow: hidden;
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-row {
|
||||||
|
display: flex;
|
||||||
|
border-bottom: 1px solid #f0f0f0;
|
||||||
|
|
||||||
|
&:last-child {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-header {
|
||||||
|
background: #f8f8f8;
|
||||||
|
font-weight: bold;
|
||||||
|
|
||||||
|
.table-cell {
|
||||||
|
color: #666;
|
||||||
|
font-size: 26rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-cell {
|
||||||
|
flex: 1;
|
||||||
|
padding: 20rpx 10rpx;
|
||||||
|
text-align: center;
|
||||||
|
border-right: 1px solid #f0f0f0;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
min-height: 80rpx;
|
||||||
|
|
||||||
|
&:last-child {
|
||||||
|
border-right: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-label {
|
||||||
|
flex: 0 0 100rpx;
|
||||||
|
background: #fafafa;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #333;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-value {
|
||||||
|
color: #17b4b2;
|
||||||
|
font-size: 28rpx;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-switch {
|
||||||
|
padding: 10rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.switch-names {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 8rpx;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.switch-name {
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #17b4b2;
|
||||||
|
padding: 6rpx 10rpx;
|
||||||
|
background: #f5f5f5;
|
||||||
|
border-radius: 4rpx;
|
||||||
|
line-height: 1.4;
|
||||||
|
word-break: break-all;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -55,14 +55,13 @@
|
|||||||
>
|
>
|
||||||
{{ item.oxyUpperValue ? item.oxyUpperValue : "-" }}Mg/L
|
{{ item.oxyUpperValue ? item.oxyUpperValue : "-" }}Mg/L
|
||||||
</view>
|
</view>
|
||||||
|
<view>
|
||||||
<nut-switch
|
<nut-switch
|
||||||
v-model="item.oxyUpperOpen"
|
v-model="item.oxyUpperOpen"
|
||||||
:ref="'up' + item.id"
|
|
||||||
active-color="#04D98A"
|
active-color="#04D98A"
|
||||||
@change="
|
@change="(value, event) => setUpSwitch({ value, event }, item)"
|
||||||
(value, event) => setUpSwitch({ value, event }, item)
|
|
||||||
"
|
|
||||||
/>
|
/>
|
||||||
|
</view>
|
||||||
</nut-col>
|
</nut-col>
|
||||||
</nut-row>
|
</nut-row>
|
||||||
</nut-cell>
|
</nut-cell>
|
||||||
@@ -85,14 +84,13 @@
|
|||||||
>
|
>
|
||||||
{{ item.oxyLowerValue ? item.oxyLowerValue : "-" }}Mg/L
|
{{ item.oxyLowerValue ? item.oxyLowerValue : "-" }}Mg/L
|
||||||
</view>
|
</view>
|
||||||
|
<view>
|
||||||
<nut-switch
|
<nut-switch
|
||||||
v-model="item.oxyLowerOpen"
|
v-model="item.oxyLowerOpen"
|
||||||
:ref="'lo' + item.id"
|
|
||||||
active-color="#04D98A"
|
active-color="#04D98A"
|
||||||
@change="
|
@change="(value, event) => setLoSwitch({ value, event }, item)"
|
||||||
(value, event) => setLoSwitch({ value, event }, item)
|
|
||||||
"
|
|
||||||
/>
|
/>
|
||||||
|
</view>
|
||||||
</nut-col>
|
</nut-col>
|
||||||
</nut-row>
|
</nut-row>
|
||||||
</nut-cell>
|
</nut-cell>
|
||||||
@@ -487,13 +485,6 @@ const themeVars = ref({
|
|||||||
cellBorderRadius: "4px",
|
cellBorderRadius: "4px",
|
||||||
cellBoxShadow: "0px",
|
cellBoxShadow: "0px",
|
||||||
cellPadding: "26rpx 0px",
|
cellPadding: "26rpx 0px",
|
||||||
SwitchWidth: "112rpx",
|
|
||||||
SwitchHeight: "56rpx",
|
|
||||||
SwitchLineHeight: "56rpx",
|
|
||||||
SwitchInsideHeight: "40rpx",
|
|
||||||
SwitchInsideWidth: "40rpx",
|
|
||||||
SwitchInsideOpenTransform: "translateX(155%)",
|
|
||||||
SwitchInsideCloseTransform: "translateX(20%)",
|
|
||||||
});
|
});
|
||||||
const themeVars2 = ref({
|
const themeVars2 = ref({
|
||||||
cellBoxShadow: "0px 0px 0px 0px",
|
cellBoxShadow: "0px 0px 0px 0px",
|
||||||
@@ -545,10 +536,18 @@ Taro.useDidShow(() => {
|
|||||||
// 查询联动控制
|
// 查询联动控制
|
||||||
function getLinksList() {
|
function getLinksList() {
|
||||||
linkerCtrlList({ id }).then((res) => {
|
linkerCtrlList({ id }).then((res) => {
|
||||||
if (res.statusCode == 200) {
|
console.log('完整返回数据:', JSON.stringify(res, null, 2));
|
||||||
|
if (res.code == 200) {
|
||||||
if (res.data) {
|
if (res.data) {
|
||||||
res.data.forEach((item, index) => {
|
res.data.forEach((item, index) => {
|
||||||
|
console.log(`联动控制${index + 1}完整数据:`, JSON.stringify(item, null, 2));
|
||||||
item.name = "联动控制" + (index + 1);
|
item.name = "联动控制" + (index + 1);
|
||||||
|
// 调试:查看原始数据
|
||||||
|
console.log('原始数据:', item.oxyUpperOpen, item.oxyLowerOpen, typeof item.oxyUpperOpen);
|
||||||
|
// 将后端返回的 0/1 转换为布尔类型 - 强制设置为 true 或 false
|
||||||
|
item.oxyUpperOpen = item.oxyUpperOpen === 1 ? true : false;
|
||||||
|
item.oxyLowerOpen = item.oxyLowerOpen === 1 ? true : false;
|
||||||
|
console.log('转换后:', item.oxyUpperOpen, item.oxyLowerOpen, typeof item.oxyUpperOpen);
|
||||||
const switchName: any = [];
|
const switchName: any = [];
|
||||||
if (item.listSwitch && item.listSwitch.length > 0) {
|
if (item.listSwitch && item.listSwitch.length > 0) {
|
||||||
item.listSwitch.forEach((r: any) => {
|
item.listSwitch.forEach((r: any) => {
|
||||||
@@ -559,13 +558,14 @@ function getLinksList() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
linkList.value = res.data || [];
|
linkList.value = res.data || [];
|
||||||
|
console.log('最终linkList:', JSON.stringify(linkList.value, null, 2));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// 开关列表
|
// 开关列表
|
||||||
function getSwitchList(type = undefined,id=undefined) {
|
function getSwitchList(type = undefined,id=undefined) {
|
||||||
pondSwitchList({ id: pondId }).then((res) => {
|
pondSwitchList({ id: pondId }).then((res) => {
|
||||||
if (res.statusCode == 200) {
|
if (res.code == 200) {
|
||||||
if (res.data.length > 0) {
|
if (res.data.length > 0) {
|
||||||
res.data.forEach((r) => {
|
res.data.forEach((r) => {
|
||||||
if (r.deviceType == 2) {
|
if (r.deviceType == 2) {
|
||||||
@@ -639,7 +639,7 @@ function remove(name, id) {
|
|||||||
success: function (res) {
|
success: function (res) {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
delLinkerCtrl({ id }).then((res) => {
|
delLinkerCtrl({ id }).then((res) => {
|
||||||
if (res.statusCode == 200) {
|
if (res.code == 200) {
|
||||||
state.show = true;
|
state.show = true;
|
||||||
state.msg = "删除成功";
|
state.msg = "删除成功";
|
||||||
getLinksList();
|
getLinksList();
|
||||||
@@ -715,7 +715,7 @@ function addHandler() {
|
|||||||
if (params.value.id) {
|
if (params.value.id) {
|
||||||
updateLinkerCtrl(params.value)
|
updateLinkerCtrl(params.value)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.statusCode == 200) {
|
if (res.code == 200) {
|
||||||
state.show = true;
|
state.show = true;
|
||||||
state.msg = "编辑成功";
|
state.msg = "编辑成功";
|
||||||
getLinksList();
|
getLinksList();
|
||||||
@@ -728,7 +728,7 @@ function addHandler() {
|
|||||||
} else {
|
} else {
|
||||||
addLinkerCtrl(params.value)
|
addLinkerCtrl(params.value)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.statusCode == 200) {
|
if (res.code == 200) {
|
||||||
state.show = true;
|
state.show = true;
|
||||||
state.msg = "添加成功";
|
state.msg = "添加成功";
|
||||||
getLinksList();
|
getLinksList();
|
||||||
@@ -808,7 +808,7 @@ function setUpSwitch({ value, event }, item: any) {
|
|||||||
const data = {
|
const data = {
|
||||||
id: item.id,
|
id: item.id,
|
||||||
openType: 1,
|
openType: 1,
|
||||||
isOpen: item.oxyUpperOpen,
|
isOpen: item.oxyUpperOpen ? 1 : 0, // 布尔转数字
|
||||||
};
|
};
|
||||||
switchParams.value = data;
|
switchParams.value = data;
|
||||||
if (item.oxyUpperOpen) {
|
if (item.oxyUpperOpen) {
|
||||||
@@ -823,7 +823,7 @@ function setLoSwitch({ value, event }, item: any) {
|
|||||||
const data = {
|
const data = {
|
||||||
id: item.id,
|
id: item.id,
|
||||||
openType: 2,
|
openType: 2,
|
||||||
isOpen: item.oxyLowerOpen,
|
isOpen: item.oxyLowerOpen ? 1 : 0, // 布尔转数字
|
||||||
};
|
};
|
||||||
switchParams.value = data;
|
switchParams.value = data;
|
||||||
if (item.oxyLowerOpen) {
|
if (item.oxyLowerOpen) {
|
||||||
@@ -845,12 +845,21 @@ function setSwitchOpenNone() {
|
|||||||
function setSwitchOpen(data) {
|
function setSwitchOpen(data) {
|
||||||
setLinkOpen(data)
|
setLinkOpen(data)
|
||||||
.then((res: any) => {
|
.then((res: any) => {
|
||||||
if (res.statusCode == 200) {
|
if (res.code == 200) {
|
||||||
state.show = true;
|
state.show = true;
|
||||||
const tag = data.isOpen ? "开启" : "关闭";
|
const tag = data.isOpen ? "开启" : "关闭";
|
||||||
state.msg = tag + "成功";
|
state.msg = tag + "成功";
|
||||||
|
// 重新加载列表以同步状态
|
||||||
|
getLinksList();
|
||||||
|
} else {
|
||||||
|
// 失败时恢复开关状态
|
||||||
|
getLinksList();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
.catch(() => {
|
||||||
|
// 错误时恢复开关状态
|
||||||
|
getLinksList();
|
||||||
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
openAlert.value = false;
|
openAlert.value = false;
|
||||||
});
|
});
|
||||||
@@ -962,7 +971,7 @@ function updateOxy(item) {
|
|||||||
function upHandler() {
|
function upHandler() {
|
||||||
updateLinkerCtrl(params.value)
|
updateLinkerCtrl(params.value)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.statusCode == 200) {
|
if (res.code == 200) {
|
||||||
state.show = true;
|
state.show = true;
|
||||||
state.msg = "编辑成功";
|
state.msg = "编辑成功";
|
||||||
getLinksList();
|
getLinksList();
|
||||||
|
|||||||
@@ -325,7 +325,7 @@ import Taro from "@tarojs/taro";
|
|||||||
import { imgUrl } from "@/utils/imgUrl";
|
import { imgUrl } from "@/utils/imgUrl";
|
||||||
const r_v = `${imgUrl}r_v.png`;
|
const r_v = `${imgUrl}r_v.png`;
|
||||||
const instance = Taro.getCurrentInstance();
|
const instance = Taro.getCurrentInstance();
|
||||||
const id = Number(instance.router.params.id);
|
const id = (instance.router.params.id);
|
||||||
// const id = 21;
|
// const id = 21;
|
||||||
const name = instance.router.params.name;
|
const name = instance.router.params.name;
|
||||||
Taro.setNavigationBarTitle({
|
Taro.setNavigationBarTitle({
|
||||||
@@ -393,7 +393,7 @@ Taro.useDidShow(() => {
|
|||||||
// 查询塘口列表
|
// 查询塘口列表
|
||||||
function getPondList() {
|
function getPondList() {
|
||||||
getPond2().then((res: any) => {
|
getPond2().then((res: any) => {
|
||||||
if (res.statusCode == 200) {
|
if (res.code == 200) {
|
||||||
const arr = [{ id: 0, pondName: "无" }];
|
const arr = [{ id: 0, pondName: "无" }];
|
||||||
res.data.forEach((r) => {
|
res.data.forEach((r) => {
|
||||||
arr.push({ id: r.id, pondName: r.pondName });
|
arr.push({ id: r.id, pondName: r.pondName });
|
||||||
@@ -405,7 +405,11 @@ function getPondList() {
|
|||||||
// 开关详情
|
// 开关详情
|
||||||
function getSwitchInfo() {
|
function getSwitchInfo() {
|
||||||
switchInfo({ id }).then((res: any) => {
|
switchInfo({ id }).then((res: any) => {
|
||||||
if (res.statusCode == 200) {
|
if (res.code == 200) {
|
||||||
|
// 将后端返回的 0/1 转换为布尔值
|
||||||
|
res.data.voltageWarnOpen = res.data.voltageWarnOpen === 1;
|
||||||
|
res.data.electricWarnOpen = res.data.electricWarnOpen === 1;
|
||||||
|
|
||||||
switchInfoRes.value = res.data;
|
switchInfoRes.value = res.data;
|
||||||
pondId.value = res.data.pondInfo ? [Number(res.data.pondInfo.id)] : [];
|
pondId.value = res.data.pondInfo ? [Number(res.data.pondInfo.id)] : [];
|
||||||
voltageType.value = res.data.connectVoltageType ? res.data.connectVoltageType : 1;
|
voltageType.value = res.data.connectVoltageType ? res.data.connectVoltageType : 1;
|
||||||
@@ -426,7 +430,7 @@ function confirm({ selectedValue, selectedOptions }) {
|
|||||||
};
|
};
|
||||||
updateSwitchPond(data)
|
updateSwitchPond(data)
|
||||||
.then((res: any) => {
|
.then((res: any) => {
|
||||||
if (res.statusCode == 200) {
|
if (res.code == 200) {
|
||||||
state.show = true;
|
state.show = true;
|
||||||
state.msg = "设置成功";
|
state.msg = "设置成功";
|
||||||
}
|
}
|
||||||
@@ -451,7 +455,7 @@ function setVEvent() {
|
|||||||
electric: Number(V.value),
|
electric: Number(V.value),
|
||||||
};
|
};
|
||||||
electricSet(data).then((res) => {
|
electricSet(data).then((res) => {
|
||||||
if (res.statusCode == 200) {
|
if (res.code == 200) {
|
||||||
state.show = true;
|
state.show = true;
|
||||||
state.msg = "设置成功";
|
state.msg = "设置成功";
|
||||||
switchInfoRes.value.rateElectricValue = V.value;
|
switchInfoRes.value.rateElectricValue = V.value;
|
||||||
@@ -474,7 +478,7 @@ function setTypeEvent() {
|
|||||||
voltageType: voltageType.value,
|
voltageType: voltageType.value,
|
||||||
};
|
};
|
||||||
updateSwitchType(data).then((res) => {
|
updateSwitchType(data).then((res) => {
|
||||||
if (res.statusCode == 200) {
|
if (res.code == 200) {
|
||||||
state.show = true;
|
state.show = true;
|
||||||
state.msg = "设置成功";
|
state.msg = "设置成功";
|
||||||
switchInfoRes.value.connectVoltageType = voltageType.value;
|
switchInfoRes.value.connectVoltageType = voltageType.value;
|
||||||
@@ -503,10 +507,10 @@ function changeV(value, event) {
|
|||||||
if (event) {
|
if (event) {
|
||||||
const data = {
|
const data = {
|
||||||
id: id,
|
id: id,
|
||||||
isOpen: switchInfoRes.value.voltageWarnOpen,
|
isOpen: switchInfoRes.value.voltageWarnOpen ? 1 : 0, // 布尔转数字
|
||||||
};
|
};
|
||||||
voltageCheckOpen(data).then((res) => {
|
voltageCheckOpen(data).then((res) => {
|
||||||
if (res.statusCode == 200) {
|
if (res.code == 200) {
|
||||||
state.show = true;
|
state.show = true;
|
||||||
state.msg = "设置成功";
|
state.msg = "设置成功";
|
||||||
}
|
}
|
||||||
@@ -517,10 +521,10 @@ function changeE(value, event) {
|
|||||||
if (event) {
|
if (event) {
|
||||||
const data = {
|
const data = {
|
||||||
id: id,
|
id: id,
|
||||||
isOpen: switchInfoRes.value.electricWarnOpen,
|
isOpen: switchInfoRes.value.electricWarnOpen ? 1 : 0, // 布尔转数字
|
||||||
};
|
};
|
||||||
electricCheckOpen(data).then((res) => {
|
electricCheckOpen(data).then((res) => {
|
||||||
if (res.statusCode == 200) {
|
if (res.code == 200) {
|
||||||
state.show = true;
|
state.show = true;
|
||||||
state.msg = "设置成功";
|
state.msg = "设置成功";
|
||||||
}
|
}
|
||||||
|
|||||||
240
src/home/wqm.vue
240
src/home/wqm.vue
@@ -261,62 +261,58 @@
|
|||||||
>
|
>
|
||||||
<!-- 绘制表格 -->
|
<!-- 绘制表格 -->
|
||||||
<view class="m_t_15">
|
<view class="m_t_15">
|
||||||
|
<view class="linked-table">
|
||||||
|
<!-- 表头 -->
|
||||||
|
<view class="table-row table-header">
|
||||||
|
<view class="table-cell"></view>
|
||||||
<view
|
<view
|
||||||
style="
|
class="table-cell"
|
||||||
display: flex;
|
v-for="(item, index) in deviceInfoRes.listLinkedCtr"
|
||||||
flex-direction: row;
|
|
||||||
justify-content: space-around;
|
|
||||||
"
|
|
||||||
class="tr"
|
|
||||||
>
|
|
||||||
<view class="tableTR tableTou"> 上限 </view>
|
|
||||||
<view
|
|
||||||
class="tableTR"
|
|
||||||
v-for="item in deviceInfoRes.listLinkedCtr"
|
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
|
>
|
||||||
|
联动{{ index + 1 }}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- 上限行 -->
|
||||||
|
<view class="table-row">
|
||||||
|
<view class="table-cell table-label">上限</view>
|
||||||
|
<view
|
||||||
|
class="table-cell table-value"
|
||||||
|
v-for="item in deviceInfoRes.listLinkedCtr"
|
||||||
|
:key="'up_' + item.id"
|
||||||
>
|
>
|
||||||
{{ item.oxyUpperOpen ? item.oxyUpperValue + 'Mg/L' : '-' }}
|
{{ item.oxyUpperOpen ? item.oxyUpperValue + 'Mg/L' : '-' }}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<!-- 下限行 -->
|
||||||
|
<view class="table-row">
|
||||||
|
<view class="table-cell table-label">下限</view>
|
||||||
<view
|
<view
|
||||||
style="
|
class="table-cell table-value"
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
justify-content: space-around;
|
|
||||||
"
|
|
||||||
class="tr"
|
|
||||||
>
|
|
||||||
<view class="tableTR tableTou"> 下限 </view>
|
|
||||||
<view
|
|
||||||
class="tableTR"
|
|
||||||
v-for="item in deviceInfoRes.listLinkedCtr"
|
v-for="item in deviceInfoRes.listLinkedCtr"
|
||||||
:key="item.id"
|
:key="'low_' + item.id"
|
||||||
>
|
>
|
||||||
{{ item.oxyLowerOpen ? item.oxyLowerValue + 'Mg/L' : '-' }}
|
{{ item.oxyLowerOpen ? item.oxyLowerValue + 'Mg/L' : '-' }}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<!-- 开关行 -->
|
||||||
|
<view class="table-row">
|
||||||
|
<view class="table-cell table-label">开关</view>
|
||||||
<view
|
<view
|
||||||
style="
|
class="table-cell table-switch"
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
justify-content: space-around;
|
|
||||||
"
|
|
||||||
class="tr"
|
|
||||||
>
|
|
||||||
<view class="tableTR tableTou"> 开关 </view>
|
|
||||||
<view
|
|
||||||
class="tableTR"
|
|
||||||
v-for="item in deviceInfoRes.listLinkedCtr"
|
v-for="item in deviceInfoRes.listLinkedCtr"
|
||||||
:key="item.id"
|
:key="'sw_' + item.id"
|
||||||
>
|
>
|
||||||
<text
|
<view class="switch-names">
|
||||||
class="truncate"
|
<view
|
||||||
:style="{
|
class="switch-name"
|
||||||
maxWidth: '100rpx',
|
v-for="(sw, idx) in item.listSwitch"
|
||||||
textAlign: 'center',
|
:key="sw.id"
|
||||||
}"
|
|
||||||
>{{ formatName(item.listSwitch) }}</text
|
|
||||||
>
|
>
|
||||||
|
{{ sw.switchName }}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -773,7 +769,7 @@ Taro.useDidShow(() => {
|
|||||||
// 查询塘口列表
|
// 查询塘口列表
|
||||||
function getPondList() {
|
function getPondList() {
|
||||||
getPond2().then((res: any) => {
|
getPond2().then((res: any) => {
|
||||||
if (res.statusCode == 200) {
|
if (res.code == 200) {
|
||||||
const arr = [{ id: 0, pondName: "无" }];
|
const arr = [{ id: 0, pondName: "无" }];
|
||||||
res.data.forEach(r=>{
|
res.data.forEach(r=>{
|
||||||
arr.push({id:r.id,pondName:r.pondName})
|
arr.push({id:r.id,pondName:r.pondName})
|
||||||
@@ -785,9 +781,17 @@ function getPondList() {
|
|||||||
// 设备详情
|
// 设备详情
|
||||||
function getDevInfo() {
|
function getDevInfo() {
|
||||||
deviceInfo({ id }).then((res: any) => {
|
deviceInfo({ id }).then((res: any) => {
|
||||||
if (res.statusCode == 200) {
|
if (res.code == 200) {
|
||||||
res.data.bindTime = formatDate(new Date(res.data.bindTime));
|
res.data.bindTime = formatDate(new Date(res.data.bindTime));
|
||||||
res.data.deadTime = formatDate(new Date(res.data.deadTime));
|
res.data.deadTime = formatDate(new Date(res.data.deadTime));
|
||||||
|
|
||||||
|
// 将数字类型转为布尔类型
|
||||||
|
res.data.oxyWarnTelOpen = !!res.data.oxyWarnTelOpen;
|
||||||
|
res.data.oxyWarnTelNoDis = !!res.data.oxyWarnTelNoDis;
|
||||||
|
res.data.tempWarnTelOpen = !!res.data.tempWarnTelOpen;
|
||||||
|
res.data.tempWarnTelNoDis = !!res.data.tempWarnTelNoDis;
|
||||||
|
res.data.isOxygenUsed = !!res.data.isOxygenUsed;
|
||||||
|
|
||||||
deviceInfoRes.value = res.data;
|
deviceInfoRes.value = res.data;
|
||||||
pondId.value = res.data.pondInfo ? [Number(res.data.pondInfo.id)] : [0];
|
pondId.value = res.data.pondInfo ? [Number(res.data.pondInfo.id)] : [0];
|
||||||
}
|
}
|
||||||
@@ -814,7 +818,7 @@ function unbind() {
|
|||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
b_isLoading.value = true
|
b_isLoading.value = true
|
||||||
deviceDel({ id }).then((res: any) => {
|
deviceDel({ id }).then((res: any) => {
|
||||||
if (res.statusCode == 200) {
|
if (res.code == 200) {
|
||||||
state.show = true;
|
state.show = true;
|
||||||
state.msg = "解绑成功";
|
state.msg = "解绑成功";
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@@ -864,7 +868,7 @@ console.log(selectedValue)
|
|||||||
};
|
};
|
||||||
deviceUpdatePond(data)
|
deviceUpdatePond(data)
|
||||||
.then((res: any) => {
|
.then((res: any) => {
|
||||||
if (res.statusCode == 200) {
|
if (res.code == 200) {
|
||||||
state.show = true;
|
state.show = true;
|
||||||
state.msg = "设置成功";
|
state.msg = "设置成功";
|
||||||
}
|
}
|
||||||
@@ -883,13 +887,13 @@ function changeO2(value, event) {
|
|||||||
const data = {
|
const data = {
|
||||||
deviceId: id,
|
deviceId: id,
|
||||||
type: 1,
|
type: 1,
|
||||||
isOpen: deviceInfoRes.value.oxyWarnTelOpen,
|
isOpen: deviceInfoRes.value.oxyWarnTelOpen ? 1 : 0, // 布尔转数字
|
||||||
isNoDisturb: deviceInfoRes.value.oxyWarnTelOpen
|
isNoDisturb: deviceInfoRes.value.oxyWarnTelOpen
|
||||||
? deviceInfoRes.value.oxyWarnTelNoDis
|
? (deviceInfoRes.value.oxyWarnTelNoDis ? 1 : 0) // 布尔转数字
|
||||||
: false,
|
: 0,
|
||||||
};
|
};
|
||||||
setWarnCall(data).then((res) => {
|
setWarnCall(data).then((res) => {
|
||||||
if (res.statusCode == 200) {
|
if (res.code == 200) {
|
||||||
state.show = true;
|
state.show = true;
|
||||||
state.msg = "设置成功";
|
state.msg = "设置成功";
|
||||||
}
|
}
|
||||||
@@ -901,13 +905,13 @@ function changeTem(value, event) {
|
|||||||
const data = {
|
const data = {
|
||||||
deviceId: id,
|
deviceId: id,
|
||||||
type: 2,
|
type: 2,
|
||||||
isOpen: deviceInfoRes.value.tempWarnTelOpen,
|
isOpen: deviceInfoRes.value.tempWarnTelOpen ? 1 : 0, // 布尔转数字
|
||||||
isNoDisturb: deviceInfoRes.value.tempWarnTelOpen
|
isNoDisturb: deviceInfoRes.value.tempWarnTelOpen
|
||||||
? deviceInfoRes.value.tempWarnTelNoDis
|
? (deviceInfoRes.value.tempWarnTelNoDis ? 1 : 0) // 布尔转数字
|
||||||
: false,
|
: 0,
|
||||||
};
|
};
|
||||||
setWarnCall(data).then((res) => {
|
setWarnCall(data).then((res) => {
|
||||||
if (res.statusCode == 200) {
|
if (res.code == 200) {
|
||||||
state.show = true;
|
state.show = true;
|
||||||
state.msg = "设置成功";
|
state.msg = "设置成功";
|
||||||
}
|
}
|
||||||
@@ -942,7 +946,7 @@ function setOxyEvent() {
|
|||||||
oxyWarnLower: oxy.value,
|
oxyWarnLower: oxy.value,
|
||||||
};
|
};
|
||||||
setOxyWarn(data).then((res) => {
|
setOxyWarn(data).then((res) => {
|
||||||
if (res.statusCode == 200) {
|
if (res.code == 200) {
|
||||||
state.show = true;
|
state.show = true;
|
||||||
state.msg = "设置成功";
|
state.msg = "设置成功";
|
||||||
deviceInfoRes.value.oxyWarnLower = oxy.value;
|
deviceInfoRes.value.oxyWarnLower = oxy.value;
|
||||||
@@ -957,11 +961,12 @@ function setNameEvent() {
|
|||||||
newName: deviceName.value,
|
newName: deviceName.value,
|
||||||
};
|
};
|
||||||
deviceUpdateName(data).then((res) => {
|
deviceUpdateName(data).then((res) => {
|
||||||
if (res.statusCode == 200) {
|
if (res.code == 200) {
|
||||||
state.show = true;
|
state.show = true;
|
||||||
state.msg = "设置成功";
|
state.msg = "设置成功";
|
||||||
deviceInfoRes.value.deviceName = deviceName.value;
|
|
||||||
openSetName.value = false;
|
openSetName.value = false;
|
||||||
|
// 重新加载设备信息
|
||||||
|
getDevInfo();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -995,7 +1000,7 @@ function setTempEvent() {
|
|||||||
tempWarnUpper: tempUp.value,
|
tempWarnUpper: tempUp.value,
|
||||||
};
|
};
|
||||||
setTempWarn(data).then((res) => {
|
setTempWarn(data).then((res) => {
|
||||||
if (res.statusCode == 200) {
|
if (res.code == 200) {
|
||||||
state.show = true;
|
state.show = true;
|
||||||
state.msg = "设置成功";
|
state.msg = "设置成功";
|
||||||
deviceInfoRes.value.tempWarnUpper = tempUp.value;
|
deviceInfoRes.value.tempWarnUpper = tempUp.value;
|
||||||
@@ -1035,7 +1040,7 @@ function setSalinity() {
|
|||||||
salinityCompensation: salinity.value ? Number(salinity.value) : 0,
|
salinityCompensation: salinity.value ? Number(salinity.value) : 0,
|
||||||
};
|
};
|
||||||
setSal(data).then((res) => {
|
setSal(data).then((res) => {
|
||||||
if (res.statusCode == 200) {
|
if (res.code == 200) {
|
||||||
state.show = true;
|
state.show = true;
|
||||||
state.msg = "设置成功";
|
state.msg = "设置成功";
|
||||||
deviceInfoRes.value.salinityCompensation = salinity.value;
|
deviceInfoRes.value.salinityCompensation = salinity.value;
|
||||||
@@ -1053,13 +1058,13 @@ function changeOxyDis(value, event) {
|
|||||||
const data = {
|
const data = {
|
||||||
deviceId: id,
|
deviceId: id,
|
||||||
type: 1,
|
type: 1,
|
||||||
isOpen: deviceInfoRes.value.oxyWarnTelOpen,
|
isOpen: deviceInfoRes.value.oxyWarnTelOpen ? 1 : 0, // 布尔转数字
|
||||||
isNoDisturb: deviceInfoRes.value.oxyWarnTelOpen
|
isNoDisturb: deviceInfoRes.value.oxyWarnTelOpen
|
||||||
? deviceInfoRes.value.oxyWarnTelNoDis
|
? (deviceInfoRes.value.oxyWarnTelNoDis ? 1 : 0) // 布尔转数字
|
||||||
: false,
|
: 0,
|
||||||
};
|
};
|
||||||
setWarnCall(data).then((res) => {
|
setWarnCall(data).then((res) => {
|
||||||
if (res.statusCode == 200) {
|
if (res.code == 200) {
|
||||||
state.show = true;
|
state.show = true;
|
||||||
state.msg = "设置成功";
|
state.msg = "设置成功";
|
||||||
}
|
}
|
||||||
@@ -1072,46 +1077,19 @@ function changeTemDis(value, event) {
|
|||||||
const data = {
|
const data = {
|
||||||
deviceId: id,
|
deviceId: id,
|
||||||
type: 2,
|
type: 2,
|
||||||
isOpen: deviceInfoRes.value.tempWarnTelOpen,
|
isOpen: deviceInfoRes.value.tempWarnTelOpen ? 1 : 0, // 布尔转数字
|
||||||
isNoDisturb: deviceInfoRes.value.tempWarnTelOpen
|
isNoDisturb: deviceInfoRes.value.tempWarnTelOpen
|
||||||
? deviceInfoRes.value.tempWarnTelNoDis
|
? (deviceInfoRes.value.tempWarnTelNoDis ? 1 : 0) // 布尔转数字
|
||||||
: false,
|
: 0,
|
||||||
};
|
};
|
||||||
setWarnCall(data).then((res) => {
|
setWarnCall(data).then((res) => {
|
||||||
if (res.statusCode == 200) {
|
if (res.code == 200) {
|
||||||
state.show = true;
|
state.show = true;
|
||||||
state.msg = "设置成功";
|
state.msg = "设置成功";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 移除设备
|
|
||||||
function removeDev() {
|
|
||||||
Taro.showModal({
|
|
||||||
title: "提示",
|
|
||||||
content:
|
|
||||||
"移除后会将设备从塘口移除,并和塘口内的其他设备解除关联关系。确认移除该设备?",
|
|
||||||
success: function (res) {
|
|
||||||
if (res.confirm) {
|
|
||||||
r_isLoading.value = true
|
|
||||||
deviceUnbind({ id }).then((res) => {
|
|
||||||
if (res.statusCode == 200) {
|
|
||||||
// alertRes.value = true
|
|
||||||
state.show = true;
|
|
||||||
state.msg = "移除成功";
|
|
||||||
deviceInfoRes.value.pondInfo = {
|
|
||||||
id: 0,
|
|
||||||
pondName: "请绑定塘口",
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}).finally(() => {
|
|
||||||
r_isLoading.value = false
|
|
||||||
})
|
|
||||||
} else if (res.cancel) {
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
// 返回上一页
|
// 返回上一页
|
||||||
function onGoBack() {
|
function onGoBack() {
|
||||||
Taro.navigateBack({ delta: 1 });
|
Taro.navigateBack({ delta: 1 });
|
||||||
@@ -1248,4 +1226,82 @@ function onblur() {
|
|||||||
color: #17b4b2;
|
color: #17b4b2;
|
||||||
font-size: 28px;
|
font-size: 28px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 联动控制表格优化样式 */
|
||||||
|
.linked-table {
|
||||||
|
width: 100%;
|
||||||
|
border-radius: 8px;
|
||||||
|
overflow: hidden;
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-row {
|
||||||
|
display: flex;
|
||||||
|
border-bottom: 1px solid #f0f0f0;
|
||||||
|
|
||||||
|
&:last-child {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-header {
|
||||||
|
background: #f8f8f8;
|
||||||
|
font-weight: bold;
|
||||||
|
|
||||||
|
.table-cell {
|
||||||
|
color: #666;
|
||||||
|
font-size: 26rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-cell {
|
||||||
|
flex: 1;
|
||||||
|
padding: 20rpx 10rpx;
|
||||||
|
text-align: center;
|
||||||
|
border-right: 1px solid #f0f0f0;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
min-height: 80rpx;
|
||||||
|
|
||||||
|
&:last-child {
|
||||||
|
border-right: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-label {
|
||||||
|
flex: 0 0 100rpx;
|
||||||
|
background: #fafafa;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #333;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-value {
|
||||||
|
color: #17b4b2;
|
||||||
|
font-size: 28rpx;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-switch {
|
||||||
|
padding: 10rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.switch-names {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 8rpx;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.switch-name {
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #17b4b2;
|
||||||
|
padding: 6rpx 10rpx;
|
||||||
|
background: #f5f5f5;
|
||||||
|
border-radius: 4rpx;
|
||||||
|
line-height: 1.4;
|
||||||
|
word-break: break-all;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -397,8 +397,9 @@ function getPayItem() {
|
|||||||
}
|
}
|
||||||
// 设备列表
|
// 设备列表
|
||||||
function getDeviceList() {
|
function getDeviceList() {
|
||||||
allDeviceList({ type: 1 }).then((res: any) => {
|
const userId = Taro.getStorageSync("UserId");
|
||||||
if (res.statusCode == 200) {
|
allDeviceList({ type: 1,rootUserId:userId }).then((res: any) => {
|
||||||
|
if (res.code == 200) {
|
||||||
res.data.forEach((item: any) => {
|
res.data.forEach((item: any) => {
|
||||||
const deadDay = daysBeforeToday(formatDate(new Date(item.deadTime)));
|
const deadDay = daysBeforeToday(formatDate(new Date(item.deadTime)));
|
||||||
item.deadDay = deadDay
|
item.deadDay = deadDay
|
||||||
|
|||||||
@@ -504,16 +504,16 @@
|
|||||||
<nut-tab-pane
|
<nut-tab-pane
|
||||||
v-for="(item, index) in noticeRows"
|
v-for="(item, index) in noticeRows"
|
||||||
:key="index"
|
:key="index"
|
||||||
:title="`${item.title}`"
|
:title="`${item.noticeTitle}`"
|
||||||
:pane-key="index"
|
:pane-key="index"
|
||||||
>
|
>
|
||||||
<nut-row>
|
<nut-row>
|
||||||
<nut-col :span="24" :style="{ height: '200px' }">
|
<nut-col :span="24" :style="{ height: '200px' }">
|
||||||
{{ item.content }}
|
<view v-html="item.noticeContent"></view>
|
||||||
</nut-col>
|
</nut-col>
|
||||||
<nut-col :span="24">
|
<nut-col :span="24">
|
||||||
<view :style="{ textAlign: 'right' }"
|
<view :style="{ textAlign: 'right' }"
|
||||||
>发布时间:{{ formatDateString(item.createdTime, "yyyy-mm-dd") }}</view
|
>发布时间:{{ formatDateString(item.createTime, "yyyy-mm-dd") }}</view
|
||||||
>
|
>
|
||||||
<!-- <div>有效期至:{{formatDateMin(item.deadTime)}}</div> -->
|
<!-- <div>有效期至:{{formatDateMin(item.deadTime)}}</div> -->
|
||||||
</nut-col>
|
</nut-col>
|
||||||
@@ -768,17 +768,17 @@ function getNotice(openType = 0) {
|
|||||||
noticeList().then((res) => {
|
noticeList().then((res) => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
const nList: any = [];
|
const nList: any = [];
|
||||||
noticeRows.value = res.data.sort(sortByField("priority", false));
|
noticeRows.value = res.rows.sort(sortByField("priority", false));
|
||||||
if (noticeRows.value.length > 0) {
|
if (noticeRows.value.length > 0) {
|
||||||
noticeRows.value.forEach((item: AnalyserOptions) => {
|
noticeRows.value.forEach((item: AnalyserOptions) => {
|
||||||
const content: string = `${item.title}:${item.content}`;
|
const content: string = `${item.noticeTitle}:${item.noticeContent}`;
|
||||||
nList.push(content);
|
nList.push(content);
|
||||||
});
|
});
|
||||||
if (openType == 0) {
|
if (openType == 0) {
|
||||||
notice.value = nList[0];
|
notice.value = nList[0];
|
||||||
if (store.getNoticeRead == 0) {
|
if (store.getNoticeRead == 0) {
|
||||||
noticeOpen.value = true;
|
noticeOpen.value = true;
|
||||||
} else if (store.getNoticeRead != noticeRows.value[0]["createdTime"]) {
|
} else if (store.getNoticeRead != noticeRows.value[0]["createTime"]) {
|
||||||
noticeOpen.value = true;
|
noticeOpen.value = true;
|
||||||
} else {
|
} else {
|
||||||
noticeOpen.value = false;
|
noticeOpen.value = false;
|
||||||
@@ -1222,9 +1222,9 @@ function closeNotice() {
|
|||||||
noticeOpen.value = false;
|
noticeOpen.value = false;
|
||||||
if (noticeRows.value.length > 0) {
|
if (noticeRows.value.length > 0) {
|
||||||
if (store.getNoticeRead == 0) {
|
if (store.getNoticeRead == 0) {
|
||||||
store.updateNoticeRead(noticeRows.value[0]["createdTime"]);
|
store.updateNoticeRead(noticeRows.value[0]["createTime"]);
|
||||||
} else if (store.getNoticeRead != noticeRows.value[0]["createdTime"]) {
|
} else if (store.getNoticeRead != noticeRows.value[0]["createTime"]) {
|
||||||
store.updateNoticeRead(noticeRows.value[0]["createdTime"]);
|
store.updateNoticeRead(noticeRows.value[0]["createTime"]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
store.updateNoticeRead(0);
|
store.updateNoticeRead(0);
|
||||||
|
|||||||
@@ -8,7 +8,8 @@ const timeOutSeconds = 10000;
|
|||||||
const getBaseUrl = () => {
|
const getBaseUrl = () => {
|
||||||
let BASE_URL = ''
|
let BASE_URL = ''
|
||||||
if (process.env.TARO_ENV === 'h5') {
|
if (process.env.TARO_ENV === 'h5') {
|
||||||
BASE_URL = 'http://127.0.0.1:8080' // 本地调试后端地址
|
BASE_URL = 'https://www.qdintc.com/fishery-api' // 线上调试后端
|
||||||
|
// BASE_URL = 'http://127.0.0.1:8080' // 本地调试后端地址
|
||||||
} else {
|
} else {
|
||||||
BASE_URL = 'https://api.yuceyun.cn' //填写你的请求域名
|
BASE_URL = 'https://api.yuceyun.cn' //填写你的请求域名
|
||||||
// BASE_URL = 'https://dev.yuceyun.cn' //测试环境
|
// BASE_URL = 'https://dev.yuceyun.cn' //测试环境
|
||||||
|
|||||||
Reference in New Issue
Block a user