提交app

This commit is contained in:
guanj
2026-03-17 14:00:55 +08:00
parent b71200cb97
commit 00e34c168f
82 changed files with 13202 additions and 4602 deletions

View File

@@ -1,197 +1,221 @@
import request from '../js/request'
import config from '../js/config'
// 获取设备
export function getDeviceList(params) {
return request({
url: '/cs-device-boot/EquipmentDelivery/queryEquipmentByProject',
method: 'post',
data: params,
})
}
/**
* 设备统计
* @param {*} id 工程id
* @returns
*/
export function getDevCount(id) {
return request({
url: '/cs-device-boot/deviceUser/devCount',
method: 'post',
data: { id },
})
}
// 获取直连设备模板信息
export function getModel(nDid) {
return request({
url: '/access-boot/device/model',
method: 'post',
data: {
nDid,
},
})
}
// 直连设备接入
export function addDevice(params) {
return request({
url: '/access-boot/device/access',
method: 'post',
header: {
'Content-Type': 'application/json',
},
data: params,
})
}
// 直连设备注册
export function registerDevice(nDid, type) {
return request({
url: '/access-boot/device/register',
method: 'post',
data: {
nDid,
type,
},
})
}
// 查询拓扑图模板
export const getTopoTemplate = () => {
return request({
url: '/cs-device-boot/topologyTemplate/queryImage',
method: 'POST',
})
}
// 查询拓扑图模板监测点
export const queryByTopoId = (id) => {
return request({
url: '/cs-device-boot/lineTemplate/queryByTopoId',
method: 'POST',
data: {
topoId: id,
},
})
}
// 查询设备拓扑图
export const queryTopologyDiagram = (devId) => {
return request({
url: '/cs-device-boot/lineTopologyDiagram/queryTopologyDiagram',
method: 'POST',
data: {
devId,
},
})
}
// 设备扫码移交
export const transferDevice = (id, userId) => {
return request({
url: '/cs-device-boot/deviceUser/transfer',
method: 'POST',
data: {
ids: id,
userId: userId || uni.getStorageSync('userInfo').userIndex,
},
})
}
// 设备扫码分享
export const shareDevice = (id, userId) => {
return request({
url: '/cs-device-boot/deviceUser/share',
method: 'POST',
data: {
ids: id,
},
})
}
// 设备删除
export const deleteDevice = (id) => {
return request({
url: '/cs-device-boot/deviceUser/delete',
method: 'POST',
data: {
eid: id,
},
})
}
// 设备查询通过id获取
export const queryDeivceById = (id) => {
return request({
url: '/cs-device-boot/EquipmentDelivery/queryEquipmentById',
method: 'POST',
data: {
ids: id,
},
})
}
// 字典树接口通过id
export const queryByid = (id) => {
return request({
url: '/system-boot/dictTree/queryByid',
method: 'post',
data: {
id,
},
})
}
//设备修改监测点信息
export const updateDevice = (params) => {
return request({
url: '/cs-device-boot/lineTopologyDiagram/auditList',
method: 'POST',
header: {
'Content-Type': 'application/json',
},
data: params,
})
}
// 设备用户列表
export const queryDeviceUser = (devId) => {
return request({
url: '/cs-device-boot/deviceUser/queryUserById',
method: 'POST',
data: {
devId,
},
})
}
// 取消分享
export const cancelShare = (params) => {
return request({
url: '/cs-device-boot/deviceUser/cancelShare',
method: 'POST',
data: params,
})
}
// 取消调试
export const cancelDebug = (params) => {
return request({
url: '/cs-device-boot/EquipmentDelivery/deleteTest',
method: 'POST',
data: params,
})
}
// 完成调试
export const finishDebug = (params) => {
return request({
url: '/cs-device-boot/EquipmentDelivery/testcompletion',
method: 'POST',
data: params,
})
}
import request from '../js/request'
import config from '../js/config'
// 获取设备
export function getDeviceList(params) {
return request({
url: '/cs-device-boot/EquipmentDelivery/queryEquipmentByProject',
method: 'post',
data: params,
})
}
/**
* 设备统计
* @param {*} id 工程id
* @returns
*/
export function getDevCount(id) {
return request({
url: '/cs-device-boot/deviceUser/devCount',
method: 'post',
data: { id },
})
}
// 获取直连设备模板信息
export function getModel(nDid) {
return request({
url: '/access-boot/device/model',
method: 'post',
data: {
nDid,
},
})
}
// 直连设备接入
export function addDevice(params) {
return request({
url: '/access-boot/device/access',
method: 'post',
header: {
'Content-Type': 'application/json',
},
data: params,
})
}
// 直连设备注册
export function registerDevice(nDid, type) {
return request({
url: '/access-boot/device/register',
method: 'post',
data: {
nDid,
type,
},
})
}
// 查询拓扑图模板
export const getTopoTemplate = () => {
return request({
url: '/cs-device-boot/topologyTemplate/queryImage',
method: 'POST',
})
}
// 查询拓扑图模板监测点
export const queryByTopoId = (id) => {
return request({
url: '/cs-device-boot/lineTemplate/queryByTopoId',
method: 'POST',
data: {
topoId: id,
},
})
}
// 查询设备拓扑图
export const queryTopologyDiagram = (devId) => {
return request({
url: '/cs-device-boot/lineTopologyDiagram/queryTopologyDiagram',
method: 'POST',
data: {
devId,
},
})
}
// 设备扫码移交
export const transferDevice = (id, userId) => {
return request({
url: '/cs-device-boot/deviceUser/transfer',
method: 'POST',
data: {
ids: id,
userId: userId || uni.getStorageSync('userInfo').userIndex,
},
})
}
// 设备扫码分享
export const shareDevice = (id, userId) => {
return request({
url: '/cs-device-boot/deviceUser/share',
method: 'POST',
data: {
ids: id,
},
})
}
// 设备删除
export const deleteDevice = (id) => {
return request({
url: '/cs-device-boot/deviceUser/delete',
method: 'POST',
data: {
eid: id,
},
})
}
// 设备查询通过id获取
export const queryDeivceById = (id) => {
return request({
url: '/cs-device-boot/EquipmentDelivery/queryEquipmentById',
method: 'POST',
data: {
ids: id,
},
})
}
// 字典树接口通过id
export const queryByid = (id) => {
return request({
url: '/system-boot/dictTree/queryByid',
method: 'post',
data: {
id,
},
})
}
//设备修改监测点信息
export const updateDevice = (params) => {
return request({
url: '/cs-device-boot/lineTopologyDiagram/auditList',
method: 'POST',
header: {
'Content-Type': 'application/json',
},
data: params,
})
}
// 设备用户列表
export const queryDeviceUser = (devId) => {
return request({
url: '/cs-device-boot/deviceUser/queryUserById',
method: 'POST',
data: {
devId,
},
})
}
// 取消分享
export const cancelShare = (params) => {
return request({
url: '/cs-device-boot/deviceUser/cancelShare',
method: 'POST',
data: params,
})
}
// 取消调试
export const cancelDebug = (params) => {
return request({
url: '/cs-device-boot/EquipmentDelivery/deleteTest',
method: 'POST',
data: params,
})
}
// 完成调试
export const finishDebug = (params) => {
return request({
url: '/cs-device-boot/EquipmentDelivery/testcompletion',
method: 'POST',
data: params,
})
}
// 置顶设备、工程
export const engineeringPinToTop = (params) => {
return request({
url: '/cs-device-boot/csUserPins/engineeringPinToTop',
method: 'POST',
data: params,
header: {
'Content-Type': 'application/json',
},
})
}
// 查询工程树
export const lineTree = (params) => {
return request({
url: '/cs-device-boot/csLedger/lineTree',
method: 'POST',
data: {
type:'engineering'
},
// header: {
// 'Content-Type': 'application/json',
// },
})
}

