app.controller("ZhuTiFuGaiLvCtrl", ["$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(); // //这是新方法20231022包括表格数据和图表数据同步显示 这是老方法 // $scope.searchPage = function () { // // //显示加载数据的状态进度条 // //$scope.isShow = true; // $("#stloading").show(); // // layui.use('table', function () { // var table = layui.table; // // table.render({ // elem: '#gridOverproof' // , url:Gaddress + '/TongJi/zhutiqiyefugailv?rwlx=' + $scope.rwlx + '&nf=' + $scope.nf + '&cydd=' + $scope.cydd // , 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: 800 // , cellMinWidth: 150 //全局定义常规单元格的最小宽度,layui 2.2.1 新增 // , height: 430 // , cols: [[ // {field: 'county_name', width: 200, align: 'center', title: '地区名称', sort: true} // , { // field: 'hege_count', // width: 200, // align: 'center', // title: '抽检覆盖的有生产经营许可证企业数量', // sort: true // } // , {field: 'choujian_count', width: 200, align: 'center', title: '生产经营企业总数', sort: true} // , {field: 'pass_rate', width: 200, align: 'right', title: '主体覆盖率(%)', sort: true} // , {field: 'score', width: 140, align: 'right', title: '分数', sort: true} // ]] // , page: false // , done: function (res, curr, count) { // //$("table").width("100 %") // // console.log('返回来的数据,需要做个操作', res); // //加载完成进度条完成操作过程 // $("#stloading").hide(); // // $scope.xx = res.chartx; // $scope.yy = res.charty; // $scope.displayBaoluliangChart(); // // //增加日志20211109 // addlog("覆盖率", "查询[覆盖率]") // } // }); // }); // } //0407新计算逻辑 $scope.searchPage = function () { //显示加载数据的状态进度条 //$scope.isShow = true; $("#stloading").show(); layui.use('table', function () { var table = layui.table; table.render({ elem: '#gridOverproof' , url: Gaddress + '/TongJi/zhutiqiyefugailv?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: 1060 , cellMinWidth: 150 //全局定义常规单元格的最小宽度,layui 2.2.1 新增 , height: 430 , cols: [[ {field: 'county_name', width: 120, align: 'center', title: '地区名称', sort: true} , { field: 'hege_count', width: 230, align: 'center', title: '抽检覆盖的有生产经营许可证企业数量', sort: true } , {field: 'choujian_count', width: 200, align: 'center', title: '生产经营企业总数', sort: true} , {field: 'pass_rate', width: 180, align: 'center', title: '主体覆盖率(%)', sort: true} , {field: 'new_pass_rate', width: 160, align: 'center', title: '修正主体覆盖率', sort: true} , {field: 'score', width: 140, align: 'center', title: '分数', sort: true} ]] , page: false , done: function (res, curr, count) { //$("table").width("100 %") console.log('返回来的数据,需要做个操作', res); //加载完成进度条完成操作过程 $("#stloading").hide(); $scope.xx = res.chartx; $scope.yy = res.charty; $scope.displayBaoluliangChart(); //增加日志20211109 addlog("覆盖率", "查询[覆盖率]") } }); }); } $scope.export = function () { window.location.href = './TongJi/zhutiqiyefugailvExport?rwlx=' + $scope.rwlx + '&nf=' + $scope.nf + '&cydd=' + $scope.cydd + '&month=' + $scope.month + '&standard=' + $scope.standard + '&frequency=' + $scope.frequency } //$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/zhutifugailvreadcache?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: 'xukezhengzongshu', width: 200, align: 'center', title: '抽检覆盖的有生产经营许可证企业数量', sort: true } , {field: 'qiyezongshu', width: 200, align: 'center', title: '生产经营企业总数', sort: true} , {field: 'zhutifugailv', width: 200, align: 'right', title: '主体覆盖率(%)', sort: true} ]] , page: false , done: function (res, curr, count) { //$("table").width("100 %") console.log('返回来的数据,需要做个操作', res); //加载完成进度条完成操作过程 $("#stloading").hide(); $scope.xx = res.chartx; $scope.yy = res.charty; $scope.displayBaoluliangChart(); //增加日志20211109 addlog("覆盖率", "查询[覆盖率]") } }); }); } // $scope.searchPageCache(); $scope.searchPage(); }])