This commit is contained in:
zhouhuang 2024-12-30 08:42:15 +08:00
commit acc08c1b93
7 changed files with 283 additions and 86 deletions

View File

@ -0,0 +1,52 @@
package com.das.modules.admin.controller;
import com.das.common.result.R;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.core.LoggerContext;
import org.apache.logging.log4j.core.config.Configurator;
import org.apache.logging.log4j.core.config.LoggerConfig;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
import java.util.stream.Collectors;
@RestController
@RequestMapping("/api/logger/")
public class LoggerController {
private static final Logger logger = LogManager.getLogger(LoggerController.class);
/**
* 查询当前日志级别
*
* @return 当前所有日志级别
*/
@GetMapping("/list")
public R<Map<String, String>> listLogLevels() {
LoggerContext context = (LoggerContext) LogManager.getContext(false);
return R.success(context.getConfiguration().getLoggers().values().stream()
.collect(Collectors.toMap(
LoggerConfig::getName,
loggerConfig -> loggerConfig.getLevel().toString()
)));
}
/**
* 更新日志级别
*
* @param loggerName 日志名称
* @param level 日志级别 (TRACE, DEBUG, INFO, WARN, ERROR, FATAL)
* @return 更新结果
*/
@PostMapping("/update")
public R<String> updateLogLevel(String loggerName, String level) {
try {
Configurator.setLevel(loggerName, org.apache.logging.log4j.Level.valueOf(level.toUpperCase()));
logger.info("Updated logger [{}] to level [{}]", loggerName, level);
return R.success( String.format("Logger [%s] updated to level [%s]", loggerName, level));
} catch (IllegalArgumentException e) {
logger.error("Invalid log level [{}]", level, e);
return R.fail(String.format("Invalid log level [%s]. Valid levels: TRACE, DEBUG, INFO, WARN, ERROR, FATAL.", level));
}
}
}

View File

