var vms = Vue.component("amplify-gqgk", {
template: `
`,
props: {},
data() {
return {
show: false,
people: [],
number: 720,
unit: '天',
shiJiPro:0,
timePro:0,
text:'时间进度',
text1:'实际产值进度',
projectId:JSON.parse(localStorage.getItem("data")).id,
}
},
mounted() {
},
methods: {
openAmplify() {
this.show = true
this.setData()
this.gainProBase()
},
closeAmplify() {
this.show = false
},
closeAmplifyAll(e) {
if (e.target.className == 'amplify-fixed') {
this.show = false
}
},
setData() {
var people = this.number != undefined ? this.number.toString().split('') : 0;
this.people = people
},
//数据接口
gainProBase() {
axios.post("/api/building/proBaseInfo?projectId=" + this.projectId).then(res => {
if(res.data.code == "200") {
this.shiJiPro = parseInt((res.data.data.kailei_money / 67640 * 100).toFixed(0))
this.timePro = parseInt(((moment().diff(moment(res.data.data.actual_start_date), 'days') / 720) * 100).toFixed(0))
}
this.getChartData()
this.getChartData1()
}).catch(err => {
})
},
//数据展示图1
getChartData(){
var chChartBar = echarts.init(this.$refs.chart1);
this.echartBar(chChartBar,this.timePro,this.text)
},
echartBar(chChart,value,text){
let newPromise = new Promise((resolve) => {
resolve()
})
//然后异步执行echarts的初始化函数
newPromise.then(() => {
var placeHolderStyle = {
normal: {
label: {
show: false,
},
labelLine: {
show: false,
},
color: "rgba(0,0,0,0)",
borderWidth: 0,
},
emphasis: {
color: "rgba(0,0,0,0)",
borderWidth: 0,
},
};
var dataStyle = {
};
this.option ={
title: [
{
text: value+'%',
textAlign: "center",
left: "48%",
top: "30%",
textStyle: {
color: "#67abf2",
fontSize: 23,
},
},
{
text: text,
left: "48%",
top: "80%",
textAlign: "center",
textStyle: {
color: "#cdd7fa",
fontWeight: "normal",
fontSize: "16",
textAlign: "center",
},
},
],
series: [
{
type: "pie",
hoverAnimation: false,
radius: ["60%", "59%"],
center: ["50%", "40%"],
labelLine: {
normal: {
show: false,
},
},
label: {
normal: {
position: "center",
},
},
data: [
{
value: 100,
itemStyle: {
normal: {
color: "#255788",
},
},
},
],
},
{
type: "pie",
hoverAnimation: false,
radius: ["53%", "60%"],
center: ["50%", "40%"],
labelLine: {
normal: {
show: false,
},
},
label: {
normal: {
position: "center",
},
},
data: [
{
value: value,
itemStyle: {
normal: {
color: "#68a8f2",
},
},
normal: {
show: false,
},
},
{
value: 100-value,
itemStyle: placeHolderStyle,
},
],
},
],
};
chChart.setOption(this.option);
window.onresize = chChart.resize;
})
},
//数据展示图2
getChartData1(){
var chChartBar = echarts.init(this.$refs.chart2);
this.echartBar(chChartBar,this.shiJiPro,this.text1)
},
echartBar(chChart,value,text){
let newPromise = new Promise((resolve) => {
resolve()
})
//然后异步执行echarts的初始化函数
newPromise.then(() => {
var placeHolderStyle = {
normal: {
label: {
show: false,
},
labelLine: {
show: false,
},
color: "rgba(0,0,0,0)",
borderWidth: 0,
},
emphasis: {
color: "rgba(0,0,0,0)",
borderWidth: 0,
},
};
var dataStyle = {
};
this.option ={
title: [
{
text: value+'%',
textAlign: "center",
left: "48%",
top: "30%",
textStyle: {
color: "#67abf2",
fontSize: 23,
},
},
{
text: text,
left: "48%",
top: "80%",
textAlign: "center",
textStyle: {
color: "#cdd7fa",
fontWeight: "normal",
fontSize: "16",
textAlign: "center",
},
},
],
series: [
{
type: "pie",
hoverAnimation: false,
radius: ["60%", "59%"],
center: ["50%", "40%"],
labelLine: {
normal: {
show: false,
},
},
label: {
normal: {
position: "center",
},
},
data: [
{
value: 100,
itemStyle: {
normal: {
color: "#255788",
},
},
},
],
},
{
type: "pie",
hoverAnimation: false,
radius: ["53%", "60%"],
center: ["50%", "40%"],
labelLine: {
normal: {
show: false,
},
},
label: {
normal: {
position: "center",
},
},
data: [
{
value: value,
itemStyle: {
normal: {
color: "#68a8f2",
},
},
normal: {
show: false,
},
},
{
value: 100-value,
itemStyle: placeHolderStyle,
},
],
},
],
};
chChart.setOption(this.option);
window.onresize = chChart.resize;
})
},
},
watch: {},
})