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

316 lines
12 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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("OverproofCtrl", ["$scope", '$http', function ($scope, $http) {
//居民覆盖率
$scope.rwlx = [];
$scope.cydd = [];
$scope.nf = '2023';
$scope.month = '1';
$scope.standard = '10';
$scope.frequency = '10';
$scope.isShow = false;
//任务类型数据内容
$scope.arrRWLX = [
'抽检监测', '风险监测', '监督抽检', '评价性抽检'
]
//抽样环节
$scope.arrCYDD = ['生产环节', '流通环节', '餐饮环节'];
////////////////////////////////////////////////////////////////////////////////
//设置下拉的选择项格式
$scope.stringSettings = {
template: '{{option}}',
smartButtonTextConverter(skip, option) {
return option;
},
};
//设置下拉的文字显示情况
$scope.searchCustomTexts = {
buttonDefaultText: '选择',
checkAll: '全选',
uncheckAll: '取消',
selectionCount: '项',
dynamicButtonTextSuffix: '项'
};
// 柱状图
$scope.displayBaoluliangChart = function () {
//var x = ['浦东新区','闵行区','宝山区','松江区','嘉定区','杨浦区','普陀区','青浦区','奉贤区','徐汇区','静安区','金山区','虹口区','崇明区','长宁区','黄浦区',];
//var y = ['1829', '395', '219', '108', '96', '1829', '395', '219', '108', '96', '1829', '395', '219', '108', '96', ];
var x = $scope.xx;
var y = $scope.yy;
// 基于准备好的dom初始化echarts实例
var dom = document.getElementById("zhuzhuangtu");
var myChart = echarts.init(dom);
var app = {};
option = null;
app.title = '';
option = {
title: {
text: '',
left: 'center'
},
color: ['#3398DB'],
tooltip: {
trigger: 'axis',
axisPointer: { // 坐标轴指示器,坐标轴触发有效
type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
}
},
xAxis: [
{
type: 'category',
data: x,
axisTick: {
alignWithLabel: true
},
axisLabel: {
rotate: 40,
interval: 0,
}
}
],
yAxis: [
{
type: 'value',
name: '单位:件数/千人',
}
],
series: [
{
name: '覆盖率',
type: 'bar',
barWidth: '60%',
data: y,
itemStyle: {
normal: {
label: {
show: true,
position: 'top',
formatter: '{c}'    //这是关键,在需要的地方加上就行了
}
}
},
}
]
};
;
if (option && typeof option === "object") {
myChart.setOption(option, true);
}
}
//$scope.baoluliang();
//这是老方法
//$scope.dataFunction = function () {
// $http.get('/TongJi/fugailv?rwlx=' + $scope.rwlx + '&nf=' + $scope.nf, {}).success(function (mydata) {
// $scope.yy = mydata.data;
// $scope.displayBaoluliangChart();
// //增加日志20211109
// addlog("覆盖率", "查询[覆盖率]")
// })
//}
//这是新方法20231022包括表格数据和图表数据同步显示
//这是新方法20240407包括表格数据和图表数据同步显示 这是旧计算逻辑 先隐去
// $scope.searchPage = function () {
//
// //显示加载数据的状态进度条
// //$scope.isShow = true;
// $("#stloading").show();
//
// layui.use('table', function () {
// var table = layui.table;
//
// table.render({
// elem: '#gridOverproof'
// , url:Gaddress + '/TongJi/fugailv?rwlx=' + $scope.rwlx + '&nf=' + $scope.nf + '&cydd=' + $scope.cydd
// , where: {
// //wherestr: JSON.stringify($scope.newsendsearch)
// }
// , parseData: function (res) { //res 即为原始返回的数据
// //加载完成进度条完成操作过程
// console.log('数据访问进度结束');
//
//
// return {
// "code": res.code,
// "msg": "",
// "data": res.data, //解析数据列表
// "chartx": res.chartx,
// "charty": res.charty
// };
// }
// //, width: 800
// , cellMinWidth: 150 //全局定义常规单元格的最小宽度layui 2.2.1 新增
// , height: 430
// , cols: [[
// { field: 'diqumingcheng', width: 200, align: 'center', title: '地区名称', sort: true }
// , { field: 'zongjianshu', width: 200, align: 'center', title: '抽检监测总件数', sort: true }
// , { field: 'renkoushuliang', width: 200, align: 'center', title: '人口数量', sort: true }
// , {field: 'fugailv', width: 200, align: 'right', title: '居民覆盖率(件数/千人)', sort: true}
//
// ]]
// , page: false
// , done: function (res, curr, count) {
// console.log('返回来的数据,需要做个操作', res);
// //加载完成进度条完成操作过程
// $("#stloading").hide();
// $scope.xx = res.chartx;
// $scope.yy = res.charty;
// $scope.displayBaoluliangChart();
// //增加日志20211109
// addlog("覆盖率", "查询[覆盖率]")
// }
// });
// });
// }
$scope.export = function () {
window.location.href = './TongJi/fugailvExport?rwlx=' + $scope.rwlx
+ '&nf=' + $scope.nf
+ '&cydd=' + $scope.cydd
+ '&month=' + $scope.month
+ '&standard=' + $scope.standard
+ '&frequency=' + $scope.frequency;
}
//0407新计算逻辑
$scope.searchPage = function () {
//显示加载数据的状态进度条
//$scope.isShow = true;
$("#stloading").show();
layui.use('table', function () {
var table = layui.table;
table.render({
elem: '#gridOverproof'
,
url: Gaddress + '/TongJi/fugailv?rwlx=' + $scope.rwlx + '&nf=' + $scope.nf + '&cydd=' + $scope.cydd + '&month=' + $scope.month
+ '&standard=' + $scope.standard + '&frequency=' + $scope.frequency
, where: {
//wherestr: JSON.stringify($scope.newsendsearch)
}
, parseData: function (res) { //res 即为原始返回的数据
//加载完成进度条完成操作过程
console.log('数据访问进度结束');
const chartx = res.data.map(item => item.county_name);
const charty = res.data.map(item => item.pass_rate);
return {
"code": res.code,
"msg": "",
"data": res.data, //解析数据列表
"chartx": chartx,
"charty": charty
// "chartx": res.chartx,
// "charty": res.charty
};
}
, width: 950
, cellMinWidth: 150 //全局定义常规单元格的最小宽度layui 2.2.1 新增
, height: 430
, cols: [[
{field: 'county_name', width: 120, align: 'center', title: '地区名称', sort: true}
, {field: 'hege_count', width: 200, align: 'center', title: '抽检监测总件数', sort: true}
, {field: 'choujian_count', width: 120, align: 'center', title: '人口数量', sort: true}
, {field: 'pass_rate', width: 200, align: 'center', title: '居民覆盖率(件数/千人)', sort: true}
, {field: 'new_pass_rate', width: 160, align: 'center', title: '修正居民覆盖率', sort: true}
, {field: 'score', width: 120, align: 'center', title: '成绩', sort: true}
]]
, page: false
, done: function (res, curr, count) {
console.log('返回来的数据,需要做个操作', res);
//加载完成进度条完成操作过程
$("#stloading").hide();
$scope.xx = res.chartx;
$scope.yy = res.charty;
$scope.displayBaoluliangChart();
//增加日志20211109
addlog("覆盖率", "查询[覆盖率]")
}
});
});
}
//$scope.searchPage();
//这是新方法20231028获取数据缓存包括表格数据和图表数据同步显示
$scope.searchPageCache = function () {
//显示加载数据的状态进度条
//$scope.isShow = true;
$("#stloading").show();
layui.use('table', function () {
var table = layui.table;
table.render({
elem: '#gridOverproof'
, url: Gaddress + '/tongji/FuGaiLvReadCache?rwlx=' + $scope.rwlx + '&nf=' + $scope.nf
, where: {
//wherestr: JSON.stringify($scope.newsendsearch)
}
, parseData: function (res) { //res 即为原始返回的数据
//加载完成进度条完成操作过程
console.log('数据访问进度结束');
return {
"code": res.code,
"msg": "",
"data": JSON.parse(res.data), //解析数据列表
"chartx": JSON.parse(res.chartx),
"charty": JSON.parse(res.charty)
};
}
//, width: 800
, cellMinWidth: 150 //全局定义常规单元格的最小宽度layui 2.2.1 新增
, height: 430
, cols: [[
{field: 'diqumingcheng', width: 200, align: 'center', title: '地区名称', sort: true}
, {field: 'zongjianshu', width: 200, align: 'center', title: '抽检监测总件数', sort: true}
, {field: 'renkoushuliang', width: 200, align: 'center', title: '人口数量', sort: true}
, {field: 'fugailv', width: 200, align: 'right', title: '居民覆盖率(件数/千人)', sort: true}
]]
// , page: false
, done: function (res, curr, count) {
console.log('返回来的数据,需要做个操作', res);
//加载完成进度条完成操作过程
$("#stloading").hide();
$scope.xx = res.chartx;
$scope.yy = res.charty;
$scope.displayBaoluliangChart();
//增加日志20211109
addlog("覆盖率", "查询[覆盖率]")
}
});
});
}
// $scope.searchPageCache();
$scope.searchPage();
}])