2 Commits

Author SHA1 Message Date
guanj
a2e27e3811 修改关键指标概览 已选指标 2026-07-14 09:13:20 +08:00
guanj
fcf702ca3c 修改发布问题 2026-07-13 10:22:03 +08:00
11 changed files with 308 additions and 99 deletions

View File

@@ -23,6 +23,7 @@ export const queryByCode = (code) => {
return request({ return request({
url: '/system-boot/dictTree/queryByCode', url: '/system-boot/dictTree/queryByCode',
method: 'post', method: 'post',
debounce: false,
data: { data: {
code, code,
}, },
@@ -34,6 +35,7 @@ export const queryCsDictTree = (pid) => {
return request({ return request({
url: '/system-boot/dictTree/query', url: '/system-boot/dictTree/query',
method: 'post', method: 'post',
debounce: false,
data: { data: {
pid, pid,
}, },

View File

@@ -7,5 +7,6 @@ export default {
dictData: 'dictData', // 字典数据 dictData: 'dictData', // 字典数据
messageCount: 'messageCount', // 消息数量 messageCount: 'messageCount', // 消息数量
serverConfig: 'serverConfig', // 服务内容配置 serverConfig: 'serverConfig', // 服务内容配置
monitorSelectedIndicators: 'monitorSelectedIndicators', // 监测点已选展示指标 monitorSelectedIndicators: 'monitorSelectedIndicators', // 非治理监测点已选展示指标
monitorSelectedIndicatorsPqCom: 'monitorSelectedIndicatorsPqCom', // 治理监测点已选展示指标
} }

View File

@@ -52,7 +52,7 @@
</view> </view>
</view> </view>
</view> </view>
<view class="uni-card__header-extra" style="position: relative" @click.stop> <view class="uni-card__header-extra" style="position: relative" @click.stop="jump(device)">
<text class="uni-card__header-extra-text"></text> <text class="uni-card__header-extra-text"></text>
<slot name="title"></slot> <slot name="title"></slot>
</view> </view>
@@ -105,6 +105,7 @@ export default {
return str return str
}, },
jump() { jump() {
if (this.device.devType == 'Direct_Connected_Device') { if (this.device.devType == 'Direct_Connected_Device') {
uni.navigateTo({ uni.navigateTo({
url: url:

View File

@@ -75,7 +75,9 @@
"push" : { "push" : {
"unipush" : { "unipush" : {
"version" : "2", "version" : "2",
"offline" : true "offline" : true,
"hms" : {},
"mi" : {}
} }
}, },
"share" : {} "share" : {}

View File

@@ -89,12 +89,18 @@
<Cn-device-card :device="item" :key="index"> <Cn-device-card :device="item" :key="index">
<template v-slot:title> <template v-slot:title>
<!-- 卡片标题 --> <!-- 卡片标题 -->
<switch <view
v-if="transfer || share" v-if="transfer || share"
class="switch-wrap"
@click.stop
@tap.stop
>
<switch
:checked="checkList.indexOf(item.equipmentId) > -1" :checked="checkList.indexOf(item.equipmentId) > -1"
style="transform: scale(0.8); position: relative; left: 20rpx" style="transform: scale(0.8); position: relative; left: 20rpx"
@change="switchChange(item)" @change.stop="switchChange(item)"
/> />
</view>
<view class="star-icon" v-else> <view class="star-icon" v-else>
<uni-icons type="search" size="25" color="#376cf3"></uni-icons> <uni-icons type="search" size="25" color="#376cf3"></uni-icons>
</view> </view>
@@ -248,7 +254,10 @@ export default {
this.select.projectName = '' this.select.projectName = ''
this.getProjectList() this.getProjectList()
} }
setTimeout(() => {
this.store && this.store.reload() this.store && this.store.reload()
}, 500);
}, },
methods: { methods: {
bindClick(e, item) { bindClick(e, item) {
@@ -316,6 +325,7 @@ export default {
console.warn('init') console.warn('init')
this.getEngineeringList() this.getEngineeringList()
this.getProjectList() this.getProjectList()
this.getDeviceList() this.getDeviceList()
}, },
getDeviceList() { getDeviceList() {

View File

@@ -11,7 +11,7 @@
<view v-for="(item, index) in store.data" :key="index" style="margin: 0px 7px 7px;"> <view v-for="(item, index) in store.data" :key="index" style="margin: 0px 8px 8px;">
<!-- extra="🔍" --> <!-- extra="🔍" -->
<uni-card class="boxClick" :title="item.name" @click="jump(item)"> <uni-card class="boxClick" :title="item.name" @click="jump(item)">
<view class="term-list-bottom"> <view class="term-list-bottom">
@@ -203,7 +203,7 @@ export default {
} }
/deep/ .uni-card--border { /deep/ .uni-card--border {
margin: 0 10px !important; margin: 0 0px !important;
padding-bottom: 10px; padding-bottom: 10px;
} }

View File

@@ -14,7 +14,7 @@
><checkbox value="true" :checked="checkedAll" />全选  ><checkbox value="true" :checked="checkedAll" />全选 
</checkbox-group></view </checkbox-group></view
> --> > -->
已选择 {{ checkedTotal }} 条事件 已选择 {{ checkedTotal }} 条事件最多{{ maxSelectCount }}
</view> </view>
<view class="nav-menu nav-menu-btn" @click="selectDevice">申请报告 </view> <view class="nav-menu nav-menu-btn" @click="selectDevice">申请报告 </view>
<!-- <view style="width: 180rpx"> <!-- <view style="width: 180rpx">
@@ -61,15 +61,19 @@
}}</text> }}</text>
</view> </view>
<view class="event-desc"> <view class="event-desc">
<text>工程{{ item.engineeringName }}</text> <text>工程</text>
<text>项目{{ item.projectName }}</text> <text>项目{{ item.projectName }}</text>
<text>设备{{ item.equipmentName }}</text> <text>设备{{ item.equipmentName }}</text>
</view> </view>
</view> </view>
<view class="event-action" @click="handleWrapperClick(item, !item.wavePath)"> <view class="event-action" @click="handleWrapperClick(item, !item.wavePath)">
<!-- 选择 --> <!-- 选择 -->
<checkbox-group @change="changeChild($event, item)" <checkbox-group @change.stop="changeChild($event, item)"
><checkbox value="true" :disabled="!item.wavePath" :checked="item.checked" /> ><checkbox
value="true"
:disabled="!item.wavePath || (checkedTotal >= maxSelectCount && !item.checked)"
:checked="item.checked"
/>
</checkbox-group> </checkbox-group>
</view> </view>
</view> </view>
@@ -126,6 +130,7 @@ export default {
height: 0, height: 0,
checkedAll: false, checkedAll: false,
checkedTotal: 0, checkedTotal: 0,
maxSelectCount: 5,
sort: 0, sort: 0,
array: ['发生时间', '暂降幅值', '持续时间'], array: ['发生时间', '暂降幅值', '持续时间'],
} }
@@ -201,7 +206,18 @@ export default {
} }
}, },
changeChild(e, item) { changeChild(e, item) {
item.checked = !item.checked const willCheck = e.detail.value.length > 0
if (willCheck && !item.checked) {
const selectedCount = this.store.data.filter((i) => i.checked).length
if (selectedCount >= this.maxSelectCount) {
uni.showToast({
title: `最多只能选择${this.maxSelectCount}条事件`,
icon: 'none',
})
return
}
}
item.checked = willCheck
this.checkedAll = this.store.data.every((item) => item.checked === true) this.checkedAll = this.store.data.every((item) => item.checked === true)
this.checkedTotal = this.store.data.filter((item) => item.checked === true).length this.checkedTotal = this.store.data.filter((item) => item.checked === true).length
}, },
@@ -266,7 +282,13 @@ export default {
title: '请选择事件!', title: '请选择事件!',
icon: 'none', icon: 'none',
}) })
} else { }
if (this.checkedTotal > this.maxSelectCount) {
return uni.showToast({
title: `最多只能选择${this.maxSelectCount}条事件`,
icon: 'none',
})
}
uni.showLoading({ uni.showLoading({
title: '申请中,请稍等...', title: '申请中,请稍等...',
mask: true, mask: true,
@@ -287,7 +309,6 @@ export default {
title: '申请报告,成功!', title: '申请报告,成功!',
}) })
}) })
}
}, },
isAllLineIdSame(data) { isAllLineIdSame(data) {
// 获取第一个元素的lineId作为基准 // 获取第一个元素的lineId作为基准

View File

@@ -46,9 +46,18 @@
<Cn-device-card :device="item" :key="index"> <Cn-device-card :device="item" :key="index">
<template v-slot:title> <template v-slot:title>
<!-- 卡片标题 --> <!-- 卡片标题 -->
<switch v-if="transfer || share" :checked="checkList.indexOf(item.equipmentId) > -1" <view
v-if="transfer || share"
class="switch-wrap"
@click.stop
@tap.stop
>
<switch
:checked="checkList.indexOf(item.equipmentId) > -1"
style="transform: scale(0.8); position: relative; left: 20rpx" style="transform: scale(0.8); position: relative; left: 20rpx"
@change="switchChange(item)" /> @change.stop="switchChange(item)"
/>
</view>
<view class="star-icon" v-else> <view class="star-icon" v-else>
<uni-icons type="search" size="25" color="#376cf3"></uni-icons> <uni-icons type="search" size="25" color="#376cf3"></uni-icons>
</view> </view>

View File

@@ -14,7 +14,7 @@
</view> </view>
</view> </view>
<view class="stats-row"> <view class="stats-row">
<view class="stats-item" v-for="(item, idx) in summaryStats" :key="idx"> <view class="stats-item" v-for="(item, idx) in summaryStats" :key="idx" @click="jump(idx)">
<text class="stats-num">{{ item.value }}</text> <text class="stats-num">{{ item.value }}</text>
<text class="stats-label">{{ item.label }}</text> <text class="stats-label">{{ item.label }}</text>
</view> </view>
@@ -28,17 +28,41 @@
</view> </view>
</view> </view>
<view class="indicators-card card"> <view class="indicators-card card">
<view class="indicator-group">
<text class="indicator-group-title">治理监测点指标</text>
<view class="indicator-tags"> <view class="indicator-tags">
<view v-for="(tag, idx) in selectedIndicators" :key="tag" <view
class="indicator-tag indicator-tag--active" @click="removeIndicator(idx)"> v-for="(tag, idx) in selectedIndicatorsPqCom"
:key="'governance-' + tag"
class="indicator-tag indicator-tag--active"
@click="removeIndicator(idx, 'governance')"
>
<text class="indicator-tag-text">{{ formatIndicatorTag(tag) }}</text> <text class="indicator-tag-text">{{ formatIndicatorTag(tag) }}</text>
<uni-icons type="closeempty" size="12" color="#376cf3" /> <uni-icons type="closeempty" size="12" color="#376cf3" />
</view> </view>
<view class="indicator-tag indicator-tag--add" @click="openIndicatorPopup"> <view class="indicator-tag indicator-tag--add" @click="openIndicatorPopup('governance')">
<text>+添加指标</text> <text>+添加指标</text>
</view> </view>
</view> </view>
</view> </view>
<view class="indicator-group">
<text class="indicator-group-title">非治理监测点指标</text>
<view class="indicator-tags">
<view
v-for="(tag, idx) in selectedIndicators"
:key="'normal-' + tag"
class="indicator-tag indicator-tag--active"
@click="removeIndicator(idx, 'normal')"
>
<text class="indicator-tag-text">{{ formatIndicatorTag(tag) }}</text>
<uni-icons type="closeempty" size="12" color="#376cf3" />
</view>
<view class="indicator-tag indicator-tag--add" @click="openIndicatorPopup('normal')">
<text>+添加指标</text>
</view>
</view>
</view>
</view>
<view class="monitor-section"> <view class="monitor-section">
<view class="monitor-section-header"> <view class="monitor-section-header">
@@ -54,8 +78,12 @@
</view> </view>
</view> </view>
<view class="monitor-search"> <view class="monitor-search">
<uni-search-bar v-model="filterKeyword" bgColor="#fff" placeholder="搜索项目、设备、监测点" <uni-search-bar
cancelButton="none" /> v-model="filterKeyword"
bgColor="#fff"
placeholder="搜索项目、设备、监测点"
cancelButton="none"
/>
</view> </view>
<view class="monitor-list"> <view class="monitor-list">
@@ -80,30 +108,43 @@
</view> </view>
<view class="params-section"> <view class="params-section">
<view v-for="(rowItems, rowIdx) in chunkedChildren(getDisplayChildren(point))" :key="rowIdx" <view
class="double-row"> v-for="(rowItems, rowIdx) in chunkedChildren(getDisplayChildren(point))"
:key="rowIdx"
class="double-row"
>
<view v-for="(child, childIdx) in rowItems" :key="childIdx" class="param-group"> <view v-for="(child, childIdx) in rowItems" :key="childIdx" class="param-group">
<view class="param-title"> <view class="param-title">
<text>{{ child.name }} {{ child.unit ? `(${child.unit})` : '' }}</text> <text>{{ child.name }} {{ child.unit ? `(${child.unit})` : '' }}</text>
</view> </view>
<view v-if="hasTPhaseData(child)" class="phase-single"> <view v-if="hasTPhaseData(child)" class="phase-single">
<text class="phase-value-vertical phase-value-vertical--neutral">{{ child.T <text class="phase-value-vertical phase-value-vertical--neutral">{{
child.T
}}</text> }}</text>
</view> </view>
<view v-else class="phase-vertical"> <view v-else class="phase-vertical">
<view class="phase-item-vertical"> <view class="phase-item-vertical">
<text class="phase-value-vertical" <text
:style="{ color: phaseColors[0].color }">{{ child.A }}</text> class="phase-value-vertical"
:style="{ color: phaseColors[0].color }"
>{{ child.A }}</text
>
</view> </view>
<view class="phase-divider" /> <view class="phase-divider" />
<view class="phase-item-vertical"> <view class="phase-item-vertical">
<text class="phase-value-vertical" <text
:style="{ color: phaseColors[1].color }">{{ child.B }}</text> class="phase-value-vertical"
:style="{ color: phaseColors[1].color }"
>{{ child.B }}</text
>
</view> </view>
<view class="phase-divider" /> <view class="phase-divider" />
<view class="phase-item-vertical"> <view class="phase-item-vertical">
<text class="phase-value-vertical" <text
:style="{ color: phaseColors[2].color }">{{ child.C }}</text> class="phase-value-vertical"
:style="{ color: phaseColors[2].color }"
>{{ child.C }}</text
>
</view> </view>
</view> </view>
</view> </view>
@@ -115,8 +156,10 @@
<text>更多指标</text> <text>更多指标</text>
</view> </view>
</view> </view>
<uni-load-more v-if="listStatus == 'loading' || filteredMonitoringPoints.length > 0" <uni-load-more
:status="listStatus"></uni-load-more> v-if="listStatus == 'loading' || filteredMonitoringPoints.length > 0"
:status="listStatus"
></uni-load-more>
<Cn-empty v-else-if="listStatus !== 'loading'" style="top: 45%"></Cn-empty> <Cn-empty v-else-if="listStatus !== 'loading'" style="top: 45%"></Cn-empty>
</view> </view>
</view> </view>
@@ -130,18 +173,32 @@
<view class="indicator-popup"> <view class="indicator-popup">
<view class="indicator-popup-header" @touchmove.stop.prevent> <view class="indicator-popup-header" @touchmove.stop.prevent>
<text class="indicator-popup-cancel" @click="closeIndicatorPopup">取消</text> <text class="indicator-popup-cancel" @click="closeIndicatorPopup">取消</text>
<text class="indicator-popup-title">{{ indicatorPopupSubtitle }}</text>
<text class="indicator-popup-confirm" @click="confirmIndicatorPopup">确定</text> <text class="indicator-popup-confirm" @click="confirmIndicatorPopup">确定</text>
</view> </view>
<scroll-view class="indicator-popup-list" scroll-y :show-scrollbar="false" @touchmove.stop> <scroll-view class="indicator-popup-list" scroll-y :show-scrollbar="false" @touchmove.stop>
<view v-if="targetLists.length === 0" class="indicator-popup-empty"> <view class="indicator-popup-section">
<!-- <text class="indicator-popup-subtitle">{{ indicatorPopupSubtitle }}</text> -->
<view v-if="currentPopupTargetLists.length === 0" class="indicator-popup-empty">
<text>暂无指标数据</text> <text>暂无指标数据</text>
</view> </view>
<view v-for="item in targetLists" :key="item.id || item.name" class="indicator-popup-item" <view
:class="{ 'indicator-popup-item--active': popupSelectedIndicators.includes(item.name) }" v-for="item in currentPopupTargetLists"
@click="togglePopupIndicator(item.name)"> :key="item.id || item.name"
class="indicator-popup-item"
:class="{
'indicator-popup-item--active': popupSelectedIndicators.includes(item.name),
}"
@click="togglePopupIndicator(item.name)"
>
<text>{{ item.name }}</text> <text>{{ item.name }}</text>
<uni-icons v-if="popupSelectedIndicators.includes(item.name)" type="checkmarkempty" size="18" <uni-icons
color="#376cf3" /> v-if="popupSelectedIndicators.includes(item.name)"
type="checkmarkempty"
size="18"
color="#376cf3"
/>
</view>
</view> </view>
</scroll-view> </scroll-view>
</view> </view>
@@ -157,18 +214,15 @@ import { getDevCount } from '@/common/api/device.js'
/** 无本地缓存时的默认展示指标:电压、电流 */ /** 无本地缓存时的默认展示指标:电压、电流 */
const DEFAULT_INDICATOR_CODES = ['Key_Power_Quality_V', 'Key_Power_Quality_I'] const DEFAULT_INDICATOR_CODES = ['Key_Power_Quality_V', 'Key_Power_Quality_I']
/** 治理测点(lineType=0)卡片默认展示指标 */ /** 治理测点无缓存时的默认展示指标 */
const GOVERNANCE_DEFAULT_INDICATORS = [ const GOVERNANCE_DEFAULT_INDICATOR_CODES = ['0', '1']
'电网电流',
'电网电压',
'负载电流',
'总输出电流',
]
export default { export default {
data() { data() {
return { return {
targetLists: [], targetLists: [],
targetListsPqCom: [],
indicatorPopupType: 'governance',
popupSelectedIndicators: [], popupSelectedIndicators: [],
engineeringName: '', engineeringName: '',
engineeringId: '', engineeringId: '',
@@ -178,6 +232,7 @@ export default {
{ label: '监测点总数', value: 0 }, { label: '监测点总数', value: 0 },
], ],
selectedIndicators: [], selectedIndicators: [],
selectedIndicatorsPqCom: [],
phaseColors: [ phaseColors: [
{ name: 'A相', color: '#DAA520' }, { name: 'A相', color: '#DAA520' },
{ name: 'B相', color: '#2E8B57' }, { name: 'B相', color: '#2E8B57' },
@@ -193,6 +248,12 @@ export default {
} }
}, },
computed: { computed: {
indicatorPopupSubtitle() {
return this.indicatorPopupType === 'governance' ? '治理监测点指标' : '非治理监测点指标'
},
currentPopupTargetLists() {
return this.indicatorPopupType === 'governance' ? this.targetListsPqCom : this.targetLists
},
filteredMonitoringPoints() { filteredMonitoringPoints() {
const keyword = (this.filterKeyword || '').trim().toLowerCase() const keyword = (this.filterKeyword || '').trim().toLowerCase()
if (!keyword) return this.monitoringPoints if (!keyword) return this.monitoringPoints
@@ -223,23 +284,25 @@ export default {
this.info() this.info()
} }
} }
if (this.targetLists.length && !skipRefresh) { if ((this.targetLists.length || this.targetListsPqCom.length) && !skipRefresh) {
this.loadSelectedIndicators() this.loadSelectedIndicators()
} }
}, },
// 加载电能质量指标字典 // 加载电能质量指标字典
created() { created() {
queryByCode('Key_Power_Quality').then((res) => { const loadDictTree = (code) => queryByCode(code).then((res) => queryCsDictTree(res.data.id))
queryCsDictTree(res.data.id).then((resp) => {
this.targetLists = (resp.data || []).slice().reverse() Promise.all([loadDictTree('Key_Power_Quality'), loadDictTree('Key_Power_Quality_Pq_Com')]).then(
([normalResp, pqComResp]) => {
this.targetLists = (normalResp.data || []).slice().reverse()
this.targetListsPqCom = (pqComResp.data || []).slice().reverse()
this.loadSelectedIndicators() this.loadSelectedIndicators()
}) },
}) )
}, },
// 下拉刷新 // 下拉刷新
onPullDownRefresh() { onPullDownRefresh() {
this.info() this.info()
}, },
methods: { methods: {
// 查询接口 // 查询接口
@@ -322,7 +385,7 @@ export default {
return order.map((key) => map[key]) return order.map((key) => map[key])
}, },
formatPhaseValue(value) { formatPhaseValue(value) {
if (value === null || value === undefined || value === '') return '-' if (value === null || value === undefined || value === '' || value === 3.14159) return '-'
const num = Number(value) const num = Number(value)
if (Number.isNaN(num)) return String(value) if (Number.isNaN(num)) return String(value)
return num.toFixed(2) return num.toFixed(2)
@@ -331,8 +394,7 @@ export default {
return child.T !== undefined && child.T !== null && child.T !== '-' return child.T !== undefined && child.T !== null && child.T !== '-'
}, },
updateSummaryStats(devCount = {}) { updateSummaryStats(devCount = {}) {
const deviceTotal = const deviceTotal = (devCount.currentOnLineDevCount || 0) + (devCount.currentOffLineDevCount || 0)
(devCount.currentOnLineDevCount || 0) + (devCount.currentOffLineDevCount || 0)
this.summaryStats = [ this.summaryStats = [
{ label: '项目总数', value: devCount.currentProjectCount || 0 }, { label: '项目总数', value: devCount.currentProjectCount || 0 },
@@ -353,8 +415,13 @@ export default {
const selectedBase = (selected || '').replace(/\(.*\)/, '').trim() const selectedBase = (selected || '').replace(/\(.*\)/, '').trim()
return base === selectedBase return base === selectedBase
}, },
// 从缓存读取已选指标,无缓存时使用默认电压/电流指标 // 从缓存读取已选指标,无缓存时使用默认指标
loadSelectedIndicators() { loadSelectedIndicators() {
this.loadNormalSelectedIndicators()
this.loadGovernanceSelectedIndicators()
},
loadNormalSelectedIndicators() {
if (!this.targetLists.length) return
const cached = uni.getStorageSync(this.$cacheKey.monitorSelectedIndicators) const cached = uni.getStorageSync(this.$cacheKey.monitorSelectedIndicators)
if (Array.isArray(cached) && cached.length) { if (Array.isArray(cached) && cached.length) {
const valid = cached.filter((name) => const valid = cached.filter((name) =>
@@ -368,35 +435,68 @@ export default {
this.selectedIndicators = this.getDefaultIndicatorsByCode() this.selectedIndicators = this.getDefaultIndicatorsByCode()
this.saveSelectedIndicators() this.saveSelectedIndicators()
}, },
loadGovernanceSelectedIndicators() {
if (!this.targetListsPqCom.length) return
const cached = uni.getStorageSync(this.$cacheKey.monitorSelectedIndicatorsPqCom)
if (Array.isArray(cached) && cached.length) {
const valid = cached.filter((name) =>
this.targetListsPqCom.some((item) => this.matchIndicator(item.name, name)),
)
if (valid.length) {
this.selectedIndicatorsPqCom = valid
return
}
}
this.selectedIndicatorsPqCom = this.getDefaultGovernanceIndicators()
this.saveSelectedIndicatorsPqCom()
},
getDefaultIndicatorsByCode() { getDefaultIndicatorsByCode() {
return this.targetLists return this.targetLists
.filter((item) => DEFAULT_INDICATOR_CODES.includes(item.code) && item.name) .filter((item) => DEFAULT_INDICATOR_CODES.includes(item.code) && item.name)
.map((item) => item.name) .map((item) => item.name)
}, },
getDefaultGovernanceIndicators() {
return this.targetListsPqCom
.filter((item) => GOVERNANCE_DEFAULT_INDICATOR_CODES.includes(item.code) && item.name)
.map((item) => item.name)
},
saveSelectedIndicators() { saveSelectedIndicators() {
uni.setStorageSync(this.$cacheKey.monitorSelectedIndicators, this.selectedIndicators) uni.setStorageSync(this.$cacheKey.monitorSelectedIndicators, this.selectedIndicators)
}, },
saveSelectedIndicatorsPqCom() {
uni.setStorageSync(this.$cacheKey.monitorSelectedIndicatorsPqCom, this.selectedIndicatorsPqCom)
},
// 跳转切换工程 // 跳转切换工程
switchEngineering() { switchEngineering() {
uni.navigateTo({ url: '/pages/home/selectEngineering' }) uni.navigateTo({ url: '/pages/home/selectEngineering' })
}, },
// 移除已选指标 // 移除已选指标
removeIndicator(idx) { removeIndicator(idx, type = 'normal') {
if (this.selectedIndicators.length <= 1) { const isGovernance = type === 'governance'
const selected = isGovernance ? this.selectedIndicatorsPqCom : this.selectedIndicators
if (selected.length <= 1) {
uni.showToast({ title: '至少保留一个指标', icon: 'none' }) uni.showToast({ title: '至少保留一个指标', icon: 'none' })
return return
} }
this.selectedIndicators.splice(idx, 1) selected.splice(idx, 1)
if (isGovernance) {
this.saveSelectedIndicatorsPqCom()
} else {
this.saveSelectedIndicators() this.saveSelectedIndicators()
}
}, },
// 打开指标选择弹窗 // 打开指标选择弹窗
openIndicatorPopup() { openIndicatorPopup(type = 'governance') {
if (!this.targetLists.length) { const isGovernance = type === 'governance'
const targetLists = isGovernance ? this.targetListsPqCom : this.targetLists
const selected = isGovernance ? this.selectedIndicatorsPqCom : this.selectedIndicators
if (!targetLists.length) {
uni.showToast({ title: '暂无指标数据', icon: 'none' }) uni.showToast({ title: '暂无指标数据', icon: 'none' })
return return
} }
this.popupSelectedIndicators = this.targetLists this.indicatorPopupType = type
.filter((item) => this.selectedIndicators.some((name) => this.matchIndicator(item.name, name))) this.popupSelectedIndicators = targetLists
.filter((item) => selected.some((name) => this.matchIndicator(item.name, name)))
.map((item) => item.name) .map((item) => item.name)
this.$refs.indicatorPopup.open() this.$refs.indicatorPopup.open()
}, },
@@ -404,6 +504,7 @@ export default {
closeIndicatorPopup() { closeIndicatorPopup() {
this.$refs.indicatorPopup.close() this.$refs.indicatorPopup.close()
this.popupSelectedIndicators = [] this.popupSelectedIndicators = []
this.indicatorPopupType = 'governance'
}, },
onIndicatorPopupChange(e) { onIndicatorPopupChange(e) {
this.indicatorPopupShow = !!e.show this.indicatorPopupShow = !!e.show
@@ -423,8 +524,13 @@ export default {
uni.showToast({ title: '至少保留一个指标', icon: 'none' }) uni.showToast({ title: '至少保留一个指标', icon: 'none' })
return return
} }
if (this.indicatorPopupType === 'governance') {
this.selectedIndicatorsPqCom = [...this.popupSelectedIndicators]
this.saveSelectedIndicatorsPqCom()
} else {
this.selectedIndicators = [...this.popupSelectedIndicators] this.selectedIndicators = [...this.popupSelectedIndicators]
this.saveSelectedIndicators() this.saveSelectedIndicators()
}
this.closeIndicatorPopup() this.closeIndicatorPopup()
}, },
// 跳转指标详情页,展示该监测点全部指标 // 跳转指标详情页,展示该监测点全部指标
@@ -439,17 +545,13 @@ export default {
url: '/pages/index/comp/targetInfo', url: '/pages/index/comp/targetInfo',
}) })
}, },
// 治理测点默认 4 项;普通测点按顶部已选指标过滤 // 按监测点类型取对应已选指标过滤展示
getDisplayChildren(point) { getDisplayChildren(point) {
const children = point.children || [] const children = point.children || []
if (point.lineType === 0) { const selected = point.lineType === 0 ? this.selectedIndicatorsPqCom : this.selectedIndicators
return GOVERNANCE_DEFAULT_INDICATORS.map((name) => return selected
children.find((child) => this.matchIndicator(child.name, name)), .map((name) => children.find((child) => this.matchIndicator(child.name, name)))
).filter(Boolean) .filter(Boolean)
}
return children.filter((child) =>
this.selectedIndicators.some((name) => this.matchIndicator(child.name, name)),
)
}, },
// 有指标数据时显示「更多指标」 // 有指标数据时显示「更多指标」
shouldShowMoreBtn(point) { shouldShowMoreBtn(point) {
@@ -471,6 +573,34 @@ export default {
}) })
this.showBackTop = false this.showBackTop = false
}, },
// 跳转页面
jump(idx) {
if (idx == 0) {
// 项目总数 -> 项目管理
const engineering = uni.getStorageSync('engineering') || {
id: this.engineeringId,
name: this.engineeringName,
}
if (!engineering?.id) {
return uni.showToast({
title: '请先选择工程',
icon: 'none',
})
}
uni.navigateTo({
url:
'/pages/project/list?engineeringName=' +
encodeURIComponent(engineering.name || '') +
'&engineeringId=' +
engineering.id,
})
} else if (idx == 1) {
// 设备总数
uni.navigateTo({
url: '/pages/device/list?type=nowEngineering',
})
}
},
}, },
} }
</script> </script>
@@ -545,7 +675,7 @@ export default {
gap: 6rpx; gap: 6rpx;
padding: 8rpx 20rpx; padding: 8rpx 20rpx;
border: 1rpx solid #376cf380; border: 1rpx solid #376cf380;
background-color: #266FFF10; background-color: #266fff10;
border-radius: 16rpx; border-radius: 16rpx;
flex-shrink: 0; flex-shrink: 0;
@@ -587,6 +717,21 @@ export default {
padding: 24rpx; padding: 24rpx;
} }
.indicator-group {
margin-bottom: 20rpx;
&:last-child {
margin-bottom: 0;
}
}
.indicator-group-title {
display: block;
margin-bottom: 12rpx;
font-size: 26rpx;
color: #666;
}
.section-title-row { .section-title-row {
display: flex; display: flex;
align-items: center; align-items: center;
@@ -736,8 +881,8 @@ export default {
flex-shrink: 0; flex-shrink: 0;
padding: 4rpx 12rpx; padding: 4rpx 12rpx;
font-size: 22rpx; font-size: 22rpx;
color: #2E8B57; color: #2e8b57;
background: #2E8B5715; background: #2e8b5715;
border-radius: 8rpx; border-radius: 8rpx;
line-height: 1.2; line-height: 1.2;
} }
@@ -832,7 +977,7 @@ export default {
line-height: 72rpx; line-height: 72rpx;
text-align: center; text-align: center;
border: 1rpx solid #376cf380; border: 1rpx solid #376cf380;
background-color: #266FFF10; background-color: #266fff10;
border-radius: 16rpx; border-radius: 16rpx;
text { text {
@@ -867,6 +1012,13 @@ export default {
min-width: 80rpx; min-width: 80rpx;
} }
.indicator-popup-title {
flex: 1;
text-align: center;
font-size: 28rpx;
font-weight: 600;
color: #333333;
}
.indicator-popup-confirm { .indicator-popup-confirm {
font-size: 28rpx; font-size: 28rpx;
@@ -877,12 +1029,23 @@ export default {
.indicator-popup-list { .indicator-popup-list {
height: 60vh; height: 60vh;
padding: 16rpx 0; padding: 8rpx 0 16rpx;
box-sizing: border-box; box-sizing: border-box;
} }
.indicator-popup-section {
padding-bottom: 8rpx;
}
.indicator-popup-subtitle {
display: block;
padding: 16rpx 32rpx 8rpx;
font-size: 24rpx;
color: #999999;
}
.indicator-popup-empty { .indicator-popup-empty {
padding: 80rpx 0; padding: 40rpx 0;
text-align: center; text-align: center;
font-size: 28rpx; font-size: 28rpx;
color: #999999; color: #999999;
@@ -892,8 +1055,8 @@ export default {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
padding: 28rpx 32rpx; padding: 20rpx 32rpx;
font-size: 28rpx; font-size: 26rpx;
color: #333333; color: #333333;
&--active { &--active {

View File

@@ -93,7 +93,7 @@ import { sm3Digest } from '@/common/js/sm3.js'
export default { export default {
data() { data() {
return { return {
checkbox: true, checkbox: false,
loading: false, loading: false,
loginType: 'pwd', loginType: 'pwd',
phone: '', phone: '',

View File

@@ -61,7 +61,7 @@ export default {
name: 'jiaban', name: 'jiaban',
data() { data() {
return { return {
checkbox: true, checkbox: false,
step: 1, step: 1,
loading: false, loading: false,
waitTime: 0, waitTime: 0,