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

352 lines
12 KiB
JavaScript
Raw 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('XingZhengChuFaCtrl', ['$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 = 85;
//设置下拉的选择项格式
$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: [], ly: [], szqx: [] //任务年份数组,领域,所在区县
};
$scope.arrRWNF = ['2020', '2021', '2022', '2023'];
$scope.arrLY = ['生产环节', '销售环节', '餐饮环节'];
$scope.arrSZQX = ['黄浦区', '徐汇区', '长宁区', '静安区', '普陀区', '虹口区', '杨浦区', '闵行区', '宝山区', '嘉定区', '浦东新区', '金山区', '松江区', '青浦区', '奉贤区', '崇明区'];
//以上的所有条件在996行进行实现
///////////////////////////////////////////////////////////////////////
/////*******************总的查询*****************/
//不用
$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);
}
/**************************************************************************************/
//默认会给加一个月份
// $scope.startTime = new Date(2023, 7);
// $scope.endTime = new Date(2023, 8);
// var nowDate = new Date(2023,7);
// var fullYear = nowDate.getFullYear();
// var month = nowDate.getMonth() + 1;
// var endOfMonth = new Date(2023, 7, 0).getDate();
// dateTime = fullYear + "/" + month + "/" + endOfMonth;
//
// $scope.startTime = new Date(dateTime);
// $scope.endTime = new Date(dateTime);
//追溯率搜索功能231021Edit
$scope.btn_clcik = function () {
// var startData = $scope.startTime.getFullYear() + "/" + ($scope.startTime.getMonth() + 1) + "/" + $scope.startTime.getDate();
// var endData = $scope.endTime.getFullYear() + "/" + ($scope.endTime.getMonth() + 1) + "/" + $scope.endTime.getDate();
$scope.newsendsearch = {
// startTime: startData,
// endTime: endData,
rwnf: $scope.newsearch.rwnf.toString(),
ly: $scope.newsearch.ly.toString(),
szqx: $scope.newsearch.szqx.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: '#zhuisulv'
, url: Gaddress + '/XZCF/GetFaShengLv'
, where: {
// wherestr: $scope.wherestr,
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: 'chufaqinxing', width: 140, align: 'center', title: '处罚情形', sort: true}
, {field: 'zongqiye', width: 120, align: 'center', title: '总企业数', sort: true}
, {field: 'chufaqiye', width: 120, align: 'center', title: '处罚企业数', sort: true}
, {field: 'fashenglv', 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(),
ly: $scope.newsearch.ly.toString(),
szqx: $scope.newsearch.szqx.toString()
}
window.location.href = './XZCF/faShengLvExport?wherestr=' + JSON.stringify($scope.newsendsearch);
}
//$scope.btn_clcik()
//缓存搜索部分新增20231028Add
$scope.btnCacheClick = function () {
//debugger
if ($scope.newsearch.rwnf.length > 2) {
dLayer.msg("任务年份缓存搜索方式不能够超过两个年份,请重新进行选择!");
return;
}
if ($scope.newsearch.ly.length > 1) {
dLayer.msg("任务类型缓存搜索方式不能够超过一个,请重新进行选择!");
return;
}
$scope.newsendsearch = {
rwnf: $scope.newsearch.rwnf.toString(),
ly: $scope.newsearch.ly.toString(),
szqx: $scope.newsearch.szqx.toString()
}
//增加日志20211109
addlog("追溯率", "查询[" + $scope.wherestr + "]")
layui.use('table', function () {
var table = layui.table;
table.render({
elem: '#zhuisulv'
, url: Gaddress + '/XXZS/GetZhuiSuLv'
, 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: 'ZHUISHUSTATUS', width: 180, align: 'center', title: '追溯状态', sort: true}
, {field: 'ZONGQIYE', width: 120, align: 'center', title: '总企业数', sort: true}
, {field: 'WANCHENGQIYE', width: 140, align: 'center', title: '完成企业数', sort: true}
, {field: 'WANCHENGLV', width: 140, align: 'right', title: '完成率(%)', sort: true}
]]
, page: false
});
});
}
//默认执行正常搜索
$scope.btn_clcik();
}])
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);
}
);
}
};
});
//=============================================================================================================================