app.controller('SampleNewsCtrl', ['$scope', 'YPJBXXGL', '$uibModal', function ($scope, YPJBXXGL, $uibModal) { $scope.myData = []; $scope.Year = ['2006', '2007', '2008', '2009', '2010', '2011', '2012', '2013', '2014', '2015', '2016']; $scope.Year = Enumerable.From($scope.Year).OrderByDescending().ToArray(); var j = 2017; for (i = 0; i < $scope.Year.length; i++) { var year = $scope.Year[i]; YPJBXXGL.getAllSelect({ $filter: "RWNF eq " + year + "", $select: "YPJBZTType,JieGuo" }, function (data) { //console.log(angular.toJson(data)); $scope.wcjs = Enumerable.From(data.value).Where(function (x) { return x.YPJBZTType == 4 }).Count(); $scope.hege = Enumerable.From(data.value).Where(function (x) { return x.YPJBZTType == 4 && x.JieGuo == "合格" }).Count(); $scope.chaobiao = Enumerable.From(data.value).Where(function (x) { return x.YPJBZTType == 4 && x.JieGuo == "不合格" }).Count(); $scope.wenti = Enumerable.From(data.value).Where(function (x) { return x.YPJBZTType == 4 && x.JieGuo == "问题" }).Count(); $scope.cbAndwt = Enumerable.From(data.value).Where(function (x) { return x.YPJBZTType == 4 && x.JieGuo == "不合格/问题" }).Count(); // var Year = 2006; j--; var aa = { YEAR: j, WCJS:$scope.wcjs, HEGE: $scope.hege, CHAOBIAO: $scope.chaobiao, WENTI: $scope.wenti, CBANDWT: $scope.cbAndwt } $scope.myData.push(aa); $scope.myData = Enumerable.From($scope.myData).OrderByDescending("$.YEAR").ToArray(); }) } //点击 到详细信息 $scope.Xiangxi = function (year, shuzi, n) { if (shuzi > 0) { // console.log(angular.toJson(year)); $scope.items = { YEAR: year, n:n }; var modalInstance = $uibModal.open({ animation: true, backdrop: false, // 不让点击背景关闭系统 templateUrl: 'app/SynthesizeManage/view/modalXiangXi.html', controller: 'XiangXiCtrl', size: 'lg', //windowTopClass:'dialog' resolve: { items: function () { return $scope.items; } } }); modalInstance.result.then( function (nclose) { $scope.returnData = nclose }, function (ndismiss) { $scope.returnData = ndismiss } ) } } //增加日志20211109 addlog("检测结果", "查询[检测结果]") }]) app.controller("XiangXiCtrl", ["$scope", '$uibModal', '$uibModalInstance', 'items', 'YPJBXXGL', 'wyOdataNodeService', '$state', function ($scope, $uibModal, $uibModalInstance, items, YPJBXXGL, wyOdataNodeService, $state) { switch (items.n) { case 1: $scope.jieguo = "合格"; break; case 2: $scope.jieguo = "不合格"; break; case 3: $scope.jieguo = "问题"; break; case 4: $scope.jieguo = "不合格/问题"; break; } /**************************************************************************************/ //通过STMATETable 分页显示数据 //以下的参数每个控制器都要有一份 $scope.tableState = []; //这个参数后面会让每次访问服务器后进行同步返回的值赋值,作为中间值使用 $scope.selectList = []; //这个参数会让每次选中或者没有选中的条目直接暴露在这个值里面 //判断是否是检测机构 如果是则只显示该机构名称 //if ($sessionStorage.user.type == 4 || $sessionStorage.user.type == 5) { // $scope.searchSql = "JCDW eq '" + $sessionStorage.user.name + "'and RWNF eq " + items + " and "; //} else { // $scope.searchSql = "RWNF"; //这个参数是自己组合相关的复杂查询条件 //} $scope.searchSql = "RWNF eq " + items.YEAR + " and YPJBZTType eq 4 and YPPJXX eq '" + $scope.jieguo + "'"; $scope.isShow = false; //这个参数主要进行页面加载的loading显示的directive的值得操作 $scope.itemsOptions = [5, 10, 20, 50, 100, 200]; //这个参数进行分页页面上面的每页多少条的设置 $scope.curpageNumber = 10; //这个参数传递当前的每页多少条的数据 //任何动作都会触发服务端的接口 $scope.getService = function (tableState, ctrl) { $scope.tableState = tableState; if (!$scope.tableState.pagination.number) { $scope.tableState.pagination.number = $scope.curpageNumber; } $scope.isShow = true; // console.log($scope.searchSql+"aaa"); wyOdataNodeService.getData(pubserver, 'YPJBXXGL_DB', $scope.tableState, $scope.searchSql + "&$orderby=CYDBH asc").then(function (data) { $scope.displayed = data; // console.log(data);; //当前页面的ID号数组 $scope.isShow = false; $scope.ids = Enumerable.From($scope.displayed).Select(function (x) { return x.id }).ToArray(); $scope.myttt = tableState.count; $scope.$broadcast('checkini'); //console.log($scope.ids); }); }; //模板的分页选择触发操作 $scope.setPageNumber = function (pageNo) { // alert("1") $scope.getService($scope.tableState); } //查询参数的调用 $scope.search = function () { $scope.searchSql = [$scope.sql]; $scope.getA($scope.tableState); //约定成数字的按照前后 //日期按照前后 //字符串的模糊查询 //var sql = '$filter=EventDateTime eq DateTime'2010-12-21T10:10:19.390625'; //日期参考如下: //(EventDateTime eq DateTime'2010-12-21T10:10:19.390625' ) and (BusinessUnitCode eq '2') //var dT=dd ge 12 and dd le 33 } //查看具体信息 $scope.XiuGai = function (id) { // console.log(id); $state.go("app.SampleInspect", { id: id, CYDBH: '' }); $uibModalInstance.dismiss('界面直接退出'); } //返回页面 $scope.return = function () { $uibModalInstance.dismiss('界面直接退出'); } }])