var vms = Vue.component("Company-amplify-gzzb", { template: `
`, props: { }, data() { return { show:false, typedata:[], active:0, option:{}, height:460, width:280 } }, mounted(){ }, methods: { openAmplify(){ this.show = true this.getGZData() //工种占比 }, closeAmplify(){ this.show = false }, closeAmplifyAll(e){ if(e.target.className == 'amplify-fixed'){ this.show = false } }, //工种占比 getGZData(){ axios.post("https://smz.makalu.cc/mkl/screenApi/getWorkTypeData?token=00e650bb50854f54b146e83f73500ca8&deptId=123&typtDeptId="+JSON.parse(localStorage.getItem("data")).dept_id, { }).then(res => { var workPropData = []; var data = res.data.workTypeData; for (let i = 0; i < data.length; i++) { workPropData.push({text:data[i].name,value:data[i].value,prop: data[i].percent}) } this.typedata = workPropData; this.getChartData() this.getChartData1() this }).catch(err => { }) }, // 左边饼图展示 getChartData(){ //品类金额占比 饼图 var chChartPie = echarts.init(this.$refs.warningPieChart); this.echartPie(chChartPie,this.typedata) }, echartPie(chChart,chartData){ let newPromise = new Promise((resolve) => { resolve() }) //然后异步执行echarts的初始化函数 newPromise.then(() => { var total_datas = 0; var data = []; var legendData = []; var color = ['#4974ff','#52aef7','#6863d7','#1d5d89','#20e6ff','#67feef'] for (let i = 0; i { return a + b.value; }, 0);*/ this.option = { title: { text: total_datas, subtext: "总人数", x: "center", y: "193", textStyle: { color: "#0dd2fd", fontSize: 36, fontWeight: "normal", align: "center", width: "200px", }, subtextStyle: { color: "#a5b5f0", fontSize: 18, fontWeight: "normal", align: "center", }, }, tooltip: { trigger: 'item', formatter: "{b}
{c} ({d}%)" }, series: [ { name: "品类金额占比", type: "pie", center: ["50%", "50%"], radius: ["53%", "70%"], data: data, label: { show: false, }, itemStyle: { normal: { borderWidth: 5, borderColor: "#051a36" } }, }, { name: "外边框", type: "pie", clockWise: false, //顺时加载 hoverAnimation: false, //鼠标移入变大 center: ["50%", "50%"], radius: ["78%", "78%"], label: { normal: { show: false, }, }, data: [ { value: 9, name: "", itemStyle: { normal: { borderWidth: 3, borderColor: "#152c65", }, }, }, ], }, ], } chChart.setOption(this.option); window.onresize = chChart.resize; }) }, // 右边echarts //分类及工时情况 getChartData1(){ var chChartBar = echarts.init(this.$refs.chart); this.echartBar(chChartBar,this.typedata) }, echartBar(chChart,chartData){ var that = this let newPromise = new Promise((resolve) => { resolve() }) //然后异步执行echarts的初始化函数 newPromise.then(() => { var value = []; var prop = []; var text = []; var zero = [] var total = 0 for (let i = chartData.length-1; i >=0; i--) { total += chartData[i].value; value.push(chartData[i].value) prop.push(chartData[i].prop.toFixed(2)) text.push(chartData[i].text) zero.push(0) } var data = [] var data_all = new Array(prop.length) for (let i = 0; i