map/ui/dasadmin/src/views/backend/equipment/airBlower/index.vue

475 lines
17 KiB
Vue
Raw Normal View History

2024-10-17 14:01:38 +08:00
<template>
<div class="airBlower">
<el-container class="containerPart">
<el-header class="headerPart">
<div class="headerLeft">
<div class="selectPart">
<span>{{ t('airBlower.status') }}</span>
<el-select
2024-10-24 19:13:18 +08:00
v-model="airBlowerSelect.iturbineoperationmode"
@change="selectAirBlower('iturbineoperationmode')"
2024-10-17 14:01:38 +08:00
:placeholder="'请选择' + t('airBlower.status')"
class="airBlowerSelect"
>
2024-10-24 19:13:18 +08:00
<el-option
v-for="v in airBlowerSelectOptions.iturbineoperationmode"
:key="v.value"
:label="v.label"
:value="v.value"
></el-option>
2024-10-17 14:01:38 +08:00
</el-select>
</div>
<div class="selectPart">
<span>{{ t('airBlower.feeder') }}</span>
<el-select
2024-10-24 19:13:18 +08:00
v-model="airBlowerSelect.belongLine"
@change="selectAirBlower('belongLine')"
2024-10-17 14:01:38 +08:00
:placeholder="'请选择' + t('airBlower.feeder')"
class="airBlowerSelect"
>
2024-10-24 19:13:18 +08:00
<el-option v-for="v in airBlowerSelectOptions.belongLine" :key="v.value" :label="v.value" :value="v.value"></el-option>
</el-select>
2024-10-17 14:01:38 +08:00
</div>
<div class="selectPart">
2024-10-24 19:13:18 +08:00
<span>自动更新</span>
<el-switch
v-model="autoUpdate"
class="ml-2"
style="--el-switch-on-color: #13ce66; --el-switch-off-color: #ff4949"
></el-switch>
2024-10-17 14:01:38 +08:00
</div>
</div>
<div class="headerRight">
2024-10-24 19:13:18 +08:00
<el-button type="primary" @click="airBlowerOperate('setTurbineFastStart')">{{ t('airBlower.start') }}</el-button>
<el-button style="color: #0064aa" @click="airBlowerOperate('setTurbineStop')">{{ t('airBlower.stop') }}</el-button>
<el-button style="color: #0064aa" @click="airBlowerOperate('setTurbineResetSafetyChain')">{{ t('airBlower.reset') }}</el-button>
<el-button style="color: #0064aa" @click="airBlowerOperate('verify')">{{ t('airBlower.verify') }}</el-button>
2024-10-17 14:01:38 +08:00
</div>
</el-header>
<el-main class="mainPart">
2024-10-24 19:13:18 +08:00
<el-table :column="tableColumn" :data="tableData" :header-row-style="tableHaderStyle" @selectionChange="selectTable" height="100%">
<el-table-column type="selection" width="55"></el-table-column>
2024-10-17 14:01:38 +08:00
<template v-for="item in tableColumn" :key="item.prop">
<el-table-column
v-if="!item.custom"
:prop="item.prop"
2024-10-24 19:13:18 +08:00
:label="item.label"
2024-10-17 14:01:38 +08:00
:align="item.align"
:width="item.width"
:type="item.type"
/>
2024-10-24 19:13:18 +08:00
<el-table-column v-else :label="item.label" :align="item.align" :width="item.width">
2024-10-17 14:01:38 +08:00
<template v-if="item.custom === 'default'" #default="scope">
2024-10-24 19:13:18 +08:00
<div v-if="item.prop === 'iturbineoperationmode'">
<el-tag v-if="scope.row.iturbineoperationmode === 20" color="rgba(0,100,170,0.20)" style="color: #0064aa"
>并网</el-tag
>
<el-tag v-if="scope.row.iturbineoperationmode === 10" color="rgba(0,160,150,0.20)" style="color: #00a096"
>维护</el-tag
>
<el-tag v-if="scope.row.iturbineoperationmode === 8" color="rgba(255,126,0,0.20)" style="color: #ff7e00"
>限功率运行</el-tag
>
<el-tag v-if="scope.row.iturbineoperationmode === 0" color="rgba(153,153,153,0.20)" style="color: #666666"
>离线</el-tag
>
<el-tag v-if="scope.row.iturbineoperationmode === 16" color="rgba(6,180,41,0.20)" style="color: #06b429"
>启动</el-tag
>
<el-tag v-if="scope.row.iturbineoperationmode === 6" color="rgba(254,55,49,0.20)" style="color: #fe3731"
>正常停机</el-tag
>
<el-tag v-if="scope.row.iturbineoperationmode === 1" color="rgba(254,55,49,0.20)" style="color: #fe3731"
>紧急停机</el-tag
>
<el-tag v-if="scope.row.iturbineoperationmode === 11" color="rgba(255,182,0,0.20)" style="color: #ffb600"
>待机</el-tag
>
<el-tag v-if="scope.row.iturbineoperationmode === 1110" color="rgba(153,153,153,0.20)" style="color: #666666"
>解缆状态</el-tag
>
<el-tag v-if="scope.row.iturbineoperationmode === 1111" color="rgba(254,55,49,0.20)" style="color: #fe3731"
>紧急停机</el-tag
>
2024-10-17 14:01:38 +08:00
</div>
</template>
<template v-if="item.custom === 'header'" #header="scope">
<div>{{ scope.column.label.split(' ')[0] }}</div>
<div>{{ scope.column.label.split(' ')[1] }}</div>
</template>
<template v-if="item.custom === 'header'" #default="scope">
<div>{{ scope.row[item.prop] }}</div>
</template>
2024-10-24 19:13:18 +08:00
<template v-if="item.prop === 'name'" #default="scope">
<div class="tableColumnClick" @click="openWindTurbine(scope.row)">{{ scope.row[item.prop] }}</div>
2024-10-24 19:13:18 +08:00
</template>
2024-10-17 14:01:38 +08:00
</el-table-column>
</template>
</el-table>
</el-main>
</el-container>
</div>
</template>
<script setup lang="ts">
2024-10-24 19:13:18 +08:00
import { SelectTypeObjType, SelectTypeKeyUnionType, TableDataObjType, TableColumnType } from './type'
import { reactive, ref, watch } from 'vue'
2024-10-17 14:01:38 +08:00
import { useI18n } from 'vue-i18n'
2024-10-24 19:13:18 +08:00
import { getAirBlowerListReq, getBelongLineListReq, runAirBlowerReq } from '/@/api/backend/airBlower/request'
import { ElMessage } from 'element-plus'
import { useRouter, useRoute } from 'vue-router'
const router = useRouter()
const route = useRoute()
2024-10-17 14:01:38 +08:00
const { t } = useI18n()
2024-10-24 19:13:18 +08:00
const airBlowerSelect = reactive<SelectTypeObjType>({
iturbineoperationmode: 987654321,
belongLine: '全部',
2024-10-17 14:01:38 +08:00
})
2024-10-24 19:13:18 +08:00
const airBlowerSelectOptions = reactive<{ [K in SelectTypeKeyUnionType]: { label: string; value: string | number }[] }>({
iturbineoperationmode: [
{
label: '全部',
value: 987654321,
},
{
label: '并网',
value: 20,
},
{
label: '待机',
value: 11,
},
{
label: '启动',
value: 16,
},
{
label: '维护',
value: 10,
},
{
label: '离线',
value: 0,
},
{
label: '限功率运行',
value: 8,
},
{
label: '正常停机',
value: 6,
},
{
label: '紧急停机',
value: 1,
},
{
label: '解缆状态',
value: 1110,
},
{
label: '电网故障停机',
value: 1111,
},
],
belongLine: [],
2024-10-17 14:01:38 +08:00
})
2024-10-24 19:13:18 +08:00
const selectAirBlower = (type: SelectTypeKeyUnionType) => {
if (airBlowerSelect.belongLine === '全部' && airBlowerSelect.iturbineoperationmode === 987654321) {
tableData.value = originTableData.value
return
} else if (airBlowerSelect.belongLine !== '全部' && airBlowerSelect.iturbineoperationmode !== 987654321) {
tableData.value = tableData.value.filter((item) => item[type] === airBlowerSelect[type])
return
} else {
if (type === 'belongLine' && airBlowerSelect.belongLine === '全部') {
tableData.value = originTableData.value.filter((item) => item.iturbineoperationmode === airBlowerSelect.iturbineoperationmode)
return
} else if (type === 'iturbineoperationmode' && airBlowerSelect.iturbineoperationmode === 987654321) {
tableData.value = originTableData.value.filter((item) => item.belongLine === airBlowerSelect.belongLine)
return
}
tableData.value = originTableData.value.filter((item) => item[type] === airBlowerSelect[type])
return
2024-10-17 14:01:38 +08:00
}
}
2024-10-24 19:13:18 +08:00
const airBlowerOperate = (type: 'setTurbineFastStart' | 'setTurbineStop' | 'setTurbineResetSafetyChain' | 'verify') => {
const data = selectList.value.map((item) => {
return {
deviceId: item,
serviceName: type,
opValue: 1 as const,
}
})
console.log(data)
runAirBlowerReq(data).then((res) => {
console.log(res)
})
2024-10-17 14:01:38 +08:00
}
const tableHaderStyle = {
color: '#333',
}
2024-10-24 19:13:18 +08:00
const tableColumn: TableColumnType[] = [
2024-10-17 14:01:38 +08:00
{
2024-10-24 19:13:18 +08:00
label: '风机列表',
prop: 'name',
2024-10-17 14:01:38 +08:00
align: 'center',
2024-10-24 19:13:18 +08:00
custom: 'default',
2024-10-17 14:01:38 +08:00
},
{
2024-10-24 19:13:18 +08:00
label: '风机型号',
prop: 'model',
2024-10-17 14:01:38 +08:00
align: 'center',
},
{
2024-10-24 19:13:18 +08:00
label: '风机状态',
prop: 'iturbineoperationmode',
2024-10-17 14:01:38 +08:00
align: 'center',
custom: 'default',
},
{
2024-10-24 19:13:18 +08:00
label: '线路',
prop: 'belongLine',
2024-10-17 14:01:38 +08:00
align: 'center',
},
{
2024-10-24 19:13:18 +08:00
label: '风速 (m/s)',
prop: 'iwindspeed',
2024-10-17 14:01:38 +08:00
align: 'center',
custom: 'header',
},
{
2024-10-24 19:13:18 +08:00
label: '有功功率 (MW)',
prop: 'igenpower',
2024-10-17 14:01:38 +08:00
align: 'center',
custom: 'header',
},
{
2024-10-24 19:13:18 +08:00
label: '日发电量 (kWh)',
prop: 'ikwhthisday',
2024-10-17 14:01:38 +08:00
align: 'center',
custom: 'header',
},
{
2024-10-24 19:13:18 +08:00
label: '总发电量 (万kWh)',
prop: 'ikwhoverall',
2024-10-17 14:01:38 +08:00
align: 'center',
custom: 'header',
},
{
2024-10-24 19:13:18 +08:00
label: '机舱角度',
prop: 'ivanedirection',
2024-10-17 14:01:38 +08:00
align: 'center',
},
{
2024-10-24 19:13:18 +08:00
label: '叶轮转速 (rmp)',
prop: 'irotorspeed',
2024-10-17 14:01:38 +08:00
align: 'center',
custom: 'header',
},
{
2024-10-24 19:13:18 +08:00
label: '发电机转速 (rmp)',
prop: 'igenspeed',
2024-10-17 14:01:38 +08:00
align: 'center',
custom: 'header',
},
{
2024-10-24 19:13:18 +08:00
label: '机舱温度 (℃)',
prop: 'itempnacelle_1sec',
2024-10-17 14:01:38 +08:00
align: 'center',
custom: 'header',
},
{
2024-10-24 19:13:18 +08:00
label: '主油路压力 (kpa)',
prop: 'ihydrpress',
2024-10-17 14:01:38 +08:00
align: 'center',
custom: 'header',
},
{
2024-10-24 19:13:18 +08:00
label: '变桨角度',
prop: 'ipitchangle',
2024-10-17 14:01:38 +08:00
align: 'center',
},
]
2024-10-24 19:13:18 +08:00
const tableData = ref<TableDataObjType[]>([])
const originTableData = ref<TableDataObjType[]>([])
const getTableData = () => {
getAirBlowerListReq()
.then((res) => {
const data = res.data.map((item: any) => {
const state = item.attributeMap.iturbineoperationmode ?? item.attributeMap.GridLostDetected ?? item.attributeMap.iPYlevel ?? '-'
const ipitchangle = Math.min(item.attributeMap.ipitchangle1, item.attributeMap.ipitchangle2, item.attributeMap.ipitchangle3)
const resVal: any = {}
Object.keys(item.attributeMap).forEach((attrKey) => {
resVal[attrKey] =
item.attributeMap[attrKey] === 0
? 0
: item.attributeMap[attrKey]
? item.attributeMap.iwindspeed % 1 === 0
? item.attributeMap.iwindspeed
: Math.floor(item.attributeMap[attrKey] * 1000) / 1000
: '-'
})
2024-10-24 19:13:18 +08:00
return {
irn: item.irn,
name: item.name ?? '-',
model: item.model || '-',
belongLine: item.belongLine || '-',
iwindspeed: '-',
igenpower: '-',
ikwhthisday: '-',
ikwhoverall: '-',
ivanedirection: '-',
irotorspeed: '-',
igenspeed: '-',
itempnacelle_1sec: '-',
ihydrpress: '-',
...resVal,
ipitchangle: ipitchangle === 0 ? 0 : ipitchangle ? Math.floor(ipitchangle * 1000) / 1000 : '-',
2024-10-24 19:13:18 +08:00
iturbineoperationmode: state,
}
})
console.log(data)
2024-10-17 14:01:38 +08:00
2024-10-24 19:13:18 +08:00
originTableData.value = data
if (airBlowerSelect.belongLine === '全部' && airBlowerSelect.iturbineoperationmode === 987654321) {
tableData.value = data
} else {
const irn = tableData.value.map((item) => item.irn)
const result: TableDataObjType[] = []
data.forEach((item: TableDataObjType) => {
if (irn.includes(item.irn)) {
result.push(item)
}
})
tableData.value = result
}
2024-10-24 19:13:18 +08:00
})
.catch((err: any) => {
console.log(err)
})
}
const getBlongLineList = () => {
getBelongLineListReq()
.then((res) => {
const data = res.data.map((item: any) => {
return {
value: item,
}
})
airBlowerSelectOptions.belongLine = [{ value: '全部', label: '全部' }, ...data]
})
.catch((err) => {
console.log(err)
})
}
2024-10-17 14:01:38 +08:00
2024-10-24 19:13:18 +08:00
const selectList = ref<string[]>([])
const selectTable = (selected: TableDataObjType[]) => {
selectList.value = selected.map((item) => item.irn)
}
const autoUpdate = ref(false)
const autoUpdateInterval = ref<any>(null)
watch(autoUpdate, (newVal: boolean) => {
if (newVal) {
if (autoUpdateInterval.value) return
ElMessage.success('开启自动刷新')
2024-10-24 19:13:18 +08:00
autoUpdateInterval.value = setInterval(() => {
console.log('刷新')
getTableData()
}, 2000)
} else {
ElMessage.warning('关闭自动刷新')
2024-10-24 19:13:18 +08:00
clearInterval(autoUpdateInterval.value)
autoUpdateInterval.value = null
}
2024-10-17 14:01:38 +08:00
})
const openWindTurbine = (row: TableDataObjType) => {
if (!router.hasRoute('windTurbine')) {
router.addRoute('admin', {
path: '/windTurbine',
name: 'windTurbine',
component: () => import('/@/views/backend/WindBlower/index.vue'),
meta: {
title: '风机详情',
},
})
}
console.log(router.getRoutes());
router.push({
name: 'windTurbine',
query: {
irn: row.irn,
},
})
}
2024-10-24 19:13:18 +08:00
getTableData()
getBlongLineList()
2024-10-17 14:01:38 +08:00
</script>
<style scoped lang="scss">
.airBlower {
height: 100%;
.containerPart {
height: 100%;
.headerPart {
padding: 20px;
display: flex;
justify-content: space-between;
align-items: center;
.headerLeft {
display: flex;
.selectPart {
display: flex;
justify-content: space-between;
align-items: center;
height: 40px;
margin-right: 20px;
span {
margin-right: 10px;
}
.airBlowerSelect {
width: 200px;
:deep(.el-select__wrapper) {
height: 40px;
}
}
}
}
.headerRight {
width: 436px;
display: flex;
justify-content: space-between;
.el-button {
width: 100px;
height: 40px;
}
}
}
.mainPart {
2024-10-24 19:13:18 +08:00
height: 100%;
.tableColumnClick {
text-decoration: underline;
color: #00a4ff;
cursor: pointer;
2024-10-17 14:01:38 +08:00
}
}
}
}
</style>