View File

@@ -1,10 +1,16 @@
import request from '../js/request'
// apf-》获取模块状态
export function getModuleState(params) {
return request({
url: '/cs-harmonic-boot/data/getModuleState',
method: 'post',
data: params,
})
import request from '../js/request'
// apf-》获取模块状态
export function getModuleState(params) {
return request({
url: '/cs-harmonic-boot/data/getModuleState',
method: 'post',
data: params,
})
}
export function getBaseRealData(id) {
return request({
url: 'cs-harmonic-boot/realData/getBaseRealData?lineId='+id,
method: 'post',
})
}

View File

@@ -1,17 +1,45 @@
import request from '../js/request';
import config from '../js/config';
/**
* 已读暂态
* @returns {*}
*/
export function updateStatus(params) {
return request({
url: '/cs-harmonic-boot/eventUser/updateStatus',
method: 'post',
header: {
'Content-Type': 'application/json',
},
data: params,
})
}
import request from '../js/request';
import config from '../js/config';
/**
* 已读暂态
* @returns {*}
*/
export function updateStatus(params) {
return request({
url: '/cs-harmonic-boot/eventUser/updateStatus',
method: 'post',
header: {
'Content-Type': 'application/json',
},
data: params,
})
}
/**
* 稳态详情
* @returns {*}
*/
export function queryHarmonicDetail(params) {
return request({
url: '/cs-harmonic-boot/csHarmonic/queryHarmonicDetail',
method: 'post',
header: {
'Content-Type': 'application/json',
},
data: params,
})
}
/**
* 运行告警事件详
* @returns {*}
*/
export function queryAlarmDetail(params) {
return request({
url: '/cs-harmonic-boot/csAlarm/queryAlarmDetail',
method: 'post',
header: {
'Content-Type': 'application/json',
},
data: params,
})
}

View File

@@ -1,287 +1,290 @@
page {
background: #f3f4f5;
}
// mt0,mr0,mb0,ml0 --> mt100,mr100,mb100,ml100
@for $i from 0 through 100 {
.mt#{$i} {
margin-top: #{$i}rpx;
}
.mr#{$i} {
margin-right: #{$i}rpx;
}
.mb#{$i} {
margin-bottom: #{$i}rpx;
}
.ml#{$i} {
margin-left: #{$i}rpx;
}
.pt#{$i} {
padding-top: #{$i}rpx;
}
.pr#{$i} {
padding-right: #{$i}rpx;
}
.pb#{$i} {
padding-bottom: #{$i}rpx;
}
.pl#{$i} {
padding-left: #{$i}rpx;
}
}
.center {
display: flex;
align-items: center;
justify-content: center;
}
.space-between {
display: flex;
justify-content: space-between;
}
.hide-txt {
overflow-x: hidden;
white-space: nowrap;
text-overflow: ellipsis;
word-break: break-all;
-webkit-line-clamp: 1;
}
.clamp-txt {
overflow: hidden;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
word-break: break-all;
}
.fixed-btn {
position: fixed;
right: 80rpx;
bottom: 200rpx;
width: 126rpx;
height: 126rpx;
background: $uni-theme-white;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 0 10rpx rgba(0, 0, 0, 0.2);
image {
height: 66rpx;
width: 66rpx;
}
}
.grid-card {
border-radius: 12rpx;
margin-bottom: 20rpx;
.grid-card-title {
padding: 0 0 20rpx;
font-size: 28rpx;
color: #111;
font-weight: 700;
}
.grid-card-content-4,
.grid-card-content-2,
.grid-card-content-1,
.grid-card-content-3,
.grid-card-content-5,
.grid-card-content-6 {
display: grid;
border-left: 2rpx solid #ccc;
border-top: 2rpx solid #ccc;
font-size: 24rpx;
grid-template-columns: 1fr 1fr 1fr 1fr;
.item {
padding: 0 4rpx;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
border-bottom: 2rpx solid #ccc;
border-right: 2rpx solid #ccc;
padding: 4rpx;
background: $uni-theme-white;
}
.item-title {
background: unset;
padding: 8rpx 4rpx;
}
}
.grid-card-content-1 {
grid-template-columns: 1fr;
}
.grid-card-content-2 {
grid-template-columns: 1fr 2fr;
}
.grid-card-content-3 {
grid-template-columns: 1fr 2fr 2fr;
}
.grid-card-content-5 {
grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
}
.grid-card-content-6 {
grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr;
}
}
.index {
.header {
margin: 0 20rpx;
display: grid;
grid-gap: 20rpx;
grid-template-columns: 1fr 1fr 1fr ;
.header-item {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 10rpx 10rpx 20rpx;
color: #fff;
font-size: 28rpx;
background: $uni-theme-color;
border-radius: 12rpx;
.header-item-value {
font-size: 44rpx;
}
.header-item-label {
font-size: 24rpx;
}
}
}
}
.nav {
position: sticky;
top: 0;
left: 0;
padding: 20rpx 20rpx 0;
padding-left: 0;
display: flex;
flex-wrap: wrap;
background: rgb(243, 244, 245);
z-index: 2;
.nav-menu {
padding: 6rpx 20rpx;
margin-left: 20rpx;
margin-bottom: 20rpx;
font-size: 24rpx;
border-radius: 8rpx;
background: #ebeaec;
color: #666;
&-active {
background: #dfe5f7;
color: $uni-theme-color;
}
&-btn {
background: $uni-theme-color;
color: #fff;
}
}
}
.btn {
display: flex;
align-items: center;
justify-content: center;
flex: 1;
background: $uni-theme-color;
color: #fff;
height: 80rpx;
border-radius: 12rpx;
}
.btn-small {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 0 40rpx;
background: $uni-theme-color;
color: #fff;
height: 60rpx;
font-size: 24rpx;
border-radius: 12rpx;
}
.device {
/deep/ .uni-card:first-of-type {
margin-top: 0 !important;
}
}
.content {
/deep/ .uni-forms-item:last-of-type {
margin-bottom: 0 !important;
}
position: relative;
}
.status-point-success {
display: inline-block;
width: 16rpx;
height: 16rpx;
border-radius: 50%;
background: greenyellow;
overflow: hidden;
}
.status-point-error {
display: inline-block;
width: 16rpx;
height: 16rpx;
border-radius: 50%;
background: red;
overflow: hidden;
}
.popup-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 20rpx;
height: 80rpx;
background: #fff;
border-radius: 20rpx 20rpx 0 0;
overflow: hidden;
border-bottom: 1px solid #eee;
.popup-header-title {
font-size: 32rpx;
color: #333;
}
.popup-header-close {
font-size: 32rpx;
color: #666;
}
}
image {
will-change: transform;//解决加载时瞬间拉伸问题
width: auto;//解决加载时瞬间拉伸问题
height: auto;//解决加载时瞬间拉伸问题
image-rendering:-moz-crisp-edges;
image-rendering:-o-crisp-edges;
image-rendering:-webkit-optimize-contrast;
image-rendering: crisp-edges;
-ms-interpolation-mode:nearest-neighbor;
}
page {
background: #f3f4f5;
}
// mt0,mr0,mb0,ml0 --> mt100,mr100,mb100,ml100
@for $i from 0 through 100 {
.mt#{$i} {
margin-top: #{$i}rpx;
}
.mr#{$i} {
margin-right: #{$i}rpx;
}
.mb#{$i} {
margin-bottom: #{$i}rpx;
}
.ml#{$i} {
margin-left: #{$i}rpx;
}
.pt#{$i} {
padding-top: #{$i}rpx;
}
.pr#{$i} {
padding-right: #{$i}rpx;
}
.pb#{$i} {
padding-bottom: #{$i}rpx;
}
.pl#{$i} {
padding-left: #{$i}rpx;
}
.pd#{$i} {
padding: #{$i}rpx;
}
}
.center {
display: flex;
align-items: center;
justify-content: center;
}
.space-between {
display: flex;
justify-content: space-between;
}
.hide-txt {
overflow-x: hidden;
white-space: nowrap;
text-overflow: ellipsis;
word-break: break-all;
-webkit-line-clamp: 1;
}
.clamp-txt {
overflow: hidden;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
word-break: break-all;
}
.fixed-btn {
position: fixed;
right: 80rpx;
bottom: 200rpx;
width: 126rpx;
height: 126rpx;
background: $uni-theme-white;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 0 10rpx rgba(0, 0, 0, 0.2);
image {
height: 66rpx;
width: 66rpx;
}
}
.grid-card {
border-radius: 12rpx;
margin-bottom: 20rpx;
.grid-card-title {
padding: 0 0 20rpx;
font-size: 28rpx;
color: #111;
font-weight: 700;
}
.grid-card-content-4,
.grid-card-content-2,
.grid-card-content-1,
.grid-card-content-3,
.grid-card-content-5,
.grid-card-content-6 {
display: grid;
border-left: 2rpx solid #ccc;
border-top: 2rpx solid #ccc;
font-size: 24rpx;
grid-template-columns: 1fr 1fr 1fr 1fr;
.item {
padding: 0 4rpx;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
border-bottom: 2rpx solid #ccc;
border-right: 2rpx solid #ccc;
padding: 4rpx;
background: $uni-theme-white;
}
.item-title {
background: unset;
padding: 8rpx 4rpx;
}
}
.grid-card-content-1 {
grid-template-columns: 1fr;
}
.grid-card-content-2 {
grid-template-columns: 1fr 2fr;
}
.grid-card-content-3 {
grid-template-columns: 1fr 2fr 2fr;
}
.grid-card-content-5 {
grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
}
.grid-card-content-6 {
grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr;
}
}
.index {
.header {
margin: 0 20rpx;
display: grid;
grid-gap: 20rpx;
grid-template-columns: 1fr 1fr 1fr ;
.header-item {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 10rpx 10rpx 20rpx;
color: #fff;
font-size: 28rpx;
background: $uni-theme-color;
border-radius: 12rpx;
.header-item-value {
font-size: 44rpx;
}
.header-item-label {
font-size: 24rpx;
}
}
}
}
.nav {
position: sticky;
top: 0;
left: 0;
padding: 20rpx 20rpx 0;
padding-left: 0;
display: flex;
flex-wrap: wrap;
background: rgb(243, 244, 245);
z-index: 2;
.nav-menu {
padding: 6rpx 20rpx;
margin-left: 20rpx;
margin-bottom: 20rpx;
font-size: 24rpx;
border-radius: 8rpx;
background: #ebeaec;
color: #666;
&-active {
background: #dfe5f7;
color: $uni-theme-color;
}
&-btn {
background: $uni-theme-color;
color: #fff;
}
}
}
.btn {
display: flex;
align-items: center;
justify-content: center;
flex: 1;
background: $uni-theme-color;
color: #fff;
height: 80rpx;
border-radius: 12rpx;
}
.btn-small {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 0 40rpx;
background: $uni-theme-color;
color: #fff;
height: 60rpx;
font-size: 24rpx;
border-radius: 12rpx;
}
.device {
/deep/ .uni-card:first-of-type {
margin-top: 0 !important;
}
}
.content {
/deep/ .uni-forms-item:last-of-type {
margin-bottom: 0 !important;
}
position: relative;
}
.status-point-success {
display: inline-block;
width: 16rpx;
height: 16rpx;
border-radius: 50%;
background: greenyellow;
overflow: hidden;
}
.status-point-error {
display: inline-block;
width: 16rpx;
height: 16rpx;
border-radius: 50%;
background: red;
overflow: hidden;
}
.popup-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 20rpx;
height: 80rpx;
background: #fff;
border-radius: 20rpx 20rpx 0 0;
overflow: hidden;
border-bottom: 1px solid #eee;
.popup-header-title {
font-size: 32rpx;
color: #333;
}
.popup-header-close {
font-size: 32rpx;
color: #666;
}
}
image {
will-change: transform;//解决加载时瞬间拉伸问题
width: auto;//解决加载时瞬间拉伸问题
height: auto;//解决加载时瞬间拉伸问题
image-rendering:-moz-crisp-edges;
image-rendering:-o-crisp-edges;
image-rendering:-webkit-optimize-contrast;
image-rendering: crisp-edges;
-ms-interpolation-mode:nearest-neighbor;
}

