Files
cmanager/public/chengdu/js/post.js
2024-02-05 10:16:53 +08:00

1103 lines
32 KiB
JavaScript

var baseUrl = "http://39.101.167.152:8088/shekecaiji";
var href = window.location.href.split("=");
var shengFen = unescape(href[1]);
$("#name").text(shengFen + "市场招聘大数据展示平台");
//console.log(shengFen);
//头部数据--------------------------------------
//获取当前时间
var formattedDateTime;
var showOtherFlag = false;
function getDate() {
$.ajax({
type: "GET",
url: baseUrl + "/dataNew/getDate",
async: false,
success: function (res) {
console.log(res);
formattedDateTime = res.data;
var text = res.data.split("-")[1];
if (Number(text) >= 10) {
$("#btn1").text(text + "月分析");
} else {
$("#btn1").text(text.substring(1, 2) + "月分析");
}
},
});
}
function showOther(obj) {
if (!showOtherFlag) {
$(".echart7").hide();
$(".echart12").hide();
showOtherFlag = true;
} else {
$(".echart7").show();
$(".echart12").show();
showOtherFlag = false;
}
}
function toggleView(obj) {
$(obj).siblings().removeClass("active");
$(obj).addClass("active");
var viewId = $(obj).attr("viewId");
if (viewId == "1") {
$(".mainbox1").show();
$(".mainbox3").hide();
getData8();
getData5();
getData9();
getData4();
getData10();
getData7();
getData12();
} else if (viewId == "2") {
$(".mainbox1").hide();
$(".mainbox3").show();
get_echart_trend1();
get_echart_trend2();
}
}
//当月分析
//分行业
function getData8() {
$.ajax({
type: "GET",
url: baseUrl + "/dataNew/getData8",
async: false,
data: { date: formattedDateTime, shengfen: shengFen },
success: function (res) {
//console.log(res);
if (res.code == "0") {
var data = res.data;
if (data.name.length > 0) {
quanGuo(data);
$(".myscroll").myScroll({
//jQuery文字无缝滚动
speed: 40, //数值越大,速度越慢
rowHeight: 26, //li的高度
});
}
}
},
});
}
function quanGuo(data) {
$("#ulBox").empty();
$(data.name).each(function (i, n) {
$("#ulBox").append(
'<li><span><span class="radius">' +
(i + 1) +
'</span></span><span class="shengFen">' +
n +
"</span><span>" +
data.data1[i] +
"</span><span>" +
data.data2[i] +
"</span></li>"
);
});
}
//分单位
function getData5() {
$.ajax({
type: "GET",
url: baseUrl + "/dataNew/getData5",
async: false,
data: { date: formattedDateTime, shengfen: shengFen },
success: function (res) {
//console.log(res);
if (res.code == "0") {
var myChart = echarts.init(document.getElementById("echart5"));
var option = {
title: {
text: "分单位性质招聘需求",
subtext: "",
left: "center",
textStyle: { fontSize: 13, color: "#fff", fontWeight: 400 },
},
legend: { left: "left", textStyle: { color: "#fff", fontSize: 10 } },
tooltip: { trigger: "axis", axisPointer: { type: "shadow" } },
grid: {
left: "0",
top: "20%",
right: "5",
bottom: "5",
containLabel: true,
},
xAxis: {
nameLocation: "end",
nameGap: 7,
type: "category",
data: res.data.name,
axisLine: {
show: true,
lineStyle: {
color: "rgba(255,255,255,.9)",
width: 1,
type: "solid",
},
},
axisTick: { show: false },
axisLabel: {
interval: 0,
rotate: 0,
textStyle: { color: "rgba(255,255,255,.6)", fontSize: "9" },
},
},
yAxis: {
type: "value",
name: "万人",
nameGap: 0,
nameTextStyle: { color: "#fff", fontSize: 10, padding: 6 },
position: "top",
axisLabel: {
show: true,
textStyle: { color: "rgba(255,255,255,.6)", fontSize: "10" },
},
axisTick: { show: false },
axisLine: {
show: true,
lineStyle: {
color: "rgba(255,255,255,.9)",
width: 1,
type: "solid",
},
},
splitLine: { lineStyle: { color: "rgba(255,255,255,.1)" } },
},
series: [
{
type: "bar",
name: "需求人数",
barWidth: "15%",
itemStyle: {
normal: { opacity: 1, barBorderRadius: 0, color: "#dd76aa" },
},
label: {
show: true,
position: "top",
distance: 5,
fontSize: "8",
},
data: res.data.data1,
},
{
type: "bar",
name: "求职人数",
barWidth: "15%",
itemStyle: {
normal: { opacity: 1, barBorderRadius: 0, color: "#36c3fd" },
},
label: {
show: true,
position: "top",
distance: 5,
fontSize: "8",
},
data: res.data.data2,
},
],
};
myChart.setOption(option);
window.addEventListener("resize", function () {
myChart.resize();
});
}
},
});
}
//性别饼图
function getData9() {
$.ajax({
type: "GET",
url: baseUrl + "/dataNew/getData9",
async: false,
data: { date: formattedDateTime, shengfen: shengFen },
success: function (res) {
//console.log(res);
if (res.code == "0") {
var arr = [];
for (var i = 0; i < res.data.name.length; i++) {
var obj = {};
obj.name = res.data.name[i];
obj.value = res.data.data1[i];
arr.push(obj);
}
var myChart = echarts.init(document.getElementById("echart9"));
var option = {
title: {
text: "分性别招聘需求",
subtext: "",
left: "center",
textStyle: { fontSize: 13, color: "#fff", fontWeight: 400 },
},
legend: {
orient: "vertical",
left: "left",
textStyle: { color: "#fff", fontSize: 10 },
},
series: [
{
name: "",
type: "pie",
color: [
"#45C2E0",
"#C1EBDD",
"#FFC851",
"#5A5476",
"#1869A0",
"#FF9393",
],
radius: "50%",
data: arr,
label: { normal: { show: true, formatter: "{b}:{c}万人" } },
center: ["50%", "60%"],
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: "rgba(0, 0, 0, 0.5)",
},
},
},
],
};
myChart.setOption(option);
window.addEventListener("resize", function () {
myChart.resize();
});
}
},
});
}
//获取岗位数gvs和招聘人数zprs
function getData1() {
$.ajax({
type: "GET",
url: baseUrl + "/dataNew/getData1",
async: false,
data: { date: formattedDateTime, shengfen: shengFen },
success: function (res) {
//console.log(res);
if ((res.code = "0")) {
var xq = res.data.xq;
var qz = res.data.qz;
$(".xuqiu").text("总岗位数:" + xq + "万个");
$(".qiuzhi").text("求职总人数:" + qz + "万人");
}
},
});
}
//分岗位招聘需求
function getData4() {
$.ajax({
type: "GET",
url: baseUrl + "/dataNew/getData4",
async: false,
data: { date: formattedDateTime, shengfen: shengFen },
success: function (res) {
console.log(res);
if (res.code == "0") {
var name = [];
var xq = [];
var qz = [];
for (var i = 0; i < res.data.length; i++) {
name.push(res.data[i].name);
xq.push(res.data[i].xq);
qz.push(res.data[i].qz);
}
var myChart = echarts.init(document.getElementById("echart4"));
var option = {
title: {
text: "分岗位招聘需求",
subtext: "",
left: "center",
textStyle: { fontSize: 13, color: "#fff", fontWeight: 400 },
},
legend: { left: "left", textStyle: { color: "#fff", fontSize: 10 } },
tooltip: { trigger: "axis", axisPointer: { type: "shadow" } },
grid: {
left: "0",
top: "20%",
right: "0",
bottom: "5",
containLabel: true,
},
xAxis: {
nameLocation: "end",
nameGap: 7,
type: "category",
data: name,
axisLine: {
show: true,
lineStyle: {
color: "rgba(255,255,255,.9)",
width: 1,
type: "solid",
},
},
axisTick: { show: false },
axisLabel: {
interval: 0,
rotate: 0,
textStyle: { color: "rgba(255,255,255,.6)", fontSize: "8" },
},
},
yAxis: {
type: "value",
name: "万人/万个",
nameGap: 0,
nameTextStyle: { color: "#fff", fontSize: 10, padding: 6 },
position: "top",
axisLabel: {
show: true,
textStyle: { color: "rgba(255,255,255,.6)", fontSize: "10" },
},
axisTick: { show: false },
axisLine: {
show: true,
lineStyle: {
color: "rgba(255,255,255,.9)",
width: 1,
type: "solid",
},
},
splitLine: { lineStyle: { color: "rgba(255,255,255,.1)" } },
},
series: [
{
type: "bar",
name: "需求人数",
barWidth: "15%",
itemStyle: {
normal: { opacity: 1, barBorderRadius: 0, color: "#dd76aa" },
},
label: {
show: true,
position: "top",
distance: 5,
fontSize: "8",
},
data: xq,
},
{
type: "bar",
name: "求职人数",
barWidth: "15%",
itemStyle: {
normal: { opacity: 1, barBorderRadius: 0, color: "#36c3fd" },
},
label: {
show: true,
position: "top",
distance: 5,
fontSize: "8",
},
data: qz,
},
],
};
myChart.setOption(option);
window.addEventListener("resize", function () {
myChart.resize();
});
}
},
});
}
//学历
function getData10() {
$.ajax({
type: "GET",
url: baseUrl + "/dataNew/getData10",
async: false,
data: { date: formattedDateTime, shengfen: shengFen },
success: function (res) {
//console.log(res);
if (res.code == "0") {
var myChart = echarts.init(document.getElementById("echart10"));
var option = {
title: {
text: "分学历求职人数",
subtext: "",
left: "center",
textStyle: { fontSize: 13, color: "#fff", fontWeight: 400 },
},
legend: { left: "left", textStyle: { color: "#fff", fontSize: 10 } },
tooltip: { trigger: "axis", axisPointer: { type: "shadow" } },
grid: {
left: "0",
top: "20%",
right: "5",
bottom: "5",
containLabel: true,
},
xAxis: {
nameLocation: "end",
nameGap: 7,
type: "category",
data: res.data.name,
axisLine: {
show: true,
lineStyle: {
color: "rgba(255,255,255,.9)",
width: 1,
type: "solid",
},
},
axisTick: { show: false },
axisLabel: {
interval: 0,
rotate: 275,
textStyle: { color: "rgba(255,255,255,.6)", fontSize: "9" },
},
},
yAxis: {
type: "value",
name: "万人/万个",
nameGap: 0,
nameTextStyle: { color: "#fff", fontSize: 10, padding: 6 },
position: "top",
axisLabel: {
show: true,
textStyle: { color: "rgba(255,255,255,.6)", fontSize: "10" },
},
axisTick: { show: false },
axisLine: {
show: true,
lineStyle: {
color: "rgba(255,255,255,.9)",
width: 1,
type: "solid",
},
},
splitLine: { lineStyle: { color: "rgba(255,255,255,.1)" } },
},
series: [
{
type: "bar",
name: "需求人数",
barWidth: "15%",
itemStyle: {
normal: { opacity: 1, barBorderRadius: 0, color: "#dd76aa" },
},
label: {
show: true,
position: "top",
distance: 5,
fontSize: "8",
},
data: res.data.data1,
},
{
type: "bar",
name: "求职人数",
barWidth: "15%",
itemStyle: {
normal: { opacity: 1, barBorderRadius: 0, color: "#36c3fd" },
},
label: {
show: true,
position: "top",
distance: 5,
fontSize: "8",
},
data: res.data.data2,
},
],
};
myChart.setOption(option);
window.addEventListener("resize", function () {
myChart.resize();
});
}
},
});
}
//分产业
function getData7() {
$.ajax({
type: "GET",
url: baseUrl + "/dataNew/getData7",
async: false,
data: { date: formattedDateTime, shengfen: shengFen },
success: function (res) {
//console.log(res);
if (res.code == "0") {
var arr = [];
for (var i = 0; i < res.data.name.length; i++) {
var obj = {};
obj.name = res.data.name[i];
obj.value = res.data.data1[i];
arr.push(obj);
}
var myChart = echarts.init(document.getElementById("echart7"));
var option = {
title: {
text: "分产业招聘需求",
subtext: "",
left: "center",
textStyle: { fontSize: 13, color: "#fff", fontWeight: 400 },
},
legend: {
orient: "vertical",
left: "left",
textStyle: { color: "#fff", fontSize: 10 },
},
series: [
{
name: "",
type: "pie",
color: [
"#45C2E0",
"#C1EBDD",
"#FFC851",
"#DA5476",
"#1869A0",
"#FF9393",
],
radius: "50%",
data: arr,
label: { normal: { show: true, formatter: "{b}:{c}万人" } },
center: ["50%", "60%"],
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: "rgba(0, 0, 0, 0.5)",
},
},
},
],
};
myChart.setOption(option);
window.addEventListener("resize", function () {
myChart.resize();
});
}
},
});
}
//工资水平
function getData12() {
$.ajax({
type: "GET",
url: baseUrl + "/dataNew/getData12",
async: false,
data: { date: formattedDateTime, shengfen: shengFen },
success: function (res) {
//console.log(res);
if (res.code == "0") {
var myChart = echarts.init(document.getElementById("echart12"));
var option = {
title: {
text: "不同薪酬区间的岗位需求",
subtext: "",
left: "center",
textStyle: { fontSize: 13, color: "#fff", fontWeight: 400 },
},
legend: { left: "left", textStyle: { color: "#fff", fontSize: 10 } },
tooltip: { trigger: "axis", axisPointer: { type: "shadow" } },
grid: {
left: "0",
top: "20%",
right: "5",
bottom: "5",
containLabel: true,
},
xAxis: {
nameLocation: "end",
nameGap: 7,
type: "category",
data: res.data.name,
axisLine: {
show: true,
lineStyle: {
color: "rgba(255,255,255,.9)",
width: 1,
type: "solid",
},
},
axisTick: { show: false },
axisLabel: {
interval: 0,
rotate: 275,
textStyle: { color: "rgba(255,255,255,.6)", fontSize: "9" },
},
},
yAxis: {
type: "value",
name: "万人/万个",
nameGap: 0,
nameTextStyle: { color: "#fff", fontSize: 10, padding: 6 },
position: "top",
axisLabel: {
show: true,
textStyle: { color: "rgba(255,255,255,.6)", fontSize: "10" },
},
axisTick: { show: false },
axisLine: {
show: true,
lineStyle: {
color: "rgba(255,255,255,.9)",
width: 1,
type: "solid",
},
},
splitLine: { lineStyle: { color: "rgba(255,255,255,.1)" } },
},
series: [
{
type: "bar",
name: "需求人数",
barWidth: "15%",
itemStyle: {
normal: { opacity: 1, barBorderRadius: 0, color: "#dd76aa" },
},
label: {
show: true,
position: "top",
distance: 5,
fontSize: "8",
},
data: res.data.data1,
},
{
type: "bar",
name: "求职人数",
barWidth: "15%",
itemStyle: {
normal: { opacity: 1, barBorderRadius: 0, color: "#36c3fd" },
},
label: {
show: true,
position: "top",
distance: 5,
fontSize: "8",
},
data: res.data.data2,
},
],
};
myChart.setOption(option);
window.addEventListener("resize", function () {
myChart.resize();
});
}
},
});
}
//分企业规模
function getData6() {
$.ajax({
type: "GET",
url: baseUrl + "/dataNew/getData6",
async: true,
data: { date: formattedDateTime },
success: function (res) {
console.log(res);
if (res.code == "0") {
var myChart = echarts.init(document.getElementById("echart6"));
var option = {
title: {
text: "分企业规模求职人数",
subtext: "",
left: "center",
textStyle: { fontSize: 13, color: "#fff", fontWeight: 400 },
},
legend: { left: "left", textStyle: { color: "#fff", fontSize: 10 } },
tooltip: { trigger: "axis", axisPointer: { type: "shadow" } },
grid: {
left: "0",
top: "20%",
right: "5",
bottom: "5",
containLabel: true,
},
xAxis: {
nameLocation: "end",
nameGap: 7,
type: "category",
data: res.data.name,
axisLine: {
show: true,
lineStyle: {
color: "rgba(255,255,255,.9)",
width: 1,
type: "solid",
},
},
axisTick: { show: false },
axisLabel: {
interval: 0,
rotate: 275,
textStyle: { color: "rgba(255,255,255,.6)", fontSize: "9" },
},
},
yAxis: {
type: "value",
name: "万人/万个",
nameGap: 0,
nameTextStyle: { color: "#fff", fontSize: 10, padding: 6 },
position: "top",
axisLabel: {
show: true,
textStyle: { color: "rgba(255,255,255,.6)", fontSize: "10" },
},
axisTick: { show: false },
axisLine: {
show: true,
lineStyle: {
color: "rgba(255,255,255,.9)",
width: 1,
type: "solid",
},
},
splitLine: { lineStyle: { color: "rgba(255,255,255,.1)" } },
},
series: [
{
type: "bar",
name: "需求人数",
barWidth: "15%",
itemStyle: {
normal: { opacity: 1, barBorderRadius: 0, color: "#dd76aa" },
},
label: {
show: true,
position: "top",
distance: 5,
fontSize: "8",
},
data: res.data.data1,
},
{
type: "bar",
name: "求职人数",
barWidth: "15%",
itemStyle: {
normal: { opacity: 1, barBorderRadius: 0, color: "#36c3fd" },
},
label: {
show: true,
position: "top",
distance: 5,
fontSize: "8",
},
data: res.data.data2,
},
],
};
myChart.setOption(option);
window.addEventListener("resize", function () {
myChart.resize();
});
}
},
});
}
//分年龄
function getData11() {
$.ajax({
type: "GET",
url: baseUrl + "/dataNew/getData11",
async: true,
data: { date: formattedDateTime },
success: function (res) {
console.log(res);
if (res.code == "0") {
var myChart = echarts.init(document.getElementById("echart11"));
var option = {
title: {
text: "分年龄求职人数",
subtext: "",
left: "center",
textStyle: { fontSize: 13, color: "#fff", fontWeight: 400 },
},
legend: { left: "left", textStyle: { color: "#fff", fontSize: 10 } },
tooltip: { trigger: "axis", axisPointer: { type: "shadow" } },
grid: {
left: "0",
top: "20%",
right: "5",
bottom: "5",
containLabel: true,
},
xAxis: {
nameLocation: "end",
nameGap: 7,
type: "category",
data: res.data.name,
axisLine: {
show: true,
lineStyle: {
color: "rgba(255,255,255,.9)",
width: 1,
type: "solid",
},
},
axisTick: { show: false },
axisLabel: {
interval: 0,
rotate: 275,
textStyle: { color: "rgba(255,255,255,.6)", fontSize: "9" },
},
},
yAxis: {
type: "value",
name: "万人/万个",
nameGap: 0,
nameTextStyle: { color: "#fff", fontSize: 10, padding: 6 },
position: "top",
axisLabel: {
show: true,
textStyle: { color: "rgba(255,255,255,.6)", fontSize: "10" },
},
axisTick: { show: false },
axisLine: {
show: true,
lineStyle: {
color: "rgba(255,255,255,.9)",
width: 1,
type: "solid",
},
},
splitLine: { lineStyle: { color: "rgba(255,255,255,.1)" } },
},
series: [
{
type: "bar",
name: "需求人数",
barWidth: "15%",
itemStyle: {
normal: { opacity: 1, barBorderRadius: 0, color: "#dd76aa" },
},
label: {
show: true,
position: "top",
distance: 5,
fontSize: "8",
},
data: res.data.data1,
},
{
type: "bar",
name: "求职人数",
barWidth: "15%",
itemStyle: {
normal: { opacity: 1, barBorderRadius: 0, color: "#36c3fd" },
},
label: {
show: true,
position: "top",
distance: 5,
fontSize: "8",
},
data: res.data.data2,
},
],
};
myChart.setOption(option);
window.addEventListener("resize", function () {
myChart.resize();
});
}
},
});
}
$(function () {
getDate();
getData8();
getData5();
getData6();
getData1();
getData4();
getData10();
getData7();
getData11();
getData12();
});
//历史数据
function get_echart_trend1() {
var fenlei = "总的招聘人数";
$.ajax({
type: "GET",
url: baseUrl + "/dataNew/getData14",
data: { fenlei: fenlei, chengshi: shengFen },
success: function (res) {
console.log(res);
if (res.code == "0") {
var myChart = echarts.init(document.getElementById("echart_trend1"));
var option = {
tooltip: {
trigger: "axis",
axisPointer: { type: "shadow" },
position: [10, 10],
},
grid: {
left: "0",
top: "5%",
right: "5",
bottom: "0",
containLabel: true,
},
xAxis: {
nameLocation: "end",
nameGap: 7,
type: "category",
data: res.data.name,
axisLine: {
show: true,
lineStyle: {
color: "rgba(255,255,255,.9)",
width: 1,
type: "solid",
},
},
axisTick: { show: false },
axisLabel: {
interval: 0,
rotate: 0,
textStyle: { color: "rgba(255,255,255,.6)", fontSize: "10" },
},
},
yAxis: {
type: "value",
name: "",
nameGap: 0,
nameTextStyle: { color: "#fff", fontSize: 10 },
position: "top",
axisLabel: {
show: true,
textStyle: { color: "rgba(255,255,255,.6)", fontSize: "10" },
},
axisTick: { show: false },
axisLine: {
show: true,
lineStyle: {
color: "rgba(255,255,255,.9)",
width: 1,
type: "solid",
},
},
splitLine: { lineStyle: { color: "rgba(255,255,255,.1)" } },
},
series: [
{
type: "line",
name: "",
barWidth: "15%",
itemStyle: {
normal: { opacity: 1, barBorderRadius: 0, color: "#36c3fd" },
},
label: {
show: true,
position: "top",
distance: 5,
fontSize: "8",
},
data: res.data.xqList,
},
],
};
myChart.setOption(option);
window.addEventListener("resize", function () {
myChart.resize();
});
}
},
});
}
function get_echart_trend2() {
var fenlei = "总的求职人数";
$.ajax({
type: "GET",
url: baseUrl + "/dataNew/getData14",
data: { fenlei: fenlei, chengshi: shengFen },
success: function (res) {
console.log(res);
if (res.code == "0") {
var myChart = echarts.init(document.getElementById("echart_trend2"));
var option = {
tooltip: {
trigger: "axis",
axisPointer: { type: "shadow" },
position: [10, 10],
},
grid: {
left: "0",
top: "5%",
right: "5",
bottom: "0",
containLabel: true,
},
xAxis: {
nameLocation: "end",
nameGap: 7,
type: "category",
data: res.data.name,
axisLine: {
show: true,
lineStyle: {
color: "rgba(255,255,255,.9)",
width: 1,
type: "solid",
},
},
axisTick: { show: false },
axisLabel: {
interval: 0,
rotate: 0,
textStyle: { color: "rgba(255,255,255,.6)", fontSize: "10" },
},
},
yAxis: {
type: "value",
name: "",
nameGap: 0,
nameTextStyle: { color: "#fff", fontSize: 10 },
position: "top",
axisLabel: {
show: true,
textStyle: { color: "rgba(255,255,255,.6)", fontSize: "10" },
},
axisTick: { show: false },
axisLine: {
show: true,
lineStyle: {
color: "rgba(255,255,255,.9)",
width: 1,
type: "solid",
},
},
splitLine: { lineStyle: { color: "rgba(255,255,255,.1)" } },
},
series: [
{
type: "line",
name: "",
barWidth: "15%",
itemStyle: {
normal: { opacity: 1, barBorderRadius: 0, color: "#36c3fd" },
},
label: {
show: true,
position: "top",
distance: 5,
fontSize: "8",
},
data: res.data.qzList,
},
],
};
myChart.setOption(option);
window.addEventListener("resize", function () {
myChart.resize();
});
}
},
});
}