wuheng 1 年之前
父节点
当前提交
d82b1f366a

+ 3 - 34
package.json

@@ -1,39 +1,8 @@
 {
-  "name": "soybean-admin",
+  "name": "eas-admin",
   "version": "0.9.9",
-  "description": "A fresh and elegant admin template, based on Vue3、Vite3、TypeScript、NaiveUI and UnoCSS. 一个基于Vue3、Vite3、TypeScript、NaiveUI and UnoCSS的清新优雅的中后台模版。",
-  "author": {
-    "name": "Soybean",
-    "email": "honghuangdc@gmail.com",
-    "url": "https://github.com/honghuangdc"
-  },
-  "license": "MIT",
-  "homepage": "https://github.com/honghuangdc/soybean-admin",
-  "repository": {
-    "url": "https://github.com/honghuangdc/soybean-admin.git"
-  },
-  "bugs": {
-    "url": "https://github.com/honghuangdc/soybean-admin/issues"
-  },
-  "keywords": [
-    "Vue",
-    "Vue3",
-    "admin",
-    "admin-template",
-    "vue-admin",
-    "vue-admin-template",
-    "Vite3",
-    "Vite",
-    "vite-admin",
-    "TypeScript",
-    "TS",
-    "NaiveUI",
-    "naive-ui",
-    "naive-admin",
-    "NaiveUI-Admin",
-    "naive-ui-admin",
-    "UnoCSS"
-  ],
+  "description": "",
+  "keywords": [],
   "scripts": {
     "dev": "cross-env VITE_SERVICE_ENV=dev vite",
     "dev:test": "cross-env VITE_SERVICE_ENV=test vite",

+ 1 - 0
src/assets/svg-icon/class.svg

@@ -0,0 +1 @@
+<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1692672982685" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="11328" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M297.6 387.9c-65.6 0-119-52-119-115.9s53.4-115.9 119-115.9 119 52 119 115.9-53.4 115.9-119 115.9z m0-191.8c-43.6 0-79 34-79 75.9 0 41.8 35.5 75.9 79 75.9s79-34 79-75.9c0-41.8-35.5-75.9-79-75.9z" fill="#1C1C1C" p-id="11329"></path><path d="M485.5 568.3h-40V489c0-53.7-43.7-97.4-97.4-97.4H246.9c-53.7 0-97.4 43.7-97.4 97.4v79.3h-40V489c0-75.7 61.6-137.4 137.4-137.4h101.3c75.7 0 137.4 61.6 137.4 137.4v79.3zM740.8 387.9c-65.6 0-119-52-119-115.9s53.4-115.9 119-115.9 119 52 119 115.9-53.4 115.9-119 115.9z m0-191.8c-43.6 0-79 34-79 75.9 0 41.8 35.5 75.9 79 75.9s79-34 79-75.9c0-41.8-35.5-75.9-79-75.9z" fill="#1C1C1C" p-id="11330"></path><path d="M928.8 568.3h-40V489c0-53.7-43.7-97.4-97.4-97.4H690.1c-53.7 0-97.4 43.7-97.4 97.4v79.3h-40V489c0-75.7 61.6-137.4 137.4-137.4h101.3c75.7 0 137.4 61.6 137.4 137.4v79.3z" fill="#1C1C1C" p-id="11331"></path><path d="M996.5 722.1H33.6c-11 0-20-9-20-20V584.5c0-11 9-20 20-20h962.9c11 0 20 9 20 20v117.7c0 11-9 19.9-20 19.9z m-942.9-40h922.9v-77.7H53.6v77.7z" fill="#1C1C1C" p-id="11332"></path><path d="M125.4 926.3c-11 0-20-9-20-20V720.1c0-11 9-20 20-20s20 9 20 20v186.2c0 11.1-8.9 20-20 20zM904.6 926.3c-11 0-20-9-20-20V702.1c0-11 9-20 20-20s20 9 20 20v204.2c0 11.1-9 20-20 20z" fill="#1C1C1C" p-id="11333"></path></svg>

文件差异内容过多而无法显示
+ 0 - 0
src/assets/svg-icon/classroom.svg


文件差异内容过多而无法显示
+ 0 - 0
src/assets/svg-icon/lesson.svg


+ 6 - 2
src/locales/lang/en.ts

@@ -77,8 +77,12 @@ const locale: LocaleMessages<I18nType.Schema> = {
         route: 'Route',
         user: 'User',
         sort: 'category',
-        student: 'Student',
-        group: 'class'
+        student: 'Student'
+      },
+      lesson: {
+        _value: 'Lesson Management',
+        group: 'class',
+        classroom: 'classroom'
       },
       about: 'About'
     }

+ 6 - 2
src/locales/lang/zh-cn.ts

@@ -77,8 +77,12 @@ const locale: LocaleMessages<I18nType.Schema> = {
         route: '路由管理',
         user: '用户管理',
         sort: '课程分类',
-        student: '学生管理',
-        group: '班级管理'
+        student: '学生管理'
+      },
+      lesson: {
+        _value: '课程管理',
+        group: '班级管理',
+        classroom: '教室管理'
       },
       about: '关于'
     }

