diff --git a/das/src/main/java/com/das/modules/equipment/controller/SysIotModelController.java b/das/src/main/java/com/das/modules/equipment/controller/SysIotModelController.java index c0b8a9f2..da45c31e 100644 --- a/das/src/main/java/com/das/modules/equipment/controller/SysIotModelController.java +++ b/das/src/main/java/com/das/modules/equipment/controller/SysIotModelController.java @@ -93,6 +93,10 @@ public class SysIotModelController { /** 获取物模型属性列表 */ @PostMapping("/attribute/list") public PageDataInfo querySysIotModelField(@RequestBody SysIotModelFieldDto sysIotModelFieldDto) { + boolean hasPermission = StpUtil.hasPermission(SysAuthorityIds.SYS_AUTHORITY_ID_VIEW_CONFIDENTIAL_DATA.toString()); + if (!hasPermission){ + sysIotModelFieldDto.setConfidential(0); + } if (sysIotModelFieldDto.getPageNum() == null && sysIotModelFieldDto.getPageSize() == null){ List sysIotModelFieldVos = sysIotModelService.queryAllModelField(sysIotModelFieldDto); return PageDataInfo.build(sysIotModelFieldVos,sysIotModelFieldVos.size()); diff --git a/das/src/main/java/com/das/modules/fdr/service/FaultRecorderService.java b/das/src/main/java/com/das/modules/fdr/service/FaultRecorderService.java index bdc89a28..00167c3e 100644 --- a/das/src/main/java/com/das/modules/fdr/service/FaultRecorderService.java +++ b/das/src/main/java/com/das/modules/fdr/service/FaultRecorderService.java @@ -19,7 +19,7 @@ public interface FaultRecorderService { void download(String path, HttpServletResponse httpServletResponse) throws IOException; - Map> getDataCurve(String url, String deviceCode) throws IOException; + Map> getDataCurve(String url, String deviceCode); void updateFdrConfig(SysEquipment sysEquipment); diff --git a/das/src/main/java/com/das/modules/fdr/service/impl/FaultRecorderServiceImpl.java b/das/src/main/java/com/das/modules/fdr/service/impl/FaultRecorderServiceImpl.java index 024b257d..6f17e958 100644 --- a/das/src/main/java/com/das/modules/fdr/service/impl/FaultRecorderServiceImpl.java +++ b/das/src/main/java/com/das/modules/fdr/service/impl/FaultRecorderServiceImpl.java @@ -168,30 +168,31 @@ public class FaultRecorderServiceImpl implements FaultRecorderService { } @Override - public Map> getDataCurve(String url, String deviceCode) throws IOException { + public Map> getDataCurve(String url, String deviceCode) { Map> resultMap = null; - try (InputStream fileStream = minioViewsServcie.getFileStream(url)) { - //根据device Code查询故障录波格式 - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("CODE", deviceCode); - SysEquipment sysEquipment = sysEquipmentMapper.selectOne(queryWrapper); - if (sysEquipment == null) { - throw new ServiceException("设备不存在,请选择正确设备"); - } + //根据device Code查询故障录波格式 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("CODE", deviceCode); + SysEquipment sysEquipment = sysEquipmentMapper.selectOne(queryWrapper); + if (sysEquipment == null) { + throw new ServiceException("设备不存在,请选择正确设备"); + } - if (StringUtils.isBlank(sysEquipment.getOptions())){ - throw new ServiceException("请添加设备文件解析配置"); - } - FileParseConfig fileParseConfig = JSON.parseObject(sysEquipment.getOptions(), FileParseConfig.class); - FdrFormatVo fdrFormatVo = fileParseConfig.getFdrFormat(); - if (fdrFormatVo == null){ - throw new ServiceException("请添加故障录波配置"); - } + if (StringUtils.isBlank(sysEquipment.getOptions())){ + throw new ServiceException("请添加设备文件解析配置"); + } + FileParseConfig fileParseConfig = JSON.parseObject(sysEquipment.getOptions(), FileParseConfig.class); + FdrFormatVo fdrFormatVo = fileParseConfig.getFdrFormat(); + if (fdrFormatVo == null){ + throw new ServiceException("请添加故障录波配置"); + } + try (InputStream fileStream = minioViewsServcie.getFileStream(url)) { // 解析文件内容 resultMap = parseFile(fileStream, fdrFormatVo.getTimeFormat(), fdrFormatVo.getDelimiter(), fdrFormatVo.getValidStartLine()); } catch (Exception e) { e.printStackTrace(); + throw new ServiceException("配置解析异常"); } return resultMap; } diff --git a/das/src/main/java/com/das/modules/plc/service/PlcLogService.java b/das/src/main/java/com/das/modules/plc/service/PlcLogService.java index 9d8485f8..6ff0344e 100644 --- a/das/src/main/java/com/das/modules/plc/service/PlcLogService.java +++ b/das/src/main/java/com/das/modules/plc/service/PlcLogService.java @@ -14,7 +14,7 @@ public interface PlcLogService { List getDirOrFileList(String fileType, String name, String startTime, String endTime); - Map> getDataCurve(String url, String deviceCode) throws IOException; + Map> getDataCurve(String url, String deviceCode); void updatePlcConfig(SysEquipment sysEquipment); diff --git a/das/src/main/java/com/das/modules/plc/service/impl/PlcLogsServiceImpl.java b/das/src/main/java/com/das/modules/plc/service/impl/PlcLogsServiceImpl.java index 728e8e40..958880d9 100644 --- a/das/src/main/java/com/das/modules/plc/service/impl/PlcLogsServiceImpl.java +++ b/das/src/main/java/com/das/modules/plc/service/impl/PlcLogsServiceImpl.java @@ -63,30 +63,31 @@ public class PlcLogsServiceImpl implements PlcLogService { } @Override - public Map> getDataCurve(String url, String deviceCode) throws IOException { + public Map> getDataCurve(String url, String deviceCode){ Map> resultMap = null; - try (InputStream fileStream = minioViewsServcie.getFileStream(url)) { - //根据device Code查询故障录波格式 - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("CODE", deviceCode); - SysEquipment sysEquipment = sysEquipmentMapper.selectOne(queryWrapper); - if (sysEquipment == null) { - throw new ServiceException("设备不存在,请选择正确设备"); - } + //根据device Code查询故障录波格式 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("CODE", deviceCode); + SysEquipment sysEquipment = sysEquipmentMapper.selectOne(queryWrapper); + if (sysEquipment == null) { + throw new ServiceException("设备不存在,请选择正确设备"); + } - if (StringUtils.isBlank(sysEquipment.getOptions())){ - throw new ServiceException("请添加设备文件解析配置"); - } - FileParseConfig fileParseConfig = JSON.parseObject(sysEquipment.getOptions(), FileParseConfig.class); - FdrFormatVo fdrFormatVo = fileParseConfig.getPlcFormat(); - if (fdrFormatVo == null){ - throw new ServiceException("请添加plclog配置"); - } + if (StringUtils.isBlank(sysEquipment.getOptions())){ + throw new ServiceException("请添加设备文件解析配置"); + } + FileParseConfig fileParseConfig = JSON.parseObject(sysEquipment.getOptions(), FileParseConfig.class); + FdrFormatVo fdrFormatVo = fileParseConfig.getPlcFormat(); + if (fdrFormatVo == null){ + throw new ServiceException("请添加plclog配置"); + } + try (InputStream fileStream = minioViewsServcie.getFileStream(url)) { // 解析文件内容 resultMap = parseFile(fileStream, fdrFormatVo.getTimeFormat(), fdrFormatVo.getDelimiter(), fdrFormatVo.getValidStartLine()); } catch (Exception e) { e.printStackTrace(); + throw new ServiceException("配置解析异常"); } return resultMap; } diff --git a/das/src/main/resources/mapper/SysIotModelFieldMapper.xml b/das/src/main/resources/mapper/SysIotModelFieldMapper.xml index c995d95d..9cc9a998 100644 --- a/das/src/main/resources/mapper/SysIotModelFieldMapper.xml +++ b/das/src/main/resources/mapper/SysIotModelFieldMapper.xml @@ -31,6 +31,9 @@ and t.subsystem = #{info.subSystem} + + and t.confidential = #{info.confidential} + order by ${info.orderColumn} ${info.orderType} 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/assets/SystemParam/style01.png b/ui/dasadmin/src/assets/SystemParam/style01.png new file mode 100644 index 00000000..dbda6a00 Binary files /dev/null and b/ui/dasadmin/src/assets/SystemParam/style01.png differ diff --git a/ui/dasadmin/src/assets/SystemParam/style02.png b/ui/dasadmin/src/assets/SystemParam/style02.png new file mode 100644 index 00000000..24dd2095 Binary files /dev/null and b/ui/dasadmin/src/assets/SystemParam/style02.png differ diff --git a/ui/dasadmin/src/assets/SystemParam/style03.png b/ui/dasadmin/src/assets/SystemParam/style03.png new file mode 100644 index 00000000..659f4ec3 Binary files /dev/null and b/ui/dasadmin/src/assets/SystemParam/style03.png differ diff --git a/ui/dasadmin/src/stores/adminInfo.ts b/ui/dasadmin/src/stores/adminInfo.ts index 73b04382..82157e63 100644 --- a/ui/dasadmin/src/stores/adminInfo.ts +++ b/ui/dasadmin/src/stores/adminInfo.ts @@ -12,9 +12,10 @@ export const useAdminInfo = defineStore('adminInfo', { last_login_time: '', token: '', refresh_token: '', + authorities: [], // 是否是superAdmin,用于判定是否显示终端按钮等,不做任何权限判断 super: false, - orgid:0 + orgid: 0, } }, actions: { diff --git a/ui/dasadmin/src/stores/interface/index.ts b/ui/dasadmin/src/stores/interface/index.ts index 63659884..41d4e7d9 100644 --- a/ui/dasadmin/src/stores/interface/index.ts +++ b/ui/dasadmin/src/stores/interface/index.ts @@ -51,6 +51,7 @@ export interface AdminInfo { username: string nickname: string avatar: string + authorities: Number[] last_login_time: string token: string refresh_token: string diff --git a/ui/dasadmin/src/views/backend/SystemParam/index.vue b/ui/dasadmin/src/views/backend/SystemParam/index.vue new file mode 100644 index 00000000..92018c59 --- /dev/null +++ b/ui/dasadmin/src/views/backend/SystemParam/index.vue @@ -0,0 +1,298 @@ + + + + + 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/home/windMatrix.vue b/ui/dasadmin/src/views/backend/home/windMatrix.vue index 2964a3a7..18a7e79c 100644 --- a/ui/dasadmin/src/views/backend/home/windMatrix.vue +++ b/ui/dasadmin/src/views/backend/home/windMatrix.vue @@ -23,7 +23,7 @@ 维护 离线 - 限功率运行 + 限功率运行 正常停机 外部因素导致停机 @@ -114,7 +114,7 @@