IntelligentRecognition/ah-jjsp-web/.svn/pristine/7c/7c7e253246bd2d5e3c1e051217a...

182 lines
5.2 KiB
Plaintext
Raw Normal View History

2024-05-24 16:09:40 +08:00
let form, layer, myChart;
let user = getUser();
let changeModel = sessionStorage.getItem("changeModel");
layui.use(['form', 'layer'], function () {
form = layui.form;
layer = layui.layer;
myChart = echarts.init(document.getElementById('echarts-box'));
loadWeekPlanAjax('3');
})
// 周计划 - 全省
function loadWeekPlanAjax(type) {
let url = dataUrl + 'proteam/pot/sup/getWeekMaps';
let params = {
'isSup': user.isSup,
'orgId': user.orgId,
'type': type
};
ajaxRequest(url, "POST", params, true, function () {
}, function (result) {
if (parseInt(result.code) == 200) {
initEchartsOne(result.city, result.twoList, result.threeList);
} else if (parseInt(result.code) === 500) {
layer.alert('服务异常', { icon: 2 })
} else if (parseInt(result.code) === 401) {
logout(1);
}
}, function (xhr) {
});
}
function initEchartsOne(nameList, valueList, valueList2) {
let fontSize = '16', fontFamily = 'Alibaba PuHuiTi R', fontColor = (changeModel === '2' || !changeModel ? '#fff' : '#000'),
fontColor2 = '#000';
let option = {
backgroundColor: 'transparent',
tooltip: {
show: true,
trigger: 'axis',
axisPointer: {
type: 'shadow'
},
// backgroundColor: 'rgba(0, 0, 0, 0.63)', //设置背景颜色
textStyle: {
color: fontColor2,
fontFamily: fontFamily
},
// borderColor: "rgba(255,255,255, .5)",
},
legend: {
icon: 'circle',
data: ['二级', '三级'],
right: 20,
textStyle: {
color: fontColor,
fontSize: fontSize,
fontFamily: fontFamily
},
itemWidth: 15,
itemHeight: 15,
itemGap: 35
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis: [{
type: 'category',
data: nameList,
axisLine: {
show: true,
lineStyle: {
color: "#063374",
width: 1,
type: "solid"
}
},
axisTick: {
show: false,
},
axisLabel: {
show: true,
interval: 0, // 强制显示所有标签
textStyle: {
color: fontColor,
fontFamily: fontFamily,
fontSize: fontSize
}
},
}],
yAxis: [{
type: 'value',
axisTick: {
show: false,
},
axisLine: {
show: false,
lineStyle: {
color: fontColor,
width: 1,
type: "solid",
},
},
splitLine: {
lineStyle: {
color: '#063374',
type: 'dashed'
}
}
}],
series: [{
name: '二级',
type: 'bar',
data: valueList,
barWidth: 10, //柱子宽度
barGap: 0.5, //柱子之间间距
itemStyle: {
normal: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
offset: 0,
color: '#FF5D5D'
}, {
offset: 1,
color: '#FF5D5D'
}]),
opacity: 1,
}
},
label: {
normal: {
show: true,
position: 'top',
formatter: '{c}',
textStyle: {
color: fontColor,
fontSize: '14px',
fontFamily: fontFamily
}
}
},
}, {
name: '三级',
type: 'bar',
data: valueList2,
barWidth: 10,
barGap: 0.5,
itemStyle: {
normal: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
offset: 0,
color: '#F9770F'
}, {
offset: 1,
color: '#F9770F'
}]),
opacity: 1,
}
},
label: {
normal: {
show: true,
position: 'top',
formatter: '{c}',
textStyle: {
color: fontColor,
fontSize: '14px',
fontFamily: fontFamily
}
}
},
}]
};
myChart.setOption(option, true);
window.addEventListener("resize", function () {
myChart.resize();
});
}