重构
This commit is contained in:
@ -8,6 +8,31 @@ export function getDzjkHomeView(siteId) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 单站监控项目点位配置(供单站监控功能查询)
|
||||||
|
export function getProjectPointMapping(siteId) {
|
||||||
|
return request({
|
||||||
|
url: `/ems/siteMonitor/getProjectPointMapping?siteId=${siteId}`,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 单站监控项目展示数据(字段配置 + 最新值)
|
||||||
|
export function getProjectDisplayData(siteId) {
|
||||||
|
return request({
|
||||||
|
url: `/ems/siteMonitor/getProjectDisplayData?siteId=${siteId}`,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 单站监控项目展示数据写入(批量)
|
||||||
|
export function saveProjectDisplayData(data) {
|
||||||
|
return request({
|
||||||
|
url: `/ems/siteMonitor/saveProjectDisplayData`,
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
//站点首页 冲放曲线
|
//站点首页 冲放曲线
|
||||||
export function getSevenChargeData({siteId, startDate, endDate}) {
|
export function getSevenChargeData({siteId, startDate, endDate}) {
|
||||||
return request({
|
return request({
|
||||||
|
|||||||
@ -30,3 +30,11 @@ export function getAllBatteryIdsBySites(data) {
|
|||||||
method: 'get',
|
method: 'get',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 综合查询-按站点获取配置设备列表
|
||||||
|
export function getGeneralQueryDeviceList(siteId) {
|
||||||
|
return request({
|
||||||
|
url: `/ems/siteConfig/getDeviceList?siteId=${siteId}`,
|
||||||
|
method: 'get',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@ -8,6 +8,24 @@ export function getSiteInfoList({siteName, startTime, endTime, pageSize, pageNum
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 新增站点
|
||||||
|
export function addSite(data) {
|
||||||
|
return request({
|
||||||
|
url: `/ems/siteConfig/addSite`,
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 编辑站点
|
||||||
|
export function updateSite(data) {
|
||||||
|
return request({
|
||||||
|
url: `/ems/siteConfig/updateSite`,
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 设备列表
|
// 设备列表
|
||||||
export function getDeviceInfoList(data) {
|
export function getDeviceInfoList(data) {
|
||||||
return request({
|
return request({
|
||||||
@ -102,6 +120,23 @@ export function getDeviceListBySiteAndCategory({siteId, deviceCategory}) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取单站监控项目点位映射
|
||||||
|
export function getSingleMonitorProjectPointMapping(siteId) {
|
||||||
|
return request({
|
||||||
|
url: `/ems/siteConfig/getSingleMonitorProjectPointMapping?siteId=${siteId}`,
|
||||||
|
method: 'get',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 保存单站监控项目点位映射
|
||||||
|
export function saveSingleMonitorProjectPointMapping(data) {
|
||||||
|
return request({
|
||||||
|
url: `/ems/siteConfig/saveSingleMonitorProjectPointMapping`,
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
//新增设备保护
|
//新增设备保护
|
||||||
export function addProtectPlan(data) {
|
export function addProtectPlan(data) {
|
||||||
return request({
|
return request({
|
||||||
@ -163,6 +198,130 @@ export function importPointList(data) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 按站点导入模板点位配置
|
||||||
|
export function importPointTemplateBySite(data) {
|
||||||
|
return request({
|
||||||
|
url: `/ems/pointConfig/importTemplateBySite`,
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// CSV导入点位配置
|
||||||
|
export function importPointConfigCsv(data) {
|
||||||
|
return request({
|
||||||
|
url: `/ems/pointConfig/importCsv`,
|
||||||
|
method: 'post',
|
||||||
|
data,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'multipart/form-data'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 点位配置列表
|
||||||
|
export function getPointMatchList(params) {
|
||||||
|
return request({
|
||||||
|
url: `/ems/pointConfig/list`,
|
||||||
|
method: 'get',
|
||||||
|
params
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 点位配置详情
|
||||||
|
export function getPointMatchDetail(id) {
|
||||||
|
return request({
|
||||||
|
url: `/ems/pointConfig/${id}`,
|
||||||
|
method: 'get',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增点位配置
|
||||||
|
export function addPointMatch(data) {
|
||||||
|
return request({
|
||||||
|
url: `/ems/pointConfig`,
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 编辑点位配置
|
||||||
|
export function updatePointMatch(data) {
|
||||||
|
return request({
|
||||||
|
url: `/ems/pointConfig`,
|
||||||
|
method: 'put',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除点位配置
|
||||||
|
export function deletePointMatch(ids) {
|
||||||
|
return request({
|
||||||
|
url: `/ems/pointConfig/${ids}`,
|
||||||
|
method: 'delete',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 点位配置-批量获取最新值(新接口)
|
||||||
|
export function getPointConfigLatestValues(data) {
|
||||||
|
return request({
|
||||||
|
url: `/ems/pointConfig/latestValues`,
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 点位配置-曲线数据(新接口)
|
||||||
|
export function getPointConfigCurve(data) {
|
||||||
|
return request({
|
||||||
|
url: `/ems/pointConfig/curve`,
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 计算点配置列表
|
||||||
|
export function getPointCalcConfigList(params) {
|
||||||
|
return request({
|
||||||
|
url: `/ems/pointCalcConfig/list`,
|
||||||
|
method: 'get',
|
||||||
|
params
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 计算点配置详情
|
||||||
|
export function getPointCalcConfigDetail(id) {
|
||||||
|
return request({
|
||||||
|
url: `/ems/pointCalcConfig/${id}`,
|
||||||
|
method: 'get',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增计算点配置
|
||||||
|
export function addPointCalcConfig(data) {
|
||||||
|
return request({
|
||||||
|
url: `/ems/pointCalcConfig`,
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 编辑计算点配置
|
||||||
|
export function updatePointCalcConfig(data) {
|
||||||
|
return request({
|
||||||
|
url: `/ems/pointCalcConfig`,
|
||||||
|
method: 'put',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除计算点配置
|
||||||
|
export function deletePointCalcConfig(ids) {
|
||||||
|
return request({
|
||||||
|
url: `/ems/pointCalcConfig/${ids}`,
|
||||||
|
method: 'delete',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
//mqtt
|
//mqtt
|
||||||
export function getMqttList({pageSize, pageNum, mqttTopic, topicName, siteId}) {
|
export function getMqttList({pageSize, pageNum, mqttTopic, topicName, siteId}) {
|
||||||
|
|||||||
@ -9,13 +9,13 @@ export const dzjk = [
|
|||||||
redirect: '/dzjk/home',
|
redirect: '/dzjk/home',
|
||||||
meta: {title: '单站监控', icon: 'dashboard',},
|
meta: {title: '单站监控', icon: 'dashboard',},
|
||||||
alwaysShow: false,
|
alwaysShow: false,
|
||||||
name: 'Dzjk',
|
name: 'DzjkLocal',
|
||||||
hidden: true,
|
hidden: true,
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: '',
|
path: '',
|
||||||
component: () => import('@/views/ems/dzjk/index'),
|
component: () => import('@/views/ems/dzjk/index'),
|
||||||
name: 'Dzjk',
|
name: 'DzjkRoot',
|
||||||
redirect: '/dzjk/home',
|
redirect: '/dzjk/home',
|
||||||
hidden: true,
|
hidden: true,
|
||||||
children: [
|
children: [
|
||||||
@ -301,5 +301,3 @@ export const dzjk = [
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -89,6 +89,19 @@ export const constantRoutes = [
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: '/ems/site/zdlb',
|
||||||
|
component: Layout,
|
||||||
|
hidden: true,
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: 'monitor-point-mapping',
|
||||||
|
component: () => import('@/views/ems/site/zdlb/MonitorPointMapping.vue'),
|
||||||
|
name: 'MonitorPointMapping',
|
||||||
|
meta: { title: '单站监控项目点位配置', activeMenu: '/ems/site/zdlb' }
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
// EMS管理系统routers
|
// EMS管理系统routers
|
||||||
...dzjk
|
...dzjk
|
||||||
]
|
]
|
||||||
|
|||||||
@ -47,10 +47,13 @@ const permission = {
|
|||||||
const asyncRoutes = filterDynamicRoutes(dynamicRoutes)
|
const asyncRoutes = filterDynamicRoutes(dynamicRoutes)
|
||||||
rewriteRoutes.push({ path: '*', redirect: '/404', hidden: true })
|
rewriteRoutes.push({ path: '*', redirect: '/404', hidden: true })
|
||||||
router.addRoutes(asyncRoutes)
|
router.addRoutes(asyncRoutes)
|
||||||
if(!hasDzjk){
|
// 后端已下发 dzjk 菜单时,移除本地静态 dzjk 路由,避免重名/重复注册
|
||||||
|
if (hasDzjk) {
|
||||||
const index = constantRoutes.findIndex(i=>i.path.indexOf('dzjk')>-1)
|
const index = constantRoutes.findIndex(i=>i.path.indexOf('dzjk')>-1)
|
||||||
|
if (index > -1) {
|
||||||
constantRoutes.splice(index, 1)
|
constantRoutes.splice(index, 1)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
commit('SET_ROUTES', rewriteRoutes)
|
commit('SET_ROUTES', rewriteRoutes)
|
||||||
commit('SET_SIDEBAR_ROUTERS', constantRoutes.concat(sidebarRoutes))
|
commit('SET_SIDEBAR_ROUTERS', constantRoutes.concat(sidebarRoutes))
|
||||||
commit('SET_DEFAULT_ROUTES', sidebarRoutes)
|
commit('SET_DEFAULT_ROUTES', sidebarRoutes)
|
||||||
@ -121,11 +124,16 @@ export function filterDynamicRoutes(routes) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const loadView = (view) => {
|
export const loadView = (view) => {
|
||||||
|
const normalizedView = String(view || '')
|
||||||
|
.replace(/^\.\/+/, '')
|
||||||
|
.replace(/^\/+/, '')
|
||||||
|
.replace(/^@\/views\//, '')
|
||||||
|
|
||||||
if (process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'staging') {
|
if (process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'staging') {
|
||||||
return (resolve) => require([`@/views/${view}`], resolve)
|
return (resolve) => require([`@/views/${normalizedView}`], resolve)
|
||||||
} else {
|
} else {
|
||||||
// 使用 import 实现生产环境的路由懒加载
|
// 使用 import 实现生产环境的路由懒加载
|
||||||
return () => import(`@/views/${view}`)
|
return () => import(`@/views/${normalizedView}`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -10,7 +10,7 @@
|
|||||||
prop="siteIds"
|
prop="siteIds"
|
||||||
:rules="[{ required: true, message: '请选择站点' }]"
|
:rules="[{ required: true, message: '请选择站点' }]"
|
||||||
>
|
>
|
||||||
<el-radio-group v-model="form.siteIds" @input="changeSiteIds">
|
<el-radio-group v-model="form.siteIds">
|
||||||
<el-radio
|
<el-radio
|
||||||
v-for="(item, index) in siteList"
|
v-for="(item, index) in siteList"
|
||||||
:key="index + 'zdListSearch'"
|
:key="index + 'zdListSearch'"
|
||||||
@ -20,24 +20,103 @@
|
|||||||
</el-radio>
|
</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item
|
|
||||||
label="设备"
|
<div
|
||||||
prop="deviceCategory"
|
v-for="(group, index) in form.queryGroups"
|
||||||
:rules="[{ required: true, message: '请选择设备' }]"
|
:key="group.key"
|
||||||
|
class="query-group"
|
||||||
>
|
>
|
||||||
<el-radio-group v-model="form.deviceCategory" @input="changeSiteIds">
|
<div class="query-group-row">
|
||||||
<el-radio
|
<el-form-item :label="`设备 ${index + 1}`" class="group-device-item">
|
||||||
v-for="(item, index) in deviceCategoryList"
|
<el-select
|
||||||
:key="index + 'sbListSearch'"
|
v-model="group.deviceId"
|
||||||
:label="item.code"
|
clearable
|
||||||
|
filterable
|
||||||
|
placeholder="请选择设备"
|
||||||
|
style="width: 320px"
|
||||||
|
@change="(val) => handleDeviceChange(index, val)"
|
||||||
>
|
>
|
||||||
{{ item.name }}
|
<el-option
|
||||||
</el-radio>
|
v-for="(item, deviceIndex) in deviceList"
|
||||||
</el-radio-group>
|
:key="`${deviceIndex}-sbListSearch-${group.key}`"
|
||||||
|
:label="`${item.deviceName || item.deviceId}(${item.deviceId})`"
|
||||||
|
:value="item.deviceId"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item :label="`点位 ${index + 1}`" class="group-point-item">
|
||||||
|
<div class="point-select-wrapper">
|
||||||
|
<el-select
|
||||||
|
v-model="group.pointNames"
|
||||||
|
multiple
|
||||||
|
filterable
|
||||||
|
remote
|
||||||
|
clearable
|
||||||
|
collapse-tags
|
||||||
|
reserve-keyword
|
||||||
|
:disabled="!canSelectPoint(group)"
|
||||||
|
:placeholder="pointSelectPlaceholder(group)"
|
||||||
|
:remote-method="(query) => remotePointSearch(index, query)"
|
||||||
|
:loading="group.pointLoading"
|
||||||
|
:no-data-text="pointNoDataText(group)"
|
||||||
|
class="point-select"
|
||||||
|
@visible-change="(visible) => handlePointDropdownVisible(index, visible)"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in group.pointOptions"
|
||||||
|
:key="`${group.key}-${item.value}`"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
<div class="point-select-toolbar">
|
||||||
|
<span class="point-select-tip">已选 {{ group.pointNames.length }} 个点位</span>
|
||||||
|
<div>
|
||||||
|
<el-button
|
||||||
|
type="text"
|
||||||
|
size="mini"
|
||||||
|
:disabled="!canSelectPoint(group)"
|
||||||
|
@click="refreshPointOptions(index)"
|
||||||
|
>
|
||||||
|
刷新点位
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
type="text"
|
||||||
|
size="mini"
|
||||||
|
:disabled="group.pointNames.length === 0"
|
||||||
|
@click="clearPointSelection(index)"
|
||||||
|
>
|
||||||
|
清空选择
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<div class="group-action-area">
|
||||||
|
<el-button
|
||||||
|
v-if="index === form.queryGroups.length - 1"
|
||||||
|
type="primary"
|
||||||
|
icon="el-icon-plus"
|
||||||
|
circle
|
||||||
|
:disabled="form.queryGroups.length >= maxQueryGroups"
|
||||||
|
@click="addQueryGroup"
|
||||||
|
/>
|
||||||
|
<el-button
|
||||||
|
v-if="form.queryGroups.length > 1"
|
||||||
|
type="danger"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
circle
|
||||||
|
@click="removeQueryGroup(index)"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<el-form-item
|
<el-form-item
|
||||||
v-if="isDtdc"
|
v-if="isDtdc"
|
||||||
label="单体电池(不超过5个)"
|
label="单体电池(不超过5个,仅第一组设备为电池时生效)"
|
||||||
prop="child"
|
prop="child"
|
||||||
:rules="[{ required: true, message: '请选择单体电池' }]"
|
:rules="[{ required: true, message: '请选择单体电池' }]"
|
||||||
>
|
>
|
||||||
@ -50,22 +129,7 @@
|
|||||||
@change="handleChildChange"
|
@change="handleChildChange"
|
||||||
></el-cascader>
|
></el-cascader>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<div style="display: flex">
|
|
||||||
<el-form-item
|
|
||||||
label="点位"
|
|
||||||
prop="pointName"
|
|
||||||
:rules="[{ required: true, message: '请输入点位' }]"
|
|
||||||
style="margin-right: 50px"
|
|
||||||
>
|
|
||||||
<el-autocomplete
|
|
||||||
v-model="form.pointName"
|
|
||||||
placeholder="请输入点位"
|
|
||||||
clearable
|
|
||||||
:fetch-suggestions="querySearchAsync"
|
|
||||||
@select="handleSelect"
|
|
||||||
></el-autocomplete>
|
|
||||||
</el-form-item>
|
|
||||||
</div>
|
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" @click="submitForm">生成图表</el-button>
|
<el-button type="primary" @click="submitForm">生成图表</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -98,8 +162,14 @@
|
|||||||
import * as echarts from "echarts";
|
import * as echarts from "echarts";
|
||||||
import resize from "@/mixins/ems/resize";
|
import resize from "@/mixins/ems/resize";
|
||||||
import {getAllSites} from "@/api/ems/zddt";
|
import {getAllSites} from "@/api/ems/zddt";
|
||||||
import {getAllBatteryIdsBySites, getAllDeviceCategory, getPointValueList, pointFuzzyQuery,} from "@/api/ems/search";
|
import {
|
||||||
|
getAllBatteryIdsBySites,
|
||||||
|
getGeneralQueryDeviceList,
|
||||||
|
getPointValueList,
|
||||||
|
pointFuzzyQuery,
|
||||||
|
} from "@/api/ems/search";
|
||||||
import DateTimeSelect from "./DateTimeSelect.vue";
|
import DateTimeSelect from "./DateTimeSelect.vue";
|
||||||
|
import {debounce} from "@/utils";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Search",
|
name: "Search",
|
||||||
@ -107,13 +177,19 @@ export default {
|
|||||||
components: {DateTimeSelect},
|
components: {DateTimeSelect},
|
||||||
computed: {
|
computed: {
|
||||||
isDtdc() {
|
isDtdc() {
|
||||||
return this.form.deviceCategory === "BATTERY";
|
return this.form.queryGroups?.[0]?.deviceCategory === "BATTERY";
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
"form.siteIds": {
|
"form.siteIds": {
|
||||||
handler(newVal) {
|
handler(newVal) {
|
||||||
newVal && this.isDtdc && this.getChildList();
|
this.form.queryGroups = [this.createEmptyQueryGroup()];
|
||||||
|
this.form.child = [];
|
||||||
|
this.childOptions = [];
|
||||||
|
this.deviceList = [];
|
||||||
|
if (newVal) {
|
||||||
|
this.getDeviceListBySite(newVal);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
isDtdc: {
|
isDtdc: {
|
||||||
@ -123,8 +199,7 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
"form.dataUnit": {
|
"form.dataUnit": {
|
||||||
handler(newVal, oldVal) {
|
handler() {
|
||||||
console.log("wacth到了dataUnit的变化", newVal, oldVal);
|
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs.dateTimeSelect.init();
|
this.$refs.dateTimeSelect.init();
|
||||||
this.getDate();
|
this.getDate();
|
||||||
@ -135,24 +210,96 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
chart: null,
|
chart: null,
|
||||||
deviceCategoryList: [], //设备列表
|
deviceList: [],
|
||||||
siteList: [], //站点列表
|
siteList: [],
|
||||||
childOptions: [], //二级设备列表
|
childOptions: [],
|
||||||
|
maxQueryGroups: 10,
|
||||||
|
groupKeySeed: 0,
|
||||||
form: {
|
form: {
|
||||||
dataRange: [], //时间选择范围
|
dataRange: [],
|
||||||
child: [],
|
child: [],
|
||||||
siteIds: "", //当前选中的站点id 默认选中第一个站点
|
siteIds: "",
|
||||||
deviceCategory: "", //设备
|
queryGroups: [],
|
||||||
pointName: "", //点位
|
dataUnit: 1,
|
||||||
dataUnit: 1, //横坐标
|
|
||||||
},
|
},
|
||||||
loading: false,
|
loading: false,
|
||||||
|
debouncedPointSearchMap: {},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
created() {
|
||||||
|
this.form.queryGroups = [this.createEmptyQueryGroup()];
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
changeSiteIds(val) {
|
createEmptyQueryGroup() {
|
||||||
console.log("切换站点或设备清空点位", val);
|
this.groupKeySeed += 1;
|
||||||
val && (this.form.pointName = "");
|
return {
|
||||||
|
key: this.groupKeySeed,
|
||||||
|
deviceId: "",
|
||||||
|
deviceCategory: "",
|
||||||
|
pointNames: [],
|
||||||
|
pointOptions: [],
|
||||||
|
pointOptionsCache: {},
|
||||||
|
pointRequestId: 0,
|
||||||
|
pointLoading: false,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
getQueryGroup(index) {
|
||||||
|
return this.form.queryGroups[index];
|
||||||
|
},
|
||||||
|
addQueryGroup() {
|
||||||
|
if (this.form.queryGroups.length >= this.maxQueryGroups) {
|
||||||
|
this.$message.warning(`最多只能添加 ${this.maxQueryGroups} 组`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.form.queryGroups.push(this.createEmptyQueryGroup());
|
||||||
|
},
|
||||||
|
removeQueryGroup(index) {
|
||||||
|
if (this.form.queryGroups.length <= 1) return;
|
||||||
|
this.form.queryGroups.splice(index, 1);
|
||||||
|
if (index === 0) {
|
||||||
|
this.form.child = [];
|
||||||
|
}
|
||||||
|
},
|
||||||
|
canSelectPoint(group) {
|
||||||
|
return !!(this.form.siteIds && group && group.deviceId);
|
||||||
|
},
|
||||||
|
pointSelectPlaceholder(group) {
|
||||||
|
return this.canSelectPoint(group)
|
||||||
|
? "支持关键字搜索,展开可查看设备点位"
|
||||||
|
: "请先选择站点和设备";
|
||||||
|
},
|
||||||
|
pointNoDataText(group) {
|
||||||
|
return this.canSelectPoint(group) ? "暂无匹配点位" : "请先选择站点和设备";
|
||||||
|
},
|
||||||
|
getDeviceListBySite(siteId) {
|
||||||
|
if (!siteId) return Promise.resolve([]);
|
||||||
|
return getGeneralQueryDeviceList(siteId).then((response) => {
|
||||||
|
this.deviceList = response?.data || [];
|
||||||
|
return this.deviceList;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleDeviceChange(groupIndex, deviceId) {
|
||||||
|
const group = this.getQueryGroup(groupIndex);
|
||||||
|
if (!group) return;
|
||||||
|
const selected = this.deviceList.find((item) => item.deviceId === deviceId);
|
||||||
|
group.deviceCategory = selected?.deviceCategory || "";
|
||||||
|
group.pointNames = [];
|
||||||
|
group.pointOptions = [];
|
||||||
|
group.pointOptionsCache = {};
|
||||||
|
group.pointRequestId = 0;
|
||||||
|
group.pointLoading = false;
|
||||||
|
|
||||||
|
if (groupIndex === 0) {
|
||||||
|
this.form.child = [];
|
||||||
|
this.childOptions = [];
|
||||||
|
if (this.isDtdc) {
|
||||||
|
this.getChildList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.canSelectPoint(group)) {
|
||||||
|
this.fetchPointOptions(groupIndex, "");
|
||||||
|
}
|
||||||
},
|
},
|
||||||
getChildList() {
|
getChildList() {
|
||||||
this.childOptions = [];
|
this.childOptions = [];
|
||||||
@ -173,8 +320,8 @@ export default {
|
|||||||
const num = Math.ceil(length / base);
|
const num = Math.ceil(length / base);
|
||||||
if (num === 0) return;
|
if (num === 0) return;
|
||||||
for (let i = 1; i <= num; i++) {
|
for (let i = 1; i <= num; i++) {
|
||||||
const start = (i - 1) * base + 1,
|
const start = (i - 1) * base + 1;
|
||||||
end = i * base;
|
const end = i * base;
|
||||||
options[index].children.push({
|
options[index].children.push({
|
||||||
value: i,
|
value: i,
|
||||||
label: `${start}-${end}`,
|
label: `${start}-${end}`,
|
||||||
@ -188,12 +335,10 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
console.log("二级设备options", options);
|
|
||||||
this.childOptions = options;
|
this.childOptions = options;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleChildChange(data) {
|
handleChildChange(data) {
|
||||||
console.log("选择二级设备", data);
|
|
||||||
this.form.child = data;
|
this.form.child = data;
|
||||||
},
|
},
|
||||||
showLoading() {
|
showLoading() {
|
||||||
@ -210,27 +355,22 @@ export default {
|
|||||||
this.getDate();
|
this.getDate();
|
||||||
},
|
},
|
||||||
setOption(data) {
|
setOption(data) {
|
||||||
// 点位类型 dataType 1-瞬时值 2-累计值 仅当值为2展示差值
|
|
||||||
// 图表类型 chartType 1-曲线图,2-箱线图
|
|
||||||
if (!this.chart) return;
|
if (!this.chart) return;
|
||||||
this.chart.clear();
|
this.chart.clear();
|
||||||
console.log("返回的数据", data);
|
|
||||||
if (!data || data.length <= 0) {
|
if (!data || data.length <= 0) {
|
||||||
this.$message.warning("暂无数据");
|
this.$message.warning("暂无数据");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
console.log('展示的图表类型chartType', data[0].chartType)
|
|
||||||
|
|
||||||
if (data[0].chartType === 2) {
|
if (data[0].chartType === 2) {
|
||||||
// 箱型图
|
this.setBoxOption(data);
|
||||||
this.setBoxOption(data)
|
|
||||||
} else {
|
} else {
|
||||||
//折线图
|
this.setLineOption(data);
|
||||||
this.setLineOption(data)
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
setLineOption(data) {
|
setLineOption(data) {
|
||||||
let dataset = [];
|
let dataset = [];
|
||||||
data.forEach((item, index) => {
|
data.forEach((item) => {
|
||||||
item.deviceList.forEach((inner) => {
|
item.deviceList.forEach((inner) => {
|
||||||
dataset.push({
|
dataset.push({
|
||||||
name: `${
|
name: `${
|
||||||
@ -242,44 +382,38 @@ export default {
|
|||||||
markPoint: {
|
markPoint: {
|
||||||
symbolSize: 30,
|
symbolSize: 30,
|
||||||
emphasis: {
|
emphasis: {
|
||||||
disabled: false//打开 鼠标高亮
|
disabled: false,
|
||||||
},
|
},
|
||||||
data: [//最大值、最小值
|
data: [
|
||||||
{
|
{
|
||||||
// type: 'max',
|
name: "最大值",
|
||||||
name: `最大值`,
|
|
||||||
coord: [inner.maxDate, inner.maxValue],
|
coord: [inner.maxDate, inner.maxValue],
|
||||||
relativeTo: 'coordinate',
|
relativeTo: "coordinate",
|
||||||
label: {
|
label: {
|
||||||
position: "top",
|
position: "top",
|
||||||
formatter: item.dataType === 2 ? ([
|
formatter: item.dataType === 2
|
||||||
|
? [
|
||||||
`最大值:${inner.maxValue}`,
|
`最大值:${inner.maxValue}`,
|
||||||
// `平均值:${inner.avgValue}`,
|
|
||||||
`差值:${inner.diffValue}`,
|
`差值:${inner.diffValue}`,
|
||||||
]).join('\n') : ([
|
].join("\n")
|
||||||
`最大值:${inner.maxValue}`,
|
: [`最大值:${inner.maxValue}`].join("\n"),
|
||||||
// `平均值:${inner.avgValue}`,
|
|
||||||
]).join('\n'),
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// type: 'min',
|
name: "最小值",
|
||||||
name: `最小值`,
|
|
||||||
coord: [inner.minDate, inner.minValue],
|
coord: [inner.minDate, inner.minValue],
|
||||||
relativeTo: 'coordinate',
|
relativeTo: "coordinate",
|
||||||
label: {
|
label: {
|
||||||
position: "top",
|
position: "top",
|
||||||
formatter: item.dataType === 2 ? ([
|
formatter: item.dataType === 2
|
||||||
|
? [
|
||||||
`最小值:${inner.minValue}`,
|
`最小值:${inner.minValue}`,
|
||||||
// `平均值:${inner.avgValue}`,
|
|
||||||
`差值:${inner.diffValue}`,
|
`差值:${inner.diffValue}`,
|
||||||
]).join('\n') : ([
|
].join("\n")
|
||||||
`最小值:${inner.minValue}`,
|
: [`最小值:${inner.minValue}`].join("\n"),
|
||||||
// `平均值:${inner.avgValue}`,
|
},
|
||||||
]).join('\n'),
|
},
|
||||||
}
|
],
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
xdata: [],
|
xdata: [],
|
||||||
data: [],
|
data: [],
|
||||||
@ -291,24 +425,17 @@ export default {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
console.log("折线图图表数据", dataset);
|
|
||||||
this.chart.setOption({
|
this.chart.setOption({
|
||||||
legend: {
|
legend: {},
|
||||||
// left: 'center',
|
|
||||||
// top: '10',
|
|
||||||
},
|
|
||||||
grid: {
|
grid: {
|
||||||
containLabel: true,
|
containLabel: true,
|
||||||
},
|
},
|
||||||
tooltip: {
|
tooltip: {
|
||||||
trigger: "axis",
|
trigger: "axis",
|
||||||
axisPointer: {
|
axisPointer: {
|
||||||
type: 'cross',
|
type: "cross",
|
||||||
},
|
},
|
||||||
// axisPointer: {
|
|
||||||
// // 坐标轴指示器,坐标轴触发有效
|
|
||||||
// type: "shadow", // 默认为直线,可选为:'line' | 'shadow'
|
|
||||||
// },
|
|
||||||
},
|
},
|
||||||
textStyle: {
|
textStyle: {
|
||||||
color: "#333333",
|
color: "#333333",
|
||||||
@ -333,7 +460,7 @@ export default {
|
|||||||
},
|
},
|
||||||
setBoxOption(data) {
|
setBoxOption(data) {
|
||||||
let dataset = [];
|
let dataset = [];
|
||||||
data.forEach((item, index) => {
|
data.forEach((item) => {
|
||||||
item.deviceList.forEach((inner) => {
|
item.deviceList.forEach((inner) => {
|
||||||
dataset.push({
|
dataset.push({
|
||||||
name: `${
|
name: `${
|
||||||
@ -342,86 +469,33 @@ export default {
|
|||||||
: ""
|
: ""
|
||||||
}${inner.deviceId}`,
|
}${inner.deviceId}`,
|
||||||
type: "boxplot",
|
type: "boxplot",
|
||||||
// markPoint: {
|
|
||||||
// symbolSize: 30,
|
|
||||||
// emphasis: {
|
|
||||||
// disabled: false//打开 鼠标高亮
|
|
||||||
// },
|
|
||||||
// data: [//最大值、最小值
|
|
||||||
// {
|
|
||||||
// // type: 'max',
|
|
||||||
// name: `最大值`,
|
|
||||||
// coord: [inner.maxDate, inner.maxValue],
|
|
||||||
// relativeTo: 'coordinate',
|
|
||||||
// label: {
|
|
||||||
// position: "top",
|
|
||||||
// formatter: item.dataType === 2 ? ([
|
|
||||||
// `最大值:${inner.maxValue}`,
|
|
||||||
// // `平均值:${inner.avgValue}`,
|
|
||||||
// `差值:${inner.diffValue}`,
|
|
||||||
// ]).join('\n') : ([
|
|
||||||
// `最大值:${inner.maxValue}`,
|
|
||||||
// // `平均值:${inner.avgValue}`,
|
|
||||||
// ]).join('\n'),
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// // type: 'min',
|
|
||||||
// name: `最小值`,
|
|
||||||
// coord: [inner.minDate, inner.minValue],
|
|
||||||
// relativeTo: 'coordinate',
|
|
||||||
// label: {
|
|
||||||
// position: "top",
|
|
||||||
// formatter: item.dataType === 2 ? ([
|
|
||||||
// `最小值:${inner.minValue}`,
|
|
||||||
// // `平均值:${inner.avgValue}`,
|
|
||||||
// `差值:${inner.diffValue}`,
|
|
||||||
// ]).join('\n') : ([
|
|
||||||
// `最小值:${inner.minValue}`,
|
|
||||||
// // `平均值:${inner.avgValue}`,
|
|
||||||
// ]).join('\n'),
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// ]
|
|
||||||
// },
|
|
||||||
xdata: [],
|
xdata: [],
|
||||||
data: [],
|
data: [],
|
||||||
});
|
});
|
||||||
const length = dataset.length;
|
const length = dataset.length;
|
||||||
inner.pointValueList.forEach((value) => {
|
inner.pointValueList.forEach((value) => {
|
||||||
const {valueDate, min, q1, median, q3, max} = value
|
const {valueDate, min, q1, median, q3, max} = value;
|
||||||
dataset[length - 1].xdata.push(valueDate);
|
dataset[length - 1].xdata.push(valueDate);
|
||||||
dataset[length - 1].data.push([min, q1, median, q3, max]);
|
dataset[length - 1].data.push([min, q1, median, q3, max]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
console.log("箱型图图表数据", dataset);
|
|
||||||
this.chart.setOption({
|
this.chart.setOption({
|
||||||
legend: {
|
legend: {},
|
||||||
// left: 'center',
|
|
||||||
// top: '10',
|
|
||||||
},
|
|
||||||
grid: {
|
grid: {
|
||||||
containLabel: true,
|
containLabel: true,
|
||||||
},
|
},
|
||||||
tooltip: {
|
tooltip: {
|
||||||
trigger: 'item',
|
trigger: "item",
|
||||||
formatter: function (params) {
|
formatter: function (params) {
|
||||||
let data = params.data;
|
let itemData = params.data;
|
||||||
let result = params.marker + params.name + ' ' + params.seriesName + '<br/>';
|
let result = params.marker + params.name + " " + params.seriesName + "<br/>";
|
||||||
result += '最小值: ' + data[1] + '<br/>';
|
result += "最小值: " + itemData[1] + "<br/>";
|
||||||
result += '平均值: ' + data[3] + '<br/>';
|
result += "平均值: " + itemData[3] + "<br/>";
|
||||||
result += '最大值: ' + data[5];
|
result += "最大值: " + itemData[5];
|
||||||
return result;
|
return result;
|
||||||
}
|
},
|
||||||
// trigger: "axis",
|
|
||||||
// axisPointer: {
|
|
||||||
// type: 'cross',
|
|
||||||
// },
|
|
||||||
// axisPointer: {
|
|
||||||
// // 坐标轴指示器,坐标轴触发有效
|
|
||||||
// type: "shadow", // 默认为直线,可选为:'line' | 'shadow'
|
|
||||||
// },
|
|
||||||
},
|
},
|
||||||
textStyle: {
|
textStyle: {
|
||||||
color: "#333333",
|
color: "#333333",
|
||||||
@ -447,105 +521,189 @@ export default {
|
|||||||
submitForm() {
|
submitForm() {
|
||||||
this.getDate();
|
this.getDate();
|
||||||
},
|
},
|
||||||
handleSelect(data) {
|
getPointCacheKey(group, query = "") {
|
||||||
this.form.pointName = data.value;
|
return `${this.form.siteIds}_${group.deviceId}_${query.trim()}`;
|
||||||
},
|
},
|
||||||
querySearchAsync(query, cb) {
|
normalizePointOptions(data = []) {
|
||||||
console.log("查询数据", query);
|
return (data || []).map((item) => {
|
||||||
if (!this.form.siteIds || !this.form.deviceCategory) {
|
if (typeof item === "string") {
|
||||||
this.$message({
|
return {value: item, label: item, pointName: item, dataKey: "", pointDesc: ""};
|
||||||
type: "warning",
|
|
||||||
message: "请先选择站点和设备",
|
|
||||||
});
|
|
||||||
return cb([]);
|
|
||||||
}
|
}
|
||||||
pointFuzzyQuery({
|
const pointName = item?.pointName || item?.value || "";
|
||||||
|
const dataKey = item?.dataKey || "";
|
||||||
|
const pointDesc = item?.pointDesc || "";
|
||||||
|
const labelParts = [pointName];
|
||||||
|
if (dataKey && dataKey !== pointName) {
|
||||||
|
labelParts.push(`key:${dataKey}`);
|
||||||
|
}
|
||||||
|
if (pointDesc) {
|
||||||
|
labelParts.push(pointDesc);
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
value: pointName,
|
||||||
|
label: labelParts.join(" | "),
|
||||||
|
pointName,
|
||||||
|
dataKey,
|
||||||
|
pointDesc,
|
||||||
|
};
|
||||||
|
}).filter((item) => item.value);
|
||||||
|
},
|
||||||
|
setPointOptions(group, data = []) {
|
||||||
|
const selected = group.pointNames || [];
|
||||||
|
const selectedOptions = selected.map((value) => ({value, label: value, pointName: value}));
|
||||||
|
const normalized = this.normalizePointOptions(data);
|
||||||
|
const merged = [...selectedOptions, ...normalized];
|
||||||
|
const seen = {};
|
||||||
|
group.pointOptions = merged.filter((item) => {
|
||||||
|
if (!item?.value || seen[item.value]) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
seen[item.value] = true;
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
fetchPointOptions(groupIndex, query = "", {force = false} = {}) {
|
||||||
|
const group = this.getQueryGroup(groupIndex);
|
||||||
|
if (!group || !this.canSelectPoint(group)) return Promise.resolve([]);
|
||||||
|
const normalizedQuery = (query || "").trim();
|
||||||
|
const cacheKey = this.getPointCacheKey(group, normalizedQuery);
|
||||||
|
if (!force && group.pointOptionsCache[cacheKey]) {
|
||||||
|
this.setPointOptions(group, group.pointOptionsCache[cacheKey]);
|
||||||
|
return Promise.resolve(group.pointOptionsCache[cacheKey]);
|
||||||
|
}
|
||||||
|
const requestId = ++group.pointRequestId;
|
||||||
|
group.pointLoading = true;
|
||||||
|
return pointFuzzyQuery({
|
||||||
siteIds: [this.form.siteIds],
|
siteIds: [this.form.siteIds],
|
||||||
deviceCategory: this.form.deviceCategory,
|
deviceCategory: group.deviceCategory,
|
||||||
pointName: query,
|
deviceId: group.deviceId,
|
||||||
}).then((response) => {
|
pointName: normalizedQuery,
|
||||||
const data = response?.data || [];
|
|
||||||
cb(
|
|
||||||
data.map((item) => {
|
|
||||||
return {name: item, value: item};
|
|
||||||
})
|
})
|
||||||
);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
// 获取所有设备
|
|
||||||
getDeviceCategory() {
|
|
||||||
return getAllDeviceCategory().then((response) => {
|
|
||||||
this.deviceCategoryList = response?.data || [];
|
|
||||||
});
|
|
||||||
},
|
|
||||||
getZdList() {
|
|
||||||
return getAllSites()
|
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
this.siteList = response.data || [];
|
if (requestId !== group.pointRequestId) return [];
|
||||||
|
const data = this.normalizePointOptions(response?.data || []);
|
||||||
|
group.pointOptionsCache[cacheKey] = data;
|
||||||
|
this.setPointOptions(group, data);
|
||||||
|
return data;
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
|
if (requestId === group.pointRequestId) {
|
||||||
|
group.pointLoading = false;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getDate() {
|
getDebouncedPointSearch(groupIndex) {
|
||||||
this.$refs.form.validate((valid) => {
|
if (!this.debouncedPointSearchMap[groupIndex]) {
|
||||||
if (valid) {
|
this.debouncedPointSearchMap[groupIndex] = debounce((query) => {
|
||||||
if (!this.form.pointName) {
|
this.fetchPointOptions(groupIndex, query);
|
||||||
return this.$message.error("请输入正确的点位");
|
}, 260);
|
||||||
}
|
}
|
||||||
if (
|
return this.debouncedPointSearchMap[groupIndex];
|
||||||
this.isDtdc &&
|
},
|
||||||
(this.form.child.length === 0 || this.form.child.length > 5)
|
remotePointSearch(groupIndex, query) {
|
||||||
) {
|
const group = this.getQueryGroup(groupIndex);
|
||||||
return this.$message.error("请选择单体电池且不能超过5个");
|
if (!group || !this.canSelectPoint(group)) return;
|
||||||
|
this.getDebouncedPointSearch(groupIndex)(query);
|
||||||
|
},
|
||||||
|
handlePointDropdownVisible(groupIndex, visible) {
|
||||||
|
const group = this.getQueryGroup(groupIndex);
|
||||||
|
if (visible && group && this.canSelectPoint(group)) {
|
||||||
|
this.fetchPointOptions(groupIndex, "");
|
||||||
}
|
}
|
||||||
const {
|
},
|
||||||
siteIds,
|
refreshPointOptions(groupIndex) {
|
||||||
dataUnit,
|
const group = this.getQueryGroup(groupIndex);
|
||||||
deviceCategory,
|
if (!group || !this.canSelectPoint(group)) return;
|
||||||
pointName,
|
this.fetchPointOptions(groupIndex, "", {force: true});
|
||||||
dataRange: [start = "", end = ""],
|
},
|
||||||
child,
|
clearPointSelection(groupIndex) {
|
||||||
} = this.form;
|
const group = this.getQueryGroup(groupIndex);
|
||||||
if (!start || !end) return this.$message.error("请选择时间");
|
if (!group) return;
|
||||||
|
group.pointNames = [];
|
||||||
|
},
|
||||||
|
getZdList() {
|
||||||
|
return getAllSites().then((response) => {
|
||||||
|
this.siteList = response.data || [];
|
||||||
|
});
|
||||||
|
},
|
||||||
|
buildSiteDeviceMap() {
|
||||||
let siteDeviceMap = {};
|
let siteDeviceMap = {};
|
||||||
child.forEach(([first, second, third]) => {
|
this.form.child.forEach(([first, second, third]) => {
|
||||||
if (siteDeviceMap[first]) {
|
if (siteDeviceMap[first]) {
|
||||||
siteDeviceMap[first].push(third);
|
siteDeviceMap[first].push(third);
|
||||||
} else {
|
} else {
|
||||||
siteDeviceMap[first] = [];
|
siteDeviceMap[first] = [third];
|
||||||
siteDeviceMap[first].push(third);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
let startDate, endDate;
|
return siteDeviceMap;
|
||||||
|
},
|
||||||
|
getDate() {
|
||||||
|
this.$refs.form.validate((valid) => {
|
||||||
|
if (!valid) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const activeGroups = this.form.queryGroups
|
||||||
|
.map((group, index) => ({group, index}))
|
||||||
|
.filter(({group}) => group.deviceId && group.pointNames && group.pointNames.length > 0);
|
||||||
|
|
||||||
|
if (activeGroups.length === 0) {
|
||||||
|
return this.$message.error("请至少选择1组设备和点位");
|
||||||
|
}
|
||||||
|
|
||||||
|
const invalidGroupIndex = this.form.queryGroups.findIndex(
|
||||||
|
(group) => group.deviceId && (!group.pointNames || group.pointNames.length === 0)
|
||||||
|
);
|
||||||
|
if (invalidGroupIndex !== -1) {
|
||||||
|
return this.$message.error(`第 ${invalidGroupIndex + 1} 组请至少选择1个点位`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.isDtdc && (this.form.child.length === 0 || this.form.child.length > 5)) {
|
||||||
|
return this.$message.error("请选择单体电池且不能超过5个");
|
||||||
|
}
|
||||||
|
|
||||||
|
const {
|
||||||
|
siteIds,
|
||||||
|
dataUnit,
|
||||||
|
dataRange: [start = "", end = ""],
|
||||||
|
} = this.form;
|
||||||
|
|
||||||
|
if (!start || !end) return this.$message.error("请选择时间");
|
||||||
|
|
||||||
|
let startDate = start;
|
||||||
|
let endDate = end;
|
||||||
if (start && dataUnit === 3) {
|
if (start && dataUnit === 3) {
|
||||||
// startDate= start + `${dataUnit === 2 ? ':00' : ' 00:00:00'}`
|
|
||||||
startDate = start + " 00:00:00";
|
startDate = start + " 00:00:00";
|
||||||
} else {
|
|
||||||
startDate = start;
|
|
||||||
}
|
}
|
||||||
if (end && dataUnit === 3) {
|
if (end && dataUnit === 3) {
|
||||||
// endDate= end + `${dataUnit === 2 ? ':00' : ' 00:00:00'}`
|
|
||||||
endDate = end + " 00:00:00";
|
endDate = end + " 00:00:00";
|
||||||
} else {
|
|
||||||
endDate = end;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
getPointValueList({
|
|
||||||
|
const requests = activeGroups.map(({group, index}) => {
|
||||||
|
const useChildMap = index === 0 && group.deviceCategory === "BATTERY";
|
||||||
|
return getPointValueList({
|
||||||
siteIds: [siteIds],
|
siteIds: [siteIds],
|
||||||
dataUnit,
|
dataUnit,
|
||||||
deviceCategory,
|
deviceId: group.deviceId,
|
||||||
pointName,
|
deviceCategory: group.deviceCategory,
|
||||||
|
pointNames: group.pointNames,
|
||||||
|
pointName: group.pointNames.join(","),
|
||||||
startDate,
|
startDate,
|
||||||
endDate,
|
endDate,
|
||||||
siteDeviceMap,
|
siteDeviceMap: useChildMap ? this.buildSiteDeviceMap() : {},
|
||||||
})
|
}).then((response) => response?.data || []);
|
||||||
.then((response) => {
|
});
|
||||||
this.setOption(response?.data || []);
|
|
||||||
|
Promise.all(requests)
|
||||||
|
.then((groupResults) => {
|
||||||
|
const merged = groupResults.flat();
|
||||||
|
this.setOption(merged);
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
});
|
});
|
||||||
}
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -561,12 +719,58 @@ export default {
|
|||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.initChart();
|
this.initChart();
|
||||||
this.$refs.dateTimeSelect.init();
|
this.$refs.dateTimeSelect.init();
|
||||||
Promise.all([this.getDeviceCategory(), this.getZdList()]).finally(
|
Promise.all([this.getZdList()]).finally(() => (this.loading = false));
|
||||||
() => (this.loading = false)
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped></style>
|
<style lang="scss" scoped>
|
||||||
|
.query-group {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
padding: 10px 12px 0;
|
||||||
|
border: 1px solid #ebeef5;
|
||||||
|
border-radius: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.query-group-row {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-start;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.group-device-item {
|
||||||
|
margin-right: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.group-point-item {
|
||||||
|
margin-right: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.point-select-wrapper {
|
||||||
|
width: 420px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.point-select {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.point-select-toolbar {
|
||||||
|
margin-top: 6px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.point-select-tip {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #909399;
|
||||||
|
}
|
||||||
|
|
||||||
|
.group-action-area {
|
||||||
|
padding-top: 34px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
1235
src/views/ems/site/pointConfig/index.vue
Normal file
1235
src/views/ems/site/pointConfig/index.vue
Normal file
File diff suppressed because it is too large
Load Diff
@ -95,19 +95,6 @@
|
|||||||
label="操作"
|
label="操作"
|
||||||
width="250">
|
width="250">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button
|
|
||||||
@click="pointDetail(scope.row,'point')"
|
|
||||||
type="primary"
|
|
||||||
size="mini">
|
|
||||||
点位清单
|
|
||||||
</el-button>
|
|
||||||
<el-button
|
|
||||||
@click="pointDetail(scope.row,'alarmPoint')"
|
|
||||||
type="primary"
|
|
||||||
size="mini">
|
|
||||||
报警点位清单
|
|
||||||
</el-button>
|
|
||||||
<br>
|
|
||||||
<el-button
|
<el-button
|
||||||
@click="downloadPointDetail(scope.row,true)"
|
@click="downloadPointDetail(scope.row,true)"
|
||||||
style="margin-top:10px;"
|
style="margin-top:10px;"
|
||||||
@ -167,7 +154,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
<add-device ref="addDevice" :mode="mode" :id="editDeviceId" @update="getData" @clear="clearEditDeviceData"/>
|
<add-device ref="addDevice" :mode="mode" :id="editDeviceId" @update="getData" @clear="clearEditDeviceData"/>
|
||||||
<point-table ref="pointTable"/>
|
|
||||||
<point-upload ref="pointUpload" @update="getData"/>
|
<point-upload ref="pointUpload" @update="getData"/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -177,14 +163,13 @@ import {deleteService, getDeviceDetailInfo, getDeviceInfoList} from '@/api/ems/s
|
|||||||
import {getAllSites} from '@/api/ems/zddt'
|
import {getAllSites} from '@/api/ems/zddt'
|
||||||
import {formatNumber} from "@/filters/ems";
|
import {formatNumber} from "@/filters/ems";
|
||||||
import {getAllDeviceCategory} from '@/api/ems/search'
|
import {getAllDeviceCategory} from '@/api/ems/search'
|
||||||
import PointTable from './PointTable.vue'
|
|
||||||
import AddDevice from "./AddDevice.vue";
|
import AddDevice from "./AddDevice.vue";
|
||||||
import PointUpload from "./PointUpload.vue";
|
import PointUpload from "./PointUpload.vue";
|
||||||
// import PcsSwitch from "./PcsSwitch.vue";
|
// import PcsSwitch from "./PcsSwitch.vue";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Sblb",
|
name: "Sblb",
|
||||||
components: {AddDevice, PointTable, PointUpload},
|
components: {AddDevice, PointUpload},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
loading: false,
|
loading: false,
|
||||||
@ -230,10 +215,6 @@ export default {
|
|||||||
this.deviceCategoryList = response?.data || []
|
this.deviceCategoryList = response?.data || []
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 查看设备电位表格
|
|
||||||
pointDetail(row, dataType) {
|
|
||||||
this.$refs.pointTable.showTable(row, dataType)
|
|
||||||
},
|
|
||||||
// 下载点位清单
|
// 下载点位清单
|
||||||
downloadPointDetail(command, isDetail = false) {
|
downloadPointDetail(command, isDetail = false) {
|
||||||
const siteId = isDetail ? command.siteId : this.siteId
|
const siteId = isDetail ? command.siteId : this.siteId
|
||||||
|
|||||||
217
src/views/ems/site/zdlb/MonitorPointMapping.vue
Normal file
217
src/views/ems/site/zdlb/MonitorPointMapping.vue
Normal file
@ -0,0 +1,217 @@
|
|||||||
|
<template>
|
||||||
|
<div class="ems-dashboard-editor-container" style="background-color:#ffffff">
|
||||||
|
<div class="header-row">
|
||||||
|
<div class="title-block">
|
||||||
|
<div class="page-title">单站监控项目点位配置</div>
|
||||||
|
<div class="page-desc">站点:{{ siteName || siteId || '-' }}</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<el-button @click="goBack">返回</el-button>
|
||||||
|
<el-button type="primary" @click="saveData">保存</el-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<el-alert
|
||||||
|
title="当前字段清单与点位映射均从后端表读取,保存后可直接用于单站监控查询。"
|
||||||
|
type="info"
|
||||||
|
:closable="false"
|
||||||
|
style="margin-top: 16px;"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<el-tabs v-model="activeTopMenu" style="margin-top: 16px;">
|
||||||
|
<el-tab-pane
|
||||||
|
v-for="topMenu in topMenuList"
|
||||||
|
:key="topMenu.code"
|
||||||
|
:label="topMenu.name"
|
||||||
|
:name="topMenu.code"
|
||||||
|
>
|
||||||
|
<el-table
|
||||||
|
v-if="!topMenu.children || topMenu.children.length === 0"
|
||||||
|
class="common-table"
|
||||||
|
:data="topMenu.items"
|
||||||
|
stripe
|
||||||
|
>
|
||||||
|
<el-table-column prop="section" label="分组" min-width="180" />
|
||||||
|
<el-table-column prop="name" label="页面展示名称" min-width="280" />
|
||||||
|
<el-table-column prop="field" label="字段名" min-width="260" />
|
||||||
|
<el-table-column label="点位" min-width="420">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-input
|
||||||
|
v-model.trim="scope.row.point"
|
||||||
|
placeholder="请输入点位"
|
||||||
|
clearable
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<el-tabs
|
||||||
|
v-else
|
||||||
|
v-model="activeChildMap[topMenu.code]"
|
||||||
|
class="child-menu-tabs"
|
||||||
|
type="border-card"
|
||||||
|
>
|
||||||
|
<el-tab-pane
|
||||||
|
v-for="child in topMenu.children"
|
||||||
|
:key="child.code"
|
||||||
|
:label="child.name"
|
||||||
|
:name="child.code"
|
||||||
|
>
|
||||||
|
<el-table class="common-table" :data="child.items" stripe>
|
||||||
|
<el-table-column prop="section" label="分组" min-width="180" />
|
||||||
|
<el-table-column prop="name" label="页面展示名称" min-width="280" />
|
||||||
|
<el-table-column prop="field" label="字段名" min-width="260" />
|
||||||
|
<el-table-column label="点位" min-width="420">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-input
|
||||||
|
v-model.trim="scope.row.point"
|
||||||
|
placeholder="请输入点位"
|
||||||
|
clearable
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { getSingleMonitorProjectPointMapping, saveSingleMonitorProjectPointMapping } from '@/api/ems/site'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'MonitorPointMapping',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
activeTopMenu: 'HOME',
|
||||||
|
activeChildMap: {},
|
||||||
|
topMenuList: []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
siteId() {
|
||||||
|
return this.$route.query.siteId || ''
|
||||||
|
},
|
||||||
|
siteName() {
|
||||||
|
return this.$route.query.siteName || ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
goBack() {
|
||||||
|
this.$router.back()
|
||||||
|
},
|
||||||
|
async initMenuStructure() {
|
||||||
|
if (!this.siteId) {
|
||||||
|
this.topMenuList = []
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const response = await getSingleMonitorProjectPointMapping(this.siteId)
|
||||||
|
const list = response?.data || []
|
||||||
|
const topMap = new Map()
|
||||||
|
const childMap = new Map()
|
||||||
|
|
||||||
|
list.forEach((row, index) => {
|
||||||
|
const moduleCode = row.moduleCode || 'UNKNOWN'
|
||||||
|
const moduleName = row.moduleName || '未分组'
|
||||||
|
const menuCode = row.menuCode || moduleCode
|
||||||
|
const menuName = row.menuName || moduleName
|
||||||
|
const topKey = moduleCode
|
||||||
|
if (!topMap.has(topKey)) {
|
||||||
|
topMap.set(topKey, {
|
||||||
|
code: moduleCode,
|
||||||
|
name: moduleName,
|
||||||
|
children: [],
|
||||||
|
items: []
|
||||||
|
})
|
||||||
|
}
|
||||||
|
const item = {
|
||||||
|
code: `${moduleCode}_${menuCode}_${row.fieldCode || index}`,
|
||||||
|
section: row.sectionName || '-',
|
||||||
|
name: row.fieldName || '-',
|
||||||
|
field: row.fieldCode || '',
|
||||||
|
point: row.dataPoint || ''
|
||||||
|
}
|
||||||
|
const topItem = topMap.get(topKey)
|
||||||
|
const isTopDirect = moduleCode === menuCode || moduleCode === 'HOME'
|
||||||
|
if (isTopDirect) {
|
||||||
|
topItem.items.push(item)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const childKey = `${moduleCode}_${menuCode}`
|
||||||
|
if (!childMap.has(childKey)) {
|
||||||
|
const child = { code: menuCode, name: menuName, items: [] }
|
||||||
|
childMap.set(childKey, child)
|
||||||
|
topItem.children.push(child)
|
||||||
|
}
|
||||||
|
childMap.get(childKey).items.push(item)
|
||||||
|
})
|
||||||
|
|
||||||
|
this.topMenuList = Array.from(topMap.values())
|
||||||
|
const firstTop = this.topMenuList[0]
|
||||||
|
this.activeTopMenu = firstTop ? firstTop.code : 'HOME'
|
||||||
|
this.activeChildMap = {}
|
||||||
|
this.topMenuList.forEach(top => {
|
||||||
|
if (top.children && top.children.length > 0) {
|
||||||
|
this.$set(this.activeChildMap, top.code, top.children[0].code)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getAllMappingRows() {
|
||||||
|
const rows = []
|
||||||
|
this.topMenuList.forEach(top => {
|
||||||
|
;(top.items || []).forEach(item => rows.push(item))
|
||||||
|
;(top.children || []).forEach(child => {
|
||||||
|
;(child.items || []).forEach(item => rows.push(item))
|
||||||
|
})
|
||||||
|
})
|
||||||
|
return rows
|
||||||
|
},
|
||||||
|
async saveData() {
|
||||||
|
if (!this.siteId) {
|
||||||
|
this.$message.warning('缺少站点ID')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const mappings = this.getAllMappingRows()
|
||||||
|
.filter(item => item.field)
|
||||||
|
.map(item => ({ fieldCode: item.field, dataPoint: item.point || '' }))
|
||||||
|
await saveSingleMonitorProjectPointMapping({ siteId: this.siteId, mappings })
|
||||||
|
this.$message.success('保存成功')
|
||||||
|
await this.initMenuStructure()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async mounted() {
|
||||||
|
await this.initMenuStructure()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.header-row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title-block {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-title {
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #303133;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-desc {
|
||||||
|
margin-top: 6px;
|
||||||
|
font-size: 13px;
|
||||||
|
color: #909399;
|
||||||
|
}
|
||||||
|
|
||||||
|
.child-menu-tabs {
|
||||||
|
margin-top: 8px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="ems-dashboard-editor-container" style="background-color: #ffffff" v-loading="loading">
|
<div class="ems-dashboard-editor-container" style="background-color: #ffffff" v-loading="loading">
|
||||||
<el-form :inline="true" class="select-container">
|
<el-form :inline="true" class="select-container">
|
||||||
@ -24,6 +23,7 @@
|
|||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" @click="onSearch" native-type="button">搜索</el-button>
|
<el-button type="primary" @click="onSearch" native-type="button">搜索</el-button>
|
||||||
<el-button @click="onReset" native-type="button">重置</el-button>
|
<el-button @click="onReset" native-type="button">重置</el-button>
|
||||||
|
<el-button type="success" @click="openAddDialog" native-type="button">新增站点</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<el-table
|
<el-table
|
||||||
@ -57,6 +57,15 @@
|
|||||||
prop="installCapacity"
|
prop="installCapacity"
|
||||||
label="装机容量">
|
label="装机容量">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label="操作"
|
||||||
|
width="220"
|
||||||
|
fixed="right">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button type="text" size="small" @click="openEditDialog(scope.row)">编辑</el-button>
|
||||||
|
<el-button type="text" size="small" @click="openPointMappingPage(scope.row)">配置</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
<el-pagination
|
<el-pagination
|
||||||
v-show="tableData.length>0"
|
v-show="tableData.length>0"
|
||||||
@ -71,33 +80,132 @@
|
|||||||
style="margin-top:15px;text-align: center"
|
style="margin-top:15px;text-align: center"
|
||||||
>
|
>
|
||||||
</el-pagination>
|
</el-pagination>
|
||||||
|
|
||||||
|
<el-dialog
|
||||||
|
:title="isEdit ? '编辑站点' : '新增站点'"
|
||||||
|
:visible.sync="dialogVisible"
|
||||||
|
width="640px"
|
||||||
|
:close-on-click-modal="false">
|
||||||
|
<el-form ref="siteForm" :model="siteForm" :rules="siteRules" label-width="100px">
|
||||||
|
<el-row :gutter="16">
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="站点ID" prop="siteId">
|
||||||
|
<el-input v-model.trim="siteForm.siteId" :disabled="isEdit" placeholder="仅支持字母/数字/下划线" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="站点名称" prop="siteName">
|
||||||
|
<el-input v-model.trim="siteForm.siteName" placeholder="请输入站点名称" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="16">
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="运营时间" prop="runningTime">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="siteForm.runningTime"
|
||||||
|
type="datetime"
|
||||||
|
value-format="yyyy-MM-dd HH:mm:ss"
|
||||||
|
placeholder="请选择运营时间"
|
||||||
|
style="width: 100%"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="站点地址" prop="siteAddress">
|
||||||
|
<el-input v-model.trim="siteForm.siteAddress" placeholder="请输入站点地址" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="16">
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="装机功率" prop="installPower">
|
||||||
|
<el-input v-model="siteForm.installPower" placeholder="请输入装机功率" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="装机容量" prop="installCapacity">
|
||||||
|
<el-input v-model="siteForm.installCapacity" placeholder="请输入装机容量" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="16">
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="纬度" prop="latitude">
|
||||||
|
<el-input v-model="siteForm.latitude" placeholder="请输入纬度" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="经度" prop="longitude">
|
||||||
|
<el-input v-model="siteForm.longitude" placeholder="请输入经度" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input v-model.trim="siteForm.remark" type="textarea" :rows="3" placeholder="请输入备注" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||||
|
<el-button type="primary" :loading="submitLoading" @click="submitSite">确 定</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {getSiteInfoList} from '@/api/ems/site'
|
import {addSite, getSiteInfoList, updateSite} from '@/api/ems/site'
|
||||||
import { formatDate } from '@/filters/ems'
|
import { formatDate } from '@/filters/ems'
|
||||||
|
|
||||||
|
const emptySiteForm = () => ({
|
||||||
|
id: undefined,
|
||||||
|
siteId: '',
|
||||||
|
siteName: '',
|
||||||
|
siteAddress: '',
|
||||||
|
runningTime: '',
|
||||||
|
installPower: '',
|
||||||
|
installCapacity: '',
|
||||||
|
latitude: '',
|
||||||
|
longitude: '',
|
||||||
|
remark: ''
|
||||||
|
})
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Zdlb",
|
name: 'Zdlb',
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
loading: false,
|
loading: false,
|
||||||
siteName:"",
|
submitLoading: false,
|
||||||
|
siteName: '',
|
||||||
pickerOptions: {
|
pickerOptions: {
|
||||||
disabledDate(time) {
|
disabledDate(time) {
|
||||||
return time.getTime() > Date.now();
|
return time.getTime() > Date.now();
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
defaultDateRange:[],//默认展示的时间
|
defaultDateRange: [],
|
||||||
dateRange:[],//startTime,endTime
|
dateRange: [],
|
||||||
tableData: [],
|
tableData: [],
|
||||||
pageSize:10,//分页栏当前每个数据总数
|
pageSize: 10,
|
||||||
pageNum:1,//分页栏当前页数
|
pageNum: 1,
|
||||||
totalSize:0,//table表格数据总数
|
totalSize: 0,
|
||||||
|
dialogVisible: false,
|
||||||
|
isEdit: false,
|
||||||
|
siteForm: emptySiteForm(),
|
||||||
|
siteRules: {
|
||||||
|
siteId: [
|
||||||
|
{ required: true, message: '请输入站点ID', trigger: 'blur' },
|
||||||
|
{ pattern: /^[A-Za-z0-9_]+$/, message: '站点ID仅支持字母、数字、下划线', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
siteName: [
|
||||||
|
{ required: true, message: '请输入站点名称', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
runningTime: [
|
||||||
|
{ required: true, message: '请选择运营时间', trigger: 'change' }
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 分页
|
|
||||||
handleSizeChange(val) {
|
handleSizeChange(val) {
|
||||||
this.pageSize = val;
|
this.pageSize = val;
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
@ -110,19 +218,16 @@ export default {
|
|||||||
this.getData()
|
this.getData()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 搜索
|
|
||||||
onSearch() {
|
onSearch() {
|
||||||
this.pageNum =1//每次搜索从1开始搜索
|
this.pageNum = 1
|
||||||
this.getData()
|
this.getData()
|
||||||
},
|
},
|
||||||
// 重置
|
|
||||||
onReset() {
|
onReset() {
|
||||||
this.siteName = ''
|
this.siteName = ''
|
||||||
this.dateRange = []
|
this.dateRange = []
|
||||||
this.pageNum =1//每次搜索从1开始搜索
|
this.pageNum = 1
|
||||||
this.getData()
|
this.getData()
|
||||||
},
|
},
|
||||||
// 获取数据
|
|
||||||
getData() {
|
getData() {
|
||||||
this.loading = true
|
this.loading = true
|
||||||
const {siteName, pageNum, pageSize} = this
|
const {siteName, pageNum, pageSize} = this
|
||||||
@ -130,8 +235,62 @@ export default {
|
|||||||
getSiteInfoList({siteName, pageSize, pageNum, startTime: formatDate(startTime), endTime: formatDate(endTime)}).then(response => {
|
getSiteInfoList({siteName, pageSize, pageNum, startTime: formatDate(startTime), endTime: formatDate(endTime)}).then(response => {
|
||||||
this.tableData = response?.rows || [];
|
this.tableData = response?.rows || [];
|
||||||
this.totalSize = response?.total || 0
|
this.totalSize = response?.total || 0
|
||||||
}).finally(() => {this.loading=false})
|
}).finally(() => {
|
||||||
|
this.loading = false
|
||||||
|
})
|
||||||
},
|
},
|
||||||
|
openAddDialog() {
|
||||||
|
this.isEdit = false
|
||||||
|
this.siteForm = emptySiteForm()
|
||||||
|
this.dialogVisible = true
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.siteForm && this.$refs.siteForm.clearValidate()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
openEditDialog(row) {
|
||||||
|
this.isEdit = true
|
||||||
|
this.siteForm = {
|
||||||
|
id: row.id,
|
||||||
|
siteId: row.siteId || '',
|
||||||
|
siteName: row.siteName || '',
|
||||||
|
siteAddress: row.siteAddress || '',
|
||||||
|
runningTime: row.runningTime || '',
|
||||||
|
installPower: row.installPower || '',
|
||||||
|
installCapacity: row.installCapacity || '',
|
||||||
|
latitude: row.latitude || '',
|
||||||
|
longitude: row.longitude || '',
|
||||||
|
remark: row.remark || ''
|
||||||
|
}
|
||||||
|
this.dialogVisible = true
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.siteForm && this.$refs.siteForm.clearValidate()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
openPointMappingPage(row) {
|
||||||
|
this.$router.push({
|
||||||
|
path: '/ems/site/zdlb/monitor-point-mapping',
|
||||||
|
query: {
|
||||||
|
siteId: row.siteId,
|
||||||
|
siteName: row.siteName || ''
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
submitSite() {
|
||||||
|
this.$refs.siteForm.validate(valid => {
|
||||||
|
if (!valid) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.submitLoading = true
|
||||||
|
const request = this.isEdit ? updateSite : addSite
|
||||||
|
request(this.siteForm).then(() => {
|
||||||
|
this.$message.success(this.isEdit ? '编辑成功' : '新增成功')
|
||||||
|
this.dialogVisible = false
|
||||||
|
this.getData()
|
||||||
|
}).finally(() => {
|
||||||
|
this.submitLoading = false
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.onReset()
|
this.onReset()
|
||||||
|
|||||||
@ -47,7 +47,7 @@ module.exports = {
|
|||||||
// }
|
// }
|
||||||
// 当请求前缀是/dev-api时,使用下面的代理
|
// 当请求前缀是/dev-api时,使用下面的代理
|
||||||
'/dev-api': {
|
'/dev-api': {
|
||||||
target: 'http://110.40.171.179:8089',
|
target: 'http://localhost:8089',
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
pathRewrite: {
|
pathRewrite: {
|
||||||
'^/dev-api': ''
|
'^/dev-api': ''
|
||||||
|
|||||||
Reference in New Issue
Block a user