2025-06-27 10:04:22 +08:00

350 lines
12 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**************************折线图******************************/
app.controller('TongJiHeGeLvCtrl', ['$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.score = 82;
////////////////////////////////////////////////////////////////////////////////
//设置下拉的选择项格式
$scope.stringSettings = {
template: '{{option}}',
smartButtonTextConverter(skip, option) {
return option;
},
};
//区县单独设置每次只能选择一个的设定
$scope.stringQXSettings = {
template: '{{option}}', selectionLimit: 1,
smartButtonTextConverter(skip, option) {
return option;
},
};
//设置下拉的文字显示情况
$scope.searchCustomTexts = {
buttonDefaultText: '选择',
checkAll: '全选',
uncheckAll: '取消',
selectionCount: '项',
dynamicButtonTextSuffix: '项'
};
$scope.newsearch = {
rwnf: [], rwlx: [], szqx: [], cyddlx: [], cydd: [], month: [], //任务年份数组,任务类型,所在区县
};
$scope.arrRWNF = ['2015', '2016', '2017', '2018', '2019', '2020', '2021', '2022', '2023'];
$scope.arrMonth = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'];
// $scope.arrRWLX = ['抽检监测', '风险监测', '监督抽检', '评价性抽检'];
$scope.arrRWLX = ['抽检监测', '监督抽检', '评价性抽检'];
$scope.arrSZQX = ['黄浦区', '徐汇区', '长宁区', '静安区', '普陀区', '虹口区', '杨浦区', '闵行区', '宝山区', '嘉定区', '浦东新区', '金山区', '松江区', '青浦区', '奉贤区', '崇明区'];
//以上的所有条件在996行进行实现
//新增抽样地点类型
$scope.arrCYDDLX = [];
//抽样环节
$scope.arrCYDD = ['生产环节', '流通环节', '餐饮环节'];
/////*******************总的查询*****************/
$scope.DaoChu = function () {
var wherestr = angular.toJson($scope.TJTable);
//$http.get('/home/GetTaMadeZuHeChaXun_DAOCHU?wherestr=' + wherestr,{}).success(function (mydata) {
// alert("导出成功");
// return mydata;
//})
window.location.href = Gaddress + '/home/GetTaMadeZuHeChaXun_DAOCHU?wherestr=' + wherestr;
}
//查询参数的调用
$scope.search = function () {
$scope.searchSql = [$scope.sql];
$scope.getA($scope.tableState);
}
/**************************************************************************************/
//合格率搜索功能231021Edit
$scope.btn_clcik = function () {
//debugger
$scope.newsendsearch = {
rwnf: $scope.newsearch.rwnf.toString(),
rwlx: $scope.newsearch.rwlx.toString(),
month: $scope.newsearch.month.toString(),
szqx: $scope.newsearch.szqx.toString(),
cyddlx: $scope.newsearch.cyddlx.toString(),
cydd: $scope.newsearch.cydd.toString(),
}
var quName = $sessionStorage.user.name;
// switch (quName) {
//
// case '长宁区': {
// $scope.arrSZQX = ['长宁区']
// $scope.newsendsearch.szqx = '长宁区'
// break; // 添加 break 语句
// }
// case '徐汇区': {
// $scope.arrSZQX = ['徐汇区']
// $scope.newsendsearch.szqx = '徐汇区'
// break; // 添加 break 语句
// }
// case '奉贤区': {
// $scope.arrSZQX = ['奉贤区']
// $scope.newsendsearch.szqx = '奉贤区'
// break; // 添加 break 语句
// }
// case '松江区': {
// $scope.arrSZQX = ['松江区']
// $scope.newsendsearch.szqx = '松江区'
// break; // 添加 break 语句
// }
// }
//增加日志20211109
addlog("不合格率", "查询[" + $scope.wherestr + "]")
layui.use('table', function () {
var table = layui.table;
table.render({
elem: '#buhegelv'
, url: Gaddress + '/TongJi/GetTongJiHeGeLv'
, where: {
num: $scope.num,
wherestr: JSON.stringify($scope.newsendsearch)
}
, parseData: function (res) { //res 即为原始返回的数据
$scope.score = res.score
$scope.$apply();
return {
"code": res.code,
"msg": "",
"data": res.data //解析数据列表
};
}
//, width: 800
, cellMinWidth: 150 //全局定义常规单元格的最小宽度layui 2.2.1 新增
, height: 330
, cols: [[
{field: 'sp_dl', width: 180, align: 'center', title: '食品大类', sort: true}
, {field: 'zongjianshu', width: 120, align: 'center', title: '总件数', sort: true}
, {field: 'hegejianshu', width: 140, align: 'center', title: '合格件数', sort: true}
, {field: 'hegelv', width: 140, align: 'right', title: '合格率(%)', sort: true}
, {field: 'score', width: 140, align: 'right', title: '分数', sort: true}
]]
, page: false
});
});
}
$scope.export = function () {
$scope.newsendsearch = {
rwnf: $scope.newsearch.rwnf.toString(),
rwlx: $scope.newsearch.rwlx.toString(),
month: $scope.newsearch.month.toString(),
szqx: $scope.newsearch.szqx.toString(),
cyddlx: $scope.newsearch.cyddlx.toString(),
cydd: $scope.newsearch.cydd.toString(),
}
window.location.href = './TongJi/GetTongJiHeGeLvExport?wherestr=' + JSON.stringify($scope.newsendsearch);
}
//$scope.btn_clcik()
//缓存搜索部分新增20231028Add
// btnCacheClick
//合格率搜索缓存功能231028Add
$scope.btnCacheClick = function () {
//debugger
if ($scope.newsearch.rwnf.length > 2) {
dLayer.msg("任务年份缓存搜索方式不能够超过两个年份,请重新进行选择!");
return;
}
if ($scope.newsearch.rwlx.length > 1) {
dLayer.msg("任务类型缓存搜索方式不能够超过一个,请重新进行选择!");
return;
}
$scope.newsendsearch = {
rwnf: $scope.newsearch.rwnf.toString(),
rwlx: $scope.newsearch.rwlx.toString(),
month: $scope.newsearch.month.toString(),
szqx: $scope.newsearch.szqx.toString(),
// cyddlx: $scope.newsearch.cyddlx.toString(),
// cydd: $scope.newsearch.cydd.toString(),
}
//增加日志20211109
addlog("不合格率", "查询[" + $scope.wherestr + "]")
layui.use('table', function () {
var table = layui.table;
table.render({
elem: '#buhegelv'
, url: Gaddress + '/tongji/tongjihegelvreadcache'
, where: {
//wherestr: $scope.wherestr,
// num: $scope.num,
wherestr: JSON.stringify($scope.newsendsearch)
}
, parseData: function (res) { //res 即为原始返回的数据
return {
"code": res.code,
"msg": "",
"data": JSON.parse(res.data) //解析数据列表
};
}
//, width: 800
, cellMinWidth: 150 //全局定义常规单元格的最小宽度layui 2.2.1 新增
, height: 330
, cols: [[
{field: 'sp_dl', width: 180, align: 'center', title: '食品大类', sort: true}
, {field: 'zongjianshu', width: 120, align: 'center', title: '总件数', sort: true}
, {field: 'hegejianshu', width: 140, align: 'center', title: '合格件数', sort: true}
, {field: 'hegelv', width: 140, align: 'right', title: '合格率(%)', sort: true}
]]
, page: false
});
});
}
$scope.btn_clcik();
//缓存查询
// $scope.btnCacheClick();
}])
app.directive('linewy', function () {
return {
scope: {
id: '@',
data: "="
},
restrict: 'AE', // E = Element, A = Attribute, C = Class, M = Comment
template: '<div style="height:400px"></div>',
replace: true,
link: function ($scope, iElm, iAttrs, controller) {
//var option =data;
// 基于准备好的dom初始化echarts图表
var myChart = echarts.init(document.getElementById($scope.id), 'macarons');
// console.log(myChart)
// 为echarts对象加载数据
myChart.showLoading(
{text: "正在加载数据"},
{effect: "whirling"}
);
$scope.$watch('data', function (e, t) {
// console.log(e);
//console.log('xindexinxi!!!');
if (e) {
myChart.setOption(e);
myChart.hideLoading();
}
})
}
};
});
app.directive('barwy', function () {
return {
scope: {
id: "@",
legend: "=",
item: "=",
data: "=",
newfunc: '&'
},
restrict: 'E', // E = Element, A = Attribute, C = Class, M = Comment
template: '<div style="height:400px"></div>',
replace: true,
controller: function ($scope) {
var option = {
tooltip: {
show: true,
trigger: "axis"
},
legend: {data: $scope.legend},
xAxis: [{
type: 'category',
data: $scope.item
}],
yAxis: [{
type: 'value',
}],
series: function () {
var serie = [];
for (var i = 0; i < $scope.legend.length; i++) {
var item = {
name: $scope.legend[i],
type: 'bar',
data: $scope.data[i]
};
serie.push(item);
}
return serie;
}()
}
$scope.option = option;
},
link: function ($scope, iElm, iAttrs, controller) {
//// 基于准备好的dom初始化echarts图表
var myChart = echarts.init(document.getElementById($scope.id), 'macarons');
//// 为echarts对象加载数据
myChart.setOption($scope.option);
$scope.$watch('',
function () {
//// 基于准备好的dom初始化echarts图表
var myChart = echarts.init(document.getElementById($scope.id), 'macarons');
//// 为echarts对象加载数据
myChart.setOption($scope.option);
}
);
}
};
});
//=============================================================================================================================