920 lines
42 KiB
JavaScript
920 lines
42 KiB
JavaScript
var vms = Vue.component("amplify-rycqfb", {
|
||
template: `
|
||
<div>
|
||
<div class="amplify-title-icon">
|
||
<img src="https://fileimg.makalu.cc/WEB_DBD5893450984E50AFF356EF44FF4139.png" @click="openAmplify">
|
||
</div>
|
||
<transition name="el-zoom-in-top">
|
||
<div class="amplify-fixed" v-show="show" style="display: none" @click="closeAmplifyAll">
|
||
<div class="amplify-max">
|
||
<div class="amplify-title">
|
||
<div>人员出勤分布</div>
|
||
<div class="amplify-close" @click="closeAmplify"><i class="el-icon-close"></i></div>
|
||
</div>
|
||
<div class="amplify-content">
|
||
<!--内容区域-->
|
||
<div class="amplify-distribution">
|
||
<div class="amplify-distributionsmallbox" ref="anlifychart"></div>
|
||
<div class="amplify-distributionsmallbox" ref="anlifychart1"></div>
|
||
<div class="amplify-distributionsmallbox" ref="anlifychart3"></div>
|
||
<div class="amplify-distributionsmallbox" ref="anlifychart2"></div>
|
||
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</transition>
|
||
</div>
|
||
`,
|
||
props: {
|
||
|
||
},
|
||
data() {
|
||
return {
|
||
width:760,
|
||
workData_1:[{ text:"白名单(7天出勤人数,包含7天)", value:0 }],
|
||
//workData_2:[{ text:"灰名单(4-10天内出勤人数)", value:0 }],
|
||
workData_3:[{ text:"灰名单(超过7天未出勤人数,不包含7天)", value:0 }],
|
||
workData_4:[{ text:"临时人员(打突击线上教育人员)", value:0 }],
|
||
workData_5:[{ text:"退场人员", value:0 }],
|
||
workMax: 0,
|
||
show:false,
|
||
projectId:JSON.parse(localStorage.getItem("data")).id,
|
||
}
|
||
},
|
||
mounted(){
|
||
},
|
||
methods: {
|
||
openAmplify(){
|
||
this.show = true
|
||
this.getActivePeopleNum1()
|
||
},
|
||
closeAmplify(){
|
||
this.show = false
|
||
},
|
||
closeAmplifyAll(e){
|
||
if(e.target.className == 'amplify-fixed'){
|
||
this.show = false
|
||
}
|
||
},
|
||
//人员出勤分布接口
|
||
getActivePeopleNum1(){
|
||
axios.post("https://smz.makalu.cc/mkl/screenApi/getUnCqUserList?token="+JSON.parse(localStorage.getItem("data")).smz_token+"&maxDay=6&deptId=123&typtDeptId="+JSON.parse(localStorage.getItem("data")).dept_id+"&typtProjectId="+JSON.parse(localStorage.getItem("data")).id, {
|
||
}).then(res => {
|
||
if(res.data.state == "OK"){
|
||
var max = this.workMax;
|
||
if(res.data.data.length > max){
|
||
this.workMax = res.data.data.length;
|
||
}
|
||
|
||
this.workData_1 = [{ text:"白名单(7天出勤人数,包含7天)", value:res.data.data.length }];
|
||
}else{
|
||
this.workData_1 = [{ text:"白名单(7天出勤人数,包含7天)", value:0 }];
|
||
}
|
||
this.getChartData()
|
||
axios.post("https://smz.makalu.cc/mkl/screenApi/getUnCqUserList?token="+JSON.parse(localStorage.getItem("data")).smz_token+"&dayNum=7&deptId=123&typtDeptId="+JSON.parse(localStorage.getItem("data")).dept_id+"&typtProjectId="+JSON.parse(localStorage.getItem("data")).id, {
|
||
}).then(res => {
|
||
if(res.data.state == "OK"){
|
||
var max = this.workMax;
|
||
if(res.data.data.length > max){
|
||
this.workMax = res.data.data.length;
|
||
}
|
||
this.workData_3 = [{ text:"灰名单(超过7天未出勤人数,不包含7天)", value:res.data.data.length }];
|
||
}else{
|
||
this.workData_3 = [{ text:"灰名单(超过7天未出勤人数,不包含7天)", value:0 }];
|
||
}
|
||
this.getChartData1()
|
||
axios.post("https://smz.makalu.cc/mkl/screenApi/getUserInfoTempList?token="+JSON.parse(localStorage.getItem("data")).smz_token+"&isWork=1&deptId=123&typtDeptId="+JSON.parse(localStorage.getItem("data")).dept_id+"&typtProjectId="+JSON.parse(localStorage.getItem("data")).id, {
|
||
}).then(res => {
|
||
if(res.data.state == "OK"){
|
||
var max = this.workMax;
|
||
if(res.data.data.length > max){
|
||
this.workMax = res.data.data.length;
|
||
}
|
||
this.workData_4 = [{ text:"临时人员(打突击线上教育人员)", value:res.data.data.length}];
|
||
}else{
|
||
this.workData_4 = [{ text:"临时人员(打突击线上教育人员)", value:0 }];
|
||
}
|
||
this.getChartData2()
|
||
axios.post("https://smz.makalu.cc/mkl/screenApi/getUserInfoList?token="+JSON.parse(localStorage.getItem("data")).smz_token+"&isWork=2&deptId=123&typtDeptId="+JSON.parse(localStorage.getItem("data")).dept_id+"&typtProjectId="+JSON.parse(localStorage.getItem("data")).id, {
|
||
}).then(res => {
|
||
if(res.data.state == "OK"){
|
||
var max = this.workMax;
|
||
if(res.data.data.length > max){
|
||
this.workMax = res.data.data.length;
|
||
}
|
||
this.workData_5 = [{ text:"退场人员", value:res.data.data.length }];
|
||
}else{
|
||
this.workData_5 = [{ text:"退场人员", value:0 }];
|
||
}
|
||
this.getChartData3()
|
||
}).catch(err => {
|
||
})
|
||
}).catch(err => {
|
||
})
|
||
}).catch(err => {
|
||
})
|
||
}).catch(err => {
|
||
})
|
||
|
||
|
||
|
||
},
|
||
//出勤情况-白名单
|
||
getChartData(){
|
||
//品类金额占比 饼图
|
||
var chChart = echarts.init(this.$refs.anlifychart);
|
||
this.echart1(chChart,this.workData_1)
|
||
},
|
||
//出勤情况-灰名单
|
||
getChartData1(){
|
||
//品类金额占比 饼图
|
||
var chChart = echarts.init(this.$refs.anlifychart1);
|
||
this.echart2(chChart,this.workData_3)
|
||
},
|
||
//出勤情况-临时人员
|
||
getChartData2(){
|
||
//品类金额占比 饼图
|
||
var chChart = echarts.init(this.$refs.anlifychart2);
|
||
this.echart3(chChart,this.workData_4)
|
||
},
|
||
//出勤情况-在线人员
|
||
getChartData3(){
|
||
//品类金额占比 饼图
|
||
var chChart = echarts.init(this.$refs.anlifychart3);
|
||
this.echart4(chChart,this.workData_5)
|
||
},
|
||
//出勤情况-白名单
|
||
echart1(chChart,chartData){
|
||
console.log(chartData)
|
||
var that = this
|
||
let newPromise = new Promise((resolve) => {
|
||
resolve()
|
||
})
|
||
//然后异步执行echarts的初始化函数
|
||
newPromise.then(() => {
|
||
|
||
var value = []
|
||
var text = []
|
||
var bgData = []
|
||
var total = 0
|
||
for (let i = 0; i < chartData.length; i++) {
|
||
value.push(chartData[i].value)
|
||
text.push(chartData[i].text)
|
||
bgData.push(100)
|
||
if(this.workMax){
|
||
total = this.workMax
|
||
}else{
|
||
total += chartData[i].value
|
||
}
|
||
}
|
||
|
||
var prop = []
|
||
for (let j = 0; j < value.length; j++) {
|
||
if(total == 0){
|
||
prop.push(0)
|
||
}else{
|
||
prop.push((value[j]/total * 100).toFixed(1))
|
||
}
|
||
}
|
||
var unit = '人'
|
||
if(this.unit){
|
||
unit = this.unit
|
||
}
|
||
|
||
|
||
this.option = {
|
||
grid: {
|
||
left: "5%",
|
||
right: "5%",
|
||
bottom: "0%",
|
||
top: "0%",
|
||
containLabel: true,
|
||
},
|
||
xAxis: [{
|
||
show: false,
|
||
},
|
||
//由于下边X轴已经是百分比刻度了,所以需要在顶部加一个X轴,刻度是金额,也隐藏掉
|
||
{
|
||
show: false,
|
||
}
|
||
],
|
||
yAxis: [
|
||
{
|
||
type: 'category',
|
||
axisLabel: {
|
||
show: false, //让Y轴数据不显示
|
||
},
|
||
itemStyle: {
|
||
|
||
},
|
||
axisTick: {
|
||
show: false, //隐藏Y轴刻度
|
||
},
|
||
axisLine: {
|
||
show: false, //隐藏Y轴线段
|
||
},
|
||
data: [],
|
||
},{
|
||
show: false,
|
||
data: [],
|
||
axisLine: {
|
||
show: false
|
||
}
|
||
}],
|
||
series: [
|
||
//数据条--------------------我是分割线君------------------------------//
|
||
{
|
||
show: true,
|
||
type: 'bar',
|
||
xAxisIndex: 1, //代表使用第二个X轴刻度!!!!!!!!!!!!!!!!!!!!!!!!
|
||
barGap: '-100%',
|
||
barWidth: '20', //统计条宽度
|
||
itemStyle: {
|
||
normal: {
|
||
color: 'rgba(22,203,115,0.05)'
|
||
},
|
||
},
|
||
label: {
|
||
normal: {
|
||
show: true,
|
||
//label 的position位置可以是top bottom left,right,也可以是固定值
|
||
//在这里需要上下统一对齐,所以用固定值
|
||
position: [0, '-40'],
|
||
rich: { //富文本
|
||
prop: { //自定义颜色
|
||
color: '#c6d9fa',
|
||
fontSize:'25',
|
||
},
|
||
unit:{
|
||
color: '#6c829a',
|
||
fontSize:'25',
|
||
},
|
||
yes:{
|
||
color: '#55adf7',
|
||
fontSize:'25',
|
||
},
|
||
not:{
|
||
color: '#4677fa',
|
||
fontSize:'25',
|
||
},
|
||
index:{
|
||
color: '#fcbc02',
|
||
fontStyle: 'italic',
|
||
padding:[0,0,0,5],
|
||
fontSize:'25',
|
||
},
|
||
name: {
|
||
width: this.width,
|
||
color: '#c6d9fa',
|
||
padding:[0,0,0,5],
|
||
fontSize:'25',
|
||
},
|
||
color:{
|
||
color: '#8ca2be',
|
||
fontSize:'20',
|
||
},
|
||
arrow:{
|
||
width:20,
|
||
height:15,
|
||
backgroundColor: {
|
||
image: "https://fileimg.makalu.cc/WEB_2B7C06210CD44D55BFEE6205A35DE4A7.png",
|
||
},
|
||
},
|
||
|
||
},
|
||
formatter: function(data) {
|
||
//富文本固定格式{colorName|这里填你想要写的内容}
|
||
//return '{arrow|}'
|
||
if(that.show == true){
|
||
return '{arrow|}{name|' + text[data.dataIndex] + '}{prop|' + value[data.dataIndex] + '}{color| '+unit+'}';
|
||
}else{
|
||
return '{arrow|}{name|' + text[data.dataIndex] + '}{prop|' + value[data.dataIndex] + '}{color| '+unit+'} {prop|'+prop[data.dataIndex]+'}{color| %} ';
|
||
}
|
||
|
||
},
|
||
}
|
||
},
|
||
data: bgData,
|
||
},
|
||
{
|
||
type: "bar",
|
||
zlevel: 1,
|
||
itemStyle: {
|
||
normal: {
|
||
color: "#6ab9fe",
|
||
},
|
||
},
|
||
barWidth: 20,
|
||
data: prop,
|
||
},
|
||
{
|
||
type: "bar",
|
||
barWidth: 20,
|
||
barGap: "-100%",
|
||
data: bgData,
|
||
itemStyle: {
|
||
normal: {
|
||
color: "rgba(24,31,68,1)",
|
||
},
|
||
},
|
||
},
|
||
],
|
||
};
|
||
|
||
chChart.setOption(this.option);
|
||
window.onresize = chChart.resize;
|
||
|
||
chChart.off('click')
|
||
|
||
chChart.on('click', function (params) {
|
||
that.$emit('personnel',params.dataIndex);
|
||
})
|
||
})
|
||
},
|
||
//出勤情况-灰名单
|
||
echart2(chChart,chartData){
|
||
console.log(chartData)
|
||
var that = this
|
||
let newPromise = new Promise((resolve) => {
|
||
resolve()
|
||
})
|
||
//然后异步执行echarts的初始化函数
|
||
newPromise.then(() => {
|
||
|
||
var value = []
|
||
var text = []
|
||
var bgData = []
|
||
var total = 0
|
||
for (let i = 0; i < chartData.length; i++) {
|
||
value.push(chartData[i].value)
|
||
text.push(chartData[i].text)
|
||
bgData.push(100)
|
||
if(this.workMax){
|
||
total = this.workMax
|
||
}else{
|
||
total += chartData[i].value
|
||
}
|
||
}
|
||
|
||
var prop = []
|
||
for (let j = 0; j < value.length; j++) {
|
||
console.log(value)
|
||
if(total == 0){
|
||
prop.push(0)
|
||
}else{
|
||
prop.push((value[j]/total * 100).toFixed(1))
|
||
}
|
||
}
|
||
console.log(prop)
|
||
var unit = '人'
|
||
if(this.unit){
|
||
unit = this.unit
|
||
}
|
||
|
||
|
||
this.option = {
|
||
grid: {
|
||
left: "5%",
|
||
right: "5%",
|
||
bottom: "0%",
|
||
top: "0%",
|
||
containLabel: true,
|
||
},
|
||
xAxis: [{
|
||
show: false,
|
||
},
|
||
//由于下边X轴已经是百分比刻度了,所以需要在顶部加一个X轴,刻度是金额,也隐藏掉
|
||
{
|
||
show: false,
|
||
}
|
||
],
|
||
yAxis: [
|
||
{
|
||
type: 'category',
|
||
axisLabel: {
|
||
show: false, //让Y轴数据不显示
|
||
},
|
||
itemStyle: {
|
||
|
||
},
|
||
axisTick: {
|
||
show: false, //隐藏Y轴刻度
|
||
},
|
||
axisLine: {
|
||
show: false, //隐藏Y轴线段
|
||
},
|
||
data: [],
|
||
},{
|
||
show: false,
|
||
data: [],
|
||
axisLine: {
|
||
show: false
|
||
}
|
||
}],
|
||
series: [
|
||
//数据条--------------------我是分割线君------------------------------//
|
||
{
|
||
show: true,
|
||
type: 'bar',
|
||
xAxisIndex: 1, //代表使用第二个X轴刻度!!!!!!!!!!!!!!!!!!!!!!!!
|
||
barGap: '-100%',
|
||
barWidth: '20', //统计条宽度
|
||
itemStyle: {
|
||
normal: {
|
||
color: 'rgba(22,203,115,0.05)'
|
||
},
|
||
},
|
||
label: {
|
||
normal: {
|
||
show: true,
|
||
//label 的position位置可以是top bottom left,right,也可以是固定值
|
||
//在这里需要上下统一对齐,所以用固定值
|
||
position: [0, '-40'],
|
||
rich: { //富文本
|
||
prop: { //自定义颜色
|
||
color: '#c6d9fa',
|
||
fontSize:'25',
|
||
},
|
||
unit:{
|
||
color: '#6c829a',
|
||
fontSize:'25',
|
||
},
|
||
yes:{
|
||
color: '#55adf7',
|
||
fontSize:'25',
|
||
},
|
||
not:{
|
||
color: '#4677fa',
|
||
fontSize:'25',
|
||
},
|
||
index:{
|
||
color: '#fcbc02',
|
||
fontStyle: 'italic',
|
||
padding:[0,0,0,5],
|
||
fontSize:'25',
|
||
},
|
||
name: {
|
||
width: this.width,
|
||
color: '#c6d9fa',
|
||
padding:[0,0,0,5],
|
||
fontSize:'25',
|
||
},
|
||
color:{
|
||
color: '#8ca2be',
|
||
fontSize:'20',
|
||
},
|
||
arrow:{
|
||
width:20,
|
||
height:15,
|
||
backgroundColor: {
|
||
image: "https://fileimg.makalu.cc/WEB_2B7C06210CD44D55BFEE6205A35DE4A7.png",
|
||
},
|
||
},
|
||
|
||
},
|
||
formatter: function(data) {
|
||
//富文本固定格式{colorName|这里填你想要写的内容}
|
||
//return '{arrow|}'
|
||
if(that.show == true){
|
||
return '{arrow|}{name|' + text[data.dataIndex] + '}{prop|' + value[data.dataIndex] + '}{color| '+unit+'}';
|
||
}else{
|
||
return '{arrow|}{name|' + text[data.dataIndex] + '}{prop|' + value[data.dataIndex] + '}{color| '+unit+'} {prop|'+prop[data.dataIndex]+'}{color| %} ';
|
||
}
|
||
|
||
},
|
||
}
|
||
},
|
||
data: bgData,
|
||
},
|
||
{
|
||
type: "bar",
|
||
zlevel: 1,
|
||
itemStyle: {
|
||
normal: {
|
||
color: "#6ab9fe",
|
||
},
|
||
},
|
||
barWidth: 20,
|
||
data: prop,
|
||
},
|
||
{
|
||
type: "bar",
|
||
barWidth: 20,
|
||
barGap: "-100%",
|
||
data: bgData,
|
||
itemStyle: {
|
||
normal: {
|
||
color: "rgba(24,31,68,1)",
|
||
},
|
||
},
|
||
},
|
||
],
|
||
};
|
||
|
||
chChart.setOption(this.option);
|
||
window.onresize = chChart.resize;
|
||
|
||
chChart.off('click')
|
||
|
||
chChart.on('click', function (params) {
|
||
that.$emit('personnel',params.dataIndex);
|
||
})
|
||
})
|
||
},
|
||
//出勤情况-临时人员
|
||
echart3(chChart,chartData){
|
||
console.log(chartData)
|
||
var that = this
|
||
let newPromise = new Promise((resolve) => {
|
||
resolve()
|
||
})
|
||
//然后异步执行echarts的初始化函数
|
||
newPromise.then(() => {
|
||
|
||
var value = []
|
||
var text = []
|
||
var bgData = []
|
||
var total = 0
|
||
for (let i = 0; i < chartData.length; i++) {
|
||
value.push(chartData[i].value)
|
||
text.push(chartData[i].text)
|
||
bgData.push(100)
|
||
if(this.workMax){
|
||
total = this.workMax
|
||
}else{
|
||
total += chartData[i].value
|
||
}
|
||
}
|
||
|
||
var prop = []
|
||
for (let j = 0; j < value.length; j++) {
|
||
if(total == 0){
|
||
prop.push(0)
|
||
}else{
|
||
prop.push((value[j]/total * 100).toFixed(1))
|
||
}
|
||
}
|
||
var unit = '人'
|
||
if(this.unit){
|
||
unit = this.unit
|
||
}
|
||
|
||
|
||
this.option = {
|
||
grid: {
|
||
left: "5%",
|
||
right: "5%",
|
||
bottom: "0%",
|
||
top: "0%",
|
||
containLabel: true,
|
||
},
|
||
xAxis: [{
|
||
show: false,
|
||
},
|
||
//由于下边X轴已经是百分比刻度了,所以需要在顶部加一个X轴,刻度是金额,也隐藏掉
|
||
{
|
||
show: false,
|
||
}
|
||
],
|
||
yAxis: [
|
||
{
|
||
type: 'category',
|
||
axisLabel: {
|
||
show: false, //让Y轴数据不显示
|
||
},
|
||
itemStyle: {
|
||
|
||
},
|
||
axisTick: {
|
||
show: false, //隐藏Y轴刻度
|
||
},
|
||
axisLine: {
|
||
show: false, //隐藏Y轴线段
|
||
},
|
||
data: [],
|
||
},{
|
||
show: false,
|
||
data: [],
|
||
axisLine: {
|
||
show: false
|
||
}
|
||
}],
|
||
series: [
|
||
//数据条--------------------我是分割线君------------------------------//
|
||
{
|
||
show: true,
|
||
type: 'bar',
|
||
xAxisIndex: 1, //代表使用第二个X轴刻度!!!!!!!!!!!!!!!!!!!!!!!!
|
||
barGap: '-100%',
|
||
barWidth: '20', //统计条宽度
|
||
itemStyle: {
|
||
normal: {
|
||
color: 'rgba(22,203,115,0.05)'
|
||
},
|
||
},
|
||
label: {
|
||
normal: {
|
||
show: true,
|
||
//label 的position位置可以是top bottom left,right,也可以是固定值
|
||
//在这里需要上下统一对齐,所以用固定值
|
||
position: [0, '-40'],
|
||
rich: { //富文本
|
||
prop: { //自定义颜色
|
||
color: '#c6d9fa',
|
||
fontSize:'25',
|
||
},
|
||
unit:{
|
||
color: '#6c829a',
|
||
fontSize:'25',
|
||
},
|
||
yes:{
|
||
color: '#55adf7',
|
||
fontSize:'25',
|
||
},
|
||
not:{
|
||
color: '#4677fa',
|
||
fontSize:'25',
|
||
},
|
||
index:{
|
||
color: '#fcbc02',
|
||
fontStyle: 'italic',
|
||
padding:[0,0,0,5],
|
||
fontSize:'25',
|
||
},
|
||
name: {
|
||
width: this.width,
|
||
color: '#c6d9fa',
|
||
padding:[0,0,0,5],
|
||
fontSize:'25',
|
||
},
|
||
color:{
|
||
color: '#8ca2be',
|
||
fontSize:'20',
|
||
},
|
||
arrow:{
|
||
width:20,
|
||
height:15,
|
||
backgroundColor: {
|
||
image: "https://fileimg.makalu.cc/WEB_2B7C06210CD44D55BFEE6205A35DE4A7.png",
|
||
},
|
||
},
|
||
|
||
},
|
||
formatter: function(data) {
|
||
//富文本固定格式{colorName|这里填你想要写的内容}
|
||
//return '{arrow|}'
|
||
if(that.show == true){
|
||
return '{arrow|}{name|' + text[data.dataIndex] + '}{prop|' + value[data.dataIndex] + '}{color| '+unit+'}';
|
||
}else{
|
||
return '{arrow|}{name|' + text[data.dataIndex] + '}{prop|' + value[data.dataIndex] + '}{color| '+unit+'} {prop|'+prop[data.dataIndex]+'}{color| %} ';
|
||
}
|
||
|
||
},
|
||
}
|
||
},
|
||
data: bgData,
|
||
},
|
||
{
|
||
type: "bar",
|
||
zlevel: 1,
|
||
itemStyle: {
|
||
normal: {
|
||
color: "#6ab9fe",
|
||
},
|
||
},
|
||
barWidth: 20,
|
||
data: prop,
|
||
},
|
||
{
|
||
type: "bar",
|
||
barWidth: 20,
|
||
barGap: "-100%",
|
||
data: bgData,
|
||
itemStyle: {
|
||
normal: {
|
||
color: "rgba(24,31,68,1)",
|
||
},
|
||
},
|
||
},
|
||
],
|
||
};
|
||
|
||
chChart.setOption(this.option);
|
||
window.onresize = chChart.resize;
|
||
|
||
chChart.off('click')
|
||
|
||
chChart.on('click', function (params) {
|
||
that.$emit('personnel',params.dataIndex);
|
||
})
|
||
})
|
||
},
|
||
//出勤情况-在线人员
|
||
echart4(chChart,chartData){
|
||
console.log(chartData)
|
||
var that = this
|
||
let newPromise = new Promise((resolve) => {
|
||
resolve()
|
||
})
|
||
//然后异步执行echarts的初始化函数
|
||
newPromise.then(() => {
|
||
|
||
var value = []
|
||
var text = []
|
||
var bgData = []
|
||
var total = 0
|
||
for (let i = 0; i < chartData.length; i++) {
|
||
value.push(chartData[i].value)
|
||
text.push(chartData[i].text)
|
||
bgData.push(100)
|
||
if(this.workMax){
|
||
total = this.workMax
|
||
}else{
|
||
total += chartData[i].value
|
||
}
|
||
}
|
||
|
||
var prop = []
|
||
for (let j = 0; j < value.length; j++) {
|
||
if(total == 0){
|
||
prop.push(0)
|
||
}else{
|
||
prop.push((value[j]/total * 100).toFixed(1))
|
||
}
|
||
}
|
||
var unit = '人'
|
||
if(this.unit){
|
||
unit = this.unit
|
||
}
|
||
|
||
|
||
this.option = {
|
||
grid: {
|
||
left: "5%",
|
||
right: "5%",
|
||
bottom: "0%",
|
||
top: "0%",
|
||
containLabel: true,
|
||
},
|
||
xAxis: [{
|
||
show: false,
|
||
},
|
||
//由于下边X轴已经是百分比刻度了,所以需要在顶部加一个X轴,刻度是金额,也隐藏掉
|
||
{
|
||
show: false,
|
||
}
|
||
],
|
||
yAxis: [
|
||
{
|
||
type: 'category',
|
||
axisLabel: {
|
||
show: false, //让Y轴数据不显示
|
||
},
|
||
itemStyle: {
|
||
|
||
},
|
||
axisTick: {
|
||
show: false, //隐藏Y轴刻度
|
||
},
|
||
axisLine: {
|
||
show: false, //隐藏Y轴线段
|
||
},
|
||
data: [],
|
||
},{
|
||
show: false,
|
||
data: [],
|
||
axisLine: {
|
||
show: false
|
||
}
|
||
}],
|
||
series: [
|
||
//数据条--------------------我是分割线君------------------------------//
|
||
{
|
||
show: true,
|
||
type: 'bar',
|
||
xAxisIndex: 1, //代表使用第二个X轴刻度!!!!!!!!!!!!!!!!!!!!!!!!
|
||
barGap: '-100%',
|
||
barWidth: '20', //统计条宽度
|
||
itemStyle: {
|
||
normal: {
|
||
color: 'rgba(22,203,115,0.05)'
|
||
},
|
||
},
|
||
label: {
|
||
normal: {
|
||
show: true,
|
||
//label 的position位置可以是top bottom left,right,也可以是固定值
|
||
//在这里需要上下统一对齐,所以用固定值
|
||
position: [0, '-40'],
|
||
rich: { //富文本
|
||
prop: { //自定义颜色
|
||
color: '#c6d9fa',
|
||
fontSize:'25',
|
||
},
|
||
unit:{
|
||
color: '#6c829a',
|
||
fontSize:'25',
|
||
},
|
||
yes:{
|
||
color: '#55adf7',
|
||
fontSize:'25',
|
||
},
|
||
not:{
|
||
color: '#4677fa',
|
||
fontSize:'25',
|
||
},
|
||
index:{
|
||
color: '#fcbc02',
|
||
fontStyle: 'italic',
|
||
padding:[0,0,0,5],
|
||
fontSize:'25',
|
||
},
|
||
name: {
|
||
width: this.width,
|
||
color: '#c6d9fa',
|
||
padding:[0,0,0,5],
|
||
fontSize:'25',
|
||
},
|
||
color:{
|
||
color: '#8ca2be',
|
||
fontSize:'20',
|
||
},
|
||
arrow:{
|
||
width:20,
|
||
height:15,
|
||
backgroundColor: {
|
||
image: "https://fileimg.makalu.cc/WEB_2B7C06210CD44D55BFEE6205A35DE4A7.png",
|
||
},
|
||
},
|
||
|
||
},
|
||
formatter: function(data) {
|
||
//富文本固定格式{colorName|这里填你想要写的内容}
|
||
//return '{arrow|}'
|
||
if(that.show == true){
|
||
return '{arrow|}{name|' + text[data.dataIndex] + '}{prop|' + value[data.dataIndex] + '}{color| '+unit+'}';
|
||
}else{
|
||
return '{arrow|}{name|' + text[data.dataIndex] + '}{prop|' + value[data.dataIndex] + '}{color| '+unit+'} {prop|'+prop[data.dataIndex]+'}{color| %} ';
|
||
}
|
||
|
||
},
|
||
}
|
||
},
|
||
data: bgData,
|
||
},
|
||
{
|
||
type: "bar",
|
||
zlevel: 1,
|
||
itemStyle: {
|
||
normal: {
|
||
color: "#6ab9fe",
|
||
},
|
||
},
|
||
barWidth: 20,
|
||
data: prop,
|
||
},
|
||
{
|
||
type: "bar",
|
||
barWidth: 20,
|
||
barGap: "-100%",
|
||
data: bgData,
|
||
itemStyle: {
|
||
normal: {
|
||
color: "rgba(24,31,68,1)",
|
||
},
|
||
},
|
||
},
|
||
],
|
||
};
|
||
|
||
chChart.setOption(this.option);
|
||
window.onresize = chChart.resize;
|
||
|
||
chChart.off('click')
|
||
|
||
chChart.on('click', function (params) {
|
||
that.$emit('personnel',params.dataIndex);
|
||
})
|
||
})
|
||
},
|
||
|
||
},
|
||
watch:{
|
||
data: function (n,o) {
|
||
this.getChartData()
|
||
this.getChartData1()
|
||
this.getChartData2()
|
||
this.getChartData3()
|
||
},
|
||
max: function (n,o) {
|
||
this.getChartData()
|
||
this.getChartData1()
|
||
this.getChartData2()
|
||
this.getChartData3()
|
||
}
|
||
}
|
||
})
|
||
|
||
|