+ 37 - 0
src/router/modules/lesson.ts

@@ -0,0 +1,37 @@
+const management: AuthRoute.Route = {
+  name: 'lesson',
+  path: '/lesson',
+  component: 'basic',
+  children: [
+    {
+      name: 'lesson_group',
+      path: '/lesson/group',
+      component: 'self',
+      meta: {
+        title: '班级管理',
+        i18nTitle: 'message.routes.lesson.group',
+        requiresAuth: true,
+        localIcon: 'class'
+      }
+    },
+    {
+      name: 'lesson_classroom',
+      path: '/lesson/classroom',
+      component: 'self',
+      meta: {
+        title: '教室管理',
+        i18nTitle: 'message.routes.lesson.classroom',
+        requiresAuth: true,
+        localIcon: 'classroom'
+      }
+    }
+  ],
+  meta: {
+    title: '课程管理',
+    i18nTitle: 'message.routes.lesson._value',
+    localIcon: 'lesson',
+    order: 9
+  }
+};
+
+export default management;

+ 0 - 11
src/router/modules/management.ts

@@ -47,17 +47,6 @@ const management: AuthRoute.Route = {
         localIcon: 'academic-cap'
       }
     },
-    {
-      name: 'management_group',
-      path: '/management/group',
-      component: 'self',
-      meta: {
-        title: '班级管理',
-        i18nTitle: 'message.routes.management.group',
-        requiresAuth: true,
-        localIcon: 'training-class'
-      }
-    },
     {
       name: 'management_sort',
       path: '/management/sort',

+ 6 - 2
src/typings/page-route.d.ts

@@ -52,13 +52,16 @@ declare namespace PageRoute {
     | 'function_tab-detail'
     | 'function_tab-multi-detail'
     | 'function_tab'
+    | 'lesson'
+    | 'lesson_classroom'
+    | 'lesson_group'
     | 'management'
     | 'management_auth'
+    | 'management_group'
     | 'management_role'
     | 'management_route'
     | 'management_sort'
     | 'management_student'
-    | 'management_group'
     | 'management_user'
     | 'multi-menu'
     | 'multi-menu_first'
@@ -113,12 +116,13 @@ declare namespace PageRoute {
     | 'function_tab-detail'
     | 'function_tab-multi-detail'
     | 'function_tab'
+    | 'lesson_group'
+    | 'lesson_classroom'
     | 'management_auth'
     | 'management_role'
     | 'management_route'
     | 'management_sort'
     | 'management_student'
-    | 'management_group'
     | 'management_user'
     | 'multi-menu_first_second-new_third'
     | 'multi-menu_first_second'

+ 4 - 0
src/typings/system.d.ts

@@ -384,7 +384,11 @@ declare namespace I18nType {
         user: string;
         sort: string;
         student: string;
+      };
+      lesson: {
+        _value: string;
         group: string;
+        classroom: string;
       };
       about: string;
     };

+ 2 - 1
src/views/index.ts

@@ -33,11 +33,12 @@ export const views: Record<
   'function_tab-multi-detail': () => import('./function/tab-multi-detail/index.vue'),
   function_tab: () => import('./function/tab/index.vue'),
   management_auth: () => import('./management/auth/index.vue'),
+  lesson_group: () => import('./lesson/group/index.vue'),
+  lesson_classroom: () => import('./lesson/classroom/index.vue'),
   management_role: () => import('./management/role/index.vue'),
   management_route: () => import('./management/route/index.vue'),
   management_sort: () => import('./management/sort/index.vue'),
   management_student: () => import('./management/student/index.vue'),
-  management_group: () => import('./management/group/index.vue'),
   management_user: () => import('./management/user/index.vue'),
   'multi-menu_first_second-new_third': () => import('./multi-menu/first/second-new/third/index.vue'),
   'multi-menu_first_second': () => import('./multi-menu/first/second/index.vue'),

+ 71 - 0
src/views/lesson/classroom/api.ts

@@ -0,0 +1,71 @@
+import { request } from '@/service/request';
+
+export interface QueryParams {
+  id?: number;
+  name?: string;
+  managerId?: number;
+  address?: string;
+  manager?: string;
+  floor?: number;
+  capacity?: number;
+  comment?: string;
+  disabled?: string;
+  createTime?: Record<string, unknown>;
+  modifyTime?: Record<string, unknown>;
+  createUid?: number;
+}
+
+export interface QueryRes {
+  status: boolean;
+  msg: string;
+  data: Record<string, unknown>;
+  total: number;
+}
+
+export interface UserList {
+  [index: string]: string;
+}
+
+export interface UserParams {
+  id: number;
+  username?: string;
+  passwd?: string;
+  email?: string;
+  relname: string;
+  phone?: string;
+  address?: string;
+  createTime?: Record<string, unknown>;
+  modifyTime?: Record<string, unknown>;
+  createUid?: number;
+  disabled?: string;
+}
+
+export function editRequest(params: QueryParams): Promise<Service.RequestResult<QueryParams>> {
+  return request.put(`/classroom/update`, params);
+}
+
+export function pageRequest(
+  pageNum: number,
+  pageSize: number,
+  params: QueryParams
+): Promise<Service.RequestResult<QueryParams>> {
+  return request.post(`/classroom/query?pageNum=${pageNum}&pageSize=${pageSize}`, params);
+}
+
+export function delRequest(id: number): Promise<Service.RequestResult<QueryRes>> {
+  return request.delete(`/classroom/delete/${id}`);
+}
+
+export function addRequest(params: QueryParams): Promise<Service.RequestResult<QueryRes>> {
+  return request.post(`/classroom/add`, params);
+}
+
+export async function queryAll(): Promise<UserList> {
+  const ret: UserList = {};
+  const respone: Service.RequestResult = await request.get(`/userinfo/queryAll`);
+  respone.data?.map((result: UserParams) => {
+    ret[result.id] = result.relname;
+    return result;
+  });
+  return ret;
+}

+ 233 - 0
src/views/lesson/classroom/crud.ts

@@ -0,0 +1,233 @@
+import type { CreateCrudOptionsRet } from '@fast-crud/fast-crud';
+import { dict } from '@fast-crud/fast-crud';
+import _ from 'lodash';
+import { isString } from '~/src/utils';
+import type { UserList } from './api';
+import { addRequest, delRequest, editRequest, pageRequest, queryAll } from './api';
+const userList: UserList = await queryAll();
+const dictOpt = {
+  url: '/userinfo/queryAll',
+  label: 'relname',
+  value: 'id'
+};
+function curd(): CreateCrudOptionsRet {
+  return {
+    crudOptions: {
+      request: {
+        pageRequest: async ({ page, query }) => {
+          const { total, data } = await pageRequest(page.offset + 1, page.limit, query);
+          return { records: data, total, currentPage: page.offset, pageSize: page.limit };
+        },
+        addRequest: ({ form }) => {
+          return addRequest(form);
+        },
+        editRequest: ({ form }) => {
+          editRequest(form);
+        },
+        delRequest: ({ row }) => {
+          return delRequest(row.id);
+        }
+      },
+      toolbar: {
+        show: true
+      },
+      actionbar: {
+        show: true,
+        buttons: {
+          add: {
+            text: '新增班级',
+            title: '使用表单新增班级',
+            circle: false,
+            tooltip: {
+              slots: {
+                default() {
+                  return '使用表单新增班级';
+                }
+              }
+            }
+          }
+        }
+      },
+      form: {
+        beforeSubmit: context => {
+          if (isString(context.form.createUid)) {
+            context.form.createUid = null;
+          }
+          if (isString(context.form.manageId)) {
+            context.form.manageId = null;
+          }
+          return true;
+        }
+      },
+      columns: {
+        id: {
+          title: '教室ID',
+          type: 'text',
+          search: { show: true },
+          form: {
+            show: false
+          },
+          column: {
+            resizable: true,
+            width: 60,
+            align: 'center',
+            fixed: 'left'
+          }
+        },
+        name: {
+          title: '教室名称',
+          type: 'text',
+          search: {
+            title: '名称',
+            show: true
+          },
+          column: {
+            resizable: true,
+            width: 60,
+            align: 'center',
+            fixed: 'left'
+          }
+        },
+        address: {
+          title: '教室地址',
+          type: 'text',
+          search: {
+            title: '地址',
+            show: true
+          },
+          column: {
+            resizable: true,
+            width: 110,
+            align: 'center',
+            fixed: 'left'
+          }
+        },
+        floor: {
+          title: '楼层',
+          type: 'text',
+          search: {
+            title: '楼层',
+            show: true
+          },
+          column: {
+            resizable: true,
+            width: 30,
+            align: 'center',
+            fixed: 'left'
+          }
+        },
+        capacity: {
+          title: '容量',
+          type: 'number',
+          search: {
+            title: '容量',
+            show: false
+          },
+          column: {
+            resizable: true,
+            width: 30,
+            align: 'center',
+            fixed: 'left'
+          }
+        },
+        comment: {
+          title: '备注信息',
+          type: 'text',
+          search: {
+            title: '容量',
+            show: false
+          },
+          column: {
+            resizable: true,
+            width: 130,
+            align: 'center',
+            fixed: 'left'
+          }
+        },
+        createUid: {
+          title: '创建用户',
+          type: 'text',
+          valueBuilder(context) {
+            if (userList[context.row.createUid]) {
+              context.row.createUid = userList[context.row.createUid];
+            }
+          },
+          form: {
+            component: {
+              name: 'fs-dict-select',
+              dict: dict(dictOpt)
+            }
+          },
+          search: { show: false },
+          column: {
+            resizable: true,
+            width: 90,
+            align: 'center',
+            fixed: 'left'
+          }
+        },
+        managerId: {
+          title: '负责人',
+          type: 'text',
+          valueBuilder(context) {
+            if (userList[context.row.managerId]) {
+              context.row.managerId = userList[context.row.managerId];
+            }
+          },
+          form: {
+            component: {
+              name: 'fs-dict-select',
+              dict: dict(dictOpt)
+            }
+          },
+          search: { show: false },
+          column: {
+            resizable: true,
+            width: 90,
+            align: 'center',
+            fixed: 'left'
+          }
+        },
+        modifyTime: {
+          title: '更新时间',
+          type: 'easDateTime',
+          search: { show: false },
+          form: { show: false },
+          column: {
+            resizable: true,
+            width: 110,
+            align: 'center',
+            fixed: 'left'
+          }
+        },
+        createTime: {
+          title: '创建时间',
+          type: 'easDateTime',
+          search: { show: true },
+          form: { show: false },
+          column: {
+            resizable: true,
+            width: 110,
+            align: 'center',
+            fixed: 'left'
+          }
+        },
+        disabled: {
+          title: '状态',
+          type: 'dict-select',
+          dict: dict({
+            data: [
+              { value: 'N', label: '启用中' },
+              { value: 'Y', label: '已禁用' }
+            ]
+          }),
+          column: {
+            resizable: true,
+            width: 80
+          }
+        }
+      }
+    }
+  };
+}
+export default curd;

+ 0 - 0
src/views/management/group/index.vue → src/views/lesson/classroom/index.vue


+ 0 - 0
src/views/management/group/api.ts → src/views/lesson/group/api.ts


+ 16 - 0
src/views/management/group/crud.ts → src/views/lesson/group/crud.ts

@@ -170,6 +170,22 @@ function curd(): CreateCrudOptionsRet {
             width: 80
           }
         }
+      },
+      rowHandle: {
+        buttons: {
+          studentManager: {
+            text: null,
+            size: 'small',
+            icon: 'ExpandOutlined',
+            tooltip: {
+              slots: {
+                default() {
+                  return '管理学员';
+                }
+              }
+            }
+          }
+        }
       }
     }
   };

+ 19 - 0
src/views/lesson/group/index.vue

@@ -0,0 +1,19 @@
+<template>
+  <div class="h-full">
+    <fs-crud ref="crudRef" v-bind="crudBinding" />
+  </div>
+</template>
+
+<script setup lang="ts">
+import { onMounted } from 'vue';
+import { useFs } from '@fast-crud/fast-crud';
+import createCrudOptions from './crud';
+
+const { crudRef, crudBinding, crudExpose } = useFs({ createCrudOptions });
+
+onMounted(() => {
+  crudExpose.doRefresh();
+});
+</script>
+
+<style scoped></style>

部分文件因为文件数量过多而无法显示