View File

@@ -1,7 +1,7 @@
const debug = false // true 是连地服务端本地false 是连接线上
const debug = true // true 是连地服务端本地false 是连接线上
const development = {
domain: 'http://192.168.1.62:10215',
domain: 'http://192.168.2.126:10215',
}
const production = {

View File

@@ -1,92 +1,98 @@
export default {
onPullDownRefresh() {
this.store && this.store.reload()
},
onReachBottom() {
if (this.store.status != 'noMore') {
this.store.next && this.store.next()
}
},
data() {
return {
store: {},
}
},
methods: {
DataSource(url) {
var me = this
return {
data: [],
status: 'noMore',
empty: false,
total: 0,
header: {
'Content-Type': 'application/json;charset=UTF-8',
},
params: {
pageNum: 1,
pageSize: 20,
},
timer: null,
callBack: null,
firstCallBack: null,
loadedCallback: null,
reload() {
if (this.status == 'loading') return
this.data = []
this.empty = false
this.params.pageNum = 1
this.next()
},
search() {
// 节流搜索
clearTimeout(this.timer)
this.timer = setTimeout(() => {
this.reload()
}, 300)
},
next() {
this.status = 'loading'
me.$request({
url: url,
data: this.params,
header: this.header,
method: 'POST',
debounce: false,
}).then((res) => {
console.warn(res)
let resultData = res.data?.list || res.data?.records || res.data || []
if (this.params.pageNum == 1) {
this.data = resultData
if (resultData.length == 0 || resultData == 0) {
this.empty = true
this.status = 'noMore'
} else if (resultData.length < this.params.pageSize) {
this.status = 'noMore'
} else if (res.total == resultData.length) {
this.status = 'noMore'
} else {
this.status = 'more'
}
} else {
this.data.push(...resultData)
if (resultData.length < this.params.pageSize) {
this.status = 'noMore'
} else {
this.status = 'more'
}
}
if (this.params.pageNum == 1) {
this.firstCallBack && this.firstCallBack()
}
this.loadedCallback && this.loadedCallback()
this.params.pageNum++
this.total = res.total
this.loading = false
uni.stopPullDownRefresh()
})
},
}
},
},
}
export default {
onPullDownRefresh() {
if (this.store.isListAtTop) {
this.store && this.store.reload()
}
},
onReachBottom() {
if (this.store.status != 'noMore') {
this.store.next && this.store.next()
}
},
data() {
return {
store: {},
}
},
methods: {
DataSource(url) {
var me = this
return {
data: [],
copyData: {},
status: 'noMore',
empty: false,
isListAtTop: true,
total: 0,
header: {
'Content-Type': 'application/json;charset=UTF-8',
},
params: {
pageNum: 1,
pageSize: 20,
},
timer: null,
callBack: null,
firstCallBack: null,
loadedCallback: null,
reload() {
if (this.status == 'loading') return
this.data = []
this.empty = false
this.params.pageNum = 1
this.next()
},
search() {
// 节流搜索
clearTimeout(this.timer)
this.timer = setTimeout(() => {
this.reload()
}, 300)
},
next() {
this.status = 'loading'
me.$request({
url: url,
data: this.params,
header: this.header,
method: 'POST',
debounce: false,
}).then((res) => {
console.warn(res)
let resultData = res.data?.list || res.data?.records || res.data || []
this.copyData = res.data
if (this.params.pageNum == 1) {
this.data = resultData
if (resultData.length == 0 || resultData == 0) {
this.empty = true
this.status = 'noMore'
} else if (resultData.length < this.params.pageSize) {
this.status = 'noMore'
} else if (res.total == resultData.length) {
this.status = 'noMore'
} else {
this.status = 'more'
}
} else {
this.data.push(...resultData)
if (resultData.length < this.params.pageSize) {
this.status = 'noMore'
} else {
this.status = 'more'
}
}
if (this.params.pageNum == 1) {
this.firstCallBack && this.firstCallBack()
}
this.loadedCallback && this.loadedCallback()
this.params.pageNum++
this.total = res.total || res.data?.total
this.loading = false
uni.stopPullDownRefresh()
})
},
}
},
},
}

View File

@@ -1,5 +1,5 @@
export const MQTT_IP = 'pqmcn.com:8085/mqtt'//mqtt地址端口, 使用emqx时一定要加mqtt
// export const MQTT_IP = '192.168.1.24:8085/mqtt'//mqtt地址端口, 使用emqx时一定要加mqtt
// export const MQTT_IP = 'pqmcn.com:8085/mqtt'//mqtt地址端口, 使用emqx时一定要加mqtt
export const MQTT_IP = '192.168.1.103:8083/mqtt'//mqtt地址端口, 使用emqx时一定要加mqtt
const MQTT_USERNAME = 't_user'//mqtt用户名
const MQTT_PASSWORD = 'njcnpqs'//密码

View File

@@ -39,7 +39,7 @@ export default (options = {}) => {
},
method: options.method || 'GET',
success: async (res) => {
console.log(res)
// console.log(res)
if (arr.indexOf(options.url) > -1) {
setTimeout(() => {
arr.splice(arr.indexOf(options.url), 1)

View File

@@ -107,39 +107,61 @@ function formatTime(time, option) {
}
// 获取当天日期(年月日)
function getToday() {
const today = new Date();
const year = today.getFullYear();
const month = String(today.getMonth() + 1).padStart(2, '0'); // 月份从0开始需+1
const day = String(today.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`;
const today = new Date()
const year = today.getFullYear()
const month = String(today.getMonth() + 1).padStart(2, '0') // 月份从0开始需+1
const day = String(today.getDate()).padStart(2, '0')
return `${year}-${month}-${day}`
}
// 获取当天日期 往前推30天
function getBeforeDays(days = 30) {
const today = new Date();
// 计算往前推N天的时间戳1天=86400000毫秒
const beforeDate = new Date(today.getTime() - days * 24 * 60 * 60 * 1000);
return formatDate(beforeDate);
const today = new Date()
// 计算往前推N天的时间戳1天=86400000毫秒
const beforeDate = new Date(today.getTime() - days * 24 * 60 * 60 * 1000)
return formatDate(beforeDate)
}
function formatDate(date) {
const year = date.getFullYear();
// 月份从0开始补零到2位
const month = String(date.getMonth() + 1).padStart(2, '0');
// 日期补零到2位
const day = String(date.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`;
const year = date.getFullYear()
// 月份从0开始补零到2位
const month = String(date.getMonth() + 1).padStart(2, '0')
// 日期补零到2位
const day = String(date.getDate()).padStart(2, '0')
return `${year}-${month}-${day}`
}
// 获取3个月前的日期
function getThreeMonthsAgo() {
const threeMonthsAgo = new Date();
threeMonthsAgo.setMonth(threeMonthsAgo.getMonth() - 3); // 月份减3
const year = threeMonthsAgo.getFullYear();
const month = String(threeMonthsAgo.getMonth() + 1).padStart(2, '0');
const day = String(threeMonthsAgo.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`;
const threeMonthsAgo = new Date()
threeMonthsAgo.setMonth(threeMonthsAgo.getMonth() - 3) // 月份减3
const year = threeMonthsAgo.getFullYear()
const month = String(threeMonthsAgo.getMonth() + 1).padStart(2, '0')
const day = String(threeMonthsAgo.getDate()).padStart(2, '0')
return `${year}-${month}-${day}`
}
//获取月最后一天
function getMonthFirstAndLastDay(monthStr) {
// 1. 校验输入格式正则匹配YYYY-MM
const reg = /^\d{4}-\d{2}$/
if (!reg.test(monthStr)) {
throw new Error('输入格式错误,请传入"YYYY-MM"格式的字符串例如2026-03')
}
// 2. 拆分年、月
const [year, month] = monthStr.split('-').map(Number)
// 3. 生成当月第一天直接拼接01
const firstDay = `${year}-${String(month).padStart(2, '0')}-01`
// 4. 生成当月最后一天核心利用Date的特性下个月0号 = 当月最后一天)
// 注意月份是0开始的0=1月11=12月所以month+1是下一个月
const lastDayDate = new Date(year, month, 0) // 下个月0号 = 当月最后一天
const lastDay = `${year}-${String(month).padStart(2, '0')}-${String(lastDayDate.getDate()).padStart(2, '0')}`
return {
firstDay,
lastDay,
}
}
const h5Helper = {
isAndroid: function () {
@@ -167,7 +189,7 @@ const getUserLocation = (call) => {
success: function (address) {
call(address)
},
fail: (err) => {
fail: (err) => {
uni.showModal({
title: '提示',
content: '定位失败,请打开定位权限',
@@ -309,12 +331,14 @@ const getDictData = (key) => {
resolve(dictData.filter((item) => item.code === key)[0]?.children || [])
} else {
// 查询字典
queryDictDataCache().then((res) => {
uni.setStorageSync(cacheKey.dictData, res.data)
resolve(res.data.filter((item) => item.code === key)[0]?.children || [])
}).catch(err=>{
reject(err)
})
queryDictDataCache()
.then((res) => {
uni.setStorageSync(cacheKey.dictData, res.data)
resolve(res.data.filter((item) => item.code === key)[0]?.children || [])
})
.catch((err) => {
reject(err)
})
}
})
}
@@ -333,5 +357,6 @@ export default {
getDictData,
getToday,
getBeforeDays,
getThreeMonthsAgo
getThreeMonthsAgo,
getMonthFirstAndLastDay,
}