/// /**************************折线图******************************/ app.controller('QuanGuoChouJianCtrl', ['$scope', 'YPJBXXGL', '$uibModal', '$sessionStorage', '$state', '$http', '$filter', 'mainUrl', 'wyOdataNodeService', 'stConfig', '$timeout', function ($scope, YPJBXXGL, $uibModal, $sessionStorage, $state, $http, $filter, mainUrl, wyOdataNodeService, stConfig, $timeout, $uibModalInstance, item) { //默认变量 $scope.stateAll = 0;//抽检状态--下拉框 $scope.TJTable = [];//查询条件数组 $scope.wherestr = "";//查询条件string格式 $scope.AllQGCJXX = function () { console.log($scope.TJTable); var wherestr = angular.toJson($scope.TJTable); $scope.wherestr = wherestr; $scope.layuiTable(); //增加日志20211109 addlog("全国抽检信息", "查询[" + $scope.wherestr + "]") } //layui表格 $scope.layuiTable = function () { if ($scope.stateAll==0) { layui.use('table', function () { var table = layui.table; table.render({ elem: '#QuanGuoChouJianTable' , url: '/QuanGuoChouJian/GetQuanGuoChouJian?state=' + $scope.stateAll + '&wherestr=' + $scope.wherestr , cols: [[ { field: 'XH', width: 40, title: 'ID', sort: true } , { field: 'SCQYMC', width: 120, title: '生产企业名称' } , { field: 'SCQYDZ', width: 120, title: '生产企业地址', sort: true } , { field: 'BCYDWMC', width: 130, title: '被抽样单位名称' } , { field: 'BCYDWSF', title: '被抽样单位所在省份', minWidth: 160 } , { field: 'SPMC', width: 110, title: '食品名称', sort: true } , { field: 'GGXH', width: 110, title: '规格型号', sort: true } , { field: 'SCRQ_PH', width: 130, title: '生产日期/批号' } , { field: 'FL', width: 120, title: '分类', sort: true } , { field: 'JYJG', width: 120, title: '检验机构', sort: true } , { field: 'LY', width: 110, title: '来源(期)', sort: true } , { field: 'LY2', width: 120, title: '来源(市局)', sort: true } , { field: 'time', width: 110, title: '发布时间', sort: true} ]] , page: true , done: function (res) { $("#countid").html(); $("#countid").append("10000"); } }); }); } if ($scope.stateAll == 1) { layui.use('table', function () { var table = layui.table; table.render({ elem: '#test' , url: '/home/AllQGCJXX?state=' + $scope.stateAll + '&wherestr=' + $scope.wherestr , cols: [[ { field: 'XH', width: 40, title: 'ID', sort: true } , { field: 'SCQYMC', width: 120, title: '生产企业名称' } , { field: 'SCQYDZ', width: 120, title: '生产企业地址', sort: true } , { field: 'BCYDWMC', width: 130, title: '被抽样单位名称' } , { field: 'BCYDWDZ', title: '被抽样单位所在地址', minWidth: 150 } , { field: 'SPMC', width: 120, title: '食品名称', sort: true } , { field: 'GGXH', width: 120, title: '规格型号', sort: true } , { field: 'SB', width: 100, title: '商标', sort: true } , { field: 'SCRQ_PH', width: 130, title: '生产日期/批号' } , { field: 'BHGXM_JYJG_BZZ', width: 200, title: '不合格项目║检验结果║标准值' } , { field: 'FL', width: 110, title: '分类', sort: true } , { field: 'JYJG', width: 110, title: '检验机构', sort: true } , { field: 'PZWH', width: 120, title: '批准文号', sort: true } , { field: 'CPLB', width: 110, title: '产品类别', sort: true } , { field: 'LY', width: 110, title: '来源(期)', sort: true } , { field: 'LY2', width: 120, title: '来源(市局)', sort: true } , { field: 'time', width: 110, title: '发布时间', sort: true } ]] , page: true , done: function (res) { $("#countid").html(); $("#countid").append("10000"); } }); }); } } $scope.layuiTable(); $scope.myttt = "等待查询结果"; $scope.Myjson = [ { "type": 1, "mytext": "生产企业名称", "PY": "SCQYMC" }, { "type": 1, "mytext": "生产企业地址", "PY": "SCQYDZ" }, { "type": 1, "mytext": "被抽样单位名称", "PY": "BCYDWMC" }, { "type": 1, "mytext": "被抽样单位省份(合格)", "PY": "BCYDWSF" }, { "type": 1, "mytext": "被抽样单位地址(不合格)", "PY": "BCYDWDZ" }, { "type": 1, "mytext": "食品名称", "PY": "SPMC" }, { "type": 1, "mytext": "规格型号", "PY": "GGXH" }, { "type": 1, "mytext": "商标", "PY": "SB" }, { "type": 1, "mytext": "分类", "PY": "FL" }, { "type": 1, "mytext": "检验机构", "PY": "JYJG" }, { "type": 1, "mytext": "来源(期)", "PY": "LY" }, { "type": 1, "mytext": "来源(市局)", "PY": "LY2" }, { "type": 1, "mytext": "发布日期", "PY": "str_to_date(time, '%Y-%m-%d')" }, ]; //、定性值、、、、限量值、限量值单位、检测值、检测值单位、判定 $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": "小于等于" }, ] //时间格式 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; } 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); } } 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.deleteTJ = function (index) { var aa = $scope.TJTable.indexOf(index); $scope.TJTable.splice(aa, 1); } //改变事件 $scope.MyjsonChange = function () { $scope.RELYdata = []; $scope.myselpublic = undefined; $scope.mytxt = ""; switch ($scope.mysel.PY) { case "str_to_date(time, '%Y-%m-%d')": $scope.isdate = true; $scope.RWLYSHOW = false; $scope.SouSuoShow = false; break; default: $scope.isdate = false; $scope.RWLYSHOW = false; $scope.SouSuoShow = true; } $timeout(function () { $("#dept").trigger("chosen:updated"); }, 100, false); } }])