Browse Source

feat: 一些调整

main
betaqi 1 month ago
parent
commit
e16ace00f8
  1. 4
      global.types/components.d.ts
  2. 1
      src/api/module/transfer/index.ts
  3. 20
      src/router/index.ts
  4. 2
      src/views/stationData/component/pointCheckbox.vue
  5. 3
      src/views/stationData/topology/components/Node.vue
  6. 79
      src/views/stationData/topology/components/detailDrawer.vue
  7. 14
      src/views/stationData/topology/index.vue
  8. 2
      src/views/stationData/transfer/components/PointGroupTree.vue
  9. 51
      src/views/stationData/transfer/components/deviceDrawer.vue
  10. 8
      src/views/stationData/transfer/index.vue
  11. 2
      src/views/stationData/type.ts
  12. 6
      src/views/taskList/index.vue

4
global.types/components.d.ts vendored

@ -15,8 +15,6 @@ declare module 'vue' { @@ -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' { @@ -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']

1
src/api/module/transfer/index.ts

@ -66,6 +66,7 @@ export interface IPointGroupOV { @@ -66,6 +66,7 @@ export interface IPointGroupOV {
id: number | string,
ip: string,
name: string,
cnName:string
port: number,
slave_addr: number | string,
type: string,

20
src/router/index.ts

@ -63,16 +63,16 @@ export const defaultRouter = [ @@ -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',
// }
// }
],
},
]

2
src/views/stationData/component/pointCheckbox.vue

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
<template>
<div class="w-340 h-full" v-loading="loadingPoints" element-loading-text="数据加载中...">
<div class="w-320 h-full" v-loading="loadingPoints" element-loading-text="数据加载中...">
<template v-if="!pointList.length">
<el-empty></el-empty>
</template>

3
src/views/stationData/topology/components/Node.vue

@ -14,7 +14,8 @@ @@ -14,7 +14,8 @@
<img :src="Device.icon" style="height: 100%;" alt="">
</div>
<div class="bg-white flex-1 flex items-center justify-center overflow-hidden">
<span class="text-12px overflow-hidden text-ellipsis whitespace-nowrap">{{ Device.name }}</span>
<span class="text-12px overflow-hidden text-ellipsis whitespace-nowrap">{{ Device.cnName
}}</span>
</div>
</div>
</template>

79
src/views/stationData/topology/components/detailDrawer.vue

