From 2827fcc18224edc44f4fb639f46aca2df69d3b2e Mon Sep 17 00:00:00 2001 From: ihzero Date: Tue, 15 Nov 2022 17:59:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=96=E9=93=BE=E6=8E=A5=E7=BC=96=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/sys/user.ts | 44 +++++++ src/router/routes/modules/system.ts | 16 +++ src/views/base/crops/base-crops/base.data.ts | 10 +- src/views/base/crops/base-crops/index.vue | 2 +- src/views/base/crops/town-crops/index.vue | 2 +- src/views/base/crops/town-crops/town.data.ts | 10 +- .../monitor/components/LiveBroadcastItem.vue | 47 ++++++- src/views/system/links/index.vue | 46 +++++++ src/views/system/links/links.data.ts | 121 ++++++++++++++++++ src/views/system/log/index.vue | 46 +++++++ src/views/system/log/log.data.ts | 56 ++++++++ src/views/visualization/components/SZJCSJ.vue | 3 +- src/views/visualization/components/TRJCSJ.vue | 1 + .../visualization/components/VideoFlv.vue | 2 - 14 files changed, 397 insertions(+), 9 deletions(-) create mode 100644 src/views/system/links/index.vue create mode 100644 src/views/system/links/links.data.ts create mode 100644 src/views/system/log/index.vue create mode 100644 src/views/system/log/log.data.ts diff --git a/src/api/sys/user.ts b/src/api/sys/user.ts index 5ea3bf4a..e4f1b521 100644 --- a/src/api/sys/user.ts +++ b/src/api/sys/user.ts @@ -811,3 +811,47 @@ export function editDeviceWarningRules(params, mode: ErrorMessageMode = 'modal') }, ) } +/** + * @description:操作日志 + */ +export function getLogs(params, mode: ErrorMessageMode = 'modal') { + return defHttp.get( + { + url: `/api/operation-logs`, + params, + }, + { + errorMessageMode: mode, + isTransformResponse: false, + }, + ) +} +/** + * @description:友情链接列表 + */ +export function getFriendinks(params, mode: ErrorMessageMode = 'modal') { + return defHttp.get( + { + url: `/api/friend-links`, + params, + }, + { + errorMessageMode: mode, + isTransformResponse: false, + }, + ) +} +/** + * @description:修改友情链接 + */ +export function updateFriendinks(params, mode: ErrorMessageMode = 'modal') { + return defHttp.put( + { + url: `/api/friend-links/${params.id}`, + params, + }, + { + errorMessageMode: mode, + }, + ) +} diff --git a/src/router/routes/modules/system.ts b/src/router/routes/modules/system.ts index b594cb24..cf2014a5 100644 --- a/src/router/routes/modules/system.ts +++ b/src/router/routes/modules/system.ts @@ -27,6 +27,22 @@ const main: AppRouteModule = { title: '账号管理', }, }, + { + path: 'log', + name: 'SystemLog', + component: () => import('/@/views/system/log/index.vue'), + meta: { + title: '系统日志', + }, + }, + { + path: 'links', + name: 'SystemLinks', + component: () => import('/@/views/system/links/index.vue'), + meta: { + title: '友情链接', + }, + }, ], } diff --git a/src/views/base/crops/base-crops/base.data.ts b/src/views/base/crops/base-crops/base.data.ts index f6eed1e7..0f7f76d5 100644 --- a/src/views/base/crops/base-crops/base.data.ts +++ b/src/views/base/crops/base-crops/base.data.ts @@ -26,7 +26,15 @@ export const columns: BasicColumn[] = [ }, ] -export const searchFormSchema: FormSchema[] = [] +export const searchFormSchema: FormSchema[] = [ + { + field: 'name', + label: '名称', + component: 'Input', + componentProps: {}, + colProps: { span: 6 }, + }, +] export const accountFormSchema: FormSchema[] = [ { diff --git a/src/views/base/crops/base-crops/index.vue b/src/views/base/crops/base-crops/index.vue index 510b2962..0c5c4075 100644 --- a/src/views/base/crops/base-crops/index.vue +++ b/src/views/base/crops/base-crops/index.vue @@ -60,7 +60,7 @@ labelWidth: 120, schemas: searchFormSchema, }, - useSearchForm: false, + useSearchForm: true, showTableSetting: true, bordered: true, showIndexColumn: true, diff --git a/src/views/base/crops/town-crops/index.vue b/src/views/base/crops/town-crops/index.vue index d9fa465e..d575fa11 100644 --- a/src/views/base/crops/town-crops/index.vue +++ b/src/views/base/crops/town-crops/index.vue @@ -60,7 +60,7 @@ labelWidth: 120, schemas: searchFormSchema, }, - useSearchForm: false, + useSearchForm: true, showTableSetting: true, bordered: true, showIndexColumn: true, diff --git a/src/views/base/crops/town-crops/town.data.ts b/src/views/base/crops/town-crops/town.data.ts index f6eed1e7..0f7f76d5 100644 --- a/src/views/base/crops/town-crops/town.data.ts +++ b/src/views/base/crops/town-crops/town.data.ts @@ -26,7 +26,15 @@ export const columns: BasicColumn[] = [ }, ] -export const searchFormSchema: FormSchema[] = [] +export const searchFormSchema: FormSchema[] = [ + { + field: 'name', + label: '名称', + component: 'Input', + componentProps: {}, + colProps: { span: 6 }, + }, +] export const accountFormSchema: FormSchema[] = [ { diff --git a/src/views/main/monitor/components/LiveBroadcastItem.vue b/src/views/main/monitor/components/LiveBroadcastItem.vue index 8377bfbb..789aa5df 100644 --- a/src/views/main/monitor/components/LiveBroadcastItem.vue +++ b/src/views/main/monitor/components/LiveBroadcastItem.vue @@ -2,7 +2,9 @@
{{ item.base_name }}
@@ -10,8 +12,9 @@ + + diff --git a/src/views/system/links/links.data.ts b/src/views/system/links/links.data.ts new file mode 100644 index 00000000..4519c2ed --- /dev/null +++ b/src/views/system/links/links.data.ts @@ -0,0 +1,121 @@ +import { BasicColumn } from '/@/components/Table' +import { FormSchema } from '/@/components/Table' +import dayjs from 'dayjs' +import { h } from 'vue' +import { Tag } from 'ant-design-vue' +import { Switch } from 'ant-design-vue' +import { useMessage } from '/@/hooks/web/useMessage' +import { updateFriendinks } from '/@/api/sys/user' + +export const columns: BasicColumn[] = [ + { + title: '名称', + dataIndex: 'name', + width: 100, + }, + { + title: '类型', + dataIndex: 'type', + width: 60, + customRender: ({ record }) => { + const status = record.type + + const list = [ + { + value: 1, + color: 'red', + label: '链接', + }, + { + value: 2, + color: 'green', + label: '视频', + }, + { + value: 3, + color: 'pink', + label: '文章', + }, + ] + const item = list.find((e) => e.value === status) + const color = item?.color ?? 'red' + const text = item?.label ?? status + return h(Tag, { color: color }, () => text) + }, + }, + { + title: '推荐', + dataIndex: 'is_recommend', + width: 180, + customRender: ({ record }) => { + if (!Reflect.has(record, 'pendingRecommendStatus')) { + record.pendingRecommendStatus = false + } + return h(Switch, { + checked: record.is_recommend === 1, + checkedChildren: '是', + unCheckedChildren: '否', + loading: record.pendingRecommendStatus, + onChange(checked: boolean) { + record.pendingRecommendStatus = true + const newStatus = checked ? 1 : 0 + const { createMessage } = useMessage() + updateFriendinks({ + id: record.id, + is_recommend: !checked, + }) + .then(() => { + record.is_recommend = newStatus + createMessage.success(`已成功设置推荐`) + }) + .catch(() => { + createMessage.error('修改推荐失败') + }) + .finally(() => { + record.pendingRecommendStatusx = false + }) + }, + }) + }, + }, + { + title: '开启', + dataIndex: 'is_show', + width: 180, + }, + { + title: '创建时间', + dataIndex: 'created_at', + width: 180, + customRender: ({ text }) => { + if (!text) return '' + return dayjs.unix(text).format('YYYY-MM-DD HH:mm:ss') + }, + }, +] + +export const searchFormSchema: FormSchema[] = [ + { + field: 'type', + label: '动作', + component: 'Select', + componentProps: { + options: [ + { label: 'create', value: 'create' }, + { label: 'update', value: 'update' }, + { label: 'delete', value: 'delete' }, + ], + }, + colProps: { span: 6 }, + }, + { + field: '[start_time, end_time]', + label: '时间范围', + component: 'RangePicker', + componentProps: { + format: 'YYYY-MM-DD', + placeholder: ['开始时间', '结束时间'], + }, + colProps: { span: 6 }, + }, +] diff --git a/src/views/system/log/index.vue b/src/views/system/log/index.vue new file mode 100644 index 00000000..85fb73f1 --- /dev/null +++ b/src/views/system/log/index.vue @@ -0,0 +1,46 @@ + + + + + diff --git a/src/views/system/log/log.data.ts b/src/views/system/log/log.data.ts new file mode 100644 index 00000000..23866e52 --- /dev/null +++ b/src/views/system/log/log.data.ts @@ -0,0 +1,56 @@ +import { BasicColumn } from '/@/components/Table' +import { FormSchema } from '/@/components/Table' +import dayjs from 'dayjs' + +export const columns: BasicColumn[] = [ + { + title: '操作人', + dataIndex: 'user_name', + width: 100, + }, + { + title: '动作', + dataIndex: 'type', + width: 180, + }, + { + title: '详情', + dataIndex: 'message', + width: 180, + }, + { + title: '时间', + dataIndex: 'created_at', + width: 180, + customRender: ({ text }) => { + if (!text) return '' + return dayjs.unix(text).format('YYYY-MM-DD HH:mm:ss') + }, + }, +] + +export const searchFormSchema: FormSchema[] = [ + { + field: 'type', + label: '动作', + component: 'Select', + componentProps: { + options: [ + { label: 'create', value: 'create' }, + { label: 'update', value: 'update' }, + { label: 'delete', value: 'delete' }, + ], + }, + colProps: { span: 6 }, + }, + { + field: '[start_time, end_time]', + label: '时间范围', + component: 'RangePicker', + componentProps: { + format: 'YYYY-MM-DD', + placeholder: ['开始时间', '结束时间'], + }, + colProps: { span: 6 }, + }, +] diff --git a/src/views/visualization/components/SZJCSJ.vue b/src/views/visualization/components/SZJCSJ.vue index e068da2f..2f937fae 100644 --- a/src/views/visualization/components/SZJCSJ.vue +++ b/src/views/visualization/components/SZJCSJ.vue @@ -72,7 +72,7 @@ }, { key: 'ph', - unit: null, + unit: 'PH', name: 'PH值', }, { @@ -263,6 +263,7 @@ name: currentMenuObj.value?.unit ?? '', nameTextStyle: { color: '#fff', + align: 'left', }, axisTick: { show: false, diff --git a/src/views/visualization/components/TRJCSJ.vue b/src/views/visualization/components/TRJCSJ.vue index 9859f72f..1c220254 100644 --- a/src/views/visualization/components/TRJCSJ.vue +++ b/src/views/visualization/components/TRJCSJ.vue @@ -259,6 +259,7 @@ name: currentMenuObj.value?.unit ?? '', nameTextStyle: { color: '#fff', + align: 'left', }, axisTick: { show: false, diff --git a/src/views/visualization/components/VideoFlv.vue b/src/views/visualization/components/VideoFlv.vue index bdb98568..b53661f6 100644 --- a/src/views/visualization/components/VideoFlv.vue +++ b/src/views/visualization/components/VideoFlv.vue @@ -53,8 +53,6 @@ }, }, setup(props) { - console.log(props) - const videoRef = ref(null) let player: any | null = null const pUrl = ref(props.url)