feat:代码格式化配置

master
guoyixuan 2 months ago
parent 99dbc02ee6
commit 9b1e2c8995

@ -0,0 +1,22 @@
{
"workbench.colorCustomizations": {
"activityBar.activeBackground": "#1f6fd0",
"activityBar.background": "#1f6fd0",
"activityBar.foreground": "#e7e7e7",
"activityBar.inactiveForeground": "#e7e7e799",
"activityBarBadge.background": "#ee90bb",
"activityBarBadge.foreground": "#15202b",
"commandCenter.border": "#e7e7e799",
"sash.hoverBorder": "#1f6fd0",
"statusBar.background": "#1857a4",
"statusBar.foreground": "#e7e7e7",
"statusBarItem.hoverBackground": "#1f6fd0",
"statusBarItem.remoteBackground": "#1857a4",
"statusBarItem.remoteForeground": "#e7e7e7",
"titleBar.activeBackground": "#1857a4",
"titleBar.activeForeground": "#e7e7e7",
"titleBar.inactiveBackground": "#1857a499",
"titleBar.inactiveForeground": "#e7e7e799"
},
"peacock.color": "#1857a4"
}

@ -1,10 +1,10 @@
#app{ #app {
box-sizing: border-box; box-sizing: border-box;
padding: 12px; padding: 12px;
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
.content{ .content {
background: #fff; background: #fff;
width: 100%; width: 100%;
height: 100%; height: 100%;
@ -13,66 +13,66 @@
border-radius: 4px; border-radius: 4px;
position: relative; position: relative;
} }
.context-menu{ .context-menu {
position: absolute; position: absolute;
z-index: 9; z-index: 9;
background: #fff; background: #fff;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
padding: 4px 6px; padding: 4px 6px;
border-radius: 2px; border-radius: 2px;
box-shadow: 0 2px 8px rgba(0, 0, 0, .15); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
} }
.context-menu >div{ .context-menu > div {
cursor: pointer; cursor: pointer;
font-size: 14px; font-size: 14px;
line-height: 22px; line-height: 22px;
} }
.context-menu >div:hover{ .context-menu > div:hover {
background-color: #f5f5f5; background-color: #f5f5f5;
} }
.tree-content{ .tree-content {
padding: 12px 0; padding: 12px 0;
width: 20%; width: 20%;
border-right: 1px solid #e8e8e8; border-right: 1px solid #e8e8e8;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
} }
.input-box{ .input-box {
padding: 0 8px; padding: 0 8px;
} }
.tree-box{ .tree-box {
flex: 1; flex: 1;
min-height: 0; min-height: 0;
overflow-y: auto; overflow-y: auto;
} }
.ant-tree-child-tree li .ant-tree-switcher{ .ant-tree-child-tree li .ant-tree-switcher {
visibility: hidden; visibility: hidden;
} }
.bottom-btns{ .bottom-btns {
padding: 8px 8px 0 8px; padding: 8px 8px 0 8px;
display: flex; display: flex;
justify-content: center; justify-content: center;
} }
.right-content{ .right-content {
flex: 1; flex: 1;
min-width: 0; min-width: 0;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
} }
.panel-views{ .panel-views {
flex: 1; flex: 1;
min-height: 0; min-height: 0;
} }
.sub-content{ .sub-content {
height: 100%; height: 100%;
width: 100%; width: 100%;
} }
.history-trend{ .history-trend {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
} }
.top-selector{ .top-selector {
border-bottom: 1px solid #e8e8e8; border-bottom: 1px solid #e8e8e8;
padding: 0 24px 12px 0; padding: 0 24px 12px 0;
text-align: right; text-align: right;
@ -80,121 +80,122 @@ box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
.top-selector .custom-date-picker { .top-selector .custom-date-picker {
width: 360px !important; width: 360px !important;
} }
.trend-graph-container{ .trend-graph-container {
flex: 1; flex: 1;
min-height: 0; min-height: 0;
overflow-y: auto; overflow-y: auto;
overflow-x: hidden; overflow-x: hidden;
} }
.trend-graph-container .trend-item{ .trend-graph-container .trend-item {
border-bottom: 1px dashed #e8e8e8; border-bottom: 1px dashed #e8e8e8;
height: 240px; height: 240px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
} }
.trend-graph-container .trend-item .title{ .trend-graph-container .trend-item .title {
padding: 12px 0 0 12px; padding: 12px 0 0 12px;
font-size: 14px; font-size: 14px;
font-weight: 700; font-weight: 700;
} }
.trend-graph-container .trend-item .line-graph{ .trend-graph-container .trend-item .line-graph {
flex: 1; flex: 1;
min-height: 0; min-height: 0;
} }
.alarm-config .grid-content{ .alarm-config .grid-content {
padding: 0 24px; padding: 0 24px;
} }
.alarm-config .search-bar{ .alarm-config .search-bar {
padding: 0 24px 0 24px; padding: 0 24px 0 24px;
display: flex; display: flex;
align-items: center; align-items: center;
flex-wrap: wrap; flex-wrap: wrap;
} }
.alarm-config .search-bar .search-item{ .alarm-config .search-bar .search-item {
margin-right: 24px; margin-right: 24px;
margin-bottom: 12px; margin-bottom: 12px;
} }
.alarm-config .search-bar .break{ .alarm-config .search-bar .break {
flex-basis: 100%; flex-basis: 100%;
height: 0; /* 避免影响垂直间距 */ height: 0; /* 避免影响垂直间距 */
} }
.config-page{ .config-page {
padding: 0 24px; padding: 0 24px;
} }
.config-page .station-config{ .config-page .station-config {
padding-bottom: 12px; padding-bottom: 12px;
border-bottom: 1px dashed #e8e8e8; border-bottom: 1px dashed #e8e8e8;
} }
.config-page .station-config .title,.config-page .path-config .title{ .config-page .station-config .title,
.config-page .path-config .title {
font-size: 14px; font-size: 14px;
font-weight: 700; font-weight: 700;
} }
.path-config{ .path-config {
margin-top: 12px; margin-top: 12px;
} }
.config-page .path-config .path-item{ .config-page .path-config .path-item {
margin-top: 12px; margin-top: 12px;
} }
.config-page .path-config .path-item .name{ .config-page .path-config .path-item .name {
font-size: 14px; font-size: 14px;
} }
.config-page .path-config .path-item .row{ .config-page .path-config .path-item .row {
margin: 4px 0; margin: 4px 0;
} }
.config-page .station-config .station{ .config-page .station-config .station {
margin-top: 12px; margin-top: 12px;
} }
.config-page .delete-bar{ .config-page .delete-bar {
margin-top: 12px; margin-top: 12px;
} }
.config-page .delete-bar .delete-time{ .config-page .delete-bar .delete-time {
margin-right: 12px; margin-right: 12px;
} }
.config-page .delete-bar .label{ .config-page .delete-bar .label {
margin-right: 8px; margin-right: 8px;
} }
.is-root > .el-tree-node__content { .is-root > .el-tree-node__content {
background-color: transparent!important; background-color: transparent !important;
color: inherit!important; color: inherit !important;
} }
.total-prpd, .total-prpd,
.prpd-and-prps{ .prpd-and-prps {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
} }
.total-prpd .trend-box, .total-prpd .trend-box,
.prpd-and-prps .trend-box{ .prpd-and-prps .trend-box {
height: 180px; height: 180px;
border-bottom: 1px solid #e8e8e8; border-bottom: 1px solid #e8e8e8;
} }
.total-prpd .prpd-box, .total-prpd .prpd-box,
.prpd-and-prps .prpd-and-prps-box{ .prpd-and-prps .prpd-and-prps-box {
flex: 1; flex: 1;
min-height: 0; min-height: 0;
display: grid; display: grid;
grid-template-columns: repeat(3, 1fr); grid-template-columns: repeat(3, 1fr);
grid-template-rows: repeat(2, 1fr); grid-template-rows: repeat(2, 1fr);
} }
.total-prpd .prpd-box .total-prpd-item, .total-prpd .prpd-box .total-prpd-item,
.prpd-and-prps .prpd-and-prps-box .prpd-and-prps-item{ .prpd-and-prps .prpd-and-prps-box .prpd-and-prps-item {
border: 1px solid #e8e8e8; border: 1px solid #e8e8e8;
} }
.prps-and-prpd-container{ .prps-and-prpd-container {
height: 100%; height: 100%;
width: 100%; width: 100%;
position: relative; position: relative;
} }
.prps-and-prpd-container .switcher{ .prps-and-prpd-container .switcher {
position: absolute; position: absolute;
bottom: 0; bottom: 0;
} }
.prps-and-prpd-container .switcher >span{ .prps-and-prpd-container .switcher > span {
cursor: pointer; cursor: pointer;
font-size: 12px; font-size: 12px;
margin-left: 8px; margin-left: 8px;
} }
.prps-and-prpd-container .switcher .active-span{ .prps-and-prpd-container .switcher .active-span {
color: #1890ff; color: #1890ff;
} }

@ -69,8 +69,7 @@
<div class="top-selector"> <div class="top-selector">
<el-date-picker v-model="dateRange" style="width: 360px" class="custom-date-picker" <el-date-picker v-model="dateRange" style="width: 360px" class="custom-date-picker"
value-format="YYYY-MM-DD HH:mm:ss" type="datetimerange" range-separator="至" value-format="YYYY-MM-DD HH:mm:ss" type="datetimerange" range-separator="至"
start-placeholder="开始日期" end-placeholder="结束日期" :disabled-date="disabledDate" start-placeholder="开始日期" end-placeholder="结束日期" />
@panel-change="handlePanelChange" />
</div> </div>
<div class="trend-graph-container"> <div class="trend-graph-container">
<div class="trend-item" v-for="item in trendGraphData" :key="item.id"> <div class="trend-item" v-for="item in trendGraphData" :key="item.id">
@ -81,6 +80,7 @@
</div> </div>
</div> </div>
</div> </div>
<div v-if="activeKey === 'alarmConfig'" key="alarmConfig" class="sub-content alarm-config"> <div v-if="activeKey === 'alarmConfig'" key="alarmConfig" class="sub-content alarm-config">
<!-- 告警配置 --> <!-- 告警配置 -->
<div class="search-bar"> <div class="search-bar">
@ -264,7 +264,7 @@
</a-modal> </a-modal>
</div> </div>
<script> <script>
axios.defaults.baseURL = 'http://192.168.1.80:9501'; // 临时服务地址 axios.defaults.baseURL = 'http://192.168.1.198:9501'; // 临时服务地址
axios.defaults.timeout = 10000; axios.defaults.timeout = 10000;
const findParentByKey = (tree, targetKey) => { const findParentByKey = (tree, targetKey) => {
for (const parent of tree) { for (const parent of tree) {
@ -867,7 +867,7 @@
}; };
const searchValue = ref(''); const searchValue = ref('');
const treeRef = ref() const treeRef = ref()
const activeKey = ref('prpdAndPrps') const activeKey = ref('historyTrend')
const tabsArr = [ const tabsArr = [
{ key: 'historyTrend', tab: '历史趋势' }, { key: 'historyTrend', tab: '历史趋势' },
{ key: 'alarmConfig', tab: '告警管理' }, { key: 'alarmConfig', tab: '告警管理' },
@ -1107,37 +1107,12 @@
}; };
const childRefs = ref({}); const childRefs = ref({});
const dateRange = ref([]); const dateRange = ref([]);
const currentYear = ref(new Date().getFullYear());
const allowedMonths = ref([]); // 允许选择的月份(如[1,5]表示1月和5月
// 禁用日期规则(核心逻辑)
const disabledDate = (time) => {
const date = new Date(time);
const year = date.getFullYear();
const month = date.getMonth() + 1;
// 规则1只允许选择当前年份
if (year !== currentYear.value) return true;
// 规则2只允许选择API返回的月份
if (!allowedMonths.value.includes(month)) return true;
// 规则3限制选择范围为1个月内当已选开始日期时
if (dateRange.value?.[0]) {
const startDate = new Date(dateRange.value[0]);
const minDate = new Date(startDate);
const maxDate = new Date(startDate);
minDate.setMonth(minDate.getMonth() - 1);
maxDate.setMonth(maxDate.getMonth() + 1);
return date < minDate || date > maxDate;
}
return false;
};
const handlePanelChange = (date) => {
currentYear.value = date?.[0]?.getFullYear() || 2025
};
const fetchHistoryTrendData = async (id, time) => { const fetchHistoryTrendData = async (id, time) => {
try { try {
const params = { const params = {
current: 1, current: 1,
startTimeStr: time[0], startTime: time[0],
endTimeStr: time[1], endTime: time[1],
monitorKey: id, monitorKey: id,
pageSize: 99999 pageSize: 99999
} }
@ -1147,7 +1122,7 @@
return { return {
id, id,
// label: // label:
data: result data: result || []
} }
} catch (error) { } catch (error) {
console.error(`请求 ${id} 时出错:`, error); console.error(`请求 ${id} 时出错:`, error);
@ -1156,6 +1131,7 @@
} }
// 初始化趋势echart // 初始化趋势echart
const initTrendGraph = (el, data) => { const initTrendGraph = (el, data) => {
console.log(data, 'data');
const legendData = [ const legendData = [
{ id: 'avg', name: '平均值' }, { id: 'avg', name: '平均值' },
{ id: 'maxValue', name: '最大值' }, { id: 'maxValue', name: '最大值' },
@ -1249,7 +1225,7 @@
// tab在历史趋势监听勾选节点 // tab在历史趋势监听勾选节点
watch([checkedKeys1, dateRange], async ([keys, time]) => { watch([checkedKeys1, dateRange], async ([keys, time]) => {
const [starTime, endTime] = time || []; const [starTime, endTime] = time || [];
if (unref(activeKey) !== 'historyTrend' || !keys.length || !starTime || !endTime) return; if (unref(activeKey) !== 'historyTrend' || !starTime || !endTime) return;
// 先清理之前的图表 // 先清理之前的图表
Object.values(chartGroups.value).forEach(group => { Object.values(chartGroups.value).forEach(group => {
group.instances.forEach(chart => chart.dispose()); group.instances.forEach(chart => chart.dispose());
@ -1287,17 +1263,6 @@
}); });
}); });
}); });
const checkedKeys1Str = computed(() => checkedKeys1.value.join(',')) // 选中节点的字符串 为了减少监听
// 请求可选择的月份
watch([checkedKeys1Str, currentYear], async ([keys, year]) => {
if (!keys || !year) return
dateRange.value = []
const { data: { result } } = await axios.post(`/ldpdtools/trendData/multHasData?year=${year}`, unref(checkedKeys1))
allowedMonths.value = result.map(item => Number(item))
}, {
immediate: true
})
// 告警信息 // 告警信息
const configLoading = ref(false) const configLoading = ref(false)
const columns = [ const columns = [
@ -1554,8 +1519,6 @@
trendGraphData.value = [] trendGraphData.value = []
childRefs.value = {} childRefs.value = {}
dateRange.value = [] dateRange.value = []
currentYear.value = new Date().getFullYear()
allowedMonths.value = []
} }
if (oldKey === 'alarmConfig') { if (oldKey === 'alarmConfig') {
// 销毁告警管理 // 销毁告警管理
@ -1618,9 +1581,6 @@
monitorModalForm, monitorModalForm,
onMonitorModalSubmit, onMonitorModalSubmit,
dateRange, dateRange,
handlePanelChange,
currentYear,
disabledDate,
checkTree, checkTree,
trendGraphData, trendGraphData,
trendGraphRefs, trendGraphRefs,

Loading…
Cancel
Save