189 lines
14 KiB
Go
189 lines
14 KiB
Go
// Code generated by templ - DO NOT EDIT.
|
|
|
|
// templ: version: v0.3.960
|
|
package auditlog
|
|
|
|
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
|
|
|
import "github.com/a-h/templ"
|
|
import templruntime "github.com/a-h/templ/runtime"
|
|
|
|
import (
|
|
"context"
|
|
|
|
"management/internal/erpserver/templ/base"
|
|
"management/internal/erpserver/templ/component"
|
|
"management/internal/pkg/mid"
|
|
)
|
|
|
|
func List(ctx context.Context) templ.Component {
|
|
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
|
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
|
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
|
|
return templ_7745c5c3_CtxErr
|
|
}
|
|
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
|
if !templ_7745c5c3_IsBuffer {
|
|
defer func() {
|
|
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
|
|
if templ_7745c5c3_Err == nil {
|
|
templ_7745c5c3_Err = templ_7745c5c3_BufErr
|
|
}
|
|
}()
|
|
}
|
|
ctx = templ.InitializeContext(ctx)
|
|
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
|
|
if templ_7745c5c3_Var1 == nil {
|
|
templ_7745c5c3_Var1 = templ.NopComponent
|
|
}
|
|
ctx = templ.ClearChildren(ctx)
|
|
templ_7745c5c3_Var2 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
|
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
|
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
|
if !templ_7745c5c3_IsBuffer {
|
|
defer func() {
|
|
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
|
|
if templ_7745c5c3_Err == nil {
|
|
templ_7745c5c3_Err = templ_7745c5c3_BufErr
|
|
}
|
|
}()
|
|
}
|
|
ctx = templ.InitializeContext(ctx)
|
|
meuns := mid.GetCurMenus(ctx)
|
|
templ_7745c5c3_Err = component.TemplBtn(meuns, true).Render(ctx, templ_7745c5c3_Buffer)
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, " <div class=\"search-layer\" id=\"search-layer\" style=\"display: none;\"><div class=\"layui-form layui-row\"><div class=\"layui-col-xs12 layui-col-sm12 layui-col-md4\"><div class=\"layui-form-column\"><label for=\"timeBegin\" class=\"tips\">开始时间</label> <input type=\"text\" name=\"timeBegin\" id=\"timeBegin\" placeholder=\"yyyy-MM-dd\" readonly value=\"")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
var templ_7745c5c3_Var3 string
|
|
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(component.MonthBegin())
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/erpserver/templ/system/auditlog/list.templ`, Line: 22, Col: 58}
|
|
}
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "\" class=\"layui-input\"></div></div><div class=\"layui-col-xs12 layui-col-sm12 layui-col-md4\"><div class=\"layui-form-column\"><label for=\"timeEnd\" class=\"tips\">结束时间</label> <input type=\"text\" name=\"timeEnd\" id=\"timeEnd\" placeholder=\"yyyy-MM-dd\" readonly value=\"")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
var templ_7745c5c3_Var4 string
|
|
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(component.MonthEnd())
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/erpserver/templ/system/auditlog/list.templ`, Line: 28, Col: 133}
|
|
}
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "\" class=\"layui-input\"></div></div><div class=\"layui-col-xs12 layui-col-sm12 layui-col-md4\"><div class=\"layui-form-column\"><label for=\"email\" class=\"tips\">邮箱</label> <input type=\"text\" name=\"email\" id=\"email\" placeholder=\"请输入邮箱\" autocomplete=\"off\" class=\"layui-input\"></div></div></div><div class=\"layui-form layui-row\"><div class=\"layui-col-xs12 layui-col-sm12 layui-col-md4\"><div class=\"layui-form-column\"><label for=\"username\" class=\"tips\">用户名</label> <input type=\"text\" name=\"username\" id=\"username\" placeholder=\"请输入用户名\" autocomplete=\"off\" class=\"layui-input\"></div></div></div></div><div class=\"layui-panel\"><table id=\"tablelist\" lay-filter=\"tablelist\"></table></div>")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
return nil
|
|
})
|
|
templ_7745c5c3_Err = base.Base(ctx, listCss(), listJs(ctx, component.MonthBegin(), component.MonthEnd())).Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
func listCss() templ.Component {
|
|
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
|
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
|
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
|
|
return templ_7745c5c3_CtxErr
|
|
}
|
|
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
|
if !templ_7745c5c3_IsBuffer {
|
|
defer func() {
|
|
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
|
|
if templ_7745c5c3_Err == nil {
|
|
templ_7745c5c3_Err = templ_7745c5c3_BufErr
|
|
}
|
|
}()
|
|
}
|
|
ctx = templ.InitializeContext(ctx)
|
|
templ_7745c5c3_Var5 := templ.GetChildren(ctx)
|
|
if templ_7745c5c3_Var5 == nil {
|
|
templ_7745c5c3_Var5 = templ.NopComponent
|
|
}
|
|
ctx = templ.ClearChildren(ctx)
|
|
return nil
|
|
})
|
|
}
|
|
|
|
func listJs(ctx context.Context, monthBegin, monthEnd string) templ.Component {
|
|
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
|
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
|
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
|
|
return templ_7745c5c3_CtxErr
|
|
}
|
|
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
|
if !templ_7745c5c3_IsBuffer {
|
|
defer func() {
|
|
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
|
|
if templ_7745c5c3_Err == nil {
|
|
templ_7745c5c3_Err = templ_7745c5c3_BufErr
|
|
}
|
|
}()
|
|
}
|
|
ctx = templ.InitializeContext(ctx)
|
|
templ_7745c5c3_Var6 := templ.GetChildren(ctx)
|
|
if templ_7745c5c3_Var6 == nil {
|
|
templ_7745c5c3_Var6 = templ.NopComponent
|
|
}
|
|
ctx = templ.ClearChildren(ctx)
|
|
token := mid.GetCsrfToken(ctx)
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "<script>\n layui.use(['jquery', 'table', 'form', 'laydate', 'util'], function () {\n let $ = layui.jquery;\n let table = layui.table;\n let form = layui.form;\n let laydate = layui.laydate;\n let util = layui.util;\n\n /**开始时间 */\n laydate.render({\n elem: '#timeBegin',\n type: 'datetime',\n value: '")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
templ_7745c5c3_Var7, templ_7745c5c3_Err := templruntime.ScriptContentInsideStringLiteral(monthBegin)
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/erpserver/templ/system/auditlog/list.templ`, Line: 73, Col: 37}
|
|
}
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var7)
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "',\n ready: function (date) {\n this.dateTime.hours = 0;\n this.dateTime.minutes = 0;\n this.dateTime.seconds = 0;\n }\n });\n\n /**截止时间 */\n laydate.render({\n elem: '#timeEnd',\n type: 'datetime',\n value: '")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
templ_7745c5c3_Var8, templ_7745c5c3_Err := templruntime.ScriptContentInsideStringLiteral(monthEnd)
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/erpserver/templ/system/auditlog/list.templ`, Line: 85, Col: 35}
|
|
}
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var8)
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "',\n ready: function (date) {\n this.dateTime.hours = 23;\n this.dateTime.minutes = 59;\n this.dateTime.seconds = 59;\n }\n });\n\n // 加载列表\n table.render({\n elem: '#tablelist',\n url: \"/system/audit_log/list\",\n method: \"POST\",\n headers: { 'X-CSRF-Token': '")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
templ_7745c5c3_Var9, templ_7745c5c3_Err := templruntime.ScriptContentInsideStringLiteral(token)
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/erpserver/templ/system/auditlog/list.templ`, Line: 98, Col: 52}
|
|
}
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var9)
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "' },\n where: getQueryParams(),\n height: function () {\n return $(window).height() - 22;\n },\n page: true,\n limit: 15,\n limits: [15, 30, 45, 60, 75, 90],\n cols: [[\n { field: 'email', title: '邮箱', align: 'left', width: 180, fixed: 'left' },\n // { field: 'username', title: '用户名', align: 'left', width: 100 },\n { field: 'created_at', title: '创建时间', align: 'left', width: 160, templet: function (d) { return !d.created_at ? '' : util.toDateString(d.created_at) } },\n { field: 'method', title: '请求方法', align: 'left', width: 90 },\n { field: 'parameters', title: '请求参数', align: 'left', width: 120 },\n { field: 'url', title: 'URL', align: 'left', width: 300 },\n { field: 'start_at', title: '开始时间', align: 'left', width: 160, templet: function (d) { return !d.start_at ? '' : util.toDateString(d.start_at) } },\n { field: 'end_at', title: '结束时间', align: 'left', width: 160, templet: function (d) { return !d.end_at ? '' : util.toDateString(d.end_at) } },\n { field: 'duration', title: '时间(毫秒)', align: 'left', width: 90 },\n { field: 'ip', title: 'ip', align: 'left', width: 150 },\n { field: 'browser', title: '浏览器', align: 'left', width: 150 },\n { field: 'os', title: '系统', align: 'left', width: 150 },\n { field: 'referer_url', title: 'Referer', align: 'left', width: 300 },\n { field: 'remark', title: '备注', align: 'left', width: 200 },\n ]],\n skin: 'grid',\n toolbar: '#toolbar',\n defaultToolbar: [{\n title: '刷新',\n layEvent: 'refresh',\n icon: 'layui-icon-refresh',\n }, 'filter', 'exports'],\n request: {\n pageName: 'page',\n limitName: 'rows'\n }\n });\n\n table.on('toolbar(tablelist)', function (obj) {\n switch (obj.event) {\n case 'search': search(); break;\n case 'refresh': refresh(); break;\n }\n });\n\n function search() {\n layer.open({\n type: 1,\n offset: '20px',\n title: '搜索',\n content: $('#search-layer'), // 捕获的元素\n shade: 0.1,\n shadeClose: false,\n scrollbar: false,\n resize: false,\n move: false,\n skin: 'search-layer-open',\n area: ['50%', '350px'],\n btn: ['搜索', '重置'],\n btn1: function (index, layero) {\n search_btn();\n layer.close(index);\n },\n btn2: function (index, layero) {\n $('#timeBegin').val(formatDate(getCurrentYearStart(), 'YYYY-MM-DD HH:mm:ss'));\n $('#timeEnd').val(formatDate(getCurrentMonthEnd(), 'YYYY-MM-DD HH:mm:ss'));\n $('#email').val('');\n $('#username').val('');\n return false;\n }\n });\n }\n\n function refresh() {\n table.reload('tablelist');\n }\n\n // 搜索条件\n function getQueryParams() {\n return {\n timeBegin: $('#timeBegin').val(),\n timeEnd: $('#timeEnd').val(),\n name: $('#username').val(),\n email: $('#email').val()\n };\n }\n\n // 搜索\n function search_btn() {\n table.reload('tablelist', {\n where: getQueryParams(),\n page: {\n curr: 1\n }\n })\n }\n });\n </script>")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
var _ = templruntime.GeneratedTemplate
|