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

89 lines
3.0 KiB
JavaScript

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();
}])