@ -173,13 +173,7 @@ public class SysEnumServiceImpl implements SysEnumService {
*/
@Override
public void deleteEnumValues(SysEnumValuesDto sysEnumValuesDto) {
SysEnumValues sysEnumValues = new SysEnumValues();
BeanCopyUtils.copy(sysEnumValuesDto,sysEnumValues);
SysUserVo sysUserVo = (SysUserVo) StpUtil.getTokenSession().get(SessionUtil.SESSION_USER_KEY);
sysEnumValues.setUpdatedBy(sysUserVo.getAccount());
sysEnumValues.setUpdatedTime(new Date());
sysEnumValues.setIsActive(0);
sysEnumValuesMapper.updateById(sysEnumValues);
sysEnumValuesMapper.deleteById(sysEnumValuesDto.getId());
}
/**

View File

@ -301,14 +301,15 @@ export function delOtherParamsReq(params: any) {
export function uploadOtherParamsFileReq(formData: FormData, V: string) {
const token = encrypt_aes(adminInfo.token, V)
return createAxios({
url: '/api/equipment//file/upload',
url: '/api/equipment/file/upload',
method: 'POST',
data: formData,
headers: {
'Content-Type': 'multipart/form-data',
V,
token,
}
},
timeout: 1000 * 60 * 2,
},
{ customEncrypt: true })
}

View File

@ -0,0 +1,46 @@
<template>
<div class="uploadContainer" @click="upload">
<slot></slot>
<input ref="uploadRef" type="file" style="display: none" :multiple="props.multiple" @change="change" />
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue'
const props = defineProps({
multiple: {
type: Boolean,
default: false,
},
onChange: {
type: Function,
default: () => {},
},
})
const uploadRef = ref()
const upload = (e:any) => {
e.stopPropagation()
uploadRef.value!.click()
}
const change = (payload: Event) => {
payload.preventDefault()
const files = (payload.target as HTMLInputElement).files
props.onChange(files)
}
const clearFiles = () => {
uploadRef.value!.value = ''
}
defineExpose({
clearFiles,
})
</script>
<style scoped lang="scss">
.uploadContainer {
height: 100%;
}
</style>

View File

@ -43,7 +43,7 @@
<el-button type="primary" :icon="Crop" class="defaultBtn" @click="openMeasure">测点选择</el-button>
<el-button style="color: rgb(0, 100, 170)" :icon="Download" class="defaultBtn" @click="downFun">数据导出</el-button>
</div>
<div class="headerRight">
<div class="headerRight" v-permission="[104]">
<el-popconfirm title="确认启动么?" @confirm="airBlowerOperate('setTurbineFastStart')">
<template #reference>
<el-button type="primary">{{ t('airBlower.start') }}</el-button>
@ -230,6 +230,9 @@ import { adminBaseRoutePath } from '/@/router/static/adminBase'
import { getRealValueListReq } from '/@/api/backend/deviceModel/request'
import SelectPoint from '/@/views/backend/equipment/airBlower/selectPoint.vue'
import RealDataChart from '/@/views/backend/equipment/airBlower/realDataChart.vue'
import { permission } from '/@/utils/directive'
const vPermission = permission()
const router = useRouter()
const { t } = useI18n()

View File

@ -84,7 +84,15 @@
</el-main>
</el-container>
<!-- 机组设备弹窗 -->
<el-dialog v-model="type10002DialogVisible" width="800" :title="type10002DialogTitle" align-center :close-on-click-modal="false" @close="cancelType10002Dialog">
<el-dialog
v-model="type10002DialogVisible"
width="800"
:title="type10002DialogTitle"
align-center
:close-on-click-modal="false"
@close="cancelType10002Dialog"
:before-close="beforeCloseType10002Dialog"
>
<el-tabs v-model="activeName">
<el-form ref="deviceDataFormRef" label-width="auto" :model="deviceData" :rules="editAddDeviceRules">
<el-tab-pane label="风机参数" name="1">
@ -170,13 +178,26 @@
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="所属线路:">
<el-input placeholder="请输入所属线路" v-model="deviceData.belongLine" style="width: 200px" />
</el-row>
<el-row>
<el-col :span="9">
<el-form-item label="所属工程">
<el-select placeholder="请选择所属工程" v-model="deviceData.belongProject">
<el-option v-for="item in belongprojectList" :key="item.id" :value="item.value"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="10" :offset="1">
<el-button @click="openAttachment('风机')">风机详情</el-button>
<el-col :span="9">
<el-form-item label="所属线路:">
<el-select placeholder="请选择所属线路" v-model="deviceData.belongLine">
<el-option v-for="item in belongLineList" :key="item.id" :value="item.value"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="3">
<div style="padding-left: 26px; width: 100%; height: 100%">
<el-button @click.stop="openAttachment('风机')">风机详情</el-button>
</div>
</el-col>
</el-row>
<el-row>
@ -266,7 +287,7 @@
</el-form-item>
</el-col>
<el-col :span="3" :offset="1">
<el-button @click="openAttachment('变桨')">详情</el-button>
<el-button @click.stop="openAttachment('变桨')">详情</el-button>
</el-col>
<el-col :span="10">
<el-form-item label="叶片1型号:">
@ -279,7 +300,7 @@
</el-form-item>
</el-col>
<el-col :span="3" :offset="1">
<el-button @click="openAttachment('叶片1')">详情</el-button>
<el-button @click.stop="openAttachment('叶片1')">详情</el-button>
</el-col>
<el-col :span="10">
<el-form-item label="叶片1轴承型号:">
@ -302,7 +323,7 @@
</el-form-item>
</el-col>
<el-col :span="3" :offset="1">
<el-button @click="openAttachment('叶片2')">详情</el-button>
<el-button @click.stop="openAttachment('叶片2')">详情</el-button>
</el-col>
<el-col :span="10">
<el-form-item label="叶片2轴承型号:">
@ -325,7 +346,7 @@
</el-form-item>
</el-col>
<el-col :span="3" :offset="1">
<el-button @click="openAttachment('叶片3')">详情</el-button>
<el-button @click.stop="openAttachment('叶片3')">详情</el-button>
</el-col>
<el-col :span="10">
<el-form-item label="叶片3轴承型号:">
@ -348,7 +369,7 @@
</el-form-item>
</el-col>
<el-col :span="3" :offset="1">
<el-button @click="openAttachment('主轴承')">详情</el-button>
<el-button @click.stop="openAttachment('主轴承')">详情</el-button>
</el-col>
<el-col :span="10">
<el-form-item label="齿轮箱型号:">
@ -361,7 +382,7 @@
</el-form-item>
</el-col>
<el-col :span="3" :offset="1">
<el-button @click="openAttachment('齿轮箱')">详情</el-button>
<el-button @click.stop="openAttachment('齿轮箱')">详情</el-button>
</el-col>
<el-col :span="10">
<el-form-item label="发电机型号:">
@ -374,7 +395,7 @@
</el-form-item>
</el-col>
<el-col :span="3" :offset="1">
<el-button @click="openAttachment('发电机')">详情</el-button>
<el-button @click.stop="openAttachment('发电机')">详情</el-button>
</el-col>
<el-col :span="10">
<el-form-item label="交流器型号:">
@ -387,7 +408,7 @@
</el-form-item>
</el-col>
<el-col :span="3" :offset="1">
<el-button @click="openAttachment('交流器')">详情</el-button>
<el-button @click.stop="openAttachment('交流器')">详情</el-button>
</el-col>
<el-col :span="12">
<el-form-item label="主控系统型号:">
@ -405,10 +426,10 @@
</el-form-item>
</el-col>
<el-col :span="4">
<el-button @click="openAttachment('塔基柜')">塔基柜详情</el-button>
<el-button @click.stop="openAttachment('塔基柜')">塔基柜详情</el-button>
</el-col>
<el-col :span="4">
<el-button @click="openAttachment('机舱柜')">机舱柜详情</el-button>
<el-button @click.stop="openAttachment('机舱柜')">机舱柜详情</el-button>
</el-col>
</el-row>
</el-tab-pane>
@ -605,12 +626,9 @@
<el-dialog v-model="attachmentDialogVisible" :title="attachmentDialogTitle" :width="800" :close-on-click-modal="false">
<div class="attachmentContainer">
<div class="header">
<!-- <el-button @click="uploadAttachment">添加附件</el-button> -->
<el-upload ref="uploadRef" :show-file-list="false" :http-request="uploadAttachment" multiple>
<template #trigger>
<el-button type="primary">添加附件</el-button>
</template>
</el-upload>
<CustomUpload multiple :onChange="uploadAttachment" ref="customUploadRef">
<el-button type="primary" :loading="uploadAttachmentLoading">添加附件</el-button>
</CustomUpload>
</div>
<div class="content">
<el-carousel indicator-position="outside" @change="changeImgIndex">
@ -630,7 +648,13 @@
preview-teleported
style="width: 100%; height: 100%"
></el-image>
<!-- <img :src="item.url" alt="" style="width: auto; height: 100%" /> -->
<div class="delImg">
<el-popconfirm title="确认删除该图片吗?" @confirm="delImg(item)">
<template #reference>
<el-button @click.stop type="danger" :icon="CloseBold" circle />
</template>
</el-popconfirm>
</div>
</div>
</el-carousel-item>
</template>
@ -643,7 +667,7 @@
<script setup lang="ts">
import { ref, reactive, computed, onMounted, nextTick, watch } from 'vue'
import { Search, CirclePlusFilled, Upload, Download } from '@element-plus/icons-vue'
import { Search, CirclePlusFilled, Upload, Download, CloseBold } from '@element-plus/icons-vue'
import {
equipTree,
equipQuery,
@ -660,28 +684,17 @@ import {
updateOtherParamsReq,
delOtherParamsReq,
uploadOtherParamsFileReq,
readFileReq,
} from '/@/api/backend'
import {
ElTable,
ElMessage,
ElMessageBox,
FormInstance,
UploadInstance,
genFileId,
UploadProps,
UploadRawFile,
UploadFile,
UploadFiles,
UploadRequestOptions,
} from 'element-plus'
import { ElTable, ElMessage, ElMessageBox, FormInstance } from 'element-plus'
import { useAdminInfo } from '/@/stores/adminInfo'
import { encrypt_aes, generateRandomNumber } from '/@/utils/crypto'
import ControlPage from './control.vue'
import MeasurementPage from './measurement.vue'
import { ModelAttributeType } from '/@/views/backend/auth/model/type'
import { theoreticalpowerCurveList } from '/@/api/backend/theoreticalpowerCurve/request'
import CustomUpload from '/@/components/upload/index.vue'
import { permission } from '/@/utils/directive'
import { enumListQuery } from '/@/api/backend/Enumeration/request'
const vPermission = permission()
const adminInfo = useAdminInfo()
@ -787,10 +800,26 @@ const defaultEquipmentProps = {
children: 'equipChildren',
}
const belongLineList = ref<{ value: string;id:string }[]>([])
const belongprojectList = ref<{ value: string;id:string }[]>([])
const getEnumList = () => {
enumListQuery({ enumTypeId: '1872545505561620482' }).then((res) => {
belongprojectList.value = res.data.rows.map((item: { description: string; id: string }) => {
return { id: item.id, value: item.description }
})
})
enumListQuery({ enumTypeId: '1872549920439873537' }).then((res) => {
belongLineList.value = res.data.rows.map((item: { description: string; id: string }) => {
return { id: item.id, value: item.description }
})
})
}
onMounted(() => {
equipTypeList()
equipOrgList()
equipOrgBelonging()
getEnumList()
})
const formQuery = reactive({
@ -1236,6 +1265,7 @@ const originDeviceData: any = {
orgId: '',
parentEquipmentId: '',
iotModelId: '',
belongProject: '',
belongLine: '',
standard: 0,
nominalCapacity: '',
@ -1262,8 +1292,6 @@ const getCurDialogState = () => {
}
}
const saveDeviceData = () => {
// console.log(deviceData, 'deviceData')
deviceDataFormRef.value?.validate((valid: boolean) => {
if (valid) {
deviceData.standard = deviceData.standard ? 1 : 0
@ -1344,9 +1372,30 @@ const saveDeviceData = () => {
}
})
}
const beforeCloseType10002Dialog = (done: () => void) => {
if (addImgList.value.length || delImgState.value) {
const title = delImgState.value ? '删除图片未保存,确认取消?' : '上传图片未保存,确认取消?'
ElMessageBox.confirm(title, '', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
done()
addImgList.value = []
imgList.value = []
delImgState.value = false
})
.catch(() => {})
} else {
done()
imgList.value = []
}
}
const cancelType10002Dialog = () => {
if (addImgList.value.length) {
ElMessageBox.confirm('上传图片未保存,确认取消?', '', {
if (addImgList.value.length || delImgState.value) {
const title = delImgState.value ? '删除图片未保存,确认取消?' : '上传图片未保存,确认取消?'
ElMessageBox.confirm(title, '', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
@ -1355,6 +1404,7 @@ const cancelType10002Dialog = () => {
type10002DialogVisible.value = false
addImgList.value = []
imgList.value = []
delImgState.value = false
})
.catch(() => {})
} else {
@ -1410,30 +1460,26 @@ const setOtherParamsFormData = (data: any = {}) => {
const attachmentDialogVisible = ref(false)
const attachmentDialogTitle = ref('风机详细信息')
const uploadRef = ref<UploadInstance>()
const uploadAttachment = (file: UploadRequestOptions) => {
const customUploadRef = ref()
const uploadAttachmentLoading = ref(false)
const uploadAttachment = (files: FileList) => {
uploadAttachmentLoading.value = true
const formData = new FormData()
formData.append('fileList', file.file)
for (let i = 0; i < files.length; i++) {
formData.append('fileList', files[i])
}
const v = generateRandomNumber(16)
return uploadOtherParamsFileReq(formData, v).then((res) => {
customUploadRef.value?.clearFiles()
res.data.forEach((item: { name: string; url: string }) => {
addImgList.value.push({
name: file.file.name,
url: res.data[0].url,
name: item.name,
url: item.url,
component: attachmentComponent.value,
})
addImgList.value.push({
name: file.file.name,
url: res.data[1].url,
component: attachmentComponent.value,
})
const imgListUrl = imgList.value.map((item: any) => item.url)
for (let i = addImgList.value.length - 1; i >= 0; i--) {
if (imgListUrl.includes('/api/equipment/file/read?path=' + addImgList.value[i].url)) {
const index = imgList.value.findIndex((item: any) => item.url === '/api/equipment/file/read?path=' + addImgList.value[i].url)
imgList.value.splice(index, 1)
}
}
previewImg([...imgList.value, ...addImgList.value])
uploadAttachmentLoading.value = false
})
}
const setUploadImgInfo = (id: string) => {
@ -1442,13 +1488,7 @@ const setUploadImgInfo = (id: string) => {
item.deviceId = id
})
}
const handleExceed: UploadProps['onExceed'] = (files) => {
uploadRef.value!.clearFiles()
const file = files[0] as UploadRawFile
file.uid = genFileId()
uploadRef.value!.handleStart(file)
uploadRef.value!.submit()
}
const attachmentComponent = ref('')
const openAttachment = (type: string) => {
attachmentComponent.value = type
@ -1457,14 +1497,19 @@ const openAttachment = (type: string) => {
const list = otherParamsForm.sysEquipmentDocsList.filter((item: { component: string; name: string; url: string }) => {
return item.component === type
})
if (list.length) {
previewImg(list)
const addList = addImgList.value.filter((item: { component: string }) => {
return item.component === type
})
const allList = [...list, ...addList]
if (allList.length) {
previewImg(allList)
} else {
imgList.value = []
}
}
const reg = /\/thumbnailPic\//
const hasPathReg = /\/api\/equipment\/file\/read\?path=/
const readImgAddPath = '/api/equipment/file/read?path='
const previewImg = (list: { url: string }[]) => {
const picList: any = []
for (let item of list) {
@ -1473,7 +1518,7 @@ const previewImg = (list: { url: string }[]) => {
continue
}
if (reg.test(item.url)) {
picList.push({ url: '/api/equipment/file/read?path=' + item.url })
picList.push({ url: readImgAddPath + item.url })
}
}
imgList.value = picList
@ -1491,6 +1536,29 @@ const previewImgIndex = ref(0)
const changeImgIndex = (index: number) => {
previewImgIndex.value = index
}
const delImgState = ref(false)
const delImg = (imgData: { url: string }) => {
imgList.value.splice(previewImgIndex.value, 1)
const hasThumbnailPicOnImgList = otherParamsForm.sysEquipmentDocsList.findIndex(
(item: { url: string }) => readImgAddPath + item.url === imgData.url
)
if (hasThumbnailPicOnImgList !== -1) {
otherParamsForm.sysEquipmentDocsList.splice(hasThumbnailPicOnImgList, 1)
const originPic = otherParamsForm.sysEquipmentDocsList.findIndex(
(item: { url: string }) => readImgAddPath + item.url === imgData.url.replace(/\/thumbnailPic\//, '/pic/')
)
otherParamsForm.sysEquipmentDocsList.splice(originPic, 1)
delImgState.value = true
}
const hasThumbnailPicOnAddImgList = addImgList.value.findIndex((item: { url: string }) => readImgAddPath + item.url === imgData.url)
if (hasThumbnailPicOnAddImgList !== -1) {
addImgList.value.splice(hasThumbnailPicOnImgList, 1)
const originPic = addImgList.value.findIndex(
(item: { url: string }) => readImgAddPath + item.url === imgData.url.replace(/\/thumbnailPic\//, '/pic/')
)
addImgList.value.splice(originPic, 1)
}
}
</script>
<style scoped lang="scss">
@ -1627,11 +1695,30 @@ $paginationHeight: 32px;
width: 100%;
height: 305px;
.imgContainer {
position: relative;
display: flex;
justify-content: center;
align-items: center;
width: 100%;
height: 100%;
&:hover {
.delImg {
opacity: 1;
}
}
.delImg {
position: absolute;
right: 0;
top: 0;
width: 20px;
height: 20px;
opacity: 0;
transition: opacity 0.3s;
.el-button {
width: 100%;
height: 100%;
}
}
}
}
}

View File

@ -9,9 +9,10 @@
<div class="cardLabel">风机矩阵</div>
<div class="cardBtn">
<el-radio-group v-model="overviewSlotData" @change="changeUpdate">
<el-radio value="">全部</el-radio>
<el-radio v-for="item in belongprojectList" :value="item.value">{{ item.name }}</el-radio>
<!-- <el-radio value="">全部</el-radio>
<el-radio value="一期">一期</el-radio>
<el-radio value="二期">二期</el-radio>
<el-radio value="二期">二期</el-radio>-->
</el-radio-group>
</div>
<div class="headerRight">
@ -52,14 +53,14 @@ import { onMounted, reactive, ref, onUnmounted } from 'vue'
import { useI18n } from 'vue-i18n'
import WindContent from '/@/views/backend/home/windMatrixpage.vue'
import { getWindFarmRealData, getWindTurbineMatrixData } from '/@/api/backend/dashboard.ts'
import { dayjs, ElMessage, ElMessageBox, TableInstance } from 'element-plus'
import { getRealTimeState,malFunctionKeys } from '/@/views/backend/equipment/airBlower/utils.ts'
import { ElMessage, TableInstance } from 'element-plus'
import { getRealTimeState } from '/@/views/backend/equipment/airBlower/utils.ts'
import { useRoute } from 'vue-router'
import { getParamList } from '/@/api/backend/SystemParam/request'
import { queryfaultCodeDict } from '/@/api/backend/theoreticalpowerCurve/request'
import { useEnumStore } from '/@/stores/enums'
import { useFaultsStore } from '/@/stores/faults'
import {equipList} from "/@/api/backend/realData/request";
import { enumListQuery } from '/@/api/backend/Enumeration/request'
const route = useRoute()
@ -73,6 +74,18 @@ let myTable = ref<TableInstance>()
const overviewSlotData= ref('')
const belongprojectList = ref<{ value: string;name:string }[]>([
{ value: '',name:'全部' },
])
const getEnumList = () => {
enumListQuery({ enumTypeId: '1872545505561620482' }).then((res) => {
res.data.rows.map((item: { description: string; value: string }) => {
belongprojectList.value.push({ value: item.description, name: item.description })
})
})
}
const realData = ref({
windFarmId: '',
attributeMap: {},
@ -397,6 +410,7 @@ const sizeChange = () => {
}
onMounted(() => {
getEnumList()
getList()
window.addEventListener('resize', sizeChange)
sizeChange()