From 3aa1d3ae4a68f20efbe8342fa37e4e6a1657cbc5 Mon Sep 17 00:00:00 2001
From: H0nGzA1 <2505811377@qq.com>
Date: Sat, 11 Feb 2023 18:19:00 +0800
Subject: [PATCH] =?UTF-8?q?feat(=E5=AE=8C=E6=88=90=E6=97=A5=E5=BF=97?=
=?UTF-8?q?=E7=AE=A1=E7=90=86=E5=9F=BA=E6=9C=AC=E5=8A=9F=E8=83=BD):=20?=
=?UTF-8?q?=E2=9C=A8=20=E5=AE=8C=E6=88=90=E7=99=BB=E5=BD=95=E6=97=A5?=
=?UTF-8?q?=E5=BF=97=EF=BC=8C=E6=93=8D=E4=BD=9C=E6=97=A5=E5=BF=97crud?=
=?UTF-8?q?=E8=8F=9C=E5=8D=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
web/src/views/system/log/loginLog/api.ts | 41 +++
web/src/views/system/log/loginLog/crud.tsx | 290 ++++++++++++++++++
web/src/views/system/log/loginLog/index.vue | 26 ++
web/src/views/system/log/operationLog/api.ts | 41 +++
.../views/system/log/operationLog/crud.tsx | 227 ++++++++++++++
.../views/system/log/operationLog/index.vue | 26 ++
6 files changed, 651 insertions(+)
create mode 100644 web/src/views/system/log/loginLog/api.ts
create mode 100644 web/src/views/system/log/loginLog/crud.tsx
create mode 100644 web/src/views/system/log/loginLog/index.vue
create mode 100644 web/src/views/system/log/operationLog/api.ts
create mode 100644 web/src/views/system/log/operationLog/crud.tsx
create mode 100644 web/src/views/system/log/operationLog/index.vue
diff --git a/web/src/views/system/log/loginLog/api.ts b/web/src/views/system/log/loginLog/api.ts
new file mode 100644
index 0000000..fe32b22
--- /dev/null
+++ b/web/src/views/system/log/loginLog/api.ts
@@ -0,0 +1,41 @@
+import { request } from '/@/utils/service';
+import { PageQuery, AddReq, DelReq, EditReq, InfoReq } from '@fast-crud/fast-crud';
+
+export const apiPrefix = '/api/system/login_log/';
+export function GetList(query: PageQuery) {
+ return request({
+ url: apiPrefix,
+ method: 'get',
+ data: query,
+ });
+}
+export function GetObj(id: InfoReq) {
+ return request({
+ url: apiPrefix + id,
+ method: 'get',
+ });
+}
+
+export function AddObj(obj: AddReq) {
+ return request({
+ url: apiPrefix,
+ method: 'post',
+ data: obj,
+ });
+}
+
+export function UpdateObj(obj: EditReq) {
+ return request({
+ url: apiPrefix + obj.id + '/',
+ method: 'put',
+ data: obj,
+ });
+}
+
+export function DelObj(id: DelReq) {
+ return request({
+ url: apiPrefix + id + '/',
+ method: 'delete',
+ data: { id },
+ });
+}
diff --git a/web/src/views/system/log/loginLog/crud.tsx b/web/src/views/system/log/loginLog/crud.tsx
new file mode 100644
index 0000000..adc46bc
--- /dev/null
+++ b/web/src/views/system/log/loginLog/crud.tsx
@@ -0,0 +1,290 @@
+import * as api from './api';
+import { dict, PageQuery, AddReq, DelReq, EditReq, CrudExpose, CrudOptions } from '@fast-crud/fast-crud';
+import { request } from '/@/utils/service';
+import { dictionary } from '/@/utils/dictionary';
+interface CreateCrudOptionsTypes {
+ crudOptions: CrudOptions;
+}
+
+export const createCrudOptions = function ({ crudExpose }: { crudExpose: CrudExpose }): CreateCrudOptionsTypes {
+ const pageRequest = async (query: PageQuery) => {
+ return await api.GetList(query);
+ };
+ const editRequest = async ({ form, row }: EditReq) => {
+ form.id = row.id;
+ return await api.UpdateObj(form);
+ };
+ const delRequest = async ({ row }: DelReq) => {
+ return await api.DelObj(row.id);
+ };
+ const addRequest = async ({ form }: AddReq) => {
+ return await api.AddObj(form);
+ };
+ return {
+ crudOptions: {
+ request: {
+ pageRequest,
+ addRequest,
+ editRequest,
+ delRequest,
+ },
+ actionbar: {
+ buttons: {
+ add: {
+ show: false,
+ },
+ },
+ },
+ rowHandle: {
+ buttons: {
+ edit: {
+ show: false,
+ },
+ remove: {
+ show: false,
+ },
+ },
+ },
+ columns: {
+ _index: {
+ title: '序号',
+ form: { show: false },
+ column: {
+ //type: 'index',
+ align: 'center',
+ width: '70px',
+ columnSetDisabled: true, //禁止在列设置中选择
+ formatter: (context) => {
+ //计算序号,你可以自定义计算规则,此处为翻页累加
+ let index = context.index ?? 1;
+ let pagination = crudExpose.crudBinding.value.pagination;
+ return ((pagination.currentPage ?? 1) - 1) * pagination.pageSize + index + 1;
+ },
+ },
+ },
+ search: {
+ title: '关键词',
+ column: {
+ show: false,
+ },
+ search: {
+ show: true,
+ component: {
+ props: {
+ clearable: true,
+ },
+ placeholder: '请输入关键词',
+ },
+ },
+ form: {
+ show: false,
+ component: {
+ props: {
+ clearable: true,
+ },
+ },
+ },
+ },
+ username: {
+ title: '登录用户名',
+ search: {
+ disabled: false,
+ },
+ width: 140,
+ type: 'input',
+ form: {
+ disabled: true,
+ component: {
+ placeholder: '请输入登录用户名',
+ },
+ },
+ },
+ ip: {
+ title: '登录ip',
+ search: {
+ disabled: false,
+ },
+ width: 130,
+ type: 'input',
+ form: {
+ disabled: true,
+ component: {
+ placeholder: '请输入登录ip',
+ },
+ },
+ },
+ isp: {
+ title: '运营商',
+ search: {
+ disabled: true,
+ },
+ disabled: true,
+ width: 180,
+ type: 'input',
+ form: {
+ component: {
+ placeholder: '请输入运营商',
+ },
+ },
+ },
+ continent: {
+ title: '大州',
+ width: 80,
+ type: 'input',
+ form: {
+ disabled: true,
+ component: {
+ placeholder: '请输入大州',
+ },
+ },
+ component: { props: { color: 'auto' } }, // 自动染色
+ },
+ country: {
+ title: '国家',
+ width: 80,
+ type: 'input',
+ form: {
+ component: {
+ placeholder: '请输入国家',
+ },
+ },
+ component: { props: { color: 'auto' } }, // 自动染色
+ },
+ province: {
+ title: '省份',
+ width: 80,
+ type: 'input',
+ form: {
+ component: {
+ placeholder: '请输入省份',
+ },
+ },
+ component: { props: { color: 'auto' } }, // 自动染色
+ },
+ city: {
+ title: '城市',
+ width: 80,
+ type: 'input',
+ form: {
+ component: {
+ placeholder: '请输入城市',
+ },
+ },
+ component: { props: { color: 'auto' } }, // 自动染色
+ },
+ district: {
+ title: '县区',
+ key: '',
+ width: 80,
+ type: 'input',
+ form: {
+ component: {
+ placeholder: '请输入县区',
+ },
+ },
+ component: { props: { color: 'auto' } }, // 自动染色
+ },
+ area_code: {
+ title: '区域代码',
+ type: 'input',
+ form: {
+ component: {
+ placeholder: '请输入区域代码',
+ },
+ },
+ component: { props: { color: 'auto' } }, // 自动染色
+ },
+ country_english: {
+ title: '英文全称',
+ width: 120,
+ type: 'input',
+ form: {
+ component: {
+ placeholder: '请输入英文全称',
+ },
+ },
+ component: { props: { color: 'auto' } }, // 自动染色
+ },
+ country_code: {
+ title: '简称',
+ type: 'input',
+ form: {
+ component: {
+ placeholder: '请输入简称',
+ },
+ },
+ component: { props: { color: 'auto' } }, // 自动染色
+ },
+ longitude: {
+ title: '经度',
+ type: 'input',
+ disabled: true,
+ form: {
+ component: {
+ placeholder: '请输入经度',
+ },
+ },
+ component: { props: { color: 'auto' } }, // 自动染色
+ },
+ latitude: {
+ title: '纬度',
+ type: 'input',
+ disabled: true,
+ form: {
+ component: {
+ placeholder: '请输入纬度',
+ },
+ },
+ component: { props: { color: 'auto' } }, // 自动染色
+ },
+ login_type: {
+ title: '登录类型',
+ type: 'select',
+ search: {
+ disabled: false,
+ },
+ dict: {
+ data: [
+ { label: '普通登录', value: 1 },
+ { label: '微信扫码登录', value: 2 },
+ ],
+ },
+ form: {
+ component: {
+ placeholder: '请选择登录类型',
+ },
+ },
+ component: { props: { color: 'auto' } }, // 自动染色
+ },
+ os: {
+ title: '操作系统',
+ type: 'input',
+ form: {
+ component: {
+ placeholder: '请输入操作系统',
+ },
+ },
+ },
+ browser: {
+ title: '浏览器名',
+ type: 'input',
+ form: {
+ component: {
+ placeholder: '请输入浏览器名',
+ },
+ },
+ },
+ agent: {
+ title: 'agent信息',
+ disabled: true,
+ type: 'input',
+ form: {
+ component: {
+ placeholder: '请输入agent信息',
+ },
+ },
+ },
+ },
+ },
+ };
+};
diff --git a/web/src/views/system/log/loginLog/index.vue b/web/src/views/system/log/loginLog/index.vue
new file mode 100644
index 0000000..1fa8634
--- /dev/null
+++ b/web/src/views/system/log/loginLog/index.vue
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
diff --git a/web/src/views/system/log/operationLog/api.ts b/web/src/views/system/log/operationLog/api.ts
new file mode 100644
index 0000000..652dd9c
--- /dev/null
+++ b/web/src/views/system/log/operationLog/api.ts
@@ -0,0 +1,41 @@
+import { request } from '/@/utils/service';
+import { PageQuery, AddReq, DelReq, EditReq, InfoReq } from '@fast-crud/fast-crud';
+
+export const apiPrefix = '/api/system/operation_log/';
+export function GetList(query: PageQuery) {
+ return request({
+ url: apiPrefix,
+ method: 'get',
+ data: query,
+ });
+}
+export function GetObj(id: InfoReq) {
+ return request({
+ url: apiPrefix + id,
+ method: 'get',
+ });
+}
+
+export function AddObj(obj: AddReq) {
+ return request({
+ url: apiPrefix,
+ method: 'post',
+ data: obj,
+ });
+}
+
+export function UpdateObj(obj: EditReq) {
+ return request({
+ url: apiPrefix + obj.id + '/',
+ method: 'put',
+ data: obj,
+ });
+}
+
+export function DelObj(id: DelReq) {
+ return request({
+ url: apiPrefix + id + '/',
+ method: 'delete',
+ data: { id },
+ });
+}
diff --git a/web/src/views/system/log/operationLog/crud.tsx b/web/src/views/system/log/operationLog/crud.tsx
new file mode 100644
index 0000000..53c1276
--- /dev/null
+++ b/web/src/views/system/log/operationLog/crud.tsx
@@ -0,0 +1,227 @@
+import * as api from './api';
+import { dict, PageQuery, AddReq, DelReq, EditReq, CrudExpose, CrudOptions } from '@fast-crud/fast-crud';
+import { request } from '/@/utils/service';
+import { dictionary } from '/@/utils/dictionary';
+interface CreateCrudOptionsTypes {
+ crudOptions: CrudOptions;
+}
+
+export const createCrudOptions = function ({ crudExpose }: { crudExpose: CrudExpose }): CreateCrudOptionsTypes {
+ const pageRequest = async (query: PageQuery) => {
+ return await api.GetList(query);
+ };
+ const editRequest = async ({ form, row }: EditReq) => {
+ form.id = row.id;
+ return await api.UpdateObj(form);
+ };
+ const delRequest = async ({ row }: DelReq) => {
+ return await api.DelObj(row.id);
+ };
+ const addRequest = async ({ form }: AddReq) => {
+ return await api.AddObj(form);
+ };
+ return {
+ crudOptions: {
+ request: {
+ pageRequest,
+ addRequest,
+ editRequest,
+ delRequest,
+ },
+ actionbar: {
+ buttons: {
+ add: {
+ show: false,
+ },
+ },
+ },
+ rowHandle: {
+ buttons: {
+ edit: {
+ show: false,
+ },
+ remove: {
+ show: false,
+ },
+ },
+ },
+ columns: {
+ _index: {
+ title: '序号',
+ form: { show: false },
+ column: {
+ //type: 'index',
+ align: 'center',
+ width: '70px',
+ columnSetDisabled: true, //禁止在列设置中选择
+ formatter: (context) => {
+ //计算序号,你可以自定义计算规则,此处为翻页累加
+ let index = context.index ?? 1;
+ let pagination = crudExpose.crudBinding.value.pagination;
+ return ((pagination.currentPage ?? 1) - 1) * pagination.pageSize + index + 1;
+ },
+ },
+ },
+ search: {
+ title: '关键词',
+ column: {
+ show: false,
+ },
+ search: {
+ show: true,
+ component: {
+ props: {
+ clearable: true,
+ },
+ placeholder: '请输入关键词',
+ },
+ },
+ form: {
+ show: false,
+ component: {
+ props: {
+ clearable: true,
+ },
+ },
+ },
+ },
+ request_modular: {
+ title: '请求模块',
+ search: {
+ disabled: false,
+ },
+ type: 'input',
+ form: {
+ disabled: true,
+ component: {
+ placeholder: '请输入请求模块',
+ },
+ },
+ },
+ request_path: {
+ title: '请求地址',
+ search: {
+ disabled: false,
+ },
+ type: 'input',
+ form: {
+ disabled: true,
+ component: {
+ placeholder: '请输入请求地址',
+ },
+ },
+ },
+ request_body: {
+ column: {
+ showOverflowTooltip: true,
+ width: 200, //列宽
+ minWidth: 100, //最小列宽
+ },
+ title: '请求参数',
+ search: {
+ disabled: true,
+ },
+ disabled: true,
+ type: 'textarea',
+ form: {
+ component: {
+ props: {
+ type: 'textarea',
+ },
+ autosize: {
+ minRows: 2,
+ maxRows: 8,
+ },
+ placeholder: '请输入关键词',
+ },
+ },
+ },
+ request_method: {
+ title: '请求方法',
+ type: 'input',
+ search: {
+ disabled: false,
+ },
+ form: {
+ disabled: true,
+ component: {
+ placeholder: '请输入请求方法',
+ },
+ },
+ component: { props: { color: 'auto' } }, // 自动染色
+ },
+ request_msg: {
+ title: '操作说明',
+ disabled: true,
+ form: {
+ component: {
+ span: 12,
+ },
+ },
+ },
+ request_ip: {
+ title: 'IP地址',
+ search: {
+ disabled: false,
+ },
+ type: 'input',
+ form: {
+ disabled: true,
+ component: {
+ placeholder: '请输入IP地址',
+ },
+ },
+ component: { props: { color: 'auto' } }, // 自动染色
+ },
+ request_browser: {
+ title: '请求浏览器',
+ type: 'input',
+ form: {
+ disabled: true,
+ },
+ component: { props: { color: 'auto' } }, // 自动染色
+ },
+ response_code: {
+ title: '响应码',
+ search: {
+ disabled: true,
+ },
+ type: 'input',
+ form: {
+ disabled: true,
+ },
+ component: { props: { color: 'auto' } }, // 自动染色
+ },
+ request_os: {
+ title: '操作系统',
+ disabled: true,
+ search: {
+ disabled: true,
+ },
+ type: 'input',
+ form: {
+ disabled: true,
+ },
+ component: { props: { color: 'auto' } }, // 自动染色
+ },
+ json_result: {
+ title: '返回信息',
+ search: {
+ disabled: true,
+ },
+ type: 'input',
+ form: {
+ disabled: true,
+ },
+ component: { props: { color: 'auto' } }, // 自动染色
+ },
+ creator_name: {
+ title: '操作人',
+ form: {
+ disabled: true,
+ },
+ },
+ },
+ },
+ };
+};
diff --git a/web/src/views/system/log/operationLog/index.vue b/web/src/views/system/log/operationLog/index.vue
new file mode 100644
index 0000000..1fa8634
--- /dev/null
+++ b/web/src/views/system/log/operationLog/index.vue
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+