ソースを参照

添加首页接口

wzz 4 年 前
コミット
39e9d7f2cd
共有2 個のファイルを変更した326 個の追加49 個の削除を含む
  1. 325 48
      pages/metrics/index.vue
  2. 1 1
      uni_modules/qiun-data-charts/js_sdk/u-charts/u-charts.js

+ 325 - 48
pages/metrics/index.vue

@@ -50,24 +50,24 @@
 		<view class="block-box display-around items-center">
 			 <view class="block-box-content" style="width:30%;background-color:#F2CD4F;" @click="goProject(0)">
 				 <view>在库项目</view>
-				 <view>18</view>
+				 <view>{{industryData.instore_project_count}}</view>
 			 </view>
 			 <view class="block-box-content" style="width:30%;background-color: #9776F2;" @click="goProject(1)">
 				 <view>技改项目</view>
-				 <view>2</view>
+				 <view>{{industryData.industrial_investment_project_count}}</view>
 			 </view>
 			 <view class="block-box-content" style="width:30%;background-color: #51A9E3;" @click="goProject(2)">
 				 <view>在谈项目</view>
-				 <view>2</view>
+				 <view>{{industryData.discuss_project_count}}</view>
 			 </view>
 		</view>
 		<qiun-title-bar title="2021年工业投资任务目标"/>
 		<view class="charts-box">
-		    <qiun-data-charts type="bar"   background="#4C4C4C" :opts="{xAxis:{max:40},extra:{bar:{linearType:'custom',barBorderCircle:true}}}" :chartData="chartData"/>
+		    <qiun-data-charts type="bar"   background="#4C4C4C" :opts="{xAxis:{max:40},extra:{bar:{linearType:'custom',barBorderCircle:true}}}" :chartData="industryData.chartData"/>
 		</view>
 		<qiun-title-bar title="工业投资额"/>
 		<view class="charts-box">
-		  <qiun-data-charts type="demotype" :opts="{fontColor:'#666',xAxis:{boundaryGap:'justify'}}" :chartData="chartData2"/>
+		  <qiun-data-charts type="demotype" :opts="{fontColor:'#666',xAxis:{boundaryGap:'justify'}}" :chartData="industryData.chartData2"/>
 		</view>
 	
 	
@@ -75,53 +75,53 @@
 	    <view class="block-box display-around items-center">
 	    	 <view class="block-box-content" style="width:30%;background-color:#F2CD4F;" @click="goImportant(0)">
 	    		 <view>重点项目</view>
-	    		 <view>18</view>
+	    		 <view>{{importantData.importent_project_count}}</view>
 	    	 </view>
 	    	 <view class="block-box-content" style="width:30%;background-color: #9776F2;" @click="goImportant(1)">
 	    		 <view>新建/续建</view>
-	    		 <view>13/8</view>
+	    		 <view>{{importantData.new_project_count}}/{{importantData.continue_project_count}}</view>
 	    	 </view>
 	    	 <view class="block-box-content" style="width:30%;background-color: #51A9E3;">
 	    		 <view>总投资(万元)</view>
-	    		 <view>2256457</view>
+	    		 <view>{{importantData.investment_count}}</view>
 	    	 </view>
 	    </view>
 	    <qiun-title-bar title="重点项目级别分布"/>
 	    <view class="charts-box">
-	        <qiun-data-charts type="bar"   background="#4C4C4C" :opts="{xAxis:{max:40},extra:{bar:{linearType:'custom',barBorderCircle:true}}}" :chartData="chartData"/>
+	        <qiun-data-charts type="bar"   background="#4C4C4C" :opts="{extra:{bar:{linearType:'custom',barBorderCircle:true}}}" :chartData="importantData.chartData"/>
 	    </view>
 	    <qiun-title-bar title="工业投资额"/>
 		<view class="charts-box">
