diff --git a/ui/dasadmin/src/api/backend/deviceModel/request.ts b/ui/dasadmin/src/api/backend/deviceModel/request.ts index 207c1993..6f1683b4 100644 --- a/ui/dasadmin/src/api/backend/deviceModel/request.ts +++ b/ui/dasadmin/src/api/backend/deviceModel/request.ts @@ -178,4 +178,11 @@ export function queryfaultCodeDict(params: object = {}) { { showErrorMessage: false }) +} + +export function getAllSubSystemReq() { + return createAxios({ + url: '/api/equipment/model/attribute/getAllSubsystem', + method: 'post' + }) } \ No newline at end of file diff --git a/ui/dasadmin/src/views/backend/auth/model/index.vue b/ui/dasadmin/src/views/backend/auth/model/index.vue index 4d9325f4..3a3bb745 100644 --- a/ui/dasadmin/src/views/backend/auth/model/index.vue +++ b/ui/dasadmin/src/views/backend/auth/model/index.vue @@ -277,6 +277,9 @@ + + + - +
- + { }) return [] } +const selectPointNum = ref(10) let realDataXAxis: any = [] let realDataSeries: any = [] +let realDataYAxis: any = [] const getRandomDarkColor = () => { let r = Math.floor(Math.random() * 200) // 限制在0到127之间,以生成较深的颜色 let g = Math.floor(Math.random() * 200) @@ -171,8 +173,9 @@ const createChartData = (data: { [k: string]: number }, time: string) => { let clearState = null lastSeriesId.forEach((item: any) => { if (!attrCode.includes(item)) { - const cur = realDataSeries.find((val: any) => val.id === item) - delete cur.id + const cur = realDataSeries.findIndex((val: any) => val.id === item) + // delete cur.id + realDataSeries.splice(cur, 1) clearState = true } }) @@ -201,7 +204,7 @@ const createChartData = (data: { [k: string]: number }, time: string) => { fillData.push(curVal) return { id: item, - name: info.name + info.unit, + name: info.name +' '+ (info?.unit ?? ''), type: 'line', barWidth: 20, itemStyle: { @@ -221,19 +224,82 @@ const createChart = () => { const chart = chartInstance ?? echarts.init(chartRef.value) let option = null if (chartInstance && realDataXAxis.length > 1) { + const nameMap: any = {} + realDataSeries.forEach((item: any) => { + const yAxisName = item.name.split(' ')[1] + if (nameMap[yAxisName] || nameMap[yAxisName]===0) { + item.yAxisIndex = nameMap[yAxisName] + } else { + const len = Object.keys(nameMap).length + item.yAxisIndex = len + nameMap[yAxisName] = len + } + }) + + const nameMapKeys = Object.keys(nameMap) + if (realDataSeries.length >= 4 && nameMapKeys.length === 4) { + selectPointNum.value = realDataSeries.length + } + const yAxisData = nameMapKeys.map((item, index) => { + const offset = Math.floor(index / 2) * 50 + const position = index % 2 == 0 ? 'left' : 'right' + const yAxisName = item + const cacheYAxis = realDataYAxis.find((item: any) => item.name === yAxisName) + if (cacheYAxis) { + return { + ...cacheYAxis, + offset, + position, + } + } else { + return { + type: 'value', + name: item, + nameTextStyle: { + color: '#4E5969', + }, + axisLine: { + show: false, + onZero: false, + lineStyle: { + color: '#dadada', + width: 0, + type: 'solid', + }, + }, + axisLabel: { + //x轴文字的配置 + show: true, + color: '#4E5969', + }, + axisTick: { show: false }, + splitLine: { + interval: 50, + lineStyle: { + type: 'dashed', + color: '#dadada', + }, + }, + offset, + position, + } + } + }) + realDataYAxis = yAxisData option = { xAxis: { data: realDataXAxis, }, + yAxis: realDataYAxis, series: realDataSeries, } } else { option = { grid: { top: 50, - right: 23, + right: 60, bottom: 50, - left: 18, + left: 60, containLabel: true, }, tooltip: { @@ -280,6 +346,7 @@ const createChart = () => { }, axisLine: { show: false, + onZero: false, lineStyle: { color: '#dadada', width: 0, @@ -321,7 +388,7 @@ const createChart = () => { series: realDataSeries, } } - chart.setOption(option, { replaceMerge: 'series' }) + chart.setOption(option, { replaceMerge: ['series', 'yAxis'] }) chartInstance = chart } @@ -338,6 +405,19 @@ const selectPointAttr = computed(() => { const addPoint = () => { selectPointVisible.value = true } +const checkShowChart = (data: any) => { + console.log(realDataSeries) + + const curCode = data.map((item: any) => item.prop) + console.log(curCode, 'curCode') + for (let i = selectList.value.length - 1; i >= 0; i--) { + if (!curCode.includes(selectList.value[i])) { + selectList.value.splice(i, 1) + realDataSeries.splice(i, 1) + changeCheck() + } + } +} const saveSelectPoint = () => { const data = selectPointRef.value?.getSelectList() if (data) { @@ -348,9 +428,10 @@ const saveSelectPoint = () => { unit: item.unit, } }) + checkShowChart(selectList) realDataList.value = selectList selectPointVisible.value = false - ElMessage.success('添加成功') + ElMessage.success('修改成功') } } let timer: any = null @@ -364,6 +445,7 @@ const clearTimer = () => { timer = null realDataSeries = [] realDataXAxis = [] + realDataYAxis = [] pauseState.value = false emits('clearChart') } diff --git a/ui/dasadmin/src/views/backend/equipment/airBlower/selectPoint.vue b/ui/dasadmin/src/views/backend/equipment/airBlower/selectPoint.vue index e60d9778..46f41cd2 100644 --- a/ui/dasadmin/src/views/backend/equipment/airBlower/selectPoint.vue +++ b/ui/dasadmin/src/views/backend/equipment/airBlower/selectPoint.vue @@ -4,12 +4,23 @@
- 可添加的测点 +
+ + 名称 + 编码 + +
+ + + + + +
-
+
已选择{{ Statistic }} import { ref, reactive, computed, watch, nextTick, onMounted } from 'vue' -import { getModelAttributeListReq } from '/@/api/backend/deviceModel/request' +import { getModelAttributeListReq, getAllSubSystemReq } from '/@/api/backend/deviceModel/request' import { ElMessage, TableInstance } from 'element-plus' import { Top, Bottom, Close } from '@element-plus/icons-vue' @@ -85,9 +96,30 @@ const props = withDefaults( } ) -const radioActiveName = ref<138 | 139 | 140 | 199>(138) -const typeChange = () => { - getTableData() +const searchType = ref('attributeName') + +const searchInfo = ref('') + +// const radioActiveName = ref<138 | 139 | 140 | 199>(138) +const search = () => { + getTableData({ pageNum: 1 }) +} + +const subSystemVal = ref('') +const subSystemList = ref() + +const getAllSubSystem = () => { + getAllSubSystemReq().then((res) => { + const data = res.data + .filter((item: any) => item) + .map((item:any) => { + return { + label: item, + value: item, + } + }) + subSystemList.value = [...data, { label: '全部', value: ' ' }] + }) } const attributeTableData = ref<{ attributeName: string; attributeCode: string }[]>([]) @@ -95,7 +127,7 @@ const selectTable = (section: any) => { const defaultCode = props.defaultAttr.map((item: any) => item.attributeCode) const addSection = section .filter((item: any) => !defaultCode.includes(item.attributeCode.toLowerCase())) - .map((item:any) => { + .map((item: any) => { return { attributeName: item.attributeName, attributeCode: item.attributeCode.toLowerCase(), @@ -108,7 +140,7 @@ const selectAllTable = (section: any) => { const defaultCode = props.defaultAttr.map((item: any) => item.attributeCode) const addSection = section .filter((item: any) => !defaultCode.includes(item.attributeCode.toLowerCase())) - .map((item:any) => { + .map((item: any) => { return { attributeName: item.attributeName, attributeCode: item.attributeCode.toLowerCase(), @@ -158,12 +190,18 @@ const moveRemove = (index: number, item: any) => { }) } -const getTableData = () => { +const getTableData = (customData = {}) => { + const inputVal: any = {} + inputVal[searchType.value] = searchInfo.value + getModelAttributeListReq({ iotModelId: '', - attributeType: radioActiveName.value, + // attributeType: radioActiveName.value, pageNum: pageSetting.current, pageSize: pageSetting.pageSize, + subSystem: (!subSystemVal.value || subSystemVal.value === ' ') ? null : subSystemVal.value, + ...inputVal, + ...customData, }) .then((res) => { if (res.code === 200) { @@ -207,6 +245,7 @@ defineExpose({ onMounted(() => { getTableData() + getAllSubSystem() }) @@ -217,13 +256,35 @@ onMounted(() => { .transferHeader { height: 40px; display: flex; - justify-content: space-between; + // justify-content: space-between; align-items: center; padding: 0 10px; color: #333333; background: #f7f9fc; border-bottom: 1px solid #e1edf6; border-radius: 6px 6px 0 0; + .searchPart { + .radio { + width: 110px; + .el-radio { + margin-right: 5px; + width: 50px; + } + } + } + .searchInput { + width: 200px; + margin: 0 20px; + } + .el-select { + width: 200px; + } + :deep(.el-input__wrapper) { + width: 200px; + } + } + .transferHeaderRight { + justify-content: space-between; } .transferLeft { width: 550px; diff --git a/ui/dasadmin/src/views/backend/node/utils.ts b/ui/dasadmin/src/views/backend/node/utils.ts index c5cc5c34..8ab22fea 100644 --- a/ui/dasadmin/src/views/backend/node/utils.ts +++ b/ui/dasadmin/src/views/backend/node/utils.ts @@ -130,8 +130,8 @@ export const excelDefaultConfig: any = { code: 'limit2Low' }, { - label:'强制归档', - code:'forceArchive', + label: '强制归档', + code: 'forceArchive', } ], R0C4: ['03', '04'], @@ -247,8 +247,8 @@ export const excelDefaultConfig: any = { code: 'col3', }, { - label:'强制归档', - code:'forceArchive', + label: '强制归档', + code: 'forceArchive', } ], R0C4: ['03', '04'], @@ -280,8 +280,8 @@ export const excelDefaultConfig: any = { code: 'col3', }, { - label:'强制归档', - code:'forceArchive', + label: '强制归档', + code: 'forceArchive', } ], R0C4: ['01', '02', '03', '04'], @@ -358,8 +358,8 @@ export const excelDefaultConfig: any = { code: 'limit2Low' }, { - label:'强制归档', - code:'forceArchive', + label: '强制归档', + code: 'forceArchive', } ], R0C4: [ @@ -374,7 +374,7 @@ export const excelDefaultConfig: any = { "8. 16位BCD数据", "9. 8位归一化值" ], // 数据类型的提示 - R0C7:[ + R0C7: [ "0. 不启用", "1. 启用" ] @@ -420,8 +420,8 @@ export const excelDefaultConfig: any = { name: '累计量', head: [ { - label:'强制归档', - code:'forceArchive', + label: '强制归档', + code: 'forceArchive', } ], }, @@ -442,8 +442,8 @@ export const excelDefaultConfig: any = { code: 'registerAddr', }, { - label:'强制归档', - code:'forceArchive', + label: '强制归档', + code: 'forceArchive', } ], R0C4: [ @@ -684,7 +684,7 @@ export const createUpLoadExcelData = (workbookData: any) => { sheetData.protocol = sheets[item].cellData[key][fieldKey].custom.protocol continue } - if (fieldKey === '1') { + if (['1','2','3'].includes(fieldKey)) { sheetData[sheetkeyMap[fieldKey]] = sheets[item].cellData[key][fieldKey]?.v ?? '' continue } @@ -692,8 +692,6 @@ export const createUpLoadExcelData = (workbookData: any) => { } sheetData.params = JSON.stringify(params) data.push(sheetData) - console.log(data); - } }) })