statisticalcenterCtrl.js 35 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033
  1. angular.module('push')
  2. .controller('statisticalcenterCtrl', function (dataToolsService, $stateParams,$scope,ionicDatePicker, CommentService, UserService, UtilService, $timeout, CommonService,$ionicPopup) {
  3. $scope.modes=[
  4. {mode:"默认模式",id:0},
  5. {mode:"动态模式",id:1}
  6. ]
  7. $scope.selectMode= $scope.modes[0].id;
  8. $scope.node=UserService.node
  9. var date=new Date()
  10. $scope.year=[date.getFullYear()]
  11. for(var i=0 ; i<date.getFullYear()-2018 ;i++){
  12. console.log(i)
  13. $scope.year.push($scope.year[i]-1)
  14. }
  15. console.log( $scope.year)
  16. $scope.selectyear=date.getFullYear()
  17. var num=0,
  18. Carousel
  19. dataToolsService.getStatisticalCenterList().then(function (res) {
  20. if (res.code == 3350) {
  21. console.log(res)
  22. $scope.indexid=res.data.indexid;
  23. $scope.datalist = res.data.statisticalCenters;
  24. $scope.data=res.data;
  25. if($stateParams.datalist){
  26. $scope.datalist=$stateParams.datalist
  27. angular.forEach($scope.datalist, function (val) {
  28. console.log(val)
  29. if(val.isSelected==true){
  30. $scope.changeIndex(val)
  31. }
  32. })
  33. }else if($scope.datalist.length > 0) {
  34. $scope.datalist[0].isSelected = true;
  35. if ($scope.datalist[0].sonCenterList.length > 0) {
  36. $scope.datalist[0].sonCenterList[0].isSelected = true;
  37. }
  38. }
  39. $scope.datalist.push({
  40. indexname:'用户',
  41. indexid:1,
  42. sonCenterList:[{indexname:'用户',}],
  43. })
  44. getIndexChart();
  45. }
  46. })
  47. $scope.ggggg=function (){
  48. console.log(333)
  49. // 日期选择
  50. var datePickerObj = {
  51. //选择日期后的回掉
  52. callback: function (val) {
  53. if (typeof (val) === 'undefined') {
  54. } else {
  55. var date = new Date(val);
  56. if (date.toLocaleString().charAt(/\s+/) != -1) {
  57. var temp = date.toLocaleString().replace(/\//g, "-");
  58. obj.value = temp;
  59. }
  60. datePickerObj.inputDate = new Date(val); //更新日期弹框上的日期
  61. }
  62. },
  63. // closeOnSelect: true, //可选,设置选择日期后是否要关掉界面。呵呵,原本是false。
  64. };
  65. ionicDatePicker.openDatePicker(datePickerObj);
  66. }
  67. $scope.goback=function(){
  68. $scope.go("tab.activityIndex")
  69. clearInterval(Carousel)
  70. }
  71. $scope.greetname={}
  72. $scope.changeMode=function (data) {
  73. if(data==1){
  74. $ionicPopup.confirm({
  75. title: '确定',
  76. template: ' <div class="list">\n' +
  77. ' <label class="item item-input">\n' +
  78. ' <span class="input-label">轮播时间:</span>\n' +
  79. ' <input type="text" ng-model="greetname.time" placeholder="请填写正整数(毫秒)">\n' +
  80. ' </label>\n' +
  81. ' <label class="item item-input">\n' +
  82. ' <span class="input-label">欢迎语句:</span>\n' +
  83. ' <input type="text" ng-model="greetname.name">\n' +
  84. ' </label>\n' +
  85. ' </div>',
  86. scope: $scope,
  87. buttons: [ {
  88. text: '确定',
  89. type: 'button-positive',
  90. onTap: function(e) {
  91. var r = /^\+?[1-9][0-9]*$/
  92. if(!r.test($scope.greetname.time)){
  93. CommonService.showMessage("请填写轮播时间只能是正整数", $scope);
  94. e.preventDefault();
  95. }else {
  96. $scope.Carouselif=true
  97. }
  98. }
  99. }]
  100. });
  101. }else {
  102. clearInterval(Carousel)
  103. }
  104. }
  105. $scope.clickCarousel=function (){
  106. $scope.Carouselif=false
  107. Carousel=setInterval(function (){fff()},$scope.greetname.time)
  108. }
  109. var dlindex=1
  110. var fff=function (){
  111. if(dlindex==4){
  112. dlindex=0
  113. }
  114. $scope.changeIndex( $scope.datalist[dlindex],false)
  115. dlindex++
  116. }
  117. $scope.changeIndex=function (data,ifs) {
  118. if(ifs){
  119. $scope.selectMode= $scope.modes[0].id;
  120. clearInterval(Carousel)
  121. }
  122. for(var i = 0; i < $scope.datalist.length; i++) {
  123. $timeout(function () {
  124. $scope.indexid++
  125. }, 2000)
  126. }
  127. angular.forEach($scope.datalist, function (res1) {
  128. res1.isSelected = false;
  129. angular.forEach(res1.sonCenterList, function (res2) {
  130. res2.isSelected = false;
  131. })
  132. })
  133. data.isSelected = true;
  134. if (data.sonCenterList && data.sonCenterList.length > 0) {
  135. data.sonCenterList[data.indexid-1].isSelected = true;
  136. getIndexChart();
  137. }
  138. // if (data.indexname == "科技成果转化" || data.indexname == "其他") {
  139. // if (data.indexname == "科技成果转化") {
  140. // getIndexChart();
  141. // }
  142. ;
  143. }
  144. $scope.changeSonIndex = function (data, soncenter) {
  145. angular.forEach($scope.datalist, function (res1) {
  146. res1.isSelected = false;
  147. angular.forEach(res1.sonCenterList, function (res2) {
  148. res2.isSelected = false;
  149. })
  150. })
  151. angular.forEach($scope.datalist, function (res1) {
  152. angular.forEach(res1.sonCenterList, function (res2) {
  153. if (soncenter.indexname == res2.indexname) {
  154. res1.isSelected = true;
  155. }
  156. })
  157. })
  158. soncenter.isSelected = true;
  159. getIndexChart();
  160. }
  161. $scope.indexname = "";
  162. $scope.fatherindexname = "";
  163. var getIndexChart = function () {
  164. for (var i = 0; i < $scope.datalist.length; i++) {
  165. for (var j = 0; j < $scope.datalist[i].sonCenterList.length; j++) {
  166. if ($scope.datalist[i].sonCenterList[j].isSelected) {
  167. $scope.indexname = $scope.datalist[i].sonCenterList[j].indexname;
  168. $scope.fatherindexname = $scope.datalist[i].indexname;
  169. $scope.selectnum=$scope.datalist[i].indexid;
  170. break;
  171. }
  172. }
  173. }
  174. if ($scope.datalist[3].indexname == "科技成果转化" && $scope.datalist[3].isSelected) {
  175. $scope.fatherindexname = "科技成果转化";
  176. }
  177. // if ($scope.datalist[4].indexname == "其他" && $scope.datalist[4].isSelected) {
  178. // $scope.fatherindexname = "其他";
  179. // }
  180. //图表清空
  181. clearEchart();
  182. if ($scope.fatherindexname == "企业") {
  183. getBarChart(6, "企业类型", "企业库企业类型统计", '');
  184. getPieChart(6, "产业领域", "企业产业领域分布", 1);
  185. }
  186. if ($scope.fatherindexname == "人才") {
  187. if (UserService.node == '330122000') {
  188. getBarChart(38, "人才等级", "人才库人才级别统计", '');
  189. }
  190. if (UserService.node != '330122000') {
  191. getBarChart(38, "人才级别", "人才库人才级别统计", '');
  192. }
  193. getPieChart(38, "产业类型", "人才产业类型分布", 1);
  194. getBarChartForTalentacademic(38, "人才学历", "人才学历统计");
  195. }
  196. if ($scope.fatherindexname == "知识产权") {
  197. getBarChartForIntellecture(66, "企业专利类型情况统计");
  198. }
  199. if ($scope.fatherindexname == "科技成果转化") {
  200. getBarChartForAchieveTrans(77, "供需转化统计");
  201. getPieChart(77, "需求对接", "需求对接统计", 22);
  202. getPieChart(77, "需求类型", "需求类型统计", 41);
  203. getBarChartForCategory(77, "科技成果转化产业领域", "成果转化领域统计",30);
  204. }
  205. if($scope.fatherindexname == "用户"){
  206. setTimeout(() => {
  207. getactiveStatistics($scope.selectyear) ;
  208. yearActiveStatistics();
  209. getcount()
  210. }, 0)
  211. }
  212. // if ($scope.fatherindexname == "其他") {
  213. // getBarChartForOthers(88, "");
  214. // }
  215. }
  216. //图表清空
  217. var clearEchart = function () {
  218. if (document.getElementById('main') != null) {
  219. document.getElementById('main').innerHTML = "";
  220. document.getElementById('main').removeAttribute("_echarts_instance_");
  221. }
  222. if (document.getElementById('main1') != null) {
  223. document.getElementById('main1').innerHTML = "";
  224. document.getElementById('main1').removeAttribute("_echarts_instance_");
  225. }
  226. if (document.getElementById('main11') != null) {
  227. document.getElementById('main11').innerHTML = "";
  228. document.getElementById('main11').removeAttribute("_echarts_instance_");
  229. }
  230. if (document.getElementById('main12') != null) {
  231. document.getElementById('main12').innerHTML = "";
  232. document.getElementById('main12').removeAttribute("_echarts_instance_");
  233. }
  234. if (document.getElementById('main14') != null) {
  235. document.getElementById('main14').innerHTML = "";
  236. document.getElementById('main14').removeAttribute("_echarts_instance_");
  237. }
  238. if (document.getElementById('main21') != null) {
  239. document.getElementById('main21').innerHTML = "";
  240. document.getElementById('main21').removeAttribute("_echarts_instance_");
  241. }
  242. if (document.getElementById('main22') != null) {
  243. document.getElementById('main22').innerHTML = "";
  244. document.getElementById('main22').removeAttribute("_echarts_instance_");
  245. }
  246. if (document.getElementById('main30') != null) {
  247. document.getElementById('main30').innerHTML = "";
  248. document.getElementById('main30').removeAttribute("_echarts_instance_");
  249. }
  250. if (document.getElementById('main41') != null) {
  251. document.getElementById('main41').innerHTML = "";
  252. document.getElementById('main41').removeAttribute("_echarts_instance_");
  253. }
  254. if (document.getElementById('main42') != null) {
  255. document.getElementById('main42').innerHTML = "";
  256. document.getElementById('main42').removeAttribute("_echarts_instance_");
  257. }
  258. if (document.getElementById('main121') != null) {
  259. document.getElementById('main121').innerHTML = "";
  260. document.getElementById('main121').removeAttribute("_echarts_instance_");
  261. }
  262. if (document.getElementById('main122') != null) {
  263. document.getElementById('main122').innerHTML = "";
  264. document.getElementById('main122').removeAttribute("_echarts_instance_");
  265. }
  266. if (document.getElementById('main130') != null) {
  267. document.getElementById('main130').innerHTML = "";
  268. document.getElementById('main130').removeAttribute("_echarts_instance_");
  269. }
  270. if (document.getElementById('main141') != null) {
  271. document.getElementById('main141').innerHTML = "";
  272. document.getElementById('main141').removeAttribute("_echarts_instance_");
  273. }
  274. if (document.getElementById('main142') != null) {
  275. document.getElementById('main142').innerHTML = "";
  276. document.getElementById('main142').removeAttribute("_echarts_instance_");
  277. }
  278. }
  279. $scope.emitContract=function (val){
  280. console.log(val)
  281. getactiveStatistics(val)
  282. }
  283. //用户统计
  284. var getactiveStatistics= function (val){
  285. dataToolsService.getactiveStatistics({year:val}).then((res)=>{
  286. getlineChart('用户月活跃度',res.data,
  287. ['1月', '2月', '3月', '4月', '5月', '6月', '7月','8月', '9月', '10月', '11月', '12月'],'lineuser1')
  288. })
  289. }
  290. //用户统计
  291. var yearActiveStatistics= function (val){
  292. dataToolsService.yearActiveStatistics().then((res)=>{
  293. if(res.code==3350){
  294. let xAxis=[],data=[]
  295. res.data.forEach((res)=>{
  296. xAxis.unshift(res.year)
  297. data.unshift(res.total)
  298. })
  299. getlineChart('用户年活跃度',data,xAxis,'lineuser2')
  300. }
  301. })
  302. }
  303. //用户统计
  304. var getcount= function (val){
  305. dataToolsService.getcount().then((res)=>{
  306. console.log(res)
  307. $scope.Totalusers=res.data
  308. })
  309. }
  310. //折线图
  311. var getlineChart=function (text,val,xdata,id){
  312. console.log("ddd")
  313. var myChart = echarts.init(document.getElementById(id));
  314. var option = {
  315. title: {
  316. text: text,
  317. },
  318. xAxis: {
  319. type: 'category',
  320. data: xdata
  321. },
  322. yAxis: {
  323. type: 'value',
  324. axisLabel: {
  325. formatter: '{value}人'
  326. }
  327. },
  328. series: [
  329. {
  330. data: val,
  331. type: 'line',
  332. smooth: true,
  333. lineStyle:{
  334. color:'rgb(128, 255, 165)'
  335. },
  336. areaStyle: {
  337. opacity: 0.8,
  338. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  339. {
  340. offset: 0,
  341. color: 'rgb(128, 255, 165)'
  342. },
  343. {
  344. offset: 1,
  345. color: 'rgb(1, 191, 236)'
  346. }
  347. ])
  348. },
  349. }
  350. ]
  351. };
  352. myChart.setOption(option);
  353. }
  354. //绘制企业类型柱状图
  355. var getBarChart = function (restype, indexname, text, sort) {
  356. dataToolsService.getBarValue(indexname, restype).then(function (res) {
  357. console.log(res)
  358. if (res.code == 3350) {
  359. $scope.xAxisData = [];
  360. $scope.yAxisData = [];
  361. for (var i = 0; i < res.data.length; i++) {
  362. $scope.xAxisData.push(res.data[i].type);
  363. $scope.yAxisData.push(res.data[i].num);
  364. }
  365. //绘图部分sort
  366. var myChart = null;
  367. if ($scope.isapp) {
  368. myChart = echarts.init(document.getElementById('main' + sort));
  369. } else {
  370. myChart = echarts.init(document.getElementById('main11'));
  371. }
  372. // console.log($scope.data)
  373. // 指定图表的配置项和数据
  374. var option = {
  375. title: {
  376. text: text,
  377. subtext:res.otherObj,
  378. subtextStyle:{
  379. color:"#ff0000",
  380. fontSize: 12,
  381. }
  382. },
  383. tooltip: {},
  384. legend: {
  385. data: ['数量']
  386. },
  387. grid: {
  388. containLabel: true,
  389. },
  390. toolbox: {
  391. feature: {
  392. myTool1: {
  393. show: $scope.data.isShowEdit,
  394. // show:true,
  395. title: '编辑',
  396. icon: 'image://img/bianji.png',
  397. onclick: function (){
  398. $scope.go("Statisticseditor",{mapList : res.data,datalist:$scope.datalist})
  399. }
  400. },
  401. }
  402. },
  403. xAxis: {
  404. data: $scope.xAxisData,
  405. axisLabel: {
  406. show: true,
  407. rotate: 60,
  408. textStyle: {
  409. fontSize: 14,
  410. color: '#686666',
  411. fontWeight: 'normal',
  412. }
  413. }
  414. },
  415. yAxis: {
  416. textStyle: {
  417. fontSize: 14,
  418. color: '#686666',
  419. fontWeight: 'normal',
  420. }
  421. },
  422. series: [{
  423. // barWidth: 50,
  424. type: 'bar',
  425. data: $scope.yAxisData,
  426. label: {
  427. show: "true",
  428. position: "top",
  429. fontWeight: "bolder",
  430. color: '#c23531',
  431. fontSize: "14"
  432. }
  433. }]
  434. };
  435. // 使用刚指定的配置项和数据显示图表。
  436. myChart.setOption(option);
  437. myChart.on('click', function (params) {
  438. //params包含很多的信息 下标索引 如横坐标名称 对应的值
  439. // console.log("click",params);
  440. });
  441. }
  442. })
  443. }
  444. //绘制产业领域饼状图
  445. var getPieChart = function (restype, indexname, text, sort) {
  446. dataToolsService.getBarValue(indexname, restype).then(function (res) {
  447. // console.log(res)
  448. if (res.code == 3350) {
  449. $scope.axisData = [];
  450. angular.forEach(res.data, function (res) {
  451. var data = {
  452. value: res.num,
  453. name: res.type
  454. }
  455. $scope.axisData.push(data);
  456. })
  457. var myChart = null;
  458. if ($scope.isapp) {
  459. if ($scope.fatherindexname == "科技成果转化") {
  460. myChart = echarts.init(document.getElementById('main1' + sort));
  461. } else {
  462. myChart = echarts.init(document.getElementById('main' + sort));
  463. }
  464. } else {
  465. if ($scope.fatherindexname == "科技成果转化") {
  466. myChart = echarts.init(document.getElementById('main' + sort));
  467. } else {
  468. /*if ($scope.fatherindexname == "人才") {
  469. }else{
  470. myChart = echarts.init(document.getElementById('main1'));
  471. }*/
  472. myChart = echarts.init(document.getElementById('main12'));
  473. }
  474. }
  475. var option = {
  476. title: {
  477. show: true,
  478. text: text,
  479. position: 'center',
  480. subtext:res.otherObj,
  481. subtextStyle:{
  482. color:"#ff0000",
  483. fontSize: 12,
  484. }
  485. },
  486. grid: {
  487. containLabel: true,
  488. },
  489. toolbox: {
  490. feature: {
  491. myTool1: {
  492. show: $scope.data.isShowEdit,
  493. // show:true,
  494. title: '编辑',
  495. icon: 'image://img/bianji.png',
  496. onclick: function (){
  497. $scope.go("Statisticseditor",{mapList : res.data,datalist:$scope.datalist})
  498. }
  499. },
  500. }
  501. },
  502. series: [
  503. {
  504. name: text,
  505. type: 'pie', // 设置图表类型为饼图
  506. center:$scope.isapp?['50%', '50%']: ['25%', '50%'],
  507. radius: ['35%', '80%'], // 饼图的半径,外半径为可视区尺寸(容器高宽中较小一项)的 55% 长度。
  508. hoverAnimation: true,
  509. avoidLabelOverlap: true,
  510. data: $scope.axisData,// 数据数组,name 为数据项名称,value 为数据项值
  511. label: {
  512. normal: {
  513. show: false,
  514. position: 'center',
  515. formatter: '{b}\n{c}({d}%)',
  516. },
  517. emphasis: {
  518. show: true,
  519. textStyle: {
  520. fontSize: '15',
  521. fontWeight: 'bold',
  522. fontFamily: 'Microsoft YaHei'
  523. }
  524. }
  525. },
  526. labelLine: {
  527. normal: {
  528. show: false
  529. }
  530. },
  531. }
  532. ],
  533. legend: {
  534. type: 'scroll',
  535. orient: $scope.isapp?'horizontal':'vertical',
  536. // selectedMode: false, // 图例选择的模式,控制是否可以通过点击图例改变系列的显示状态。默认开启图例选择,可以设成 false 关闭。
  537. right: 0,
  538. top: 20,
  539. y: 'center',
  540. formatter: function (name) {
  541. var data = option.series[0].data;
  542. var total = 0;
  543. var tarValue;
  544. for (var i = 0, l = data.length; i < l; i++) {
  545. total += data[i].value;
  546. if (data[i].name == name) {
  547. tarValue = data[i].value;
  548. }
  549. }
  550. var p = 0;
  551. if (total > 0) {
  552. p = (tarValue / total * 100).toFixed(2);
  553. }
  554. return name + tarValue + '(' + p + '%)';
  555. },
  556. textStyle: { // 图例的公用文本样式。
  557. fontSize: 13,
  558. color: '#000',
  559. fontFamily: 'Microsoft YaHei'
  560. },
  561. data: $scope.axisData
  562. }
  563. }
  564. myChart.setOption(option);
  565. // myChart.dispatchAction({type: 'highlight', seriesIndex: 0, dataIndex: 0});
  566. // // 当鼠标移入时,如果不是第一项,则把当前项置为选中,如果是第一项,则设置第一项为当前项
  567. // var index=0
  568. // myChart.on('mouseover', function (e) {
  569. // console.log(e)
  570. // // myChart.dispatchAction({type: 'downplay', seriesIndex: 0, dataIndex: 0});
  571. // if (e.dataIndex != index) {
  572. // myChart.dispatchAction({type: 'downplay', seriesIndex: 0, dataIndex: index});
  573. // }
  574. // // if (e.dataIndex == 0) {
  575. // // myChart.dispatchAction({type: 'highlight', seriesIndex: 0, dataIndex: e.dataIndex});
  576. // // }
  577. // });
  578. // //
  579. // // //当鼠标离开时,把当前项置为选中
  580. // myChart.on('mouseout', function (e) {
  581. // index = e.dataIndex;
  582. // myChart.dispatchAction({type: 'highlight', seriesIndex: 0, dataIndex: e.dataIndex});
  583. // });
  584. }
  585. })
  586. }
  587. //人才学历统计专用
  588. var getBarChartForTalentacademic = function (restype, indexname, text) {
  589. dataToolsService.getBarChartForTalentacademic(indexname, restype).then(function (res) {
  590. if (res.code == 3350) {
  591. console.log(res)
  592. $scope.handleedit=function(){
  593. $scope.go("Statisticseditor",{datalist:$scope.datalist,tableList : res.data})
  594. }
  595. // console.log(res.data)
  596. $scope.typetalentdatalist = res.data;
  597. $scope.talentAcademicText = text;
  598. $scope.talentAcademictime = res.otherObj;
  599. // $scope.title1 = "电子信息";
  600. // $scope.title2 = "生物与新医药";
  601. // $scope.title3 = "航空航天";
  602. // $scope.title4 = "新材料";
  603. // $scope.title5 = "高技术服务";
  604. // $scope.title6 = "新能源与节能";
  605. // $scope.title7 = "资源与环境";
  606. // $scope.title8 = "先进制造与自动化";
  607. // $scope.title9 = "新能源汽车产业";
  608. // $scope.title10 = "临空产业";
  609. // $scope.title11 = "高端装备产业";
  610. // $scope.title14 = "其他";
  611. $scope.total=0
  612. $scope.num1 = 0;
  613. $scope.rate1 = 0;
  614. $scope.num2 = 0;
  615. $scope.rate2 = 0;
  616. $scope.num3 = 0;
  617. $scope.rate3 = 0;
  618. $scope.num4 = 0;
  619. $scope.rate4 = 0;
  620. $scope.num5 = 0;
  621. $scope.rate5 = 0;
  622. $scope.num6 = 0;
  623. $scope.rate6 = 0;
  624. $scope.num7 = 0;
  625. $scope.rate7 = 0;
  626. angular.forEach($scope.typetalentdatalist, function (res) {
  627. $scope.total+=res.mannum+res.womannum
  628. $scope.num1 += res.mannum;
  629. $scope.num2 += res.womannum;
  630. $scope.num3 += res.doctornum;
  631. $scope.num4 += res.masternum;
  632. $scope.num5 += res.degreenum;
  633. $scope.num6 += res.highnum;
  634. $scope.num7 += res.vicenum;
  635. })
  636. $scope.rate1 = toPercent($scope.num1/($scope.total==0?1:$scope.total));
  637. $scope.rate2 = toPercent($scope.num2/($scope.total==0?1:$scope.total));
  638. $scope.rate3 = toPercent($scope.num3/($scope.total==0?1:$scope.total));
  639. $scope.rate4 = toPercent($scope.num4/($scope.total==0?1:$scope.total));
  640. $scope.rate5 = toPercent($scope.num5/($scope.total==0?1:$scope.total));
  641. $scope.rate6 = toPercent($scope.num6/($scope.total==0?1:$scope.total));
  642. $scope.rate7 = toPercent($scope.num7/($scope.total==0?1:$scope.total));
  643. }
  644. })
  645. }
  646. //把小数转换成百分数
  647. var toPercent = function (point) {
  648. // console.log(point)
  649. if (point == 0) {
  650. return 0;
  651. }
  652. if (point == 1) {
  653. return "100%";
  654. }
  655. var str = String(point.toFixed(2) * 100).slice(0, 2) + "%";
  656. return str;
  657. }
  658. //企业专利类型情况统计
  659. var getBarChartForIntellecture = function (restype, text) {
  660. //获取拥有知识产权的企业的数量
  661. dataToolsService.getHaveIntellectureNum().then(function (res) {
  662. if (res.code == 3350) {
  663. console.log(res)
  664. $scope.intellectureTotalNum = res.data[0].num;
  665. $scope.intellectureTotaltime = res.otherObj;
  666. $scope.handlefirmedit=function () {
  667. $scope.go("Statisticseditor",{mapList:res.data,datalist:$scope.datalist})
  668. }
  669. }
  670. })
  671. dataToolsService.getBarChartForIntellecture($scope.fatherindexname, restype).then(function (res) {
  672. if (res.code == 3350) {
  673. $scope.xAxisData = [];
  674. $scope.yAxisData = [];
  675. for (var i = 0; i < res.data.length; i++) {
  676. $scope.xAxisData.push(res.data[i].type);
  677. $scope.yAxisData.push(res.data[i].num);
  678. }
  679. //绘图部分
  680. var myChart = null;
  681. if ($scope.isapp) {
  682. myChart = echarts.init(document.getElementById('main'));
  683. } else {
  684. myChart = echarts.init(document.getElementById('main11'));
  685. }
  686. // 指定图表的配置项和数据
  687. var option = {
  688. title: {
  689. text: text,
  690. subtext:res.otherObj,
  691. subtextStyle:{
  692. color:"#ff0000",
  693. fontSize: 12,
  694. }
  695. },
  696. grid: {
  697. containLabel: true,
  698. },
  699. tooltip: {},
  700. legend: {
  701. data: ['数量']
  702. },
  703. toolbox: {
  704. feature: {
  705. myTool1: {
  706. show: $scope.data.isShowEdit,
  707. // show:true,
  708. title: '编辑',
  709. icon: 'image://img/bianji.png',
  710. onclick: function (){
  711. $scope.go("Statisticseditor",{mapList : res.data,datalist:$scope.datalist})
  712. }
  713. },
  714. }
  715. },
  716. xAxis: {
  717. data: $scope.xAxisData,
  718. axisLabel: {
  719. show: true,
  720. textStyle: {
  721. fontSize: 14,
  722. color: '#686666',
  723. fontWeight: 'normal',
  724. }
  725. }
  726. },
  727. yAxis: {
  728. textStyle: {
  729. fontSize: 14,
  730. color: '#686666',
  731. fontWeight: 'normal',
  732. }
  733. },
  734. series: [{
  735. barWidth: 50,
  736. type: 'bar',
  737. data: $scope.yAxisData,
  738. label: {
  739. show: "true",
  740. position: "top",
  741. fontWeight: "bolder",
  742. color: '#c23531',
  743. fontSize: "14"
  744. }
  745. }]
  746. };
  747. // 使用刚指定的配置项和数据显示图表。
  748. myChart.setOption(option);
  749. }
  750. })
  751. }
  752. //科技成果转化产业领域
  753. var getBarChartForCategory = function (restype, indexname, text, sort) {
  754. dataToolsService.getBarChartForCategory(indexname, restype).then(function (res) {
  755. // console.log(res)
  756. if (res.code == 3350) {
  757. $scope.list = res.data;
  758. dataToolsService.getCategoryList(indexname, restype).then(function (res1) {
  759. if (res1.code == 3350) {
  760. $scope.xAxisData1 = res1.data;
  761. $scope.demandCategortList = [];
  762. $scope.supplyCategortList = [];
  763. $scope.brokerCategortList = [];
  764. for (var i = 0; i < $scope.xAxisData1.length; i++) {
  765. for (var j = 0; j < $scope.list.length; j++) {
  766. if ($scope.xAxisData1[i] == $scope.list[j].type) {
  767. if ($scope.list[j].fathertype == "需求") {
  768. $scope.demandCategortList.push($scope.list[j].num);
  769. }
  770. if ($scope.list[j].fathertype == "供给") {
  771. $scope.supplyCategortList.push($scope.list[j].num);
  772. }
  773. if ($scope.list[j].fathertype == "经纪人") {
  774. $scope.brokerCategortList.push($scope.list[j].num);
  775. }
  776. }
  777. }
  778. }
  779. //绘图部分
  780. var myChart = null;
  781. if ($scope.isapp) {
  782. myChart = echarts.init(document.getElementById('main1' + sort));
  783. } else {
  784. myChart = echarts.init(document.getElementById('main' + sort));
  785. }
  786. // 指定图表的配置项和数据
  787. var option = {
  788. title: {
  789. text: text,
  790. subtext:res.otherObj,
  791. subtextStyle:{
  792. color:"#ff0000",
  793. fontSize: 12,
  794. }
  795. },
  796. grid: {
  797. containLabel: true,
  798. },
  799. tooltip: {trigger: 'axis'},
  800. legend: {
  801. show: true,
  802. right: 20,
  803. data: ['供给', '需求', '经纪人']
  804. },
  805. toolbox: {
  806. feature: {
  807. myTool1: {
  808. show: $scope.data.isShowEdit,
  809. // show:true,
  810. title: '编辑',
  811. icon: 'image://img/bianji.png',
  812. onclick: function (){
  813. $scope.go("Statisticseditor",{mapList : res.data,datalist:$scope.datalist})
  814. }
  815. },
  816. }
  817. },
  818. calculable: true,
  819. xAxis: {
  820. type: 'category',
  821. data: $scope.xAxisData1,
  822. axisLabel:{
  823. interval:0,//横轴信息全部显示
  824. rotate:-70,//-15度角倾斜显示
  825. }
  826. },
  827. yAxis: {
  828. type: 'value',
  829. textStyle: {
  830. fontSize: 14,
  831. color: '#686666',
  832. fontWeight: 'normal',
  833. }
  834. },
  835. series: [{
  836. name: '需求',
  837. type: 'bar',
  838. color: '#CC0066',
  839. data: $scope.demandCategortList,
  840. label: {
  841. show: "true",
  842. position: "top",
  843. fontWeight: "bolder",
  844. color: '#c23531',
  845. fontSize: "14"
  846. }
  847. },
  848. {
  849. name: '供给',
  850. type: 'bar',
  851. color: '#009999',
  852. data: $scope.supplyCategortList,
  853. label: {
  854. show: "true",
  855. position: "top",
  856. fontWeight: "bolder",
  857. color: '#c23531',
  858. fontSize: "14"
  859. }
  860. },
  861. {
  862. name: '经纪人',
  863. type: 'bar',
  864. color: '#FFCC33',
  865. data: $scope.brokerCategortList,
  866. label: {
  867. show: "true",
  868. position: "top",
  869. fontWeight: "bolder",
  870. color: '#c23531',
  871. fontSize: "14"
  872. }
  873. }]
  874. };
  875. // 使用刚指定的配置项和数据显示图表。
  876. myChart.setOption(option);
  877. }
  878. })
  879. }
  880. })
  881. }
  882. //获取科技成果转化的数量
  883. var getBarChartForAchieveTrans = function (restype, text) {
  884. dataToolsService.getBarChartForAchieveTrans($scope.fatherindexname, restype).then(function (res) {
  885. if (res.code == 3350) {
  886. // console.log(res)
  887. $scope.achieveTransDataList = res.data;
  888. angular.forEach($scope.achieveTransDataList, function (res) {
  889. if (res.type == "需求提出率") {
  890. $scope.demandRate = res.num;
  891. }
  892. })
  893. $scope.xAxisData = ['人才', '技术', '高校'];
  894. //绘图部分
  895. var myChart = null;
  896. if ($scope.isapp) {
  897. myChart = echarts.init(document.getElementById('main121'));
  898. } else {
  899. myChart = echarts.init(document.getElementById('main21'));
  900. }
  901. // 指定图表的配置项和数据
  902. var option = {
  903. title: {
  904. text: text,
  905. subtext:res.otherObj,
  906. subtextStyle:{
  907. color:"#ff0000",
  908. fontSize: 12,
  909. }
  910. },
  911. grid: {
  912. containLabel: true,
  913. },
  914. tooltip: {trigger: 'axis'},
  915. legend: {
  916. show: true,
  917. right: 20,
  918. data: ['需求', '供给', '转化']
  919. },
  920. toolbox: {
  921. feature: {
  922. myTool1: {
  923. show: $scope.data.isShowEdit,
  924. // show:true,
  925. title: '编辑',
  926. icon: 'image://img/bianji.png',
  927. onclick: function (){
  928. $scope.go("Statisticseditor",{mapList : res.data,datalist:$scope.datalist})
  929. }
  930. },
  931. }
  932. },
  933. calculable: true,
  934. xAxis: {
  935. type: 'category',
  936. data: $scope.xAxisData,
  937. axisLabel:{
  938. interval:0,//横轴信息全部显示
  939. rotate:-15,//-15度角倾斜显示
  940. }
  941. },
  942. yAxis: {
  943. type: 'value',
  944. textStyle: {
  945. fontSize: 14,
  946. color: '#686666',
  947. fontWeight: 'normal',
  948. }
  949. },
  950. series: [{
  951. name: '需求',
  952. type: 'bar',
  953. color: '#CC0066',
  954. data: [$scope.achieveTransDataList[6].num, $scope.achieveTransDataList[7].num, 0],
  955. label: {
  956. show: "true",
  957. position: "top",
  958. fontWeight: "bolder",
  959. color: '#c23531',
  960. fontSize: "14"
  961. }
  962. },
  963. {
  964. name: '供给',
  965. type: 'bar',
  966. color: '#009999',
  967. data: [$scope.achieveTransDataList[2].num, $scope.achieveTransDataList[8].num, 0],
  968. label: {
  969. show: "true",
  970. position: "top",
  971. fontWeight: "bolder",
  972. color: '#c23531',
  973. fontSize: "14"
  974. }
  975. },
  976. {
  977. name: '转化',
  978. type: 'bar',
  979. color: '#FFCC33',
  980. data: [$scope.achieveTransDataList[10].num, $scope.achieveTransDataList[11].num, 0],
  981. label: {
  982. show: "true",
  983. position: "top",
  984. fontWeight: "bolder",
  985. color: '#c23531',
  986. fontSize: "14"
  987. }
  988. }]
  989. };
  990. // 使用刚指定的配置项和数据显示图表。
  991. myChart.setOption(option);
  992. }
  993. })
  994. }
  995. //其他
  996. // var getBarChartForOthers = function (restype, text) {
  997. // dataToolsService.getBarChartForOthers($scope.fatherindexname, restype).then(function (res) {
  998. // if (res.code == 3350) {
  999. // $scope.othersDataList = res.data;
  1000. // }
  1001. // })
  1002. // }
  1003. });