@ -9,7 +9,23 @@ @@ -9,7 +9,23 @@
:before-close="handleBeforeClose"
@opened="onDrawerOpened">
<main class="wh-full flex">
<EdfsWrap title="选择" class="p-r-4 h-full w-340 border-r-1 border-solid border-r-#e4e7ed">
<EdfsWrap title="点位选择"
class="p-r-4 h-full w-340 border-r-1 border-solid border-r-#e4e7ed">
<el-select
v-if="currentGroup?.customNode"
v-model="selectValue"
placeholder="单体选择"
style="width:240px"
@change="onchangeSelect"
>
<el-option
v-for="item in currentGroup.brother"
:key="item.name"
:label="item.customCnName"
:value="item.name"
/>
</el-select>
<PointCheckbox
:pointList="pointList"
:loadingPoints="loadingPoints"
@ -34,7 +50,21 @@ @@ -34,7 +50,21 @@
</div>
</div>
</div>
<el-button class="mb-4" type="primary" @click="loadChardData">查询数据</el-button>
<div class="flex w-full items-center gap-16">
<div class="w-400px">
<el-date-picker
v-model="time"
type="datetimerange"
value-format="YYYY-MM-DD HH:mm:ss"
range-separator="到"
:default-value="getBeforeMonth"
start-placeholder="开始时间"
end-placeholder="结束时间"
:disabled-date="disabledDate"
/>
</div>
<el-button type="primary" @click="loadChardData">查询数据</el-button>
</div>
<NewDataChart
v-if="isShowChart"
:chart-datas="chartData"
@ -79,6 +109,13 @@ async function open(device: IDevice & { @@ -79,6 +109,13 @@ async function open(device: IDevice & {
}, group: IPointGroupOV) {
curDevice.value = device
currentGroup.value = group
if (
currentGroup.value.customNode &&
currentGroup.value.brother &&
currentGroup.value.brother.length
) {
selectValue.value = currentGroup.value.brother[0].name
}
PointCheckboxRef.value?.clearCheck()
await loadPoints()
.then(async () => {
@ -90,11 +127,19 @@ async function open(device: IDevice & { @@ -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<IPointGroupOV>()
const currentGroup = ref<IPointGroupOV & {
customNode?: boolean
brother?: Array<any>
}>()
async function loadPoints() {
if (!currentGroup.value) {
@ -159,6 +204,10 @@ const chartOffset = ref(0) @@ -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() { @@ -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[]) { @@ -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,

14
src/views/stationData/topology/index.vue

@ -56,6 +56,7 @@ async function loadDeviceTopology() { @@ -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 = [ @@ -81,7 +82,7 @@ const plugins: PluginOptions = [
enable: (e: any) => e.targetType === 'node',
getContent: (e: any, items: any) => {
console.log(items)
return `<div>节点: ${items[0].data.name}</div>`;
return `<div>${items[0].data.cnName}</div>`;
},
},
]
@ -102,6 +103,7 @@ function init() { @@ -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 () => { @@ -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]
}
}

2
src/views/stationData/transfer/components/PointGroupTree.vue

@ -64,7 +64,7 @@ const handleNodeClick = (data: IPointGroupOV) => { @@ -64,7 +64,7 @@ const handleNodeClick = (data: IPointGroupOV) => {
const defaultProps = {
children: 'children',
label: 'name',
label: 'cnName',
}
function changePoints() {

51
src/views/stationData/transfer/components/deviceDrawer.vue

@ -33,7 +33,22 @@ @@ -33,7 +33,22 @@
</div>
</div>
</div>
<el-button class="mb-4" type="primary" @click="loadChardData">查询数据</el-button>
<div class="flex w-full items-center gap-16">
<div class="w-400px">
<el-date-picker
v-model="time"
type="datetimerange"
value-format="YYYY-MM-DD HH:mm:ss"
range-separator="到"
:default-value="getBeforeMonth"
start-placeholder="开始时间"
end-placeholder="结束时间"
:disabled-date="disabledDate"
/>
</div>
<el-button type="primary" @click="loadChardData">查询数据</el-button>
</div>
<NewDataChart v-if="isShowChart" :chart-datas="chartData" :legends="legends"
:axis-data="Array.from(axisData)" ref="chartRef"/>
</div>
@ -61,6 +76,8 @@ import dayjs from 'dayjs' @@ -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) @@ -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() { @@ -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() { @@ -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[]) { @@ -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,

8
src/views/stationData/transfer/index.vue

@ -104,7 +104,7 @@ @@ -104,7 +104,7 @@
</template>
<template v-else>
<template v-for="key in Object.keys(offlineDeviceMap)">
<div class="info-item" v-if="key === 'create_time'">
<div class="info-item" v-if="['create_time','end_time','start_time'].includes(key)">
<div>
{{ offlineDeviceMap[key as keyof typeof offlineDeviceMap] }}:
</div>
@ -204,12 +204,14 @@ const onlineDeviceMap: Record< @@ -204,12 +204,14 @@ const onlineDeviceMap: Record<
footprint: '数据占用空间',
}
const offlineDeviceMap: Record<
keyof Pick<IOfflineDevice, 'site_id' | 'db' | 'create_time'>,
keyof Pick<IOfflineDevice, 'site_id' | 'db' | 'create_time' | 'start_time' | 'end_time'>,
string
> = {
site_id: '站点名称',
db: '数据库',
create_time: '创建时间',
start_time: '数据启始时间',
end_time: '数据结束时间',
}
const checkDeviceList = ref<string[]>([])
@ -463,7 +465,7 @@ function onOffDeviceTransfer() { @@ -463,7 +465,7 @@ function onOffDeviceTransfer() {
}
.device-item {
@apply w-289 h-160 border border-solid border-[#E0E0E0] rounded-8px p-x-14 p-y-10 flex-col;
@apply w-292 border border-solid border-[#E0E0E0] rounded-8px p-x-14 p-y-10 flex-col;
.device-item-header {
@apply w-full text-black text-18px font-500 flex items-center justify-between;

2
src/views/stationData/type.ts

@ -21,6 +21,8 @@ export interface IOfflineDevice { @@ -21,6 +21,8 @@ export interface IOfflineDevice {
site_id: string
status: number
type: string
start_time: string
end_time: string
}
export type IDevice = IOnlineDevice | IOfflineDevice

6
src/views/taskList/index.vue

@ -89,10 +89,10 @@ const taskMode = [{ @@ -89,10 +89,10 @@ const taskMode = [{
const tableCol = [
{ label: '任务ID', prop: 'id', minWidth: '10%' },
{ label: '站点', prop: 'site', minWidth: '16%' },
{ label: '任务类型', prop: 'mode', minWidth: '10%' },
{ label: '站点', prop: 'site', minWidth: '10%' },
{ label: '任务类型', prop: 'mode', minWidth: '8%' },
{ label: '任务状态', prop: 'status', minWidth: '10%' },
{ label: '创建时间', prop: 'startTime', minWidth: '10%' },
{ label: '创建时间', prop: 'startTime', minWidth: '12%' },
{ label: '任务详情', prop: 'info', minWidth: '20%' },
]

Loading…
Cancel
Save