Compare commits
58 Commits
57b55b5f82
...
ad9a43a7c6
Author | SHA1 | Date |
---|---|---|
|
ad9a43a7c6 | 9 months ago |
|
82b0f4cf96 | 9 months ago |
|
bbed0e3ff3 | 9 months ago |
|
1790db4595 | 9 months ago |
|
8b40268bd1 | 9 months ago |
|
7aa949bdcf | 9 months ago |
|
61dcbfeacd | 9 months ago |
|
6478070bd8 | 9 months ago |
|
a1b3ee2c8c | 9 months ago |
|
dd7c417f81 | 9 months ago |
|
a9e6998430 | 9 months ago |
|
261ad9017d | 9 months ago |
|
b8b6a46e7e | 9 months ago |
|
ab29f9152d | 9 months ago |
|
2d96bbda3b | 9 months ago |
|
7869b083c3 | 9 months ago |
|
9637a6f13b | 9 months ago |
|
ecf6cd38dd | 9 months ago |
|
84191fe301 | 9 months ago |
|
7dadb22181 | 9 months ago |
|
b396c37426 | 9 months ago |
|
ee99ba7340 | 9 months ago |
|
c628c10f25 | 9 months ago |
|
79c56bb979 | 9 months ago |
|
9ca6cb83f0 | 9 months ago |
|
a2bfe148d3 | 9 months ago |
|
9134cf4ac3 | 9 months ago |
|
7b77c3cc88 | 9 months ago |
|
5e2f9cc966 | 9 months ago |
|
4dcb8f74ca | 9 months ago |
|
223ceed5eb | 9 months ago |
|
5c5acf6942 | 9 months ago |
|
975d5fe4f0 | 9 months ago |
|
159698ffbe | 9 months ago |
|
1b0118bb82 | 9 months ago |
|
7c679f7fa5 | 9 months ago |
|
ccec1ee763 | 9 months ago |
|
c390535202 | 9 months ago |
|
f4d01d65d0 | 9 months ago |
|
16e3213f21 | 9 months ago |
|
842c1e94e0 | 9 months ago |
|
55f98f9e56 | 9 months ago |
|
fc4b038e2e | 9 months ago |
|
5993621c21 | 9 months ago |
|
714e640c2e | 9 months ago |
|
96b91ad6de | 9 months ago |
|
b82b97ebb1 | 9 months ago |
|
69727fa613 | 9 months ago |
|
0fba8917f2 | 9 months ago |
|
088590beea | 9 months ago |
|
4c2989239d | 9 months ago |
|
1c8419569e | 9 months ago |
|
822519dbb6 | 9 months ago |
|
2d1d3a41a8 | 9 months ago |
|
2bc56cc1d4 | 9 months ago |
|
f82ffa185d | 9 months ago |
|
57d97eb3e2 | 9 months ago |
|
c9e283c3c8 | 9 months ago |
@ -0,0 +1,6 @@ |
|||
export enum energyAlarmApi { |
|||
getTableList = '/carbon-smart/api/AlarmEnergyConsumptionLog/selectAlarmEnergyConsumptionLog', //能碳告警 列表
|
|||
getCodeList = '/carbon-smart/api/AlarmEnergyConsumptionLog/selectErrorCodeList ', //能碳告警 列表
|
|||
getSelectAlarmEnergyConsumptionLogStatusProcess = '/carbon-smart/api/AlarmEnergyConsumptionLogStatusProcess/selectAlarmEnergyConsumptionLogStatusProcess', //能碳告警 状态 没有创建工单log接口
|
|||
noCreatOrUpdateLog = '/carbon-smart/api/AlarmEnergyConsumptionLogStatusProcess/creatOrUpdate', //能碳告警 状态 没有创建工单 添加 修改状态log
|
|||
} |
@ -0,0 +1,6 @@ |
|||
export enum equipmentAlarmApi { |
|||
getTableList = '/carbon-smart/api/AlarmEquipmentLog/selectAlarmEquipmentLog', //设备告警 列表
|
|||
getCodeList = '/carbon-smart/api/AlarmEquipmentLog/selectErrorCodeList', //设备告警 列表
|
|||
getSelectAlarmEquipmentLogStatusProcess = '/carbon-smart/api/AlarmEquipmentLogStatusProcess/selectAlarmEquipmentLogStatusProcess', //设备告警 状态 没有创建工单log接口
|
|||
noCreatOrUpdateLog = '/carbon-smart/api/AlarmEquipmentLogStatusProcess/creatOrUpdate', //设备告警 状态 没有创建工单 添加 修改状态log
|
|||
} |
@ -0,0 +1,3 @@ |
|||
export enum gatewayAlarmApi { |
|||
getTableList = '/carbon-smart/api/AlarmGatewayLog/selectAlarmGatewayLog', //网关告警 列表
|
|||
} |
@ -0,0 +1,6 @@ |
|||
export enum dict { |
|||
dictionaryUnitManagement = '/carbon-smart/client/dict/dictionaryUnitManagement', |
|||
updateDictionary = '/carbon-smart/client/dict/updateDictionary', |
|||
createDictionary = '/carbon-smart/client/dict/createDictionary', |
|||
delDictionary = '/carbon-smart/client/dict/delDictionary', |
|||
} |
@ -1,13 +1,14 @@ |
|||
// 设备监测
|
|||
export enum deviceMonitor { |
|||
// getTableList = '/carbon/emission/factor/queryCarbonFactorPage',
|
|||
// addNewData = '/carbon/emission/factor/creatOrUpdate',
|
|||
// editUser = '/carbon-smart/api/user/edit',
|
|||
// frozen = '/carbon-smart/api/user/frozen',
|
|||
// resetPwd = '/carbon-smart/api/user/resetPwd',
|
|||
// del = '/carbon-smart/api/user/del',
|
|||
// batchDel = '/carbon-smart/api/user/batchDel',
|
|||
// getCarbonFactorTree = '/carbon/emission/type/getCarbonFactorTree',
|
|||
// queryDeptTree = '/carbon-smart/api/user/queryDeptTree',
|
|||
// queryUserPerList = '/carbon-smart/api/user/queryUserPerList',
|
|||
getDeviceGraph = '/carbon-smart/api/monitor/getDeviceGraph', |
|||
getDevicePointToMonitor = '/carbon-smart//api/monitor/getDevicePointToMonitor', |
|||
} |
|||
|
|||
// 能耗监测
|
|||
export enum energyMonitor { |
|||
getDeviceOrNodeEnergyGraph = '/carbon-smart/api/monitor/getDeviceOrNodeEnergyGraph', |
|||
getDeviceOrNodeEnergyAnalyse = '/carbon-smart/api/monitor/getDeviceOrNodeEnergyAnalyse', |
|||
} |
|||
|
|||
// 环境监测
|
|||
export enum environmentMonitor {} |
|||
|
After Width: | Height: | Size: 1.8 KiB |
@ -0,0 +1,15 @@ |
|||
const dict = { |
|||
path: '/dict', |
|||
name: 'dict', |
|||
meta: { title: '字典', icon: 'zidian', index: 7, hideChildren: true }, |
|||
redirect: { name: 'dictIndex' }, |
|||
children: [ |
|||
{ |
|||
path: 'index', |
|||
name: 'dictIndex', |
|||
meta: { title: '字典', hideChildren: true, icon: 'zidian' }, |
|||
component: () => import('/@/view/dict/index.vue'), |
|||
}, |
|||
], |
|||
}; |
|||
export default dict; |
@ -0,0 +1,48 @@ |
|||
<template> |
|||
<ns-view-list-table v-bind="config" ref="mainRef"> |
|||
<template #bodyCell="{ record, column }"> |
|||
<template v-if="column.dataIndex === 'alarmTitle'"> |
|||
<div style="color: #2778ff">{{ record.alarmTitle }}</div> |
|||
{{ record.abnormalDescription }} |
|||
</template> |
|||
<template v-if="column.dataIndex === 'priority'"> |
|||
{{ record.priority ? record.priority.label : '' }} |
|||
</template> |
|||
<template v-if="column.dataIndex === 'alarmLogState'"> |
|||
{{ record.alarmLogState ? record.alarmLogState.label : '' }} |
|||
</template> |
|||
</template> |
|||
</ns-view-list-table> |
|||
<!-- 详情页面 --> |
|||
<Look ref="look" /> |
|||
<!-- 状态页面 --> |
|||
<Status ref="status" @logAdd="logAdd" /> |
|||
</template> |
|||
<script lang="ts"> |
|||
import { notificationtableConfig } from './ts/config'; |
|||
import Look from './look.vue'; |
|||
import Status from './status.vue'; |
|||
import { ref } from 'vue'; |
|||
|
|||
export default { |
|||
name: 'EquipmentAlarmIndex', |
|||
components: { Look, Status }, |
|||
|
|||
setup() { |
|||
const look = ref(null); |
|||
const status = ref(null); |
|||
const mainRef = ref(null); |
|||
const config = notificationtableConfig(look, status); |
|||
const logAdd = () => { |
|||
mainRef.value?.nsTableRef.reload(); |
|||
}; |
|||
return { |
|||
config, |
|||
look, |
|||
status, |
|||
mainRef, |
|||
logAdd, |
|||
}; |
|||
}, |
|||
}; |
|||
</script> |
@ -0,0 +1,274 @@ |
|||
<template> |
|||
<ns-drawer |
|||
v-model:visible="visible" |
|||
width="520" |
|||
:title="' '" |
|||
:footer-style="{ textAlign: 'right' }" |
|||
:ok="btnClick" |
|||
:cancel="handleClose" |
|||
placement="right" |
|||
@close="handleClose"> |
|||
<div style="width: 100%; height: 100%; overflow-y: auto; overflow-x: hidden"> |
|||
<!-- top --> |
|||
<div class="box"> |
|||
<div class="card"></div> |
|||
<div style="left: 25px; position: absolute; height: 35px; line-height: 35px"> |
|||
告警编号:{{ infoObject.alarmCode }} |
|||
</div> |
|||
<div style="right: 20px; position: absolute; height: 35px; line-height: 35px"> |
|||
{{ infoObject.updateTime }} |
|||
</div> |
|||
</div> |
|||
<!-- center --> |
|||
<div style="width: 100%; height: 400px"> |
|||
<div style="width: 100%; height: 100%" ref="graphChart"></div> |
|||
</div> |
|||
<!-- bottom --> |
|||
<div style="width: 100%; margin-top: 10px"> |
|||
<a-descriptions :column="1" bordered> |
|||
<a-descriptions-item label="优先级">{{ |
|||
infoObject.priority ? infoObject.priority.label : '' |
|||
}}</a-descriptions-item> |
|||
<a-descriptions-item label="状态">{{ |
|||
infoObject.alarmLogState ? infoObject.alarmLogState.label : '' |
|||
}}</a-descriptions-item> |
|||
<a-descriptions-item label="错误码">{{ infoObject.errorCode }}</a-descriptions-item> |
|||
<a-descriptions-item label="告警描述"> |
|||
<div style="color: #2778ff">{{ infoObject.alarmTitle }}</div> |
|||
{{ infoObject.abnormalDescription }}</a-descriptions-item |
|||
> |
|||
<a-descriptions-item label="监测点位"> |
|||
{{ infoObject.monitoringPoints }} |
|||
</a-descriptions-item> |
|||
<a-descriptions-item label="重复次数"> |
|||
{{ infoObject.alarmRepetitions }} |
|||
</a-descriptions-item> |
|||
</a-descriptions> |
|||
</div> |
|||
</div> |
|||
<template #footer> |
|||
<a-button type="primary" @click="handleClose">确定</a-button> |
|||
</template> |
|||
</ns-drawer> |
|||
</template> |
|||
<script lang="ts" setup> |
|||
defineOptions({ |
|||
name: 'look', // 与页面路由name一致缓存才可生效 |
|||
}); |
|||
import { ref } from 'vue'; |
|||
import * as echarts from 'echarts'; |
|||
|
|||
let chartInstance: echarts.ECharts | null = null; |
|||
const graphChart = ref(null); |
|||
const infoObject = ref({ |
|||
priority: null, |
|||
alarmCode: null, |
|||
alarmLogState: null, |
|||
errorCode: null, |
|||
alarmTitle: null, |
|||
abnormalDescription: null, |
|||
monitoringPoints: null, |
|||
alarmRepetitions: null, |
|||
updateTime: null, |
|||
}); |
|||
const visible = ref(false); |
|||
const handleClose = () => { |
|||
visible.value = false; |
|||
if (chartInstance) { |
|||
chartInstance.dispose(); |
|||
} |
|||
infoObject.value = { |
|||
priority: null, |
|||
alarmCode: null, |
|||
alarmLogState: null, |
|||
errorCode: null, |
|||
alarmTitle: null, |
|||
abnormalDescription: null, |
|||
monitoringPoints: null, |
|||
alarmRepetitions: null, |
|||
updateTime: null, |
|||
}; |
|||
}; |
|||
const btnClick = () => { |
|||
handleClose(); |
|||
}; |
|||
const toggle = (data: any) => { |
|||
infoObject.value = data; |
|||
visible.value = true; |
|||
setTimeout(() => { |
|||
getChatr(); |
|||
}, 500); |
|||
}; |
|||
const getChatr = () => { |
|||
let dayData = []; |
|||
let energyAlarm = []; |
|||
|
|||
// Extend data for 30 days |
|||
for (let i = 1; i < 30; i++) { |
|||
dayData.push(`3/${i}`); |
|||
energyAlarm.push(Math.floor(Math.random() * 250)); |
|||
} |
|||
if (chartInstance) { |
|||
chartInstance.dispose(); |
|||
} |
|||
chartInstance = echarts.init(graphChart.value); |
|||
const option = { |
|||
// title: { |
|||
// text: '告警趋势/ 近30天', |
|||
// textStyle: { |
|||
// fontSize: 16, |
|||
// fontWeight: 'normal', |
|||
// color: '#aaaaaa', |
|||
// }, |
|||
// left: '1%', |
|||
// top: '2%', |
|||
// }, |
|||
tooltip: { |
|||
trigger: 'axis', |
|||
axisPointer: { |
|||
type: 'shadow', |
|||
}, |
|||
formatter: function (params: any) { |
|||
let res = params[0].marker + ' ' + params[0].seriesName + ' : ' + params[0].data; |
|||
return res; |
|||
}, |
|||
}, |
|||
grid: { |
|||
left: '10%', // 设置图表距离左边的距离 |
|||
right: '4%', // 设置图表距离右边的距离 |
|||
top: '6%', |
|||
borderWidth: 0, |
|||
y2: 60, // 距离底边 |
|||
}, |
|||
legend: [ |
|||
{ |
|||
show: false, |
|||
top: 5, |
|||
left: 'center', // 将图例居中显示 |
|||
textStyle: { |
|||
color: 'rgb(89, 89, 89)', |
|||
fontSize: '14', |
|||
fontWeight: 'normal', |
|||
}, // 注意这里的颜色值要用引号括起来 |
|||
data: ['电压值'], |
|||
itemGap: 30, // 这里可以调整图例项之间的间距,单位为像素 |
|||
}, |
|||
], |
|||
// toolbox: { |
|||
// show: true, |
|||
// feature: { |
|||
// restore: {}, |
|||
// saveAsImage: {}, |
|||
// }, |
|||
// }, |
|||
calculable: true, |
|||
xAxis: [ |
|||
{ |
|||
type: 'category', |
|||
splitLine: { |
|||
show: false, |
|||
}, |
|||
axisTick: { |
|||
show: true, |
|||
}, |
|||
splitArea: { |
|||
show: false, |
|||
}, |
|||
axisLabel: { |
|||
show: true, // 显示 X 轴刻度标签 |
|||
color: 'rgb(89, 89, 89)', // X 轴刻度标签的字体颜色 |
|||
fontSize: 12, // X 轴刻度标签的字体大小 |
|||
formatter: function (value) { |
|||
// 可选:格式化 X 轴刻度标签文本 |
|||
return value; |
|||
}, |
|||
}, |
|||
data: dayData, |
|||
}, |
|||
], |
|||
yAxis: [ |
|||
{ |
|||
type: 'value', |
|||
shwo: false, |
|||
splitLine: { |
|||
show: true, |
|||
}, |
|||
axisLine: { |
|||
show: false, |
|||
}, |
|||
axisTick: { |
|||
show: false, |
|||
}, |
|||
splitArea: { |
|||
show: false, |
|||
}, |
|||
axisLabel: { |
|||
show: true, // 显示 |
|||
formatter: function (value) { |
|||
return value + ' V'; // 在刻度值后加上单位 |
|||
}, |
|||
}, |
|||
}, |
|||
], |
|||
dataZoom: [ |
|||
{ |
|||
height: 12, |
|||
start: 0, |
|||
end: 100, |
|||
handleSize: '300%', // 设置滑块的大小 |
|||
bottom: 15, |
|||
}, |
|||
], |
|||
series: [ |
|||
{ |
|||
name: '电压值', |
|||
type: 'line', |
|||
itemStyle: { |
|||
normal: { |
|||
barBorderRadius: 0, |
|||
color: '#2778FF', |
|||
}, |
|||
}, |
|||
symbol: 'circle', // 数据点的形状,这里设置为圆形 |
|||
symbolSize: 8, |
|||
label: { |
|||
show: true, |
|||
color: 'rgb(89, 89, 89)', |
|||
position: 'top', |
|||
top: '10', |
|||
formatter: function (value) { |
|||
return Number(energyAlarm[value.dataIndex]) + 'V'; |
|||
}, |
|||
}, |
|||
data: energyAlarm, |
|||
}, |
|||
], |
|||
}; |
|||
chartInstance = echarts.init(graphChart.value); |
|||
chartInstance.setOption(option); |
|||
}; |
|||
defineExpose({ |
|||
toggle, |
|||
}); |
|||
</script> |
|||
<style scoped lang="less"> |
|||
.box { |
|||
width: 100%; |
|||
height: 35px; |
|||
display: flex; |
|||
position: relative; |
|||
font-size: @font-size-base; |
|||
border-bottom: 1px solid @primary-color; |
|||
} |
|||
.card { |
|||
position: absolute; |
|||
left: 0px; |
|||
top: 0px; |
|||
width: 5px; |
|||
height: 35px; |
|||
background-color: @primary-color; |
|||
} |
|||
:deep(.ant-descriptions-item-label) { |
|||
width: 25%; |
|||
} |
|||
</style> |
@ -0,0 +1,183 @@ |
|||
<template> |
|||
<ns-drawer |
|||
v-model:visible="visible" |
|||
width="550" |
|||
:title="' '" |
|||
:footer-style="{ textAlign: 'right' }" |
|||
:ok="btnClick" |
|||
:cancel="handleClose" |
|||
placement="right" |
|||
@close="handleClose"> |
|||
<a-tabs> |
|||
<a-tab-pane key="1" tab="更新状态"> |
|||
<div style="width: 100%; padding: 24px"> |
|||
<a-form ref="formRef" :model="infoObject" :rules="rules"> |
|||
<a-form-item ref="state" label="当前状态" name="state"> |
|||
<a-select |
|||
v-model:value="infoObject.state" |
|||
show-search |
|||
placeholder="请选择当前状态" |
|||
style="width: 85%" |
|||
:options="stateOptions" |
|||
:disabled="showEdit" /> |
|||
<ns-icon |
|||
size="20" |
|||
@click="changeShowEdit" |
|||
style="margin-left: 20px" |
|||
:name="showEdit ? 'bianji' : 'baocun'" /> |
|||
</a-form-item> |
|||
<a-form-item label="备注" name="remarks"> |
|||
<a-textarea |
|||
v-model:value="infoObject.remarks" |
|||
placeholder="请输入异常描述" |
|||
:disabled="showEdit" |
|||
style="width: 85%" |
|||
:autoSize="{ minRows: 4, maxRows: 4 }" /> |
|||
</a-form-item> |
|||
</a-form> |
|||
</div> |
|||
</a-tab-pane> |
|||
<a-tab-pane key="2" tab="状态流程"> |
|||
<!-- 自动生成工单 --> |
|||
<div v-if="infoObject.createWorkOrder === 1"> xxxx </div> |
|||
<!-- 没有自动生成工单 --> |
|||
<NsSteps v-else v-bind="config" /> |
|||
</a-tab-pane> |
|||
</a-tabs> |
|||
<template #footer> |
|||
<a-button type="primary" @click="btnClick">确定</a-button> |
|||
</template> |
|||
</ns-drawer> |
|||
</template> |
|||
<script> |
|||
import { defineComponent } from 'vue'; |
|||
import { ref } from 'vue'; |
|||
import NsSteps from '/@/components/ns-steps.vue'; |
|||
import { NsMessage } from '/nerv-lib/component'; |
|||
import { http } from '/nerv-lib/util'; |
|||
import { energyAlarmApi } from '/@/api/alarmManagement/energyAlarm'; |
|||
import { getEnum } from '/@/api'; |
|||
|
|||
export default defineComponent({ |
|||
components: { NsSteps }, |
|||
|
|||
setup(props, { emit }) { |
|||
const visible = ref(false); |
|||
const showEdit = ref(true); |
|||
const infoObject = ref({}); |
|||
const energyAlarm = ref({}); |
|||
const stateOptions = ref(); |
|||
const logList = ref([]); |
|||
const formRef = ref(); |
|||
const config = ref({ |
|||
size: logList.value.length, |
|||
dataSource: logList.value, |
|||
}); |
|||
// 表单校验 |
|||
const rules = { |
|||
remarks: [ |
|||
{ |
|||
required: true, |
|||
message: '请输入备注', |
|||
trigger: 'change', |
|||
validator: (rules, remarks, cbfn) => { |
|||
if (remarks && remarks.trim() !== '') { |
|||
cbfn(); |
|||
} else { |
|||
cbfn('备注不能为空'); |
|||
} |
|||
}, |
|||
}, |
|||
], |
|||
state: [{ required: true, message: '请选择当前状态', trigger: 'change' }], |
|||
}; |
|||
const handleClose = () => { |
|||
showEdit.value = true; |
|||
energyAlarm.value = {}; |
|||
infoObject.value = {}; |
|||
visible.value = false; |
|||
config.value.dataSource = []; |
|||
}; |
|||
const btnClick = () => { |
|||
formRef.value.validate().then(() => { |
|||
delete infoObject.value.createTime; |
|||
infoObject.value.alarmEnergyConsumptionLogId = energyAlarm.value.id; |
|||
if (energyAlarm.value.createWorkOrder === 0) { |
|||
http.post(energyAlarmApi.noCreatOrUpdateLog, infoObject.value).then((res) => { |
|||
if (res.msg === 'success') { |
|||
NsMessage.success('操作成功'); |
|||
showEdit.value = true; |
|||
energyAlarm.value = {}; |
|||
infoObject.value = {}; |
|||
visible.value = false; |
|||
emit('logAdd', null); |
|||
} |
|||
}); |
|||
} |
|||
}); |
|||
}; |
|||
//修改状态 |
|||
const changeShowEdit = () => { |
|||
// 未生成工单 |
|||
if (energyAlarm.value.createWorkOrder === 0) { |
|||
showEdit.value = !showEdit.value; |
|||
} |
|||
}; |
|||
const toggle = async (data) => { |
|||
energyAlarm.value = { ...data }; |
|||
visible.value = true; |
|||
let states = await getEnum({ params: { enumType: 'AlarmLogStateEnum' } }); |
|||
stateOptions.value = states.data; |
|||
if (energyAlarm.value.createWorkOrder !== 1) { |
|||
stateOptions.value = stateOptions.value.filter((item) => item.value !== 4); |
|||
} |
|||
await http |
|||
.post(energyAlarmApi.getSelectAlarmEnergyConsumptionLogStatusProcess, { |
|||
alarmEnergyConsumptionLogId: data.id, |
|||
}) |
|||
.then((res) => { |
|||
if (res.msg === 'success') { |
|||
logList.value = res.data; |
|||
infoObject.value = { ...logList.value[0] }; |
|||
infoObject.value.state = infoObject.value.state.value; |
|||
let colorMap = { |
|||
1: '#ff7602', |
|||
2: '#00a1e6', |
|||
3: '#04d919', |
|||
4: '#d9001b', |
|||
5: '#a6a6a6', |
|||
}; |
|||
logList.value.forEach((item) => { |
|||
item.stateName = item.state.label; |
|||
item.color = colorMap[item.state.value]; |
|||
item.src = 'state-' + item.state.value; |
|||
}); |
|||
config.value.dataSource = logList.value; |
|||
} |
|||
}); |
|||
}; |
|||
return { |
|||
infoObject, |
|||
changeShowEdit, |
|||
showEdit, |
|||
rules, |
|||
formRef, |
|||
energyAlarm, |
|||
stateOptions, |
|||
btnClick, |
|||
visible, |
|||
logList, |
|||
config, |
|||
handleClose, |
|||
toggle, |
|||
}; |
|||
}, |
|||
}); |
|||
</script> |
|||
<style scoped lang="less"> |
|||
:deep(.ant-form-item-label) { |
|||
z-index: 20; |
|||
text-align: right; |
|||
width: 17%; |
|||
} |
|||
</style> |
@ -0,0 +1,183 @@ |
|||
import { energyAlarmApi } from '/@/api/alarmManagement/energyAlarm'; |
|||
import { dict } from '/@/api'; |
|||
import { ref } from 'vue'; |
|||
import { getEnum } from '/@/api'; |
|||
|
|||
const orgId = ref(''); |
|||
const result = JSON.parse(sessionStorage.getItem('ORGID')!); |
|||
orgId.value = result; |
|||
const tableKeyMap = [ |
|||
{ |
|||
title: '序号', |
|||
dataIndex: 'address', |
|||
width: 80, |
|||
customRender: (text: any) => { |
|||
return text.index + 1; |
|||
}, |
|||
}, |
|||
{ |
|||
title: '告警编号', |
|||
dataIndex: 'alarmCode', |
|||
}, |
|||
{ |
|||
title: '告警描述', |
|||
dataIndex: 'alarmTitle', |
|||
}, |
|||
{ |
|||
title: '类型', |
|||
dataIndex: 'dataSourcesTypeName', |
|||
}, |
|||
{ |
|||
title: '优先级', |
|||
dataIndex: 'priority', |
|||
}, |
|||
{ |
|||
title: '状态', |
|||
dataIndex: 'alarmLogState', |
|||
}, |
|||
{ |
|||
title: '错误码', |
|||
dataIndex: 'errorCode', |
|||
}, |
|||
{ |
|||
title: '监测点位', |
|||
dataIndex: 'monitoringPoints', |
|||
}, |
|||
{ |
|||
title: '更新时间', |
|||
dataIndex: 'updateTime', |
|||
}, |
|||
{ |
|||
title: '重复次数', |
|||
dataIndex: 'alarmRepetitions', |
|||
}, |
|||
]; |
|||
export const notificationtableConfig = (look: any, status: any) => { |
|||
return { |
|||
title: '告警记录', |
|||
api: energyAlarmApi.getTableList, |
|||
headerActions: [{}], |
|||
scroll: { x: 2000 }, |
|||
columns: tableKeyMap, |
|||
// rowSelection: null, 选择按钮
|
|||
columnActions: { |
|||
title: '操作', |
|||
actions: [ |
|||
{ |
|||
label: '详情', |
|||
name: 'FeedBackDetail', |
|||
dynamicParams: ['uuid', 'appealType'], |
|||
handle: (data: any) => { |
|||
look.value.toggle(data); |
|||
}, |
|||
}, |
|||
{ |
|||
label: '状态', |
|||
name: 'FeedBackDetail', |
|||
dynamicParams: ['uuid', 'appealType'], |
|||
handle: (data: any) => { |
|||
status.value.toggle(data); |
|||
}, |
|||
}, |
|||
], |
|||
}, |
|||
|
|||
formConfig: { |
|||
schemas: [ |
|||
{ |
|||
field: 'dataSourcesType', |
|||
label: '类型', |
|||
component: 'nsSelectApi', |
|||
// dynamicParams: {
|
|||
// id: 'deviceName', //帮定上级联动数据
|
|||
// },
|
|||
componentProps: { |
|||
api: () => dict({ params: { dicKey: 'ENERGY_TYPE' } }), |
|||
immediate: true, |
|||
allowClear: true, |
|||
labelField: 'cnValue', |
|||
valueField: 'id', |
|||
placeholder: '请选择类型', |
|||
showSearch: true, |
|||
filterOption: (input: string, option: any) => { |
|||
return option.cnValue.toLowerCase().indexOf(input.toLowerCase()) >= 0; |
|||
}, |
|||
// autoSelectFirst: true,
|
|||
}, |
|||
}, |
|||
{ |
|||
field: 'priority', |
|||
label: '优先级', |
|||
component: 'nsSelectApi', |
|||
// dynamicParams: {
|
|||
// id: 'deviceName', //帮定上级联动数据
|
|||
// },
|
|||
componentProps: { |
|||
api: () => getEnum({ params: { enumType: 'PriorityEnum' } }), |
|||
immediate: true, |
|||
allowClear: true, |
|||
resultField: 'data', |
|||
labelField: 'label', |
|||
valueField: 'value', |
|||
placeholder: '请选择告警优先级', |
|||
showSearch: true, |
|||
filterOption: (input: string, option: any) => { |
|||
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0; |
|||
}, |
|||
// autoSelectFirst: true,
|
|||
}, |
|||
}, |
|||
{ |
|||
field: 'alarmLogState', |
|||
label: '状态', |
|||
component: 'nsSelectApi', |
|||
// dynamicParams: {
|
|||
// id: 'deviceName', //帮定上级联动数据
|
|||
// },
|
|||
componentProps: { |
|||
api: () => getEnum({ params: { enumType: 'AlarmLogStateEnum' } }), |
|||
immediate: true, |
|||
allowClear: true, |
|||
resultField: 'data', |
|||
labelField: 'label', |
|||
valueField: 'value', |
|||
placeholder: '请选择状态', |
|||
showSearch: true, |
|||
filterOption: (input: string, option: any) => { |
|||
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0; |
|||
}, |
|||
// autoSelectFirst: true,
|
|||
}, |
|||
}, |
|||
{ |
|||
field: 'errorCode', |
|||
label: '错误码', |
|||
component: 'NsSelectApi', |
|||
componentProps: { |
|||
allowClear: true, |
|||
placeholder: '请选择错误码', |
|||
autoSelectFirst: false, |
|||
api: energyAlarmApi.getCodeList, |
|||
resultField: 'data', |
|||
labelField: 'errorCode', |
|||
valueField: 'errorCode', |
|||
}, |
|||
}, |
|||
{ |
|||
field: 'createTime', |
|||
label: '数据日期', |
|||
component: 'NsRangePicker', |
|||
allowClear: true, |
|||
fieldMap: ['startTime', 'endTime'], |
|||
componentProps: { |
|||
valueFormat: 'YYYY-MM-DD', |
|||
placeholder: ['开始日期', '结束日期'], |
|||
}, |
|||
}, |
|||
], |
|||
}, |
|||
params: { orgId: orgId.value }, |
|||
// pagination: { pageSizeOptions: false },
|
|||
rowKey: 'id', |
|||
}; |
|||
}; |
@ -1,283 +1,41 @@ |
|||
import { ref } from 'vue'; |
|||
import { http } from '/nerv-lib/util'; |
|||
import { origanizemanage } from '/@/api/origanizemanage'; |
|||
import { carbonEmissionFactorLibrary } from '/@/api/carbonEmissionFactorLibrary'; |
|||
export const formConfig = (disabled) => { |
|||
return ref([ |
|||
{ |
|||
field: 'fields', |
|||
component: 'NsChildForm', |
|||
componentProps: { |
|||
schemas: [ |
|||
{ |
|||
label: '排放源', |
|||
field: 'emissionSources', |
|||
component: 'NsInput', |
|||
componentProps: { |
|||
placeholder: '请输入排放源', |
|||
maxLength: 20, |
|||
}, |
|||
rules: [ |
|||
{ |
|||
required: true, |
|||
message: '请输入排放源', |
|||
}, |
|||
], |
|||
}, |
|||
{ |
|||
field: 'emissionType', |
|||
label: '排放分类', |
|||
component: 'NsCascader', |
|||
fieldMap: ['emissionType'], |
|||
componentProps: { |
|||
placeholder: '请选择排放分类', |
|||
api: carbonEmissionFactorLibrary.getCarbonFactorTree, |
|||
fieldNames: { label: 'emissionName', value: 'id' }, |
|||
showSearch: true, |
|||
}, |
|||
rules: [ |
|||
{ |
|||
required: true, |
|||
message: '请选择排放分类', |
|||
}, |
|||
], |
|||
}, |
|||
{ |
|||
field: 'emissionGas', |
|||
label: '排放气体', |
|||
component: 'NsSelect', |
|||
componentProps: { |
|||
allowClear: true, |
|||
placeholder: '请选择排放气体', |
|||
options: [ |
|||
{ |
|||
label: 'CO2', |
|||
value: 'CO2', |
|||
}, |
|||
{ |
|||
label: 'CO2e', |
|||
value: 'CO2e', |
|||
}, |
|||
{ |
|||
label: 'SF6', |
|||
value:'SF6', |
|||
}, |
|||
{ |
|||
label: 'CH4', |
|||
value: 'CH4', |
|||
}, |
|||
{ |
|||
label: 'PFCs', |
|||
value: 'PFCs', |
|||
}, |
|||
{ |
|||
label: 'HFCs', |
|||
value: 'HFCs', |
|||
}, |
|||
], |
|||
}, |
|||
rules: [ |
|||
{ |
|||
required: true, |
|||
message: '请选择排放气体', |
|||
}, |
|||
], |
|||
}, |
|||
// {
|
|||
// field: 'emissionProcess',
|
|||
// label: '排放环节',
|
|||
// component: 'NsSelectApi',
|
|||
// componentProps: {
|
|||
// api: carbonEmissionFactorLibrary.getEmissionProcess,
|
|||
// params: {
|
|||
// emissionType: sessionStorage.getItem('checkedTreeNode'),
|
|||
// },
|
|||
// resultField: 'data',
|
|||
// labelField: 'emissionProcess',
|
|||
// valueField: 'emissionProcess',
|
|||
// immediate: true,
|
|||
// autoSelectFirst: false,
|
|||
// filterOption:false,
|
|||
// showSearch:true,
|
|||
// autoClearSearchValue:false
|
|||
// },
|
|||
// },
|
|||
{ |
|||
label: '排放环节', |
|||
field: 'emissionProcess', |
|||
component: 'NsInput', |
|||
componentProps: { |
|||
placeholder: '请输入排放环节', |
|||
maxLength: 20, |
|||
}, |
|||
rules: [ |
|||
{ |
|||
required: true, |
|||
message: '请输入排放环节', |
|||
}, |
|||
], |
|||
}, |
|||
{ |
|||
label: '排放因子', |
|||
field: 'emissionFactors', |
|||
component: 'NsInputNumber', |
|||
componentProps: { |
|||
placeholder: '请输入排放因子值', |
|||
maxLength: 20, |
|||
}, |
|||
rules: [ |
|||
{ |
|||
required: true, |
|||
message: '请输入排放因子值', |
|||
trigger: 'change', |
|||
}, |
|||
], |
|||
}, |
|||
{ |
|||
field: 'carbonEmissionPrefix', |
|||
label: '碳排前缀', |
|||
component: 'NsSelect', |
|||
componentProps: { |
|||
disabled: true, |
|||
allowClear: true, |
|||
defaultValue: 't', |
|||
placeholder: '请选择碳排前缀', |
|||
options: [ |
|||
{ |
|||
label: 'g', |
|||
value: 'g', |
|||
}, |
|||
{ |
|||
label: 'kg', |
|||
value: 'kg', |
|||
}, |
|||
{ |
|||
label: 't', |
|||
value: 't', |
|||
}, |
|||
], |
|||
}, |
|||
rules: [ |
|||
{ |
|||
required: true, |
|||
message: '请选择碳排前缀', |
|||
}, |
|||
], |
|||
}, |
|||
{ |
|||
label: '碳排后缀', |
|||
field: 'carbonEmissionSuffix', |
|||
component: 'NsInput', |
|||
componentProps: { |
|||
placeholder: '请输入碳排后缀', |
|||
maxLength: 20, |
|||
}, |
|||
rules: [ |
|||
{ |
|||
required: true, |
|||
message: '请输入碳排后缀', |
|||
}, |
|||
], |
|||
}, |
|||
{ |
|||
label: '已引用数', |
|||
field: 'numberOfReferences', |
|||
component: 'NsInput', |
|||
componentProps: { |
|||
defaultValue: 10, |
|||
disabled: true, |
|||
maxLength: 20, |
|||
}, |
|||
}, |
|||
{ |
|||
label: '参考文献', |
|||
field: 'reference', |
|||
component: 'NsTextarea', |
|||
componentProps: { |
|||
placeholder: '请输入参考文献', |
|||
maxLength: 20, |
|||
}, |
|||
}, |
|||
], |
|||
}, |
|||
// 凭证弹窗表头
|
|||
export const voucherColumns = [ |
|||
{ |
|||
title: '序号', |
|||
customRender: (text: any) => { |
|||
return text.index + 1; |
|||
}, |
|||
]); |
|||
}; |
|||
const options = ref([]); |
|||
|
|||
const getUserPerList = (transform, params = {}) => { |
|||
return http.post(origanizemanage.queryUserPerList, { ...params }).then((res) => { |
|||
return res.data?.map((item) => { |
|||
item = { ...item, ...transform(item) }; |
|||
return item; |
|||
}); |
|||
}); |
|||
}; |
|||
export const formConfig2 = (casData: any) => { |
|||
return ref([ |
|||
{ |
|||
field: 'information', |
|||
component: 'NsCascader', |
|||
componentProps: { |
|||
placeholder: '请选择', |
|||
displayRender: ({ labels, selectedOptions }: any) => { |
|||
console.log(labels, selectedOptions); |
|||
|
|||
casData.value = selectedOptions.map(({ label, value }) => { |
|||
return { label, value }; |
|||
}); |
|||
return labels.join('/'); |
|||
}, |
|||
loadData: (selectedOptions, options) => { |
|||
console.log(selectedOptions, options, 'selectedOptions, options'); |
|||
|
|||
const targetOption = selectedOptions[selectedOptions.length - 1]; |
|||
let transForm, params; |
|||
// load options lazily
|
|||
if (!selectedOptions.length) { |
|||
transForm = (data) => { |
|||
data['label'] = data.orgName; |
|||
data['value'] = data.orgId; |
|||
data['isLeaf'] = false; |
|||
data['level'] = 1; |
|||
return data; |
|||
}; |
|||
getUserPerList(transForm).then((res) => { |
|||
options.value = [...res]; |
|||
}); |
|||
} |
|||
const id = targetOption?.value; |
|||
const level = targetOption?.level; |
|||
if (targetOption) { |
|||
targetOption.loading = true; |
|||
} |
|||
|
|||
if (level === 1) { |
|||
transForm = (data) => { |
|||
data['label'] = data.deptName; |
|||
data['value'] = data.deptId; |
|||
data['isLeaf'] = false; |
|||
data['level'] = 2; |
|||
return data; |
|||
}; |
|||
params = { orgId: id }; |
|||
} else if (level === 2) { |
|||
transForm = (data) => { |
|||
data['label'] = data.roleName; |
|||
data['value'] = data.roleId; |
|||
data['level'] = 3; |
|||
return data; |
|||
}; |
|||
params = { deptId: id }; |
|||
} |
|||
if (targetOption) { |
|||
getUserPerList(transForm, { ...params }).then((res) => { |
|||
targetOption.loading = false; |
|||
targetOption.children = [...res]; |
|||
}); |
|||
} |
|||
}, |
|||
}, |
|||
}, |
|||
]); |
|||
}; |
|||
}, |
|||
{ |
|||
title: '日期', |
|||
dataIndex: 'age', |
|||
key: 'age', |
|||
}, |
|||
{ |
|||
title: '文件名称', |
|||
dataIndex: 'address', |
|||
key: 'address 1', |
|||
ellipsis: true, |
|||
}, |
|||
]; |
|||
// 编辑页中表头
|
|||
export const drawerColumns = [ |
|||
{ |
|||
title: '名称', |
|||
dataIndex: 'emissionSources', |
|||
}, |
|||
{ |
|||
title: '因子值', |
|||
dataIndex: 'emissionFactors', |
|||
}, |
|||
{ |
|||
title: '排放环节', |
|||
className: 'emissionProcess', |
|||
dataIndex: 'emissionProcess', |
|||
}, |
|||
{ |
|||
title: '数据来源', |
|||
className: 'dataSources', |
|||
dataIndex: 'dataSources', |
|||
}, |
|||
]; |
@ -0,0 +1,51 @@ |
|||
export const tableColumns = [ |
|||
// {
|
|||
// title: '序号',
|
|||
// customRender: (text: any) => {
|
|||
// return text.index + 1;
|
|||
// },
|
|||
// },
|
|||
{ |
|||
title: 'id', |
|||
dataIndex: 'id', |
|||
}, |
|||
{ |
|||
title: '字典组名', |
|||
dataIndex: 'grp', |
|||
}, |
|||
{ |
|||
title: '字典组名描述', |
|||
dataIndex: 'grpDesc', |
|||
}, |
|||
{ |
|||
title: '字典Key', |
|||
dataIndex: 'dicKey', |
|||
}, |
|||
{ |
|||
title: '字典中文Value', |
|||
dataIndex: 'cnValue', |
|||
}, |
|||
{ |
|||
title: '字典英文Value', |
|||
dataIndex: 'enValue', |
|||
}, |
|||
{ |
|||
title: '字典描述', |
|||
dataIndex: 'description', |
|||
}, |
|||
{ |
|||
title: '父级ID', |
|||
dataIndex: 'parentId', |
|||
}, |
|||
{ |
|||
title: '排序数字', |
|||
dataIndex: 'seq', |
|||
}, |
|||
{ |
|||
title: '是否展示', |
|||
dataIndex: 'showed', |
|||
}, |
|||
{ |
|||
title: '操作', |
|||
}, |
|||
]; |
@ -0,0 +1,316 @@ |
|||
<!-- eslint-disable vue/multi-word-component-names --> |
|||
<template> |
|||
<div> |
|||
<a-table |
|||
:columns="tableColumns" |
|||
:data-source="data" |
|||
bordered |
|||
:pagination="false" |
|||
:scroll="{ y: 530 }"> |
|||
<template #bodyCell="{ text, column, record }"> |
|||
<template v-if="column.dataIndex === 'showed'"> |
|||
<a-switch |
|||
:checked="text" |
|||
:checked-value="0" |
|||
:unCheckedValue="1" |
|||
@change="(checked) => updateShowed(record, true)" /> |
|||
</template> |
|||
<template v-if="column.title === '操作'"> |
|||
<a-button type="link" @click="updateDict(record)">编辑</a-button> |
|||
<a-button type="link" @click="deleteDict(record)">删除</a-button> |
|||
</template> |
|||
</template> |
|||
<template #title> |
|||
<div |
|||
style="display: flex; align-items: center; justify-content: space-between; width: 100%"> |
|||
<div style="display: flex; align-items: center; width: 85%"> |
|||
<div style="width: 10%">数据报表</div> |
|||
<a-input |
|||
v-model:value="queryParams.grp" |
|||
placeholder="请输入字典组名" |
|||
style="width: 15%" /> |
|||
<a-input |
|||
v-model:value="queryParams.grpDesc" |
|||
placeholder="请输入字典组名描述" |
|||
style="width: 15%; margin-left: 10px" /> |
|||
<a-input |
|||
v-model:value="queryParams.dicKey" |
|||
placeholder="请输入字典Key" |
|||
style="width: 15%; margin-left: 10px" /> |
|||
<a-input |
|||
v-model:value="queryParams.cnValue" |
|||
placeholder="请输入字典中文Value" |
|||
style="width: 15%; margin-left: 10px" /> |
|||
<a-button type="primary" style="margin-left: 10px" @click="getTableList"> |
|||
查询 |
|||
</a-button> |
|||
</div> |
|||
<a-button type="primary" style="margin-left: 10px" @click="addDict"> 新增 </a-button> |
|||
</div> |
|||
</template> |
|||
</a-table> |
|||
|
|||
<a-drawer |
|||
:width="600" |
|||
:visible="visible" |
|||
:title="updateInfo && updateInfo.id ? '编辑' : '新增'" |
|||
:body-style="{ paddingBottom: '80px' }" |
|||
:footer-style="{ textAlign: 'right' }" |
|||
destroyOnClose |
|||
@close="onClose"> |
|||
<a-form |
|||
ref="formRef" |
|||
:model="updateInfo" |
|||
:rules="rules" |
|||
:label-col="labelCol" |
|||
:wrapper-col="wrapperCol"> |
|||
<a-form-item ref="grp" label="字典组名" name="grp"> |
|||
<a-input v-model:value="updateInfo.grp" placeholder="请输入字典组名" /> |
|||
</a-form-item> |
|||
<a-form-item ref="grpDesc" label="字典组名描述" name="grpDesc"> |
|||
<a-input v-model:value="updateInfo.grpDesc" placeholder="请输入字典组名描述" /> |
|||
</a-form-item> |
|||
<a-form-item ref="dicKey" label="字典Key" name="dicKey"> |
|||
<a-input v-model:value="updateInfo.dicKey" placeholder="请输入字典Key" /> |
|||
</a-form-item> |
|||
<a-form-item ref="cnValue" label="字典中文Value" name="cnValue"> |
|||
<a-input v-model:value="updateInfo.cnValue" placeholder="请输入字典中文Value" /> |
|||
</a-form-item> |
|||
<a-form-item ref="enValue" label="字典英文Value" name="enValue"> |
|||
<a-input v-model:value="updateInfo.enValue" placeholder="请输入字典英文Value" /> |
|||
</a-form-item> |
|||
<a-form-item ref="description" label="字典描述" name="description"> |
|||
<a-input v-model:value="updateInfo.description" placeholder="请输入字典描述" /> |
|||
</a-form-item> |
|||
<a-form-item ref="parentId" label="父级ID" name="parentId"> |
|||
<a-input v-model:value="updateInfo.parentId" placeholder="请输入父级ID" /> |
|||
</a-form-item> |
|||
<a-form-item ref="seq" label="排序数字" name="seq"> |
|||
<a-input v-model:value="updateInfo.seq" placeholder="请输入排序数字" /> |
|||
</a-form-item> |
|||
<a-form-item ref="showed" label="是否展示" name="showed"> |
|||
<!-- <a-input v-model:value="updateInfo.showed" placeholder="请输入是否展示" /> --> |
|||
<a-switch |
|||
:checked="updateInfo.showed" |
|||
:checked-value="0" |
|||
:unCheckedValue="1" |
|||
@change="updateShowed(updateInfo, false)" /> |
|||
</a-form-item> |
|||
<!-- <a-form-item label="计量单位" name="unit"> |
|||
<a-cascader v-model:value="formState.unit" :options="measurementUnit" /> |
|||
</a-form-item> |
|||
<a-form-item label="自动采集节点" name="collectionNode"> |
|||
<a-tree-select |
|||
v-model:value="formState.collectionNode" |
|||
:tree-line="true" |
|||
:tree-data="treeData" /> |
|||
</a-form-item> |
|||
<a-form-item label="计算碳排" name="isComputeCarbon"> |
|||
<a-radio-group v-model:value="formState.isComputeCarbon" @change="changeRadio"> |
|||
<a-radio :value="0">是</a-radio> |
|||
<a-radio :value="1">否</a-radio> |
|||
</a-radio-group> |
|||
</a-form-item> |
|||
<a-form-item label="排放类型" name="emissionType" :required="isRequired"> |
|||
<a-select v-model:value="formState.emissionType" placeholder="请选择排放类型"> |
|||
<a-select-option v-for="(item, index) in emissionTypeDic" :key="index" :value="item.id"> |
|||
{{ item.cnValue }} |
|||
</a-select-option> |
|||
</a-select> |
|||
</a-form-item> --> |
|||
</a-form> |
|||
<template #footer> |
|||
<a-button style="margin-right: 8px" @click="onClose">取消</a-button> |
|||
<a-button type="primary" @click="onSubmit">确定</a-button> |
|||
</template> |
|||
</a-drawer> |
|||
</div> |
|||
</template> |
|||
<script lang="ts" setup> |
|||
import { ref, onMounted, defineOptions } from 'vue'; |
|||
import { http } from '/nerv-lib/util/http'; |
|||
import type { FormInstance, Rule } from 'ant-design-vue/es/form'; |
|||
import { tableColumns } from './config'; |
|||
import { dict } from '/@/api/dict'; |
|||
import { NsMessage } from '/nerv-lib/component'; |
|||
import { Modal } from 'ant-design-vue'; |
|||
defineOptions({ |
|||
energyType: 'dictIndex', // 与页面路由name一致缓存才可生效 |
|||
}); |
|||
|
|||
const data = ref([]); |
|||
const updateInfo = ref({}); |
|||
const formRef = ref<FormInstance | null>(null); |
|||
|
|||
const queryParams = ref({ |
|||
grp: '', |
|||
grpDesc: '', |
|||
dicKey: '', |
|||
cnValue: '', |
|||
}); |
|||
const orgId = ref(''); |
|||
const result = JSON.parse(sessionStorage.getItem('ORGID')!); |
|||
orgId.value = result; |
|||
const fetch = (api, params = { orgId }) => { |
|||
return http.post(api, params); |
|||
}; |
|||
|
|||
// 获取表格数据 |
|||
const getTableList = () => { |
|||
fetch(dict.dictionaryUnitManagement, queryParams.value).then((res) => { |
|||
data.value = res.data; |
|||
}); |
|||
}; |
|||
// 修改是否显示状态 |
|||
const updateShowed = (record: any, falg: Boolean) => { |
|||
if (record.showed == 0) { |
|||
record.showed = 1; |
|||
} else { |
|||
record.showed = 0; |
|||
} |
|||
if (falg) { |
|||
fetch(dict.updateDictionary, record).then((res) => { |
|||
getTableList(); |
|||
}); |
|||
} else { |
|||
} |
|||
}; |
|||
|
|||
const visible = ref(false); |
|||
// const formState = ref({ |
|||
// orgId: orgId.value, |
|||
// }); |
|||
const labelCol = { span: 5 }; |
|||
const wrapperCol = { span: 19 }; |
|||
// 定义form表单的必填 |
|||
const rules: Record<string, Rule[]> = { |
|||
grp: [{ required: true, message: '请输入字典组名', trigger: 'change' }], |
|||
grpDesc: [{ required: true, message: '请输入字典组名描述', trigger: 'change' }], |
|||
dicKey: [{ required: true, message: '请输入字典Key', trigger: 'change' }], |
|||
cnValue: [{ required: true, message: '请输入字典中文Value', trigger: 'change' }], |
|||
seq: [{ required: true, message: '请输入排序数字', trigger: 'change' }], |
|||
showed: [{ required: true, message: '请输入是否展示', trigger: 'change' }], |
|||
}; |
|||
// interface FormState { |
|||
// energyType: string; |
|||
// unit: string; |
|||
// collectionNode: string; |
|||
// emissionType: string | undefined; |
|||
// isComputeCarbon: string; |
|||
// janFlag: string; |
|||
// febFlag: string; |
|||
// marFlag: string; |
|||
// aprFlag: string; |
|||
// mayFlag: string; |
|||
// junFlag: string; |
|||
// julFlag: string; |
|||
// augFlag: string; |
|||
// sepFlag: string; |
|||
// octFlag: string; |
|||
// novFlag: string; |
|||
// decFlag: string; |
|||
// } |
|||
// 关闭新增抽屉 |
|||
const onClose = () => { |
|||
visible.value = false; |
|||
// formState.value = { |
|||
// orgId: orgId.value, |
|||
// }; |
|||
// formRef.value.resetFields(); |
|||
}; |
|||
// 打开编辑页 |
|||
const updateDict = (record: any) => { |
|||
updateInfo.value = record; |
|||
visible.value = true; |
|||
// todo 打开编辑页 |
|||
}; |
|||
// 打开新增页 |
|||
const addDict = () => { |
|||
updateInfo.value = {}; |
|||
updateInfo.value.showed = 1; |
|||
visible.value = true; |
|||
// todo 打开编辑页 |
|||
}; |
|||
|
|||
// 点击确定提交 |
|||
const onSubmit = () => { |
|||
debugger; |
|||
formRef.value |
|||
?.validate() |
|||
.then((valid) => { |
|||
if (valid) { |
|||
if (updateInfo.value.id) { |
|||
fetch(dict.updateDictionary, updateInfo.value).then((res) => { |
|||
if (res.retcode == 0) { |
|||
visible.value = false; |
|||
NsMessage.success('保存成功'); |
|||
getTableList(); |
|||
} |
|||
}); |
|||
} else { |
|||
fetch(dict.createDictionary, updateInfo.value).then((res) => { |
|||
if (res.retcode == 0) { |
|||
visible.value = false; |
|||
NsMessage.success('保存成功'); |
|||
getTableList(); |
|||
} |
|||
}); |
|||
} |
|||
} else { |
|||
console.log('表单验证失败'); |
|||
} |
|||
}) |
|||
.catch((error) => { |
|||
console.log('表单验证失败', error); |
|||
}); |
|||
}; |
|||
|
|||
// 删除字典 |
|||
const deleteDict = (record: any) => { |
|||
Modal.confirm({ |
|||
title: '警告', |
|||
// icon: createVNode(ExclamationCircleOutlined), |
|||
content: '确定要删除么?', |
|||
okText: '确认', |
|||
okType: 'primary', |
|||
cancelText: '取消', |
|||
onOk() { |
|||
// let params = ; |
|||
// // http.post(dict.delDictionary, params).then((res) => { |
|||
// // if (res.retcode == 0) { |
|||
// // visible.value = false; |
|||
// // NsMessage.success('删除成功'); |
|||
// // getTableList(); |
|||
// // } |
|||
// // }); |
|||
fetch(dict.delDictionary, { id: record.id }).then((res) => { |
|||
if (res.retcode == 0) { |
|||
visible.value = false; |
|||
NsMessage.success('删除成功'); |
|||
getTableList(); |
|||
} |
|||
}); |
|||
}, |
|||
onCancel() { |
|||
console.log('Cancel'); |
|||
}, |
|||
}); |
|||
}; |
|||
onMounted(() => { |
|||
getTableList(); |
|||
}); |
|||
</script> |
|||
<style scoped lang="less"> |
|||
::v-deep .ant-table-title { |
|||
display: flex; |
|||
} |
|||
::v-deep .ant-table-container { |
|||
padding: 0px 16px; |
|||
} |
|||
</style> |
|||
<style scoped> |
|||
th.column-money, |
|||
td.column-money { |
|||
text-align: right !important; |
|||
} |
|||
</style> |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 4.6 KiB |
@ -0,0 +1,47 @@ |
|||
<template> |
|||
<div class="map-box"> |
|||
<div class="map"> |
|||
<liftInfo /> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import { ref, onMounted } from 'vue'; |
|||
import liftInfo from './liftInfo.vue'; |
|||
// 请求 |
|||
|
|||
// 初始化 =========================================================== |
|||
|
|||
onMounted(() => {}); |
|||
|
|||
// tab页部分 ======================================================== |
|||
|
|||
// 表格数据 |
|||
const dataSource = ref([]); |
|||
</script> |
|||
<style lang="less" scoped> |
|||
.map-box { |
|||
// 颜色变量,用于区别颜色 |
|||
|
|||
// 正常 - 开启 - 上行 -下行 |
|||
--on: #0dffa4; |
|||
// 关闭 |
|||
--off: #bfcde2; |
|||
// 暂停 - 维修 |
|||
--pause: #ffbc46; |
|||
// 告警 - 急停 |
|||
--stop: #f36163; |
|||
// 故障 |
|||
--fault: #ff7636; |
|||
// 未知 |
|||
--unknown: #a742ff; |
|||
width: 100%; |
|||
height: 100%; |
|||
.map { |
|||
width: 1280px; |
|||
height: 720px; |
|||
background-image: url(../image/bg.jpg); |
|||
} |
|||
} |
|||
</style> |
@ -0,0 +1,146 @@ |
|||
<template> |
|||
<div class="info-box"> |
|||
<div class="box-title"> |
|||
<div class="dot"></div> |
|||
<span>办公区域扶梯A</span> |
|||
</div> |
|||
<div class="box-inner"> |
|||
<!-- 是否开启 --> |
|||
<div class="item"> |
|||
<div class="item-box"> |
|||
<div class="icon"> |
|||
<div class="icon-item"> |
|||
<img src="../image/liftState/lift-normal.svg" alt="" /> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="item-text">开启</div> |
|||
</div> |
|||
<!-- 是否故障 --> |
|||
<div class="item"> |
|||
<div class="item-box"> |
|||
<div class="icon"> |
|||
<div class="icon-item"> |
|||
<img src="../image/liftState/lift-normal.svg" alt="" /> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="item-text">开启</div> |
|||
</div> |
|||
<!-- 如何运行 --> |
|||
<div class="item"> |
|||
<div class="item-box"> |
|||
<div class="icon"> |
|||
<div class="icon-item"> |
|||
<img src="../image/liftState/lift-normal.svg" alt="" /> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="item-text">开启</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import { ref, onMounted } from 'vue'; |
|||
|
|||
// 请求 |
|||
|
|||
// 初始化 =========================================================== |
|||
|
|||
onMounted(() => {}); |
|||
|
|||
// tab页部分 ======================================================== |
|||
|
|||
// 运行状态 |
|||
const runState = ref('1'); |
|||
// 电梯状态 |
|||
const liftState = ref('2'); |
|||
</script> |
|||
<style lang="less" scoped> |
|||
// 面板 |
|||
.info-box { |
|||
// 字体颜色变量 |
|||
--text: rgb(20, 255, 255); |
|||
|
|||
width: 240px; |
|||
height: 130px; |
|||
display: flex; |
|||
gap: 5px; |
|||
flex-direction: column; |
|||
background: rgb(17, 44, 86, 0.9); |
|||
border-radius: 8px; |
|||
box-sizing: border-box; |
|||
padding: 8px; |
|||
border: 3px solid var(--text); |
|||
// 面板标题 |
|||
.box-title { |
|||
height: auto; |
|||
color: var(--text); |
|||
// 标题前小方块 |
|||
.dot { |
|||
display: inline-block; |
|||
width: 2px; |
|||
height: 16px; |
|||
vertical-align: middle; |
|||
background: var(--text); |
|||
} |
|||
// 标题 |
|||
span { |
|||
padding-left: 8px; |
|||
} |
|||
} |
|||
// 下半部分 |
|||
.box-inner { |
|||
flex: 1; |
|||
display: flex; |
|||
padding: 0 10px; |
|||
// 单个盒子(3盒子) |
|||
.item { |
|||
flex: 1; |
|||
display: flex; |
|||
flex-direction: column; |
|||
// 盒子中放置图片的容器 |
|||
.item-box { |
|||
flex: 1; |
|||
display: flex; |
|||
align-items: center; |
|||
justify-content: center; |
|||
// border: 1px solid red; |
|||
.icon { |
|||
width: 55px; |
|||
height: 55px; |
|||
background-image: url(../image/box.svg); |
|||
background-size: 130% 130%; |
|||
background-repeat: no-repeat; |
|||
background-position: left -8px top -8px; |
|||
// border: 1px solid red; |
|||
position: relative; |
|||
.icon-item { |
|||
position: absolute; |
|||
width: 20px; |
|||
height: 20px; |
|||
left: 0; |
|||
right: 0; |
|||
bottom: 0; |
|||
top: 0; |
|||
margin: auto; |
|||
img { |
|||
width: 100%; |
|||
height: 100%; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
.item-text { |
|||
height: 20px; |
|||
text-align: center; |
|||
font-size: 12px; |
|||
color: white; |
|||
user-select: none; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
</style> |
@ -1,263 +1,276 @@ |
|||
<template> |
|||
<div class="lighting-box"> |
|||
<div class="lighting-img-box"> |
|||
<!-- 左上角,区域切换 --> |
|||
<div class="btn-box"> |
|||
<button class="btn-item" @click=changeFloor(1)>1F</button> |
|||
<button class="btn-item" @click=changeFloor(2)>2F</button> |
|||
<div class="lighting-box"> |
|||
<div class="lighting-img-box"> |
|||
<!-- 左上角,区域切换 --> |
|||
<div class="btn-box"> |
|||
<button v-for="item in floorData" class="btn-item" @click="changeFloor(item.childList)">{{ |
|||
item.name |
|||
}}</button> |
|||
</div> |
|||
<!-- 楼层区域 --> |
|||
<div class="area"> |
|||
<div |
|||
v-for="(item, index) in treeData" |
|||
:class="computedClass(item.id)" |
|||
@click="changeThisArea([item])" |
|||
:key="index"> |
|||
<div v-for="(v, i) in item.childList" :key="i" class="light-group"> |
|||
<div class="group-shadow" @click.stop="changeThisArea([item, v])"> |
|||
<div :class="computedClass(v.id)" class="shadow-box"></div> |
|||
</div> |
|||
<!-- 楼层区域 --> |
|||
<div class="area"> |
|||
<div |
|||
v-for="(item, index) in treeData" |
|||
:class="computedClass(item.id)" |
|||
@click="changeThisArea([item])" |
|||
:key="index"> |
|||
<div v-for="(v, i) in item.children" :key="i" class="light-group"> |
|||
<div class="group-shadow" @click.stop="changeThisArea([item, v])"> |
|||
<div :class="computedClass(v.id)" class="shadow-box"></div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<!-- 照明设备 --> |
|||
<div class="lights"> |
|||
<light v-for="(item, index) in bulbs" |
|||
:key="index" |
|||
:styleObject="item.styleText" |
|||
:type="item.type" |
|||
:visible="item.visible"> |
|||
</light> |
|||
</div> |
|||
</div> |
|||
<!-- 右侧抽屉的触发按钮 --> |
|||
<div class="drawer-box-in" v-if="!visible" @click="toggleDrawer"> |
|||
<double-left-outlined class="drawer-icon" style="color: white" /> |
|||
</div> |
|||
<!-- 左侧抽屉的关闭按钮 --> |
|||
<div class="drawer-box-out" v-if="visible" @click="toggleDrawer"> |
|||
<double-right-outlined class="drawer-icon" style="color: white;" /> |
|||
</div> |
|||
</div> |
|||
<!-- 右侧抽屉 --> |
|||
<a-drawer |
|||
v-model:visible="visible" |
|||
class="drawer-item" |
|||
width="496" |
|||
placement="right" |
|||
:body-style="{ background: 'rgba(0, 0, 0)', opacity: 0.8 }" |
|||
:closable="false" |
|||
id="drawer" |
|||
:maskStyle="{ 'background-color': 'rgba(0, 0, 0, 0)' }"> |
|||
<a-tabs v-model:activeKey="activeKey"> |
|||
<a-tab-pane key="1" tab="控制面板"> |
|||
<tabs1 @changeArea="changeArea" :treeData="treeData" :nowArea="nowArea"></tabs1> |
|||
</a-tab-pane> |
|||
<a-tab-pane key="2" tab="计划列表" force-render> |
|||
<tabs2></tabs2> |
|||
</a-tab-pane> |
|||
<a-tab-pane key="3" tab="日志"> |
|||
<tabs3></tabs3> |
|||
</a-tab-pane> |
|||
</a-tabs> |
|||
</a-drawer> |
|||
</div> |
|||
<!-- 照明设备 --> |
|||
<div class="lights"> |
|||
<light |
|||
v-for="(item, index) in bulbs" |
|||
:key="index" |
|||
:styleObject="item.styleText" |
|||
:type="item.type" |
|||
:visible="item.visible" /> |
|||
</div> |
|||
</div> |
|||
<!-- 右侧抽屉的触发按钮 --> |
|||
<div class="drawer-box-in" v-if="!visible" @click="toggleDrawer"> |
|||
<double-left-outlined class="drawer-icon" style="color: white" /> |
|||
</div> |
|||
<!-- 左侧抽屉的关闭按钮 --> |
|||
<div class="drawer-box-out" v-if="visible" @click="toggleDrawer"> |
|||
<double-right-outlined class="drawer-icon" style="color: white" /> |
|||
</div> |
|||
<!-- 右侧抽屉 --> |
|||
<a-drawer |
|||
v-model:visible="visible" |
|||
class="drawer-item" |
|||
width="496" |
|||
:forceRender="preload" |
|||
placement="right" |
|||
:body-style="{ background: 'rgba(0, 0, 0)', opacity: 0.8 }" |
|||
:closable="false" |
|||
id="drawer" |
|||
:maskStyle="{ 'background-color': 'rgba(0, 0, 0, 0)' }"> |
|||
<a-tabs v-model:activeKey="activeKey"> |
|||
<a-tab-pane key="1" tab="控制面板"> |
|||
<tabs1 ref="tabs1Ref" @changeArea="changeArea" @reset="reset" :treeData="treeData" /> |
|||
</a-tab-pane> |
|||
<a-tab-pane key="2" tab="计划列表" force-render> |
|||
<tabs2 /> |
|||
</a-tab-pane> |
|||
<a-tab-pane key="3" tab="日志"> |
|||
<tabs3 /> |
|||
</a-tab-pane> |
|||
</a-tabs> |
|||
</a-drawer> |
|||
</div> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
|
|||
import { ref, onMounted } from 'vue'; |
|||
// 组件 |
|||
import light from './light.vue'; |
|||
import tabs1 from './tabs1.vue' |
|||
import tabs2 from './tabs2.vue' |
|||
import tabs3 from './tabs3.vue' |
|||
// 请求 |
|||
import { http } from '/nerv-lib/util/http'; |
|||
import { lightingManage } from '/@/api/IlluminationInfo'; |
|||
// ICON |
|||
import { |
|||
DoubleLeftOutlined, |
|||
DoubleRightOutlined |
|||
} from '@ant-design/icons-vue'; |
|||
|
|||
// 类声明 ======================================================= |
|||
|
|||
interface items { |
|||
id: string, |
|||
<script setup lang="ts"> |
|||
import { ref, onMounted } from 'vue'; |
|||
// 组件 |
|||
import light from './light.vue'; |
|||
import tabs1 from './tabs1.vue'; |
|||
import tabs2 from './tabs2.vue'; |
|||
import tabs3 from './tabs3.vue'; |
|||
// 请求 |
|||
import { http } from '/nerv-lib/util/http'; |
|||
import { lightingManage } from '/@/api/IlluminationInfo'; |
|||
// ICON |
|||
import { DoubleLeftOutlined, DoubleRightOutlined } from '@ant-design/icons-vue'; |
|||
|
|||
} |
|||
// 初始化 ======================================================= |
|||
|
|||
// 初始化 ======================================================= |
|||
onMounted(() => { |
|||
// 获得分区与线路的结构 |
|||
getAllArea(); |
|||
}); |
|||
|
|||
onMounted(() => { |
|||
http.post(lightingManage.getArea, { floor: '1', siteId: '10000001' }).then(res => { |
|||
const data = res.data |
|||
/** 由前端创建的,只在前端使用的变量 |
|||
* @param id 用于判断样式和层级的前端属性 |
|||
* @param selected 用于表示是否选中的前端属性 |
|||
*/ |
|||
data.forEach((item, index) => { |
|||
if (index == 0) { |
|||
item.selected = true |
|||
} else { |
|||
item.selected = false |
|||
} |
|||
item.id = String(index + 1) |
|||
item.children = [] |
|||
// deviceGroup后端返回了对象,此处转化为数组 |
|||
let i = 1; |
|||
for (let obj in item.deviceGroup) { |
|||
item.deviceGroup[obj].selected = false |
|||
item.deviceGroup[obj].id = String((index + 1) + '-' + i++) |
|||
item.children.push(item.deviceGroup[obj]) |
|||
} |
|||
}) |
|||
treeData.value = data |
|||
}) |
|||
}) |
|||
// 预加载flag,获得分区数据后,预加载抽屉,防止获取ref报错 |
|||
const preload = ref(false); |
|||
|
|||
// 分层业务 ===================================================== |
|||
// 分层业务 ===================================================== |
|||
|
|||
// 左上角分层切换 |
|||
const changeFloor = (area: number) => { |
|||
if (area == 1) { |
|||
console.log('1F') |
|||
} else if (area == 2) { |
|||
console.log('2F') |
|||
} |
|||
} |
|||
// 所有楼层的数据 |
|||
const floorData = ref([]); |
|||
// 左上角分层切换 |
|||
const changeFloor = (area: any) => { |
|||
// 重置数据 |
|||
reset(); |
|||
// 重置视图 |
|||
changeArea(['1']); |
|||
// 切换楼层数据 |
|||
treeData.value = area; |
|||
// 默认选择第一项 |
|||
treeData.value[0].selected = true; |
|||
}; |
|||
|
|||
// 分区业务 ===================================================== |
|||
// 分区业务 ===================================================== |
|||
|
|||
// 分区结构树 |
|||
const treeData = ref([]) |
|||
// 当前选中的分区id |
|||
const nowArea = ref('1') |
|||
// 当前选中的分区序号 - 用于样式渲染 |
|||
const area = ref(['1']) |
|||
// 线路内小灯泡 - 此处位置需前端写死 |
|||
const bulbs = ref([ |
|||
// 分区结构树 |
|||
const treeData = ref([]); |
|||
// 当前选中的分区序列 - 用于样式渲染 |
|||
const area = ref(['1']); |
|||
// 线路内小灯泡 - 此处位置需前端写死 |
|||
const bulbs = ref([ |
|||
{ |
|||
styleText: { left: '180px', bottom: '200px' }, |
|||
area: 1, |
|||
type: 1, |
|||
visible: true |
|||
styleText: { left: '180px', bottom: '200px' }, |
|||
area: 1, |
|||
type: 1, |
|||
visible: true, |
|||
}, |
|||
{ |
|||
styleText: { left: '230px', bottom: '125px' }, |
|||
area: 1, |
|||
type: 2, |
|||
visible: true |
|||
styleText: { left: '230px', bottom: '125px' }, |
|||
area: 1, |
|||
type: 2, |
|||
visible: true, |
|||
}, |
|||
{ |
|||
styleText: { left: '320px', bottom: '140px' }, |
|||
area: 1, |
|||
type: 3, |
|||
visible: true |
|||
styleText: { left: '320px', bottom: '140px' }, |
|||
area: 1, |
|||
type: 3, |
|||
visible: true, |
|||
}, |
|||
{ |
|||
styleText: { left: '245px', bottom: '230px' }, |
|||
area: 1, |
|||
type: 3, |
|||
visible: true |
|||
styleText: { left: '245px', bottom: '230px' }, |
|||
area: 1, |
|||
type: 3, |
|||
visible: true, |
|||
}, |
|||
{ |
|||
styleText: { left: '405px', bottom: '230px' }, |
|||
area: 2, |
|||
type: 3, |
|||
visible: true |
|||
styleText: { left: '405px', bottom: '230px' }, |
|||
area: 2, |
|||
type: 3, |
|||
visible: true, |
|||
}, |
|||
{ |
|||
styleText: { left: '460px', bottom: '180px' }, |
|||
area: 2, |
|||
type: 3, |
|||
visible: true |
|||
styleText: { left: '460px', bottom: '180px' }, |
|||
area: 2, |
|||
type: 3, |
|||
visible: true, |
|||
}, |
|||
{ |
|||
styleText: { left: '360px', bottom: '275px' }, |
|||
area: 2, |
|||
type: 3, |
|||
visible: true |
|||
styleText: { left: '360px', bottom: '275px' }, |
|||
area: 2, |
|||
type: 3, |
|||
visible: true, |
|||
}, |
|||
{ |
|||
styleText: { left: '715px', bottom: '320px' }, |
|||
area: 3, |
|||
type: 1, |
|||
visible: true |
|||
styleText: { left: '715px', bottom: '320px' }, |
|||
area: 3, |
|||
type: 1, |
|||
visible: true, |
|||
}, |
|||
]) |
|||
// 由子组件控制的分区与线路切换 |
|||
const changeArea = (result: any) => { |
|||
console.log(result,'changeArea') |
|||
]); |
|||
// 由子组件控制的分区与线路切换 |
|||
const changeArea = (result: any) => { |
|||
console.log(result, 'changeArea'); |
|||
// 数组 |
|||
if (Array.isArray(result)) { |
|||
area.value = result |
|||
// 不是数组 |
|||
area.value = result; |
|||
// 不是数组 |
|||
} else { |
|||
area.value.length = 0 |
|||
area.value[0] = String(result) |
|||
} |
|||
} |
|||
// 由当前组件控制的分区切换 |
|||
const changeThisArea = (result: any) => { |
|||
console.log(result, 'changeThisArea') |
|||
area.value.length = 0; |
|||
area.value[0] = String(result); |
|||
} |
|||
}; |
|||
// 由当前组件控制的分区切换 |
|||
const changeThisArea = (result: any) => { |
|||
console.log(result, 'changeThisArea'); |
|||
// 修改前,将所有选项置空 |
|||
reset() |
|||
reset(); |
|||
let level1 = result[0]; |
|||
area.value.length = 0 |
|||
area.value.length = 0; |
|||
// 只选择了分区 |
|||
if (result.length === 1) { |
|||
result[0].selected = true |
|||
area.value.push(result[0].id) |
|||
result[0].selected = true; |
|||
area.value.push(result[0].id); |
|||
// 控制子组件按钮区 |
|||
tabs1Ref.value.changeArea(result[0]); |
|||
// 选择了分区 + 线路 |
|||
} else if (result.length === 2) { |
|||
// 如果没有分区,默认选择第一个 |
|||
if (!level1) { |
|||
level1 = treeData.value[0] |
|||
} |
|||
// 选中状态都设为true |
|||
level1.selected = result[1].selected = true |
|||
area.value.splice(0, 0, level1.id, result[1].id) |
|||
// 如果没有分区,默认选择第一个 |
|||
if (!level1) { |
|||
level1 = treeData.value[0]; |
|||
} |
|||
// 选中状态都设为true |
|||
level1.selected = result[1].selected = true; |
|||
area.value.splice(0, 0, level1.id, result[1].id); |
|||
// 控制子组件按钮区 |
|||
tabs1Ref.value.changeArea(result[0]); |
|||
tabs1Ref.value.changeLine(result[1]); |
|||
} |
|||
nowArea.value = level1.id |
|||
} |
|||
// 重置分区树所有当前选项 |
|||
const reset = () => { |
|||
treeData.value.forEach(item => { |
|||
item.selected = false |
|||
item.children.forEach(i => { |
|||
i.selected = false |
|||
}) |
|||
}) |
|||
} |
|||
// 俯视图分区选中计算函数 |
|||
const computedClass = (string: string) => { |
|||
}; |
|||
// 重置分区树所有当前选项 |
|||
const reset = () => { |
|||
treeData.value.forEach((item: any) => { |
|||
item.selected = false; |
|||
item.childList.forEach((i: any) => { |
|||
i.selected = false; |
|||
}); |
|||
}); |
|||
}; |
|||
// 俯视图分区选中计算函数 |
|||
const computedClass = (string: string) => { |
|||
if (area.value.indexOf(string) != -1) { |
|||
return `isActive area-item area${string}` |
|||
return `isActive area-item area${string}`; |
|||
} else { |
|||
return `area-item area${string}` |
|||
return `area-item area${string}`; |
|||
} |
|||
} |
|||
}; |
|||
|
|||
// 抽屉业务 ===================================================== |
|||
// 获得所有分区 |
|||
const getAllArea = () => { |
|||
http.get(lightingManage.getArea, { projectId: 'HLlmTZp8' }).then((res) => { |
|||
const data = res.data; |
|||
floorData.value = data; |
|||
/** 只在前端使用的变量 |
|||
* @param id 用于判断样式和层级的前端属性 |
|||
* @param selected 用于表示是否选中的前端属性 |
|||
*/ |
|||
data.forEach((floor: any) => { |
|||
floor.childList.forEach((item: any, index: number) => { |
|||
if (index == 0) { |
|||
item.selected = true; |
|||
} else { |
|||
item.selected = false; |
|||
} |
|||
item.id = String(index + 1); |
|||
item.childList.forEach((v: any, i: number) => { |
|||
v.selected = false; |
|||
v.id = index + 1 + '-' + (i + 1); |
|||
}); |
|||
}); |
|||
}); |
|||
// 默认展示 线路 1-1 |
|||
treeData.value = data[0].childList; |
|||
// 开始预加载 |
|||
preload.value = true; |
|||
}); |
|||
}; |
|||
|
|||
// 抽屉 - 当前选择的tab |
|||
let activeKey = ref('1'); |
|||
// 抽屉 - 打开状态 |
|||
let visible = ref(false); |
|||
// 抽屉 - 开关事件 |
|||
const toggleDrawer = () => { |
|||
visible.value = !visible.value; |
|||
}; |
|||
// 抽屉业务 ===================================================== |
|||
|
|||
// 抽屉 - 当前选择的tab |
|||
let activeKey = ref('1'); |
|||
// 抽屉 - 打开状态 |
|||
let visible = ref(false); |
|||
// 抽屉 - 开关事件 |
|||
const toggleDrawer = () => { |
|||
visible.value = !visible.value; |
|||
}; |
|||
// 抽屉tab1组件的引用 |
|||
const tabs1Ref = ref(); |
|||
</script> |
|||
<style lang="less" scoped> |
|||
@import "./index.less"; |
|||
// 当前选中分区的样式 |
|||
.isActive { |
|||
@import './index.less'; |
|||
|
|||
// 当前选中分区的样式 |
|||
.isActive { |
|||
border: 3px solid white !important; |
|||
} |
|||
// 抽屉顶部tab按钮样式 |
|||
:deep(.ant-tabs-tab-btn) { |
|||
} |
|||
|
|||
// 抽屉顶部tab按钮样式 |
|||
:deep(.ant-tabs-tab-btn) { |
|||
color: white; |
|||
} |
|||
} |
|||
</style> |
|||
|
@ -1,88 +0,0 @@ |
|||
import { ref } from 'vue'; |
|||
export const treeData = ref([ |
|||
{ |
|||
label: '站厅', |
|||
id: '1', |
|||
// 前端遍历后添加,属前端属性
|
|||
selected: false, |
|||
children: [{ |
|||
label: '站厅1区', |
|||
id: '1-1', |
|||
// 前端属性
|
|||
selected: false, |
|||
// 后端属性(表示禁用了一个设备)
|
|||
stop: false, |
|||
// 当前的控制模式
|
|||
type: 3 |
|||
},{ |
|||
label: '站厅2区', |
|||
id: '1-2', |
|||
selected: false, |
|||
stop: false, |
|||
type: 1 |
|||
}] |
|||
}, |
|||
{ |
|||
label: '站台', |
|||
id: '2', |
|||
selected: false, |
|||
children: [{ |
|||
label: '站台1区', |
|||
id: '2-1', |
|||
selected: false, |
|||
stop: false, |
|||
type: 1 |
|||
},{ |
|||
label: '站台2区', |
|||
id: '2-2', |
|||
selected: false, |
|||
stop: false, |
|||
type: 2 |
|||
},{ |
|||
label: '站台3区', |
|||
id: '2-3', |
|||
selected: false, |
|||
stop: false, |
|||
type: 3 |
|||
},{ |
|||
label: '站台4区', |
|||
id: '2-4', |
|||
selected: false, |
|||
stop: false, |
|||
type: 1 |
|||
}] |
|||
},{ |
|||
label: '办公室', |
|||
id: '3', |
|||
selected: false, |
|||
children: [{ |
|||
label: '办公室1区', |
|||
id: '3-1', |
|||
selected: false, |
|||
stop: false, |
|||
type: 2 |
|||
}] |
|||
},{ |
|||
label: '楼道', |
|||
id: '4', |
|||
selected: false, |
|||
children: [{ |
|||
label: '楼道1区', |
|||
id: '4-1', |
|||
selected: false, |
|||
stop: false, |
|||
type: 3 |
|||
}] |
|||
}, |
|||
]); |
|||
|
|||
export const controlType = ref([{ |
|||
name: '托管', |
|||
type: 1, |
|||
},{ |
|||
name: 'AI', |
|||
type: 2, |
|||
},{ |
|||
name: '手动', |
|||
type: 3, |
|||
}]) |