pcs开关机,设备列表上传、下载
This commit is contained in:
@ -9,10 +9,11 @@ export function getSiteInfoList({siteName, startTime, endTime, pageSize, pageNum
|
||||
}
|
||||
|
||||
// 设备列表
|
||||
export function getDeviceInfoList({siteId, pageSize, pageNum}) {
|
||||
export function getDeviceInfoList(data) {
|
||||
return request({
|
||||
url: `/ems/siteConfig/getDeviceInfoList?siteId=${siteId}&pageSize=${pageSize}&pageNum=${pageNum}`,
|
||||
method: 'get'
|
||||
url: `/ems/siteConfig/getDeviceInfoList`,
|
||||
method: 'get',
|
||||
params: data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@ -31,7 +31,13 @@
|
||||
<div>数据更新时间:{{ pcsItem.dataUpdateTime }}</div>
|
||||
</div>
|
||||
<div class="alarm">
|
||||
<el-button type="primary" size="small" style="margin-right:20px;" @click="pointDetail(pcsItem,'point')">详细</el-button>
|
||||
<pcs-switch style="margin-right:10px;"
|
||||
size="small"
|
||||
:data="pcsItem"
|
||||
@updateSuccess="init"/>
|
||||
<el-button type="primary" size="small" style="margin-right:20px;" @click="pointDetail(pcsItem,'point')">
|
||||
详细
|
||||
</el-button>
|
||||
<el-badge :value="pcsItem.alarmNum || 0" class="item">
|
||||
<i
|
||||
class="el-icon-message-solid alarm-icon"
|
||||
@ -51,7 +57,8 @@
|
||||
labelClassName="descriptions-label"
|
||||
>{{
|
||||
$store.state.ems.workStatusOptions[pcsItem.workStatus]
|
||||
}}</el-descriptions-item
|
||||
}}
|
||||
</el-descriptions-item
|
||||
>
|
||||
<el-descriptions-item
|
||||
:span="1"
|
||||
@ -60,7 +67,8 @@
|
||||
labelClassName="descriptions-label"
|
||||
>{{
|
||||
$store.state.ems.gridStatusOptions[pcsItem.gridStatus]
|
||||
}}</el-descriptions-item
|
||||
}}
|
||||
</el-descriptions-item
|
||||
>
|
||||
<el-descriptions-item
|
||||
:contentClassName="`descriptions-direction ${
|
||||
@ -71,7 +79,8 @@
|
||||
labelClassName="descriptions-label"
|
||||
>{{
|
||||
$store.state.ems.deviceStatusOptions[pcsItem.deviceStatus]
|
||||
}}</el-descriptions-item
|
||||
}}
|
||||
</el-descriptions-item
|
||||
>
|
||||
<el-descriptions-item
|
||||
:span="1"
|
||||
@ -80,7 +89,8 @@
|
||||
labelClassName="descriptions-label"
|
||||
>{{
|
||||
$store.state.ems.controlModeOptions[pcsItem.controlMode]
|
||||
}}</el-descriptions-item
|
||||
}}
|
||||
</el-descriptions-item
|
||||
>
|
||||
</el-descriptions>
|
||||
</div>
|
||||
@ -127,7 +137,8 @@
|
||||
:span="4"
|
||||
contentClassName="descriptions-direction keep"
|
||||
labelClassName="descriptions-label"
|
||||
>{{ item.dischargeStatus }}</el-descriptions-item
|
||||
>{{ item.dischargeStatus }}
|
||||
</el-descriptions-item
|
||||
>
|
||||
<el-descriptions-item
|
||||
:span="1"
|
||||
@ -180,11 +191,13 @@ import pointChart from "./../PointChart.vue";
|
||||
import PointTable from "@/views/ems/site/sblb/PointTable.vue";
|
||||
import RealTimeBaseInfo from "./../RealTimeBaseInfo.vue";
|
||||
import getQuerySiteId from "@/mixins/ems/getQuerySiteId";
|
||||
import { getRunningHeadInfo, getPcsDetailInfo } from "@/api/ems/dzjk";
|
||||
import {getPcsDetailInfo, getRunningHeadInfo} from "@/api/ems/dzjk";
|
||||
import intervalUpdate from "@/mixins/ems/intervalUpdate";
|
||||
import PcsSwitch from "@/views/ems/site/sblb/PcsSwitch.vue";
|
||||
|
||||
export default {
|
||||
name: "DzjkSbjkPcs",
|
||||
components: { RealTimeBaseInfo, pointChart ,PointTable},
|
||||
components: {RealTimeBaseInfo, pointChart, PointTable, PcsSwitch},
|
||||
mixins: [getQuerySiteId, intervalUpdate],
|
||||
data() {
|
||||
return {
|
||||
|
||||
96
src/views/ems/site/sblb/PcsSwitch.vue
Normal file
96
src/views/ems/site/sblb/PcsSwitch.vue
Normal file
@ -0,0 +1,96 @@
|
||||
<template>
|
||||
<el-button :size="size" :type="type" :circle='circle' @click="switchStatus"
|
||||
icon="el-icon-refresh-left">
|
||||
</el-button>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
</style>
|
||||
<script>
|
||||
|
||||
export default {
|
||||
props: {
|
||||
size: {
|
||||
type: String,
|
||||
default: 'mini',
|
||||
required: false
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
default: 'primary',
|
||||
required: false
|
||||
},
|
||||
// plain: {
|
||||
// type: Boolean,
|
||||
// default: true,
|
||||
// required: false
|
||||
// },
|
||||
circle: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
required: false
|
||||
},
|
||||
data: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {
|
||||
runningStatus: null,
|
||||
deviceId: null,
|
||||
deviceName: null,
|
||||
}
|
||||
},
|
||||
required: true
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
label() {
|
||||
return this.data.runningStatus === '4' ? '开机' : '关机'
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
switchStatus() {
|
||||
const {runningStatus, deviceId, deviceName} = this.data
|
||||
this.$confirm(`确认要${this.label}设备${deviceName || ''}吗?`, {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
showClose: false,
|
||||
closeOnClickModal: false,
|
||||
type: "warning",
|
||||
beforeClose: (action, instance, done) => {
|
||||
if (action === "confirm") {
|
||||
instance.confirmButtonLoading = true;
|
||||
//做开关机操作,更新成功后刷新表格
|
||||
setTimeout(() => {
|
||||
instance.confirmButtonLoading = false; //todo delete
|
||||
done()
|
||||
}, 2000)
|
||||
// deleteProtectPlan(row.id)
|
||||
// .then((response) => {
|
||||
// response.code === 200 && done();
|
||||
// })
|
||||
// .finally(() => {
|
||||
// instance.confirmButtonLoading = false;
|
||||
// });
|
||||
} else {
|
||||
done();
|
||||
}
|
||||
},
|
||||
})
|
||||
.then(() => {
|
||||
//只有在废弃成功的情况下会走到这里
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: `${deviceName}${this.label}成功!`,
|
||||
});
|
||||
this.$emit('updateSuccess')
|
||||
//调用接口 更新表格数据
|
||||
})
|
||||
.catch(() => {
|
||||
//取消关机
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
@ -42,8 +42,8 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
showDialog({siteId, code}) {
|
||||
this.upload.data = {siteId, deviceCategory: code}
|
||||
showDialog({siteId, deviceCategory, deviceId}) {
|
||||
this.upload.data = {siteId, deviceCategory, deviceId}
|
||||
this.show = true;
|
||||
},
|
||||
//关闭弹窗 重置数据
|
||||
|
||||
@ -8,13 +8,23 @@
|
||||
:key="index+'zdxeSelect'"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="设备类型">
|
||||
<el-select v-model="deviceCategory" placeholder="请选择设备类型" @change="onSearch" clearable>
|
||||
<el-option
|
||||
v-for="(item,index) in deviceCategoryList"
|
||||
:key="index+'deviceCategorySelect'"
|
||||
:label="item.name"
|
||||
:value="item.code">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<!-- <el-button type="primary" @click="onSearch" native-type="button">搜索</el-button>-->
|
||||
<!-- <el-button @click="onReset" native-type="button">重置</el-button>-->
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-button type="primary" @click="addDevice" native-type="button">新增设备</el-button>
|
||||
<el-dropdown @command="downloadPointDetail">
|
||||
<el-dropdown @command="(val)=>downloadPointDetail(val,false)">
|
||||
<el-button
|
||||
style="margin-left:10px;"
|
||||
type="primary"
|
||||
@ -28,7 +38,7 @@
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
<el-dropdown @command="uploadPointDetail">
|
||||
<el-dropdown @command="(val)=>uploadPointDetail(val,false)">
|
||||
<el-button
|
||||
style="margin-left:10px;"
|
||||
type="success"
|
||||
@ -42,8 +52,6 @@
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
|
||||
|
||||
<el-table
|
||||
class="common-table"
|
||||
:data="tableData"
|
||||
@ -76,6 +84,9 @@
|
||||
label="在线状态">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ $store.state.ems.deviceStatusOptions[scope.row.runningStatus] }}</span>
|
||||
<pcs-switch v-if="scope.row.deviceCategory === 'PCS'" style="margin-left:5px;"
|
||||
:data="{runningStatus:scope.row.runningStatus,deviceId:scope.row.deviceId,deviceName:scope.row.deviceName}"
|
||||
@updateSuccess="getData"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
@ -96,6 +107,23 @@
|
||||
报警点位清单
|
||||
</el-button>
|
||||
<br>
|
||||
<el-button
|
||||
@click="downloadPointDetail(scope.row,true)"
|
||||
style="margin-top:10px;"
|
||||
type="primary"
|
||||
plain
|
||||
size="mini">
|
||||
下载点位清单
|
||||
</el-button>
|
||||
<el-button
|
||||
@click="uploadPointDetail(scope.row,true)"
|
||||
style="margin-top:10px;"
|
||||
type="success"
|
||||
plain
|
||||
size="mini">
|
||||
上传点位清单
|
||||
</el-button>
|
||||
<br>
|
||||
<el-button
|
||||
@click="editDevice(scope.row)"
|
||||
style="margin-top:10px;"
|
||||
@ -151,10 +179,11 @@ import {getAllDeviceCategory} from '@/api/ems/search'
|
||||
import PointTable from './PointTable.vue'
|
||||
import AddDevice from "./AddDevice.vue";
|
||||
import PointUpload from "./PointUpload.vue";
|
||||
import PcsSwitch from "./PcsSwitch.vue";
|
||||
|
||||
export default {
|
||||
name: "Sblb",
|
||||
components: {AddDevice, PointTable, PointUpload},
|
||||
components: {AddDevice, PointTable, PointUpload, PcsSwitch},
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
@ -163,8 +192,9 @@ export default {
|
||||
editDeviceId: '',//编辑设备id
|
||||
siteId: '',
|
||||
siteList: [],
|
||||
tableData: [],
|
||||
deviceCategory: '',//搜索栏设备类型
|
||||
deviceCategoryList: [],//设备类别
|
||||
tableData: [],
|
||||
pageSize: 10,//分页栏当前每个数据总数
|
||||
pageNum: 1,//分页栏当前页数
|
||||
totalSize: 0,//table表格数据总数
|
||||
@ -204,15 +234,26 @@ export default {
|
||||
this.$refs.pointTable.showTable(row, dataType)
|
||||
},
|
||||
// 下载点位清单
|
||||
downloadPointDetail(command) {
|
||||
downloadPointDetail(command, isDetail = false) {
|
||||
const siteId = isDetail ? command.siteId : this.siteId
|
||||
const deviceCategory = isDetail ? command.deviceCategory : command.code
|
||||
const categoryName = isDetail ? command.categoryName : command.name
|
||||
const deviceId = isDetail ? command.deviceId : null
|
||||
console.log('下载', command, isDetail)
|
||||
this.download('ems/pointMatch/export', {
|
||||
siteId: this.siteId,
|
||||
deviceCategory: command.code
|
||||
}, `点位清单_${command.name}_${new Date().getTime()}.xlsx`)
|
||||
siteId,
|
||||
deviceCategory,
|
||||
deviceId,
|
||||
}, `点位清单_${categoryName}_${new Date().getTime()}.xlsx`)
|
||||
},
|
||||
// 上传点位清单
|
||||
uploadPointDetail(command) {
|
||||
this.$refs.pointUpload.showDialog({...command, siteId: this.siteId})
|
||||
uploadPointDetail(command, isDetail = false) {
|
||||
const siteId = isDetail ? command.siteId : this.siteId
|
||||
const deviceCategory = isDetail ? command.deviceCategory : command.code
|
||||
const categoryName = isDetail ? command.categoryName : command.name
|
||||
const deviceId = isDetail ? command.deviceId : ''
|
||||
console.log('上传', command, isDetail)
|
||||
this.$refs.pointUpload.showDialog({siteId, deviceCategory, categoryName, deviceId})
|
||||
},
|
||||
clearEditDeviceData() {
|
||||
this.mode = '';
|
||||
@ -312,8 +353,8 @@ export default {
|
||||
// 获取数据
|
||||
getData() {
|
||||
this.loading = true
|
||||
const {siteId, pageNum, pageSize} = this
|
||||
getDeviceInfoList({siteId, pageNum, pageSize}).then(response => {
|
||||
const {siteId, deviceCategory, pageNum, pageSize} = this
|
||||
getDeviceInfoList({siteId, deviceCategory, pageNum, pageSize}).then(response => {
|
||||
this.tableData = response?.rows || [];
|
||||
this.totalSize = response?.total || 0
|
||||
}).finally(() => {
|
||||
|
||||
Reference in New Issue
Block a user