-		  <qiun-data-charts type="demotype" :opts="{fontColor:'#666',xAxis:{boundaryGap:'justify'}}" :chartData="chartData2"/>
+		  <qiun-data-charts type="demotype" :opts="{fontColor:'#666',xAxis:{boundaryGap:'justify'}}" :chartData="importantData.chartData2"/>
 		</view>
 	
 	    <qiun-title-bar title="科技创新指标" style="border-top:10rpx solid #f2f2f2;margin-bottom: 10rpx;" />
 	    <view class="block-box display-around items-center">
 	    	 <view class="block-box-content" style="width:47%;color: #555;" @click="goScale('科技创新企业')">
 	    		 <view>国家高新技术企业</view>
-	    		 <view>8/<text style="color: red;">5</text></view>
+	    		 <view>{{techData.target.high}}/<text style="color: red;">{{techData.finish.high}}</text></view>
 	    	 </view>
 	    	 <view class="block-box-content" style="width:47%;color: #555;" @click="goScale('科技创新企业')">
 	    		 <view>科技型中小企业</view>
-	    		 <view>70/<text style="color: red;">50</text></view>
+	    		 <view>{{techData.target.mini}}/<text style="color: red;">{{techData.finish.mini}}</text></view>
 	    	 </view>
 		</view>
 		<view class="display-around-column items-center" style="height: 620rpx; margin: 10rpx 0 10rpx 0;">
 		   <view class="block-box-content" style="width:97%;color: #555;">
 		   				 <view>累计研发投入规上工业企业</view>
-		   				 <view>7/<text style="color: red;">6</text></view>
+		   				 <view>{{techData.target.standard_industry}}/<text style="color: red;">{{techData.finish.standard_industry}}</text></view>
 		   </view>
 		   <view class="block-box-content" style="width:97%;color: #555;">
 		   				 <view>累计研发投入规上服务业企业</view>
-		   				 <view>2/<text style="color: red;">1</text></view>
+		   				 <view>{{techData.target.standard_service}}/<text style="color: red;">{{techData.finish.standard_service}}</text></view>
 		    </view>
 		    <view class="block-box-content" style="width:97%;color: #555;">
 		   				 <view>累计研发投入占主营业务5%的企业</view>
-		   				 <view>4/<text style="color: red;">4</text></view>
+		   				 <view>{{techData.target.rd_five_percent}}/<text style="color: red;">{{techData.finish.rd_five_percent}}</text></view>
 		   </view>
 		   <view class="block-box-content" style="width:97%;color: #555;">
 		   				 <view>累计研发投入500万以上的企业</view>
-		   				 <view>2/<text style="color: red;">2</text></view>
+		   				 <view>{{techData.target.rd_five_million}}/<text style="color: red;">{{techData.finish.rd_five_million}}</text></view>
 		   </view>
 	   </view>
 	
@@ -137,11 +137,11 @@
 	    </view>
 		<qiun-title-bar title="各新城规上工业企业数量"/>
 		<view class="charts-box">
-			<qiun-data-charts  type="column"  :chartData="chartData1" background="#4C4C4C"/>
+			<qiun-data-charts  type="column"  :chartData="ereaData.chartDataBar" background="#4C4C4C"/>
 		</view>
 		<qiun-title-bar title="各新城规上工业企业数量占比"/>
 		<view class="charts-box" style="margin-bottom: 20rpx;">
-			<qiun-data-charts   type="pie" :chartData="chartDataPie" background="#4C4C4C"/>
+			<qiun-data-charts   type="pie" :chartData="ereaData.chartDataPie" background="#4C4C4C"/>
 		</view>
 	</view>
 </template>
@@ -193,35 +193,103 @@
 						{name: "上年度", data: [],textSize:1}
 					]
 			  },
