app.controller('OperateLogCtrl', ['$scope', '$state', '$http', function ($scope, $state, $http) { //操作日志,目前没有用得上,虽然前面做了绑定,最后还是用了jquery的方法 $scope.searchJson = { ouser: "", otype:"",ocontent:""} $scope.showtip ="只导出5000条以内" $scope.search = function () { console.log($("#ouser").val(), $("#otype").val(), $("#ocontent").val()) $scope.loadlog() } $scope.exportcsv = function () { //$("#ouser").val(), $("#otype").val(), $("#ocontent").val() //$http.get( // "/operateLog/ExportCsv?operateUser=" + $("#ouser").val() + // "&operateType=" + $("#otype").val() + // "&operateContent=" + $("#ocontent").val() // ).then(function (mydata) { // console.log("导出成功") // }) var strUrl = "/operateLog/ExportCsv?operateUser=" + $("#ouser").val() + "&operateType=" + $("#otype").val() + "&operateContent=" + $("#ocontent").val(); $scope.showtip = "只导出5000条以内,正在导出,请稍等" window.location.href = strUrl; $scope.showtip = "只导出5000条以内" } $scope.loadlog = function () { //layui.use('form', function () { // var form = layui.form; //}) layui.use('table', function () { var table = layui.table; table.render({ elem: '#OperateTable' , url: Gaddress + '/OperateLog/getlog' , where: { 'operateUser': $("#ouser").val(), 'operateType': $("#otype").val(), 'operateContent': $("#ocontent").val() } , parseData: function (res) { //res 即为原始返回的数据 return { "code": res.code, "data": res.data, //解析数据列表 "count": res.count }; } //, width: 800 , height: 700 , cols: [[ { field: 'Id', width: 100, align: 'center', title: '编号', sort: true } , { field: 'operateUser', width: 300, align: 'center', title: '操作人员', sort: true } , { field: 'operateType', width: 200, align: 'center', title: '操作类型', sort: true } , { field: 'operateContent', width: 500, align: 'center', title: '操作内容', sort: true } , { field: 'operateTime', width: 200, align: 'right', title: '操作时间', sort: true } ]] , page: true , done: function (res, curr, count) { //$("table").width("100 %") } }); }); $http.get("/operateLog/getQueryConditions").then(function (mydata) { $scope.QueryCondition = mydata.data; }) } $scope.loadlog(); }]) //备份的部分用的 app.controller('BackLogCtrl', ['$scope', '$state', '$http', function ($scope, $state, $http) { $scope.SearchBackLog=function() { layui.use('table', function () { var table = layui.table; //SQLServer数据库备份记录表 table.render({ elem: '#SQLBackTable' , url: '/operatelog/ReadSqlBackList' , where: { //page: } , parseData: function (res) { //res 即为原始返回的数据 return { "code": res.code, "data": res.data, //解析数据列表 "count": res.count }; } , width: '70%' , height: 500 , cols: [[ { field: 'logType', width: 120, align: 'center', title: '备份类型' } , { field: 'logContent', width: 600, align: 'center', title: '备份内容' } , { field: 'OperateTime', width: 210, align: 'center', title: '备份时间' } ]] , border: true , page: true , done: function (res, curr, count) { } }); table.render({ elem: '#BackLogTable' , url: '/OperateLog/ReadBackList' , where: { } , parseData: function (res) { //res 即为原始返回的数据 return { "code": res.code, "data": res.data, //解析数据列表 "count": res.count }; } , width: '30%' , height: 200 , cols: [[ { field: 'OriginalPath', width: 240, align: 'center', title: '日志文档' } , { fixed: 'right', title: '操作', width: 60, minWidth: 60, toolbar: '#barDemo' } ]] , border: true , page: false , done: function (res, curr, count) { } }); // 单元格编辑事件 table.on('tool(BackLogTable)', function (obj) { var field = obj.field //得到字段 , value = obj.value //得到修改后的值 , data = obj.data; //得到所在行所有键值 var data = obj.data; //获得当前行数据 var layEvent = obj.event; //获得 lay-event 对应的值 if (layEvent === 'detail') { //查看 //do somehing //alert('sdfsdf', obj) console.log(obj.data.OriginalPath) var tableDetail = layui.table; tableDetail.render({ elem: '#BackLogDetailTable' , url: '/OperateLog/ReadBackLog' , where: { 'filename': obj.data.OriginalPath } , parseData: function (res) { //res 即为原始返回的数据 return { "code": res.code, "data": res.data, //解析数据列表 "count": res.count }; } , width: '60%' , height: 200 , cols: [[ { field: 'LogTime', width: 180, align: 'center', title: '日志时间' } //, { field: 'LogType', width: 200, align: 'center', title: '日志类型' } , { field: 'Content', width: 340, align: 'center', title: '日志文档' } ]] , border: true , page: false , done: function (res, curr, count) { } }); } }); }) } $scope.SearchBackLog(); }])