| | |
| | | countCountryDimension, |
| | | countProvinceDimension, |
| | | GetServicesVisitsCount, |
| | | countZhPipeMapLength, |
| | | countLargeCategories, |
| | | countProjectType, |
| | | countProjectDown, |
| | | countProjectTypeNumber, |
| | | countStorageByProject, |
| | | } from "@/api/screen.js" |
| | | export default { |
| | | props: { |
| | |
| | | type: String, |
| | | default: "全国项目", |
| | | }, |
| | | params: { |
| | | type: Object, |
| | | default: () => null, |
| | | }, |
| | | project: { |
| | | type: String, |
| | | default: "全国项目", |
| | | }, |
| | | title: { |
| | | type: String, |
| | | default: "", |
| | | }, |
| | | }, |
| | | data() { |
| | | return { |
| | |
| | | option() { |
| | | let xAxis = [] |
| | | let yAxis = [] |
| | | |
| | | this.dataList.forEach(item => { |
| | | xAxis.push(item.type) |
| | | yAxis.push(item.count) |
| | | }) |
| | | const proObj = this.dataList.find(item => item.项目名称 == this.project) |
| | | if (proObj) { |
| | | Object.keys(proObj).forEach(item => { |
| | | if (item.toString() != '项目名称') { |
| | | xAxis.push(item) |
| | | yAxis.push(proObj[item]) |
| | | } |
| | | }) |
| | | } else { |
| | | this.dataList.forEach(item => { |
| | | let type = item.type || item.projtype |
| | | xAxis.push(type) |
| | | yAxis.push(item.count) |
| | | }) |
| | | } |
| | | |
| | | // let data = [220, 182, 191, 234, 290, 330, 310] |
| | | // const sideData = data.map(item => { |
| | |
| | | }, |
| | | grid: { |
| | | right: "5%", |
| | | top: '10%', |
| | | top: "10%", |
| | | left: "5%", |
| | | bottom: "17%", |
| | | containLabel: true |
| | | containLabel: true, |
| | | }, |
| | | |
| | | xAxis: { |
| | |
| | | boundaryGap: true, |
| | | axisLine: { |
| | | lineStyle: { |
| | | color: "#fff" |
| | | color: "#fff", |
| | | }, |
| | | show: false |
| | | show: false, |
| | | }, |
| | | nameRotate: 45, |
| | | axisTick: { |
| | |
| | | }, |
| | | series: [ |
| | | { |
| | | name: "服务访问次数", |
| | | name: this.title, |
| | | type: "line", |
| | | showAllSymbol: false, |
| | | lineStyle: { |
| | |
| | | }, |
| | | project: { |
| | | deep: true, |
| | | immediate: true, |
| | | handler(newVal) { |
| | | let requsetFn = null |
| | | switch (newVal) { |
| | | case "全球项目": |
| | | requsetFn = countCountryDimension |
| | | requsetFn = countProjectTypeNumber |
| | | break |
| | | case "全国项目": |
| | | requsetFn = countProvinceDimension |
| | | requsetFn = countProjectTypeNumber |
| | | break |
| | | |
| | | case "全球管网图": |
| | | requsetFn = countZhPipeMapLength |
| | | break |
| | | case "全国管网图": |
| | | requsetFn = countZhPipeMapLength |
| | | break |
| | | default: |
| | | requsetFn = countStorageByProject |
| | | |
| | | break |
| | | } |
| | | requsetFn && this.initData(requsetFn) |
| | |
| | | }, |
| | | }, |
| | | mounted() { |
| | | this.initData() |
| | | // this.initData() |
| | | this.initChart() |
| | | if (this.autoResize) { |
| | | window.addEventListener("resize", this.resizeHandler) |
| | |
| | | }, |
| | | methods: { |
| | | resizeHandler() { |
| | | this.chart.resize() |
| | | this.chart && this.chart.resize() |
| | | }, |
| | | initChart() { |
| | | this.chart = echarts.init(this.$refs.chart, "", { |
| | |
| | | this.chart && this.chart.clear() |
| | | }, |
| | | async initData(requsetFn = GetServicesVisitsCount) { |
| | | const res = await requsetFn() |
| | | const res = await requsetFn(this.params) |
| | | if (res.code == 200) { |
| | | this.dataList = res.result |
| | | console.log("requsetFn", res) |