综合查询相关接口不再使用中文categoryName统一使用deviceCategory

This commit is contained in:
白菜
2025-10-16 16:10:29 +08:00
parent fb0eda4565
commit f4e6821484
14 changed files with 130 additions and 141 deletions

View File

@ -54,7 +54,13 @@ export function deleteService(id) {
method: 'delete',
})
}
// 获取上级设备id列表
export function getParentDeviceId({siteId,deviceCategory}) {
return request({
url: `/ems/siteConfig/getParentDeviceId?siteId=${siteId}&deviceCategory=${deviceCategory}`,
method: 'get',
})
}
//获取所有设备
export function getDeviceList(siteId) {
return request({
@ -64,9 +70,9 @@ export function getDeviceList(siteId) {
}
//获取设备点位table
export function getDevicePointList({siteId,deviceId,deviceCategory,pageNum,pageSize,dataPointName='',sortMethod,sortData,dataPoint,lower,upper}) {
export function getDevicePointList({siteId,deviceId,deviceCategory,parentDeviceId,pageNum,pageSize,dataPointName='',sortMethod,sortData,dataPoint,lower,upper}) {
return request({
url: `/ems/siteConfig/getDevicePointList?siteId=${siteId}&deviceId=${deviceId}&pageNum=${pageNum}&pageSize=${pageSize}&deviceCategory=${deviceCategory}&dataPointName=${dataPointName}&dataPoint=${dataPoint}&lower=${lower}&upper=${upper}&pageNum=${pageNum}&sortMethod=${sortMethod}&sortData=${sortData}`,
url: `/ems/siteConfig/getDevicePointList?siteId=${siteId}&deviceId=${deviceId}&pageNum=${pageNum}&pageSize=${pageSize}&deviceCategory=${deviceCategory}&dataPointName=${dataPointName}&parentDeviceId=${parentDeviceId}&dataPoint=${dataPoint}&lower=${lower}&upper=${upper}&pageNum=${pageNum}&sortMethod=${sortMethod}&sortData=${sortData}`,
method: 'get',
})
}

View File

@ -42,43 +42,43 @@ export const dzjk=[
path: 'ssyx',
component: () => import('@/views/ems/dzjk/sbjk/ssyx/index.vue'),
name: 'DzjkSbjkSsyx',
meta: { title: '实时运行',breadcrumb: false,activeMenu: '/dzjk',activeSecondMenuName:'DzjkSbjk',categoryName:'SSYX'},
meta: { title: '实时运行',breadcrumb: false,activeMenu: '/dzjk',activeSecondMenuName:'DzjkSbjk',deviceCategory:'SSYX'},
},
{
path: 'pcs',
component: () => import('@/views/ems/dzjk/sbjk/pcs/index.vue'),
name: 'DzjkSbjkPcs',
meta: { title: 'PCS',breadcrumb: false,activeMenu: '/dzjk',activeSecondMenuName:'DzjkSbjk',categoryName:'PCS'},
meta: { title: 'PCS',breadcrumb: false,activeMenu: '/dzjk',activeSecondMenuName:'DzjkSbjk',deviceCategory:'PCS'},
},
{
path: 'bmszl',
component: () => import('@/views/ems/dzjk/sbjk/bmszl/index.vue'),
name: 'DzjkSbjkBmszl',
meta: { title: 'BMS总览',breadcrumb: false,activeMenu: '/dzjk',activeSecondMenuName:'DzjkSbjk', categoryName:'STACK'},
meta: { title: 'BMS总览',breadcrumb: false,activeMenu: '/dzjk',activeSecondMenuName:'DzjkSbjk', deviceCategory:'STACK'},
},
{
path: 'bmsdcc',
component: () => import('@/views/ems/dzjk/sbjk/bmsdcc/index.vue'),
name: 'DzjkSbjkBmsdcc',
meta: { title: 'BMS电池簇',breadcrumb: false,activeMenu: '/dzjk',activeSecondMenuName:'DzjkSbjk',categoryName:'CLUSTER'},
meta: { title: 'BMS电池簇',breadcrumb: false,activeMenu: '/dzjk',activeSecondMenuName:'DzjkSbjk',deviceCategory:'CLUSTER'},
},
{
path: 'dtdc',
component: () => import('@/views/ems/dzjk/sbjk/dtdc/index.vue'),
name: 'DzjkSbjkDtdc',
meta: { title: '单体电池',breadcrumb: false,activeMenu: '/dzjk',activeSecondMenuName:'DzjkSbjk',categoryName:'BATTERY'},
meta: { title: '单体电池',breadcrumb: false,activeMenu: '/dzjk',activeSecondMenuName:'DzjkSbjk',deviceCategory:'BATTERY'},
},
{
path: 'db',
component: () => import('@/views/ems/dzjk/sbjk/db/index.vue'),
name: 'DzjkSbjkDb',
meta: { title: '电表',breadcrumb: false,activeMenu: '/dzjk',activeSecondMenuName:'DzjkSbjk',categoryName:'AMMETER'},
meta: { title: '电表',breadcrumb: false,activeMenu: '/dzjk',activeSecondMenuName:'DzjkSbjk',deviceCategory:'AMMETER'},
},
{
path: 'yl',
component: () => import('@/views/ems/dzjk/sbjk/yl/index.vue'),
name: 'DzjkSbjkYl',
meta: { title: '液冷',breadcrumb: false,activeMenu: '/dzjk',activeSecondMenuName:'DzjkSbjk',categoryName:'COOLING'},
meta: { title: '液冷',breadcrumb: false,activeMenu: '/dzjk',activeSecondMenuName:'DzjkSbjk',deviceCategory:'COOLING'},
}
]
},

View File

@ -10,7 +10,7 @@
append-to-body
width="1000px"
class="ems-dialog"
:before-close="handleColsed"
:before-close="handleClosed"
>
<el-card
shadow="always"
@ -50,14 +50,14 @@ export default {
},
computed: {
isDtdc() {
return this.categoryName === "单体电池";
return this.deviceCategory === "BATTERY";
},
},
watch: {
show(val) {
if (!val) {
this.pointName = "";
this.categoryName = "";
this.deviceCategory = "";
this.deviceId = "";
this.dataUnit = 1;
this.child = "";
@ -88,15 +88,15 @@ export default {
dataRange: [],
child: "", //单体电池需要数据
pointName: "",
categoryName: "",
deviceCategory: "",
deviceId: "",
};
},
methods: {
showChart({ pointName, categoryName, deviceId, child = "" }) {
showChart({ pointName, deviceCategory, deviceId, child = "" }) {
//初始化数据
this.pointName = pointName;
this.categoryName = categoryName;
this.deviceCategory = deviceCategory;
this.deviceId = deviceId;
child && (this.child = child);
this.show = true;
@ -123,7 +123,7 @@ export default {
dataRange: [start = "", end = ""],
child,
deviceId,
categoryName,
deviceCategory,
pointName,
} = this;
let siteDeviceMap = {};
@ -146,7 +146,7 @@ export default {
siteIds: [siteId],
deviceId,
dataUnit,
categoryName,
deviceCategory,
pointName,
startDate,
endDate,
@ -170,9 +170,9 @@ export default {
dataset.push({
name: `${
this.isDtdc
? `${inner.parentDeviceId ? inner.parentDeviceId + "-" : ""}`
: ""
}${this.isDtdc ? inner.deviceId : this.pointName}`,
? `${inner.parentDeviceId ? inner.parentDeviceId + "-" : ""}${inner.deviceId}`
: `${inner.deviceId}`
}`,
type: "line",
xdata: [],
data: [],
@ -228,7 +228,7 @@ export default {
this.dataRange = val || [];
this.getDate();
},
handleColsed(done) {
handleClosed(done) {
if (!this.chart) {
return done();
}

View File

@ -20,7 +20,7 @@
<div class="descriptions-main descriptions-main-bg-color">
<el-descriptions direction="vertical" :column="3" :colon="false">
<el-descriptions-item labelClassName="descriptions-label" contentClassName="descriptions-direction" v-for="(item,index) in infoData" :key="index+'pcsInfoData'" :span="1" :label="item.label">
<span class="pointer" @click="showChart(item.pointName || '','电池簇',baseInfo.deviceId)">
<span class="pointer" @click="showChart(item.pointName || '',baseInfo.deviceId)">
{{baseInfo[item.attr] | formatNumber}} <span v-if="item.unit" v-html="item.unit"></span>
</span>
</el-descriptions-item>
@ -30,7 +30,7 @@
<div class="process-line-bg">
<div class="process-line" :style="{height:baseInfo.currentSoc+'%'}"></div>
</div>
<div class="process pointer" @click="showChart( '当前SOC','电池簇',baseInfo.deviceId)">当前SOC : {{baseInfo.currentSoc}}%</div>
<div class="process pointer" @click="showChart( '当前SOC',baseInfo.deviceId)">当前SOC : {{baseInfo.currentSoc}}%</div>
</div>
</div>
<el-table
@ -50,14 +50,14 @@
label="单体平均值"
>
<template slot-scope="scope">
<span class="pointer" @click="showChart( tablePointNameMap[scope.row.dataName+scope.column.label],'电池簇',baseInfo.deviceId)">{{scope.row.avgData}}</span>
<span class="pointer" @click="showChart( tablePointNameMap[scope.row.dataName+scope.column.label],baseInfo.deviceId)">{{scope.row.avgData}}</span>
</template>
</el-table-column>
<el-table-column
prop="minData"
label="单体最小值">
<template slot-scope="scope">
<span class="pointer" @click="showChart( tablePointNameMap[scope.row.dataName+scope.column.label],'电池簇',baseInfo.deviceId)">{{scope.row.minData}}</span>
<span class="pointer" @click="showChart( tablePointNameMap[scope.row.dataName+scope.column.label],baseInfo.deviceId)">{{scope.row.minData}}</span>
</template>
</el-table-column>
<el-table-column
@ -68,7 +68,7 @@
prop="maxData"
label="单体最大值">
<template slot-scope="scope">
<span class="pointer " @click="showChart( tablePointNameMap[scope.row.dataName+scope.column.label],'电池簇',baseInfo.deviceId)">{{scope.row.maxData}}</span>
<span class="pointer " @click="showChart( tablePointNameMap[scope.row.dataName+scope.column.label],baseInfo.deviceId)">{{scope.row.maxData}}</span>
</template>
</el-table-column>
<el-table-column
@ -127,9 +127,8 @@ export default {
}
},
methods:{
showChart(pointName,categoryName,deviceId){
console.log('点击查询图表',pointName,categoryName,deviceId)
pointName && this.$refs.pointChart.showChart({pointName,categoryName,deviceId})
showChart(pointName,deviceId){
pointName && this.$refs.pointChart.showChart({pointName,deviceCategory:'CLUSTER',deviceId})
},
updateData(){
this.loading = true

View File

@ -47,26 +47,26 @@
label="簇电压"
>
<template slot-scope="scope">
<span class="pointer" @click="showChart('簇电压','电池簇',scope.row.clusterId)">{{scope.row.clusterVoltage}} V</span>
<span class="pointer" @click="showChart('簇电压',scope.row.clusterId)">{{scope.row.clusterVoltage}} V</span>
</template>
</el-table-column>
<el-table-column
label="簇电流">
<template slot-scope="scope">
<span class="pointer" @click="showChart('簇电流','电池簇',scope.row.clusterId)">{{scope.row.clusterCurrent}} A</span>
<span class="pointer" @click="showChart('簇电流',scope.row.clusterId)">{{scope.row.clusterCurrent}} A</span>
</template>
</el-table-column>
<el-table-column
label="簇SOC">
<template slot-scope="scope">
<span class="pointer" @click="showChart('当前SOC','电池簇',scope.row.clusterId)">{{scope.row.currentSoc}} %</span>
<span class="pointer" @click="showChart('当前SOC',scope.row.clusterId)">{{scope.row.currentSoc}} %</span>
</template>
</el-table-column>
<el-table-column
label="单体最高电压"
prop="maxVoltage">
<template slot-scope="scope">
<span class="pointer" @click="showChart('最高单体电压','电池簇',scope.row.clusterId)">{{scope.row.maxCellVoltage}} V</span>
<span class="pointer" @click="showChart('最高单体电压',scope.row.clusterId)">{{scope.row.maxCellVoltage}} V</span>
</template>
</el-table-column>
<el-table-column
@ -77,7 +77,7 @@
label="单体最低电压"
prop="minVoltage">
<template slot-scope="scope">
<span class="pointer" @click="showChart('最低单体电压','电池簇',scope.row.clusterId)">{{scope.row.minCellVoltage}} V</span>
<span class="pointer" @click="showChart('最低单体电压',scope.row.clusterId)">{{scope.row.minCellVoltage}} V</span>
</template>
</el-table-column>
<el-table-column
@ -87,7 +87,7 @@
<el-table-column
label="单体最高温度">
<template slot-scope="scope">
<span class="pointer" @click="showChart('最高单体温度','电池簇',scope.row.clusterId)">{{scope.row.maxCellTemp}} &#8451;</span>
<span class="pointer" @click="showChart('最高单体温度',scope.row.clusterId)">{{scope.row.maxCellTemp}} &#8451;</span>
</template>
</el-table-column>
<el-table-column
@ -98,7 +98,7 @@
label="单体最低温度"
prop="minTemperature">
<template slot-scope="scope">
<span class="pointer" @click="showChart('最低单体温度','电池簇',scope.row.clusterId)">{{scope.row.minCellTemp}} &#8451;</span>
<span class="pointer" @click="showChart('最低单体温度',scope.row.clusterId)">{{scope.row.minCellTemp}} &#8451;</span>
</template>
</el-table-column>
<el-table-column
@ -141,9 +141,8 @@ export default {
}
},
methods:{
showChart(pointName,categoryName,deviceId){
console.log('点击查询图表',pointName,categoryName,deviceId)
pointName && this.$refs.pointChart.showChart({pointName,categoryName,deviceId})
showChart(pointName,deviceId){
pointName && this.$refs.pointChart.showChart({pointName,deviceCategory:'STACK',deviceId})
},
updateData(){
this.loading = true

View File

@ -25,7 +25,7 @@
</div>
<el-row>
<el-col v-for="(tempDataItem,tempDataIndex) in deviceIdTypeMsg[item.deviceId]" :key="tempDataIndex+'dbTempData'" :span="8">
<span class="pointer" @click="showChart(tempDataItem.pointName,item.deviceName,item.deviceId)">
<span class="pointer" @click="showChart(tempDataItem.pointName,item.deviceId)">
{{tempDataItem.name}}{{item[tempDataItem.attr]}}<span v-html="tempDataItem.unit"></span>
</span>
</el-col>
@ -140,9 +140,8 @@ export default {
};
},
methods: {
showChart(pointName,categoryName,deviceId){
console.log('点击查询图表',pointName,categoryName,deviceId)
pointName && this.$refs.pointChart.showChart({pointName,categoryName,deviceId})
showChart(pointName,deviceId){
pointName && this.$refs.pointChart.showChart({pointName,deviceCategory:'AMMETER',deviceId})
},
updateData(){
this.loading = true;

View File

@ -174,7 +174,7 @@ export default {
dataType &&
this.$refs.pointChart.showChart({
pointName: dataType,
categoryName: "单体电池",
deviceCategory:'BATTERY',
deviceId: clusterDeviceId,
child: [deviceId],
});

View File

@ -38,10 +38,10 @@ export default {
return this.zdDeviceCategoryOptions[this.siteId] || []
},
categoryRouter(){
const routeData =this.childrenRoute.filter(item=>this.locationSiteCategory.includes(item.meta.categoryName))
const routeData =this.childrenRoute.filter(item=>this.locationSiteCategory.includes(item.meta.deviceCategory))
if(this.siteId && routeData.length > 0 && this.locationSiteCategory && this.locationSiteCategory.length >1){
const locationPageCategoryName = this.$route.meta?.categoryName || ''
if(!routeData.some(item=> item.meta.categoryName===locationPageCategoryName)){
const locationPageDeviceCategory = this.$route.meta?.deviceCategory || ''
if(!routeData.some(item=> item.meta.deviceCategory===locationPageDeviceCategory)){
this.$router.replace({path:'/dzjk/sbjk/ssyx',query:this.$route.query})
}
}

View File

@ -100,7 +100,7 @@
<span
class="pointer"
@click="
showChart(item.pointName || '', 'PCS', pcsItem.deviceId)
showChart(item.pointName || '', pcsItem.deviceId)
"
>
{{ pcsItem[item.attr] | formatNumber }}
@ -136,7 +136,7 @@
>
<span
class="pointer"
@click="showChart('直流功率', 'PCS分支设备', item.deviceId)"
@click="showChart('直流功率', item.deviceId,true)"
>{{ item.dcPower }}kW</span
>
</el-descriptions-item>
@ -148,7 +148,7 @@
>
<span
class="pointer"
@click="showChart('直流电压', 'PCS分支设备', item.deviceId)"
@click="showChart('直流电压', item.deviceId,true)"
>{{ item.dcVoltage }}V</span
>
</el-descriptions-item>
@ -160,7 +160,7 @@
>
<span
class="pointer"
@click="showChart('直流电流', 'PCS分支设备', item.deviceId)"
@click="showChart('直流电流', item.deviceId,true)"
>{{ item.dcCurrent }}A</span
>
</el-descriptions-item>
@ -169,7 +169,6 @@
</el-card>
</div>
<el-empty v-show="pcsList.length <= 0" :image-size="200"></el-empty>
<!-- 电位图表 showChart({pointName:点位名称,categoryName:设备名称})-->
<point-chart ref="pointChart" :site-id="siteId" />
</div>
</template>
@ -270,10 +269,9 @@ export default {
};
},
methods: {
showChart(pointName, categoryName, deviceId) {
console.log("点击查询图表", pointName, categoryName, deviceId);
showChart(pointName, deviceId,isBranch=false) {
pointName &&
this.$refs.pointChart.showChart({ pointName, categoryName, deviceId });
this.$refs.pointChart.showChart({ pointName,deviceCategory:isBranch ? 'BRANCH' : 'PCS', deviceId });
},
//6个方块数据
getRunningHeadData() {

View File

@ -11,7 +11,7 @@
</div>
<el-row>
<el-col v-for="(tempDataItem,tempDataIndex) in tempData" :key="tempDataIndex+'ylTempData'" :span="8">
<span class="pointer" @click="showChart(tempDataItem.title,item.deviceName,item.deviceId)">
<span class="pointer" @click="showChart(tempDataItem.title,item.deviceId)">
{{tempDataItem.title}}{{item[tempDataItem.attr]}}<span v-html="tempDataItem.unit"></span>
</span>
</el-col>
@ -48,9 +48,8 @@ export default {
}
},
methods:{
showChart(pointName,deviceName,deviceId){
console.log('点击查询图表',pointName,deviceName,deviceId)
pointName && this.$refs.pointChart.showChart({pointName,deviceName,deviceId})
showChart(pointName,deviceId){
pointName && this.$refs.pointChart.showChart({pointName,deviceCategory:'COOLING',deviceId})
},
updateData(){
this.loading = true

View File

@ -22,16 +22,16 @@
</el-form-item>
<el-form-item
label="设备"
prop="categoryName"
prop="deviceCategory"
:rules="[{ required: true, message: '请选择设备' }]"
>
<el-radio-group v-model="form.categoryName" @input="changeSiteIds">
<el-radio-group v-model="form.deviceCategory" @input="changeSiteIds">
<el-radio
v-for="(key, index) in deviceCategoryList"
v-for="(item, index) in deviceCategoryList"
:key="index + 'sbListSearch'"
:label="key"
:label="item.code"
>
{{ key }}
{{ item.name }}
</el-radio>
</el-radio-group>
</el-form-item>
@ -65,13 +65,6 @@
@select="handleSelect"
></el-autocomplete>
</el-form-item>
<!-- <el-form-item label="横坐标" prop="dataUnit" :rules="[{ required: true, message: '请选择横坐标' }]">-->
<!-- <el-radio-group v-model="form.dataUnit">-->
<!-- <el-radio :label="1">分钟</el-radio>-->
<!-- <el-radio :label="2">小时</el-radio>-->
<!-- <el-radio :label="3"></el-radio>-->
<!-- </el-radio-group>-->
<!-- </el-form-item>-->
</div>
<el-form-item>
<el-button type="primary" @click="submitForm">生成图表</el-button>
@ -118,7 +111,7 @@ export default {
components: { DateTimeSelect },
computed: {
isDtdc() {
return this.form.categoryName === "单体电池";
return this.form.deviceCategory === "BATTERY";
},
},
watch: {
@ -140,7 +133,6 @@ export default {
this.$refs.dateTimeSelect.init();
this.getDate();
});
// this.submitForm()
},
},
},
@ -154,7 +146,7 @@ export default {
dataRange: [], //时间选择范围
child: [],
siteIds: "", //当前选中的站点id 默认选中第一个站点
categoryName: "", //设备
deviceCategory: "", //设备
pointName: "", //点位
dataUnit: 1, //横坐标
},
@ -294,7 +286,7 @@ export default {
},
querySearchAsync(query, cb) {
console.log("查询数据", query);
if (!this.form.siteIds || !this.form.categoryName) {
if (!this.form.siteIds || !this.form.deviceCategory) {
this.$message({
type: "warning",
message: "请先选择站点和设备",
@ -303,7 +295,7 @@ export default {
}
pointFuzzyQuery({
siteIds: [this.form.siteIds],
categoryName: this.form.categoryName,
deviceCategory: this.form.deviceCategory,
pointName: query,
}).then((response) => {
const data = response?.data || [];
@ -342,7 +334,7 @@ export default {
const {
siteIds,
dataUnit,
categoryName,
deviceCategory,
pointName,
dataRange: [start = "", end = ""],
child,
@ -374,7 +366,7 @@ export default {
getPointValueList({
siteIds: [siteIds],
dataUnit,
categoryName,
deviceCategory,
pointName,
startDate,
endDate,

View File

@ -1,13 +1,13 @@
<template>
<el-dialog :visible.sync="dialogTableVisible" :close-on-click-modal="false" :show-close="false" destroy-on-close lock-scroll append-to-body width="600px" class="ems-dialog" :title="mode === 'add'?'新增设备':`编辑设备` " >
<el-form v-loading="loading>0" ref="addTempForm" :model="formData" :rules="rules" size="medium" label-width="100px">
<el-dialog :visible.sync="dialogTableVisible" :close-on-press-escape="false" :close-on-click-modal="false" :show-close="false" destroy-on-close lock-scroll append-to-body width="600px" class="ems-dialog" :title="mode === 'add'?'新增设备':`编辑设备` " >
<el-form v-loading="loading>0" ref="addTempForm" :model="formData" :rules="rules" size="medium" label-width="140px">
<el-form-item label="站点" prop="siteId">
<el-select v-model="formData.siteId" placeholder="请选择" :style="{width: '100%'}">
<el-select v-model="formData.siteId" placeholder="请选择" :style="{width: '100%'}" @change="changeType">
<el-option :label="item.siteName" :value="item.siteId" v-for="(item,index) in siteList" :key="index+'siteOptions'"></el-option>
</el-select>
</el-form-item>
<el-form-item label="设备id" prop="deviceId" >
<el-input v-model="formData.deviceId" maxlength="60" clearable :style="{width: '100%'}">
<el-input v-model="formData.deviceId" placeholder="请输入" maxlength="60" clearable :style="{width: '100%'}">
</el-input>
</el-form-item>
<el-form-item label="设备名称" prop="deviceName">
@ -29,11 +29,11 @@
</el-select>
</el-form-item>
<el-form-item label="设备类别" prop="deviceCategory">
<el-select v-model="formData.deviceCategory" placeholder="请选择" :style="{width: '100%'}">
<el-option :label="item" :value="item" v-for="(item,index) in deviceCategoryList" :key="index+'deviceCategoryList'"></el-option>
<el-select v-model="formData.deviceCategory" placeholder="请选择" :style="{width: '100%'}" @change="changeType">
<el-option :label="item.name" :value="item.code" v-for="(item,index) in deviceCategoryList" :key="index+'deviceCategoryList'"></el-option>
</el-select>
</el-form-item>
<el-form-item label="上级设备" prop="parentId" v-if="formData.deviceCategory === dccDeviceCategory">
<el-form-item label="上级设备" prop="parentId" v-if="dccDeviceCategoryList.includes(formData.deviceCategory)">
<el-select v-model="formData.parentId" :placeholder="parentDeviceList.length === 0 && !formData.siteId ? '请先选择站点' : '请选择'" :style="{width: '100%'}">
<el-option :label="item.deviceName" :value="item.id" v-for="(item,index) in parentDeviceList" :key="index+'parentDeviceList'" ></el-option>
</el-select>
@ -80,10 +80,10 @@
</template>
<script>
import {mapState} from "vuex";
import {getStackNameList} from '@/api/ems/dzjk'
import {getAllSites} from '@/api/ems/zddt'
import {validText} from '@/utils/validate'
import {getDeviceDetailInfo,getDeviceCategory,updateDevice,addDevice} from "@/api/ems/site";
import {getDeviceDetailInfo,updateDevice,addDevice,getParentDeviceId} from "@/api/ems/site";
import {getAllDeviceCategory} from '@/api/ems/search'
export default {
props:{
mode:{
@ -112,7 +112,7 @@ export default {
}
return {
loading:0,
dccDeviceCategory:'CLUSTER',
dccDeviceCategoryList:['CLUSTER','BATTERY'],//需要展示上级设备的设备类型
dialogTableVisible:false,
parentDeviceList:[],//上级设备列表 从接口获取数据
siteList:[],//站点列表 从接口获取数据
@ -195,24 +195,6 @@ export default {
})
},
watch:{
'formData.deviceCategory':{
handler(newVal){
// 只有电池簇需要选择上级设备 调用接口获取电池堆列表
if(newVal && newVal === this.dccDeviceCategory){
this.getParentDeviceList()
}
},
immediate:true
},
'formData.siteId':{
handler(newVal,oldVal){
// 只有电池簇需要选择上级设备 调用接口获取电池堆列表
if(newVal && oldVal!== newVal && this.formData.deviceCategory === this.dccDeviceCategory){
this.getParentDeviceList()
}
},
immediate:true
},
dialogTableVisible:{
handler(newVal){
//打开弹窗
@ -229,6 +211,9 @@ export default {
this.loading+=1
getDeviceDetailInfo(newVal).then(response => {
this.formData = JSON.parse(JSON.stringify(response?.data || {}));
if(this.dccDeviceCategoryList.includes(this.formData.deviceCategory)){
this.getParentDeviceList(true)
}
}).finally(() => {this.loading-=1})
}
},
@ -236,6 +221,11 @@ export default {
}
},
methods: {
changeType(){
if(this.dccDeviceCategoryList.includes(this.formData.deviceCategory)){
this.getParentDeviceList()
}
},
uploadImage(data){
this.formData.pictureUrl = data
},
@ -249,18 +239,18 @@ export default {
// 获取设备类别
getDeviceCategoryList(){
this.loading+=1
getDeviceCategory().then(response => {
getAllDeviceCategory().then(response => {
this.deviceCategoryList = response?.data || []
}).finally(() => {this.loading-=1})
},
//获取上级id列表
getParentDeviceList(){
getParentDeviceList(init=false){
if(!this.formData.siteId){
return console.log('请先选择站点')
}
this.formData.parentId=''
!init && (this.formData.parentId='')
this.loading= this.loading+1
getStackNameList(this.formData.siteId).then(response => {
getParentDeviceId({siteId:this.formData.siteId,deviceCategory:this.formData.deviceCategory}).then(response => {
this.parentDeviceList = JSON.parse(JSON.stringify(response?.data || []));
}).finally(() => {
this.loading=this.loading -1
@ -318,7 +308,6 @@ export default {
closeDialog(){
this.$emit('clear')
// 清空所有数据
this.$refs.addTempForm.resetFields()
this.formData= {
id:'',//设备唯一标识
siteId:'',//站点ID
@ -338,6 +327,7 @@ export default {
parity:'',//校验位
pictureUrl:'',//设备图片
}
this.$refs.addTempForm.resetFields()
this.dialogTableVisible=false
}
}

View File

@ -75,9 +75,7 @@
class="pointer"
@click="
showChart(
scope.row.pointName,
scope.row.deviceName,
scope.row.deviceId
scope.row
)
"
>{{ scope.row.pointValue }}</span
@ -118,7 +116,7 @@ export default {
if (!val) {
this.tableData = [];
this.deviceId = "";
this.deviceName = "";
this.parentId='';
this.siteId = "";
this.pageSize = 10;
this.pageNum = 1;
@ -135,6 +133,11 @@ export default {
}
},
},
computed:{
isDtdc(){
return this.deviceCategory === 'BATTERY'
}
},
data() {
return {
// 默认排序
@ -150,8 +153,8 @@ export default {
upper: "", //
},
deviceCategory: "",
deviceName: "",
deviceId: "",
parentId:'',
siteId: "",
tableData: [],
pageSize: 10, //分页栏当前每个数据总数
@ -160,10 +163,12 @@ export default {
};
},
methods: {
showChart(pointName, deviceName, deviceId) {
console.log("点击查询图表", pointName, deviceName, deviceId);
pointName &&
this.$refs.pointChart.showChart({ pointName, deviceName, deviceId });
showChart({pointName}) {
if(pointName){
const {deviceCategory,deviceId}=this
if(this.isDtdc) this.$refs.pointChart.showChart({ pointName, deviceCategory, deviceId:this.parentId,child:[deviceId] });
else this.$refs.pointChart.showChart({ pointName, deviceCategory, deviceId });
}
},
handleSortChange(column) {
this.form.sortData = column.prop
@ -175,11 +180,11 @@ export default {
this.pageNum = 1;
this.getData();
},
showTable({ deviceCategory, siteId, deviceId, deviceName }) {
showTable({ deviceCategory, siteId, deviceId ,parentId=''}) {
this.deviceCategory = deviceCategory;
this.siteId = siteId;
this.deviceId = deviceId;
this.deviceName = deviceName;
this.parentId=deviceCategory === 'BATTERY' ? parentId : ''//只有单体电池需要这个值
this.show = true;
this.getData();
},
@ -189,6 +194,7 @@ export default {
siteId,
deviceId,
deviceCategory,
parentId,
pageNum,
pageSize,
form: {
@ -204,6 +210,7 @@ export default {
siteId,
deviceId,
deviceCategory,
parentDeviceId: parentId,
pageNum,
pageSize,
sortData,

View File

@ -1,5 +1,5 @@
<template>
<el-dialog v-loading="loading>0" :visible.sync="dialogTableVisible" class="ems-dialog" :title="mode === 'add'?'新增工单':`编辑工单` " :close-on-click-modal="false" :show-close="false">
<el-dialog v-loading="loading>0" :visible.sync="dialogTableVisible" class="ems-dialog" :title="mode === 'add'?'新增工单':`编辑工单`" :close-on-press-escape="false" :close-on-click-modal="false" :show-close="false">
<el-form ref="addTempForm" :model="formData" :rules="rules" size="medium" label-width="120px">
<el-form-item label="工单号" prop="ticketNo" v-if="mode !== 'add'">
<el-input disabled v-model="formData.ticketNo" clearable :style="{width: '100%'}">