diff --git a/ui/dasadmin/src/api/backend/logConfiguration/request.ts b/ui/dasadmin/src/api/backend/logConfiguration/request.ts new file mode 100644 index 00000000..37e8dcc1 --- /dev/null +++ b/ui/dasadmin/src/api/backend/logConfiguration/request.ts @@ -0,0 +1,24 @@ +import createAxios from '/@/utils/axios' + +export function getLogConfigurationListReq() { + return createAxios({ + url: '/api/logger/list', + method: 'POST', + }) +} + +export function updateLogConfigurationListReq(params: any) { + return createAxios({ + url: '/api/logger/update', + method: 'POST', + data: params, + }) +} + +export function delLogConfigurationListReq(params: any) { + return createAxios({ + url: '/api/logger/delete', + method: 'POST', + data: params, + }) +} diff --git a/ui/dasadmin/src/views/backend/equipment/airBlower/index.vue b/ui/dasadmin/src/views/backend/equipment/airBlower/index.vue index 537503be..746a13f5 100644 --- a/ui/dasadmin/src/views/backend/equipment/airBlower/index.vue +++ b/ui/dasadmin/src/views/backend/equipment/airBlower/index.vue @@ -198,18 +198,24 @@ - (linePause = false)" + > --> + 实时曲线 保存 - 继续 + @@ -796,16 +802,16 @@ const openLineChart = (row: TableDataObjType) => { clickRow.value = row realDataLineChartVisible.value = true autoUpdate.value = false - linePause.value = false + // linePause.value = false } const closeLineChart = () => { autoUpdate.value = true } -const linePause = ref(false) +// const linePause = ref(false) const saveLineChart = () => { const data = realDataChartRef.value?.saveChart() - linePause.value = true + // linePause.value = true const info = 'deviceCode:' + clickRow.value?.deviceCode + '\n' + 'deviceName:' + clickRow.value?.name + '\n' let title = 'TimeStamp;' let columns = '' @@ -824,16 +830,17 @@ const saveLineChart = () => { let uri = 'data:text/plain;charset=utf-8,' + encodeURIComponent(str) let link = document.createElement('a') link.href = uri - link.download = clickRow.value?.deviceCode + 'ChartData' + '.txt' + const titleTime = data.time[0] + '-' + data.time[data.time.length - 1] + link.download = 'deviceCode' + clickRow.value?.deviceCode + ';' + titleTime + '.txt' document.body.appendChild(link) link.click() document.body.removeChild(link) } -const continueLineChart = () => { - realDataChartRef.value?.continueChart() - linePause.value = false -} +// const continueLineChart = () => { +// realDataChartRef.value?.continueChart() +// linePause.value = false +// } onUnmounted(() => { autoUpdateInterval.value && clearInterval(autoUpdateInterval.value) diff --git a/ui/dasadmin/src/views/backend/equipment/airBlower/realDataChart.vue b/ui/dasadmin/src/views/backend/equipment/airBlower/realDataChart.vue index 2b626fd3..a7405b58 100644 --- a/ui/dasadmin/src/views/backend/equipment/airBlower/realDataChart.vue +++ b/ui/dasadmin/src/views/backend/equipment/airBlower/realDataChart.vue @@ -157,12 +157,18 @@ let realDataXAxis: any = [] let realDataSeries: any = [] let realDataYAxis: any = [] let realDataLegend: any = [] -const getRandomDarkColor = () => { - let r = Math.floor(Math.random() * 200) // 限制在0到127之间,以生成较深的颜色 - let g = Math.floor(Math.random() * 200) - let b = Math.floor(Math.random() * 200) - let color = `#${r.toString(16).padStart(2, '0')}${g.toString(16).padStart(2, '0')}${b.toString(16).padStart(2, '0')}` +const colorList = ['#ee1289', '#b8860b', '#ff00ff', '#ff0000', '#ff9912', '#8a2be2', '#000000', '#03a89e'] +const getRandomDarkColor = () => { + // if (index >= colorList.length) { + // let r = Math.floor(Math.random() * 200) // 限制在0到127之间,以生成较深的颜色 + // let g = Math.floor(Math.random() * 200) + // let b = Math.floor(Math.random() * 200) + // let color = `#${r.toString(16).padStart(2, '0')}${g.toString(16).padStart(2, '0')}${b.toString(16).padStart(2, '0')}` + // return color + // } + const color = colorList.shift() as string + colorList.push(color) return color } @@ -176,14 +182,13 @@ const createChartData = (data: { [k: string]: number }, time: string) => { const attrCode = Object.keys(data) realDataXAxis.push(time) const lastSeriesId = realDataSeries.map((item: any) => item.id) - const color = getRandomDarkColor() let clearState = null lastSeriesId.forEach((item: any) => { if (!attrCode.includes(item)) { const cur = realDataSeries.findIndex((val: any) => val.id === item) realDataSeries.splice(cur, 1) - const curLegendIndex = realDataLegend.findIndex((val:any)=>val.customKey===item) - realDataLegend.splice(curLegendIndex,1) + const curLegendIndex = realDataLegend.findIndex((val: any) => val.customKey === item) + realDataLegend.splice(curLegendIndex, 1) clearState = true } }) @@ -194,7 +199,7 @@ const createChartData = (data: { [k: string]: number }, time: string) => { legend: realDataLegend, }, { - replaceMerge: ['series','legend'], + replaceMerge: ['series', 'legend'], } ) } @@ -205,18 +210,19 @@ const createChartData = (data: { [k: string]: number }, time: string) => { cur.data.push(curVal) return cur } else { + const color = getRandomDarkColor() const info = realDataList.value.find((val) => val.prop === item) const list = realDataSeries?.[0]?.data ?? [] const len = list.length const fillData = new Array(len).fill('') fillData.push(curVal) realDataLegend.push({ - name:info.name, + name: info.name, icon: 'rect', textStyle: { color: color, }, - customKey:item + customKey: item, }) return { id: item, @@ -253,7 +259,7 @@ const createChart = () => { }) const nameMapKeys = Object.keys(nameMap) - if (realDataSeries.length >= 4 && nameMapKeys.length === 4) { + if (nameMapKeys.length === 4) { selectPointNum.value = realDataSeries.length } const yAxisData = nameMapKeys.map((item, index) => { @@ -308,7 +314,7 @@ const createChart = () => { }, yAxis: realDataYAxis, series: realDataSeries, - legend:realDataLegend + legend: realDataLegend, } } else { option = { @@ -398,14 +404,11 @@ const createChart = () => { ], legend: { data: realDataLegend, - textStyle: { - color: '#73767a', - }, }, series: realDataSeries, } } - chart.setOption(option, { replaceMerge: ['series', 'yAxis','legend'] }) + chart.setOption(option, { replaceMerge: ['series', 'yAxis', 'legend'] }) chartInstance = chart } @@ -463,31 +466,31 @@ const clearTimer = () => { realDataSeries = [] realDataXAxis = [] realDataYAxis = [] - pauseState.value = false - emits('clearChart') + // pauseState.value = false + // emits('clearChart') } -const pauseState = ref(false) +// const pauseState = ref(false) const saveChart = () => { - timer && clearInterval(timer) - pauseState.value = true + // timer && clearInterval(timer) + // pauseState.value = true return { time: realDataXAxis, chartData: realDataSeries, } } -const continueChart = () => { - pauseState.value = false - const fillVal = new Array(5).fill('') - realDataXAxis.push(...fillVal) - realDataSeries.forEach((item: any) => { - item.data.push(...fillVal) - }) - createTimer() -} +// const continueChart = () => { +// pauseState.value = false +// const fillVal = new Array(5).fill('') +// realDataXAxis.push(...fillVal) +// realDataSeries.forEach((item: any) => { +// item.data.push(...fillVal) +// }) +// createTimer() +// } defineExpose({ saveChart, - continueChart, + // continueChart, }) onMounted(() => { if (selectList.value.length > 0) { diff --git a/ui/dasadmin/src/views/backend/logConfiguration/index.vue b/ui/dasadmin/src/views/backend/logConfiguration/index.vue new file mode 100644 index 00000000..e912d57c --- /dev/null +++ b/ui/dasadmin/src/views/backend/logConfiguration/index.vue @@ -0,0 +1,212 @@ + + + + + 新增日志配置 + + + + + + + + + + + + + + + + {{ scope.row.level }} + + + + + + + 保存 + 取消 + 编辑 + + + 删除 + + + + + + + + + + + + + + + + + + + + + + + + + + 保存 + 取消 + + + + + + + + +