diff --git a/global.types/components.d.ts b/global.types/components.d.ts index b1ce32b..d5f9cbf 100644 --- a/global.types/components.d.ts +++ b/global.types/components.d.ts @@ -15,8 +15,6 @@ declare module 'vue' { EdfsTable: typeof import('./../src/components/Edfs-table/index.vue')['default'] EdfsWrap: typeof import('./../src/components/Edfs-wrap.vue')['default'] ElAside: typeof import('element-plus/es')['ElAside'] - ElBreadcrumb: typeof import('element-plus/es')['ElBreadcrumb'] - ElBreadcrumbItem: typeof import('element-plus/es')['ElBreadcrumbItem'] ElButton: typeof import('element-plus/es')['ElButton'] ElCheckbox: typeof import('element-plus/es')['ElCheckbox'] ElCheckboxGroup: typeof import('element-plus/es')['ElCheckboxGroup'] @@ -33,10 +31,12 @@ declare module 'vue' { ElInput: typeof import('element-plus/es')['ElInput'] ElMenu: typeof import('element-plus/es')['ElMenu'] ElMenuItem: typeof import('element-plus/es')['ElMenuItem'] + ElOption: typeof import('element-plus/es')['ElOption'] ElPagination: typeof import('element-plus/es')['ElPagination'] ElProgress: typeof import('element-plus/es')['ElProgress'] ElRow: typeof import('element-plus/es')['ElRow'] ElScrollbar: typeof import('element-plus/es')['ElScrollbar'] + ElSelect: typeof import('element-plus/es')['ElSelect'] ElSubMenu: typeof import('element-plus/es')['ElSubMenu'] ElTableColumn: typeof import('element-plus/es')['ElTableColumn'] ElTag: typeof import('element-plus/es')['ElTag'] diff --git a/src/api/module/transfer/index.ts b/src/api/module/transfer/index.ts index f0889a2..40453a7 100644 --- a/src/api/module/transfer/index.ts +++ b/src/api/module/transfer/index.ts @@ -66,6 +66,7 @@ export interface IPointGroupOV { id: number | string, ip: string, name: string, + cnName:string port: number, slave_addr: number | string, type: string, diff --git a/src/router/index.ts b/src/router/index.ts index c1c6fbc..9ea71c4 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -63,16 +63,16 @@ export const defaultRouter = [ icon: 'i-mingcute:task-line', } }, - { - path: '/testG6', - name: 'testG6', - component: () => import('@/views/testG6/index.vue'), - meta: { - title: '测试G6', - isShow: true, - icon: 'i-mingcute:task-line', - } - } + // { + // path: '/testG6', + // name: 'testG6', + // component: () => import('@/views/testG6/index.vue'), + // meta: { + // title: '测试G6', + // isShow: true, + // icon: 'i-mingcute:task-line', + // } + // } ], }, ] diff --git a/src/views/stationData/component/pointCheckbox.vue b/src/views/stationData/component/pointCheckbox.vue index e3d5b60..2f8b0db 100644 --- a/src/views/stationData/component/pointCheckbox.vue +++ b/src/views/stationData/component/pointCheckbox.vue @@ -1,5 +1,5 @@ diff --git a/src/views/stationData/topology/components/detailDrawer.vue b/src/views/stationData/topology/components/detailDrawer.vue index 94d0841..bcc3f71 100644 --- a/src/views/stationData/topology/components/detailDrawer.vue +++ b/src/views/stationData/topology/components/detailDrawer.vue @@ -9,7 +9,23 @@ :before-close="handleBeforeClose" @opened="onDrawerOpened">
- + + + + + - 查询数据 +
+
+ +
+ 查询数据 +
{ @@ -90,11 +127,19 @@ async function open(device: IDevice & { }) } +const selectValue = ref() +function onchangeSelect(value: string) { + PointCheckboxRef.value?.clearCheck() +} + const loadingPoints = ref(false) const columParams = computed(() => ['ts', ...checkPointList.value.map(i => i.addr)]) -const currentGroup = ref() +const currentGroup = ref +}>() async function loadPoints() { if (!currentGroup.value) { @@ -159,6 +204,10 @@ const chartOffset = ref(0) const progress = ref(0) async function loadChardData() { + if (!time.value || time.value.length !== 2) { + message.error('请选择时间范围') + return + } if (!currentGroup.value) return if (!columParams.value.filter(i => i !== 'ts').length) { message.error('请选择点位') @@ -171,7 +220,9 @@ async function loadChardData() { columns: columParams.value, isLocal: !curDevice.value?.isonLine, host: curDevice.value?.isonLine ? (curDevice.value as IOnlineDevice).clientIp : '', - name: currentGroup.value.name as string, + name: selectValue.value as string, + startTime: time.value[0], + endTime: time.value[1], } const params: IGetDeviceDataParams = { @@ -315,6 +366,26 @@ function onchangePoints(checkPoints: IMyPoint[]) { checkPointList.value = checkPoints } +const time = ref<[string, string]>() +const disabledDate = (time: any) => { + const current = dayjs(time) + if (curDevice.value?.isonLine) { + return current.isAfter(dayjs(), 'day') + } + + try { + const deviceOff = curDevice.value as IOfflineDevice + const start = dayjs(deviceOff.start_time).format('YYYY-MM-DD') + const end = dayjs(deviceOff.end_time).format('YYYY-MM-DD') + return current.isBefore(start, 'day') || current.isAfter(end, 'day') + } catch (e) { + console.log('disableDate error', e) + return current.isAfter(dayjs(), 'day') + } + +} +const getBeforeMonth = dayjs().startOf('month').subtract(1, 'month').startOf('month').toDate() + defineExpose({ open, openFullScreen, diff --git a/src/views/stationData/topology/index.vue b/src/views/stationData/topology/index.vue index 0bdae7b..be32c89 100644 --- a/src/views/stationData/topology/index.vue +++ b/src/views/stationData/topology/index.vue @@ -56,6 +56,7 @@ async function loadDeviceTopology() { id: deviceInfo.sn, ip: deviceInfo.ip, name: deviceInfo?.sn, + cnName: deviceInfo?.name ?? deviceInfo?.sn, port: deviceInfo.port, slave_addr: 'root', type: deviceInfo?.type ?? 'emu', @@ -81,7 +82,7 @@ const plugins: PluginOptions = [ enable: (e: any) => e.targetType === 'node', getContent: (e: any, items: any) => { console.log(items) - return `
节点: ${items[0].data.name}
`; + return `
${items[0].data.cnName}
`; }, }, ] @@ -102,6 +103,7 @@ function init() { function onDetail(value: string, item: HTMLElement, current: any) { const nodeData = current.config.context.model.getNodeData(current.config.id) + console.log(nodeData[nodeData.length - 1].data) const device = deviceInfo as unknown as IDevice & { isonLine: boolean siteName: string @@ -117,10 +119,14 @@ onMounted(async () => { function filterTree(node: IPointGroupOV) { if (node.type === 'bms_cluster' && Array.isArray(node.children)) { - if (node.children.length > 2) { - const customNode = node.children[node.children.length - 1] as any - customNode.name = `${node.children[0].name} ~ ${node.children[node.children.length - 2].name}` + if (node.children.length > 1) { + const customNode = node.children[0] as any + node.children.forEach(r => { + r.customCnName = r.cnName + }) + customNode.cnName = `${node.children[0].cnName} ~ ${node.children[node.children.length - 1].cnName}` customNode.customNode = true + customNode.brother = node.children node.children = [customNode] } } diff --git a/src/views/stationData/transfer/components/PointGroupTree.vue b/src/views/stationData/transfer/components/PointGroupTree.vue index bbb32a5..6ccf737 100644 --- a/src/views/stationData/transfer/components/PointGroupTree.vue +++ b/src/views/stationData/transfer/components/PointGroupTree.vue @@ -64,7 +64,7 @@ const handleNodeClick = (data: IPointGroupOV) => { const defaultProps = { children: 'children', - label: 'name', + label: 'cnName', } function changePoints() { diff --git a/src/views/stationData/transfer/components/deviceDrawer.vue b/src/views/stationData/transfer/components/deviceDrawer.vue index 1b43d2d..2e8810f 100644 --- a/src/views/stationData/transfer/components/deviceDrawer.vue +++ b/src/views/stationData/transfer/components/deviceDrawer.vue @@ -33,7 +33,22 @@ - 查询数据 +
+
+ +
+ 查询数据 +
+ @@ -61,6 +76,8 @@ import dayjs from 'dayjs' import { nextTick } from "vue"; import EdfsWrap from "@/components/Edfs-wrap.vue"; +const time = ref<[string, string]>() + const env = import.meta.env @@ -160,6 +177,10 @@ const chartOffset = ref(0) const progress = ref(0) async function loadChardData() { + if (!time.value || time.value.length !== 2) { + message.error('请选择时间范围') + return + } if (!columParams.value.filter(i => i !== 'ts').length) { message.error('请选择点位') return @@ -167,11 +188,17 @@ async function loadChardData() { clearData() const limit = chartLimit.value const offset = chartOffset.value - const options = { + const options:any = { columns: columParams.value, isLocal: !props.isTransfer, host: props.isTransfer ? (curDevice.value as IOnlineDevice).clientIp : '', name: curGroupName.value as string, + startTime: time.value[0], + endTime: time.value[1], + } + if (env.VITE_APP_ENV !== 'local' || !props.isTransfer) { + options.site_id = props.siteInfo!.name || '' + options.device_id = curDevice.value?.sn || '' } const params: IGetDeviceDataParams = { @@ -180,13 +207,8 @@ async function loadChardData() { offset } - if (env.VITE_APP_ENV !== 'local' || !props.isTransfer) { - params.site_id = props.siteInfo!.name || '' - params.device_id = curDevice.value?.sn || '' - } loadingChart.value = true isShowChart.value = false - const res = await getDeviceDetails(params) if (res.code !== 0) { @@ -355,6 +377,21 @@ function onchangePoints(checkPoints: IMyPoint[]) { checkPointList.value = checkPoints } +const disabledDate = (time: any) => { + const current = dayjs(time) + if (props.isTransfer) return current.isAfter(dayjs(), 'day') + try { + const deviceOff = curDevice.value as IOfflineDevice + const start = dayjs(deviceOff.start_time).format('YYYY-MM-DD') + const end = dayjs(deviceOff.end_time).format('YYYY-MM-DD') + return current.isBefore(start, 'day') || current.isAfter(end, 'day') + } catch (e) { + console.log('disableDate error', e) + return current.isAfter(dayjs(), 'day') + } + +} +const getBeforeMonth = dayjs().startOf('month').subtract(1, 'month').startOf('month').toDate() defineExpose({ open, openFullScreen, diff --git a/src/views/stationData/transfer/index.vue b/src/views/stationData/transfer/index.vue index 8be9b91..48238cf 100644 --- a/src/views/stationData/transfer/index.vue +++ b/src/views/stationData/transfer/index.vue @@ -104,7 +104,7 @@