/// /**************************折线图******************************/ app.controller('YPXXNYCLCtrl', ['$scope', 'YPJBXXGL', '$uibModal', '$sessionStorage', '$state', '$http', '$filter', 'mainUrl', 'wyOdataNodeService', 'stConfig', '$timeout', 'Upload', function ($scope, YPJBXXGL, $uibModal, $sessionStorage, $state, $http, $filter, mainUrl, wyOdataNodeService, stConfig, $timeout, Upload, $uibModalInstance, item) { $scope.complaintType = [ "发生食源性疾病", "腐败变质", "存在异物", "发现病媒生物", "环境卫生", "销售过期食品", "虚假宣传", "无证经营", "没有准时送达", "标签不规范", "超范围经营", "假冒伪劣", "人员管理不规范", "原料处理不当", "无生产日期", "感官异常", "无检验检疫证明", "售卖活禽", "预包装食品未封口", "未设置临保专区", "原料使用不当", "储存不规范", "违规加药", "餐饮具清洗消毒不洁", "核辐射区生产的食品", "包装使用不当", "不正当竞争", "无法使用卡券" ] //修改数据窗口打开 $scope.ValueEdit = function (item) { // console.log('新方法的值', item); //OldThreeData = item; $scope.FormTitle = '农药样品信息' $scope.FormData = item; } //修改数据方法 $scope.UpdateData = function () { $http.put('./NYCL/update', $scope.FormData) .then(function (response) { dLayer.msg("审核完成"); $scope.ChaXun(); }) .catch(function (error) { console.error('发生错误', error); }); } //替换方法 $scope.ZongHeTH = function () { //新的打开替换的方法 dLayer.open({ type: 2, area: ['1200px', '700px'], content: '../tihuan_zhonghe.html' }); } $scope.myttt = "等待查询结果"; //todo $scope.Myjson = [ {"type": 1, "mytext": "样品名称", "PY": "YPMC"}, {"type": 1, "mytext": "食品品种", "PY": "SP_PZ"}, {"type": 1, "mytext": "食品亚类", "PY": "SP_YL"}, {"type": 1, "mytext": "食品细类", "PY": "SP_XL"}, {"type": 1, "mytext": "检测项目", "PY": "JCXM"}, {"type": 1, "mytext": "检验结果", "PY": "JCZ"}, {"type": 1, "mytext": "检测值单位", "PY": "JCZDW"}, {"type": 1, "mytext": "当量浓度", "PY": "Equivalent"}, {"type": 1, "mytext": "抽样地点类型", "PY": "CYDDLX"}, {"type": 1, "mytext": "被抽样单位区", "PY": "DZ_QX"}, {"type": 1, "mytext": "抽样人签名时间", "PY": "CYSJ"}, ]; //、定性值、限量值、限量值单位、检测值、检测值单位、判定 $scope.Myjson1 = [ {"myvalue": 1, "mytext": "等于"}, {"myvalue": 7, "mytext": "不等于"}, {"myvalue": 2, "mytext": "包含"}, {"myvalue": 8, "mytext": "不包含"}, {"myvalue": 3, "mytext": "大于"}, {"myvalue": 4, "mytext": "小于"}, {"myvalue": 5, "mytext": "大于等于"}, {"myvalue": 6, "mytext": "小于等于"}, ] var shipinleibieshuju = {}; function add0(m) { return m < 10 ? '0' + m : m } function format(shijianchuo) { //shijianchuo是整数,否则要parseInt转换 var time = new Date(shijianchuo); var y = time.getFullYear(); var m = time.getMonth() + 1; var d = time.getDate(); //var h = time.getHours(); //var mm = time.getMinutes(); //var s = time.getSeconds(); return y + '/' + add0(m) + '/' + add0(d);// + ' ' + add0(h) + ':' + add0(mm) + ':' + add0(s); } /***********************样品综合查询**************************/ //添加条件 $scope.TJTable = []; $scope.RWLYSHOW = false; $scope.SouSuoShow = true; $scope.addTJ = function (tjtype) { if ($scope.TJTable.length <= 0) { tjtype = ""; } if (!$scope.isdate) { var str = $("#dept").val(); if (str != "? undefined:undefined ?") { $scope.mytxt = str; } var aa = { "lianjietype": tjtype, "CXTJPY": $scope.mysel.PY, "CXTJ": $scope.mysel.mytext, "CXLX": $scope.mysel1.mytext, "CXLXid": $scope.mysel1.myvalue, "CXNR": $scope.mytxt, } if (aa.CXTJ == "选择" || aa.CXLX == "选择" || (str == "" && $scope.RWLYSHOW)) { return; } //console.log(aa); var myll = Enumerable.From($scope.TJTable).Where(function (x) { return x.CXTJ == aa.CXTJ && x.CXLX == aa.CXLX && x.CXNR == aa.CXNR }).ToArray(); if (myll.length > 0) { alert("您已经添加过此条件"); } else { $scope.TJTable.push(aa); //$scope.TJTable = Enumerable.From($scope.TJTable).ToArray(); //console.log(angular.toJson($scope.TJTable)); } } else { var kaishishijian = format($scope.datebegin); var jieshushijian = format($scope.dateend); var aa1 = { "lianjietype": tjtype, "CXTJPY": $scope.mysel.mytext == "执行年月" ? "ZXNY_KS" : $scope.mysel.PY, "CXTJ": $scope.mysel.mytext == "执行年月" ? "执行年月开始" : $scope.mysel.mytext, "CXLX": "大于等于", "CXLXid": 5, "CXNR": kaishishijian, } var aa2 = { "lianjietype": "and", "CXTJPY": $scope.mysel.mytext == "执行年月" ? "ZXNY_JS" : $scope.mysel.PY, "CXTJ": $scope.mysel.mytext == "执行年月" ? "执行年月结束" : $scope.mysel.mytext, "CXLX": "小于等于", "CXLXid": 6, "CXNR": jieshushijian, } $scope.TJTable.push(aa1); $scope.TJTable.push(aa2); //$scope.TJTable = Enumerable.From($scope.TJTable).ToArray(); } } //删除条件 $scope.deleteTJ = function (index) { var aa = $scope.TJTable.indexOf(index); $scope.TJTable.splice(aa, 1); } /////*******************总的查询*****************/ $scope.wherestr = ""; $scope.ChaXun = function () { var wherestr = angular.toJson($scope.TJTable); if ($scope.TJTable.length <= 0) { wherestr = ""; } wherestr = wherestr.replace('+', '%2B'); console.log($scope.tableState.pagination.start) console.log("分页查询") console.log(wherestr); $scope.wherestr = wherestr; // $scope.tableState.pagination.start = 0; $scope.getService($scope.tableState, null); //增加日志20240802 // addlog("投诉举报SQL查询", "查询[" + wherestr + "]") } $("#delete").hide(); $("#delete2").hide(); $("#tihuan").hide(); var Uname = sessionStorage.getItem('userName'); if (Uname == 'yushenghao') { $("#delete").show(); $("#delete2").show(); $("#tihuan").show(); } //直接导出数据的方法 //todo //导出文档 $scope.ExportAll = function () { debugger; if (!tableState.pagination.number) { tableState.pagination.number = $scope.curpageNumber; } window.location.href = './NYCL/export?wherestr=' + $scope.wherestr + '&page=' + tableState.pagination.start + '&limit=' + tableState.pagination.number; } /**************************************************************************************/ //通过STMATETable 分页显示数据 //以下的参数每个控制器都要有一份 tableState = {counrt: 0, pagination: {start: 0}, search: {}, sort: {}}; //这个参数后面会让每次访问服务器后进行同步返回的值赋值,作为中间值使用 $scope.selectList = []; //这个参数会让每次选中或者没有选中的条目直接暴露在这个值里面 $scope.searchSql = ""; //这个参数是自己组合相关的复杂查询条件 $scope.isShow = false; //这个参数主要进行页面加载的loading显示的directive的值得操作 $scope.itemsOptions = [5, 10, 20, 50, 100, 200, 500, 1000]; //这个参数进行分页页面上面的每页多少条的设置 $scope.curpageNumber = 10; //这个参数传递当前的每页多少条的数据 $scope.getService = function (tableState, ctrl) { //if (!wherestr || !wherestr) { // wherestr = ""; //} if (!tableState.pagination.number) { tableState.pagination.number = $scope.curpageNumber; } console.log($scope.wherestr); $http.get('./NYCL/page?wherestr=' + $scope.wherestr + '&page=' + tableState.pagination.start + '&limit=' + tableState.pagination.number, {}).success(function (res) { // console.log('获取结果', res); $scope.displayed = res.data.records; $scope.totalData = res.data.total; $scope.qiyeshuliang = res.qiyetotal; $scope.isShow = false; //当前页面的ID号数组 //$scope.ids = Enumerable.From($scope.displayed).Select(function (x) { return x._id }).ToArray(); //表格数量 $scope.myttt = res.data.total; tableState.count = res.data.total; tableState.pagination.numberOfPages = Math.ceil(res.data.total / $scope.curpageNumber); $scope.inputPage = tableState.pagination.numberOfPages; $scope.tableState = tableState; $scope.$broadcast('checkini'); }) }; //模板的分页选择触发操作 $scope.setPageNumber = function (pageNo) { tableState.pagination.number = pageNo; $scope.getService($scope.tableState, null); } //查询参数的调用 $scope.search = function () { $scope.searchSql = [$scope.sql]; $scope.getA($scope.tableState); } /**************************************************************************************/ $scope.items = 0; $scope.open = function (YPBH) { $scope.items = YPBH; var modalInstance = $uibModal.open({ animation: true, backdrop: false, // 不让点击背景关闭系统 templateUrl: 'app/model/modalTemplate.html', controller: 'uibModalInstanceCtrl', size: 'lg', //windowTopClass:'dialog' resolve: { items: function () { return $scope.items; } } }); modalInstance.result.then( function (nclose) { $scope.returnData = nclose }, function (ndismiss) { $scope.returnData = ndismiss } ) } $scope.JYXM = []; }])