-			  chartDataPie:{
-				  "categories": ["空港", "沣东", "秦汉", "泾河", "沣西"],
-				  "series": [
-				          {
-				              "data": [
-				                  {
-				                      "name": "空港",
-				                      "value": 50
-				                  },
-				                  {
-				                      "name": "沣东",
-				                      "value": 30
-				                  },
-				                  {
-				                      "name": "秦汉",
-				                      "value": 20
-				                  },
-				                  {
-				                      "name": "泾河",
-				                      "value": 18
-				                  },
-				                  {
-				                      "name": "沣西",
-				                      "value": 8
-				                  }
-				              ]
-				          }
-				      ]
+			  industryData:{
+				  discuss_project_count:'',
+				  industrial_investment_project_count:'',
+				  instore_project_count:'',
+				  chartData:{
+					  categories: ["在库项目", "技改项目"],
+					  series: [
+					  	{   
+							name: "目标任务",
+					  		data: [],
+					  		otherData:[],
+					  		format:'moreDataShow',
+					  		textSize:10
+					  	},
+					      {   
+							name: "目前已完成", 
+					  		data: [],
+					  		otherData:[],
+					  		format:'moreDataShow',
+					  		textSize:10
+					  	},
+					  	]
+				  },
+				  chartData2:{
+					  "categories": ["1月", "2月","3月", "4月","5月", "6月","7月", "8月","9月", "10月","11月", "12月"],
+					  "series": [
+									{name: "本年度",data: [],textSize:1},
+									{name: "上年度", data: [],textSize:1}
+					  			]
 				  }
+			   },
+			  importantData:{
+				  importent_project_count:'',
+				  new_project_count:'',
+				  continue_project_count:'',
+				  investment_count:'',
+				  chartData:{
+					  categories: ["市级", "新区级","新城级"],
+					  series: [
+						{   
+							name: "数量",
+							data: [],
+						},
+						]
+				  },
+				  chartData2:{
+					  "categories": ["1月", "2月","3月", "4月","5月", "6月","7月", "8月","9月", "10月","11月", "12月"],
+					  "series": [
+									{name: "本年度",data: [],textSize:1},
+									{name: "上年度", data: [],textSize:1}
+								]
+				  }
+			  },
+			  techData:{
+				  target:{},
+				  finish:{}
+			  },
+			  ereaData:{
+				  chartDataBar:{
+					  "categories": [],
+					  "series": [
+							{
+								"name": "各新城规上工业企业数量",
+								"data": [],
+							}
+						]
+				  },
+				  chartDataPie:{
+					  "categories": [],
+					  "series": [
+							  {
+								  "data": [
+									  // {
+										 //  "name": "空港",
+										 //  "value": 50
+									  // },
+									  // {
+										 //  "name": "沣东",
+										 //  "value": 30
+									  // },
+									  // {
+										 //  "name": "秦汉",
+										 //  "value": 20
+									  // },
+									  // {
+										 //  "name": "泾河",
+										 //  "value": 18
+									  // },
+									  // {
+										 //  "name": "沣西",
+										 //  "value": 8
+									  // }
+								  ]
+							  }
+						  ]
+					  },
+			  }			  
 		 }
 	  },
 	  onLoad() {
@@ -230,7 +298,11 @@
 	  methods:{
 		  topChartFn(year,month){
 			  this.getStandardChart(year,month);
-			  this.getAdvancedCompanyChart(year,month)
+			  this.getAdvancedCompanyChart(year,month);
+			  this.getIndustryChart(year,month);
+			  this.getImportantChart(year,month);
+			  this.getTechInfo(year,month);
+			  this.getEreaInfos(year,month,1);
 		  },
 		  getStandardChart(y,m){
 			  let md5Sign = md5(
@@ -340,6 +412,209 @@
 				},
 			  });
 		  },
