台站和核素下拉框 增加过滤
图标增加图形标志及逻辑优化
This commit is contained in:
parent
2bcb6611fc
commit
fa690f0153
|
@ -26,6 +26,7 @@
|
||||||
placeholder="select..."
|
placeholder="select..."
|
||||||
show-arrow
|
show-arrow
|
||||||
allowClear
|
allowClear
|
||||||
|
:filterOption="filterOption"
|
||||||
:options="stationOptions"
|
:options="stationOptions"
|
||||||
@change="stationChange"
|
@change="stationChange"
|
||||||
>
|
>
|
||||||
|
@ -42,6 +43,7 @@
|
||||||
placeholder="select..."
|
placeholder="select..."
|
||||||
show-arrow
|
show-arrow
|
||||||
allowClear
|
allowClear
|
||||||
|
:filterOption="filterOption"
|
||||||
:options="nuclideOptions"
|
:options="nuclideOptions"
|
||||||
>
|
>
|
||||||
<img slot="suffixIcon" src="@/assets/images/global/select-down.png" alt="" />
|
<img slot="suffixIcon" src="@/assets/images/global/select-down.png" alt="" />
|
||||||
|
@ -94,35 +96,18 @@
|
||||||
<a-spin :spinning="spinning" style="height: 100%; width: 100%">
|
<a-spin :spinning="spinning" style="height: 100%; width: 100%">
|
||||||
<div class="layout-chart-one" v-show="isDefault">
|
<div class="layout-chart-one" v-show="isDefault">
|
||||||
<BoxTitle title="Nuclide History" />
|
<BoxTitle title="Nuclide History" />
|
||||||
<!-- <div class="layout-chart-one-one" id="chartLeft"></div> -->
|
|
||||||
</div>
|
</div>
|
||||||
<template v-if="stationIds.length != 0">
|
<template v-if="stationIds.length != 0">
|
||||||
<div
|
<div
|
||||||
class="layout-chart-box"
|
class="layout-chart-box"
|
||||||
v-for="item in stationIds"
|
v-for="item in chartLayout"
|
||||||
:key="item"
|
:key="item"
|
||||||
:style="{ height: stationIds.length == 1 ? '100%' : '50%' }"
|
:style="{ height: chartLayout.length == 1 ? '100%' : '50%' }"
|
||||||
>
|
>
|
||||||
<BoxTitle :title="`${itemTitle[item] ? itemTitle[item] + ':' : ''}Nuclide History`" />
|
<BoxTitle :title="`${itemTitle[item] ? itemTitle[item] + ':' : ''}Nuclide History`" />
|
||||||
<div class="layout-chart-box-box" :id="`chart_${item}`"></div>
|
<div class="layout-chart-box-box" :id="`chart_${item}`"></div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<!-- 一个台站 -->
|
|
||||||
<!-- <div v-if="!isCharts" class="layout-chart-one">
|
|
||||||
<BoxTitle :title="titleOne" />
|
|
||||||
<div class="layout-chart-one-one" id="chartOne"></div>
|
|
||||||
</div> -->
|
|
||||||
<!-- 两个台站 -->
|
|
||||||
<!-- <template v-if="isCharts">
|
|
||||||
<div class="layout-chart-left">
|
|
||||||
<BoxTitle :title="titleLeft" />
|
|
||||||
<div class="layout-chart-left-left" id="chartLeft"></div>
|
|
||||||
</div>
|
|
||||||
<div class="layout-chart-right">
|
|
||||||
<BoxTitle :title="titleRight" />
|
|
||||||
<div class="layout-chart-right-right" id="chartRight"></div>
|
|
||||||
</div>
|
|
||||||
</template> -->
|
|
||||||
</a-spin>
|
</a-spin>
|
||||||
</div>
|
</div>
|
||||||
</a-card>
|
</a-card>
|
||||||
|
@ -137,7 +122,10 @@ import { getAction, getFileAction } from '../../../../api/manage'
|
||||||
import { saveAs } from 'file-saver'
|
import { saveAs } from 'file-saver'
|
||||||
import moment from 'moment'
|
import moment from 'moment'
|
||||||
let xDataLength = 0
|
let xDataLength = 0
|
||||||
|
const symbolList = ['circle', 'rect', 'roundRect', 'triangle', 'diamond', 'pin', 'arrow']
|
||||||
|
const colorList = ['#5470c6', '#91cc75', '#fac858', '#ee6666', '#73c0de', '#3ba272', '#fc8452', '#9a60b4', '#ea7ccc']
|
||||||
const commonOptions = {
|
const commonOptions = {
|
||||||
|
color: colorList,
|
||||||
grid: {
|
grid: {
|
||||||
top: 30,
|
top: 30,
|
||||||
left: 20,
|
left: 20,
|
||||||
|
@ -149,6 +137,8 @@ const commonOptions = {
|
||||||
trigger: 'axis',
|
trigger: 'axis',
|
||||||
},
|
},
|
||||||
legend: {
|
legend: {
|
||||||
|
type: 'scroll',
|
||||||
|
width: '90%',
|
||||||
inactiveColor: 'rgba(153, 177, 189,.5)',
|
inactiveColor: 'rgba(153, 177, 189,.5)',
|
||||||
lineStyle: {
|
lineStyle: {
|
||||||
inactiveColor: '#333',
|
inactiveColor: '#333',
|
||||||
|
@ -156,10 +146,14 @@ const commonOptions = {
|
||||||
textStyle: {
|
textStyle: {
|
||||||
color: '#9ab1bc',
|
color: '#9ab1bc',
|
||||||
},
|
},
|
||||||
|
pageIconColor: '#9ab1bc',
|
||||||
|
pageIconInactiveColor: 'rgba(153, 177, 189,.5)',
|
||||||
|
pageTextStyle: {
|
||||||
|
color: '#9ab1bc',
|
||||||
|
},
|
||||||
// data: [],
|
// data: [],
|
||||||
},
|
},
|
||||||
toolbox: {
|
toolbox: {
|
||||||
// showTitle: false,
|
|
||||||
feature: {
|
feature: {
|
||||||
saveAsImage: {
|
saveAsImage: {
|
||||||
title: 'Save The Image',
|
title: 'Save The Image',
|
||||||
|
@ -197,21 +191,24 @@ const commonOptions = {
|
||||||
axisLabel: {
|
axisLabel: {
|
||||||
color: '#ade6ee',
|
color: '#ade6ee',
|
||||||
formatter: (value, index) => {
|
formatter: (value, index) => {
|
||||||
let val = value.split(' ').join('\n')
|
// let val = value.split(' ').join('\n')
|
||||||
|
let val = value.split(' ')[0]
|
||||||
if (index === 0) {
|
if (index === 0) {
|
||||||
let arr = value.split(' ')
|
let arr = value.split(' ')
|
||||||
arr[0] = ' ' + arr[0]
|
arr[0] = ' ' + arr[0]
|
||||||
arr[1] = ' ' + arr[1]
|
// arr[1] = ' ' + arr[1]
|
||||||
let str = arr.join('\n')
|
// let str = arr.join('\n')
|
||||||
return str
|
let str = arr[0]
|
||||||
}
|
|
||||||
if (index === xDataLength - 1) {
|
|
||||||
let arr = value.split(' ')
|
|
||||||
arr[0] = arr[0] + ' '
|
|
||||||
arr[1] = arr[1] + ' '
|
|
||||||
let str = arr.join('\n')
|
|
||||||
return str
|
return str
|
||||||
}
|
}
|
||||||
|
// if (index === xDataLength - 1) {
|
||||||
|
// let arr = value.split(' ')
|
||||||
|
// arr[0] = arr[0] + ' '
|
||||||
|
// // arr[1] = arr[1] + ' '
|
||||||
|
// // let str = arr.join('\n')
|
||||||
|
// let str = arr[0]
|
||||||
|
// return str
|
||||||
|
// }
|
||||||
return val
|
return val
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -244,9 +241,8 @@ export default {
|
||||||
BoxTitle,
|
BoxTitle,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
// this.chartOneOption = cloneDeep(commonOptions)
|
this.symbolList = symbolList
|
||||||
// this.chartLeftOption = cloneDeep(commonOptions)
|
this.colorList = colorList
|
||||||
// this.chartRightOption = cloneDeep(commonOptions)
|
|
||||||
return {
|
return {
|
||||||
typeOptions: [
|
typeOptions: [
|
||||||
{
|
{
|
||||||
|
@ -269,7 +265,7 @@ export default {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Interactive DB',
|
label: 'Interactive DB',
|
||||||
value: 'interactive',
|
value: 'man',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
stationOptions: [],
|
stationOptions: [],
|
||||||
|
@ -284,37 +280,39 @@ export default {
|
||||||
endDate: moment().format('YYYY-MM-DD'),
|
endDate: moment().format('YYYY-MM-DD'),
|
||||||
},
|
},
|
||||||
menuName: '',
|
menuName: '',
|
||||||
// titleOne: 'Nuclide History',
|
|
||||||
// titleLeft: 'Nuclide History',
|
|
||||||
// titleRight: 'Nuclide History',
|
|
||||||
// chartOne: null,
|
|
||||||
// chartLeft: null,
|
|
||||||
// chartRight: null,
|
|
||||||
spinning: false,
|
spinning: false,
|
||||||
isDefault: true,
|
isDefault: true,
|
||||||
chartInitList: [],
|
chartInitList: [],
|
||||||
itemTitle: {},
|
itemTitle: {},
|
||||||
|
chartLayout: [],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
watch: {
|
||||||
isCharts() {
|
chartLayout: {
|
||||||
return Array.isArray(this.stationIds) && this.stationIds.length == 2 ? true : false
|
handler(newVal) {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.chartInitList.forEach((item) => {
|
||||||
|
item.resize()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
moment,
|
moment,
|
||||||
typeChange(val) {
|
typeChange(val) {
|
||||||
this.isDefault = true
|
this.isDefault = true
|
||||||
// this.disposeCharts()
|
|
||||||
this.stationIds = []
|
this.stationIds = []
|
||||||
// this.queryParams.dbName = undefined
|
this.chartLayout = []
|
||||||
this.queryParams.nuclideNames = []
|
this.queryParams.nuclideNames = []
|
||||||
this.queryParams.systemType = val
|
this.queryParams.systemType = val
|
||||||
if (val == 'Particulate') this.menuName = 'Particulate'
|
if (val == 'Particulate') this.menuName = 'Particulate'
|
||||||
if (val == 'gamma') this.menuName = 'Noble Gas HPGe'
|
if (val == 'gamma') this.menuName = 'Noble Gas HPGe'
|
||||||
if (val == 'beta') this.menuName = 'Noble Gas Beta-Gamma'
|
if (val == 'beta') this.menuName = 'Noble Gas Beta-Gamma'
|
||||||
|
if (val.length > 0) {
|
||||||
this.getStations()
|
this.getStations()
|
||||||
this.getNuclide()
|
this.getNuclide()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
getStations() {
|
getStations() {
|
||||||
getAction('/webStatistics/findStationList', { menuName: this.menuName }).then((res) => {
|
getAction('/webStatistics/findStationList', { menuName: this.menuName }).then((res) => {
|
||||||
|
@ -348,12 +346,7 @@ export default {
|
||||||
},
|
},
|
||||||
stationChange(val) {
|
stationChange(val) {
|
||||||
if (val.length != 0) {
|
if (val.length != 0) {
|
||||||
this.isDefault = false
|
// this.isDefault = false
|
||||||
this.$nextTick(() => {
|
|
||||||
this.chartInitList.forEach((item) => {
|
|
||||||
item.resize()
|
|
||||||
})
|
|
||||||
})
|
|
||||||
if (val.length == 2) {
|
if (val.length == 2) {
|
||||||
this.stationOptions.forEach((item) => {
|
this.stationOptions.forEach((item) => {
|
||||||
if (!val.includes(item.value)) {
|
if (!val.includes(item.value)) {
|
||||||
|
@ -368,22 +361,6 @@ export default {
|
||||||
} else {
|
} else {
|
||||||
this.isDefault = true
|
this.isDefault = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (this.chartOne) this.chartOne.dispose()
|
|
||||||
// if (this.chartLeft) this.chartLeft.dispose()
|
|
||||||
// if (this.chartRight) this.chartRight.dispose()
|
|
||||||
// this.stationIds = val
|
|
||||||
// if (val.length == 2) {
|
|
||||||
// this.stationOptions.forEach((item) => {
|
|
||||||
// if (!val.includes(item.value)) {
|
|
||||||
// item.disabled = true
|
|
||||||
// } else {
|
|
||||||
// item.disabled = false
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
// } else {
|
|
||||||
// this.stationOptions.forEach((item) => (item.disabled = false))
|
|
||||||
// }
|
|
||||||
},
|
},
|
||||||
startDateChange(date, dateString) {
|
startDateChange(date, dateString) {
|
||||||
this.queryParams.startDate = dateString
|
this.queryParams.startDate = dateString
|
||||||
|
@ -392,9 +369,12 @@ export default {
|
||||||
this.queryParams.endDate = dateString
|
this.queryParams.endDate = dateString
|
||||||
},
|
},
|
||||||
handleSearch() {
|
handleSearch() {
|
||||||
|
this.isDefault = false
|
||||||
this.chartInitList = []
|
this.chartInitList = []
|
||||||
|
this.chartLayout = []
|
||||||
this.stationIds.forEach((id, index) => {
|
this.stationIds.forEach((id, index) => {
|
||||||
// this.queryParams.stationId = id
|
this.chartLayout.push(id)
|
||||||
|
this.$nextTick(() => {
|
||||||
let currChartInit = echarts.init(document.getElementById(`chart_${id}`))
|
let currChartInit = echarts.init(document.getElementById(`chart_${id}`))
|
||||||
this.chartInitList.push(currChartInit)
|
this.chartInitList.push(currChartInit)
|
||||||
let params = {
|
let params = {
|
||||||
|
@ -402,49 +382,13 @@ export default {
|
||||||
stationId: id,
|
stationId: id,
|
||||||
}
|
}
|
||||||
let options = cloneDeep(commonOptions)
|
let options = cloneDeep(commonOptions)
|
||||||
|
if (this.queryParams.nuclideNames.length > 0) {
|
||||||
this.getChartDate(params, currChartInit, options, id)
|
this.getChartDate(params, currChartInit, options, id)
|
||||||
/**
|
|
||||||
if (index == 0) {
|
|
||||||
this.chartLeftOption.series = []
|
|
||||||
this.chartLeft = echarts.init(document.getElementById('chartLeft'))
|
|
||||||
this.getChartDate(params, this.chartLeft, this.chartLeftOption, 'left')
|
|
||||||
} else {
|
} else {
|
||||||
this.chartRightOption.series = []
|
this.$message.warning(`Please select nuclide!`)
|
||||||
this.chartRight = echarts.init(document.getElementById('chartRight'))
|
|
||||||
this.getChartDate(params, this.chartRight, this.chartRightOption, 'right')
|
|
||||||
}*/
|
|
||||||
})
|
|
||||||
/**
|
|
||||||
if (this.chartOne) this.chartOne.clear()
|
|
||||||
if (this.chartLeft) this.chartLeft.clear()
|
|
||||||
if (this.chartRight) this.chartRight.clear()
|
|
||||||
if (this.stationIds.length == 1) {
|
|
||||||
this.chartOne = echarts.init(document.getElementById('chartOne'))
|
|
||||||
// this.queryParams.stationId = this.stationIds[0]
|
|
||||||
let params = {
|
|
||||||
...this.queryParams,
|
|
||||||
stationId: this.stationIds[0],
|
|
||||||
}
|
|
||||||
this.chartOneOption.series = []
|
|
||||||
this.getChartDate(params, this.chartOne, this.chartOneOption, 'one')
|
|
||||||
} else {
|
|
||||||
this.stationIds.forEach((id, index) => {
|
|
||||||
// this.queryParams.stationId = id
|
|
||||||
let params = {
|
|
||||||
...this.queryParams,
|
|
||||||
stationId: id,
|
|
||||||
}
|
|
||||||
if (index == 0) {
|
|
||||||
this.chartLeftOption.series = []
|
|
||||||
this.chartLeft = echarts.init(document.getElementById('chartLeft'))
|
|
||||||
this.getChartDate(params, this.chartLeft, this.chartLeftOption, 'left')
|
|
||||||
} else {
|
|
||||||
this.chartRightOption.series = []
|
|
||||||
this.chartRight = echarts.init(document.getElementById('chartRight'))
|
|
||||||
this.getChartDate(params, this.chartRight, this.chartRightOption, 'right')
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}*/
|
})
|
||||||
},
|
},
|
||||||
async getChartDate(params, chart, option, id) {
|
async getChartDate(params, chart, option, id) {
|
||||||
this.spinning = true
|
this.spinning = true
|
||||||
|
@ -456,24 +400,32 @@ export default {
|
||||||
this.spinning = false
|
this.spinning = false
|
||||||
this.$set(this.itemTitle, id, result.STATION_NAME)
|
this.$set(this.itemTitle, id, result.STATION_NAME)
|
||||||
if (result.CollectStart.length < 1) {
|
if (result.CollectStart.length < 1) {
|
||||||
this.$message.warning('No Data!')
|
this.$message.warning(`${result.STATION_NAME} No Data!`)
|
||||||
}
|
}
|
||||||
// if (type === 'one') this.titleOne = `${result.STATION_NAME}:Nuclide History`
|
// legend.data = Object.keys(result).filter((item) => item !== 'CollectStart')
|
||||||
// if (type === 'left') this.titleLeft = `${result.STATION_NAME}:Nuclide History`
|
|
||||||
// if (type === 'right') this.titleRight = `${result.STATION_NAME}:Nuclide History`
|
|
||||||
legend.data = Object.keys(result).filter((item) => item !== 'CollectStart')
|
|
||||||
xAxis.data = result.CollectStart
|
xAxis.data = result.CollectStart
|
||||||
xDataLength = result.CollectStart.length
|
xDataLength = result.CollectStart.length
|
||||||
toolbox.feature.saveAsImage.name = `${result.STATION_NAME}:Nuclide History`
|
toolbox.feature.saveAsImage.name = `${result.STATION_NAME}:Nuclide History`
|
||||||
|
let objKeys = Object.keys(result).filter(
|
||||||
|
(item) => item !== 'CollectStart' && item !== 'STATION_NAME' && key !== 'AllDayTime'
|
||||||
|
)
|
||||||
for (const key in result) {
|
for (const key in result) {
|
||||||
|
let idx = objKeys.findIndex((item) => item == key)
|
||||||
|
let num_symbol = idx % 7
|
||||||
|
// let num_symbol = idx%7
|
||||||
let param = null
|
let param = null
|
||||||
if (Object.hasOwnProperty.call(result, key) && key !== 'CollectStart' && key !== 'STATION_NAME') {
|
if (
|
||||||
|
Object.hasOwnProperty.call(result, key) &&
|
||||||
|
key !== 'CollectStart' &&
|
||||||
|
key !== 'STATION_NAME' &&
|
||||||
|
key !== 'AllDayTime'
|
||||||
|
) {
|
||||||
const element = result[key]
|
const element = result[key]
|
||||||
param = {
|
param = {
|
||||||
type: 'line',
|
type: 'line',
|
||||||
name: key,
|
name: key,
|
||||||
smooth: true,
|
smooth: true,
|
||||||
showSymbol: false,
|
symbol: this.symbolList[num_symbol],
|
||||||
animation: false,
|
animation: false,
|
||||||
lineStyle: {
|
lineStyle: {
|
||||||
normal: {
|
normal: {
|
||||||
|
@ -509,15 +461,6 @@ export default {
|
||||||
this.$message.warning('No downloadable data')
|
this.$message.warning('No downloadable data')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/**
|
|
||||||
// 清除图表
|
|
||||||
disposeCharts() {
|
|
||||||
if (this.chartOne) this.chartOne.dispose()
|
|
||||||
if (this.chartLeft) this.chartLeft.dispose()
|
|
||||||
if (this.chartRight) this.chartRight.dispose()
|
|
||||||
this.titleOne = this.titleLeft = this.titleRight = 'Nuclide History'
|
|
||||||
},
|
|
||||||
*/
|
|
||||||
|
|
||||||
filterOption(input, option) {
|
filterOption(input, option) {
|
||||||
return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
||||||
|
|
Loading…
Reference in New Issue
Block a user