diff --git a/ui/dasadmin/src/api/backend/control/request.ts b/ui/dasadmin/src/api/backend/control/request.ts index 29d70a1d..19b9bb2e 100644 --- a/ui/dasadmin/src/api/backend/control/request.ts +++ b/ui/dasadmin/src/api/backend/control/request.ts @@ -1,17 +1,19 @@ import createAxios from '/@/utils/axios' +import { CommandReqType, CommandResType } from '/@/views/backend/equipment/airBlower/type' -export const sendValue146Req = (data: any) => { - return createAxios({ - url: '/api/node/link/setPoint', + +export const sendCommandReq = (data: CommandReqType) => { + return createAxios>({ + url: '/api/operation/command', method: 'post', - data: data, + data: data }) } -export const sendValue147Req = (data: any) => { - return createAxios({ - url: '/api/node/link/command', +export const sendManualCommandReq = (data: CommandReqType) => { + return createAxios>({ + url: '/api/operation/manualCommand', method: 'post', - data: data, + data: data }) -} \ No newline at end of file +} diff --git a/ui/dasadmin/src/api/backend/operatingRecord/request.ts b/ui/dasadmin/src/api/backend/operatingRecord/request.ts new file mode 100644 index 00000000..653211b4 --- /dev/null +++ b/ui/dasadmin/src/api/backend/operatingRecord/request.ts @@ -0,0 +1,9 @@ +import createAxios from '/@/utils/axios' +import { OperatingReqType, ReturnType } from '/@/views/backend/operatingRecord/type' +export const getOperatingListReq = (data: OperatingReqType) => { + return createAxios>({ + url: '/api/operation/getEventLogList', + method: 'post', + data: data, + }) +} diff --git a/ui/dasadmin/src/views/backend/WindBlower/index.vue b/ui/dasadmin/src/views/backend/WindBlower/index.vue index e5ee6696..529057c1 100644 --- a/ui/dasadmin/src/views/backend/WindBlower/index.vue +++ b/ui/dasadmin/src/views/backend/WindBlower/index.vue @@ -106,11 +106,19 @@ {{ realTimeDataState }}
- 启动 - 停机 - 复位 - 锁定 - 解锁 + 启动 + 停机 + 复位 + 锁定 + 解锁
@@ -206,7 +214,7 @@
- {{ realTimeDataForSingle.windfarmmonthprodenergy }} + {{ realTimeDataForSingle.monthprodenergy }}
万kWh
月发电量
@@ -220,7 +228,7 @@
- {{ realTimeDataForSingle.windfarmyearprodenergy }} + {{ realTimeDataForSingle.yearprodenergy }}
万kWh
年发电量
@@ -314,16 +322,15 @@ import { getModelAttributeListReq } from '/@/api/backend/deviceModel/request' import { useRoute } from 'vue-router' import Overview from './overview.vue' import { TableInstance } from 'element-plus' -import { dayjs } from 'element-plus' +import { dayjs, ElMessage, ElMessageBox } from 'element-plus' import { getRealTimeState, getCutDecimalsValue } from '/@/views/backend/equipment/airBlower/utils' -import { get } from 'sortablejs' +import { sendCommandReq, sendManualCommandReq } from '/@/api/backend/control/request' + const route = useRoute() -const d = new Date() const { t } = useI18n() let timer: any = null let myTable = ref() -const radioactiveName = ref('1') const overviewData = reactive({ iul1_690v: '-', @@ -351,8 +358,8 @@ const realTimeDataForSingle = ref({ ipitchangle: '', iwindspeed: '-', iwinddirection: '-', - windfarmmonthprodenergy: '-', - windfarmyearprodenergy: '-', + monthprodenergy: '-', + yearprodenergy: '-', }) const state: { @@ -1039,11 +1046,15 @@ const createRealTimeData = async () => { const modelList: any = await getModelList() const realData: any = await getRealTimeData() realTimeData.value.iturbineoperationmode = getRealTimeState(realData) + realTimeData.value.locked = realData.locked temperatureChartsData[0].value = getCutDecimalsValue(realData.itempoutdoor_1sec) temperatureChartsData[1].value = getCutDecimalsValue(realData.itempnacelle_1sec) temperatureChartsData[2].value = getCutDecimalsValue(realData.itempoutdoor_1sec) + const ipitchangle = Math.min(realData.ipitchangle1, realData.ipitchangle2, realData.ipitchangle3) + realTimeDataForSingle.value.ipitchangle = ipitchangle / 1 === 0 ? ipitchangle : Math.floor(ipitchangle * 1000) / 1000 + const overviewDatakeys: any = Object.keys(overviewData) const sigleDataKeys: any = Object.keys(realTimeDataForSingle.value) @@ -1063,13 +1074,6 @@ const createRealTimeData = async () => { if (sigleDataKeys.includes(item.attributeCode.toLowerCase())) { realTimeDataForSingle.value[item.attributeCode.toLowerCase()] = val === '-' ? val : val } - if ( - item.attributeCode.toLowerCase() === 'ipitchangle1' || - item.attributeCode.toLowerCase() === 'ipitchangle2' || - item.attributeCode.toLowerCase() === 'ipitchangle3' - ) { - realTimeDataForSingle.value.ipitchangle = Math.min(realTimeDataForSingle.value.ipitchangle, realVal) - } if (overviewDatakeys.includes(item.attributeCode.toLowerCase())) { overviewData[item.attributeCode.toLowerCase() as keyof typeof overviewData] = val === '-' ? val : val + item.unit } @@ -1359,6 +1363,58 @@ const getAllChartData = (type: ('power' | 'trend' | 'frequency')[] = ['power', ' } } +const sendCommand = (type: 'setTurbineFastStart' | 'setTurbineStop' | 'setTurbineResetStatusCode') => { + const sendTypeEnum = { + setTurbineFastStart: '风机快速启动指令', + setTurbineStop: '风机停机指令', + setTurbineResetStatusCode: '风机复位故障代码指令', + } + ElMessageBox.confirm('确认发送' + sendTypeEnum[type] + '吗?', '', { + confirmButtonText: '确认', + cancelButtonText: '取消', + type: 'warning', + }).then(() => { + const serviceName = sendTypeEnum[type] + const optDesc = serviceName + 1 + sendCommandReq({ + deviceId: route.query.irn as string, + serviceCode: type, + serviceName, + optDesc, + opValue: 1, + }).then((res) => { + if (res.code == 200) { + ElMessage.success('指令发送成功') + } else { + ElMessage.error('指令发送失败') + } + }) + }) +} + +const sendManualCommand = (type: 1 | 0) => { + const serviceName = type === 0 ? '风机解锁' : '风机锁定' + ElMessageBox.confirm('确认' + serviceName + '吗?', '', { + confirmButtonText: '确认', + cancelButtonText: '取消', + type: 'warning', + }).then(() => { + sendManualCommandReq({ + deviceId: route.query.irn as string, + serviceCode: 'Locked', + serviceName, + optDesc: serviceName + type, + opValue: type, + }).then((res) => { + if (res.code == 200) { + ElMessage.success('指令发送成功') + } else { + ElMessage.error('指令发送失败') + } + }) + }) +} + onMounted(() => { getAllChartData() createScroll() @@ -1504,6 +1560,7 @@ onUnmounted(() => { .control-tag-left { margin-left: 0; border-radius: 8px 0 0 0; + background-color: #ff4949; } } .btnLeft { diff --git a/ui/dasadmin/src/views/backend/auth/model/index.vue b/ui/dasadmin/src/views/backend/auth/model/index.vue index 66af30cb..962f1bb0 100644 --- a/ui/dasadmin/src/views/backend/auth/model/index.vue +++ b/ui/dasadmin/src/views/backend/auth/model/index.vue @@ -489,6 +489,11 @@ const modelContextMenu = (event: any, data: TreeNode) => { const modelNodeClick = (target: TreeNode) => { curContextMenuTreeData.value = JSON.parse(JSON.stringify(target)) initSortData() + modelAttributeAndServiceInputValue.value = '' + if (currentPage.value !== 1) { + currentPage.value = 1 + return + } if (ModelTabs.value === 'attribute') { getAttributeList() } else { @@ -632,8 +637,12 @@ const getAttributeList = ({ type?: radioGroupType value?: string } = {}) => { + const attributeName = modelAttributeSearchRadio.value === 'Name' ? modelAttributeAndServiceInputValue.value : undefined + const attributeCode = modelAttributeSearchRadio.value === 'Code' ? modelAttributeAndServiceInputValue.value : undefined const requestData: GetModelAttributeType = { iotModelId: curContextMenuTreeData.value!.id!, + attributeName, + attributeCode, pageNum: currentPage.value, pageSize: currentPageSize.value, orderColumn: sortData.attributeOrderColumn, @@ -669,6 +678,7 @@ const getAttributeList = ({ } else { if (res.rows && res.rows.length === 0) { attributeTableData.value = [] + pageTotal.value = res.total } else { ElMessage.error(res.msg) } @@ -686,8 +696,12 @@ const getServiceList = ({ type?: radioGroupType value?: string } = {}) => { + const serviceName = modelAttributeSearchRadio.value === 'Name' ? modelAttributeAndServiceInputValue.value : undefined + const serviceCode = modelAttributeSearchRadio.value === 'Code' ? modelAttributeAndServiceInputValue.value : undefined const requestData: GetModelServiceType = { iotModelId: curContextMenuTreeData.value!.id!, + serviceName, + serviceCode, pageNum: currentPage.value, pageSize: currentPageSize.value, orderColumn: sortData.serviceOrderColumn, @@ -711,6 +725,7 @@ const getServiceList = ({ } else { if (res.rows && res.rows.length === 0) { serviceTableData.value = [] + pageTotal.value = res.total } else { ElMessage.error(res.msg) } diff --git a/ui/dasadmin/src/views/backend/auth/org/index.vue b/ui/dasadmin/src/views/backend/auth/org/index.vue index 6548119b..65306ae5 100644 --- a/ui/dasadmin/src/views/backend/auth/org/index.vue +++ b/ui/dasadmin/src/views/backend/auth/org/index.vue @@ -576,6 +576,7 @@ const treeNodeClick = (nodeData: getTreeDataReturnType, node: Node) => { originData.value = [...res] }) } + currentPage.value = 1 clickTreeMenuData.value = nodeData } diff --git a/ui/dasadmin/src/views/backend/equipment/airBlower/type.ts b/ui/dasadmin/src/views/backend/equipment/airBlower/type.ts index 24661a90..4e0451a7 100644 --- a/ui/dasadmin/src/views/backend/equipment/airBlower/type.ts +++ b/ui/dasadmin/src/views/backend/equipment/airBlower/type.ts @@ -8,10 +8,10 @@ export type SelectTypeKeyUnionType = keyof SelectTypeObjType export type TableDataObjType = { - irn:string + irn: string name: string model: string - iotModelId:string + iotModelId: string iturbineoperationmode: number belongLine: string iwindspeed: string @@ -37,4 +37,18 @@ export type TableColumnType = { align?: 'left' | 'right' | 'center' custom?: 'header' | 'default' type?: 'default' | 'selection' | 'index' | 'expand' +} + +export type CommandReqType = { + deviceId: string | number, + serviceCode: string, + serviceName: string, + optDesc: string, + opValue: 0 | 1 +} + +export type CommandResType = { + code: number, + success: boolean, + msg: string } \ No newline at end of file diff --git a/ui/dasadmin/src/views/backend/equipment/equipmentManagement/control.vue b/ui/dasadmin/src/views/backend/equipment/equipmentManagement/control.vue index 3d9a484f..c7d1babb 100644 --- a/ui/dasadmin/src/views/backend/equipment/equipmentManagement/control.vue +++ b/ui/dasadmin/src/views/backend/equipment/equipmentManagement/control.vue @@ -9,8 +9,8 @@
- - + +
- - + + import { ref, watch } from 'vue' -import { sendValue146Req, sendValue147Req } from '/@/api/backend/control/request' +import { sendCommandReq } from '/@/api/backend/control/request' import { ElMessage, FormInstance } from 'element-plus' import { getModelServiceListReq } from '/@/api/backend/deviceModel/request' @@ -96,14 +96,14 @@ const serviceType147Ref = ref() const serviceType146Ref = ref() const serviceType147Form = ref({ //服务名 - serviceName: '', + serviceCode: '', //操作值 opValue: null, }) const serviceType146Form = ref({ //服务名 - serviceName: '', + serviceCode: '', //操作值 opValue: null, }) @@ -128,7 +128,7 @@ const init = () => { } const validData147 = { - serviceName: [ + serviceCode: [ { required: true, message: '请输入服务名', @@ -145,7 +145,7 @@ const validData147 = { } const validData146 = { - serviceName: [ + serviceCode: [ { required: true, message: '请输入服务名', @@ -171,43 +171,29 @@ const submit = (type: number) => { serviceType147Ref.value?.validate((valid) => { if (valid) { loading.value = true - sendValue147(serviceType147Form.value) + sendValue(serviceType147Form.value as unknown as { serviceCode: string; opValue: number }, type) } }) } else if (type === 146) { serviceType146Ref.value?.validate((valid) => { if (valid) { loading.value = true - sendValue146(serviceType146Form.value) + sendValue(serviceType146Form.value as unknown as { serviceCode: string; opValue: number }, type) } }) } } -const sendValue146 = (data: any) => { +const sendValue = (data: { serviceCode: string; opValue: number }, type: 146 | 147) => { const val = JSON.parse(JSON.stringify(data)) val.deviceId = props.deviceId - console.log(val, 146) - sendValue146Req(val) - .then((res) => { - console.log(res) - ElMessage.success('发送成功!') - }) - .catch((err) => { - ElMessage.error('发送失败!') - }) - .finally(() => { - loading.value = false - }) -} - -const sendValue147 = (data: any) => { - const val = JSON.parse(JSON.stringify(data)) - val.deviceId = props.deviceId - console.log(val, 147) - - sendValue147Req(val) + val.serviceName = + type === 146 + ? deviceServiceType146List.value.find((item) => item.value === val.serviceCode)?.label + : deviceServiceType147List.value.find((item) => item.value === val.serviceCode)?.label + val.optDesc = val.serviceName + val.opValue + sendCommandReq(val) .then((res) => { console.log(res) ElMessage.success('发送成功!') @@ -239,11 +225,11 @@ watch( (newVal) => { if (newVal) { serviceType147Form.value = { - serviceName: '', + serviceCode: '', opValue: null, } serviceType146Form.value = { - serviceName: '', + serviceCode: '', opValue: null, } serviceType147Ref.value?.resetFields() diff --git a/ui/dasadmin/src/views/backend/operatingRecord/index.vue b/ui/dasadmin/src/views/backend/operatingRecord/index.vue new file mode 100644 index 00000000..2024eaca --- /dev/null +++ b/ui/dasadmin/src/views/backend/operatingRecord/index.vue @@ -0,0 +1,215 @@ + + + + + diff --git a/ui/dasadmin/src/views/backend/operatingRecord/type.ts b/ui/dasadmin/src/views/backend/operatingRecord/type.ts new file mode 100644 index 00000000..7a34ae8c --- /dev/null +++ b/ui/dasadmin/src/views/backend/operatingRecord/type.ts @@ -0,0 +1,32 @@ +export type ReturnType = { + code: number + data: { + total: number + rows: OperatingResType[] + code: number + msg: string + } + msg: string + success: boolean +} + + +export type OperatingReqType = { + startTime?: string, + endTime?: string, + windTurbinesCode?: string, + userName?: string, + pageNum: number, + pageSize: number +} + +export type OperatingResType = { + id: string, + userName: string, + optTime: string, + deviceId: number, + attributeCode: string, + attributeName: string, + name:string + optDesc: string +}