联调电镀数据页面
This commit is contained in:
@@ -150,3 +150,4 @@ export function getRawData(data?: any) {
|
|||||||
data
|
data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
const dataProcessing = (arr: any[]) => {
|
const dataProcessing = (arr: any[]) => {
|
||||||
return arr
|
return arr
|
||||||
.filter(item => typeof item === 'number' || (typeof item === 'string' && !isNaN(parseFloat(item))))
|
.filter(item => typeof item === 'number' || (typeof item === 'string' && !isNaN(parseFloat(item))))
|
||||||
@@ -258,6 +257,32 @@ export const completeTimeSeries = (rawData: string[][]): (string | null)[][] =>
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 补首尾边界:首日 00:00:00、末日 23:59:59
|
||||||
|
const createPadItem = (timeStr: string): (string | null | undefined)[] => {
|
||||||
|
const result: (string | null | undefined)[] = [timeStr, '/']
|
||||||
|
if (template.length > 2) result.push(template[2])
|
||||||
|
if (template.length > 3) result.push(template[3])
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
const firstDate = new Date(completedData[0][0] as string)
|
||||||
|
const dayStartStr = formatTime(
|
||||||
|
new Date(firstDate.getFullYear(), firstDate.getMonth(), firstDate.getDate(), 0, 0, 0)
|
||||||
|
)
|
||||||
|
|
||||||
|
const lastDate = new Date(completedData[completedData.length - 1][0] as string)
|
||||||
|
const dayEndStr = formatTime(new Date(lastDate.getFullYear(), lastDate.getMonth(), lastDate.getDate(), 23, 59, 59))
|
||||||
|
|
||||||
|
const firstTimeStr = formatTime(new Date(completedData[0][0] as string))
|
||||||
|
if (firstTimeStr !== dayStartStr) {
|
||||||
|
completedData.unshift(createPadItem(dayStartStr))
|
||||||
|
}
|
||||||
|
|
||||||
|
const lastTimeStr = formatTime(new Date(completedData[completedData.length - 1][0] as string))
|
||||||
|
if (lastTimeStr !== dayEndStr) {
|
||||||
|
completedData.push(createPadItem(dayEndStr))
|
||||||
|
}
|
||||||
|
|
||||||
return completedData
|
return completedData
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -245,10 +245,10 @@ const setEchart = () => {
|
|||||||
for (let j in phaseList) {
|
for (let j in phaseList) {
|
||||||
color.push(j == 'A' ? '#DAA520' : j == 'B' ? '#2E8B57' : j == 'C' ? '#A52a2a' : '#0000CC')
|
color.push(j == 'A' ? '#DAA520' : j == 'B' ? '#2E8B57' : j == 'C' ? '#A52a2a' : '#0000CC')
|
||||||
legend.push(
|
legend.push(
|
||||||
j == 'M' ? k : j == 'A' ? `A相_${k}` : j == 'B' ? `B相_${k}` : j == 'C' ? `C相_${k}` : j
|
j == 'T' ? k : j == 'A' ? `A相_${k}` : j == 'B' ? `B相_${k}` : j == 'C' ? `C相_${k}` : j
|
||||||
)
|
)
|
||||||
series.push({
|
series.push({
|
||||||
name: j == 'M' ? k : j == 'A' ? `A相_${k}` : j == 'B' ? `B相_${k}` : j == 'C' ? `C相_${k}` : j,
|
name: j == 'T' ? k : j == 'A' ? `A相_${k}` : j == 'B' ? `B相_${k}` : j == 'C' ? `C相_${k}` : j,
|
||||||
symbol: 'none',
|
symbol: 'none',
|
||||||
smooth: true,
|
smooth: true,
|
||||||
type: 'line',
|
type: 'line',
|
||||||
|
|||||||
@@ -130,6 +130,7 @@
|
|||||||
:showSearch="false"
|
:showSearch="false"
|
||||||
v-if="
|
v-if="
|
||||||
(dataSet.indexOf('_trenddata') == -1 &&
|
(dataSet.indexOf('_trenddata') == -1 &&
|
||||||
|
dataSet.indexOf('_kilowattHour') == -1 &&
|
||||||
dataSet.indexOf('_realtimedata') == -1 &&
|
dataSet.indexOf('_realtimedata') == -1 &&
|
||||||
dataSet.indexOf('_event') == -1) ||
|
dataSet.indexOf('_event') == -1) ||
|
||||||
realTimeFlag
|
realTimeFlag
|
||||||
@@ -297,6 +298,7 @@
|
|||||||
:style="{ height: tableHeight }"
|
:style="{ height: tableHeight }"
|
||||||
v-if="
|
v-if="
|
||||||
dataSet.indexOf('_trenddata') == -1 &&
|
dataSet.indexOf('_trenddata') == -1 &&
|
||||||
|
dataSet.indexOf('_kilowattHour') == -1 &&
|
||||||
dataSet.indexOf('_realtimedata') == -1 &&
|
dataSet.indexOf('_realtimedata') == -1 &&
|
||||||
dataSet.indexOf('_event') == -1 &&
|
dataSet.indexOf('_event') == -1 &&
|
||||||
tableData.length != 0
|
tableData.length != 0
|
||||||
@@ -482,6 +484,10 @@
|
|||||||
<div style="height: calc(100vh - 340px)" v-if="dataSet.indexOf('_trenddata') != -1">
|
<div style="height: calc(100vh - 340px)" v-if="dataSet.indexOf('_trenddata') != -1">
|
||||||
<Trend ref="trendRef" :TrendList="TrendList"></Trend>
|
<Trend ref="trendRef" :TrendList="TrendList"></Trend>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- 电镀数据 -->
|
||||||
|
<div style="height: calc(100vh - 340px)" v-if="dataSet.indexOf('_kilowattHour') != -1">
|
||||||
|
<electroplating ref="electroplatingRef" :TrendList="TrendList"></electroplating>
|
||||||
|
</div>
|
||||||
<!-- 实时数据 -->
|
<!-- 实时数据 -->
|
||||||
<div
|
<div
|
||||||
:style="`height: calc(100vh - (${sonTab == 1 ? '378px' : sonTab == 2 ? '340px' : '425px'}))`"
|
:style="`height: calc(100vh - (${sonTab == 1 ? '378px' : sonTab == 2 ? '340px' : '425px'}))`"
|
||||||
@@ -579,6 +585,7 @@ import { ElMessage } from 'element-plus'
|
|||||||
import DatePicker from '@/components/form/datePicker/index.vue'
|
import DatePicker from '@/components/form/datePicker/index.vue'
|
||||||
import Trend from './tabs/trend.vue' //趋势数据
|
import Trend from './tabs/trend.vue' //趋势数据
|
||||||
import realTime from './tabs/realtime.vue' //实时数据-主界面
|
import realTime from './tabs/realtime.vue' //实时数据-主界面
|
||||||
|
import electroplating from './tabs/electroplating.vue' //电镀数据-主界面
|
||||||
import realTrend from './tabs/components/realtrend.vue' //实时数据-实时趋势
|
import realTrend from './tabs/components/realtrend.vue' //实时数据-实时趋势
|
||||||
import operatingTrend from './tabs/operatingTrend.vue' //运行趋势
|
import operatingTrend from './tabs/operatingTrend.vue' //运行趋势
|
||||||
import harmonicSpectrum from './tabs/components/harmonicSpectrum.vue' //实时数据-谐波频谱子页面
|
import harmonicSpectrum from './tabs/components/harmonicSpectrum.vue' //实时数据-谐波频谱子页面
|
||||||
@@ -687,6 +694,7 @@ const volConTypeList = dictData.getBasicData('Dev_Connect')
|
|||||||
const realTrendRef = ref()
|
const realTrendRef = ref()
|
||||||
const txtContent = ref('')
|
const txtContent = ref('')
|
||||||
const operatingTrendRef = ref()
|
const operatingTrendRef = ref()
|
||||||
|
const electroplatingRef = ref()
|
||||||
const changeTrendType = (val: any) => {
|
const changeTrendType = (val: any) => {
|
||||||
trendDataTime.value = ''
|
trendDataTime.value = ''
|
||||||
activeTrendName.value = val * 1
|
activeTrendName.value = val * 1
|
||||||
@@ -932,6 +940,10 @@ const nodeClick = async (e: anyObj, node: any) => {
|
|||||||
if (item.type === 'trenddata') {
|
if (item.type === 'trenddata') {
|
||||||
item.id = item.id + '_trenddata'
|
item.id = item.id + '_trenddata'
|
||||||
}
|
}
|
||||||
|
//电镀数据
|
||||||
|
if (item.type === 'kilowattHour') {
|
||||||
|
item.id = item.id + '_kilowattHour'
|
||||||
|
}
|
||||||
//实时数据
|
//实时数据
|
||||||
if (item.type === 'realtimedata') {
|
if (item.type === 'realtimedata') {
|
||||||
item.id = item.id + '_realtimedata'
|
item.id = item.id + '_realtimedata'
|
||||||
@@ -1257,6 +1269,26 @@ const handleClick = async (tab?: any) => {
|
|||||||
tableLoading.value = false
|
tableLoading.value = false
|
||||||
}, 0)
|
}, 0)
|
||||||
}
|
}
|
||||||
|
//电镀数据
|
||||||
|
if (dataSet.value.includes('_kilowattHour')) {
|
||||||
|
let obj = {
|
||||||
|
devId: deviceId.value, //e.id
|
||||||
|
lineId: lineId.value, //e.pid
|
||||||
|
type: 4,
|
||||||
|
list: [
|
||||||
|
{
|
||||||
|
lineId: lineId.value,
|
||||||
|
devId: dataSet.value.replace('_kilowattHour', '')
|
||||||
|
}
|
||||||
|
]
|
||||||
|
// startTime: datePickerRef.value && datePickerRef.value.timeValue[0],
|
||||||
|
// endTime: datePickerRef.value && datePickerRef.value.timeValue[1]
|
||||||
|
}
|
||||||
|
setTimeout(() => {
|
||||||
|
electroplatingRef.value && electroplatingRef.value.getTrendRequest(obj)
|
||||||
|
tableLoading.value = false
|
||||||
|
}, 0)
|
||||||
|
}
|
||||||
//查询实时数据
|
//查询实时数据
|
||||||
if (dataSet.value.includes('_realtimedata')) {
|
if (dataSet.value.includes('_realtimedata')) {
|
||||||
tableLoading.value = true
|
tableLoading.value = true
|
||||||
|
|||||||
842
src/views/govern/device/control/tabs/electroplating.vue
Normal file
842
src/views/govern/device/control/tabs/electroplating.vue
Normal file
@@ -0,0 +1,842 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<!-- 历史趋势数据 -->
|
||||||
|
<div>
|
||||||
|
<TableHeader ref="tableHeaderRef" :showSearch="false" @selectChange="selectChange">
|
||||||
|
<template v-slot:select>
|
||||||
|
<el-form-item>
|
||||||
|
<DatePicker ref="datePickerRef"></DatePicker>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="电度指标" label-width="80px">
|
||||||
|
<el-select style="width: 200px" multiple :multiple-limit="3" collapse-tags filterable
|
||||||
|
collapse-tags-tooltip v-model="searchForm.index" placeholder="请选择统计指标"
|
||||||
|
@change="onIndexChange($event)">
|
||||||
|
<el-option v-for="item in indexOptions" :key="item.id" :label="item.name"
|
||||||
|
:value="item.id"></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-radio-group v-model="searchForm.dataLevel" :disabled="props?.TrendList?.lineType != 1"
|
||||||
|
@change="init()">
|
||||||
|
<el-radio-button label="一次值" value="Primary" />
|
||||||
|
<el-radio-button label="二次值" value="Secondary" />
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<!-- <el-form-item label="统计类型">
|
||||||
|
<el-select style="min-width: 120px !important" placeholder="请选择" v-model="searchForm.valueType">
|
||||||
|
<el-option value="max" label="最大值"></el-option>
|
||||||
|
<el-option value="min" label="最小值"></el-option>
|
||||||
|
<el-option value="avg" label="平均值"></el-option>
|
||||||
|
<el-option value="cp95" label="cp95"></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item> -->
|
||||||
|
<el-form-item>
|
||||||
|
<div class="history_count" v-for="(item, index) in countData" :key="index"
|
||||||
|
v-show="item.countOptions.length != 0">
|
||||||
|
<span class="mr12">
|
||||||
|
{{ item.name.includes('次数') ? item.name : item.name + '谐波次数' }}
|
||||||
|
</span>
|
||||||
|
<el-select v-model="item.count" @change="onCountChange($event, index)" placeholder="请选择谐波次数"
|
||||||
|
style="width: 100px" class="mr20">
|
||||||
|
<el-option v-for="vv in item.countOptions" :key="vv"
|
||||||
|
:label="item.name.includes('间谐波') ? vv - 0.5 : vv" :value="vv"></el-option>
|
||||||
|
</el-select>
|
||||||
|
</div>
|
||||||
|
</el-form-item>
|
||||||
|
</template>
|
||||||
|
<template #operation>
|
||||||
|
<el-button type="primary" icon="el-icon-Search" @click="init()">查询</el-button>
|
||||||
|
<el-button :type="timeControl ? 'primary' : ''" icon="el-icon-Sort" @click="setTimeControl">
|
||||||
|
缺失数据
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</TableHeader>
|
||||||
|
</div>
|
||||||
|
<div class="history_chart" :style="pageHeight" v-loading="loading">
|
||||||
|
<MyEchart ref="historyChart" :options="echartsData" v-if="showEchart" />
|
||||||
|
<el-empty :style="pageHeight" v-else description="暂无数据" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { mainHeight } from '@/utils/layout'
|
||||||
|
import { queryByCode, queryCsDictTree } from '@/api/system-boot/dictTree'
|
||||||
|
import { ref, onMounted, watch } from 'vue'
|
||||||
|
import MyEchart from '@/components/echarts/MyEchart.vue'
|
||||||
|
import { useDictData } from '@/stores/dictData'
|
||||||
|
import { queryStatistical } from '@/api/system-boot/csstatisticalset'
|
||||||
|
import { yMethod, exportCSV, completeTimeSeries } from '@/utils/echartMethod'
|
||||||
|
import TableHeader from '@/components/table/header/index.vue'
|
||||||
|
import { getTabsDataByType } from '@/api/cs-device-boot/EquipmentDelivery'
|
||||||
|
import DatePicker from '@/components/form/datePicker/index.vue'
|
||||||
|
import { color } from '@/components/echarts/color'
|
||||||
|
import { ElMessage } from 'element-plus'
|
||||||
|
const dictData = useDictData()
|
||||||
|
defineOptions({
|
||||||
|
// name: 'govern/device/control'
|
||||||
|
})
|
||||||
|
const props = defineProps({
|
||||||
|
TrendList: {
|
||||||
|
type: Array
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// console.log("🚀 ~ props:", props.TrendList)
|
||||||
|
const showEchart = ref(true)
|
||||||
|
//电压等级
|
||||||
|
const voltageLevelList = dictData.getBasicData('Dev_Voltage_Stand')
|
||||||
|
//接线方式
|
||||||
|
const volConTypeList = dictData.getBasicData('Dev_Connect')
|
||||||
|
const num = ref(0)
|
||||||
|
const timeControl = ref(false)
|
||||||
|
//值类型
|
||||||
|
const pageHeight = ref(mainHeight(290))
|
||||||
|
const loading = ref(true)
|
||||||
|
const searchForm: any = ref({})
|
||||||
|
const tableHeaderRef = ref()
|
||||||
|
const typeOptions = [
|
||||||
|
{
|
||||||
|
name: '平均值',
|
||||||
|
id: 'avg'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '最大值',
|
||||||
|
id: 'max'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '最小值',
|
||||||
|
id: 'min'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'CP95值',
|
||||||
|
id: 'cp95'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
searchForm.value = {
|
||||||
|
index: [],
|
||||||
|
type: typeOptions[0].id,
|
||||||
|
count: '',
|
||||||
|
searchBeginTime: '',
|
||||||
|
searchEndTime: '',
|
||||||
|
dataLevel: 'Primary',
|
||||||
|
valueType: 'avg'
|
||||||
|
}
|
||||||
|
//统计指标
|
||||||
|
const indexOptions: any = ref([])
|
||||||
|
//谐波次数
|
||||||
|
const countOptions: any = ref([])
|
||||||
|
// Harmonic_Type
|
||||||
|
// portable-harmonic
|
||||||
|
const legendDictList: any = ref([])
|
||||||
|
queryByCode('Kilowatt_Hour').then(res => {
|
||||||
|
queryCsDictTree(res.data.id).then(item => {
|
||||||
|
//排序
|
||||||
|
indexOptions.value = item.data.sort((a: any, b: any) => {
|
||||||
|
return a.sort - b.sort
|
||||||
|
})
|
||||||
|
searchForm.value.index[0] = indexOptions.value[0].id
|
||||||
|
})
|
||||||
|
queryStatistical(res.data.id).then(vv => {
|
||||||
|
legendDictList.value = vv.data
|
||||||
|
indexOptions.value.map((item: any, index: any) => {
|
||||||
|
if (!countDataCopy.value[index]) {
|
||||||
|
countDataCopy.value[index] = {
|
||||||
|
index: item.id,
|
||||||
|
countOptions: [],
|
||||||
|
count: [],
|
||||||
|
name: indexOptions.value.find((vv: any) => {
|
||||||
|
return vv.id == item.id
|
||||||
|
})?.name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
legendDictList.value?.selectedList?.map((vv: any, vvs: any) => {
|
||||||
|
//查找相等的指标
|
||||||
|
if (item.id == vv.dataType) {
|
||||||
|
vv.eleEpdPqdVOS.map((kk: any, kks: any) => {
|
||||||
|
if (kk.harmStart && kk.harmEnd) {
|
||||||
|
range(0, 0, 0)
|
||||||
|
|
||||||
|
// if (kk.showName == '间谐波电压含有率') {
|
||||||
|
// countDataCopy.value[index].countOptions = range(kk.harmStart, kk.harmEnd, 1).map(
|
||||||
|
// (item: any) => {
|
||||||
|
// return item - 0.5
|
||||||
|
// }
|
||||||
|
// )
|
||||||
|
// } else {
|
||||||
|
countDataCopy.value[index].countOptions = range(kk.harmStart, kk.harmEnd, 1)
|
||||||
|
// }
|
||||||
|
if (!countDataCopy.value[index].count || countDataCopy.value[index].count.length == 0) {
|
||||||
|
countDataCopy.value[index].count = countDataCopy.value[index].countOptions[0]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
init()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
const chartsList = ref<any>([])
|
||||||
|
const activeName: any = ref()
|
||||||
|
const deviceData: any = ref([])
|
||||||
|
//历史趋势devId
|
||||||
|
const historyDevId: any = ref('')
|
||||||
|
const chartTitle: any = ref('')
|
||||||
|
const echartsData = ref<any>(null)
|
||||||
|
//加载echarts图表
|
||||||
|
//历史趋势数据
|
||||||
|
const historyDataList: any = ref([])
|
||||||
|
const range = (start: any, end: any, step: any) => {
|
||||||
|
return Array.from({ length: (end - start) / step + 1 }, (_, i) => start + i * step)
|
||||||
|
}
|
||||||
|
//获取请求趋势数据参数
|
||||||
|
const trendRequestData = ref()
|
||||||
|
const getTrendRequest = (val: any) => {
|
||||||
|
trendRequestData.value = val
|
||||||
|
// init()
|
||||||
|
}
|
||||||
|
//初始化趋势图
|
||||||
|
const headerRef = ref()
|
||||||
|
const datePickerRef = ref()
|
||||||
|
const lineStyle = [{ type: 'solid' }, { type: 'dashed' }, { type: 'dotted' }]
|
||||||
|
const init = async () => {
|
||||||
|
loading.value = true
|
||||||
|
// 选择指标的时候切换legend内容和data数据
|
||||||
|
let list: any = []
|
||||||
|
echartsData.value = {}
|
||||||
|
legendDictList.value?.selectedList?.map((item: any) => {
|
||||||
|
searchForm.value.index.map((vv: any) => {
|
||||||
|
if (item.dataType == vv) {
|
||||||
|
list.push(item.eleEpdPqdVOS)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
//颜色数组
|
||||||
|
const colorList = color
|
||||||
|
//选择的指标使用方法处理
|
||||||
|
formatCountOptions()
|
||||||
|
//查询历史趋势
|
||||||
|
historyDataList.value = []
|
||||||
|
chartTitle.value = ''
|
||||||
|
|
||||||
|
searchForm.value.index.map((item: any, indexs: any) => {
|
||||||
|
indexOptions.value.map((vv: any) => {
|
||||||
|
if (vv.id == item) {
|
||||||
|
chartTitle.value += indexs == searchForm.value.index.length - 1 ? vv.name : vv.name + '/'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
let lists: any = []
|
||||||
|
let frequencys: any = null
|
||||||
|
countData.value.map((item: any, index: any) => {
|
||||||
|
if (item.name.includes('间谐波电压')) {
|
||||||
|
frequencys = item.count //+ 0.5
|
||||||
|
} else {
|
||||||
|
frequencys = item.count
|
||||||
|
}
|
||||||
|
lists[index] = {
|
||||||
|
statisticalId: item.index,
|
||||||
|
frequencys: frequencys && frequencys.length != 0 ? [frequencys] : []
|
||||||
|
}
|
||||||
|
})
|
||||||
|
let obj = {
|
||||||
|
...trendRequestData.value,
|
||||||
|
list: lists,
|
||||||
|
// valueType: searchForm.value.type,
|
||||||
|
dataLevel: searchForm.value.dataLevel,
|
||||||
|
// valueType: searchForm.value.valueType,
|
||||||
|
startTime: datePickerRef.value && datePickerRef.value.timeValue[0],
|
||||||
|
endTime: datePickerRef.value && datePickerRef.value.timeValue[1]
|
||||||
|
}
|
||||||
|
if (searchForm.value.index.length == 0) {
|
||||||
|
ElMessage.warning('请选择统计指标')
|
||||||
|
loading.value = false
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (obj.devId && obj.list.length != 0) {
|
||||||
|
try {
|
||||||
|
showEchart.value = true
|
||||||
|
await getTabsDataByType(obj)
|
||||||
|
.then((res: any) => {
|
||||||
|
if (res.code == 'A0000') {
|
||||||
|
if (res.data.length == 0) {
|
||||||
|
loading.value = false
|
||||||
|
showEchart.value = false
|
||||||
|
return
|
||||||
|
}
|
||||||
|
historyDataList.value = res.data
|
||||||
|
chartsList.value = JSON.parse(JSON.stringify(res.data))
|
||||||
|
loading.value = false
|
||||||
|
setEchart()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
loading.value = false
|
||||||
|
})
|
||||||
|
} catch (error) {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const setEchart = () => {
|
||||||
|
loading.value = true
|
||||||
|
echartsData.value = {}
|
||||||
|
//icon图标替换legend图例
|
||||||
|
|
||||||
|
// y轴单位数组
|
||||||
|
let unitList: any = []
|
||||||
|
|
||||||
|
let groupedData = chartsList.value.reduce((acc: any, item: any) => {
|
||||||
|
let key = ''
|
||||||
|
if (item.phase == null) {
|
||||||
|
key = item.unit
|
||||||
|
} else {
|
||||||
|
key = item.anotherName
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!acc[key]) {
|
||||||
|
acc[key] = []
|
||||||
|
}
|
||||||
|
acc[key].push(item)
|
||||||
|
return acc
|
||||||
|
}, {})
|
||||||
|
let result = Object.values(groupedData)
|
||||||
|
// console.log("🚀 ~ .then ~ result:", result)
|
||||||
|
// console.log("🚀 ~ .then ~ result:", result)
|
||||||
|
if (chartsList.value.length > 0) {
|
||||||
|
unitList = result.map((item: any) => {
|
||||||
|
return item[0].unit
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
echartsData.value = {
|
||||||
|
legend: {
|
||||||
|
itemWidth: 20,
|
||||||
|
itemHeight: 20,
|
||||||
|
itemStyle: { opacity: 0 }, //去圆点
|
||||||
|
type: 'scroll', // 开启滚动分页
|
||||||
|
// orient: 'vertical', // 垂直排列
|
||||||
|
top: 5,
|
||||||
|
right: 70
|
||||||
|
// width: 550,
|
||||||
|
// height: 50
|
||||||
|
},
|
||||||
|
grid: {
|
||||||
|
top: '80px'
|
||||||
|
},
|
||||||
|
tooltip: {
|
||||||
|
axisPointer: {
|
||||||
|
type: 'cross',
|
||||||
|
label: {
|
||||||
|
color: '#fff',
|
||||||
|
fontSize: 16
|
||||||
|
}
|
||||||
|
},
|
||||||
|
textStyle: {
|
||||||
|
color: '#fff',
|
||||||
|
fontStyle: 'normal',
|
||||||
|
opacity: 0.35,
|
||||||
|
fontSize: 14
|
||||||
|
},
|
||||||
|
backgroundColor: 'rgba(0,0,0,0.55)',
|
||||||
|
borderWidth: 0,
|
||||||
|
formatter(params: any) {
|
||||||
|
const xname = params[0].value[0]
|
||||||
|
let str = `${xname}<br>`
|
||||||
|
params.forEach((el: any, index: any) => {
|
||||||
|
let marker = ''
|
||||||
|
|
||||||
|
if (el.value[3] == 'dashed') {
|
||||||
|
for (let i = 0; i < 3; i++) {
|
||||||
|
marker += `<span style="display:inline-block;border: 2px ${el.color} solid;margin-right:5px;width:10px;height:0px;background-color:#ffffff00;"></span>`
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
marker = `<span style="display:inline-block;border: 2px ${el.color} ${el.value[3]};margin-right:5px;width:40px;height:0px;background-color:#ffffff00;"></span>`
|
||||||
|
}
|
||||||
|
let unit = el.value[2] ? el.value[2] : ''
|
||||||
|
str += `${marker}${el.seriesName.split('(')[0]}:${el.value[1]}${unit}
|
||||||
|
<br>`
|
||||||
|
})
|
||||||
|
return str
|
||||||
|
}
|
||||||
|
},
|
||||||
|
color: ['#DAA520', '#2E8B57', '#A52a2a', ...color],
|
||||||
|
xAxis: {
|
||||||
|
type: 'time',
|
||||||
|
axisLabel: {
|
||||||
|
formatter: {
|
||||||
|
day: '{MM}-{dd}',
|
||||||
|
month: '{MM}',
|
||||||
|
year: '{yyyy}'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
yAxis: [{}],
|
||||||
|
toolbox: {
|
||||||
|
featureProps: {
|
||||||
|
myTool1: {
|
||||||
|
show: true,
|
||||||
|
title: '下载csv',
|
||||||
|
icon: 'path://M588.8 551.253333V512H352v39.253333h236.373333z m0 78.933334v-39.253334H352v39.253334h236.373333z m136.533333 78.933333V334.933333l-157.866666-157.866666H273.066667A59.306667 59.306667 0 0 0 213.333333 236.373333v551.253334a59.306667 59.306667 0 0 0 59.306667 59.306666h274.773333v42.666667H853.333333v-180.48zM568.746667 234.666667l100.266666 100.693333h-81.066666a20.053333 20.053333 0 0 1-19.626667-20.053333z m-20.48 573.013333H273.066667a19.2 19.2 0 0 1-17.493334-19.626667V236.373333a19.2 19.2 0 0 1 19.626667-19.626666h256v98.133333a58.88 58.88 0 0 0 58.88 59.306667h96.426667v334.933333h-98.133334v-39.68H352v39.68h196.266667z m100.266666 23.04a37.973333 37.973333 0 0 1-32 15.786667 38.826667 38.826667 0 0 1-32.426666-15.786667 53.76 53.76 0 0 1-10.24-32.853333 42.666667 42.666667 0 0 1 42.666666-47.786667 35.84 35.84 0 0 1 37.546667 29.866667h-12.8a23.893333 23.893333 0 0 0-24.746667-19.2c-17.066667 0-29.013333 14.08-29.013333 35.84s11.52 37.546667 28.586667 37.546666a26.453333 26.453333 0 0 0 26.453333-25.6h12.8a39.253333 39.253333 0 0 1-7.253333 22.186667z m59.733334 15.786667a35.84 35.84 0 0 1-40.106667-34.56H682.666667a23.893333 23.893333 0 0 0 26.88 23.04c12.8 0 22.613333-6.4 22.613333-15.786667s-4.266667-11.52-14.506667-13.653333l-21.333333-5.12c-17.066667-4.266667-24.32-11.52-24.32-23.893334s12.8-26.453333 34.133333-26.453333a31.573333 31.573333 0 0 1 35.413334 30.293333h-13.653334a19.626667 19.626667 0 0 0-22.613333-18.773333c-12.8 0-20.48 5.12-20.48 12.8s5.12 11.093333 17.066667 13.653333l14.933333 2.986667a42.666667 42.666667 0 0 1 20.906667 8.96 23.893333 23.893333 0 0 1 7.68 17.92c-0.426667 17.066667-14.506667 28.16-37.12 28.16z m88.746666 0h-14.506666l-32.426667-92.16h14.08l19.626667 59.733333 6.4 20.053333c0-9.386667 3.413333-12.8 5.546666-20.053333l19.2-59.733333h14.08z',
|
||||||
|
onclick: e => {
|
||||||
|
// console.log("🚀 ~ init ~ echartsData.value:", echartsData.value.options.series.map(item => item.data))
|
||||||
|
|
||||||
|
let list = echartsData.value.options.series?.map((item: any) => item.data)
|
||||||
|
let dataList = list[0]?.map((item: any, index: any) => {
|
||||||
|
let value = [item[0], item[1]]
|
||||||
|
list.forEach((item1: any, index1: any) => {
|
||||||
|
if (index1 > 0) {
|
||||||
|
value.push(item1 && item1[index] ? item1[index][1] : null)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
return value
|
||||||
|
})
|
||||||
|
exportCSV(
|
||||||
|
echartsData.value.options.series.map((item: any) => item.name),
|
||||||
|
dataList,
|
||||||
|
'历史趋势.csv'
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
options: {
|
||||||
|
series: []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// console.log("🚀 ~ unitList.forEach ~ unitList:", unitList)
|
||||||
|
|
||||||
|
if (chartsList.value.length > 0) {
|
||||||
|
let yData: any = []
|
||||||
|
echartsData.value.yAxis = []
|
||||||
|
let setList = [...new Set(unitList)]
|
||||||
|
|
||||||
|
setList.forEach((item: any, index: any) => {
|
||||||
|
if (index > 2) {
|
||||||
|
echartsData.value.grid.right = (index - 1) * 80
|
||||||
|
}
|
||||||
|
yData.push([])
|
||||||
|
let right = {
|
||||||
|
position: 'right',
|
||||||
|
offset: (index - 1) * 80
|
||||||
|
}
|
||||||
|
// console.log("🚀 ~ unitList.forEach ~ right.index:", index)
|
||||||
|
echartsData.value.yAxis.push({
|
||||||
|
name: item,
|
||||||
|
yAxisIndex: index,
|
||||||
|
splitNumber: 5,
|
||||||
|
minInterval: 1,
|
||||||
|
splitLine: {
|
||||||
|
show: false
|
||||||
|
},
|
||||||
|
...(index > 0 ? right : null)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
// console.log("🚀 ~ result.forEach ~ result:", result)
|
||||||
|
// '电压负序分量', '电压正序分量', '电压零序分量'
|
||||||
|
let ABCName = [
|
||||||
|
...new Set(
|
||||||
|
chartsList.value.map((item: any) => {
|
||||||
|
return item.anotherName == '电压负序分量'
|
||||||
|
? '电压不平衡'
|
||||||
|
: item.anotherName == '电压正序分量'
|
||||||
|
? '电压不平衡'
|
||||||
|
: item.anotherName == '电压零序分量'
|
||||||
|
? '电压不平衡'
|
||||||
|
: item.anotherName
|
||||||
|
})
|
||||||
|
)
|
||||||
|
]
|
||||||
|
// console.log("🚀 ~ .then ~ ABCName:", ABCName)
|
||||||
|
result.forEach((item: any, index: any) => {
|
||||||
|
let yMethodList: any = []
|
||||||
|
|
||||||
|
let ABCList = Object.values(
|
||||||
|
item.reduce((acc, item) => {
|
||||||
|
let key = ''
|
||||||
|
if (item.phase == null) {
|
||||||
|
key = item.anotherName
|
||||||
|
} else {
|
||||||
|
key = item.phase
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!acc[key]) {
|
||||||
|
acc[key] = []
|
||||||
|
}
|
||||||
|
acc[key].push(item)
|
||||||
|
return acc
|
||||||
|
}, {})
|
||||||
|
)
|
||||||
|
// console.log("🚀 ~ ABCList.forEach ~ ABCList:", ABCList)
|
||||||
|
|
||||||
|
ABCList.forEach((kk: any) => {
|
||||||
|
let colorName = kk[0].phase?.charAt(0).toUpperCase()
|
||||||
|
let lineS = ABCName.findIndex(
|
||||||
|
item =>
|
||||||
|
item ===
|
||||||
|
(kk[0].anotherName == '电压负序分量'
|
||||||
|
? '电压不平衡'
|
||||||
|
: kk[0].anotherName == '电压正序分量'
|
||||||
|
? '电压不平衡'
|
||||||
|
: kk[0].anotherName == '电压零序分量'
|
||||||
|
? '电压不平衡'
|
||||||
|
: kk[0].anotherName)
|
||||||
|
)
|
||||||
|
|
||||||
|
let seriesList: any = []
|
||||||
|
kk.forEach((cc: any) => {
|
||||||
|
if (cc.statisticalData !== null) {
|
||||||
|
yData[setList.indexOf(kk[0].unit)].push(cc.statisticalData?.toFixed(2))
|
||||||
|
}
|
||||||
|
|
||||||
|
seriesList.push([cc.time, cc.statisticalData?.toFixed(2), cc.unit, lineStyle[lineS].type])
|
||||||
|
})
|
||||||
|
// console.log(kk);
|
||||||
|
|
||||||
|
echartsData.value.options.series.push({
|
||||||
|
name: kk[0].phase ? kk[0].phase + '相' + kk[0].anotherName : kk[0].anotherName,
|
||||||
|
type: 'line',
|
||||||
|
smooth: true,
|
||||||
|
color:
|
||||||
|
colorName == 'A' ? '#DAA520' : colorName == 'B' ? '#2E8B57' : colorName == 'C' ? '#A52a2a' : '',
|
||||||
|
symbol: 'none',
|
||||||
|
// data: seriesList,
|
||||||
|
data: timeControl.value ? completeTimeSeries(seriesList) : seriesList,
|
||||||
|
lineStyle: lineStyle[lineS],
|
||||||
|
yAxisIndex: setList.indexOf(kk[0].unit)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
// let [min, max] = yMethod(yMethodList)
|
||||||
|
// echartsData.value.yAxis[index].min = min
|
||||||
|
// echartsData.value.yAxis[index].max = max
|
||||||
|
})
|
||||||
|
yData.forEach((item: any, index: any) => {
|
||||||
|
let [min, max] = yMethod(item)
|
||||||
|
echartsData.value.yAxis[index].min = min
|
||||||
|
echartsData.value.yAxis[index].max = max
|
||||||
|
})
|
||||||
|
// console.log("🚀 ~ result.forEach ~ echartsData.value:", echartsData.value)
|
||||||
|
}
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
const setTimeControl = () => {
|
||||||
|
timeControl.value = !timeControl.value
|
||||||
|
setEchart()
|
||||||
|
}
|
||||||
|
|
||||||
|
const selectChange = (flag: boolean) => {
|
||||||
|
if (flag) {
|
||||||
|
pageHeight.value = mainHeight(332)
|
||||||
|
} else {
|
||||||
|
pageHeight.value = mainHeight(290)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//导出
|
||||||
|
const historyChart = ref()
|
||||||
|
// const chart: any = ref(null)
|
||||||
|
// chart.value = echarts.init(historyChart.value)
|
||||||
|
const handleExport = async () => {
|
||||||
|
const planCsv = ref('')
|
||||||
|
const chartsCsv = ref('')
|
||||||
|
|
||||||
|
if (deviceData.value.records && deviceData.value.records.length != 0) {
|
||||||
|
let csv = '',
|
||||||
|
obj: any = {}
|
||||||
|
obj = deviceData.value.records.find((item: any) => {
|
||||||
|
return item.id == activeName.value
|
||||||
|
})
|
||||||
|
if (obj) {
|
||||||
|
//测试是否与变量名长度有关系
|
||||||
|
let cell1 = deviceData.value.itemName,
|
||||||
|
cell2 = deviceData.value.describe,
|
||||||
|
cell3 = obj?.itemName,
|
||||||
|
cell4 = obj?.statisticalInterval,
|
||||||
|
cell5 = voltageLevelList.find(vv => {
|
||||||
|
return vv.id == obj.voltageLevel
|
||||||
|
})?.name,
|
||||||
|
cell6 = volConTypeList.find(vv => {
|
||||||
|
return vv.id == obj.volConType
|
||||||
|
})?.name,
|
||||||
|
cell7 = obj.capacitySscmin,
|
||||||
|
cell8 = obj.capacitySi,
|
||||||
|
cell9 = obj.capacitySscb,
|
||||||
|
cell10 = obj.capacitySt,
|
||||||
|
cell11 = obj.pt && obj.pt1 ? obj.pt / obj.pt1 + '\b' : '/',
|
||||||
|
cell12 = obj.ct && obj.ct1 ? obj.ct / obj.ct1 + '\b' : '/',
|
||||||
|
cell13 = obj.startTime ? obj.startTime : '/',
|
||||||
|
cell14 = obj.endTime ? obj.endTime : '/',
|
||||||
|
cell15 = obj.location
|
||||||
|
csv = `方案测试项信息,
|
||||||
|
方案名称, ${cell1},
|
||||||
|
方案描述, ${cell2},
|
||||||
|
测试项名称, ${cell2},
|
||||||
|
测量间隔, ${cell4 + '分钟'},
|
||||||
|
电压等级, ${cell5},
|
||||||
|
接线方式, ${cell6},
|
||||||
|
最小短路容量, ${cell7 + 'MVA'},
|
||||||
|
用户协议容量, ${cell8 + 'MVA'},
|
||||||
|
基准短路容量, ${cell9 + 'MVA'},
|
||||||
|
供电设备容量, ${cell10 + 'MVA'},
|
||||||
|
PT变比, ${cell11},
|
||||||
|
CT变比, ${cell12},
|
||||||
|
起始时间, ${cell13},
|
||||||
|
结束时间, ${cell14},
|
||||||
|
监测位置, ${cell15}\n,
|
||||||
|
`
|
||||||
|
planCsv.value = csv
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (historyDataList.value.length != 0) {
|
||||||
|
let xAxis: any = []
|
||||||
|
let timeList: any = []
|
||||||
|
historyDataList.value.map((item: any) => {
|
||||||
|
timeList.push(item.time)
|
||||||
|
})
|
||||||
|
xAxis = timeList.sort((a: any, b: any) => {
|
||||||
|
return (
|
||||||
|
a.replace('-', '').replace('-', '').replace(' ', '').replace(':', '').replace(':', '') -
|
||||||
|
0 -
|
||||||
|
(b.replace('-', '').replace('-', '').replace(' ', '').replace(':', '').replace(':', '') - 0)
|
||||||
|
)
|
||||||
|
})
|
||||||
|
xAxis = Array.from(new Set(xAxis))
|
||||||
|
// 使用这个函数转换数据为CSV格式
|
||||||
|
let csv: any = ''
|
||||||
|
const list = echartsData.value.options.series
|
||||||
|
csv = convertToCSV([], [])
|
||||||
|
chartsCsv.value = csv
|
||||||
|
// 如果你想提供下载链接
|
||||||
|
// const blob = new Blob([csv], { type: 'text/csv;charset=utf-8;' })
|
||||||
|
// const link = document.createElement('a')
|
||||||
|
// link.href = URL.createObjectURL(blob)
|
||||||
|
// link.download = '历史趋势.csv'
|
||||||
|
// link.click()
|
||||||
|
function convertToCSV(data: any, key: any) {
|
||||||
|
// 添加列头
|
||||||
|
let title = '统计时间,'
|
||||||
|
list.map((item: any, index: any) => {
|
||||||
|
index == list.length - 1 ? (title += `${item.name}\n`) : (title += `${item.name},`)
|
||||||
|
})
|
||||||
|
let csv = ''
|
||||||
|
csv = title
|
||||||
|
// 遍历数据并添加到CSV字符串中
|
||||||
|
const listLength = list.length
|
||||||
|
list[0].data.map((vv: any, indexs: any) => {
|
||||||
|
let strs = '',
|
||||||
|
count = null
|
||||||
|
list.map((item: any, index: any) => {
|
||||||
|
if (index == 0) {
|
||||||
|
count = index
|
||||||
|
}
|
||||||
|
index == list.length - 1
|
||||||
|
? (strs += list[index].data[indexs])
|
||||||
|
: (strs += list[index].data[indexs] + ',')
|
||||||
|
})
|
||||||
|
if (count == 0 && xAxis[indexs]) {
|
||||||
|
csv += '\u200B' + `${xAxis[indexs]},` + strs + '\n'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return csv
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let csvs = ''
|
||||||
|
if (chartsCsv.value) {
|
||||||
|
csvs = planCsv.value + '历史趋势数据,\n\n' + chartsCsv.value
|
||||||
|
} else {
|
||||||
|
csvs = planCsv.value
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果你想提供下载链接
|
||||||
|
const blob = new Blob([csvs], { type: 'text/csv;charset=utf-8;' })
|
||||||
|
const link = document.createElement('a')
|
||||||
|
link.href = URL.createObjectURL(blob)
|
||||||
|
let obj = deviceData.value.records.find((item: any) => {
|
||||||
|
return item.id == activeName.value
|
||||||
|
})
|
||||||
|
const date = window.XEUtils.toDateString(new Date(), 'yyyyMMdd HHmmss').replace(' ', '_')
|
||||||
|
link.download = `${deviceData.value.itemName}_${obj?.itemName}_${date}.csv`
|
||||||
|
link.click()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const countData: any = ref([])
|
||||||
|
const countDataCopy: any = ref([])
|
||||||
|
|
||||||
|
//根据选择的指标处理谐波次数
|
||||||
|
const formatCountOptions = () => {
|
||||||
|
countData.value = []
|
||||||
|
if (searchForm.value.index.length != 0) {
|
||||||
|
searchForm.value.index.forEach((item: any, index: any) => {
|
||||||
|
countDataCopy.value.forEach((vv: any, vvs: any) => {
|
||||||
|
if (vv.index == item) {
|
||||||
|
countData.value.push(vv)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
// list.map((item: any, index: any) => {
|
||||||
|
// if (!countData.value[index]) {
|
||||||
|
// countData.value[index] = {
|
||||||
|
// index: item,
|
||||||
|
// countOptions: [],
|
||||||
|
// count: '',
|
||||||
|
// name: indexOptions.value.find((vv: any) => {
|
||||||
|
// return vv.id == item
|
||||||
|
// })?.name
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// legendDictList.value?.selectedList?.map((vv: any, vvs: any) => {
|
||||||
|
// //查找相等的指标
|
||||||
|
// if (item == vv.dataType) {
|
||||||
|
// vv.eleEpdPqdVOS.map((kk: any, kks: any) => {
|
||||||
|
// if (kk.harmStart && kk.harmEnd) {
|
||||||
|
// range(0, 0, 0)
|
||||||
|
// countData.value[index].countOptions = range(kk.harmStart, kk.harmEnd, 1)
|
||||||
|
// if (kk.showName == '间谐波电压含有率') {
|
||||||
|
// countData.value[index].countOptions = range(kk.harmStart, kk.harmEnd, 1).map(
|
||||||
|
// (item: any) => {
|
||||||
|
// return item - 0.5
|
||||||
|
// }
|
||||||
|
// )
|
||||||
|
// } else {
|
||||||
|
// countData.value[index].countOptions = range(kk.harmStart, kk.harmEnd, 1)
|
||||||
|
// }
|
||||||
|
// //添加默认值
|
||||||
|
// if (countData.value[index].count.length == 0) {
|
||||||
|
// countData.value[index].count = countData.value[index].countOptions[0]
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// })
|
||||||
|
countData.value.map((item: any, key: any) => {
|
||||||
|
if (item.name == '谐波电流有效值') {
|
||||||
|
item.name = '谐波电流次数'
|
||||||
|
} else if (item.name == '谐波电压含有率') {
|
||||||
|
item.name = '谐波电压次数'
|
||||||
|
} else if (item.name == '间谐波电压含有率') {
|
||||||
|
item.name = '间谐波电压次数'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
setTimeout(() => {
|
||||||
|
tableHeaderRef.value.computedSearchRow()
|
||||||
|
}, 500)
|
||||||
|
}
|
||||||
|
// 判断下拉框是否存在
|
||||||
|
const onCountChange = (val: any, index: any) => {
|
||||||
|
if (val.length == 0) {
|
||||||
|
countData.value[index].count = countData.value[index].countOptions[0]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const flag = ref(true)
|
||||||
|
const onIndexChange = (val: any) => {
|
||||||
|
num.value += 1
|
||||||
|
let pp: any = []
|
||||||
|
indexOptions.value.forEach((item: any) => {
|
||||||
|
const filteredResult = val.filter(vv => item.id == vv)
|
||||||
|
if (filteredResult.length > 0) {
|
||||||
|
pp.push(filteredResult[0])
|
||||||
|
}
|
||||||
|
})
|
||||||
|
searchForm.value.index = pp
|
||||||
|
flag.value = true
|
||||||
|
formatCountOptions()
|
||||||
|
|
||||||
|
// if (val.length == 0) {
|
||||||
|
// searchForm.value.index = [indexOptions.value[0].id]
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
watch(
|
||||||
|
() => searchForm.value.index,
|
||||||
|
(val: any, oldval: any) => {
|
||||||
|
// if (val) {
|
||||||
|
// setTimeout(() => {
|
||||||
|
// formatCountOptions(val)
|
||||||
|
// }, 100)
|
||||||
|
// if (val == 0) {
|
||||||
|
// countData.value = []
|
||||||
|
// }
|
||||||
|
// countData.value.map((item: any, key: any) => {
|
||||||
|
// if (
|
||||||
|
// val.findIndex((vv: any) => {
|
||||||
|
// return vv == item.index
|
||||||
|
// }) == -1
|
||||||
|
// ) {
|
||||||
|
// countData.value.splice(key, 1)
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
deep: true,
|
||||||
|
immediate: true
|
||||||
|
}
|
||||||
|
)
|
||||||
|
onMounted(() => {
|
||||||
|
datePickerRef.value.setInterval(5)
|
||||||
|
})
|
||||||
|
defineExpose({ getTrendRequest })
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.history_header {
|
||||||
|
display: flex;
|
||||||
|
|
||||||
|
// flex-wrap: wrap;
|
||||||
|
#history_select {
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
// justify-content: flex-start;
|
||||||
|
// overflow-x: auto;
|
||||||
|
height: auto;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
|
||||||
|
.el-form-item {
|
||||||
|
flex: none !important;
|
||||||
|
// max-width: 380px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-select {
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// #history_select::-webkit-scrollbar {
|
||||||
|
// width: 0 !important;
|
||||||
|
// display: none !important;
|
||||||
|
// }
|
||||||
|
|
||||||
|
.history_searchBtn {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
margin-top: 3px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.history_chart {
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
// flex: 1;
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history_count {
|
||||||
|
.el-select {
|
||||||
|
min-width: 100px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-select__selected-item) {
|
||||||
|
.is-closable {
|
||||||
|
width: 100px !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-form--inline .el-form-item) {
|
||||||
|
margin-right: 15px !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,475 +1,475 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog class="cn-operate-dialog statistical-type-binding" v-model.trim="dialogVisible" title="绑定指标"
|
<el-dialog class="cn-operate-dialog statistical-type-binding" v-model.trim="dialogVisible" title="绑定指标"
|
||||||
style="width: 1200px" @closed="close">
|
style="width: 1200px" @closed="close">
|
||||||
<el-scrollbar style="padding-right: 0">
|
<el-scrollbar style="padding-right: 0">
|
||||||
<div class="box">
|
<div class="box">
|
||||||
<div class="box-left">
|
<div class="box-left">
|
||||||
<el-input maxlength="32" show-word-limit v-model.trim="searchKey" size="small" placeholder="请输入搜索内容"
|
<el-input maxlength="32" show-word-limit v-model.trim="searchKey" size="small" placeholder="请输入搜索内容"
|
||||||
:suffix-icon="Search" @input="filterTree" style="margin-bottom: 10px"></el-input>
|
:suffix-icon="Search" @input="filterTree" style="margin-bottom: 10px"></el-input>
|
||||||
<el-cascader-panel v-model.trim="fromDataValue" :props="{
|
<el-cascader-panel v-model.trim="fromDataValue" :props="{
|
||||||
multiple: true
|
multiple: true
|
||||||
}" :options="fromData"></el-cascader-panel>
|
}" :options="fromData"></el-cascader-panel>
|
||||||
</div>
|
</div>
|
||||||
<div class="box-center">
|
<div class="box-center">
|
||||||
<el-button type="primary" icon="el-icon-Plus" @click="newGroup">新建分组</el-button>
|
<el-button type="primary" icon="el-icon-Plus" @click="newGroup">新建分组</el-button>
|
||||||
<el-popover v-model.trim="popoverVisible" placement="right" width="400" trigger="click"
|
<el-popover v-model.trim="popoverVisible" placement="right" width="400" trigger="click"
|
||||||
popper-style="width:auto">
|
popper-style="width:auto">
|
||||||
<div class="statistical-type-binding-button-group">
|
<div class="statistical-type-binding-button-group">
|
||||||
<el-button type="primary" style="margin-left: 0" v-for="item in toData"
|
<el-button type="primary" style="margin-left: 0" v-for="item in toData"
|
||||||
@click="leftCheckChange(item)">
|
@click="leftCheckChange(item)">
|
||||||
{{ item.label }}
|
{{ item.label }}
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="toData.length === 0">请先创建分组</div>
|
<div v-if="toData.length === 0">请先创建分组</div>
|
||||||
<template #reference>
|
<template #reference>
|
||||||
<el-button style="margin-left: 0" class="mt20" type="primary" icon="el-icon-ArrowRight">
|
<el-button style="margin-left: 0" class="mt20" type="primary" icon="el-icon-ArrowRight">
|
||||||
向右
|
向右
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-popover>
|
</el-popover>
|
||||||
<el-button style="margin-left: 0" icon="el-icon-ArrowLeft" class="mt20" type="primary"
|
<el-button style="margin-left: 0" icon="el-icon-ArrowLeft" class="mt20" type="primary"
|
||||||
@click="rightCheckChange">
|
@click="rightCheckChange">
|
||||||
向左
|
向左
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="box-right">
|
<div class="box-right">
|
||||||
<el-input maxlength="32" show-word-limit v-model.trim="searchKey1" size="small"
|
<el-input maxlength="32" show-word-limit v-model.trim="searchKey1" size="small"
|
||||||
placeholder="请输入搜索内容" :suffix-icon="Search" @input="filterTree1"
|
placeholder="请输入搜索内容" :suffix-icon="Search" @input="filterTree1"
|
||||||
style="margin-bottom: 10px"></el-input>
|
style="margin-bottom: 10px"></el-input>
|
||||||
<el-cascader-panel v-model.trim="toDataValue" :props="{
|
<el-cascader-panel v-model.trim="toDataValue" :props="{
|
||||||
multiple: true,
|
multiple: true,
|
||||||
checkStrictly: true,
|
checkStrictly: true,
|
||||||
expandTrigger: 'click'
|
expandTrigger: 'click'
|
||||||
}" :options="toData">
|
}" :options="toData">
|
||||||
<template #default="{ node, data }">
|
<template #default="{ node, data }">
|
||||||
<div style="display: flex; align-items: center">
|
<div style="display: flex; align-items: center">
|
||||||
|
|
||||||
<el-tooltip placement="bottom" :hide-after="0">
|
<el-tooltip placement="bottom" :hide-after="0">
|
||||||
<template #content>
|
<template #content>
|
||||||
<span>{{ data.label }}</span>
|
<span>{{ data.label }}</span>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<div class="hide-txt">{{ data.label }}</div>
|
<div class="hide-txt">{{ data.label }}</div>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<template v-if="node.level === 1">
|
<template v-if="node.level === 1">
|
||||||
<div class="ml5">({{ data.children.length }})</div>
|
<div class="ml5">({{ data.children.length }})</div>
|
||||||
<div style="flex: 1"></div>
|
<div style="flex: 1"></div>
|
||||||
<Icon name="el-icon-EditPen" class="ml10" style="cursor: pointer"
|
<Icon name="el-icon-EditPen" class="ml10" style="cursor: pointer"
|
||||||
@click="editGroup(data)"></Icon>
|
@click="editGroup(data)"></Icon>
|
||||||
|
|
||||||
<el-popconfirm title="确定删除该分组吗?" @confirm="dicDeleteGroup(data)">
|
<el-popconfirm title="确定删除该分组吗?" @confirm="dicDeleteGroup(data)">
|
||||||
<template #reference>
|
<template #reference>
|
||||||
<Icon name="el-icon-Delete" class="ml10" style="cursor: pointer"></Icon>
|
<Icon name="el-icon-Delete" class="ml10" style="cursor: pointer"></Icon>
|
||||||
</template>
|
</template>
|
||||||
</el-popconfirm>
|
</el-popconfirm>
|
||||||
|
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-cascader-panel>
|
</el-cascader-panel>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</el-scrollbar>
|
</el-scrollbar>
|
||||||
|
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<span class="dialog-footer">
|
<span class="dialog-footer">
|
||||||
<el-button @click="close">取消</el-button>
|
<el-button @click="close">取消</el-button>
|
||||||
<el-button type="primary" @click="submit">确认</el-button>
|
<el-button type="primary" @click="submit">确认</el-button>
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
<PopupAdd ref="addRef" @over="init(0)"></PopupAdd>
|
<PopupAdd ref="addRef" @over="init(0)"></PopupAdd>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref, inject } from 'vue'
|
import { ref, inject } from 'vue'
|
||||||
import { CascaderValue, ElMessage } from 'element-plus'
|
import { CascaderValue, ElMessage } from 'element-plus'
|
||||||
import { addStatistical, queryStatistical } from '@/api/system-boot/csstatisticalset'
|
import { addStatistical, queryStatistical } from '@/api/system-boot/csstatisticalset'
|
||||||
import { getDictTreeById } from '@/api/system-boot/dictTree'
|
import { getDictTreeById } from '@/api/system-boot/dictTree'
|
||||||
import PopupAdd from './add.vue'
|
import PopupAdd from './add.vue'
|
||||||
import { dicDelete } from '@/api/system-boot/dic'
|
import { dicDelete } from '@/api/system-boot/dic'
|
||||||
import List from '@/views/pms/comptroller/list.vue'
|
import List from '@/views/pms/comptroller/list.vue'
|
||||||
import { Search } from '@element-plus/icons-vue'
|
import { Search } from '@element-plus/icons-vue'
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'govern/setting/statisticalType/binding'
|
name: 'govern/setting/statisticalType/binding'
|
||||||
})
|
})
|
||||||
const addRef = ref()
|
const addRef = ref()
|
||||||
// 统计类型pid
|
// 统计类型pid
|
||||||
const pid = ref('')
|
const pid = ref('')
|
||||||
const dialogVisible = ref(false)
|
const dialogVisible = ref(false)
|
||||||
const popoverVisible = ref(false)
|
const popoverVisible = ref(false)
|
||||||
const fromData = ref<treeData[]>([])
|
const fromData = ref<treeData[]>([])
|
||||||
const fromDataValue = ref<string[]>([])
|
const fromDataValue = ref<string[]>([])
|
||||||
const toData = ref<treeData[]>([])
|
const toData = ref<treeData[]>([])
|
||||||
const toDataValue = ref<string[]>([])
|
const toDataValue = ref<string[]>([])
|
||||||
const init = (val: any) => {
|
const init = (val: any) => {
|
||||||
queryStatistical(pid.value).then(res => {
|
queryStatistical(pid.value).then(res => {
|
||||||
if (val == 0) {
|
if (val == 0) {
|
||||||
fromData.value = []
|
fromData.value = []
|
||||||
fromDataValue.value = []
|
fromDataValue.value = []
|
||||||
toData.value = []
|
toData.value = []
|
||||||
toDataValue.value = []
|
toDataValue.value = []
|
||||||
res.data.unSelectedList.forEach((item: any) => {
|
res.data.unSelectedList.forEach((item: any) => {
|
||||||
const obj = {
|
const obj = {
|
||||||
id: item.dataType,
|
id: item.dataType,
|
||||||
value: item.dataType,
|
value: item.dataType,
|
||||||
pid: 0,
|
pid: 0,
|
||||||
label: item.dataTypeName,
|
label: item.dataTypeName,
|
||||||
children: [] as any[]
|
children: [] as any[]
|
||||||
}
|
}
|
||||||
item.eleEpdPqdVOS.forEach((item2: any) => {
|
item.eleEpdPqdVOS.forEach((item2: any) => {
|
||||||
const obj2 = {
|
const obj2 = {
|
||||||
id: item2.id,
|
id: item2.id,
|
||||||
pid: item.dataType,
|
pid: item.dataType,
|
||||||
value: item2.id,
|
value: item2.id,
|
||||||
label: item2.phase === 'M' ? item2.showName : item2.phase + '相' + item2.showName
|
label: item2.phase === 'T' ? item2.showName : item2.phase + '相' + item2.showName
|
||||||
}
|
}
|
||||||
if (item2.showName) {
|
if (item2.showName) {
|
||||||
obj.children.push(obj2)
|
obj.children.push(obj2)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
fromData.value.push(obj)
|
fromData.value.push(obj)
|
||||||
})
|
})
|
||||||
res.data.selectedList.forEach((item: any) => {
|
res.data.selectedList.forEach((item: any) => {
|
||||||
const obj = {
|
const obj = {
|
||||||
id: item.dataType,
|
id: item.dataType,
|
||||||
value: item.dataType,
|
value: item.dataType,
|
||||||
pid: 0,
|
pid: 0,
|
||||||
label: item.dataTypeName,
|
label: item.dataTypeName,
|
||||||
children: [] as any[]
|
children: [] as any[]
|
||||||
}
|
}
|
||||||
item.eleEpdPqdVOS.forEach((item2: any) => {
|
item.eleEpdPqdVOS.forEach((item2: any) => {
|
||||||
const obj2 = {
|
const obj2 = {
|
||||||
id: item2.id,
|
id: item2.id,
|
||||||
pid: item2.dataType,
|
pid: item2.dataType,
|
||||||
value: item2.id,
|
value: item2.id,
|
||||||
label: item2.phase === 'M' ? item2.showName : item2.phase + '相' + item2.showName
|
label: item2.phase === 'T' ? item2.showName : item2.phase + '相' + item2.showName
|
||||||
}
|
}
|
||||||
if (item2.showName) {
|
if (item2.showName) {
|
||||||
obj.children.push(obj2)
|
obj.children.push(obj2)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
toData.value.push(obj)
|
toData.value.push(obj)
|
||||||
})
|
})
|
||||||
} else if (val == 1) {
|
} else if (val == 1) {
|
||||||
fromData.value = []
|
fromData.value = []
|
||||||
fromDataValue.value = []
|
fromDataValue.value = []
|
||||||
res.data.unSelectedList.forEach((item: any) => {
|
res.data.unSelectedList.forEach((item: any) => {
|
||||||
const obj = {
|
const obj = {
|
||||||
id: item.dataType,
|
id: item.dataType,
|
||||||
value: item.dataType,
|
value: item.dataType,
|
||||||
pid: 0,
|
pid: 0,
|
||||||
label: item.dataTypeName,
|
label: item.dataTypeName,
|
||||||
children: [] as any[]
|
children: [] as any[]
|
||||||
}
|
}
|
||||||
item.eleEpdPqdVOS.forEach((item2: any) => {
|
item.eleEpdPqdVOS.forEach((item2: any) => {
|
||||||
const obj2 = {
|
const obj2 = {
|
||||||
id: item2.id,
|
id: item2.id,
|
||||||
pid: item.dataType,
|
pid: item.dataType,
|
||||||
value: item2.id,
|
value: item2.id,
|
||||||
label: item2.phase === 'M' ? item2.showName : item2.phase + '相' + item2.showName
|
label: item2.phase === 'T' ? item2.showName : item2.phase + '相' + item2.showName
|
||||||
}
|
}
|
||||||
if (item2.showName) {
|
if (item2.showName) {
|
||||||
obj.children.push(obj2)
|
obj.children.push(obj2)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
fromData.value.push(obj)
|
fromData.value.push(obj)
|
||||||
})
|
})
|
||||||
} else if (val == 2) {
|
} else if (val == 2) {
|
||||||
toData.value = []
|
toData.value = []
|
||||||
toDataValue.value = []
|
toDataValue.value = []
|
||||||
res.data.selectedList.forEach((item: any) => {
|
res.data.selectedList.forEach((item: any) => {
|
||||||
const obj = {
|
const obj = {
|
||||||
id: item.dataType,
|
id: item.dataType,
|
||||||
value: item.dataType,
|
value: item.dataType,
|
||||||
pid: 0,
|
pid: 0,
|
||||||
label: item.dataTypeName,
|
label: item.dataTypeName,
|
||||||
children: [] as any[]
|
children: [] as any[]
|
||||||
}
|
}
|
||||||
item.eleEpdPqdVOS.forEach((item2: any) => {
|
item.eleEpdPqdVOS.forEach((item2: any) => {
|
||||||
const obj2 = {
|
const obj2 = {
|
||||||
id: item2.id,
|
id: item2.id,
|
||||||
pid: item2.dataType,
|
pid: item2.dataType,
|
||||||
value: item2.id,
|
value: item2.id,
|
||||||
label: item2.phase === 'M' ? item2.showName : item2.phase + '相' + item2.showName
|
label: item2.phase === 'T' ? item2.showName : item2.phase + '相' + item2.showName
|
||||||
}
|
}
|
||||||
if (item2.showName) {
|
if (item2.showName) {
|
||||||
obj.children.push(obj2)
|
obj.children.push(obj2)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
toData.value.push(obj)
|
toData.value.push(obj)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const searchVisible = ref(false)
|
const searchVisible = ref(false)
|
||||||
const searchKey = ref('')
|
const searchKey = ref('')
|
||||||
//查左边
|
//查左边
|
||||||
const filteredTree = ref([])
|
const filteredTree = ref([])
|
||||||
const filterTree = () => {
|
const filterTree = () => {
|
||||||
filteredTree.value = filterNodes(fromData.value, searchKey.value)
|
filteredTree.value = filterNodes(fromData.value, searchKey.value)
|
||||||
}
|
}
|
||||||
//查右边
|
//查右边
|
||||||
const searchKey1 = ref('')
|
const searchKey1 = ref('')
|
||||||
const filteredTree1 = ref([])
|
const filteredTree1 = ref([])
|
||||||
const filterTree1 = () => {
|
const filterTree1 = () => {
|
||||||
filteredTree1.value = filterNodes1(toData.value, searchKey1.value)
|
filteredTree1.value = filterNodes1(toData.value, searchKey1.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
const filterNodes = (node: any, query: any) => {
|
const filterNodes = (node: any, query: any) => {
|
||||||
if (searchKey.value) {
|
if (searchKey.value) {
|
||||||
const keyword = query.trim().toLowerCase() // 获取搜索关键字并转换为小写
|
const keyword = query.trim().toLowerCase() // 获取搜索关键字并转换为小写
|
||||||
const nodes = node
|
const nodes = node
|
||||||
// 使用递归函数过滤树形数据
|
// 使用递归函数过滤树形数据
|
||||||
const filteredNodes = []
|
const filteredNodes = []
|
||||||
for (const node of nodes) {
|
for (const node of nodes) {
|
||||||
if (node.label.toLowerCase().includes(keyword)) {
|
if (node.label.toLowerCase().includes(keyword)) {
|
||||||
// 如果节点的标签包含关键字,将其添加到结果中
|
// 如果节点的标签包含关键字,将其添加到结果中
|
||||||
filteredNodes.push(node)
|
filteredNodes.push(node)
|
||||||
} else if (node.children && node.children.length > 0) {
|
} else if (node.children && node.children.length > 0) {
|
||||||
// 如果节点有子节点,则递归过滤子节点
|
// 如果节点有子节点,则递归过滤子节点
|
||||||
const filteredChildren: any = filterNodes(node.children, keyword)
|
const filteredChildren: any = filterNodes(node.children, keyword)
|
||||||
if (filteredChildren.length > 0) {
|
if (filteredChildren.length > 0) {
|
||||||
// 如果子节点中有匹配的结果,则添加父节点
|
// 如果子节点中有匹配的结果,则添加父节点
|
||||||
const clonedNode = { ...node, children: filteredChildren }
|
const clonedNode = { ...node, children: filteredChildren }
|
||||||
filteredNodes.push(clonedNode)
|
filteredNodes.push(clonedNode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (fromData.value = filteredNodes)
|
return (fromData.value = filteredNodes)
|
||||||
} else {
|
} else {
|
||||||
init(1)
|
init(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const filterNodes1 = (node: any, query: any) => {
|
const filterNodes1 = (node: any, query: any) => {
|
||||||
if (searchKey1.value) {
|
if (searchKey1.value) {
|
||||||
const result: any = []
|
const result: any = []
|
||||||
node.forEach((node: any) => {
|
node.forEach((node: any) => {
|
||||||
let newNode = { ...node }
|
let newNode = { ...node }
|
||||||
if (node.children) {
|
if (node.children) {
|
||||||
newNode.children = filterNodes1(node.children, query)
|
newNode.children = filterNodes1(node.children, query)
|
||||||
}
|
}
|
||||||
if (newNode.label.includes(query) || (newNode.children && newNode.children.length)) {
|
if (newNode.label.includes(query) || (newNode.children && newNode.children.length)) {
|
||||||
result.push(newNode)
|
result.push(newNode)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return (toData.value = result)
|
return (toData.value = result)
|
||||||
} else {
|
} else {
|
||||||
init(2)
|
init(2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 左侧源数据选中事件
|
// 左侧源数据选中事件
|
||||||
const leftCheckChange = (e: any) => {
|
const leftCheckChange = (e: any) => {
|
||||||
if (fromDataValue.value.length === 0) {
|
if (fromDataValue.value.length === 0) {
|
||||||
return ElMessage.warning('请先选择数据')
|
return ElMessage.warning('请先选择数据')
|
||||||
}
|
}
|
||||||
let arr: any[] = []
|
let arr: any[] = []
|
||||||
fromDataValue.value.forEach(item1 => {
|
fromDataValue.value.forEach(item1 => {
|
||||||
fromData.value.forEach(item2 => {
|
fromData.value.forEach(item2 => {
|
||||||
if (item2.value === item1[0]) {
|
if (item2.value === item1[0]) {
|
||||||
item2.children = item2.children.filter((item3, index) => {
|
item2.children = item2.children.filter((item3, index) => {
|
||||||
if (item3.value === item1[1]) {
|
if (item3.value === item1[1]) {
|
||||||
arr.push(item3)
|
arr.push(item3)
|
||||||
return false
|
return false
|
||||||
} else {
|
} else {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
if (e.value) {
|
if (e.value) {
|
||||||
toData.value.forEach(item => {
|
toData.value.forEach(item => {
|
||||||
if (item.value === e.value) {
|
if (item.value === e.value) {
|
||||||
item.children.push(...arr)
|
item.children.push(...arr)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
toData.value.push(...arr)
|
toData.value.push(...arr)
|
||||||
}
|
}
|
||||||
// fromDataValue.value = []
|
// fromDataValue.value = []
|
||||||
popoverVisible.value = false
|
popoverVisible.value = false
|
||||||
}
|
}
|
||||||
// 右侧目标数据选中事件
|
// 右侧目标数据选中事件
|
||||||
const rightCheckChange = () => {
|
const rightCheckChange = () => {
|
||||||
if (toDataValue.value.length === 0) {
|
if (toDataValue.value.length === 0) {
|
||||||
return ElMessage.warning('请先选择数据')
|
return ElMessage.warning('请先选择数据')
|
||||||
}
|
}
|
||||||
let arr: any[] = []
|
let arr: any[] = []
|
||||||
toDataValue.value.forEach(item1 => {
|
toDataValue.value.forEach(item1 => {
|
||||||
if (item1.length === 1) {
|
if (item1.length === 1) {
|
||||||
toData.value = toData.value.filter(item2 => {
|
toData.value = toData.value.filter(item2 => {
|
||||||
if (item2.value === item1[0]) {
|
if (item2.value === item1[0]) {
|
||||||
arr.push(item2)
|
arr.push(item2)
|
||||||
return false
|
return false
|
||||||
} else {
|
} else {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
toData.value.forEach(item2 => {
|
toData.value.forEach(item2 => {
|
||||||
if (item2.value === item1[0]) {
|
if (item2.value === item1[0]) {
|
||||||
item2.children = item2.children.filter((item3, index) => {
|
item2.children = item2.children.filter((item3, index) => {
|
||||||
if (item3.value === item1[1]) {
|
if (item3.value === item1[1]) {
|
||||||
arr.push(item3)
|
arr.push(item3)
|
||||||
return false
|
return false
|
||||||
} else {
|
} else {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
fromData.value.forEach(item1 => {
|
fromData.value.forEach(item1 => {
|
||||||
arr.forEach(item2 => {
|
arr.forEach(item2 => {
|
||||||
if (item2.pid === item1.value) {
|
if (item2.pid === item1.value) {
|
||||||
item1.children.push(item2)
|
item1.children.push(item2)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const dicDeleteGroup = (data: any) => {
|
const dicDeleteGroup = (data: any) => {
|
||||||
if (data.children.length) {
|
if (data.children.length) {
|
||||||
return ElMessage.warning('该分组下有指标,不能删除')
|
return ElMessage.warning('该分组下有指标,不能删除')
|
||||||
}
|
}
|
||||||
dicDelete(data.value).then(res => {
|
dicDelete(data.value).then(res => {
|
||||||
ElMessage.success('删除成功')
|
ElMessage.success('删除成功')
|
||||||
toData.value = toData.value.filter(item => item.value !== data.value)
|
toData.value = toData.value.filter(item => item.value !== data.value)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const newGroup = () => {
|
const newGroup = () => {
|
||||||
|
|
||||||
addRef.value.open('新建分组', {
|
addRef.value.open('新建分组', {
|
||||||
sort: toData.value.length ? toData.value[toData.value.length - 1].sort + 1 : 1,
|
sort: toData.value.length ? toData.value[toData.value.length - 1].sort + 1 : 1,
|
||||||
code: '',
|
code: '',
|
||||||
pid: pid.value,
|
pid: pid.value,
|
||||||
id: '',
|
id: '',
|
||||||
remark: '',
|
remark: '',
|
||||||
name: ''
|
name: ''
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
const editGroup = (data: any) => {
|
const editGroup = (data: any) => {
|
||||||
getDictTreeById(data.id).then(res => {
|
getDictTreeById(data.id).then(res => {
|
||||||
addRef.value.open('修改分组', {
|
addRef.value.open('修改分组', {
|
||||||
sort: res.data.sort || 100,
|
sort: res.data.sort || 100,
|
||||||
code: res.data.code || '',
|
code: res.data.code || '',
|
||||||
pid: res.data.pid || '',
|
pid: res.data.pid || '',
|
||||||
id: res.data.id || '',
|
id: res.data.id || '',
|
||||||
remark: res.data.remark || '',
|
remark: res.data.remark || '',
|
||||||
name: res.data.name || ''
|
name: res.data.name || ''
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const open = (id: string) => {
|
const open = (id: string) => {
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
pid.value = id
|
pid.value = id
|
||||||
init(0)
|
init(0)
|
||||||
}
|
}
|
||||||
const submit = async () => {
|
const submit = async () => {
|
||||||
let ids = []
|
let ids = []
|
||||||
let one = {
|
let one = {
|
||||||
id: pid.value,
|
id: pid.value,
|
||||||
ids: [] as any[]
|
ids: [] as any[]
|
||||||
}
|
}
|
||||||
toData.value.forEach(item => {
|
toData.value.forEach(item => {
|
||||||
let obj = {
|
let obj = {
|
||||||
id: item.id,
|
id: item.id,
|
||||||
ids: [] as any[]
|
ids: [] as any[]
|
||||||
}
|
}
|
||||||
if (item.children) {
|
if (item.children) {
|
||||||
item.children.forEach(item2 => {
|
item.children.forEach(item2 => {
|
||||||
obj.ids.push(item2.value)
|
obj.ids.push(item2.value)
|
||||||
})
|
})
|
||||||
ids.push(obj)
|
ids.push(obj)
|
||||||
} else {
|
} else {
|
||||||
one.ids.push(item.value)
|
one.ids.push(item.value)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
if (one.ids.length) {
|
if (one.ids.length) {
|
||||||
ids.push(one)
|
ids.push(one)
|
||||||
}
|
}
|
||||||
addStatistical(ids).then(res => {
|
addStatistical(ids).then(res => {
|
||||||
ElMessage.success('绑定指标成功')
|
ElMessage.success('绑定指标成功')
|
||||||
dialogVisible.value = false
|
dialogVisible.value = false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
const close = () => {
|
const close = () => {
|
||||||
searchKey.value = ''
|
searchKey.value = ''
|
||||||
searchKey1.value = ''
|
searchKey1.value = ''
|
||||||
dialogVisible.value = false
|
dialogVisible.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
defineExpose({ open })
|
defineExpose({ open })
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.statistical-type-binding-button-group {
|
.statistical-type-binding-button-group {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(3, 1fr);
|
grid-template-columns: repeat(3, 1fr);
|
||||||
grid-gap: 10px;
|
grid-gap: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.statistical-type-binding {
|
.statistical-type-binding {
|
||||||
.box {
|
.box {
|
||||||
display: flex;
|
display: flex;
|
||||||
width: 1160px;
|
width: 1160px;
|
||||||
height: calc(60vh - 95px);
|
height: calc(60vh - 95px);
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
|
|
||||||
.box-center {
|
.box-center {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
width: 100px;
|
width: 100px;
|
||||||
padding-top: 20px;
|
padding-top: 20px;
|
||||||
margin: 0 20px;
|
margin: 0 20px;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
.box-right,
|
.box-right,
|
||||||
.box-left {
|
.box-left {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
// flex: 1;
|
// flex: 1;
|
||||||
width: 450px;
|
width: 450px;
|
||||||
|
|
||||||
.el-cascader-menu {
|
.el-cascader-menu {
|
||||||
padding-right: 0;
|
padding-right: 0;
|
||||||
|
|
||||||
.el-scrollbar__wrap {
|
.el-scrollbar__wrap {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-cascader-panel {
|
.el-cascader-panel {
|
||||||
height: calc(60vh - 140px);
|
height: calc(60vh - 140px);
|
||||||
|
|
||||||
.el-cascader-menu__list {
|
.el-cascader-menu__list {
|
||||||
height: 100% !important;
|
height: 100% !important;
|
||||||
overflow-y: auto !important;
|
overflow-y: auto !important;
|
||||||
// padding-bottom: 50px !important;
|
// padding-bottom: 50px !important;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.box-right {
|
.box-right {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.hide-txt {
|
.hide-txt {
|
||||||
width: 150px;
|
width: 150px;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user