From 4912593167419a201286b1fda64dc5f0339dbe9e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=99=88=E7=BA=A2=E4=B8=BD?= <1181930680@qq.com>
Date: Fri, 2 Aug 2024 09:34:49 +0800
Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=BA=90=E7=AE=A1=E7=90=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/content/ad/querySchemas.ts | 56 ++++++
src/views/monitor/dataSource/columns.ts | 51 +++++
src/views/monitor/dataSource/edit.vue | 194 +++++++++++++++++++
src/views/monitor/dataSource/index.vue | 148 ++++++++++++++
src/views/monitor/dataSource/querySchemas.ts | 30 +++
src/views/system/level/index.vue | 1 -
6 files changed, 479 insertions(+), 1 deletion(-)
create mode 100644 src/views/content/ad/querySchemas.ts
create mode 100644 src/views/monitor/dataSource/columns.ts
create mode 100644 src/views/monitor/dataSource/edit.vue
create mode 100644 src/views/monitor/dataSource/index.vue
create mode 100644 src/views/monitor/dataSource/querySchemas.ts
diff --git a/src/views/content/ad/querySchemas.ts b/src/views/content/ad/querySchemas.ts
new file mode 100644
index 0000000..4c41f8c
--- /dev/null
+++ b/src/views/content/ad/querySchemas.ts
@@ -0,0 +1,56 @@
+import { FormSchema } from '@/components/Form/index';
+import { getAdSortAllList } from '@/api/content/adSort';
+export const loadSelectData = async(res)=> {
+ //这里可以进行数据转换处理
+ return (await getAdSortAllList({ ...res })).map((item, index) => {
+ return {
+ ...item,
+ label:item.name,
+ value:item.id,
+ index,
+ };
+ });
+}
+export const schemas: FormSchema[] = [
+ {
+ field: 'title',
+ component: 'Input',
+ label: '广告标题',
+ componentProps: {
+ placeholder: '请输广告标题',
+ },
+ },
+ {
+ field: 'status',
+ component: 'Select',
+ label: '广告状态',
+ componentProps: {
+ placeholder: '请选择广告状态',
+ clearable: true,
+ options: [
+ {
+ label: '在用',
+ value: '1',
+ },
+ {
+ label: '停用',
+ value: '2',
+ }
+ ],
+ },
+ },
+ {
+ field: 'adSortId',
+ component: 'BasicSelect',
+ label: '广告位',
+ componentProps: {
+ placeholder: '请选择广告位',
+ clearable: true,
+ block:true,
+ request: loadSelectData,
+ onChange: (e: any) => {
+ console.log(e);
+ },
+ },
+ },
+];
diff --git a/src/views/monitor/dataSource/columns.ts b/src/views/monitor/dataSource/columns.ts
new file mode 100644
index 0000000..b31dc50
--- /dev/null
+++ b/src/views/monitor/dataSource/columns.ts
@@ -0,0 +1,51 @@
+import { h } from 'vue';
+import { ElTag } from 'element-plus';
+
+export const columns = [
+ {
+ type: 'selection',
+ },
+ {
+ label: '数据源名称',
+ prop: 'name',
+ },
+ {
+ label: '数据库类型',
+ prop: 'dbType',
+ render(record) {
+ let typeText = ''
+ switch (record.row.dbType) {
+ case 1:
+ typeText='MySQL'
+ break;
+ case 2:
+ typeText='PostgreSQL'
+ break;
+ case 3:
+ typeText='SQLServer'
+ break;
+ case 4:
+ typeText='Oracle'
+ break;
+ case 5:
+ typeText='Sqlite'
+ break;
+ default:
+ break;
+ }
+ return h('span', typeText || '-');
+ },
+ },
+ {
+ label: '数据源编码',
+ prop: 'code',
+ },
+ {
+ label: '数据库名称',
+ prop: 'dbName',
+ },
+ {
+ label: '数据源地址',
+ prop: 'dbUrl',
+ },
+];
diff --git a/src/views/monitor/dataSource/edit.vue b/src/views/monitor/dataSource/edit.vue
new file mode 100644
index 0000000..d84772d
--- /dev/null
+++ b/src/views/monitor/dataSource/edit.vue
@@ -0,0 +1,194 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/monitor/dataSource/index.vue b/src/views/monitor/dataSource/index.vue
new file mode 100644
index 0000000..05a4417
--- /dev/null
+++ b/src/views/monitor/dataSource/index.vue
@@ -0,0 +1,148 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 添加数据源
+
+
+
+
+
+
+
+ 删除
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/monitor/dataSource/querySchemas.ts b/src/views/monitor/dataSource/querySchemas.ts
new file mode 100644
index 0000000..5544614
--- /dev/null
+++ b/src/views/monitor/dataSource/querySchemas.ts
@@ -0,0 +1,30 @@
+import { FormSchema } from '@/components/Form/index';
+export const schemas: FormSchema[] = [
+ {
+ field: 'name',
+ component: 'Input',
+ label: '数据源名称',
+ componentProps: {
+ placeholder: '请输入数据源名称',
+ },
+ },
+ {
+ field: 'dbType',
+ component: 'Select',
+ label: '数据库类型',
+ componentProps: {
+ placeholder: '请选择数据库类型',
+ clearable: true,
+ options: [
+ {
+ label: '关系型数据库',
+ value: '0',
+ },
+ {
+ label: '图形数据库',
+ value: '1',
+ },
+ ],
+ },
+ },
+];
diff --git a/src/views/system/level/index.vue b/src/views/system/level/index.vue
index 44528ef..301eff5 100644
--- a/src/views/system/level/index.vue
+++ b/src/views/system/level/index.vue
@@ -84,7 +84,6 @@
import { PlusOutlined } from '@vicons/antd';
import {message,confirm,loading, closeLoading} from "@/utils/auth";
import { useUserStore } from '@/store/modules/user';
- import {downloadByData} from '@/utils/file/download';
const editDialog = defineAsyncComponent(() =>
import('./edit.vue')
)