|
|
|
@ -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, |
|
|
|
|