Selaa lähdekoodia

HR首页流量对比数据

yanliming 3 vuotta sitten
vanhempi
commit
2791e4d270
2 muutettua tiedostoa jossa 44 lisäystä ja 7 poistoa
  1. 6 1
      src/api/job/hrIndex.js
  2. 38 6
      src/views/job/index-HR.vue

+ 6 - 1
src/api/job/hrIndex.js

@@ -4,9 +4,14 @@ import constant from '@/constant'
 function indexData(){
     return request.post(constant.serverUrl + "/job/hrIndex/indexData");
 }
+
+
+function stackedLineData(selectData){
+    return request.post(constant.serverUrl + "/job/hrIndex/stackedLineData",selectData);
+}
   
 
 
 export default {
-    indexData
+    indexData,stackedLineData
 }

+ 38 - 6
src/views/job/index-HR.vue

@@ -86,7 +86,7 @@
 			<div class="mainContainer main-chart2">
 				<div class="mainContainer-title2"><h4 style="display:inline">职位流量对比情况</h4>
 				<div class="radioDiv">
-					<el-radio-group v-model="radio1" size="small">
+					<el-radio-group v-model="radio1" size="small" @change="selectRadio">
 					<el-radio-button label="职位展现"></el-radio-button>
 					<el-radio-button label="职位点击"></el-radio-button>
 					<el-radio-button label="职位投递"></el-radio-button>
@@ -189,7 +189,7 @@ export default {
 
 			this.chart.setOption(option);
 		},
-		find2(){
+		find2(xAxisList,seriesList1,seriesList2){
 			this.chart = this.$echarts.init(this.$refs.lineChart);
 			const option = {
 				title: {
@@ -210,7 +210,7 @@ export default {
 				xAxis: {
 					type: 'category',
 					boundaryGap: false,
-					data: ['一月', '二月', '三月', '四月', '五月', '六月']
+					data: xAxisList
 				},
 				yAxis: {
 					type: 'value'
@@ -220,18 +220,50 @@ export default {
 					name: '我',
 					type: 'line',
 					stack: 'Total',
-					data: [120, 132, 101, 134, 90, 230]
+					data: seriesList1
 					},
 					{
 					name: '平台平均值',
 					type: 'line',
 					stack: 'Total',
-					data: [220, 182, 191, 234, 290, 330]
+					data: seriesList2
 					}
 				
 				]
 			};
 			this.chart.setOption(option);
+		},
+		selectRadio(val){
+			var self = this;
+
+			var type ="";
+			if(val=='职位展现'){
+				type="1";
+			}
+			else if(val=='职位点击'){
+				type="2";
+			}
+			else if(val=='职位投递'){
+				type="3";
+			}
+
+			var selectData = new FormData();
+
+			selectData.append("type", type);
+
+			hrIndexApi.stackedLineData(selectData).then(response=>{
+				var jsonData = response.data;
+
+				if(jsonData.result){
+					self.formModel = jsonData.data;
+					console.log(self.formModel);
+
+					self.find2(self.formModel.xAxisList,self.formModel.seriesMap.seriesList1,self.formModel.seriesMap.seriesList2);
+				}
+				else{
+					self.$message.error(jsonData.message + "");
+				}
+			});
 		}
 },
 mounted: function () {
@@ -239,7 +271,7 @@ mounted: function () {
 
 		//加载图表
 		
-		self.find2();
+		self.selectRadio("职位展现");
 
 		hrIndexApi.indexData().then(response=>{
 			var jsonData = response.data;