+		  industryFilter(data){
+			  let targetData = [],targetData1 = [],finishData = [],finishData1 = [],lineBalanceList = [], lineLast = [];
+			  this.industryData.discuss_project_count = data.discuss_project_count;
+			  this.industryData.industrial_investment_project_count = data.industrial_investment_project_count;
+			  this.industryData.instore_project_count = data.instore_project_count;
+			  if(data.target.length){
+				   let targetList = data.target;
+				   targetData = [targetList[0].store_balance,targetList[0].tech_balance];
+				   targetData1 = [targetList[0].store_ratio,targetList[0].tech_ratio]
+			  }else{
+					targetData = [0,0];targetData1 = [0,0]
+			  }
+			  if(data.finish.length){
+					let finishList = data.finish;
+					finishData = [finishList[0].store_balance,finishList[0].tech_balance];
+					finishData1 = [finishList[0].store_ratio,finishList[0].tech_ratio]
+			  }else{
+			  		finishData = [0,0];finishData1 = [0,0]
+			  }
+			  for(let key in data.month_list ){
+					 lineBalanceList.push(data.month_list[key].balance)
+					 lineLast.push(data.month_list[key].last_balance)
+			  }
+			  this.industryData.chartData.series[0].data = targetData
+			  this.industryData.chartData.series[0].otherData = targetData1
+			  this.industryData.chartData.series[1].data = finishData
+			  this.industryData.chartData.series[1].otherData = finishData1
+			  this.industryData.chartData2.series[0].data = lineBalanceList;
+			  this.industryData.chartData2.series[1].data = lineLast;
+		  },
+	      getIndustryChart(y,m){
+				  let md5Sign = md5(
+				    "method=" +
+				      "stat" +
+				      "&timestamp=" +
+				      getApp().globalData.globalTimestamp +
+				      "&secret=" +
+				      getApp().globalData.secret
+				  );
+				  let url =
+				    getApp().globalData.shareUrl +
+				    "api/api.php" +
+				    "?method=stat&action=industry&timestamp=" +
+				    getApp().globalData.globalTimestamp +
+				    "&sign=" +
+				    md5Sign;
+				  uni.request({
+				    url: url,
+				    method: "POST",
+				    header: {
+				      "content-type": "application/x-www-form-urlencoded",
+				    },
+				    data: {
+				       year:y,
+				       month:m,
+				    },
+				    success: (res) => {
+				      if (res.data.code === 200) {
+		                   this.industryFilter(res.data.data)
+				      }
+				    },
+				    fail: () => {
+				      console.log("连接失败");
+				    },
+				  });
+		  },
+		  importantFilter(data){
+			  let lineBalanceList = [], lineLast = [];
+			  this.importantData.importent_project_count = data.importent_project_count;
+			  this.importantData.new_project_count = data.new_project_count;
+			  this.importantData.continue_project_count = data.continue_project_count;
+			  this.importantData.investment_count = data.investment_count;
+			  this.importantData.chartData.series[0].data = [data.city_level_count,data.area_level_count,data.new_city_level_count] 
+			  //this.importantData.chartData.series[0].data = [5,16,21]
+			  for(let key in data.month_list ){
+				 lineBalanceList.push(data.month_list[key].balance)
+				 lineLast.push(data.month_list[key].last_balance)
+			  }
+			  this.importantData.chartData2.series[0].data = lineBalanceList;
+			  this.importantData.chartData2.series[1].data = lineLast;
+		  },
+		  getImportantChart(y,m){
+			  let md5Sign = md5(
+			    "method=" +
+			      "stat" +
+			      "&timestamp=" +
+			      getApp().globalData.globalTimestamp +
+			      "&secret=" +
+			      getApp().globalData.secret
+			  );
+			  let url =
+			    getApp().globalData.shareUrl +
+			    "api/api.php" +
+			    "?method=stat&action=importent_project&timestamp=" +
+			    getApp().globalData.globalTimestamp +
+			    "&sign=" +
+			    md5Sign;
+			  uni.request({
+			    url: url,
+			    method: "POST",
+			    header: {
+			      "content-type": "application/x-www-form-urlencoded",
+			    },
+			    data: {
+			       year:y,
+			       month:m,
+			    },
+			    success: (res) => {
+			      if (res.data.code === 200) {
+			           this.importantFilter(res.data.data)
+			      }
+			    },
+			    fail: () => {
+			      console.log("连接失败");
+			    },
+			  });
+		  },
+		  getTechInfo(y,m){
+			  let md5Sign = md5(
+			    "method=" +
+			      "stat" +
+			      "&timestamp=" +
+			      getApp().globalData.globalTimestamp +
+			      "&secret=" +
+			      getApp().globalData.secret
+			  );
+			  let url =
+			    getApp().globalData.shareUrl +
+			    "api/api.php" +
+			    "?method=stat&action=tech_infos&timestamp=" +
+			    getApp().globalData.globalTimestamp +
+			    "&sign=" +
+			    md5Sign;
+			  uni.request({
+			    url: url,
+			    method: "POST",
+			    header: {
+			      "content-type": "application/x-www-form-urlencoded",
+			    },
+			    data: {
+			       year:y,
+			       month:m,
+			    },
+			    success: (res) => {
+			      if (res.data.code === 200) {
+					  this.techData.target = res.data.data.target;
+					  this.techData.finish = res.data.data.finish;
+			      }
+			    },
+			    fail: () => {
+			      console.log("连接失败");
+			    },
+			  });
+		  },
+		  ereaInfoFilter(data){
+			  let categoriesList = [], barData = [], pieData = [];
+			  for(let key in data.area_list ){
+				     categoriesList.push(data.area_list[key].name);
+					 barData.push(data.area_list[key].value)
+					 pieData.push(data.area_list[key])
+			  }
+			  this.ereaData.chartDataBar.categories = categoriesList;
+			  this.ereaData.chartDataPie.categories = categoriesList;
+			  this.ereaData.chartDataBar.series[0].data = barData;
+			  this.ereaData.chartDataPie.series[0].data = pieData;
+		  },
+		  getEreaInfos(y,m,select){
+			  let md5Sign = md5(
+			    "method=" +
+			      "stat" +
+			      "&timestamp=" +
+			      getApp().globalData.globalTimestamp +
+			      "&secret=" +
+			      getApp().globalData.secret
+			  );
+			  let url =
+			    getApp().globalData.shareUrl +
+			    "api/api.php" +
+			    "?method=stat&action=erea_infos&timestamp=" +
+			    getApp().globalData.globalTimestamp +
+			    "&sign=" +
+			    md5Sign;
+			  uni.request({
+			    url: url,
+			    method: "POST",
+			    header: {
+			      "content-type": "application/x-www-form-urlencoded",
+			    },
+			    data: {
+			       year:y,
+			       month:m,
+				   source:select
+			    },
+			    success: (res) => {
+			      if (res.data.code === 200) {
+			  			this.ereaInfoFilter(res.data.data)
+			      }
+			    },
+			    fail: () => {
+			      console.log("连接失败");
+			    },
+			  });
+		  },
 		  bindDateChange(e){
 			   this.dateYear = e.target.value
 			   this.topChartFn(this.dateYear,this.dateMonth)
@@ -348,8 +623,10 @@
 			   this.dateMonth = this.arrayMonth[e.target.value]
 			   this.topChartFn(this.dateYear,this.dateMonth)
 		  },
-		  bindDateCityChange(){
+		  bindDateCityChange(e){
 			  this.sortSelect = this.arrayNewCity[e.target.value]
+			  let dataSelect = Number(e.target.value) + 1;
+			  this.getEreaInfos(this.dateYear,this.dateMonth,dataSelect)
 		  },
 		  goScale(title){
 			  uni.navigateTo({

+ 1 - 1
uni_modules/qiun-data-charts/js_sdk/u-charts/u-charts.js

@@ -2120,7 +2120,7 @@ function drawBarPointText(points, series, config, context, opts) {
       }
       var formatVal = series.formatter ? series.formatter(value,index,opts,series) : value;
       context.setTextAlign('left');
-      context.fillText(String(formatVal), item.x - 68 * opts.pix , item.y + fontSize / 2 - 3 );
+      context.fillText(String(formatVal), item.x - 70 * opts.pix , item.y + fontSize / 2 - 3 );
       context.closePath();
       context.stroke();
     }