lion 9 months ago
parent d208ea23a7
commit b2caa9f5c4

@ -217,7 +217,7 @@ export default {
let paginationHeight = this.isPage ? 37 : 0; //
let topHeight = 20; //
this.tableHeight =
clientHeight - lxHeader_height - topHeight - paginationHeight - 20 - 25;
clientHeight - lxHeader_height - topHeight - paginationHeight - 20 - 55;
//console.log(this.tableHeight)
this.$emit("getHeight",this.tableHeight)
},

@ -110,13 +110,13 @@
grid: {
left: '20',
right: '20',
top: '40',
top: '60',
bottom: '20',
containLabel: true
},
color: this.colors, //
legend: {},
legend: currentData.legend||{},
tooltip: { //
// trigger: "axis",
// formatter: currentData.formatter, //

@ -59,11 +59,13 @@
</div>
</div>
<div class="yearData">
<myecharts style="margin-top:20px" :width="'100%'" :height="'350px'" :data="budget_data"></myecharts>
<div class="yearData-item" v-for="item in yearsArr">
<el-descriptions :title="item.name" direction="vertical" :column="1" border>
<el-descriptions-item label="年度预算">
<div v-if="item.budgets.length<1" style="text-align: center;"></div>
<!-- <el-descriptions-item>
<template slot="label">年度预算{{item.budgets.all_year}}</template>
<myecharts style="margin-top:20px" :width="'100%'" :height="'250px'" :data="item.budgets"></myecharts>
<el-descriptions :column="2" v-else border v-for="budget in item.budgets">
<el-descriptions-item label="年度总预算" :span="2">
{{budget.all_year}}
@ -82,15 +84,16 @@
</el-descriptions-item>
</el-descriptions>
</el-descriptions-item>
</el-descriptions-item> -->
<el-descriptions-item label="业务数据">
<myecharts style="margin-top:20px" :width="'100%'" :height="'300px'" :data="item.list"></myecharts>
<div v-if="item.list.length<1" style="text-align: center;"></div>
<!-- <div v-if="item.list.length<1" style="text-align: center;"></div>
<el-descriptions :column="1" border v-else>
<el-descriptions-item v-for="li in item.list" :label="li.name">
{{li.total}}
</el-descriptions-item>
</el-descriptions>
</el-descriptions> -->
</el-descriptions-item>
</el-descriptions>
@ -115,8 +118,8 @@
} from "@/api/home"
import {
index
} from "@/api/system/baseForm.js"
import state from '@/store/modules/user.js'
} from "@/api/system/baseForm.js"
import state from '@/store/modules/user.js'
export default {
components: {
myecharts,
@ -130,8 +133,8 @@
// areasTotal: 0,
status1Total: 0,
dateTotal: 0
},
stateObj: {},
},
stateObj: {},
nowDate: '',
//
list_areas: [],
@ -144,6 +147,7 @@
area_id: ''
},
overall_month_data: {},
budget_data: {},
//
yearSelect: {
year: '',
@ -162,7 +166,7 @@
},
created() {
this.monthSelect.year = this.$moment(new Date).format("YYYY")
this.yearSelect.year = this.$moment(new Date).format("YYYY")
this.yearSelect.year = this.$moment(new Date).format("YYYY")
this.stateObj = state.state
this.init()
this.getRecords()
@ -218,11 +222,11 @@
//
changeBussiness(e) {
this.list_business.map(item => {
if (e === item.id) {
//
if(this.stateObj.is_admin){
this.list_areas = item.area_ids_details
this.monthSelect.area_id = this.list_areas[0].id
if (e === item.id) {
//
if (this.stateObj.is_admin) {
this.list_areas = item.area_ids_details
this.monthSelect.area_id = this.list_areas[0].id
}
this.list_type = item.id_business_types_business_id_relation.filter(item => {
@ -255,31 +259,31 @@
page: 1,
table_name: 'businesses',
json_data_fields: ['area_ids'],
})
//
//
//
if(!this.stateObj.is_admin){
this.list_business = res.data.filter(item => {
return item.area_ids.includes(this.stateObj.area_id)
})
this.monthSelect.business_id = this.list_business[0].id
this.monthSelect.area_id = this.stateObj.area_id
this.list_type = this.list_business[0].id_business_types_business_id_relation.filter(item => {
return item.area_id == this.monthSelect.area_id
})
this.monthSelect.business_type_id = this.list_type[0].id
}else{
this.list_business = res.data.reverse()
this.monthSelect.business_id = res.data[0].id
this.list_areas = res.data[0].area_ids_details
this.monthSelect.area_id = this.list_areas[0].id
this.list_type = res.data[0].id_business_types_business_id_relation.filter(item => {
return item.area_id == this.monthSelect.area_id
})
this.monthSelect.business_type_id = this.list_type[0].id
}
})
//
//
//
if (!this.stateObj.is_admin) {
this.list_business = res.data.filter(item => {
return item.area_ids.includes(this.stateObj.area_id)
})
this.monthSelect.business_id = this.list_business[0].id
this.monthSelect.area_id = this.stateObj.area_id
this.list_type = this.list_business[0].id_business_types_business_id_relation.filter(item => {
return item.area_id == this.monthSelect.area_id
})
this.monthSelect.business_type_id = this.list_type[0].id
} else {
this.list_business = res.data.reverse()
this.monthSelect.business_id = res.data[0].id
this.list_areas = res.data[0].area_ids_details
this.monthSelect.area_id = this.list_areas[0].id
this.list_type = res.data[0].id_business_types_business_id_relation.filter(item => {
return item.area_id == this.monthSelect.area_id
})
this.monthSelect.business_type_id = this.list_type[0].id
}
@ -296,6 +300,7 @@
let dMonth = this.getMonthArr(res.list)
this.overall_month_data.x = xMonth
this.overall_month_data.list = dMonth
console.log("this.overall_month_data", this.overall_month_data)
},
//
getMonthArr(list) {
@ -317,17 +322,14 @@
name,
business_data_id,
type: 'bar',
barGap: '0%',
// barWidth: '30%', //
barGap: '0%',
// barWidth: '30%', //
data: Array(12).fill(0), // 120
label: {
show: true,
position: 'top',
color: "#333",
formatter: function(para) {
console.log(para)
if (para.value > 0) {
if (para.seriesName.includes('费用') || para.seriesName.includes('补贴')) {
return para.value + '万元'
@ -359,7 +361,7 @@
async getYearList() {
await this.getAreas()
await this.getYearChart()
},
},
async getAreas() {
const res = await index({
@ -369,12 +371,12 @@
sort_type: 'ASC',
sort_name: 'sort',
})
this.all_areas = res.data
//
if(!this.stateObj.is_admin){
this.yearSelect.area_id = this.stateObj.area_id
}else{
this.yearSelect.area_id = this.all_areas[0].id
this.all_areas = res.data
//
if (!this.stateObj.is_admin) {
this.yearSelect.area_id = this.stateObj.area_id
} else {
this.yearSelect.area_id = this.all_areas[0].id
}
},
async getYearChart() {
@ -382,32 +384,90 @@
year: this.yearSelect.year,
area_id: this.yearSelect.area_id
})
// this.yearList = res.list
// this.yearBudgets = res.budgets
this.yearsArr = this.getYearObj(res.list, res.budgets)
console.log("getYearObj", this.getYearObj(res.list, res.budgets))
// let xMonth = this.monthArr
// let dMonth = this.getMonthArr(res.list)
// this.overall_month_data.x = xMonth
// this.overall_month_data.list = dMonth
},
//
getYearObj(list, budgets) {
let flatBudgets = [].concat(...budgets);
let yearObjs = [];
for (let name in list) {
let yearObjs = [];
let budget_data_x = []
this.budget_data.list.map(item=>{
item.data = []
})
for (let name in list) {
budget_data_x.push(name)
if (list.hasOwnProperty(name)) {
let yearObj = {
name: name,
budgets: [],
list: list[name]
budgets: {
},
list: {
trigger: 'item',
xShow: false,
yShow: false,
all_year: 0,
legend: {
left: 'left',
top: 0
},
list: [{
name: name,
type: 'pie',
radius: '60%',
tooltip: {
formatter: function(item) {
console.log(item)
let result = `${item.seriesName}<br/>`;
const name = item.name; //
const value = item.value; //
const marker = item.marker; //
const unit = item.name.includes('费用') || item.name.includes('补贴') ? '万元' : ''
result += `${marker}${name}: ${value}${unit}<br/>`;
return result;
},
},
data: [],
label: {
show: true,
position: 'outer',
},
}]
},
};
let matchedBudgets = flatBudgets.filter(budget =>
list[name].some(item => item.business_id === budget.business_id)
);
yearObj.budgets = matchedBudgets;
console.log(name, list[name], matchedBudgets)
//
this.budget_data.list.map(item=>{
if(item.id==='quarter_1'){
item.data.push(matchedBudgets.length > 0 ? matchedBudgets[0].quarter_1/10000 : 0)
}else if(item.id==='quarter_2'){
item.data.push(matchedBudgets.length > 0 ? matchedBudgets[0].quarter_2/10000 : 0)
}else if(item.id==='quarter_3'){
item.data.push(matchedBudgets.length > 0 ? matchedBudgets[0].quarter_3/10000 : 0)
}else if(item.id==='quarter_4'){
item.data.push(matchedBudgets.length > 0 ? matchedBudgets[0].quarter_4/10000 : 0)
}
})
//
list[name].map(item => {
let last_total = item.total
if (item.name.includes('费用') || item.name.includes('补贴')) {
last_total = item.total / 10000
}
yearObj.list.list[0].data.push({
name: item.name,
value: last_total
})
})
yearObjs.push(yearObj);
console.log("budget_data", this.budget_data)
}
}
}
this.budget_data.x = budget_data_x
return yearObjs
},
@ -418,10 +478,6 @@
this.overall_month_data = {
xShow: true,
yShow: true,
// rotate: 20,
// formatter:function(params){
// return that.chartFomatter(params)
// },
xAxis: {
axisLabel: {
show: true,
@ -445,21 +501,84 @@
list: []
}
this.overall_year_data = {
trigger: 'item',
xShow: false,
yShow: false,
list: [{
name: '档案数',
type: 'pie',
radius: '80%',
// center:['20%','20%'],
data: [],
trigger: 'item',
xShow: false,
yShow: false,
list: [{
name: '档案数',
type: 'pie',
radius: '80%',
// center:['20%','20%'],
data: [],
label: {
show: true,
position: 'center'
},
}]
},
this.budget_data = {
xShow: true,
yShow: true,
xAxis: {
axisLabel: {
show: true,
// rotate: 35, //35
},
},
formatter: function(params) {
let result = `${params[0].name}<br/>`;
params.forEach(function(item) {
// item
const seriesName = item.seriesName; //
const value = item.value; //
const marker = item.marker; //
const unit = '万元'
result += `${marker}${seriesName}: ${value}${unit}<br/>`;
});
return result;
},
x: [],
list: []
}
let four = [{
name: '第一季度',
id: 'quarter_1'
}, {
name: '第二季度',
id: 'quarter_2'
}, {
name: '第三季度',
id: 'quarter_3'
}, {
name: '第四季度',
id: 'quarter_4'
}]
four.map(item => {
this.budget_data.list.push({
name:item.name,
id:item.id,
type: 'bar',
barGap: '0%',
// barWidth: '30%', //
data: [], // 120
label: {
show: true,
position: 'center'
position: 'top',
color: "#333",
formatter: function(para) {
if (para.value > 0) {
if (para.seriesName.includes('费用') || para.seriesName.includes('补贴')) {
return para.value + '万元'
} else {
return para.value
}
} else {
return ''
}
}
},
}]
}
})
})
}
},
}
@ -511,8 +630,8 @@
&-item {
// width: 30%;
flex-basis: 30%;
margin-right: 2%;
flex-basis: 32%;
margin: 0.5%;
margin-bottom: 20px;
}
}

@ -3,7 +3,7 @@
<div>
<div ref="lxHeader">
<lx-header icon="md-apps" :text="is_search?$route.meta.title+'--'+select.keyword:$route.meta.title"
<lx-header icon="md-apps" :text="is_search?$route.meta.title+'--'+select.keyword:$route.meta.title+select.catalog_name"
style="margin-bottom: 10px; border: 0px; margin-top: 15px">
<div slot="content" v-if="!hasMenu">
<div class="searchwrap" style="display: flex;align-items: center;">
@ -99,10 +99,11 @@
</div>
</div>
<div class="catalog_right" v-else>
<div class="catalog_right" v-else>
<!-- :defaultExpandAll='false' :isPage="false" rowKey="id" -->
<xy-table @getHeight="initHeight" @cell-dblclick="dbclick"
:total="total" @pageIndexChange="pageIndexChange" @pageSizeChange="pageSizeChange"
:defaultExpandAll='false' :isPage="true" rowKey="id"
:list="list" :table-item="table_item">
<template v-slot:catalog_name>
<el-table-column align='center' label="所属目录" min-width="120" header-align="center">
@ -125,7 +126,7 @@
</el-table-column>
</template>
<template v-slot:tag_name>
<el-table-column align='center' label="标签" header-align="center">
<el-table-column align='center' label="标签" min-width="120" header-align="center">
<template slot-scope="scope">
<div v-if="scope.row.tag_ids_details && scope.row.tag_ids_details.length>0">
<el-tag style="margin-right:5px;margin-bottom:5px" v-for="item in scope.row.tag_ids_details">

Loading…
Cancel
Save