Merge branch 'temp' of http://123.60.103.97:3000/xuziqiang/SaaS-lib into temp
This commit is contained in:
@@ -2,8 +2,8 @@ export enum energyAlarms {
|
||||
getTableList = '/carbon-smart/api/AlarmEnergyConsumption/selectAlarmEnergyConsumption', //能耗告警分页
|
||||
addOrUpNewData = '/carbon-smart/api/AlarmEnergyConsumption/creatOrUpdate', //能耗告警添加 修改
|
||||
del = '/carbon-smart/api/AlarmEnergyConsumption/delete', //能耗删除
|
||||
configGetTableList = '/carbon-smart/api/AlarmEquipmentRule/selectAlarmEquipmentRule', //配置设备告警分页
|
||||
configAddOrUpNewData = '/carbon-smart/api/AlarmEquipmentRule/creatOrUpdate', //配置设备告警添加 修改
|
||||
configFindById = '/carbon-smart/api/AlarmEquipmentRule/findById', //配置设备告警 查询详情
|
||||
configDel = '/carbon-smart/api/AlarmEquipmentRule/delete', //配置设备告警删除
|
||||
configGetTableList = '/carbon-smart/api/AlarmEnergyConsumptionRule/selectAlarmEnergyConsumptionRule', //配置设备告警分页
|
||||
configAddOrUpNewData = '/carbon-smart/api/AlarmEnergyConsumptionRule/creatOrUpdate', //配置设备告警添加 修改
|
||||
configFindById = '/carbon-smart/api/AlarmEnergyConsumptionRule/findById', //配置设备告警 查询详情
|
||||
configDel = '/carbon-smart/api/AlarmEnergyConsumptionRule/delete', //配置设备告警删除
|
||||
}
|
||||
|
||||
@@ -8,6 +8,9 @@ export enum carbonEmissionFactorLibrary {
|
||||
getCarbonFactorTree = '/carbon-smart/api/carbon/emission/type/getCarbonFactorTree',
|
||||
creat = '/carbon-smart/api/carbon/emission/type/creatOrUpdate',
|
||||
delTreeNode = '/carbon-smart/api/carbon/emission/type/del',
|
||||
// 单位管理
|
||||
dictionaryUnitManagement = '/carbon-smart/api/carbon/emission/factor/dictionaryUnitManagement',
|
||||
findOutermost = '/carbon-smart/api/carbon/emission/factor/findOutermost',
|
||||
}
|
||||
// 碳排管理-碳排统计接口
|
||||
export enum energyConsumption {
|
||||
|
||||
@@ -30,7 +30,9 @@
|
||||
style="flex: 1; height: 100%; background-color: white; border-radius: 4px; padding: 12px">
|
||||
<div ref="echartPieOne" style="width: 100%; height: 100%"></div>
|
||||
</div>
|
||||
<div style="flex: 1; height: 100%; background-color: white; border-radius: 4px"> xxxx </div>
|
||||
<div style="flex: 1; height: 100%; background-color: white; border-radius: 4px">
|
||||
<div ref="echartPieTow" style="width: 100%; height: 100%"></div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 告警矩形 echarts -->
|
||||
<div style="flex: 4; width: 100%; background-color: white; border-radius: 4px; padding: 12px">
|
||||
@@ -49,8 +51,10 @@
|
||||
const info = ref({});
|
||||
let chartInstance: echarts.ECharts | null = null;
|
||||
let chartInstanceOne: echarts.ECharts | null = null;
|
||||
let chartInstanceTow: echarts.ECharts | null = null;
|
||||
const graphChart = ref(null);
|
||||
const echartPieOne = ref(null);
|
||||
const echartPieTow = ref(null);
|
||||
const getGraphChart = () => {
|
||||
let dayData = [];
|
||||
let energyAlarm = [];
|
||||
@@ -294,7 +298,7 @@
|
||||
},
|
||||
textAlign: 'center',
|
||||
x: '44.3%',
|
||||
y: '46%',
|
||||
y: '43%',
|
||||
},
|
||||
],
|
||||
tooltip: {
|
||||
@@ -327,9 +331,10 @@
|
||||
clockwise: false, //饼图的扇区是否是顺时针排布
|
||||
avoidLabelOverlap: false,
|
||||
label: {
|
||||
show: true,
|
||||
normal: {
|
||||
show: true,
|
||||
position: 'outter',
|
||||
position: 'outside',
|
||||
textStyle: {
|
||||
fontSize: 14,
|
||||
fontWeight: 'bold',
|
||||
@@ -342,7 +347,7 @@
|
||||
labelLine: {
|
||||
show: true, // 控制标签线是否显示
|
||||
length: 10, // 标签线长度
|
||||
length2: 20, // 标签线引出部分长度
|
||||
length2: 0, // 标签线引出部分长度
|
||||
// 其他样式属性,如 lineStyle 等
|
||||
},
|
||||
data: m2R2Data,
|
||||
@@ -352,11 +357,107 @@
|
||||
chartInstanceOne = echarts.init(echartPieOne.value);
|
||||
chartInstanceOne.setOption(option);
|
||||
};
|
||||
const getEchartPieTow = () => {
|
||||
if (chartInstanceTow) {
|
||||
chartInstanceTow.dispose();
|
||||
}
|
||||
chartInstanceTow = echarts.init(echartPieTow.value);
|
||||
var m2R2Data = [
|
||||
{ value: 335, name: '紧急', itemStyle: { color: '#F56E53' } },
|
||||
{ value: 310, name: '重要', itemStyle: { color: '#F7C122' } },
|
||||
{ value: 234, name: '一般', itemStyle: { color: '#3BC27F' } },
|
||||
];
|
||||
const option = {
|
||||
title: [
|
||||
{
|
||||
text: '优先级 / 近30天',
|
||||
textStyle: {
|
||||
fontSize: 16,
|
||||
fontWeight: 'normal',
|
||||
color: '#aaaaaa',
|
||||
},
|
||||
left: '2%',
|
||||
top: '2%',
|
||||
},
|
||||
{
|
||||
text: '优先级',
|
||||
subtext: 12312 + '个',
|
||||
textStyle: {
|
||||
fontSize: 24,
|
||||
color: 'black',
|
||||
},
|
||||
subtextStyle: {
|
||||
fontSize: 24,
|
||||
fontWeight: '700',
|
||||
color: 'black',
|
||||
},
|
||||
textAlign: 'center',
|
||||
x: '44.3%',
|
||||
y: '43%',
|
||||
},
|
||||
],
|
||||
tooltip: {
|
||||
trigger: 'item',
|
||||
formatter: function (parms) {
|
||||
var str = parms.marker + ' :' + parms.data.value;
|
||||
return str;
|
||||
},
|
||||
},
|
||||
legend: {
|
||||
// 设置图例靠右,上下居中,垂直排列
|
||||
right: 50,
|
||||
top: 'center',
|
||||
orient: 'vertical',
|
||||
// 图例图标设置为圆形
|
||||
icon: 'circle',
|
||||
itemWidth: 12,
|
||||
itemHeight: 12,
|
||||
itemGap: 16,
|
||||
textStyle: {
|
||||
fontSize: 14,
|
||||
},
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '优先级',
|
||||
type: 'pie',
|
||||
center: ['45%', '50%'],
|
||||
radius: ['50%', '70%'],
|
||||
clockwise: false, //饼图的扇区是否是顺时针排布
|
||||
avoidLabelOverlap: false,
|
||||
label: {
|
||||
show: true,
|
||||
normal: {
|
||||
show: true,
|
||||
position: 'outside',
|
||||
textStyle: {
|
||||
fontSize: 14,
|
||||
fontWeight: 'bold',
|
||||
},
|
||||
formatter: function (parms) {
|
||||
return '[ ' + parms.data.name + ' ] : ' + parms.data.value;
|
||||
},
|
||||
},
|
||||
},
|
||||
labelLine: {
|
||||
show: true, // 控制标签线是否显示
|
||||
length: 10, // 标签线长度
|
||||
length2: 0, // 标签线引出部分长度
|
||||
// 其他样式属性,如 lineStyle 等
|
||||
},
|
||||
data: m2R2Data,
|
||||
},
|
||||
],
|
||||
};
|
||||
chartInstanceTow = echarts.init(echartPieTow.value);
|
||||
chartInstanceTow.setOption(option);
|
||||
};
|
||||
onMounted(() => {
|
||||
//渲染第三个图表
|
||||
getGraphChart();
|
||||
//优先级
|
||||
getEchartPieOne();
|
||||
getEchartPieTow();
|
||||
});
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
|
||||
@@ -11,27 +11,23 @@
|
||||
}"
|
||||
@click="clickSwitch({ enableRules: record.enableRules, record: record })" />
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'equipmentInfo'">
|
||||
{{
|
||||
record?.enableRules
|
||||
? record.enableRules + '>' + record.deviceType + '>' + record.deviceName
|
||||
: '-'
|
||||
}}
|
||||
<template v-if="column.dataIndex === 'comparisonType'">
|
||||
{{ getcomparisonType(record) }}
|
||||
</template>
|
||||
</template>
|
||||
</ns-view-list-table>
|
||||
<!-- 新增or编辑界面 -->
|
||||
<editConfigureEnergyAlarm ref="editConfigureEnergyAlarms" />
|
||||
<editConfigureEnergyAlarm ref="editConfigureEnergyAlarms" @editObject="editObject" />
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import { ref, createVNode } from 'vue';
|
||||
import { http } from '/nerv-lib/util';
|
||||
import data from '../notificationManagementMock.json';
|
||||
import { NsMessage, NsModal } from '/nerv-lib/component';
|
||||
import editConfigureEnergyAlarm from './editConfigureEnergyAlarm.vue';
|
||||
import { deviceAlarms } from '/@/api/alarmSettings/deviceAlarms';
|
||||
import { energyAlarms } from '/@/api/alarmSettings/energyAlarm';
|
||||
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||
import { device } from '/@/api/deviceManage';
|
||||
import { dict } from '/@/api';
|
||||
|
||||
export default {
|
||||
components: { editConfigureEnergyAlarm },
|
||||
@@ -43,11 +39,37 @@
|
||||
const tableConfig = ref({});
|
||||
const mainRef = ref({});
|
||||
const editConfigureEnergyAlarms = ref({});
|
||||
const mockData = ref(data.listData);
|
||||
//组织树
|
||||
const orgId = ref('');
|
||||
const result = JSON.parse(sessionStorage.getItem('ORGID')!);
|
||||
orgId.value = result;
|
||||
//获取对比类型
|
||||
const getcomparisonType = (data: any) => {
|
||||
let datas = data.comparisonType.split(',');
|
||||
if (datas[0] === '1') {
|
||||
switch (datas[1]) {
|
||||
case '1':
|
||||
return '数值>输入数值';
|
||||
case '2':
|
||||
return '数值>同比';
|
||||
case '3':
|
||||
return '数值>环比';
|
||||
case '4':
|
||||
return '数值>对比基准';
|
||||
}
|
||||
} else {
|
||||
switch (datas[1]) {
|
||||
case '1':
|
||||
return '比例>输入比例';
|
||||
case '2':
|
||||
return '比例>同比';
|
||||
case '3':
|
||||
return '比例>环比';
|
||||
case '4':
|
||||
return '比例>对比基准';
|
||||
}
|
||||
}
|
||||
};
|
||||
const clickSwitch = (data: any) => {
|
||||
NsModal.confirm({
|
||||
title: '启用状态',
|
||||
@@ -55,7 +77,7 @@
|
||||
content: '确定' + (data.record.enableRules === 1 ? '关闭' : '启用') + '规则吗?',
|
||||
onOk: () => {
|
||||
http
|
||||
.post(deviceAlarms.addOrUpNewData, {
|
||||
.post(energyAlarms.configAddOrUpNewData, {
|
||||
id: data.record.id,
|
||||
enableRules: data.record.enableRules === 1 ? 0 : 1,
|
||||
})
|
||||
@@ -80,8 +102,7 @@
|
||||
show.value = true;
|
||||
tableConfig.value = {
|
||||
title: '告警规则',
|
||||
api: deviceAlarms.getTableList,
|
||||
value: mockData.value,
|
||||
api: energyAlarms.configGetTableList,
|
||||
headerActions: [
|
||||
{
|
||||
label: '新增',
|
||||
@@ -120,14 +141,24 @@
|
||||
label: '批量删除',
|
||||
type: 'primary',
|
||||
name: 'userBatchDel',
|
||||
confirm: true,
|
||||
dynamicDisabled: (data: any) => {
|
||||
return data.list.length === 0;
|
||||
},
|
||||
confirm: true,
|
||||
isReload: true,
|
||||
isClearCheck: true,
|
||||
// api: origanizemanage.batchDel,
|
||||
dynamicParams: { userIds: 'userId[]' },
|
||||
handle: (data: any) => {
|
||||
let ids = [];
|
||||
data.list.forEach((item) => {
|
||||
ids.push(item.id);
|
||||
});
|
||||
data.list = [];
|
||||
http.post(energyAlarms.configDel, { ids: ids.toString() }).then(() => {
|
||||
NsMessage.success('告警规则删除成功');
|
||||
//清空选中
|
||||
mainRef.value.nsTableRef.clearCheck();
|
||||
//刷新表单
|
||||
mainRef.value?.nsTableRef.reload();
|
||||
});
|
||||
},
|
||||
},
|
||||
],
|
||||
columns: [
|
||||
@@ -144,7 +175,7 @@
|
||||
},
|
||||
{
|
||||
title: '设备信息/节点信息',
|
||||
dataIndex: 'equipmentInfo',
|
||||
dataIndex: 'deviceInfo',
|
||||
},
|
||||
{
|
||||
title: '对比类型',
|
||||
@@ -152,11 +183,11 @@
|
||||
},
|
||||
{
|
||||
title: '告警点位',
|
||||
dataIndex: 'devicePoint',
|
||||
dataIndex: 'devicePointName',
|
||||
},
|
||||
{
|
||||
title: '判断条件',
|
||||
dataIndex: 'ruleType',
|
||||
dataIndex: 'conditionalJudgment',
|
||||
},
|
||||
{
|
||||
title: '异常描述',
|
||||
@@ -185,8 +216,12 @@
|
||||
name: 'FeedBackDetail',
|
||||
dynamicParams: ['uuid', 'appealType'],
|
||||
confirm: true,
|
||||
handle: () => {
|
||||
// mockData.value.splice(0, 1);
|
||||
handle: (data: any) => {
|
||||
http.post(energyAlarms.configDel, { ids: data.id }).then(() => {
|
||||
NsMessage.success('告警规则删除成功');
|
||||
//刷新表单
|
||||
mainRef.value?.nsTableRef.reload();
|
||||
});
|
||||
},
|
||||
},
|
||||
],
|
||||
@@ -194,78 +229,106 @@
|
||||
formConfig: {
|
||||
title: value.errorCode,
|
||||
schemas: [
|
||||
// {
|
||||
// field: 'deviceNode',
|
||||
// label: '设备名称',
|
||||
// component: 'nsSelectApi',
|
||||
// componentProps: {
|
||||
// api: device.queryDevicePage,
|
||||
// allowClear: true,
|
||||
// params: {
|
||||
// orgId: orgId.value,
|
||||
// pageNum: 1,
|
||||
// pageSize: 99,
|
||||
// },
|
||||
// placeholder: '请选择设备名称',
|
||||
// resultField: 'data.records',
|
||||
// labelField: 'deviceName',
|
||||
// valueField: 'id',
|
||||
// showSearch: true,
|
||||
// filterOption: (input: string, option: any) => {
|
||||
// return option.deviceName.toLowerCase().indexOf(input.toLowerCase()) >= 0;
|
||||
// },
|
||||
// // autoAddLink: true, //默认添加联动
|
||||
// },
|
||||
// },
|
||||
{
|
||||
field: 'deviceName',
|
||||
label: '设备名称',
|
||||
component: 'nsSelectApi',
|
||||
label: '设备信息/节点信息',
|
||||
component: 'NsInput',
|
||||
componentProps: {
|
||||
api: device.queryDevicePage,
|
||||
params: {
|
||||
orgId: orgId.value,
|
||||
pageNum: 1,
|
||||
pageSize: 99,
|
||||
allowClear: true,
|
||||
placeholder: '请输入设备信息/节点信息关键字',
|
||||
},
|
||||
},
|
||||
{
|
||||
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;
|
||||
},
|
||||
placeholder: '请选择设备名称',
|
||||
resultField: 'data.records',
|
||||
labelField: 'deviceName',
|
||||
valueField: 'id',
|
||||
autoAddLink: true, //默认添加联动
|
||||
// autoSelectFirst: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'devicePoint',
|
||||
label: '设备点位',
|
||||
component: 'nsSelectApi',
|
||||
dynamicParams: {
|
||||
id: 'deviceName', //帮定上级联动数据
|
||||
},
|
||||
componentProps: {
|
||||
api: device.queryDevicePoint,
|
||||
resultField: 'data',
|
||||
placeholder: '请选择设备点位',
|
||||
labelField: 'code',
|
||||
valueField: 'id',
|
||||
dependency: 'deviceName',
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'payWay',
|
||||
field: 'enableRules',
|
||||
label: '启用状态',
|
||||
component: 'NsSelect',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
placeholder: '请选择启用状态',
|
||||
options: [
|
||||
{
|
||||
label: '启用',
|
||||
value: '1',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
label: '关闭',
|
||||
value: '0',
|
||||
value: 0,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'provider',
|
||||
field: 'abnormalDescription',
|
||||
label: '异常描述',
|
||||
component: 'NsInput',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
placeholder: '请输入异常描述关键字',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
params: { id: value.id },
|
||||
params: { equipmentAlarmId: value.id },
|
||||
// pagination: { pageSizeOptions: false },
|
||||
rowKey: 'id',
|
||||
};
|
||||
};
|
||||
// 编辑或添加成功 刷新列表
|
||||
const editObject = () => {
|
||||
mainRef.value?.nsTableRef.reload();
|
||||
};
|
||||
return {
|
||||
configureEnergyAlarmsData,
|
||||
show,
|
||||
clickSwitch,
|
||||
doWnload,
|
||||
mainRef,
|
||||
editObject,
|
||||
getcomparisonType,
|
||||
orgId,
|
||||
tableConfig,
|
||||
editConfigureEnergyAlarms,
|
||||
|
||||
@@ -27,9 +27,9 @@
|
||||
}"
|
||||
tree-node-filter-prop="orgName" />
|
||||
</a-form-item>
|
||||
<a-form-item label="数据来源" name="sbtype">
|
||||
<a-form-item label="数据来源" name="dataSources">
|
||||
<a-cascader
|
||||
v-model:value="infoObject.sbtype"
|
||||
v-model:value="infoObject.dataSources"
|
||||
:options="deviceTypeTreeData"
|
||||
:field-names="{
|
||||
children: 'children',
|
||||
@@ -45,16 +45,19 @@
|
||||
v-model:value="infoObject.deviceNode"
|
||||
style="width: 100%"
|
||||
placeholder="请选择设备节点"
|
||||
:disabled="!infoObject.sbtype"
|
||||
:disabled="!infoObject.dataSources"
|
||||
:tree-line="true && { showLeafIcon: false }"
|
||||
:tree-data="jdTreeData"
|
||||
:field-names="{
|
||||
children: 'children',
|
||||
label: infoObject.sbtype && infoObject.sbtype[1] === 1 ? 'deviceName' : 'pointName',
|
||||
label:
|
||||
infoObject.dataSources && infoObject.dataSources[1] === 1
|
||||
? 'deviceName'
|
||||
: 'pointName',
|
||||
value: 'id',
|
||||
}" />
|
||||
</a-form-item>
|
||||
<a-form-item label="启用规则" name="enableRules">
|
||||
<a-form-item label="启用规则">
|
||||
<a-switch
|
||||
:checked="infoObject.enableRules === 1 ? true : false"
|
||||
:class="{
|
||||
@@ -67,6 +70,7 @@
|
||||
<a-textarea
|
||||
v-model:value="infoObject.abnormalDescription"
|
||||
style="height: 32px"
|
||||
placeholder="请输入异常描述"
|
||||
:autoSize="{ minRows: 1, maxRows: 1 }"
|
||||
show-count
|
||||
:maxlength="30" />
|
||||
@@ -152,10 +156,11 @@
|
||||
deviceNode: null,
|
||||
ruleType: null,
|
||||
abnormalDescription: null,
|
||||
sbtype: null,
|
||||
dataSources: null,
|
||||
enableRules: 0,
|
||||
alarmList: [{ id: null, logic: null, num: null, isDelete: 0 }],
|
||||
});
|
||||
const emit = defineEmits(['editObject']);
|
||||
//删除的逻辑列表
|
||||
const delAlarmList = ref([]);
|
||||
//对比类型
|
||||
@@ -271,19 +276,24 @@
|
||||
const toggle = async (value: any, info: any) => {
|
||||
// 数据来源
|
||||
let energyType = await dict({ params: { dicKey: 'ENERGY_TYPE' } });
|
||||
energyType.data.data.forEach((item: any) => {
|
||||
item.children = [
|
||||
{
|
||||
id: 1,
|
||||
cnValue: '设备',
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
cnValue: '节点',
|
||||
},
|
||||
];
|
||||
});
|
||||
deviceTypeTreeData.value = energyType.data.data;
|
||||
if (energyType.data.data) {
|
||||
energyType.data.data.forEach((item: any) => {
|
||||
item.children = [
|
||||
{
|
||||
id: 1,
|
||||
cnValue: '设备',
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
cnValue: '节点',
|
||||
},
|
||||
];
|
||||
});
|
||||
deviceTypeTreeData.value = energyType.data.data;
|
||||
} else {
|
||||
deviceTypeTreeData.value = [];
|
||||
}
|
||||
|
||||
//能源告警
|
||||
energyAlarm.value = info;
|
||||
// 获取站点数据
|
||||
@@ -294,16 +304,29 @@
|
||||
});
|
||||
//判断 是新增 还是修改
|
||||
if (value) {
|
||||
value.ruleType = value.ruleType + '';
|
||||
value.comparisonType = value.comparisonType.split(',');
|
||||
value.sbtype = [value.dataSourcesType, value.dataSourcesWay];
|
||||
delete value.dataSourcesType;
|
||||
delete value.dataSourcesWay;
|
||||
infoObject.value = value;
|
||||
//获取设备/节点
|
||||
deviceTypeTreeData.value.forEach((item: any) => {
|
||||
if (item.id === infoObject.value.sbtype[0]) {
|
||||
selectDeviceType(infoObject.value.sbtype, [{ ...item }]);
|
||||
await http.post(energyAlarms.configFindById, { id: value.id }).then((res) => {
|
||||
if (res.msg === 'success') {
|
||||
infoObject.value = res.data;
|
||||
// 拼凑成 修改回显形式
|
||||
infoObject.value.dataSources = [
|
||||
infoObject.value.dataSourcesType,
|
||||
infoObject.value.dataSourcesWay,
|
||||
];
|
||||
delete infoObject.value.dataSourcesType;
|
||||
delete infoObject.value.dataSourcesWay;
|
||||
infoObject.value.comparisonType = infoObject.value.comparisonType.split(',');
|
||||
infoObject.value.ruleType = infoObject.value.ruleType + '';
|
||||
infoObject.value.alarmList = infoObject.value.hxAlarmRuleLogicList || [];
|
||||
delete infoObject.value.hxAlarmRuleLogicList;
|
||||
//获取设备/节点
|
||||
|
||||
if (deviceTypeTreeData && deviceTypeTreeData.value.length > 0) {
|
||||
deviceTypeTreeData.value.forEach((item: any) => {
|
||||
if (item.id === infoObject.value.dataSources[0]) {
|
||||
selectDeviceType(infoObject.value.dataSources, [{ ...item }]);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
@@ -313,7 +336,7 @@
|
||||
deviceNode: null,
|
||||
ruleType: null,
|
||||
abnormalDescription: null,
|
||||
sbtype: null,
|
||||
dataSources: null,
|
||||
enableRules: 0,
|
||||
alarmList: [{ id: null, logic: null, num: null, isDelete: 0 }],
|
||||
};
|
||||
@@ -324,8 +347,7 @@
|
||||
//表单 判断规格
|
||||
const rules = {
|
||||
site: [{ required: true, message: '请选择站点', trigger: 'change' }],
|
||||
sbtype: [{ required: true, message: '请选择设备类型', trigger: 'change' }],
|
||||
enableRules: [{ required: true, message: '请选择启用规则', trigger: 'change' }],
|
||||
dataSources: [{ required: true, message: '请选择设备类型', trigger: 'change' }],
|
||||
deviceNode: [{ required: true, message: '请选择设备名称', trigger: 'change' }],
|
||||
sbAdress: [{ required: true, message: '请选择设备点位', trigger: 'change' }],
|
||||
comparisonType: [{ required: true, message: '请选择对比类型', trigger: 'change' }],
|
||||
@@ -344,12 +366,9 @@
|
||||
},
|
||||
},
|
||||
],
|
||||
logic: [{ required: true, message: '请选择逻辑', trigger: 'blur' }],
|
||||
num: [{ required: true, message: '请输入数值', trigger: 'blur' }],
|
||||
};
|
||||
// 确认按钮
|
||||
const btnClick = () => {
|
||||
console.log(infoObject.value, '数据');
|
||||
infoObject.value.alarmList.forEach((item) => {
|
||||
if (item.logic === null || item.num === null) {
|
||||
return;
|
||||
@@ -361,17 +380,16 @@
|
||||
}
|
||||
//数据是否验证通过
|
||||
formRef.value.validate().then(() => {
|
||||
console.log(energyAlarm.value, '数据');
|
||||
|
||||
//处理数据
|
||||
let data = { ...infoObject.value };
|
||||
//关联能耗告警id
|
||||
data.equipmentAlarmId = energyAlarm.value.id;
|
||||
data.errorCode = energyAlarm.value.errorCode;
|
||||
data.dataSourcesType = data.sbtype[0];
|
||||
data.dataSourcesWay = data.sbtype[1];
|
||||
data.dataSourcesType = data.dataSources[0];
|
||||
data.dataSourcesWay = data.dataSources[1];
|
||||
delete data.dataSources;
|
||||
data.hxAlarmRuleLogicList = [...infoObject.value.alarmList, ...delAlarmList.value];
|
||||
data.comparisonType = data.comparisonType.toString;
|
||||
data.comparisonType = data.comparisonType.toString();
|
||||
data.hxAlarmRuleLogicList.forEach((item) => {
|
||||
const num = Number(item.num);
|
||||
if (!isNaN(num)) {
|
||||
@@ -382,24 +400,24 @@
|
||||
});
|
||||
data.ruleType = Number(data.ruleType);
|
||||
delete data.alarmList;
|
||||
// http
|
||||
// .post(energyAlarms.configAddOrUpNewData, data)
|
||||
// .then((res) => {
|
||||
// if (res.msg === 'success') {
|
||||
// // 操作成功时的处理
|
||||
// if (data.id) {
|
||||
// NsMessage.success('告警规则编辑成功');
|
||||
// } else {
|
||||
// NsMessage.success('告警规则新增成功');
|
||||
// }
|
||||
// emit('editObject', null);
|
||||
// handleClose();
|
||||
// }
|
||||
// })
|
||||
// .catch((error) => {
|
||||
// // 错误处理
|
||||
// console.error('请求失败:', error);
|
||||
// });
|
||||
http
|
||||
.post(energyAlarms.configAddOrUpNewData, data)
|
||||
.then((res) => {
|
||||
if (res.msg === 'success') {
|
||||
// 操作成功时的处理
|
||||
if (data.id) {
|
||||
NsMessage.success('告警规则编辑成功');
|
||||
} else {
|
||||
NsMessage.success('告警规则新增成功');
|
||||
}
|
||||
emit('editObject', null);
|
||||
handleClose();
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
// 错误处理
|
||||
console.error('请求失败:', error);
|
||||
});
|
||||
});
|
||||
};
|
||||
//取消按钮
|
||||
@@ -413,7 +431,7 @@
|
||||
ruleType: null,
|
||||
deviceNode: null,
|
||||
abnormalDescription: null,
|
||||
sbtype: null,
|
||||
dataSources: null,
|
||||
enableRules: 0,
|
||||
alarmList: [{ id: null, logic: null, num: null, isDelete: 0 }],
|
||||
};
|
||||
|
||||
@@ -188,9 +188,9 @@
|
||||
name: 'FeedBackDetail',
|
||||
dynamicParams: ['uuid', 'appealType'],
|
||||
confirm: true,
|
||||
handle: () => {
|
||||
handle: (data: any) => {
|
||||
http.post(deviceAlarms.configDel, { ids: data.id }).then(() => {
|
||||
NsMessage.success('规则删除成功');
|
||||
NsMessage.success('告警规则删除成功');
|
||||
mainRef.value?.nsTableRef.reload();
|
||||
});
|
||||
},
|
||||
@@ -216,6 +216,10 @@
|
||||
resultField: 'data.records',
|
||||
labelField: 'deviceName',
|
||||
valueField: 'id',
|
||||
showSearch: true,
|
||||
filterOption: (input: string, option: any) => {
|
||||
return option.deviceName.toLowerCase().indexOf(input.toLowerCase()) >= 0;
|
||||
},
|
||||
autoAddLink: true, //默认添加联动
|
||||
},
|
||||
},
|
||||
@@ -234,6 +238,10 @@
|
||||
labelField: 'code',
|
||||
valueField: 'id',
|
||||
dependency: 'deviceName',
|
||||
showSearch: true,
|
||||
filterOption: (input: string, option: any) => {
|
||||
return option.code.toLowerCase().indexOf(input.toLowerCase()) >= 0;
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@@ -85,6 +85,7 @@
|
||||
<a-textarea
|
||||
v-model:value="infoObject.abnormalDescription"
|
||||
style="height: 32px"
|
||||
placeholder="请输入异常描述"
|
||||
:autoSize="{ minRows: 1, maxRows: 1 }"
|
||||
show-count
|
||||
:maxlength="30" />
|
||||
@@ -323,7 +324,6 @@
|
||||
delete infoObject.value.hxAlarmRuleLogicList;
|
||||
infoObject.value.deviceType = selectDevice;
|
||||
infoObject.value.ruleType = infoObject.value.ruleType + '';
|
||||
console.log(infoObject.value, '数据');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
||||
@@ -40,11 +40,17 @@
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'monitor'">
|
||||
{{
|
||||
record?.monitorTime && record?.monitorTimeUnit
|
||||
? record?.monitorTime + '' + record?.monitorTimeUnit
|
||||
record.monitorTime && record.monitorTimeUnit
|
||||
? record.monitorTime + '' + record.monitorTimeUnit.label
|
||||
: '-'
|
||||
}}
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'repetition'">
|
||||
{{ record.repetitions.label }}
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'prioritys'">
|
||||
{{ record.priority.label }}
|
||||
</template>
|
||||
</template>
|
||||
</ns-view-list-table>
|
||||
<a-button
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
<template>
|
||||
<ns-drawer
|
||||
v-model:visible="visible"
|
||||
width="520"
|
||||
:title="' '"
|
||||
width="600"
|
||||
:title="'设置通知联系人'"
|
||||
:ok="btnClick"
|
||||
:cancel="handleClose"
|
||||
placement="right"
|
||||
:footer-style="{ textAlign: 'right' }"
|
||||
@close="handleClose">
|
||||
<div style="padding: 18px; width: 100%; overflow: hidden">
|
||||
<a-form ref="formRef" :model="infoObject" :rules="rules">
|
||||
<div style="width: 100%; overflow: hidden; overflow-y: hidden; height: 100%">
|
||||
<a-form ref="formRef" :model="infoObject" :rules="rules" style="width: 80%">
|
||||
<a-form-item ref="notification" label="通知方式" name="notification">
|
||||
<a-select
|
||||
ref="select"
|
||||
@@ -22,7 +22,7 @@
|
||||
placeholder="请选择通知方式"
|
||||
:filter-option="filterDevicePoint" />
|
||||
</a-form-item>
|
||||
<a-form-item label="启用规则" name="enableRules">
|
||||
<a-form-item label="启用规则">
|
||||
<a-switch
|
||||
:checked="infoObject.enableRules === 1 ? true : false"
|
||||
:class="{
|
||||
@@ -31,28 +31,57 @@
|
||||
}"
|
||||
@click="clickSwitch" />
|
||||
</a-form-item>
|
||||
<a-form-item label="通知用户" name="user">
|
||||
<a-cascader
|
||||
v-model:value="infoObject.user"
|
||||
style="width: 100%"
|
||||
multiple
|
||||
:max-tag-count="1"
|
||||
:options="options"
|
||||
:load-data="loadData"
|
||||
placeholder="请选择通知用户"
|
||||
:show-checked-strategy="Cascader.SHOW_CHILD" />
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
<a-table :dataSource="dataSource" :columns="columns" :pagination="false" />
|
||||
<div style="width: 100%; height: 765px; overflow-y: auto">
|
||||
<div style="margin-bottom: 8px">
|
||||
<div style="width: 100%; display: flex; position: relative">
|
||||
<div
|
||||
style="
|
||||
border-width: 0px;
|
||||
position: absolute;
|
||||
left: 0px;
|
||||
top: 5px;
|
||||
width: 5px;
|
||||
height: 15px;
|
||||
background: inherit;
|
||||
background-color: rgba(251, 156, 67, 1);
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
-moz-box-shadow: none;
|
||||
-webkit-box-shadow: none;
|
||||
box-shadow: none;
|
||||
"></div>
|
||||
<span style="margin-left: 24px; color: #333333">联系人名单</span>
|
||||
</div>
|
||||
<img
|
||||
style="width: 100%; margin-top: -10px"
|
||||
src="https://files.axshare.com/gsc/4T0UQR/7e/5d/a2/7e5da2a277344db8af30521cefeb70cc/images/告警设置/u150.svg?pageId=1f58c1ba-b461-4fe8-a2b3-295f1e7b0aa0" />
|
||||
</div>
|
||||
<div style="margin-bottom: 16px">
|
||||
<a-button type="primary" @click="chengUser">选择联系人 </a-button>
|
||||
</div>
|
||||
<a-table
|
||||
:dataSource="dataSource"
|
||||
:columns="columns"
|
||||
:scroll="{ x: 800, y: 700 }"
|
||||
:pagination="pagination">
|
||||
<template #bodyCell="{ record, column }">
|
||||
<template v-if="column.dataIndex === 'operation'">
|
||||
<a style="color: rgb(210, 0, 5)" @click="remove(record)">移除</a>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</div>
|
||||
</div>
|
||||
<linkPeople v-show="visibleModel" ref="linkPeoples" @handleCancel="handleCancel" />
|
||||
</ns-drawer>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import { Cascader } from 'ant-design-vue';
|
||||
|
||||
import { NsMessage } from '/nerv-lib/component';
|
||||
import { http } from '/nerv-lib/util';
|
||||
// import { NsMessage } from '/nerv-lib/component';
|
||||
// import { http } from '/nerv-lib/util';
|
||||
// import { number } from 'vue-types';
|
||||
import linkPeople from './linkPeople/index.vue';
|
||||
|
||||
// import { deviceAlarms } from '/@/api/alarmSettings/deviceAlarms';
|
||||
|
||||
@@ -61,25 +90,191 @@
|
||||
{
|
||||
title: '序号',
|
||||
dataIndex: 'address',
|
||||
width: 80,
|
||||
fixed: 'left',
|
||||
customRender: (text: any) => {
|
||||
return text.index + 1;
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '通知名单',
|
||||
title: '姓名',
|
||||
dataIndex: 'name',
|
||||
width: 80,
|
||||
fixed: 'left',
|
||||
key: 'name',
|
||||
},
|
||||
];
|
||||
const dataSource = [
|
||||
{
|
||||
name: '运维>运维1部>张三',
|
||||
title: '性别',
|
||||
dataIndex: 'sex',
|
||||
width: 80,
|
||||
key: 'sex',
|
||||
},
|
||||
{
|
||||
name: '运维>运维1部>李四',
|
||||
title: '组织关系',
|
||||
dataIndex: 'site',
|
||||
key: 'site',
|
||||
},
|
||||
{
|
||||
title: '部门',
|
||||
dataIndex: 'department',
|
||||
key: 'department',
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
width: 80,
|
||||
dataIndex: 'operation',
|
||||
fixed: 'right',
|
||||
},
|
||||
];
|
||||
const visibleModel = ref(false);
|
||||
const dataSource = ref([
|
||||
{
|
||||
id: 1,
|
||||
name: '张三1',
|
||||
sex: '男',
|
||||
site: '济阳站',
|
||||
department: '济阳站/产品/产品经理',
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: '张三2',
|
||||
sex: '男',
|
||||
site: '济阳站',
|
||||
department: '济阳站/产品/产品经理',
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: '张三3',
|
||||
sex: '男',
|
||||
site: '济阳站',
|
||||
department: '济阳站/产品/产品经理',
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: '张三',
|
||||
sex: '男',
|
||||
site: '济阳站',
|
||||
department: '济阳站/产品/产品经理',
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: '张三',
|
||||
sex: '男',
|
||||
site: '济阳站',
|
||||
department: '济阳站/产品/产品经理',
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: '张三',
|
||||
sex: '男',
|
||||
site: '济阳站',
|
||||
department: '济阳站/产品/产品经理',
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: '张三',
|
||||
sex: '男',
|
||||
site: '济阳站',
|
||||
department: '济阳站/产品/产品经理',
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: '张三',
|
||||
sex: '男',
|
||||
site: '济阳站',
|
||||
department: '济阳站/产品/产品经理',
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: '张三',
|
||||
sex: '男',
|
||||
site: '济阳站',
|
||||
department: '济阳站/产品/产品经理',
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
name: '张三',
|
||||
sex: '男',
|
||||
site: '济阳站',
|
||||
department: '济阳站/产品/产品经理',
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
name: '张三',
|
||||
sex: '男',
|
||||
site: '济阳站',
|
||||
department: '济阳站/产品/产品经理',
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
name: '张三',
|
||||
sex: '男',
|
||||
site: '济阳站',
|
||||
department: '济阳站/产品/产品经理',
|
||||
},
|
||||
{
|
||||
id: 13,
|
||||
name: '张三',
|
||||
sex: '男',
|
||||
site: '济阳站',
|
||||
department: '济阳站/产品/产品经理',
|
||||
},
|
||||
{
|
||||
id: 14,
|
||||
name: '张三',
|
||||
sex: '男',
|
||||
site: '济阳站',
|
||||
department: '济阳站/产品/产品经理',
|
||||
},
|
||||
{
|
||||
id: 15,
|
||||
name: '张三',
|
||||
sex: '男',
|
||||
site: '济阳站',
|
||||
department: '济阳站/产品/产品经理',
|
||||
},
|
||||
{
|
||||
id: 16,
|
||||
name: '张三',
|
||||
sex: '男',
|
||||
site: '济阳站',
|
||||
department: '济阳站/产品/产品经理',
|
||||
},
|
||||
{
|
||||
id: 17,
|
||||
name: '张三',
|
||||
sex: '男',
|
||||
site: '济阳站',
|
||||
department: '济阳站/产品/产品经理',
|
||||
},
|
||||
]);
|
||||
const visible = ref(false);
|
||||
const linkPeoples = ref(null);
|
||||
const handleChangePage = (current: number, pageSize: number) => {
|
||||
pagination.value.current = current;
|
||||
pagination.value.pageSize = pageSize;
|
||||
};
|
||||
const pagination = ref({
|
||||
total: 0,
|
||||
size: 'small',
|
||||
current: 1,
|
||||
pageSize: 10,
|
||||
showQuickJumper: true,
|
||||
showLessItems: true,
|
||||
// showSizeChanger: true,
|
||||
showTotal: (total: number, range: any) =>
|
||||
total && range ? `显示第${range[0]}到${range[1]}条记录,共 ${total} 条记录` : '',
|
||||
onChange: handleChangePage,
|
||||
});
|
||||
//点击联系人
|
||||
const chengUser = () => {
|
||||
visibleModel.value = true;
|
||||
linkPeoples.value.getData();
|
||||
};
|
||||
//取消弹窗
|
||||
const handleCancel = () => {
|
||||
visibleModel.value = false;
|
||||
};
|
||||
//表单数据
|
||||
const infoObject = ref({
|
||||
enableRules: 0,
|
||||
@@ -101,63 +296,10 @@
|
||||
{ label: '站内信息', value: 1 },
|
||||
{ label: '邮件', value: 2 },
|
||||
]);
|
||||
//通知用户
|
||||
const options = ref([
|
||||
{
|
||||
value: 1,
|
||||
label: 'Zhejiang',
|
||||
isLeaf: false,
|
||||
},
|
||||
{
|
||||
value: 2,
|
||||
label: 'Jiangsu',
|
||||
isLeaf: false,
|
||||
},
|
||||
]);
|
||||
//加载用户
|
||||
const loadData = (selectedOptions: any) => {
|
||||
const targetOption = selectedOptions[selectedOptions.length - 1];
|
||||
targetOption.loading = true;
|
||||
// load options lazily
|
||||
setTimeout(() => {
|
||||
targetOption.loading = false;
|
||||
console.log(targetOption, '数据');
|
||||
targetOption.children = [
|
||||
{
|
||||
label: `${targetOption.label} Dynamic 1`,
|
||||
value: 3,
|
||||
isLeaf: false,
|
||||
},
|
||||
{
|
||||
label: `${targetOption.label} Dynamic 2`,
|
||||
value: 4,
|
||||
isLeaf: false,
|
||||
},
|
||||
];
|
||||
options.value = [...options.value];
|
||||
}, 1000);
|
||||
};
|
||||
|
||||
const rules = {
|
||||
notification: [{ required: true, message: '请选择站点', trigger: 'change' }],
|
||||
enableRules: [{ required: true, message: '请选择启用规则', trigger: 'change' }],
|
||||
notification: [{ required: true, message: '请选择通知方式', trigger: 'change' }],
|
||||
user: [{ required: true, message: '请选择通知人', trigger: 'change' }],
|
||||
abnormalDescription: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入异常描述',
|
||||
trigger: 'blur',
|
||||
validator: (rules: any, abnormalDescription: any, cbfn: any) => {
|
||||
if (abnormalDescription.trim() !== '') {
|
||||
cbfn();
|
||||
} else {
|
||||
cbfn('告警标题不能为空');
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
alarm: [{ required: true, message: '请选择逻辑', trigger: 'blur' }],
|
||||
number: [{ required: true, message: '请输入数值', trigger: 'blur' }],
|
||||
};
|
||||
const formRef = ref();
|
||||
const emit = defineEmits(['editObject']);
|
||||
@@ -165,7 +307,9 @@
|
||||
//判断 是新增 还是修改
|
||||
if (value) {
|
||||
// infoObject.value = value;
|
||||
infoObject.value = {};
|
||||
infoObject.value = {
|
||||
enableRules: 0,
|
||||
};
|
||||
} else {
|
||||
infoObject.value = {
|
||||
enableRules: 0,
|
||||
@@ -173,7 +317,15 @@
|
||||
}
|
||||
visible.value = !visible.value;
|
||||
};
|
||||
|
||||
//移除数据
|
||||
const remove = (data: any) => {
|
||||
dataSource.value.forEach((item, index) => {
|
||||
if (item.id === data.id) {
|
||||
dataSource.value.splice(index, 1);
|
||||
}
|
||||
});
|
||||
dataSource.value = [...dataSource.value];
|
||||
};
|
||||
const btnClick = () => {
|
||||
console.log(infoObject.value);
|
||||
//表单校验
|
||||
@@ -190,22 +342,13 @@
|
||||
// 清楚校验错误信息
|
||||
formRef.value.resetFields();
|
||||
visible.value = false;
|
||||
options.value = [
|
||||
{
|
||||
value: 'zhejiang',
|
||||
label: 'Zhejiang',
|
||||
isLeaf: false,
|
||||
},
|
||||
{
|
||||
value: 'jiangsu',
|
||||
label: 'Jiangsu',
|
||||
isLeaf: false,
|
||||
},
|
||||
];
|
||||
visibleModel.value = false;
|
||||
};
|
||||
defineExpose({
|
||||
toggle,
|
||||
handleClose,
|
||||
handleCancel,
|
||||
handleChangePage,
|
||||
formRef,
|
||||
});
|
||||
</script>
|
||||
@@ -240,7 +383,7 @@
|
||||
}
|
||||
/deep/ .ant-form-item-label {
|
||||
z-index: 20;
|
||||
text-align: right;
|
||||
width: 23%;
|
||||
text-align: left;
|
||||
width: 20%;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
<template>
|
||||
<a-modal
|
||||
v-model:visible="show"
|
||||
width="1000px"
|
||||
style="top: 50%; transform: translateY(-50%)"
|
||||
title="添加联系人"
|
||||
@ok="handleOk"
|
||||
@cancel="handleCancel">
|
||||
<div style="width: 100%; height: 100%">
|
||||
<p>Some contents...</p>
|
||||
<p>Some contents...</p>
|
||||
<p>Some contents...</p>
|
||||
</div>
|
||||
</a-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import { defineComponent } from 'vue';
|
||||
|
||||
export default defineComponent({
|
||||
setup(props, { emit }) {
|
||||
const handleOk = () => {
|
||||
// 处理确定按钮的逻辑
|
||||
console.log('点击了确定按钮');
|
||||
};
|
||||
const getData = () => {
|
||||
show.value = true;
|
||||
};
|
||||
const show = ref(false);
|
||||
const handleCancel = () => {
|
||||
// 处理取消按钮的逻辑
|
||||
console.log('点击了取消按钮');
|
||||
emit('handleCancel', null);
|
||||
show.value = false;
|
||||
};
|
||||
return {
|
||||
handleOk,
|
||||
show,
|
||||
getData,
|
||||
handleCancel,
|
||||
};
|
||||
},
|
||||
});
|
||||
</script>
|
||||
@@ -14,7 +14,7 @@ const tableKeyMap = [
|
||||
},
|
||||
{
|
||||
title: '优先级',
|
||||
dataIndex: 'priority',
|
||||
dataIndex: 'prioritys',
|
||||
},
|
||||
{
|
||||
title: '告警标题',
|
||||
@@ -26,8 +26,7 @@ const tableKeyMap = [
|
||||
},
|
||||
{
|
||||
title: '重复次数',
|
||||
dataIndex: 'repetitions',
|
||||
textEllipsis: true,
|
||||
dataIndex: 'repetition',
|
||||
},
|
||||
{
|
||||
title: '监测时长',
|
||||
@@ -104,6 +103,9 @@ export const equipmentAlarmTableConfig = (
|
||||
name: 'FeedBackDetail',
|
||||
dynamicParams: ['uuid', 'appealType'],
|
||||
handle: (data: any) => {
|
||||
data.priority = data.priority.value;
|
||||
data.repetitions = data.repetitions.value;
|
||||
data.monitorTimeUnit = data.monitorTimeUnit.value;
|
||||
editEquipmentAlarm.value.toggle(data);
|
||||
},
|
||||
},
|
||||
|
||||
@@ -36,27 +36,31 @@
|
||||
:expanded-keys="expandedKeys"
|
||||
:auto-expand-parent="autoExpandParent"
|
||||
@expand="onExpand">
|
||||
<template #title="{ emissionName }">
|
||||
<span v-if="emissionName && selectTreeDataValue && emissionName.indexOf(selectTreeDataValue) > -1">
|
||||
{{ emissionName.substring(0, emissionName.indexOf(selectTreeDataValue)) }}
|
||||
<span style="color: #f50">{{ selectTreeDataValue }}</span>
|
||||
{{ emissionName.substring(emissionName.indexOf(selectTreeDataValue) + selectTreeDataValue.length) }}
|
||||
</span>
|
||||
<span v-else>{{ emissionName }}</span>
|
||||
</template>
|
||||
</a-tree>
|
||||
<a-popover v-if="showOperation" placement="rightTop" trigger="focus">
|
||||
<template #content>
|
||||
<div style="display: flex;flex-direction: column;">
|
||||
<a-button type="text" @click="editTreeNodeData">编辑</a-button>
|
||||
<a-button type="text" @click="addTreeNodeData">新增子节点</a-button>
|
||||
<a-button type="text">上移</a-button>
|
||||
<a-button type="text">下移</a-button>
|
||||
<a-button type="text" @click="deleteTreeNode">删除</a-button>
|
||||
<template #title="data">
|
||||
<div class="treeRow">
|
||||
<div>
|
||||
<span v-if="data.emissionName && selectTreeDataValue && data.emissionName.indexOf(selectTreeDataValue) > -1">
|
||||
{{ data.emissionName.substring(0, data.emissionName.indexOf(selectTreeDataValue)) }}
|
||||
<span style="color: #f50" >{{ selectTreeDataValue }}</span>
|
||||
{{ data.emissionName.substring(data.emissionName.indexOf(selectTreeDataValue) + selectTreeDataValue.length) }}
|
||||
</span>
|
||||
<span v-else>{{ data.emissionName }}</span>
|
||||
</div>
|
||||
<a-popover placement="rightTop" trigger="focus">
|
||||
<template #content>
|
||||
<div style="display: flex;flex-direction: column;">
|
||||
<a-button type="text" @click="editTreeNodeData">编辑</a-button>
|
||||
<a-button type="text" @click="addTreeNodeData">新增子节点</a-button>
|
||||
<a-button type="text">上移</a-button>
|
||||
<a-button type="text">下移</a-button>
|
||||
<a-button type="text" @click="deleteTreeNode">删除</a-button>
|
||||
</div>
|
||||
</template>
|
||||
<MoreOutlined class="actionMore" />
|
||||
</a-popover>
|
||||
</div>
|
||||
</template>
|
||||
<MoreOutlined style="position: absolute;right: 0;top: 16%;font-size: 25px;cursor: pointer;" />
|
||||
</a-popover>
|
||||
</a-tree>
|
||||
<div class="addTreeNode">
|
||||
<a-button type="primary" style="width:100%;" @click="addTreeNodeData">新增</a-button>
|
||||
</div>
|
||||
@@ -92,6 +96,66 @@
|
||||
<a-button type="primary" @click="onEdit">确定</a-button>
|
||||
</template>
|
||||
</a-drawer>
|
||||
<!-- 单位管理 -->
|
||||
<a-drawer
|
||||
:width="500"
|
||||
:visible="unitManagement"
|
||||
v-if="unitManagement"
|
||||
:body-style="{ paddingBottom: '80px' }"
|
||||
:footer-style="{ textAlign: 'right' }"
|
||||
destroyOnClose
|
||||
title="单位管理"
|
||||
@close="closeUnitManag">
|
||||
<div class="addButton">
|
||||
<a-button type="primary">新增分组</a-button>
|
||||
<a-button type="primary">新增单位</a-button>
|
||||
</div>
|
||||
<div class="treePart">
|
||||
<div style="width: 100%;height: 7%;display: flex;justify-content: center;align-items: center;">
|
||||
<a-select
|
||||
ref="select"
|
||||
:value="unitTreeParams.cnValue"
|
||||
style="width: 96%"
|
||||
placeholder="选择分组"
|
||||
@change="handleChange"
|
||||
>
|
||||
<a-select-option v-for="(item, index) in groupData" :key="index" :value="item.cnValue">
|
||||
{{ item.cnValue }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</div>
|
||||
<a-tree
|
||||
:expandedKeys="unitExpandedKeys"
|
||||
:selectedKeys="unitSelectedKeys"
|
||||
:tree-data="unitTreeData"
|
||||
v-if="unitTreeData && unitTreeData.length > 0"
|
||||
>
|
||||
<template #title="data">
|
||||
<div class="treeRow">
|
||||
<div>
|
||||
<span>{{ data.cnValue }}</span>
|
||||
</div>
|
||||
<a-popover placement="rightTop" trigger="focus">
|
||||
<template #content>
|
||||
<div style="display: flex;flex-direction: column;">
|
||||
<a-button type="text" @click="editTreeNodeData">编辑</a-button>
|
||||
<a-button type="text" @click="addTreeNodeData">新增子节点</a-button>
|
||||
<a-button type="text">上移</a-button>
|
||||
<a-button type="text">下移</a-button>
|
||||
<a-button type="text" @click="deleteTreeNode">删除</a-button>
|
||||
</div>
|
||||
</template>
|
||||
<MoreOutlined class="actionMore" />
|
||||
</a-popover>
|
||||
</div>
|
||||
</template>
|
||||
</a-tree>
|
||||
</div>
|
||||
<template #footer>
|
||||
<a-button style="margin-right: 8px" @click="closeUnitManag">取消</a-button>
|
||||
<a-button type="primary" @click="onEdit">确定</a-button>
|
||||
</template>
|
||||
</a-drawer>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
@@ -107,7 +171,7 @@
|
||||
AntTreeNodeDropEvent,
|
||||
TreeProps,
|
||||
} from 'ant-design-vue/es/tree';
|
||||
import { log } from 'node:console';
|
||||
import { log } from 'node:console';
|
||||
|
||||
defineOptions({ name: 'OrderListIndex' });
|
||||
const selectTreeDataValue = ref<string>('');
|
||||
@@ -116,6 +180,7 @@ import { log } from 'node:console';
|
||||
let formData = ref({});
|
||||
const formRef = ref();
|
||||
const visible = ref(false);
|
||||
const unitManagement = ref(false);
|
||||
const searchValue = ref<string>('');
|
||||
const searchValue2 = ref<string>('');
|
||||
const disabled = ref(false);
|
||||
@@ -428,7 +493,9 @@ import { log } from 'node:console';
|
||||
formData.value = {};
|
||||
userAuthList.value.splice(0);
|
||||
};
|
||||
|
||||
const closeUnitManag = () => {
|
||||
unitManagement.value = false;
|
||||
};
|
||||
const onEdit = () => {
|
||||
formRef.value?.triggerSubmit().then(() => {
|
||||
console.log(formData.value, 'formData.value');
|
||||
@@ -497,6 +564,20 @@ import { log } from 'node:console';
|
||||
api: carbonEmissionFactorLibrary.del,
|
||||
dynamicParams: { ids: 'id[]' },
|
||||
},
|
||||
{
|
||||
label: '单位管理',
|
||||
type: 'primary',
|
||||
name: 'userAdd',
|
||||
handle: () => {
|
||||
unitManagement.value = true,
|
||||
fetch(carbonEmissionFactorLibrary.findOutermost).then((res) => {
|
||||
groupData.value = res.data
|
||||
});
|
||||
fetch(carbonEmissionFactorLibrary.dictionaryUnitManagement, unitTreeParams.value).then((res) => {
|
||||
unitTreeData.value = res.data
|
||||
});
|
||||
},
|
||||
},
|
||||
],
|
||||
columns: [
|
||||
{
|
||||
@@ -679,6 +760,22 @@ import { log } from 'node:console';
|
||||
// pagination: { defaultPageSize: 10 },
|
||||
rowKey: 'id',
|
||||
});
|
||||
|
||||
// 单位管理
|
||||
const unitExpandedKeys = ref<string[]>();
|
||||
const unitSelectedKeys = ref<string[]>([]);
|
||||
const unitTreeParams = ref({
|
||||
grp: 'MEASUREMENT_UNIT'
|
||||
})
|
||||
const groupData = ref([])
|
||||
const unitTreeData = ref<TreeProps['treeData']>(genData);
|
||||
const handleChange = (value: string) => {
|
||||
unitTreeParams.value.cnValue = value
|
||||
fetch(carbonEmissionFactorLibrary.dictionaryUnitManagement, unitTreeParams.value).then((res) => {
|
||||
unitTreeData.value = res.data
|
||||
});
|
||||
};
|
||||
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
.main {
|
||||
@@ -696,7 +793,6 @@ import { log } from 'node:console';
|
||||
// box-shadow: @ns-content-box-shadow;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
.top{
|
||||
@@ -727,4 +823,34 @@ import { log } from 'node:console';
|
||||
padding-bottom: 10px;
|
||||
border-bottom: 1px solid #e9e9e9;
|
||||
}
|
||||
.treeRow {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
.addButton{
|
||||
width: 70%;
|
||||
height: 5vh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-evenly;
|
||||
}
|
||||
.treePart{
|
||||
width: 70%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
border: 1px solid #bfbfbf;
|
||||
margin-left: 10%;
|
||||
flex-direction: column;
|
||||
}
|
||||
.actionMore {
|
||||
display: none;
|
||||
}
|
||||
:deep(.ant-tree-node-content-wrapper) {
|
||||
&:hover {
|
||||
.actionMore {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -78,3 +78,45 @@ export const tableColumns = [
|
||||
width: 130
|
||||
},
|
||||
];
|
||||
export const columns = [
|
||||
{
|
||||
title: '序号',
|
||||
customRender: (text: any) => {
|
||||
return text.index + 1;
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '因子值',
|
||||
dataIndex: 'energyType',
|
||||
},
|
||||
{
|
||||
title: '计量单位',
|
||||
className: 'unit',
|
||||
dataIndex: 'unit',
|
||||
},
|
||||
{
|
||||
title: '更新时间',
|
||||
className: 'unit',
|
||||
dataIndex: 'unit',
|
||||
},
|
||||
{
|
||||
title: '启用时间',
|
||||
className: 'unit',
|
||||
dataIndex: 'unit',
|
||||
},
|
||||
{
|
||||
title: '结束时间',
|
||||
className: 'unit',
|
||||
dataIndex: 'unit',
|
||||
},
|
||||
{
|
||||
title: '数据来源',
|
||||
className: 'unit',
|
||||
dataIndex: 'unit',
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
width: 130
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,401 @@
|
||||
<!-- @format -->
|
||||
|
||||
<template>
|
||||
<div class="main">
|
||||
<div class="left">
|
||||
<div class="top">
|
||||
<a-form style="width: 100%;margin: 0 auto;">
|
||||
<div class="ns-form-title"><span>排放分类</span></div>
|
||||
<div style="padding: 0 16px !important;width: 100%;">
|
||||
<a-row>
|
||||
<a-col :span="24" style="margin-bottom: 16px;">
|
||||
<a-input-search
|
||||
v-model:value="selectTreeDataValue"
|
||||
placeholder="请输入关键词"
|
||||
@search="onSearchTreeData"
|
||||
/>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</div>
|
||||
</a-form>
|
||||
<a-tree
|
||||
v-if="gData && gData.length > 0"
|
||||
class="draggable-tree"
|
||||
style="padding: 0 16px !important;"
|
||||
show-line
|
||||
block-node
|
||||
:tree-data="gData"
|
||||
:checkedKeys="checkedTreeNodeKeys"
|
||||
:selectedKeys="selectedKeys"
|
||||
@check="checkTreeNode"
|
||||
@select="onSelect"
|
||||
:expanded-keys="expandedKeys"
|
||||
:auto-expand-parent="autoExpandParent"
|
||||
@expand="onExpand">
|
||||
<template #title="{ emissionName }">
|
||||
<span v-if="emissionName && selectTreeDataValue && emissionName.indexOf(selectTreeDataValue) > -1">
|
||||
{{ emissionName.substring(0, emissionName.indexOf(selectTreeDataValue)) }}
|
||||
<span style="color: #f50">{{ selectTreeDataValue }}</span>
|
||||
{{ emissionName.substring(emissionName.indexOf(selectTreeDataValue) + selectTreeDataValue.length) }}
|
||||
</span>
|
||||
<span v-else>{{ emissionName }}</span>
|
||||
</template>
|
||||
</a-tree>
|
||||
</div>
|
||||
</div>
|
||||
<div class="right">
|
||||
<a-table :columns="columns" :data-source="tableData" bordered :pagination="false">
|
||||
<template #bodyCell="{ column, text }">
|
||||
<template v-if="column.dataIndex === 'name'">
|
||||
<a>{{ text }}</a>
|
||||
</template>
|
||||
</template>
|
||||
<template #title>Header</template>
|
||||
</a-table>
|
||||
</div>
|
||||
<!-- 新增树节点 -->
|
||||
<ns-modal :visible="treeNodeAdd" :title="operationTree" @ok="handleOk" @cancel="handleCancel">
|
||||
<ns-input
|
||||
v-model:value="addTreeNode"
|
||||
class="input"
|
||||
placeholder="请输入排放类型"/>
|
||||
</ns-modal>
|
||||
<!-- 新增数据库数据 -->
|
||||
<a-drawer
|
||||
:width="500"
|
||||
:visible="visible"
|
||||
:body-style="{ paddingBottom: '80px' }"
|
||||
:footer-style="{ textAlign: 'right' }"
|
||||
destroyOnClose
|
||||
@close="onClose">
|
||||
<ns-form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
class="form"
|
||||
:wrapperCol="{ span: 20 }"
|
||||
formLayout="vertical" />
|
||||
<template #footer>
|
||||
<a-button style="margin-right: 8px" @click="onClose">取消</a-button>
|
||||
<a-button type="primary" @click="onEdit">确定</a-button>
|
||||
</template>
|
||||
</a-drawer>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { Modal } from 'ant-design-vue';
|
||||
import { computed, createVNode, defineComponent, reactive, ref, watchEffect,watch } from 'vue';
|
||||
import { http } from '/nerv-lib/util/http';
|
||||
import { NsMessage, NsModal } from '/nerv-lib/component';
|
||||
import { carbonEmissionFactorLibrary } from '/@/api/carbonEmissionFactorLibrary';
|
||||
import type {
|
||||
AntTreeNodeDragEnterEvent,
|
||||
AntTreeNodeDropEvent,
|
||||
TreeProps,
|
||||
} from 'ant-design-vue/es/tree';
|
||||
import { log } from 'node:console';
|
||||
|
||||
defineOptions({ name: 'QuickCalculation' });
|
||||
const selectTreeDataValue = ref<string>('');
|
||||
const data = reactive({});
|
||||
let formData = ref({});
|
||||
const formRef = ref();
|
||||
const visible = ref(false);
|
||||
const searchValue = ref<string>('');
|
||||
const searchValue2 = ref<string>('');
|
||||
const disabled = ref(false);
|
||||
const treeNodeAdd = ref<boolean>(false);
|
||||
const operationTree = ref<string>('新增');
|
||||
|
||||
const opMap: any = ref({
|
||||
type: 'add',
|
||||
fuc: () => {},
|
||||
record: {},
|
||||
});
|
||||
watchEffect(() => {
|
||||
disabled.value = opMap.value.type === 'edit';
|
||||
});
|
||||
const casData = ref([]);
|
||||
const treeData = ref([]);
|
||||
const userAuthList = ref([]);
|
||||
const orgId = ref('');
|
||||
const result = JSON.parse(sessionStorage.getItem('ORGID')!);
|
||||
orgId.value = result;
|
||||
const dynamicDisabled = computed(() => {
|
||||
return formRef.value?.validateResult && userAuthList.value?.length;
|
||||
});
|
||||
const fetch = (api, params = { orgId }) => {
|
||||
return http.post(api, params);
|
||||
};
|
||||
|
||||
// 树结构
|
||||
const x = 3;
|
||||
const y = 2;
|
||||
const z = 1;
|
||||
const genData: TreeProps['treeData'] = [];
|
||||
|
||||
const generateData = (_level: number, _preKey?: string, _tns?: TreeProps['treeData']) => {
|
||||
const preKey = _preKey || '0';
|
||||
const tns = _tns || genData;
|
||||
|
||||
const children = [];
|
||||
for (let i = 0; i < x; i++) {
|
||||
const key = `${preKey}-${i}`;
|
||||
tns.push({ title: key, key });
|
||||
if (i < y) {
|
||||
children.push(key);
|
||||
}
|
||||
}
|
||||
if (_level < 0) {
|
||||
return tns;
|
||||
}
|
||||
const level = _level - 1;
|
||||
children.forEach((key, index) => {
|
||||
tns[index].children = [];
|
||||
return generateData(level, key, tns[index].children);
|
||||
});
|
||||
};
|
||||
generateData(z);
|
||||
type TreeDataItem = TreeProps['treeData'][number];
|
||||
const gData = ref<TreeProps['treeData']>(genData);
|
||||
const dataList: TreeProps['treeData'] = [];
|
||||
const generateList = (data: TreeProps['treeData']) => {
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
const node = data[i];
|
||||
const key = node.key;
|
||||
dataList.push({ key, title: key });
|
||||
if (node.children) {
|
||||
generateList(node.children);
|
||||
}
|
||||
}
|
||||
};
|
||||
generateList(genData);
|
||||
|
||||
const getParentKey = (
|
||||
key: string | number,
|
||||
tree: TreeProps['treeData'],
|
||||
): string | number | undefined => {
|
||||
let parentKey;
|
||||
for (let i = 0; i < tree.length; i++) {
|
||||
const node = tree[i];
|
||||
if (node.children) {
|
||||
if (node.children.some(item => item.key === key)) {
|
||||
parentKey = node.key;
|
||||
} else if (getParentKey(key, node.children)) {
|
||||
parentKey = getParentKey(key, node.children);
|
||||
}
|
||||
}
|
||||
}
|
||||
return parentKey;
|
||||
};
|
||||
const expandedKeys = ref<(string | number)[]>([]);
|
||||
const autoExpandParent = ref<boolean>(true);
|
||||
|
||||
const onExpand = (keys: string[]) => {
|
||||
expandedKeys.value = keys;
|
||||
autoExpandParent.value = false;
|
||||
};
|
||||
watch(selectTreeDataValue, value => {
|
||||
const expanded = dataList
|
||||
.map((item: TreeProps['treeData'][number]) => {
|
||||
if (item.title.indexOf(value) > -1) {
|
||||
return getParentKey(item.key, gData.value);
|
||||
}
|
||||
return null;
|
||||
})
|
||||
.filter((item, i, self) => item && self.indexOf(item) === i);
|
||||
expandedKeys.value = expanded;
|
||||
selectTreeDataValue.value = value;
|
||||
autoExpandParent.value = true;
|
||||
});
|
||||
// 筛选树结构中的数据
|
||||
const onSearchTreeData = (selectTreeDataValue: string) => {
|
||||
console.log('use value', selectTreeDataValue);
|
||||
console.log('or use this.value', value.value);
|
||||
};
|
||||
// 点击数据点的复选框
|
||||
const checkedIds = ref([])
|
||||
const emissionType = ref()
|
||||
const checkTreeNode = (checkedKeys, info) => {
|
||||
checkedIds.value = []
|
||||
info.checkedNodes.forEach(item=>{
|
||||
checkedIds.value.push(item.id)
|
||||
})
|
||||
sessionStorage.setItem('checkedTreeNode', checkedIds.value);
|
||||
emissionType.value = checkedIds.value.join(',')
|
||||
}
|
||||
// 新增/编辑树节点点击确定
|
||||
const addTreeNode =ref()
|
||||
const handleOk = (e: MouseEvent) => {
|
||||
editTreeNode.value.emissionName = addTreeNode.value
|
||||
http.post(carbonEmissionFactorLibrary.creat,editTreeNode.value).then(() => {
|
||||
getOrgTree()
|
||||
NsMessage.success('操作成功');
|
||||
addTreeNode.value = ''
|
||||
treeNodeAdd.value = false;
|
||||
});
|
||||
};
|
||||
const handleCancel = () => {
|
||||
addTreeNode.value = ''
|
||||
treeNodeAdd.value = false;
|
||||
};
|
||||
// 获取排放分类树
|
||||
const getOrgTree = (params?) => {
|
||||
fetch(carbonEmissionFactorLibrary.getCarbonFactorTree, params).then((res) => {
|
||||
gData.value = res.data
|
||||
// 找到匹配的节点数据
|
||||
const selectedNodes = [];
|
||||
checkedTreeNodeKeys.value.forEach(key => {
|
||||
const [parentId, childId] = key.split('-').map(Number);
|
||||
if (parentId >= 0 && childId >= 0 && gData.value[parentId]?.children?.[childId]) {
|
||||
selectedNodes.push(gData.value[parentId]);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
getOrgTree();
|
||||
// 被选中的树节点
|
||||
const editTreeNode = ref({})
|
||||
const onSelect = (selectedKeys: string[], info: any) => {
|
||||
if(info.selected){
|
||||
editTreeNode.value = {
|
||||
id:info.selectedNodes[0].id,
|
||||
level:info.selectedNodes[0].level,
|
||||
dataNumber:info.selectedNodes[0].dataNumber,
|
||||
sortNumber:info.selectedNodes[0].sortNumber,
|
||||
parentEmissionId:info.selectedNodes[0].parentEmissionId,
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const onSearch = () => {
|
||||
console.log(searchValue.value);
|
||||
getOrgTree({ orgName: searchValue.value, orgId });
|
||||
};
|
||||
|
||||
const tableFetch = (params) => {
|
||||
console.log(params, 'sdfasfasdfasdfasdf');
|
||||
|
||||
setTimeout(() => {
|
||||
mainRef.value?.nsTableRef.reload();
|
||||
}, 100);
|
||||
};
|
||||
|
||||
const handleSelect = (selectedKeys: any, info: any) => {
|
||||
fetch(carbonEmissionFactorLibrary.queryDeptTree, { orgId: info.node?.orgInfo.orgId }).then((res) => {
|
||||
treeData2.value = res.data;
|
||||
});
|
||||
tableFetch({ orgId: info.node?.orgInfo.orgId });
|
||||
};
|
||||
const columns = [
|
||||
{
|
||||
title: 'Name',
|
||||
dataIndex: 'name',
|
||||
},
|
||||
{
|
||||
title: 'Cash Assets',
|
||||
className: 'column-money',
|
||||
dataIndex: 'money',
|
||||
},
|
||||
{
|
||||
title: 'Address',
|
||||
dataIndex: 'address',
|
||||
},
|
||||
];
|
||||
|
||||
const tableData = [
|
||||
{
|
||||
key: '1',
|
||||
name: 'John Brown',
|
||||
money: '¥300,000.00',
|
||||
address: 'New York No. 1 Lake Park',
|
||||
},
|
||||
{
|
||||
key: '2',
|
||||
name: 'Jim Green',
|
||||
money: '¥1,256,000.00',
|
||||
address: 'London No. 1 Lake Park',
|
||||
},
|
||||
{
|
||||
key: '3',
|
||||
name: 'Joe Black',
|
||||
money: '¥120,000.00',
|
||||
address: 'Sidney No. 1 Lake Park',
|
||||
},
|
||||
];
|
||||
|
||||
const onClose = () => {
|
||||
visible.value = false;
|
||||
formData.value = {};
|
||||
userAuthList.value.splice(0);
|
||||
};
|
||||
|
||||
const onEdit = () => {
|
||||
formRef.value?.triggerSubmit().then(() => {
|
||||
console.log(formData.value, 'formData.value');
|
||||
// if (!userAuthList.value.length) {
|
||||
// NsMessage.error('请添加用户权限');
|
||||
// return;
|
||||
// }
|
||||
|
||||
opMap.value.fuc &&
|
||||
opMap.value.fuc({ ...formData.value });
|
||||
});
|
||||
};
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
.main {
|
||||
background-color: @ns-content-bg;
|
||||
display: flex;
|
||||
height: 100%;
|
||||
}
|
||||
.left {
|
||||
width: 300px;
|
||||
// max-height: calc(100vh - 96px);
|
||||
margin-right: @ns-gap;
|
||||
min-width: fit-content;
|
||||
> div {
|
||||
background-color: @white;
|
||||
// box-shadow: @ns-content-box-shadow;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
.top{
|
||||
position: relative;
|
||||
.addTreeNode{
|
||||
width: 100%;
|
||||
padding: 16px;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
.right {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
::v-deep .ant-table-container{
|
||||
padding: 0px 16px;
|
||||
}
|
||||
.top {
|
||||
overflow: auto;
|
||||
// height: 50%;
|
||||
// border-bottom: 5px solid rgb(229, 235, 240);
|
||||
// overflow-y: auto;
|
||||
}
|
||||
.ns-form-title{
|
||||
font-weight: bold;
|
||||
user-select: text;
|
||||
padding: 16px;
|
||||
margin-bottom: 16px;
|
||||
padding-bottom: 10px;
|
||||
border-bottom: 1px solid #e9e9e9;
|
||||
}
|
||||
</style>
|
||||
<style scoped>
|
||||
th.column-money,
|
||||
td.column-money {
|
||||
text-align: right !important;
|
||||
}
|
||||
</style>
|
||||
@@ -1,16 +1,14 @@
|
||||
<!-- @format -->
|
||||
|
||||
<template>
|
||||
<div class="main">
|
||||
<div class="left">
|
||||
<div class="top">
|
||||
<a-form style="width: 100%;margin: 0 auto;">
|
||||
<div class="ns-form-title"><span>排放分类</span></div>
|
||||
<div class="ns-form-title"><span>因子分类</span></div>
|
||||
<div style="padding: 0 16px !important;width: 100%;">
|
||||
<a-row>
|
||||
<a-col :span="24" style="margin-bottom: 16px;">
|
||||
<a-input-search
|
||||
v-model:value="selectTreeDataValue"
|
||||
v-model:value="searchValue"
|
||||
placeholder="请输入关键词"
|
||||
@search="onSearchTreeData"
|
||||
/>
|
||||
@@ -19,118 +17,129 @@
|
||||
</div>
|
||||
</a-form>
|
||||
<a-tree
|
||||
v-if="gData && gData.length > 0"
|
||||
class="draggable-tree"
|
||||
style="padding: 0 16px !important;"
|
||||
draggable
|
||||
show-line
|
||||
checkable
|
||||
block-node
|
||||
:tree-data="gData"
|
||||
:checkedKeys="checkedTreeNodeKeys"
|
||||
:selectedKeys="selectedKeys"
|
||||
@dragenter="onDragEnter"
|
||||
@drop="onDrop"
|
||||
@check="checkTreeNode"
|
||||
@select="onSelect"
|
||||
:expanded-keys="expandedKeys"
|
||||
:auto-expand-parent="autoExpandParent"
|
||||
@expand="onExpand">
|
||||
<template #title="{ emissionName }">
|
||||
<span v-if="emissionName && selectTreeDataValue && emissionName.indexOf(selectTreeDataValue) > -1">
|
||||
{{ emissionName.substring(0, emissionName.indexOf(selectTreeDataValue)) }}
|
||||
<span style="color: #f50">{{ selectTreeDataValue }}</span>
|
||||
{{ emissionName.substring(emissionName.indexOf(selectTreeDataValue) + selectTreeDataValue.length) }}
|
||||
:tree-data="gData"
|
||||
@expand="onExpand"
|
||||
style="padding: 0 16px !important;"
|
||||
>
|
||||
<template #title="{ title }">
|
||||
<span v-if="title.indexOf(searchValue) > -1">
|
||||
{{ title.substring(0, title.indexOf(searchValue)) }}
|
||||
<span style="color: #f50">{{ searchValue }}</span>
|
||||
{{ title.substring(title.indexOf(searchValue) + searchValue.length) }}
|
||||
</span>
|
||||
<span v-else>{{ emissionName }}</span>
|
||||
<span v-else>{{ title }}</span>
|
||||
</template>
|
||||
</a-tree>
|
||||
</div>
|
||||
</div>
|
||||
<div class="right">
|
||||
<ns-view-list-table v-bind="tableConfig" :model="data" ref="mainRef" :scroll="{ x: 2000}"/>
|
||||
<a-table
|
||||
:columns="columns"
|
||||
:data-source="tableData"
|
||||
bordered
|
||||
:pagination="false">
|
||||
<template #bodyCell="{ column, text, record }">
|
||||
<template v-if="column.key === 'action'">
|
||||
<span>
|
||||
<a @click="editData(record)">编辑</a>
|
||||
<a-divider type="vertical" />
|
||||
<a @click="delData(record)">删除</a>
|
||||
</span>
|
||||
</template>
|
||||
</template>
|
||||
<template #title>
|
||||
<div class="ns-table-title"><span>排放因子库</span></div>
|
||||
<div class="buttonGroup">
|
||||
<a-button type="primary" @click="addNewData">新增</a-button>
|
||||
</div>
|
||||
</template>
|
||||
</a-table>
|
||||
<a-pagination
|
||||
:current="queryParams.pageNum"
|
||||
:total="total"
|
||||
:page-size="queryParams.pageSize"
|
||||
style="display: flex;justify-content: center;margin-top: 16px;"
|
||||
:show-size-changer="true"
|
||||
:show-quick-jumper="true"
|
||||
@change="onChange" />
|
||||
<!-- 新增/编辑 -->
|
||||
<a-drawer
|
||||
:width="500"
|
||||
:visible="visible"
|
||||
:body-style="{ paddingBottom: '80px' }"
|
||||
:footer-style="{ textAlign: 'right' }"
|
||||
destroyOnClose
|
||||
@close="onClose">
|
||||
<a-form
|
||||
ref="formRef"
|
||||
:model="formState"
|
||||
:rules="rules"
|
||||
:label-col="labelCol"
|
||||
:wrapper-col="wrapperCol"
|
||||
>
|
||||
<a-form-item ref="name" label="能源种类" name="energyType">
|
||||
<a-input v-model:value="formState.energyType" placeholder="请输入能源种类" />
|
||||
</a-form-item>
|
||||
<a-form-item label="计量单位" name="unit">
|
||||
<a-cascader v-model:value="formState.unit" :options="options" />
|
||||
</a-form-item>
|
||||
<a-form-item label="自动采集节点" name="collectionNode">
|
||||
<a-tree-select
|
||||
v-model:value="formState.collectionNode"
|
||||
:tree-line="true"
|
||||
:tree-data="treeData"
|
||||
tree-node-filter-prop="title"
|
||||
>
|
||||
</a-tree-select>
|
||||
</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">
|
||||
<a-select v-model:value="formState.emissionType" placeholder="请选择排放类型">
|
||||
<a-select-option v-for="(item, index) in emissionTypeDic" :key="index" :value="item.cnValue">
|
||||
{{ 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>
|
||||
<!-- 新增树节点 -->
|
||||
<ns-modal :visible="treeNodeAdd" :title="operationTree" @ok="handleOk" @cancel="handleCancel">
|
||||
<ns-input
|
||||
v-model:value="addTreeNode"
|
||||
class="input"
|
||||
placeholder="请输入排放类型"/>
|
||||
</ns-modal>
|
||||
<!-- 新增数据库数据 -->
|
||||
<a-drawer
|
||||
:width="500"
|
||||
:visible="visible"
|
||||
:body-style="{ paddingBottom: '80px' }"
|
||||
:footer-style="{ textAlign: 'right' }"
|
||||
destroyOnClose
|
||||
@close="onClose">
|
||||
<ns-form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
class="form"
|
||||
:wrapperCol="{ span: 20 }"
|
||||
formLayout="vertical" />
|
||||
<template #footer>
|
||||
<a-button style="margin-right: 8px" @click="onClose">取消</a-button>
|
||||
<a-button type="primary" @click="onEdit">确定</a-button>
|
||||
</template>
|
||||
</a-drawer>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { Modal } from 'ant-design-vue';
|
||||
import { computed, createVNode, defineComponent, reactive, ref, watchEffect,watch } from 'vue';
|
||||
import { ref, watch } from 'vue';
|
||||
import type { TreeProps } from 'ant-design-vue';
|
||||
import { Pagination } from 'ant-design-vue';
|
||||
import { columns } from '../config';
|
||||
import { http } from '/nerv-lib/util/http';
|
||||
import { NsMessage, NsModal } from '/nerv-lib/component';
|
||||
import { carbonEmissionFactorLibrary } from '/@/api/carbonEmissionFactorLibrary';
|
||||
import type {
|
||||
AntTreeNodeDragEnterEvent,
|
||||
AntTreeNodeDropEvent,
|
||||
TreeProps,
|
||||
} from 'ant-design-vue/es/tree';
|
||||
import { log } from 'node:console';
|
||||
|
||||
defineOptions({ name: 'QuickCalculation' });
|
||||
const selectTreeDataValue = ref<string>('');
|
||||
const mainRef = ref();
|
||||
const data = reactive({});
|
||||
let formData = ref({});
|
||||
const formRef = ref();
|
||||
const visible = ref(false);
|
||||
const searchValue = ref<string>('');
|
||||
const searchValue2 = ref<string>('');
|
||||
const disabled = ref(false);
|
||||
const treeNodeAdd = ref<boolean>(false);
|
||||
const operationTree = ref<string>('新增');
|
||||
|
||||
const opMap: any = ref({
|
||||
type: 'add',
|
||||
fuc: () => {},
|
||||
record: {},
|
||||
defineOptions({
|
||||
energyType: 'quickCalculation', // 与页面路由name一致缓存才可生效
|
||||
components: {
|
||||
'a-pagination': Pagination,
|
||||
},
|
||||
});
|
||||
watchEffect(() => {
|
||||
disabled.value = opMap.value.type === 'edit';
|
||||
});
|
||||
const casData = ref([]);
|
||||
const treeData = ref([]);
|
||||
const userAuthList = ref([]);
|
||||
const orgId = ref('');
|
||||
const result = JSON.parse(sessionStorage.getItem('ORGID')!);
|
||||
orgId.value = result;
|
||||
const dynamicDisabled = computed(() => {
|
||||
return formRef.value?.validateResult && userAuthList.value?.length;
|
||||
});
|
||||
const fetch = (api, params = { orgId }) => {
|
||||
const fetch = (api, params = { orgId } ) => {
|
||||
return http.post(api, params);
|
||||
};
|
||||
|
||||
// 树结构
|
||||
// 数结构
|
||||
const x = 3;
|
||||
const y = 2;
|
||||
const z = 1;
|
||||
const genData: TreeProps['treeData'] = [];
|
||||
const checkedTreeNodeKeys = ref<string[]>(['0-0']);
|
||||
|
||||
const generateData = (_level: number, _preKey?: string, _tns?: TreeProps['treeData']) => {
|
||||
const preKey = _preKey || '0';
|
||||
@@ -154,70 +163,7 @@ import { log } from 'node:console';
|
||||
});
|
||||
};
|
||||
generateData(z);
|
||||
type TreeDataItem = TreeProps['treeData'][number];
|
||||
const gData = ref<TreeProps['treeData']>(genData);
|
||||
const onDragEnter = (info: AntTreeNodeDragEnterEvent) => {
|
||||
console.log(info);
|
||||
// expandedKeys 需要展开时
|
||||
// expandedKeys.value = info.expandedKeys;
|
||||
};
|
||||
|
||||
const onDrop = (info: AntTreeNodeDropEvent) => {
|
||||
console.log(info);
|
||||
const dropKey = info.node.key;
|
||||
const dragKey = info.dragNode.key;
|
||||
const dropPos = info.node.pos.split('-');
|
||||
const dropPosition = info.dropPosition - Number(dropPos[dropPos.length - 1]);
|
||||
const loop = (data: TreeProps['treeData'], key: string | number, callback: any) => {
|
||||
data.forEach((item, index) => {
|
||||
if (item.key === key) {
|
||||
return callback(item, index, data);
|
||||
}
|
||||
if (item.children) {
|
||||
return loop(item.children, key, callback);
|
||||
}
|
||||
});
|
||||
};
|
||||
const data = [...gData.value];
|
||||
|
||||
// Find dragObject
|
||||
let dragObj: TreeDataItem;
|
||||
loop(data, dragKey, (item: TreeDataItem, index: number, arr: TreeProps['treeData']) => {
|
||||
arr.splice(index, 1);
|
||||
dragObj = item;
|
||||
});
|
||||
if (!info.dropToGap) {
|
||||
// Drop on the content
|
||||
loop(data, dropKey, (item: TreeDataItem) => {
|
||||
item.children = item.children || [];
|
||||
/// where to insert 示例添加到头部,可以是随意位置
|
||||
item.children.unshift(dragObj);
|
||||
});
|
||||
} else if (
|
||||
(info.node.children || []).length > 0 && // Has children
|
||||
info.node.expanded && // Is expanded
|
||||
dropPosition === 1 // On the bottom gap
|
||||
) {
|
||||
loop(data, dropKey, (item: TreeDataItem) => {
|
||||
item.children = item.children || [];
|
||||
// where to insert 示例添加到头部,可以是随意位置
|
||||
item.children.unshift(dragObj);
|
||||
});
|
||||
} else {
|
||||
let ar: TreeProps['treeData'] = [];
|
||||
let i = 0;
|
||||
loop(data, dropKey, (_item: TreeDataItem, index: number, arr: TreeProps['treeData']) => {
|
||||
ar = arr;
|
||||
i = index;
|
||||
});
|
||||
if (dropPosition === -1) {
|
||||
ar.splice(i, 0, dragObj);
|
||||
} else {
|
||||
ar.splice(i + 1, 0, dragObj);
|
||||
}
|
||||
}
|
||||
gData.value = data;
|
||||
};
|
||||
const dataList: TreeProps['treeData'] = [];
|
||||
const generateList = (data: TreeProps['treeData']) => {
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
@@ -249,13 +195,16 @@ import { log } from 'node:console';
|
||||
return parentKey;
|
||||
};
|
||||
const expandedKeys = ref<(string | number)[]>([]);
|
||||
const searchValue = ref<string>('');
|
||||
const autoExpandParent = ref<boolean>(true);
|
||||
const gData = ref<TreeProps['treeData']>(genData);
|
||||
|
||||
const onExpand = (keys: string[]) => {
|
||||
expandedKeys.value = keys;
|
||||
autoExpandParent.value = false;
|
||||
};
|
||||
watch(selectTreeDataValue, value => {
|
||||
|
||||
watch(searchValue, value => {
|
||||
const expanded = dataList
|
||||
.map((item: TreeProps['treeData'][number]) => {
|
||||
if (item.title.indexOf(value) > -1) {
|
||||
@@ -265,273 +214,64 @@ import { log } from 'node:console';
|
||||
})
|
||||
.filter((item, i, self) => item && self.indexOf(item) === i);
|
||||
expandedKeys.value = expanded;
|
||||
selectTreeDataValue.value = value;
|
||||
searchValue.value = value;
|
||||
autoExpandParent.value = true;
|
||||
});
|
||||
// 筛选树结构中的数据
|
||||
const onSearchTreeData = (selectTreeDataValue: string) => {
|
||||
console.log('use value', selectTreeDataValue);
|
||||
console.log('or use this.value', value.value);
|
||||
};
|
||||
// 点击数据点的复选框
|
||||
const checkedIds = ref([])
|
||||
const emissionType = ref()
|
||||
const checkTreeNode = (checkedKeys, info) => {
|
||||
checkedTreeNodeKeys.value = checkedKeys
|
||||
checkedIds.value = []
|
||||
info.checkedNodes.forEach(item=>{
|
||||
checkedIds.value.push(item.id)
|
||||
})
|
||||
sessionStorage.setItem('checkedTreeNode', checkedIds.value);
|
||||
emissionType.value = checkedIds.value.join(',')
|
||||
mainRef.value?.nsTableRef.reload();
|
||||
}
|
||||
// 新增/编辑树节点点击确定
|
||||
const addTreeNode =ref()
|
||||
const handleOk = (e: MouseEvent) => {
|
||||
editTreeNode.value.emissionName = addTreeNode.value
|
||||
http.post(carbonEmissionFactorLibrary.creat,editTreeNode.value).then(() => {
|
||||
getOrgTree()
|
||||
NsMessage.success('操作成功');
|
||||
addTreeNode.value = ''
|
||||
treeNodeAdd.value = false;
|
||||
});
|
||||
};
|
||||
const handleCancel = () => {
|
||||
addTreeNode.value = ''
|
||||
treeNodeAdd.value = false;
|
||||
};
|
||||
// 获取排放分类树
|
||||
const getOrgTree = (params?) => {
|
||||
fetch(carbonEmissionFactorLibrary.getCarbonFactorTree, params).then((res) => {
|
||||
gData.value = res.data
|
||||
// 找到匹配的节点数据
|
||||
const selectedNodes = [];
|
||||
checkedTreeNodeKeys.value.forEach(key => {
|
||||
const [parentId, childId] = key.split('-').map(Number);
|
||||
if (parentId >= 0 && childId >= 0 && gData.value[parentId]?.children?.[childId]) {
|
||||
selectedNodes.push(gData.value[parentId]);
|
||||
}
|
||||
});
|
||||
// 获取默认选中节点的所有id
|
||||
getDefaultIds(selectedNodes)
|
||||
});
|
||||
};
|
||||
const defaultIds = ref([])
|
||||
const getDefaultIds = (selectedNodes) => {
|
||||
selectedNodes.forEach(items => {
|
||||
defaultIds.value.push(items.id)
|
||||
if(items.children){
|
||||
getDefaultIds(items.children)
|
||||
}
|
||||
})
|
||||
emissionType.value = defaultIds.value.join(',')
|
||||
checkedIds.value = defaultIds.value
|
||||
sessionStorage.setItem('checkedTreeNode', checkedIds.value);
|
||||
}
|
||||
getOrgTree();
|
||||
// 被选中的树节点
|
||||
const editTreeNode = ref({})
|
||||
const onSelect = (selectedKeys: string[], info: any) => {
|
||||
if(info.selected){
|
||||
editTreeNode.value = {
|
||||
id:info.selectedNodes[0].id,
|
||||
level:info.selectedNodes[0].level,
|
||||
dataNumber:info.selectedNodes[0].dataNumber,
|
||||
sortNumber:info.selectedNodes[0].sortNumber,
|
||||
parentEmissionId:info.selectedNodes[0].parentEmissionId,
|
||||
}
|
||||
}
|
||||
// 列表数据
|
||||
const total = ref<number>()
|
||||
const queryParams = ref({
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
})
|
||||
const tableData = [
|
||||
{
|
||||
key: '1',
|
||||
name: 'John Brown',
|
||||
money: '¥300,000.00',
|
||||
address: 'New York No. 1 Lake Park',
|
||||
},
|
||||
{
|
||||
key: '2',
|
||||
name: 'Jim Green',
|
||||
money: '¥1,256,000.00',
|
||||
address: 'London No. 1 Lake Park',
|
||||
},
|
||||
{
|
||||
key: '3',
|
||||
name: 'Joe Black',
|
||||
money: '¥120,000.00',
|
||||
address: 'Sidney No. 1 Lake Park',
|
||||
},
|
||||
];
|
||||
// 分页器
|
||||
const onChange = (pageNumber: number,size: number) => {
|
||||
queryParams.value.pageNum = pageNumber;
|
||||
queryParams.value.pageSize = size;
|
||||
// getTableList()
|
||||
};
|
||||
// 新增/编辑
|
||||
const formRef = ref();
|
||||
const labelCol = { span: 5 };
|
||||
const wrapperCol = { span: 19 };
|
||||
const formState = ref({})
|
||||
const visible = ref(false);
|
||||
|
||||
const onSearch = () => {
|
||||
console.log(searchValue.value);
|
||||
getOrgTree({ orgName: searchValue.value, orgId });
|
||||
// 定义form表单的必填
|
||||
const rules: Record<string, Rule[]> = {
|
||||
energyType: [{ required: true, message: '请输入能源种类', trigger: 'change' }],
|
||||
isComputeCarbon: [{ required: true, message: '请选择是否计算碳排', trigger: 'change' }]
|
||||
};
|
||||
|
||||
const tableFetch = (params) => {
|
||||
console.log(params, 'sdfasfasdfasdfasdf');
|
||||
|
||||
tableConfig.value.params = {
|
||||
...mainRef.value.params,
|
||||
...params,
|
||||
};
|
||||
|
||||
setTimeout(() => {
|
||||
mainRef.value?.nsTableRef.reload();
|
||||
}, 100);
|
||||
// 点击编辑按钮
|
||||
const editData = (record) =>{
|
||||
visible.value = true
|
||||
};
|
||||
|
||||
const handleSelect = (selectedKeys: any, info: any) => {
|
||||
fetch(carbonEmissionFactorLibrary.queryDeptTree, { orgId: info.node?.orgInfo.orgId }).then((res) => {
|
||||
treeData2.value = res.data;
|
||||
});
|
||||
tableFetch({ orgId: info.node?.orgInfo.orgId });
|
||||
};
|
||||
|
||||
|
||||
// 关闭新增抽屉
|
||||
const onClose = () => {
|
||||
visible.value = false;
|
||||
formData.value = {};
|
||||
userAuthList.value.splice(0);
|
||||
formRef.value.resetFields();
|
||||
};
|
||||
|
||||
const onEdit = () => {
|
||||
formRef.value?.triggerSubmit().then(() => {
|
||||
console.log(formData.value, 'formData.value');
|
||||
// if (!userAuthList.value.length) {
|
||||
// NsMessage.error('请添加用户权限');
|
||||
// return;
|
||||
// }
|
||||
|
||||
opMap.value.fuc &&
|
||||
opMap.value.fuc({ ...formData.value });
|
||||
});
|
||||
};
|
||||
const tableConfig = ref({
|
||||
title: '数据库',
|
||||
api: carbonEmissionFactorLibrary.getTableList,
|
||||
params: {
|
||||
orgId,
|
||||
emissionType
|
||||
},
|
||||
headerActions: [
|
||||
{
|
||||
label: '新增',
|
||||
name: 'userAdd',
|
||||
type: 'primary',
|
||||
handle: () => {
|
||||
opMap.value.type = 'add';
|
||||
setTimeout(() => {
|
||||
formData.value = {
|
||||
carbonEmissionPrefix:'t',
|
||||
numberOfReferences:'10'
|
||||
};
|
||||
userAuthList.value.splice(0);
|
||||
});
|
||||
opMap.value.fuc = (formData: any) => {
|
||||
formData.emissionType = formData.emissionType[formData.emissionType.length - 1]
|
||||
return http.post(carbonEmissionFactorLibrary.creatOrUpdate, formData).then(() => {
|
||||
mainRef.value?.nsTableRef.reload();
|
||||
visible.value = false;
|
||||
NsMessage.success('操作成功');
|
||||
});
|
||||
};
|
||||
visible.value = true;
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '导入',
|
||||
type: 'primary',
|
||||
name: 'userImport',
|
||||
handle: () => {},
|
||||
},
|
||||
{
|
||||
label: '导出',
|
||||
type: 'primary',
|
||||
name: 'userExports',
|
||||
},
|
||||
{
|
||||
label: '批量删除',
|
||||
type: 'primary',
|
||||
name: 'userBatchDel',
|
||||
dynamicDisabled: (data: any) => {
|
||||
return data.list.length === 0;
|
||||
},
|
||||
confirm: true,
|
||||
isReload: true,
|
||||
isClearCheck: true,
|
||||
api: carbonEmissionFactorLibrary.del,
|
||||
dynamicParams: { ids: 'id[]' },
|
||||
},
|
||||
],
|
||||
columns: [
|
||||
{
|
||||
title: 'id',
|
||||
customRender: (text: any) => {
|
||||
return text.index + 1;
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '排放源',
|
||||
dataIndex: 'emissionSources',
|
||||
},
|
||||
{
|
||||
title: '排放类型',
|
||||
dataIndex: 'emissionTypeColumn',
|
||||
},
|
||||
{
|
||||
title: '排放气体',
|
||||
dataIndex: 'emissionGas',
|
||||
},
|
||||
{
|
||||
title: '排放环节',
|
||||
dataIndex: 'emissionProcess',
|
||||
},
|
||||
{
|
||||
title: '排放因子',
|
||||
dataIndex: 'emissionFactors',
|
||||
},
|
||||
{
|
||||
title: '排放因子单位',
|
||||
dataIndex: 'emissionFactorUnits',
|
||||
},
|
||||
{
|
||||
title: '数据来源',
|
||||
dataIndex: 'dataSources',
|
||||
},
|
||||
{
|
||||
title: '数据库',
|
||||
dataIndex: 'carbonDatabase',
|
||||
},
|
||||
{
|
||||
title: '参考文献',
|
||||
dataIndex: 'reference',
|
||||
},
|
||||
{
|
||||
title: '引用数量',
|
||||
dataIndex: 'numberOfReferences',
|
||||
},
|
||||
],
|
||||
columnActions: {
|
||||
title: '操作',
|
||||
actions: [
|
||||
{
|
||||
label: '编辑',
|
||||
name: 'userEdit',
|
||||
handle: (record: any) => {
|
||||
userAuthList.value.splice(0);
|
||||
setTimeout(() => {
|
||||
console.log(record.id);
|
||||
|
||||
http.post(carbonEmissionFactorLibrary.findById,{ id: record.id } ).then((res) => {
|
||||
formData.value = res.data;
|
||||
});
|
||||
}, 10);
|
||||
opMap.value.type = 'edit';
|
||||
opMap.value.fuc = (formData: any) => {
|
||||
return http.post(carbonEmissionFactorLibrary.creatOrUpdate, formData).then(() => {
|
||||
mainRef.value?.nsTableRef.reload();
|
||||
visible.value = false;
|
||||
NsMessage.success('操作成功');
|
||||
});
|
||||
};
|
||||
visible.value = true;
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '删除',
|
||||
name: 'userDelete',
|
||||
dynamicParams: { ids: 'id[]' },
|
||||
confirm: true,
|
||||
isReload: true,
|
||||
api: carbonEmissionFactorLibrary.del,
|
||||
},
|
||||
],
|
||||
},
|
||||
rowKey: 'id',
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.main {
|
||||
background-color: @ns-content-bg;
|
||||
@@ -540,13 +280,10 @@ import { log } from 'node:console';
|
||||
}
|
||||
.left {
|
||||
width: 300px;
|
||||
// max-height: calc(100vh - 96px);
|
||||
margin-right: @ns-gap;
|
||||
min-width: fit-content;
|
||||
> div {
|
||||
border-radius: @ns-border-radius;
|
||||
background-color: @white;
|
||||
// box-shadow: @ns-content-box-shadow;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
@@ -565,12 +302,14 @@ import { log } from 'node:console';
|
||||
.right {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
height: 100%;
|
||||
background: #ffffff;
|
||||
}
|
||||
::v-deep .ant-table-container{
|
||||
padding: 0px 16px;
|
||||
}
|
||||
.top {
|
||||
overflow: auto;
|
||||
// height: 50%;
|
||||
// border-bottom: 5px solid rgb(229, 235, 240);
|
||||
// overflow-y: auto;
|
||||
}
|
||||
.ns-form-title{
|
||||
font-weight: bold;
|
||||
@@ -580,4 +319,24 @@ import { log } from 'node:console';
|
||||
padding-bottom: 10px;
|
||||
border-bottom: 1px solid #e9e9e9;
|
||||
}
|
||||
::v-deep .ant-table-title{
|
||||
display: flex;
|
||||
height: 100%;
|
||||
align-items: center;
|
||||
}
|
||||
.ns-table-title{
|
||||
font-weight: bold;
|
||||
}
|
||||
.buttonGroup{
|
||||
margin-left: 1vw;
|
||||
width: 5vw;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
}
|
||||
</style>
|
||||
<style scoped>
|
||||
th.column-money,
|
||||
td.column-money {
|
||||
text-align: right !important;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,141 @@
|
||||
.out-dialog {
|
||||
position: fixed;
|
||||
right: 496px;
|
||||
width: 500px;
|
||||
height: 100%;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
margin: auto;
|
||||
box-sizing: border-box;
|
||||
color: rgb(255, 83, 0);
|
||||
background: black;
|
||||
display: flex;
|
||||
padding: 25px;
|
||||
flex-direction: column;
|
||||
.content {
|
||||
overflow-y: scroll;
|
||||
.div-operation {
|
||||
display: inline-block;
|
||||
width: 3px;
|
||||
height: 13px;
|
||||
opacity: 1;
|
||||
border-radius: 1px;
|
||||
background: rgba(67, 136, 251, 1);
|
||||
}
|
||||
.text-operation {
|
||||
display: inline-block;
|
||||
color: rgba(255, 255, 255, 1);
|
||||
font-size: 16px;
|
||||
font-weight: 700;
|
||||
margin-left: 5px;
|
||||
}
|
||||
.j-box {
|
||||
background-color: #000;
|
||||
opacity: 1;
|
||||
z-index: 99999;
|
||||
overflow-y: scroll;
|
||||
.journal {
|
||||
padding: 1% 3%;
|
||||
width: 100%;
|
||||
height: 150px;
|
||||
background-color: rgba(0, 0, 0);
|
||||
border-radius: 12px;
|
||||
border: 2px solid transparent;
|
||||
border-image: linear-gradient(to bottom, #0077ff, #00f6ff, #000000) 1;
|
||||
}
|
||||
.imgText {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
|
||||
.ztzm {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.cxbtn {
|
||||
color: rgba(255, 255, 255, 1);
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
width: 59.79px;
|
||||
height: 32px;
|
||||
opacity: 1;
|
||||
background: linear-gradient(
|
||||
180deg,
|
||||
rgba(255, 187, 0, 1) 0%,
|
||||
rgba(255, 112, 3, 1) 91.21%,
|
||||
rgba(255, 129, 3, 1) 100%
|
||||
);
|
||||
}
|
||||
}
|
||||
.btn-box {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
grid-template-rows: 1fr 1fr;
|
||||
grid-row-gap: 15px;
|
||||
.btn-item {
|
||||
text-align: center;
|
||||
display: flex;
|
||||
align-content: space-between;
|
||||
.left {
|
||||
width: 70px;
|
||||
height: 35px;
|
||||
line-height: 35px;
|
||||
border-radius: 4px;
|
||||
background: linear-gradient(
|
||||
180deg,
|
||||
rgba(1, 206, 255, 1) 0%,
|
||||
rgba(0, 150, 229, 1) 100%
|
||||
);
|
||||
color: rgba(255, 255, 255, 1);
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
}
|
||||
.right {
|
||||
width: 140px;
|
||||
height: 35px;
|
||||
line-height: 35px;
|
||||
span {
|
||||
vertical-align: middle;
|
||||
}
|
||||
img {
|
||||
padding: 0 5px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.button-box {
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
padding: 10px;
|
||||
height: 60px;
|
||||
position: absolute;
|
||||
background-color: transparent;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
.execute, .cancel {
|
||||
margin-right: 10px;
|
||||
width: 74px;
|
||||
height: 40px;
|
||||
opacity: 1;
|
||||
cursor: pointer;
|
||||
border-radius: 4px;
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
border: 0;
|
||||
margin-left: 10px;
|
||||
}
|
||||
.execute {
|
||||
background: rgb(67, 136, 251);
|
||||
color: white;
|
||||
}
|
||||
.cancel {
|
||||
background: white;
|
||||
color: black;
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,156 +0,0 @@
|
||||
// 页面容器
|
||||
.lighting-box {
|
||||
// width: 100%;
|
||||
// height: 100%;
|
||||
position: relative;
|
||||
// background: linear-gradient(#badaff, #8cabeb, #7095de);
|
||||
// 照明设备功能总容器
|
||||
.lighting-img-box {
|
||||
position: relative;
|
||||
width: 1280px;
|
||||
height: 720px;
|
||||
user-select: none;
|
||||
background-image: url(../image/bg.jpg);
|
||||
// 由于背景是俯视图,会产生有交点的透视效果,故使用透视属性
|
||||
perspective: 1000px;
|
||||
perspective-origin: 850px -160px;
|
||||
// 左上角区域切换功能
|
||||
.btn-box {
|
||||
width: 120px;
|
||||
position: sticky;
|
||||
top: 10px;
|
||||
left: 10px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
.btn-item {
|
||||
cursor: pointer;
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
border-radius: 4px;
|
||||
background: rgba(39, 120, 255, 1);
|
||||
border: 1px solid rgba(51, 199, 255, 1);
|
||||
box-shadow: 0px 10px 15px rgba(0, 54, 136, 0.3);
|
||||
font-size: 18px;
|
||||
color: white;
|
||||
}
|
||||
.btn-item:hover {
|
||||
color: black;
|
||||
}
|
||||
}
|
||||
// 大区分区
|
||||
.area{
|
||||
position: absolute;
|
||||
bottom: 170px;
|
||||
left: 240px;
|
||||
width: 780px;
|
||||
height: 240px;
|
||||
transform: rotateX(79deg) rotateZ(-22deg) skew(29deg);
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
.area1 {
|
||||
width: 170px;
|
||||
background: rgba(0, 251, 91, 0.3);
|
||||
border: 2px solid rgb(0, 251, 91);
|
||||
display: flex;
|
||||
}
|
||||
.area2 {
|
||||
width: 240px;
|
||||
background: rgba(255, 165, 0, 0.3);
|
||||
border: 2px solid rgb(255, 165, 0);
|
||||
display: flex;
|
||||
}
|
||||
.area3 {
|
||||
width: 110px;
|
||||
background: rgba(255, 0, 0, 0.3);
|
||||
border: 2px solid rgb(255, 0, 0);
|
||||
}
|
||||
.area4 {
|
||||
flex: 1;
|
||||
background: rgba(80, 236, 244, 0.3);
|
||||
border: 2px solid rgb(80, 236, 244);
|
||||
}
|
||||
// .area-item:hover {
|
||||
// transform: scale(1.05);
|
||||
// }
|
||||
.area-item {
|
||||
cursor: pointer;
|
||||
transition: all ease 0.2s;
|
||||
>.light-group {
|
||||
height: 100%;
|
||||
flex: 1;
|
||||
display:flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
.group-shadow1 {
|
||||
width: 35px;
|
||||
height: 150px;
|
||||
border-radius: 20px;
|
||||
background: rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
.group-shadow2 {
|
||||
width: 35px;
|
||||
height: 180px;
|
||||
border-radius: 20px;
|
||||
background: rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
.group-shadow3 {
|
||||
width: 40px;
|
||||
height: 180px;
|
||||
border-radius: 20px;
|
||||
background: rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
.group-shadow4 {
|
||||
width: 40px;
|
||||
height: 160px;
|
||||
border-radius: 20px;
|
||||
background: rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
}
|
||||
// .group-shadow {
|
||||
// transition: all ease 0.2s;
|
||||
// }
|
||||
// .group-shadow:hover {
|
||||
// transform: scale(1.05);
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 总容器与抽屉按钮
|
||||
.ns-content-main {
|
||||
position: relative;
|
||||
// 抽屉打开按钮
|
||||
.drawer-box-in {
|
||||
width: 30px;
|
||||
height: 40px;
|
||||
border-radius: 2px;
|
||||
position: fixed;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
margin: auto;
|
||||
background: rgba(0, 0 ,0 ,0.5);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
cursor: pointer;
|
||||
}
|
||||
// 抽屉关闭按钮
|
||||
.drawer-box-out {
|
||||
width: 30px;
|
||||
height: 40px;
|
||||
border-radius: 2px;
|
||||
position: fixed;
|
||||
right: 496px;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
margin: auto;
|
||||
background: rgba(0, 0 ,0 ,0.5);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,19 +3,19 @@
|
||||
<div class="lighting-img-box">
|
||||
<!-- 左上角,区域切换 -->
|
||||
<div class="btn-box">
|
||||
<button class="btn-item">1F</button>
|
||||
<button class="btn-item">2F</button>
|
||||
<button class="btn-item">站台</button>
|
||||
<button class="btn-item" @click=changeArea(1)>1F</button>
|
||||
<button class="btn-item" @click=changeArea(2)>2F</button>
|
||||
<button class="btn-item" @click=changeArea(3)>站台</button>
|
||||
</div>
|
||||
<!-- 楼层区域 -->
|
||||
<div class="area">
|
||||
<div
|
||||
v-for="(item, index) in treeData"
|
||||
:class="computedClass(item.id)"
|
||||
@click="getArea(item.id)"
|
||||
:class="computedClass(String(item.id))"
|
||||
@click="getArea(item)"
|
||||
:key="index">
|
||||
<div v-for="(v, i) in item.children" :key="i" class="light-group">
|
||||
<div class="group-shadow group-shadow1" :class="computedClass(v.id)" @click.stop="getArea(v.id)"></div>
|
||||
<div class="group-shadow group-shadow1" :class="computedClass(v.id)" @click.stop="getArea(v)"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -40,16 +40,18 @@
|
||||
placement="right"
|
||||
:body-style="{ background: 'rgba(0, 0, 0)', opacity: 0.8 }"
|
||||
:closable="false"
|
||||
id="Odrawer"
|
||||
id="drawer"
|
||||
:maskStyle="{ 'background-color': 'rgba(0, 0, 0, 0)' }">
|
||||
<a-tabs v-model:activeKey="activeKey">
|
||||
<a-tab-pane key="1" tab="控制面板">
|
||||
<tabs1 @changeArea="getArea" :treeData="treeData"></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-tab-pane key="3" tab="日志"></a-tab-pane>
|
||||
</a-tabs>
|
||||
</a-drawer>
|
||||
</div>
|
||||
@@ -61,15 +63,17 @@ import { ref } from 'vue';
|
||||
import { treeData } from './treeData'
|
||||
import light from './light.vue';
|
||||
import tabs1 from './tabs1.vue'
|
||||
import tabs2 from './tabs2.vue'
|
||||
import tabs3 from './tabs3.vue'
|
||||
// ICON
|
||||
import {
|
||||
DoubleLeftOutlined,
|
||||
DoubleRightOutlined
|
||||
} from '@ant-design/icons-vue';
|
||||
|
||||
// 分区 - 当前选择的分区 - 默认选择一区
|
||||
let area = ref(['1'])
|
||||
// 分区 - 分区小灯泡
|
||||
// 分区 - 当前选择的分区序号 - 默认选择一区
|
||||
const area = ref(['1'])
|
||||
// 分区 - 分区小灯泡 - 此处位置需前端写死
|
||||
const bulbs = ref([
|
||||
{
|
||||
styleText: { left: '190px', bottom: '200px' },
|
||||
@@ -121,6 +125,16 @@ const bulbs = ref([
|
||||
},
|
||||
])
|
||||
|
||||
// 分区 - 左上角分区切换
|
||||
const changeArea = (area: number) => {
|
||||
if (area == 1) {
|
||||
console.log('1F')
|
||||
} else if (area == 2) {
|
||||
console.log('2F')
|
||||
} else if (area == 3) {
|
||||
console.log('站台')
|
||||
}
|
||||
}
|
||||
// 分区 - 单个分区切换
|
||||
const getArea = (result: any) => {
|
||||
// 如果传入的值是数组
|
||||
@@ -132,16 +146,14 @@ const getArea = (result: any) => {
|
||||
area.value[0] = String(result)
|
||||
}
|
||||
}
|
||||
// 分区 - 多个分区切换,只有照明回路能够触发多个分区
|
||||
// 分区 - 样式函数
|
||||
const computedClass = (number: number) => {
|
||||
if (area.value.indexOf(number) != -1) {
|
||||
return `isActive area-item area${number}`
|
||||
const computedClass = (string: string) => {
|
||||
if (area.value.indexOf(string) != -1) {
|
||||
return `isActive area-item area${string}`
|
||||
} else {
|
||||
return `area-item area${number}`
|
||||
return `area-item area${string}`
|
||||
}
|
||||
}
|
||||
|
||||
// 抽屉 - 当前选择的tab
|
||||
let activeKey = ref('1');
|
||||
// 抽屉 - 打开状态
|
||||
@@ -153,7 +165,7 @@ const toggleDrawer = () => {
|
||||
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
@import "./indexs.less";
|
||||
@import "./index.less";
|
||||
.isActive {
|
||||
border: 3px solid white !important;
|
||||
}
|
||||
|
||||
@@ -1162,16 +1162,11 @@
|
||||
selectedButton.value = null;
|
||||
showControlMode.value = false;
|
||||
showControlScene.value = false;
|
||||
selectedButton3.value = null;
|
||||
selectedButton4.value = null;
|
||||
selectedButton3.value = '';
|
||||
selectedButton4.value = '';
|
||||
};
|
||||
|
||||
// 操作日志
|
||||
const logModalVisible = ref(false);
|
||||
const handlerefClick1 = () => {
|
||||
console.log(1111);
|
||||
executevisible.value = true;
|
||||
};
|
||||
|
||||
|
||||
let trindex = ref('-1');
|
||||
const handleRowClick = (index: any) => {
|
||||
@@ -1192,9 +1187,7 @@
|
||||
};
|
||||
// 添加模态框
|
||||
const addvisible = ref<boolean>(false);
|
||||
const addModal = () => {
|
||||
addvisible.value = true;
|
||||
};
|
||||
|
||||
// 穿梭框
|
||||
interface MockData {
|
||||
key: string;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<div class="area">
|
||||
<template v-if="!showAllButtonsArea">
|
||||
<button v-for="(button, index) in limitedButtons1" :key="index"
|
||||
:class="{ btn: true, selected: button.selected }" @click="selectButton(button, index)">
|
||||
:class="{ btn: true, selected: button.selected }" @click="selectButton(button)">
|
||||
{{ button.label }}
|
||||
</button>
|
||||
<div style="margin-top: 10px">
|
||||
@@ -20,8 +20,8 @@
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<button v-for="(button, index) in props.treeData" :key="index"
|
||||
:class="{ btn: true, selected: button.selected }" @click="selectButton(button)">
|
||||
<button v-for="(button, index) in props.treeData" :key="index" :class="{ btn: true, selected: button.selected }"
|
||||
@click="selectButton(button)">
|
||||
{{ button.label }}
|
||||
</button>
|
||||
<div style="margin-top: 10px">
|
||||
@@ -36,7 +36,7 @@
|
||||
<div class="circuit-tab"></div>
|
||||
<span class="circuit-text">照明回路</span>
|
||||
<div class="btn2">
|
||||
<button class="openplan" :class="{ enabled2: isPlanEnabled2, disabled2: !isPlanEnabled2 }" @click="togglePlan2">
|
||||
<button class="openPlan" :class="{ enabled2: isPlanEnabled2, disabled2: !isPlanEnabled2 }" @click="togglePlan2">
|
||||
{{ isPlanEnabled2 ? '启用面板' : '禁用面板' }}
|
||||
</button>
|
||||
<a-switch v-model:checked="selectAllCheckbox" :disabled="singleSelection" :class="{
|
||||
@@ -49,7 +49,7 @@
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btnarea" v-if="selectedButton">
|
||||
<div class="btnArea" v-if="selectedButton">
|
||||
<template v-if="!showAllButtons">
|
||||
<button v-for="(button2, index) in limitedButtons2" :key="index"
|
||||
:class="{ btn: true, selected: button2.selected }" class="zmhlbtn" @click="toggleSelection(button2)">
|
||||
@@ -80,7 +80,7 @@
|
||||
<!-- 控制模式按钮部分 -->
|
||||
<div class="control-mode-btn-area" v-show="showControlMode">
|
||||
<button v-for="(button3, index) in controlType" :key="index"
|
||||
:class="{ btn: true, selected: button3.type === thisButtonType }" @click="selectButton3(button3)">
|
||||
:class="{ btn: true, selected: button3.type == thisButton.type }" @click="selectButton3(button3)">
|
||||
{{ button3.name }}
|
||||
</button>
|
||||
</div>
|
||||
@@ -119,7 +119,7 @@
|
||||
:style="{ height: '50px' }">
|
||||
<td>{{ row.num }}</td>
|
||||
<td>{{ row.light }}</td>
|
||||
<td>{{ row.tempruter }}</td>
|
||||
<td>{{ row.temperature }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -130,170 +130,71 @@
|
||||
<button class="flushed" @click="refresh">刷新</button>
|
||||
<button class="execute" @click="showModal">执行</button>
|
||||
</div>
|
||||
<!-- <a-modal :v-if="cxlist.length === 0" v-model:visible="executevisible" width="500px" height="792px" okText="执行"
|
||||
:closable="false" @ok="handleOk2" :mask="false" :bodyStyle="{
|
||||
opacity: 1,
|
||||
background: ' rgba(0,0,0)',
|
||||
color: 'rgba(255,83,0)',
|
||||
boxSizing: 'borderBox',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
position: 'fixed',
|
||||
right: '496px',
|
||||
top: '0',
|
||||
}">
|
||||
<div :v-if="cxlist.length === 0" style="height: 792px">
|
||||
|
||||
<div class="out-dialog" v-if="executeVisible">
|
||||
<div class="content" v-if="executeVisible">
|
||||
<div>
|
||||
<div class="div-operation"></div>
|
||||
<span class="text-operation">变更内容 </span>
|
||||
</div>
|
||||
<div class="jbox" v-for="item in cxlist" :key="item.id">
|
||||
<div class="j-box" v-for="item in cxList" :key="item.id">
|
||||
<div class="journal" style="margin-top: 20px">
|
||||
<div class="imgText">
|
||||
<div class="zjzm">
|
||||
<img class="titleimg" src="/asset/image//bulbLogo/21961.png" alt="" />
|
||||
<span class="titletext" style="font-size: 20px; font-weight: 500; color: rgba(255, 255, 255, 1)">{{
|
||||
item.name }}</span>
|
||||
<img class="title-img" src="/asset/image//bulbLogo/21961.png" alt="" />
|
||||
<span class="title-text" style="font-size: 20px; font-weight: 500; color: rgba(255, 255, 255, 1)">{{ item.name }}</span>
|
||||
</div>
|
||||
<button class="cxbtn" @click="delbtn(item.id)">撤销</button>
|
||||
<button class="cxbtn" @click="delBtn(item.id)">撤销</button>
|
||||
</div>
|
||||
<div class="control-btn">
|
||||
<button style="
|
||||
width: 96px;
|
||||
height: 40px;
|
||||
border-radius: 4px;
|
||||
background: linear-gradient(
|
||||
180deg,
|
||||
rgba(1, 206, 255, 1) 0%,
|
||||
rgba(0, 150, 229, 1) 100%
|
||||
);
|
||||
|
||||
border: 1px solid rgba(95, 154, 251, 1);
|
||||
color: rgba(255, 255, 255, 1);
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
">
|
||||
控制模式
|
||||
</button>
|
||||
<span style="
|
||||
color: rgba(255, 255, 255, 1);
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
margin-left: 12px;
|
||||
margin-right: 8px;
|
||||
">手动</span>
|
||||
<img src="/asset/image/bulbLogo/22406.png" alt="" />
|
||||
<span style="
|
||||
color: rgba(255, 255, 255, 1);
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
margin-left: 8px;
|
||||
margin-right: 40px;
|
||||
">自动</span>
|
||||
</div>
|
||||
<div class="light-btn">
|
||||
<button style="
|
||||
width: 68px;
|
||||
height: 40px;
|
||||
border-radius: 4px;
|
||||
background: linear-gradient(
|
||||
180deg,
|
||||
rgba(1, 206, 255, 1) 0%,
|
||||
rgba(0, 150, 229, 1) 100%
|
||||
);
|
||||
|
||||
border: 1px solid rgba(95, 154, 251, 1);
|
||||
color: rgba(255, 255, 255, 1);
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
">
|
||||
亮度
|
||||
</button>
|
||||
<span style="
|
||||
color: rgba(255, 255, 255, 1);
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
margin-left: 12px;
|
||||
margin-right: 8px;
|
||||
">100lux</span>
|
||||
<img src="/asset/image/bulbLogo/22406.png" alt="" />
|
||||
<span style="
|
||||
color: rgba(243, 97, 99, 1);
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
margin-left: 8px;
|
||||
">30lux</span>
|
||||
</div>
|
||||
<div class="control-area-btn">
|
||||
<button style="
|
||||
width: 96px;
|
||||
height: 40px;
|
||||
border-radius: 4px;
|
||||
background: linear-gradient(
|
||||
180deg,
|
||||
rgba(1, 206, 255, 1) 0%,
|
||||
rgba(0, 150, 229, 1) 100%
|
||||
);
|
||||
|
||||
border: 1px solid rgba(95, 154, 251, 1);
|
||||
color: rgba(255, 255, 255, 1);
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
">
|
||||
控制场景
|
||||
</button>
|
||||
<span style="
|
||||
color: rgba(255, 255, 255, 1);
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
margin-left: 12px;
|
||||
margin-right: 8px;
|
||||
">手动</span>
|
||||
<img src="/asset/image/bulbLogo/22406.png" alt="" />
|
||||
<span style="
|
||||
color: rgba(255, 255, 255, 1);
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
margin-left: 8px;
|
||||
margin-right: 40px;
|
||||
">自动</span>
|
||||
</div>
|
||||
<div class="temp-btn">
|
||||
<button style="
|
||||
width: 68px;
|
||||
height: 40px;
|
||||
border-radius: 4px;
|
||||
background: linear-gradient(
|
||||
180deg,
|
||||
rgba(1, 206, 255, 1) 0%,
|
||||
rgba(0, 150, 229, 1) 100%
|
||||
);
|
||||
border: 1px solid rgba(95, 154, 251, 1);
|
||||
color: rgba(255, 255, 255, 1);
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
">
|
||||
色温
|
||||
</button>
|
||||
<span style="
|
||||
color: rgba(255, 255, 255, 1);
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
margin-left: 12px;
|
||||
margin-right: 8px;
|
||||
">4000k</span>
|
||||
<img src="/asset/image/bulbLogo/22406.png" alt="" />
|
||||
<span style="
|
||||
color: rgba(255, 255, 255, 1);
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
margin-left: 8px;
|
||||
">3800k</span>
|
||||
<div class="btn-box">
|
||||
<div class="btn-item">
|
||||
<div class="left">控制模式</div>
|
||||
<div class="right">
|
||||
<span>手动</span>
|
||||
<img src="/asset/image/bulbLogo/22406.png" alt="" />
|
||||
<span>自动</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-item">
|
||||
<div class="left">
|
||||
亮度
|
||||
</div>
|
||||
<div class="right">
|
||||
<span>100lux</span>
|
||||
<img src="/asset/image/bulbLogo/22406.png" alt="" />
|
||||
<span>30lux</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-item">
|
||||
<div class="left">
|
||||
控制场景
|
||||
</div>
|
||||
<div class="right">
|
||||
<span>手动</span>
|
||||
<img src="/asset/image/bulbLogo/22406.png" alt="" />
|
||||
<span>自动</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-item">
|
||||
<div class="left">
|
||||
色温
|
||||
</div>
|
||||
<div class="right">
|
||||
<span>4000k</span>
|
||||
<img src="/asset/image/bulbLogo/22406.png" alt="" />
|
||||
<span>3800k</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</a-modal> -->
|
||||
<div style="width: 100%; height: 60px;"></div>
|
||||
<div class="button-box">
|
||||
<button class="cancel" @click="executeVisible = false">取消</button>
|
||||
<button class="execute">执行</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
@@ -307,19 +208,23 @@ import {
|
||||
|
||||
// 初始化
|
||||
onMounted(() => {
|
||||
const tree = props.treeData
|
||||
const data = props.treeData[0]
|
||||
// 默认选中第一个分区
|
||||
tree[0].selected = true
|
||||
data.selected = true
|
||||
// 默认展示第一个分区的回路
|
||||
buttons2.value = tree[0].children
|
||||
buttons2.value = data.children
|
||||
})
|
||||
|
||||
// 与父组件的交互 ===================================================================
|
||||
const props = defineProps({
|
||||
// 分区结构(照明区域 > 照明回路)
|
||||
treeData: {
|
||||
type: Array
|
||||
type: Array,
|
||||
default: []
|
||||
},
|
||||
line: {
|
||||
type: Array
|
||||
}
|
||||
});
|
||||
const emit = defineEmits(['changeArea']);
|
||||
|
||||
@@ -336,20 +241,13 @@ const togglePlan = () => {
|
||||
const showAllButtonsArea = ref(false);
|
||||
// 照明区域 - 分区 - 被选中的按钮 默认为1
|
||||
const selectedButton = ref('1');
|
||||
// 照明区域 - 区域切换(按钮点击)事件
|
||||
const selectButton = (button: any, index: number) => {
|
||||
// 照明区域 - 区域切换(按钮点击-单选)事件
|
||||
const selectButton = (button: any) => {
|
||||
// 当前选中按钮
|
||||
selectedButton.value = button;
|
||||
// 分区只能单选
|
||||
props.treeData.forEach(item => {
|
||||
item.selected = false
|
||||
})
|
||||
// 重置
|
||||
initMenu(1)
|
||||
button.selected = true
|
||||
// 切换1级分区时,重置二级分区
|
||||
buttons2.value.forEach(item => {
|
||||
item.selected = false
|
||||
})
|
||||
showControlMode.value = false
|
||||
buttons2.value = button.children
|
||||
// 反选area
|
||||
emit('changeArea', []);
|
||||
@@ -375,17 +273,8 @@ const togglePlan2 = () => {
|
||||
isPlanEnabled2.value = !isPlanEnabled2.value;
|
||||
// 禁用 - 则取消选中,增加禁止图标
|
||||
if (isPlanEnabled2.value) {
|
||||
item.selected = false;
|
||||
item.stop = true
|
||||
let level1 = String(selectedButton.value.id)
|
||||
let arr = [level1]
|
||||
buttons2.value.forEach(item => {
|
||||
if (item.selected) {
|
||||
arr.push(item.id)
|
||||
}
|
||||
})
|
||||
emit('changeArea', arr)
|
||||
// 启用 - 去除禁止图标
|
||||
// 启用 - 去除禁止图标
|
||||
} else {
|
||||
item.stop = false
|
||||
}
|
||||
@@ -410,12 +299,10 @@ const toggleAllSelection = () => {
|
||||
// 全选
|
||||
if (selectAllCheckbox.value) {
|
||||
buttons2.value.forEach((item) => {
|
||||
if (!item.stop) {
|
||||
item.selected = true;
|
||||
arr.push(item.id)
|
||||
}
|
||||
item.selected = true;
|
||||
arr.push(item.id)
|
||||
});
|
||||
// 全不选
|
||||
// 全不选
|
||||
} else {
|
||||
buttons2.value.forEach((item) => {
|
||||
item.selected = false;
|
||||
@@ -431,7 +318,7 @@ const toggleSelection = (button: any) => {
|
||||
zmhlid.value = button.id
|
||||
// 如果已被锁定,则展示禁用/启用状态跳出
|
||||
if (button.stop) {
|
||||
return isPlanEnabled2.value = true
|
||||
isPlanEnabled2.value = true
|
||||
} else {
|
||||
isPlanEnabled2.value = false
|
||||
}
|
||||
@@ -455,17 +342,22 @@ const toggleSelection = (button: any) => {
|
||||
arr.push(item.id)
|
||||
}
|
||||
});
|
||||
console.log(arr)
|
||||
emit('changeArea', arr)
|
||||
}
|
||||
// 用于展示控制模式
|
||||
if (button.selected) {
|
||||
// 发生了选中事件
|
||||
showControlMode.value = true
|
||||
thisButtonType.value = button.type
|
||||
thisButton.value = button
|
||||
if (button.type == 3) {
|
||||
showControlScene.value = true
|
||||
} else {
|
||||
showControlScene.value = false
|
||||
}
|
||||
} else {
|
||||
// 未发生选中 或 多选被取消
|
||||
showControlMode.value = false
|
||||
thisButton.value = null
|
||||
thisButton.value = { type: '0' }
|
||||
}
|
||||
|
||||
};
|
||||
@@ -479,16 +371,12 @@ const buttons2 = ref([]);
|
||||
// 控制模式 =======================================================================
|
||||
// 控制模式 - 决定该区域是否显示
|
||||
const showControlMode = ref(false);
|
||||
const thisButtonType = ref(null)
|
||||
const thisButton = ref(null)
|
||||
// 控制模式 - 当前选择按钮
|
||||
const selectedButton3 = ref('');
|
||||
const thisButton = ref({ type: '0' })
|
||||
// 控制模式 - 按钮切换
|
||||
const selectButton3 = (button3) => {
|
||||
thisButton.value.type = button3.type
|
||||
thisButtonType.value = button3.type
|
||||
showControlScene.value = button3.name === '手动';
|
||||
selectedButton4.value = ''; // 清空选中的控制场景按钮
|
||||
selectedButton4.value = null; // 清空选中的控制场景按钮
|
||||
};
|
||||
|
||||
// 控制场景 =======================================================================
|
||||
@@ -502,7 +390,7 @@ const controlSceneButtons = ref([
|
||||
{ label: '客流高峰', selected: false },
|
||||
]);
|
||||
// 控制场景 - 当前选择按钮
|
||||
const selectedButton4 = ref('');
|
||||
const selectedButton4 = ref(null);
|
||||
// 控制场景 - 按钮切换
|
||||
const selectButton4 = (button4) => {
|
||||
selectedButton4.value = button4.label;
|
||||
@@ -510,33 +398,112 @@ const selectButton4 = (button4) => {
|
||||
|
||||
// 灯具参数 ========================================================================
|
||||
// 灯具参数 - 表格数据
|
||||
const lightSource = ref([{ num: '8/10', light: '100', tempruter: '4200' }]);
|
||||
const lightSource = ref([{ num: '8/10', light: '100', temperature: '4200' }]);
|
||||
|
||||
let trIndex = ref('-1');
|
||||
const handleRowClick = (index: any) => {
|
||||
trindex.value = index;
|
||||
if (index === trindex.value) {
|
||||
console.log('tri');
|
||||
}
|
||||
// 显示模态框
|
||||
logModalVisible.value = true;
|
||||
};
|
||||
trIndex.value = index;
|
||||
if (index === trIndex.value) {
|
||||
console.log('tri');
|
||||
}
|
||||
};
|
||||
|
||||
// 底部表格 ========================================================================
|
||||
// 内侧弹窗 ========================================================================
|
||||
const cxList = ref([
|
||||
{
|
||||
id: '1',
|
||||
name: '站厅照明 1区',
|
||||
manual: '手动',
|
||||
automatic: '自动',
|
||||
brightness: '100lux',
|
||||
brightness2: '30lux',
|
||||
manual2: '手动',
|
||||
automatic2: '自动',
|
||||
brightness3: '4000k',
|
||||
brightness4: '3800k',
|
||||
},
|
||||
{
|
||||
id: '2',
|
||||
name: '站厅照明 2区',
|
||||
manual: '手动',
|
||||
automatic: '自动',
|
||||
brightness: '100lux',
|
||||
brightness2: '30lux',
|
||||
manual2: '手动',
|
||||
automatic2: '自动',
|
||||
brightness3: '4000k',
|
||||
brightness4: '3800k',
|
||||
},
|
||||
{
|
||||
id: '3',
|
||||
name: '站厅照明 3区',
|
||||
manual: '手动',
|
||||
automatic: '自动',
|
||||
brightness: '100lux',
|
||||
brightness2: '30lux',
|
||||
manual2: '手动',
|
||||
automatic2: '自动',
|
||||
brightness3: '4000k',
|
||||
brightness4: '3800k',
|
||||
},
|
||||
]);
|
||||
// const cxList = cxList.value.concat(cxList.value)
|
||||
//撤销
|
||||
const delBtn = (id: any) => {
|
||||
console.log(id);
|
||||
cxList.value.pop(id);
|
||||
console.log(cxList.value.length);
|
||||
|
||||
const refresh = () => {
|
||||
selectedButton.value = {};
|
||||
if (cxList.value.length === 0) {
|
||||
executeVisible.value = false;
|
||||
}
|
||||
};
|
||||
// 其他业务 ========================================================================
|
||||
|
||||
// 用于初始化5级联动的菜单
|
||||
const initMenu = (tier: number) => {
|
||||
// 1 = 照明区域 - 切换时,重置以下所有菜单
|
||||
if (tier == 1) {
|
||||
// 切换前,清除照明回路的选中状态
|
||||
buttons2.value.forEach(item => {
|
||||
item.selected = false
|
||||
})
|
||||
// 切换后,清空所有选中状态
|
||||
props.treeData.forEach(item => {
|
||||
item.selected = false
|
||||
})
|
||||
// 控制模式 隐藏
|
||||
showControlMode.value = false;
|
||||
// 控制场景 隐藏
|
||||
showControlScene.value = false;
|
||||
selectedButton3.value = null;
|
||||
// 灯具参数 隐藏
|
||||
selectedButton4.value = null;
|
||||
} else if (tier == 2) {
|
||||
// 控制场景 隐藏
|
||||
showControlScene.value = false;
|
||||
// 灯具参数 隐藏
|
||||
selectedButton4.value = null;
|
||||
}
|
||||
}
|
||||
// 刷新
|
||||
const refresh = () => {
|
||||
executeVisible.value = false
|
||||
selectedButton.value = '1';
|
||||
emit('changeArea', []);
|
||||
emit('changeArea', [1]);
|
||||
showControlMode.value = false;
|
||||
showControlScene.value = false;
|
||||
selectedButton4.value = null;
|
||||
};
|
||||
// 执行确认
|
||||
const executevisible = ref<boolean>(false);
|
||||
const showModal = () => {
|
||||
executevisible.value = true;
|
||||
};
|
||||
const executeVisible = ref<boolean>(false);
|
||||
const showModal = () => {
|
||||
executeVisible.value = true;
|
||||
};
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
@import "./dialogStyle.less";
|
||||
|
||||
// 抽屉
|
||||
.drawer-item {
|
||||
|
||||
@@ -614,7 +581,7 @@ const executevisible = ref<boolean>(false);
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.openplan.enabled2 {
|
||||
.openPlan.enabled2 {
|
||||
border: none;
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
@@ -627,7 +594,7 @@ const executevisible = ref<boolean>(false);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.openplan.disabled2 {
|
||||
.openPlan.disabled2 {
|
||||
border: none;
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
@@ -639,7 +606,7 @@ const executevisible = ref<boolean>(false);
|
||||
background-color: red;
|
||||
}
|
||||
|
||||
.openplan:disabled {
|
||||
.openPlan:disabled {
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
@@ -714,7 +681,7 @@ const executevisible = ref<boolean>(false);
|
||||
}
|
||||
|
||||
.area,
|
||||
.btnarea,
|
||||
.btnArea,
|
||||
.control-mode-btn-area,
|
||||
.control-scene-btn-area {
|
||||
margin-left: -17px;
|
||||
@@ -828,7 +795,6 @@ const executevisible = ref<boolean>(false);
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.execute {
|
||||
@@ -836,6 +802,7 @@ const executevisible = ref<boolean>(false);
|
||||
width: 74px;
|
||||
height: 40px;
|
||||
opacity: 1;
|
||||
cursor: pointer;
|
||||
border-radius: 4px;
|
||||
background: rgba(67, 136, 251, 1);
|
||||
font-size: 14px;
|
||||
@@ -848,6 +815,7 @@ const executevisible = ref<boolean>(false);
|
||||
.flushed {
|
||||
width: 74px;
|
||||
height: 40px;
|
||||
cursor: pointer;
|
||||
opacity: 1;
|
||||
border-radius: 4px;
|
||||
font-size: 14px;
|
||||
@@ -857,50 +825,6 @@ const executevisible = ref<boolean>(false);
|
||||
border: 1px solid rgba(193, 197, 204, 1);
|
||||
}
|
||||
|
||||
.tabreboot,
|
||||
.tabdelete {
|
||||
border: none;
|
||||
background-color: rgba(0, 0, 0, 0);
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
letter-spacing: 0;
|
||||
line-height: 20px;
|
||||
color: rgba(67, 136, 251, 1);
|
||||
}
|
||||
|
||||
.tabreboot {
|
||||
margin-right: 8px;
|
||||
}
|
||||
|
||||
.add {
|
||||
width: 74px;
|
||||
height: 40px;
|
||||
opacity: 1;
|
||||
border-radius: 4px;
|
||||
background: rgba(67, 136, 251, 1);
|
||||
border: rgba(67, 136, 251, 1);
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.divadd {
|
||||
width: 100%;
|
||||
height: 64px;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
margin-bottom: 10px;
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
||||
.atable {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
:deep(.ant-table-pagination) {
|
||||
visibility: hidden;
|
||||
}
|
||||
@@ -1006,9 +930,12 @@ const executevisible = ref<boolean>(false);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.zmhlbtn {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
// 禁用图标
|
||||
.anticon-stop {
|
||||
position: absolute;
|
||||
right: 3px;
|
||||
|
||||
@@ -0,0 +1,216 @@
|
||||
<template>
|
||||
<div class="div-add">
|
||||
<button class="add" @click="addModal">添加</button>
|
||||
</div>
|
||||
<table class="custom-table table1">
|
||||
<thead>
|
||||
<tr :style="{ background: 'rgba(35,45,69)' }">
|
||||
<th>序号</th>
|
||||
<th>执行时间</th>
|
||||
<th>计划名称</th>
|
||||
<th>状态</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="(row, index) in dataSource" :key="index">
|
||||
<td>{{ row.key }}</td>
|
||||
<td>{{ row.data }}</td>
|
||||
<td>{{ row.planName }}</td>
|
||||
<td v-if="row.status === '待执行'">
|
||||
<button
|
||||
style="
|
||||
font-size: 12px;
|
||||
background: rgba(57, 215, 187, 0.1);
|
||||
color: rgb(57, 215, 187);
|
||||
border: 1px solid rgb(57, 215, 187);
|
||||
">
|
||||
{{ row.status }}
|
||||
</button>
|
||||
</td>
|
||||
<td v-if="row.status !== '待执行'">
|
||||
<button
|
||||
style="
|
||||
font-size: 12px;
|
||||
background: rgba(243, 97, 99, 0.1);
|
||||
border: 1px solid rgba(243, 97, 99);
|
||||
color: rgba(243, 97, 99);
|
||||
">
|
||||
{{ row.status }}
|
||||
</button>
|
||||
</td>
|
||||
<td>
|
||||
<button class="tabReboot" @click="handleRefClick1">重启</button>
|
||||
<button class="tabDelete">删除</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="out-dialog" v-if="addVisible">
|
||||
<div class="content" v-if="addVisible">
|
||||
<div class="div-operation"></div>
|
||||
<span class="text-operation">计划库</span>
|
||||
</div>
|
||||
<div style="margin-top: 20px">
|
||||
<a-transfer
|
||||
v-model:target-keys="targetKeys"
|
||||
:data-source="mockData"
|
||||
show-search
|
||||
:filter-option="filterOption"
|
||||
:render="(item) => item.title"
|
||||
@change="handleChange"
|
||||
:style="{ color: 'rgba(255,255,255,1)' }"
|
||||
@search="handleSearch"
|
||||
:listStyle="{ border: '2px solid rgba(25,74,125,1)', height: 'calc(100vh - 200px)' }" />
|
||||
</div>
|
||||
<div style="width: 100%; height: 60px;"></div>
|
||||
<div class="button-box">
|
||||
<button class="cancel" @click="addVisible = false">取消</button>
|
||||
<button class="execute">确定</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted } from 'vue';
|
||||
|
||||
// 初始化
|
||||
onMounted(() => {
|
||||
|
||||
})
|
||||
|
||||
// 表格数据
|
||||
const dataSource = ref([
|
||||
{
|
||||
key: '1',
|
||||
data: '2024-05-01',
|
||||
planName: '劳动节',
|
||||
status: '暂停中',
|
||||
},
|
||||
{
|
||||
key: '2',
|
||||
data: '2024-05-01',
|
||||
planName: '国庆节',
|
||||
status: '待执行',
|
||||
},
|
||||
{
|
||||
key: '3',
|
||||
data: '2024-05-01',
|
||||
planName: '元旦',
|
||||
status: '待执行',
|
||||
},
|
||||
]);
|
||||
const addVisible = ref<boolean>(false);
|
||||
// 操作日志
|
||||
const handleRefClick1 = () => {
|
||||
alert(111)
|
||||
};
|
||||
const addModal = () => {
|
||||
addVisible.value = true;
|
||||
};
|
||||
const handleChange = (keys: string[], direction: string, moveKeys: string[]) => {
|
||||
console.log(keys, direction, moveKeys);
|
||||
};
|
||||
const handleSearch = (dir: string, value: string) => {
|
||||
console.log('search:', dir, value);
|
||||
};
|
||||
|
||||
// 穿梭框 相关业务
|
||||
interface MockData {
|
||||
key: string;
|
||||
title: string;
|
||||
description: string;
|
||||
chosen: boolean;
|
||||
}
|
||||
const mockData = ref([
|
||||
{
|
||||
key: '1',
|
||||
title: '计划再开',
|
||||
},
|
||||
{
|
||||
key: '2',
|
||||
title: '检修模式',
|
||||
},
|
||||
{
|
||||
key: '3',
|
||||
title: '设备变更',
|
||||
},
|
||||
]);
|
||||
const targetKeys = ref<string[]>([]);
|
||||
const filterOption = (inputValue: string, option: MockData) => {
|
||||
console.log(option.description);
|
||||
|
||||
return option.description.indexOf(inputValue) > -1;
|
||||
};
|
||||
|
||||
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
@import "./dialogStyle.less";
|
||||
|
||||
// 右下角添加按钮
|
||||
.div-add {
|
||||
height: 64px;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
margin-right: 20px;
|
||||
.add {
|
||||
width: 74px;
|
||||
height: 40px;
|
||||
opacity: 1;
|
||||
border-radius: 4px;
|
||||
background: rgba(67, 136, 251, 1);
|
||||
border: rgba(67, 136, 251, 1);
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
color: rgba(255, 255, 255, 1);
|
||||
}
|
||||
}
|
||||
// 表格
|
||||
.custom-table {
|
||||
border-collapse: collapse;
|
||||
width: 416px;
|
||||
height: 60px;
|
||||
color: rgba(255, 255, 255, 1);
|
||||
}
|
||||
.custom-table th,
|
||||
.custom-table td {
|
||||
border: 1px solid rgba(163, 192, 243, 1);
|
||||
text-align: left;
|
||||
padding: 8px;
|
||||
text-align: center;
|
||||
}
|
||||
.table1 {
|
||||
margin-top: 20px;
|
||||
width: 100%;
|
||||
border: 1px solid rgba(255, 255, 255);
|
||||
border-radius: 5px;
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
// 表格中的操作按钮
|
||||
.tabReboot,
|
||||
.tabDelete {
|
||||
border: none;
|
||||
background-color: rgba(0, 0, 0, 0);
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
letter-spacing: 0;
|
||||
line-height: 20px;
|
||||
color: rgba(67, 136, 251, 1);
|
||||
}
|
||||
.tabReboot {
|
||||
margin-right: 8px;
|
||||
}
|
||||
}
|
||||
::v-deep(.ant-transfer) {
|
||||
// 屏蔽自带的hover效果
|
||||
.ant-transfer-list-content-item:hover {
|
||||
background: black;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
@@ -0,0 +1,255 @@
|
||||
<template>
|
||||
<table class="custom-table table1">
|
||||
<thead>
|
||||
<tr :style="{ background: 'rgba(35,45,69)' }">
|
||||
<th>序号</th>
|
||||
<th>执行时间</th>
|
||||
<th>操作内容</th>
|
||||
<th>操作人</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="(row, index) in dataSource1" :key="index" @click="handleRowClick(row.key)"
|
||||
:class="row.key === trIndex ? 'isTrIndex' : ''">
|
||||
<td>{{ row.key }}</td>
|
||||
<td>{{ row.data }}</td>
|
||||
<td>{{ row.planName }}</td>
|
||||
<td>{{ row.status }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="out-dialog" v-if="logModalVisible">
|
||||
<div class="content" v-if="logModalVisible">
|
||||
<div>
|
||||
<div class="div-operation"></div>
|
||||
<span class="text-operation">变更内容 </span>
|
||||
</div>
|
||||
<div class="jbox" v-for="item in cxList" :key="item.id">
|
||||
<div class="journal" style="margin-top: 20px">
|
||||
<div class="imgText">
|
||||
<div class="zjzm">
|
||||
<img class="title-img" src="/asset/image//bulbLogo/21961.png" alt="" />
|
||||
<span class="title-text" style="font-size: 20px; font-weight: 500; color: rgba(255, 255, 255, 1)">{{
|
||||
item.name }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-box">
|
||||
<div class="btn-item">
|
||||
<div class="left">控制模式</div>
|
||||
<div class="right">
|
||||
<span>手动</span>
|
||||
<img src="/asset/image/bulbLogo/22406.png" alt="" />
|
||||
<span>自动</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-item">
|
||||
<div class="left">
|
||||
亮度
|
||||
</div>
|
||||
<div class="right">
|
||||
<span>100lux</span>
|
||||
<img src="/asset/image/bulbLogo/22406.png" alt="" />
|
||||
<span>30lux</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-item">
|
||||
<div class="left">
|
||||
控制场景
|
||||
</div>
|
||||
<div class="right">
|
||||
<span>手动</span>
|
||||
<img src="/asset/image/bulbLogo/22406.png" alt="" />
|
||||
<span>自动</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-item">
|
||||
<div class="left">
|
||||
色温
|
||||
</div>
|
||||
<div class="right">
|
||||
<span>4000k</span>
|
||||
<img src="/asset/image/bulbLogo/22406.png" alt="" />
|
||||
<span>3800k</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="height: 60px;"></div>
|
||||
<div class="button-box">
|
||||
<button class="cancel" @click="logModalVisible = false">取消</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="div-add">
|
||||
<button class="add">刷新</button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted } from 'vue';
|
||||
|
||||
// 初始化
|
||||
onMounted(() => {
|
||||
|
||||
})
|
||||
|
||||
// 与父组件的交互 ===================================================================
|
||||
const props = defineProps({
|
||||
// 分区结构(照明区域 > 照明回路)
|
||||
treeData: {
|
||||
type: Array
|
||||
},
|
||||
});
|
||||
const emit = defineEmits(['changeArea']);
|
||||
|
||||
// 表格数据
|
||||
const dataSource1 = ref([
|
||||
{
|
||||
key: '1',
|
||||
data: '2024-05-01',
|
||||
planName: '计划再开',
|
||||
status: '张三111',
|
||||
},
|
||||
{
|
||||
key: '2',
|
||||
data: '2024-05-01',
|
||||
planName: '检修模式',
|
||||
status: '李四12',
|
||||
},
|
||||
{
|
||||
key: '3',
|
||||
data: '2024-05-01',
|
||||
planName: '设备变更',
|
||||
status: '王五33',
|
||||
},
|
||||
]);
|
||||
const cxList = ref([
|
||||
{
|
||||
id: '1',
|
||||
name: '站厅照明 1区',
|
||||
manual: '手动',
|
||||
automatic: '自动',
|
||||
brightness: '100lux',
|
||||
brightness2: '30lux',
|
||||
manual2: '手动',
|
||||
automatic2: '自动',
|
||||
brightness3: '4000k',
|
||||
brightness4: '3800k',
|
||||
},
|
||||
{
|
||||
id: '2',
|
||||
name: '站厅照明 2区',
|
||||
manual: '手动',
|
||||
automatic: '自动',
|
||||
brightness: '100lux',
|
||||
brightness2: '30lux',
|
||||
manual2: '手动',
|
||||
automatic2: '自动',
|
||||
brightness3: '4000k',
|
||||
brightness4: '3800k',
|
||||
},
|
||||
{
|
||||
id: '3',
|
||||
name: '站厅照明 3区',
|
||||
manual: '手动',
|
||||
automatic: '自动',
|
||||
brightness: '100lux',
|
||||
brightness2: '30lux',
|
||||
manual2: '手动',
|
||||
automatic2: '自动',
|
||||
brightness3: '4000k',
|
||||
brightness4: '3800k',
|
||||
},
|
||||
]);
|
||||
let trIndex = ref('-1');
|
||||
const logModalVisible = ref(false);
|
||||
const handleRowClick = (index: any) => {
|
||||
trIndex.value = index;
|
||||
if (index === trIndex.value) {
|
||||
console.log('tri');
|
||||
}
|
||||
// 显示模态框
|
||||
logModalVisible.value = true;
|
||||
};
|
||||
|
||||
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
@import "./dialogStyle.less";
|
||||
|
||||
// 右下角添加按钮
|
||||
.div-add {
|
||||
|
||||
height: 64px;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
margin-right: 20px;
|
||||
.add {
|
||||
width: 74px;
|
||||
height: 40px;
|
||||
opacity: 1;
|
||||
border-radius: 4px;
|
||||
background: rgba(67, 136, 251, 1);
|
||||
border: rgba(67, 136, 251, 1);
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
color: rgba(255, 255, 255, 1);
|
||||
}
|
||||
}
|
||||
|
||||
// 表格
|
||||
.custom-table {
|
||||
border-collapse: collapse;
|
||||
width: 416px;
|
||||
height: 60px;
|
||||
color: rgba(255, 255, 255, 1);
|
||||
}
|
||||
|
||||
.custom-table th,
|
||||
.custom-table td {
|
||||
border: 1px solid rgba(163, 192, 243, 1);
|
||||
text-align: left;
|
||||
padding: 8px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.table1 {
|
||||
margin-top: 20px;
|
||||
width: 100%;
|
||||
border: 1px solid rgba(255, 255, 255);
|
||||
border-radius: 5px;
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
|
||||
.tabReboot,
|
||||
.tabDelete {
|
||||
border: none;
|
||||
background-color: rgba(0, 0, 0, 0);
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
letter-spacing: 0;
|
||||
line-height: 20px;
|
||||
color: rgba(67, 136, 251, 1);
|
||||
}
|
||||
|
||||
.tabReboot {
|
||||
margin-right: 8px;
|
||||
}
|
||||
|
||||
.isTrIndex {
|
||||
background: rgba(67, 136, 251, 1);
|
||||
}
|
||||
}
|
||||
|
||||
::v-deep(.ant-transfer) {
|
||||
|
||||
// 屏蔽自带的hover效果
|
||||
.ant-transfer-list-content-item:hover {
|
||||
background: black;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user