qualityCtrl.js 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472
  1. 'use strict';
  2. angular.module('app.additionalHome').controller('qualityCtrl', function ($rootScope,$scope,$state,$filter,$compile,$http,
  3. safeProduceNotifyService,safeproduceService,acceptanceService,qualitycheckService,StorehouseService,
  4. threetempcheckService,grainTempService,liangspzService,APP_CONFIG) {
  5. $scope.pageInfo = {pageNum : 1, pageSize : 5};
  6. $scope.loadData = function() {
  7. //公告
  8. safeProduceNotifyService.getPageInfo($scope.pageInfo.pageNum, $scope.pageInfo.pageSize, null)
  9. .then(function(data) {
  10. $scope.qualityPageInfo = data;
  11. $scope.safeProduceNumber = data.total;
  12. if(data.list.length < 1){
  13. $(".list").html("<img src='styles/img/qualityCheck/timg.jpg' style='width:100%;height:100%;'>");
  14. }
  15. }, function(data) {
  16. console.log(data);
  17. });
  18. //公共文档
  19. safeproduceService.getPageInfo($scope.pageInfo.pageNum, $scope.pageInfo.pageSize, 1, null)
  20. .then(function(data) {
  21. $scope.documentsNumber = data.total;
  22. }, function(data) {
  23. console.log(data);
  24. });
  25. //全部(验收)
  26. $scope.searchCondition = {planNumber:null,planTitle:null,customerPlanState:null};
  27. // 获取列表数据
  28. acceptanceService.getPageInfo($scope.pageInfo.pageNum, $scope.pageInfo.pageSize,
  29. $scope.searchCondition, null).then(function(data){
  30. $scope.acceptanceTotal = data.total;
  31. },function(data){
  32. console.log(data);
  33. });
  34. //已验收(验收)
  35. $scope.searchCondition = {planNumber:null,planTitle:null,customerPlanState:100};
  36. // 获取列表数据
  37. acceptanceService.getPageInfo($scope.pageInfo.pageNum, $scope.pageInfo.pageSize,
  38. $scope.searchCondition, null).then(function(data){
  39. $scope.acceptancedNumber = data.total;
  40. },function(data){
  41. console.log(data);
  42. });
  43. //未验收(验收)
  44. $scope.searchCondition = {planNumber:null,planTitle:null,customerPlanState:-100};
  45. // 获取列表数据
  46. acceptanceService.getPageInfo($scope.pageInfo.pageNum, $scope.pageInfo.pageSize,
  47. $scope.searchCondition, null).then(function(data){
  48. $scope.noAcceptanceNumber = data.total;
  49. },function(data){
  50. console.log(data);
  51. });
  52. //全部(春秋普查)
  53. qualitycheckService.getPageInfo($scope.pageInfo.pageNum, $scope.pageInfo.pageSize,2,null,null,null).then(function(data){
  54. $scope.generalSurveyTotal = data.total;
  55. },function(data){
  56. console.log(data);
  57. });
  58. //合格(春秋普查)
  59. qualitycheckService.getPageInfo($scope.pageInfo.pageNum, $scope.pageInfo.pageSize,2,"0",null,null).then(function(data){
  60. $scope.qualifiedNumber = data.total;
  61. },function(data){
  62. console.log(data);
  63. });
  64. //不合格(春秋普查)
  65. qualitycheckService.getPageInfo($scope.pageInfo.pageNum, $scope.pageInfo.pageSize,2,"1",null,null).then(function(data){
  66. $scope.unqualifiedNumber = data.total;
  67. },function(data){
  68. console.log(data);
  69. });
  70. //全部(第三方检查)
  71. qualitycheckService.getPageInfo($scope.pageInfo.pageNum, $scope.pageInfo.pageSize,5,null,null,null).then(function(data){
  72. $scope.thirdPartyTotal = data.total;
  73. },function(data){
  74. console.log(data);
  75. });
  76. //合格(第三方检查)
  77. qualitycheckService.getPageInfo($scope.pageInfo.pageNum, $scope.pageInfo.pageSize,5,"0",null,null).then(function(data){
  78. $scope.passNumber = data.total;
  79. },function(data){
  80. console.log(data);
  81. });
  82. //不合格(第三方检查)
  83. qualitycheckService.getPageInfo($scope.pageInfo.pageNum, $scope.pageInfo.pageSize,5,"1",null,null).then(function(data){
  84. $scope.noPassNumber = data.total;
  85. },function(data){
  86. console.log(data);
  87. });
  88. };
  89. // 查看页面
  90. $scope.showViewNotify = function(id) {
  91. $scope.switchTopMenu(19);
  92. $state.go('app.safeproduce.notifyAdd', {id:id,isNotEdit:true});
  93. };
  94. // 发布通知公告
  95. $scope.showAddNotify=function (id) {
  96. var className = $("#"+id).parent().parent().attr("class");
  97. if(className.indexOf("flip-current") != -1){
  98. $scope.switchTopMenu(19);
  99. $state.go('app.safeproduce.notifyAdd', {id:0,isNotEdit:false,topRow:$rootScope.orgInfo.orgName+"通告:\n"});
  100. }
  101. };
  102. //验收
  103. $scope.acceptance = function(type){
  104. $scope.switchTopMenu(19);
  105. $state.go("app.storage.acceptanceList",{customerPlanState:type});
  106. }
  107. //验收申请
  108. $scope.acceptanceApplication = function(type,id){
  109. var className = $("#"+id).parent().parent().attr("class");
  110. if(className.indexOf("flip-current") != -1){
  111. $scope.switchTopMenu(19);
  112. $scope.searchCondition = {planNumber:null,planTitle:null,customerPlanState:50};
  113. // 获取列表数据
  114. acceptanceService.getPageInfo($scope.pageInfo.pageNum, $scope.pageInfo.pageSize,
  115. $scope.searchCondition, null).then(function(data){
  116. for(var i=0;i<data.list.length;i++){
  117. var ids = data.list[i].id;
  118. $state.go("app.storage.acceptanceEditYS",{id:ids});
  119. break;
  120. }
  121. },function(data){
  122. console.log(data);
  123. });
  124. }
  125. }
  126. //春秋普查
  127. $scope.generalSurvey = function(type){
  128. $scope.switchTopMenu(19);
  129. $state.go("app.storage.qualitycheck.spr.sprlist",{type:2,checkResult:type});
  130. }
  131. //第三方检查
  132. $scope.thirdParty = function(type){
  133. $scope.switchTopMenu(19);
  134. $state.go("app.storage.qualitycheck.spr.sprlist",{type:5,checkResult:type});
  135. }
  136. // 安全生产通知
  137. $scope.safeProduceNotifyTodo=function() {
  138. $scope.switchTopMenu(19);
  139. $state.go("app.safeproduce.notifyList");
  140. }
  141. // 安全生产管理制度
  142. $scope.safeProduceTodo=function(layerType,id) {
  143. if("publish" == layerType){//跳转文档发布页面
  144. var className = $("#"+id).parent().parent().attr("class");
  145. if(className.indexOf("flip-current") != -1){
  146. $scope.switchTopMenu(19);
  147. $state.go('app.safeproduce.list', {type:1,layerType:'publish'});
  148. }
  149. }else if("list" == layerType) {//跳转文档列表页面
  150. $scope.switchTopMenu(19);
  151. $state.go('app.safeproduce.list', {type:1});
  152. }
  153. }
  154. $scope.switchTopMenu = function(funcId) {
  155. if (!$("#menu-"+funcId).hasClass('open')) {
  156. $("#menu-"+funcId).smartCollapseToggle();
  157. }
  158. if (funcId==18) {
  159. $('body').addClass("minified");
  160. } else {
  161. $('body').removeClass("minified");
  162. }
  163. $rootScope.childSysId = funcId;
  164. sessionStorage.setItem("childSysId", funcId);
  165. }
  166. // 三温检查列表
  167. $scope.loadThreeTemperature= function() {
  168. //查询三温检查列表最新数据所对应的仓房
  169. StorehouseService.getThreeTempCheckList($rootScope.orgInfo.orgId).then(function(data){
  170. if((data.houseList).length>0){
  171. $scope.houseId = data.houseList[0].storehouseId;
  172. }else{
  173. $scope.houseId = "";
  174. }
  175. $scope.initThree();
  176. },function (data) {
  177. console.log(data);
  178. });
  179. }
  180. $scope.initThree = function(){
  181. grainTempService.getThreeConditionHomePage($rootScope.orgInfo.orgId,$scope.houseId,"13").then(function(data){
  182. //初始化echarts 图表
  183. var option = {
  184. tooltip : {
  185. trigger: 'axis'
  186. },
  187. grid:{
  188. left: '3%',
  189. right: '7%',
  190. bottom: '3%',
  191. containLabel: true
  192. },
  193. color:['#00FF00','#ffdb43','#4bb4ff'],
  194. legend: {
  195. data:['粮温','仓内温','仓外温'],
  196. icon: "circle",
  197. itemWidth: 10,
  198. itemHeight: 10,
  199. itemGap: 20,
  200. right: '4%', // 垂直安放位置,默认为全图顶端,可选为:
  201. textStyle: {
  202. color: '#000' // 图例文字颜色
  203. }
  204. },
  205. xAxis : [
  206. {
  207. type : 'category',
  208. boundaryGap : false,
  209. data : ['周一','周二','周三','周四','周五','周六','周日'],
  210. axisLabel: {
  211. textStyle: {
  212. color: '#000',//坐标值得具体的颜色
  213. }
  214. },
  215. axisLine: {
  216. lineStyle: {
  217. color: '#000',
  218. width: 1
  219. }
  220. },
  221. splitLine: {
  222. show: true,
  223. lineStyle:{
  224. color: ['#eee'],
  225. width: 1,
  226. type: 'solid'
  227. }
  228. }
  229. }
  230. ],
  231. yAxis : [
  232. {
  233. type : 'value',
  234. show : true,
  235. axisLabel: {
  236. textStyle: {
  237. color: '#000',//坐标值得具体的颜色
  238. }
  239. },
  240. axisLine : {
  241. lineStyle: {
  242. type: 'solid',
  243. color:'#000000',
  244. width:'1'
  245. }
  246. }
  247. }
  248. ],
  249. series : [
  250. {
  251. name:'粮温',
  252. type:'line',
  253. smooth:true,
  254. data:[10, 12, 21, 54, 260, 830, 710]
  255. },
  256. {
  257. name:'仓内温',
  258. type:'line',
  259. smooth:true,
  260. data:[30, 182, 434, 791, 390, 30, 10]
  261. },
  262. {
  263. name:'仓外温',
  264. type:'line',
  265. smooth:true,
  266. data:[1320, 1132, 601, 234, 120, 90, 20]
  267. },
  268. {
  269. name:'仓内湿',
  270. type:'line',
  271. smooth:true,
  272. data:[1320, 1132, 601, 234, 120, 90, 20]
  273. },
  274. {
  275. name:'仓外湿',
  276. type:'line',
  277. smooth:true,
  278. data:[1320, 1132, 601, 234, 120, 90, 20]
  279. }
  280. ]
  281. };
  282. //获取实时数据--具体点的数据
  283. $scope.getRealTemp = function (data) {
  284. var timeList = [];// 时间集合
  285. var lswd = [];// 粮食温度
  286. var cwwd = [];// 仓外温度
  287. var cnwd = [];// 仓内温度
  288. var cnsd = [];// 仓内湿度
  289. var cwsd = [];// 仓外湿度
  290. for (var i=0;i<data.length;i++){
  291. lswd.push(data[i].lswd);
  292. cwwd.push(data[i].cwwd);
  293. cnwd.push(data[i].cnwd);
  294. cnsd.push(data[i].cnsd);
  295. cwsd.push(data[i].cwsd);
  296. timeList.push(data[i].days);
  297. }
  298. option.series[0].data = lswd;
  299. option.series[1].data = cnwd;
  300. option.series[2].data = cwwd;
  301. option.series[3].data = cnsd;
  302. option.series[4].data = cwsd;
  303. option.xAxis[0].data= timeList;
  304. }
  305. var myChart = echarts.init(document.getElementById("Thermometer"));
  306. $scope.getRealTemp(data);
  307. myChart.setOption(option);
  308. },function(data){
  309. console.log(data);
  310. });
  311. }
  312. //粮食品种柱形图
  313. $scope.loadFoodstuff = function(){
  314. liangspzService.getDate().then(function(data){
  315. var xiaomai=data.xiaomai;
  316. var yumi=data.yumi;
  317. var daogu=data.daogu;
  318. var dadou=data.dadou;
  319. // 基于准备好的dom,初始化echarts实例
  320. var myChart = echarts.init(document.getElementById("foodstuff"));
  321. var labelOption = {
  322. normal: {
  323. show: false,
  324. formatter: '{c} {name|{a}}',
  325. fontSize: 16,
  326. rich: {
  327. name: {
  328. textBorderColor: '#fff'
  329. }
  330. }
  331. }
  332. };
  333. // 指定图表的配置项和数据
  334. var option = {
  335. color: ['#003366', '#006699', '#4cabce', '#e5323e'],
  336. tooltip: {
  337. trigger: 'axis'
  338. },
  339. legend: {
  340. data: ['大豆', '玉米', '小麦', '稻谷'],
  341. itemGap: 20,
  342. right: '4%'
  343. },
  344. //控制边距 
  345. grid: {
  346. left: '3%',
  347. right: '4%',
  348. bottom: '3%',
  349. containLabel: true
  350. },
  351. calculable: true,
  352. xAxis: [
  353. {
  354. type: 'category',
  355. data: data.years,
  356. splitLine: {
  357. show: true,
  358. lineStyle:{
  359. color: ['#eee'],
  360. width: 1,
  361. type: 'solid'
  362. }
  363. },
  364. axisLabel:{
  365. show: true,
  366. textStyle:{
  367. color:"#000"
  368. }
  369. },
  370. axisLine: {
  371. lineStyle: {
  372. color:'#000',
  373. width:'1'
  374. }
  375. }
  376. }
  377. ],
  378. yAxis: [
  379. {
  380. type: 'value',
  381. splitLine: {
  382. show: true,
  383. lineStyle:{
  384. color: ['#eee'],
  385. width: 1,
  386. type: 'solid'
  387. }
  388. },
  389. axisLine: {
  390. lineStyle: {
  391. color:'#000',
  392. width:'1'
  393. }
  394. },
  395. axisLabel: {
  396. show: true,
  397. textStyle: {
  398. color: '#928f8f'
  399. }
  400. }
  401. }
  402. ],
  403. series: [
  404. {
  405. name: '大豆',
  406. type: 'bar',
  407. barGap: '5%', // 柱间隔
  408. label: labelOption,
  409. barWidth : 10,
  410. data: dadou
  411. },
  412. {
  413. name: '玉米',
  414. type: 'bar',
  415. label: labelOption,
  416. barWidth : 10,
  417. data: yumi
  418. },
  419. {
  420. name: '小麦',
  421. type: 'bar',
  422. label: labelOption,
  423. barWidth : 10,
  424. data: xiaomai
  425. },
  426. {
  427. name: '稻谷',
  428. type: 'bar',
  429. label: labelOption,
  430. barWidth : 10,
  431. data: daogu
  432. }
  433. ]
  434. };
  435. myChart.setOption(option);
  436. },function(data){
  437. console.log(data);
  438. });
  439. }
  440. $scope.loadData();
  441. $scope.loadThreeTemperature();
  442. $scope.loadFoodstuff();
  443. });