From 8510bc124c563702bcc8b6016ecec45160093b7e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=B0=8F=E8=82=A5=E7=BE=8A?= <1048382248@qq.com>
Date: Wed, 13 Aug 2025 15:23:06 +0800
Subject: [PATCH 01/10] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20=E8=A7=92=E8=89=B2?=
=?UTF-8?q?=E9=A1=B5=E9=9D=A2=20=E4=BF=AE=E5=A4=8D=20hTable=20Edit=20?=
=?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=97=B6=E5=80=99id=E4=B8=8D=E4=B8=BA0?=
=?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/hTable/hTable.ts | 2 +-
src/components/hTable/hTableEdit.vue | 10 +--
src/components/hTable/index.vue | 4 +-
src/views/admin/role.vue | 109 +++++++++++++++++++++++++++
4 files changed, 117 insertions(+), 8 deletions(-)
create mode 100644 src/views/admin/role.vue
diff --git a/src/components/hTable/hTable.ts b/src/components/hTable/hTable.ts
index 45fb491..95bf2a1 100644
--- a/src/components/hTable/hTable.ts
+++ b/src/components/hTable/hTable.ts
@@ -107,7 +107,7 @@ export interface TableColumn {
/* 列宽度 */
width?: string;
/* 字段类型 */
- type?: string;
+ type?: "string" | "dropdown" | "switch" | "img" | "datetime" | "textarea";
/** 是否多选 */
multiple?: boolean;
/** 编辑时显示列 */
diff --git a/src/components/hTable/hTableEdit.vue b/src/components/hTable/hTableEdit.vue
index 8da9a3a..b0cc80a 100644
--- a/src/components/hTable/hTableEdit.vue
+++ b/src/components/hTable/hTableEdit.vue
@@ -75,10 +75,10 @@ function handleSubmitForm() {
}
editData.value.loading = true;
- let form = {};
+ let form: any = {};
if (editData.value.isedit) {
form = props.row;
- }
+ } else form.id = 0;
for (const key in column.value) {
const element = column.value[key];
if (element.valueE !== null && element.valueE !== "") {
@@ -154,9 +154,9 @@ function fetchFormData() {
diff --git a/src/views/admin/role.vue b/src/views/admin/role.vue
new file mode 100644
index 0000000..fc16386
--- /dev/null
+++ b/src/views/admin/role.vue
@@ -0,0 +1,109 @@
+
+
+
+
+
From 3f354eae5833b2aa676996e86db4f90da67ac10c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=B0=8F=E8=82=A5=E7=BE=8A?= <1048382248@qq.com>
Date: Wed, 13 Aug 2025 17:20:06 +0800
Subject: [PATCH 02/10] =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E9=83=A8=E5=88=86ht?=
=?UTF-8?q?able=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api/menu.ts | 7 ++
src/components/hTable/hTable.ts | 5 +-
src/components/hTable/hTableEdit.vue | 4 +-
src/components/hTable/index.vue | 11 ++-
src/utils/auth.ts | 5 +-
src/utils/roles.ts | 20 +++++
src/views/admin/index.vue | 15 +++-
src/views/admin/role.vue | 13 ++-
src/views/class/index.vue | 109 ++++++++++++++++++++++++++
src/views/menu/index.vue | 78 +++++++++++++-----
src/views/permission/button/index.vue | 99 -----------------------
src/views/permission/button/perms.vue | 109 --------------------------
src/views/permission/page/index.vue | 66 ----------------
13 files changed, 236 insertions(+), 305 deletions(-)
create mode 100644 src/utils/roles.ts
create mode 100644 src/views/class/index.vue
delete mode 100644 src/views/permission/button/index.vue
delete mode 100644 src/views/permission/button/perms.vue
delete mode 100644 src/views/permission/page/index.vue
diff --git a/src/api/menu.ts b/src/api/menu.ts
index e6db80f..17ba631 100644
--- a/src/api/menu.ts
+++ b/src/api/menu.ts
@@ -30,3 +30,10 @@ export function MenuAll() {
export function Edit(info: MenuItem) {
return http.request
>("post", `Menu/Edit`, { data: info });
}
+/**
+ * @description 获取所有的菜单
+ * @return {object}
+ */
+export function Del(ids: number[]) {
+ return http.request>("post", `Menu/Del`, { data: ids });
+}
diff --git a/src/components/hTable/hTable.ts b/src/components/hTable/hTable.ts
index 95bf2a1..26dcada 100644
--- a/src/components/hTable/hTable.ts
+++ b/src/components/hTable/hTable.ts
@@ -50,6 +50,8 @@ export interface ButtonCustomConfig {
export interface OperationButton {
/* 是否为头部按钮 */
topBtn: boolean;
+ /** 按钮权限码 */
+ perms?: string;
/* 是否显示 */
show?: boolean;
/* 按钮文本 */
@@ -57,7 +59,7 @@ export interface OperationButton {
/* 按钮类型 */
btnType: "add" | "edit" | "del" | "custom";
/* 按钮样式 */
- btnStyle?: "success" | "danger";
+ btnStyle?: "success" | "info" | "primary" | "danger" | "warning";
/* 自定义按钮配置 */
custom?: ButtonCustomConfig;
}
@@ -112,6 +114,7 @@ export interface TableColumn {
multiple?: boolean;
/** 编辑时显示列 */
editShow?: boolean;
+ /**校验规则 */
rules?: any | Array;
/** 显示列 */
show?: boolean;
diff --git a/src/components/hTable/hTableEdit.vue b/src/components/hTable/hTableEdit.vue
index b0cc80a..3a9bb75 100644
--- a/src/components/hTable/hTableEdit.vue
+++ b/src/components/hTable/hTableEdit.vue
@@ -116,8 +116,8 @@ function handleResetForm() {
function fetchInitData() {}
function fetchFormData() {
editData.value.loading = false;
- handleResetForm();
if (editData.value.isedit) {
+ handleResetForm();
Api.Info({ id: props.id }).then(res => {
if (res.code === 200) {
editData.value.frorm = res.data;
@@ -192,7 +192,7 @@ function fetchFormData() {
) {
permissions
});
}
-
- if (data.userName && data.roles) {
+ if (data.userName && data.permissions) {
const { userName, roles } = data;
setUserKey({
avatar: data?.avatar ?? "",
@@ -129,7 +128,7 @@ export const formatToken = (token: string): string => {
/** 是否有按钮级别的权限(根据登录接口返回的`permissions`字段进行判断)*/
export const hasPerms = (value: string | Array): boolean => {
- if (!value) return false;
+ if (!value) return true;
const allPerms = "*:*:*";
const { permissions } = useUserStoreHook();
if (!permissions) return false;
diff --git a/src/utils/roles.ts b/src/utils/roles.ts
new file mode 100644
index 0000000..6f7566d
--- /dev/null
+++ b/src/utils/roles.ts
@@ -0,0 +1,20 @@
+export const ruleRequired = [
+ { required: true, message: "不能为空", trigger: "blur" }
+];
+export const rulePassword = [
+ { required: true, message: "不能为空", trigger: "blur" },
+ { min: 6, message: "长度必须大于5", trigger: "blur" }
+];
+export const ruleAccount = [
+ { required: true, message: "不能为空", trigger: "blur" },
+ { min: 13, message: "长度必须大于12", trigger: "blur" }
+];
+
+export const rulePhone = [
+ { required: true, message: "手机号不能为空", trigger: "blur" },
+ {
+ pattern: /^1[3-9]\d{9}$/,
+ message: "请输入正确的手机号",
+ trigger: "blur"
+ }
+];
diff --git a/src/views/admin/index.vue b/src/views/admin/index.vue
index db4fa4f..0f1c91e 100644
--- a/src/views/admin/index.vue
+++ b/src/views/admin/index.vue
@@ -4,6 +4,12 @@ import { TableConfig } from "@/components/hTable/hTable";
import { onMounted, ref } from "vue";
import { fa } from "element-plus/es/locales.mjs";
import { hTableAPI } from "@/api/hTable";
+import {
+ ruleAccount,
+ rulePassword,
+ rulePhone,
+ ruleRequired
+} from "@/utils/roles";
const ControllerName = "Admin";
defineOptions({
@@ -71,6 +77,7 @@ const tableData: TableConfig = {
name: {
label: "名称",
width: "180px",
+ rules: ruleRequired,
search: true,
searchType: "Like",
add: true, // 字段允许添加
@@ -78,6 +85,7 @@ const tableData: TableConfig = {
},
Phone: {
label: "手机号",
+ rules: rulePhone,
width: "200px",
search: true,
add: true, // 字段允许添加
@@ -85,6 +93,7 @@ const tableData: TableConfig = {
},
account: {
label: "账号",
+ rules: ruleAccount,
search: true,
add: true, // 字段允许添加
edit: false // 字段允许修改
@@ -92,6 +101,8 @@ const tableData: TableConfig = {
password: {
label: "密码",
show: false,
+ /**长度必须大于6 */
+ rules: rulePassword,
search: false,
add: true, // 字段允许添加
edit: false // 字段允许修改
@@ -100,13 +111,15 @@ const tableData: TableConfig = {
label: "启用",
type: "switch",
search: false,
- add: false, // 字段允许添加
+
+ add: true, // 字段允许添加
edit: true, // 字段允许修改
valueE: true // 编辑时的默认值
},
roleId: {
label: "角色",
type: "dropdown",
+ rules: ruleRequired,
search: true,
add: true, // 字段允许添加
edit: false, // 字段允许修改
diff --git a/src/views/admin/role.vue b/src/views/admin/role.vue
index fc16386..11e281e 100644
--- a/src/views/admin/role.vue
+++ b/src/views/admin/role.vue
@@ -11,7 +11,6 @@ defineOptions({
});
function searchCallback(data) {}
-const RoleApi = new hTableAPI("AdminRole");
const table = ref<{ initTable: (config: TableConfig) => void }>(null);
const tableData: TableConfig = {
apiUrl: ControllerName,
@@ -29,6 +28,14 @@ const tableData: TableConfig = {
},
operationColumn: true, // 显示操作按钮
operationColumnData: [
+ {
+ topBtn: false, // 头部按钮
+ show: true,
+ label: "角色授权",
+ perms: "角色授权", //按钮显示需要的权限码
+ btnType: "custom", // 按钮类型 add edit del 不设置则 自定义按钮
+ btnStyle: "success" // topBtn: true才生效 success danger
+ },
{
// 操作按钮
topBtn: false, // 是头部按钮
@@ -71,7 +78,7 @@ const tableData: TableConfig = {
label: "启用",
type: "switch",
search: false,
- add: false, // 字段允许添加
+ add: true, // 字段允许添加
edit: true, // 字段允许修改
valueE: true // 编辑时的默认值
},
@@ -84,6 +91,8 @@ const tableData: TableConfig = {
},
remark: {
label: "备注",
+ type: "textarea",
+ editRows: 3,
search: false,
add: true, // 字段允许添加
edit: true // 字段允许修改
diff --git a/src/views/class/index.vue b/src/views/class/index.vue
new file mode 100644
index 0000000..2aab196
--- /dev/null
+++ b/src/views/class/index.vue
@@ -0,0 +1,109 @@
+
+
+
+
+
diff --git a/src/views/menu/index.vue b/src/views/menu/index.vue
index 91a83c7..6f09a21 100644
--- a/src/views/menu/index.vue
+++ b/src/views/menu/index.vue
@@ -17,26 +17,47 @@
class="menu-tree"
>
-
@@ -195,11 +196,16 @@ function fetchFormData() {
v-model="o.valueE as boolean"
active-text="启用"
inactive-text="禁用"
+ class="elWidth"
@change="o.change"
/>
-
+
@@ -215,3 +221,9 @@ function fetchFormData() {
+
diff --git a/src/components/hTable/index.vue b/src/components/hTable/index.vue
index 7057044..57b9236 100644
--- a/src/components/hTable/index.vue
+++ b/src/components/hTable/index.vue
@@ -281,7 +281,7 @@ function handleReloadPaged(reload = true) {
data.ConditionalType = "Like";
}
data.FieldName = name.charAt(0).toUpperCase() + name.slice(1);
- data.FieldValue = table.value.column[name].value;
+ data.FieldValue = table.value.column[name].value.toString();
if (table.value.column[name].searchType != undefined) {
data.ConditionalType = table.value.column[name].searchType || 0;
@@ -303,11 +303,10 @@ async function fetchInitData() {
const element = table.value.column[key];
if (element.type === "dropdown") {
if (!element.setting.datasource) {
- // 存在值就不处理
-
- let rdata = await eval(element.setting.datasourceStr);
- element.setting.datasource = rdata.data;
- console.log(key + " " + element.setting.datasourceStr, rdata);
+ // 不安全取消 存在值就不处理
+ // let rdata = await eval(element.setting.datasourceStr);
+ // element.setting.datasource = rdata.data;
+ // console.log(key + " " + element.setting.datasourceStr, rdata);
}
}
if (
diff --git a/src/views/class/index.vue b/src/views/class/index.vue
index 2aab196..78a25b4 100644
--- a/src/views/class/index.vue
+++ b/src/views/class/index.vue
@@ -4,12 +4,14 @@ import { TableConfig } from "@/components/hTable/hTable";
import { onMounted, ref } from "vue";
import { fa } from "element-plus/es/locales.mjs";
import { hTableAPI } from "@/api/hTable";
+import { getenum } from "@/api/enum";
const ControllerName = "Class";
defineOptions({
name: ControllerName
});
+const SchoolApi = new hTableAPI("School");
function searchCallback(data) {}
const table = ref<{ initTable: (config: TableConfig) => void }>();
@@ -59,24 +61,46 @@ const tableData: TableConfig = {
edit: false, // 字段允许修改
width: "150px"
},
+ schoolId: {
+ label: "学校",
+ width: "180px",
+ search: true,
+ type: "dropdown",
+ add: true, // 字段允许添加
+ edit: true, // 字段允许修改
+ setting: {}
+ },
name: {
- label: "角色名称",
+ label: "名称",
width: "180px",
search: true,
searchType: "Like",
add: true, // 字段允许添加
edit: true // 字段允许修改
},
- enable: {
- label: "启用",
- type: "switch",
- search: false,
- add: false, // 字段允许添加
+ Grade: {
+ label: "年级",
+ width: "180px",
+ type: "dropdown",
+ custom: row => `${row.grade ?? ""}`,
+ // `${row.grade ?? ""} ${row.gradeLevel + row.graduationYear}`,
+ search: true,
+ setting: {},
+ add: true, // 字段允许添加
+ edit: false // 字段允许修改
+ },
+ type: {
+ label: "类型",
+ width: "150px",
+ type: "dropdown",
+ search: true,
+ add: true, // 字段允许添加
edit: true, // 字段允许修改
- valueE: true // 编辑时的默认值
+ setting: {}
},
createTime: {
label: "创建时间",
+ width: "180px",
type: "datetime",
search: true,
add: false, // 字段允许添加
@@ -84,6 +108,8 @@ const tableData: TableConfig = {
},
remark: {
label: "备注",
+ type: "textarea",
+ editRows: 3,
search: false,
add: true, // 字段允许添加
edit: true // 字段允许修改
@@ -100,6 +126,15 @@ const showTable = ref(false);
onMounted(async () => {
//初始化数据原
+ tableData.column.Grade.setting.datasource = (await getenum("GradeEnum")).data;
+
+ tableData.column.type.setting.datasource = (
+ await getenum("ClassTypeEnum")
+ ).data;
+ tableData.column.schoolId.setting.datasource = (
+ await SchoolApi.querycombo({ TextName: "Name", ValueName: "Id" })
+ ).data;
+
showTable.value = true;
});
From f13a4261a1f2df7a57dcda3f6fc9696104eabf01 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=B0=8F=E8=82=A5=E7=BE=8A?= <1048382248@qq.com>
Date: Thu, 14 Aug 2025 18:20:28 +0800
Subject: [PATCH 06/10] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20=E7=99=BB=E5=BD=95?=
=?UTF-8?q?=E6=8E=88=E6=9D=83=E9=97=AE=E9=A2=98=20=E4=BC=98=E5=8C=96=20?=
=?UTF-8?q?=E7=9B=B4=E6=8E=A5=E8=B0=83=E7=94=A8=E6=95=B0=E6=8D=AE=E4=B8=AD?=
=?UTF-8?q?=E5=BF=83API?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.env.development | 4 +-
src/api/class.ts | 12 +
src/api/hTable.ts | 8 +-
src/api/school.ts | 2 +-
src/components/hTable/hTableEdit.vue | 2 +-
src/utils/http/index.ts | 63 +++++
src/utils/{roles.ts => rules.ts} | 0
src/views/admin/index.vue | 2 +-
src/views/class/edit.vue | 347 +++++++++++++++++++++++++++
src/views/class/index.vue | 99 ++++++--
src/views/grade/index.vue | 136 +++++++++++
src/views/menu/index.vue | 2 +-
src/views/school/SchoolEdit.vue | 2 -
src/views/school/index.vue | 28 +--
14 files changed, 647 insertions(+), 60 deletions(-)
create mode 100644 src/api/class.ts
rename src/utils/{roles.ts => rules.ts} (100%)
create mode 100644 src/views/class/edit.vue
create mode 100644 src/views/grade/index.vue
diff --git a/.env.development b/.env.development
index 17faa14..d70fc73 100644
--- a/.env.development
+++ b/.env.development
@@ -6,5 +6,7 @@ VITE_PUBLIC_PATH = /
# 开发环境路由历史模式(Hash模式传"hash"、HTML5模式传"h5"、Hash模式带base参数传"hash,base参数"、HTML5模式带base参数传"h5,base参数")
VITE_ROUTER_HISTORY = "hash"
-
+# 接口地址
VITE_API_BASEURL = "http://localhost:5199/api"
+#数据中心后台地址
+VITE_API_USERCENTER_URL = "https://dca.w.23544.com:8843/api/back"
diff --git a/src/api/class.ts b/src/api/class.ts
new file mode 100644
index 0000000..5589bda
--- /dev/null
+++ b/src/api/class.ts
@@ -0,0 +1,12 @@
+import { http } from "@/utils/http";
+import type { Res } from "@/utils/http/types";
+
+/**
+ * @description 获取所有的菜单
+ * @return {object}
+ */
+export function addClasses(info: any) {
+ return http.request>("post", `classes/addclass`, {
+ data: info
+ });
+}
diff --git a/src/api/hTable.ts b/src/api/hTable.ts
index 038394e..e097d07 100644
--- a/src/api/hTable.ts
+++ b/src/api/hTable.ts
@@ -11,13 +11,9 @@ export class hTableAPI {
PageList(data = {}) {
return http.request>("post", `${this.url}/PageList`, { data });
}
- Info(tag = {}) {
- const pUrl = `${this.url}/Info`;
+ Info(tag) {
+ const pUrl = `${this.url}/${tag}`;
let getUrl = pUrl;
- for (const key in tag) {
- const el = tag[key];
- getUrl += (getUrl === pUrl ? "?" : "&") + key + "=" + el;
- }
return http.request>("get", getUrl);
}
edit(data) {
diff --git a/src/api/school.ts b/src/api/school.ts
index 4891252..1a78add 100644
--- a/src/api/school.ts
+++ b/src/api/school.ts
@@ -33,5 +33,5 @@ export function getregion(r) {
* @return {void}
*/
export function EditSchool(data: any) {
- return http.request>("post", `School/Edit`, { data });
+ return http.request>("post", `schools/add`, { data });
}
diff --git a/src/components/hTable/hTableEdit.vue b/src/components/hTable/hTableEdit.vue
index cd24367..19dce09 100644
--- a/src/components/hTable/hTableEdit.vue
+++ b/src/components/hTable/hTableEdit.vue
@@ -118,7 +118,7 @@ function fetchFormData() {
editData.value.loading = false;
if (editData.value.isedit) {
handleResetForm();
- Api.Info({ id: props.id }).then(res => {
+ Api.Info(props.id).then(res => {
if (res.code === 200) {
editData.value.frorm = res.data;
for (const key in column.value) {
diff --git a/src/utils/http/index.ts b/src/utils/http/index.ts
index bfd306b..49f6eb3 100644
--- a/src/utils/http/index.ts
+++ b/src/utils/http/index.ts
@@ -13,6 +13,59 @@ import { stringify } from "qs";
import NProgress from "../progress";
import { getToken, formatToken } from "@/utils/auth";
import { useUserStoreHook } from "@/store/modules/user";
+import { string } from "vue-types";
+import router from "@/router";
+
+/**请求后端的地址 未配置则访问BaseURL */
+const apiServiceConfig = {
+ classes: import.meta.env.VITE_API_USERCENTER_URL,
+ schools: import.meta.env.VITE_API_USERCENTER_URL
+};
+
+function getAPIUrl(url: string): string {
+ let token = url.startsWith("/") ? url.split("/")[1] : url.split("/")[0];
+ if (apiServiceConfig[token] != null) return apiServiceConfig[token];
+ else return import.meta.env.VITE_API_BASEURL;
+}
+
+const snakeToCamel = (str: string): string => {
+ // 处理蛇形命名(user_id → userId)
+ let result = str.replace(/_([a-zA-Z0-9])/g, (_, letter) =>
+ letter.toUpperCase()
+ );
+
+ // 处理大驼峰命名(UserName → userName)
+ if (result.length > 0) {
+ result = result.charAt(0).toLowerCase() + result.slice(1);
+ }
+
+ // 特殊场景:处理连续下划线(__type → Type)
+ result = result.replace(/^_+/, "");
+
+ return result;
+};
+
+/**
+ * 递归转换对象/数组的键名为小驼峰格式
+ */
+const convertKeysToCamelCase = (data: any): T => {
+ if (Array.isArray(data)) {
+ return data.map(item => convertKeysToCamelCase(item)) as unknown as T;
+ }
+
+ if (data !== null && typeof data === "object") {
+ return Object.keys(data).reduce((result, key) => {
+ const camelKey = snakeToCamel(key);
+ const value = data[key];
+ return {
+ ...result,
+ [camelKey]: convertKeysToCamelCase(value)
+ };
+ }, {}) as T;
+ }
+
+ return data as T;
+};
// 相关配置请参考:www.axios-js.com/zh-cn/docs/#axios-request-config-1
const defaultConfig: AxiosRequestConfig = {
@@ -64,6 +117,9 @@ class PureHttp {
async (config: PureHttpRequestConfig): Promise => {
// 开启进度条动画
NProgress.start();
+ if (config.url.indexOf("http") === -1) {
+ config.baseURL = getAPIUrl(config.url);
+ }
// 优先判断post/get等方法是否传入回调,否则执行初始化设置等回调
if (typeof config.beforeRequestCallback === "function") {
config.beforeRequestCallback(config);
@@ -124,6 +180,7 @@ class PureHttp {
const $config = response.config;
// 关闭进度条动画
NProgress.done();
+ response.data = convertKeysToCamelCase(response.data);
// 优先判断post/get等方法是否传入回调,否则执行初始化设置等回调
if (typeof $config.beforeResponseCallback === "function") {
$config.beforeResponseCallback(response);
@@ -140,6 +197,12 @@ class PureHttp {
$error.isCancelRequest = Axios.isCancel($error);
// 关闭进度条动画
NProgress.done();
+ if (error.response?.status === 403) {
+ // 跳转到403页面
+ router.push({
+ path: "/error/403"
+ });
+ }
// 所有的响应异常 区分来源为取消请求/非取消请求
return Promise.reject($error);
}
diff --git a/src/utils/roles.ts b/src/utils/rules.ts
similarity index 100%
rename from src/utils/roles.ts
rename to src/utils/rules.ts
diff --git a/src/views/admin/index.vue b/src/views/admin/index.vue
index 0f1c91e..6a2a671 100644
--- a/src/views/admin/index.vue
+++ b/src/views/admin/index.vue
@@ -9,7 +9,7 @@ import {
rulePassword,
rulePhone,
ruleRequired
-} from "@/utils/roles";
+} from "@/utils/rules";
const ControllerName = "Admin";
defineOptions({
diff --git a/src/views/class/edit.vue b/src/views/class/edit.vue
new file mode 100644
index 0000000..a3fea06
--- /dev/null
+++ b/src/views/class/edit.vue
@@ -0,0 +1,347 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 添加
+
+
+
+
+ 暂未添加!
+
+ {{ tag }}
+
+
+
+
+
+ 立即提交
+
+ 重置
+
+
+
+
+
+
+
+
diff --git a/src/views/class/index.vue b/src/views/class/index.vue
index 78a25b4..8314e3c 100644
--- a/src/views/class/index.vue
+++ b/src/views/class/index.vue
@@ -5,13 +5,14 @@ import { onMounted, ref } from "vue";
import { fa } from "element-plus/es/locales.mjs";
import { hTableAPI } from "@/api/hTable";
import { getenum } from "@/api/enum";
-const ControllerName = "Class";
+import { ruleRequired } from "@/utils/rules";
+const ControllerName = "classes";
defineOptions({
name: ControllerName
});
-const SchoolApi = new hTableAPI("School");
+const SchoolApi = new hTableAPI("schools");
function searchCallback(data) {}
const table = ref<{ initTable: (config: TableConfig) => void }>();
@@ -38,11 +39,17 @@ const tableData: TableConfig = {
btnType: "edit" // 按钮类型 add edit del custom
},
{
- // 操作按钮
- topBtn: true, // 是头部按钮
- label: "添加",
- btnStyle: "success",
- btnType: "add" // 按钮类型 add edit del custom
+ topBtn: true, // 头部按钮
+ label: "新增",
+ btnType: "custom", // 按钮类型 add edit del custom
+ btnStyle: "success", // topBtn: true才生效 success danger
+ custom: {
+ // 按钮类型 custom 专用
+ title: "新增班级", // 弹出框title
+ src: "class/edit", // 组件路径
+ width: "550px", // 弹框宽度
+ height: "520px" // 弹框高度
+ }
},
{
topBtn: false, // 头部按钮
@@ -63,6 +70,7 @@ const tableData: TableConfig = {
},
schoolId: {
label: "学校",
+ rules: ruleRequired,
width: "180px",
search: true,
type: "dropdown",
@@ -72,6 +80,7 @@ const tableData: TableConfig = {
},
name: {
label: "名称",
+ rules: ruleRequired,
width: "180px",
search: true,
searchType: "Like",
@@ -80,6 +89,7 @@ const tableData: TableConfig = {
},
Grade: {
label: "年级",
+ rules: ruleRequired,
width: "180px",
type: "dropdown",
custom: row => `${row.grade ?? ""}`,
@@ -89,31 +99,56 @@ const tableData: TableConfig = {
add: true, // 字段允许添加
edit: false // 字段允许修改
},
+ GradeLevel: {
+ label: "年级",
+ search: false,
+ type: "dropdown",
+ searchType: "Like", // Equal等于/NoEqual不等于/Like包含/GreaterThan大于/LessThan小于/NoLike不包括
+ add: true, // 字段允许添加
+ edit: true, // 字段允许修改
+ width: "70px",
+ setting: {
+ datasource: [
+ { text: "初", value: "初" },
+ { text: "高", value: "高" },
+ { text: "小", value: "小" }
+ ]
+ }
+ },
+ GraduationYear: {
+ label: "届",
+ search: false,
+ searchType: "Like", // Equal等于/NoEqual不等于/Like包含/GreaterThan大于/LessThan小于/NoLike不包括
+ add: true, // 字段允许添加
+ edit: true, // 字段允许修改
+ width: "80px"
+ },
type: {
label: "类型",
- width: "150px",
+ rules: ruleRequired,
+ // width: "150px",
type: "dropdown",
search: true,
add: true, // 字段允许添加
edit: true, // 字段允许修改
setting: {}
- },
- createTime: {
- label: "创建时间",
- width: "180px",
- type: "datetime",
- search: true,
- add: false, // 字段允许添加
- edit: false // 字段允许修改
- },
- remark: {
- label: "备注",
- type: "textarea",
- editRows: 3,
- search: false,
- add: true, // 字段允许添加
- edit: true // 字段允许修改
}
+ // createTime: {
+ // label: "创建时间",
+ // width: "180px",
+ // type: "datetime",
+ // search: true,
+ // add: false, // 字段允许添加
+ // edit: false // 字段允许修改
+ // },
+ // remark: {
+ // label: "备注",
+ // type: "textarea",
+ // editRows: 3,
+ // search: false,
+ // add: true, // 字段允许添加
+ // edit: true // 字段允许修改
+ // }
},
data: [],
pageData: {
@@ -126,8 +161,20 @@ const showTable = ref(false);
onMounted(async () => {
//初始化数据原
- tableData.column.Grade.setting.datasource = (await getenum("GradeEnum")).data;
-
+ tableData.column.Grade.setting.datasource = [
+ { text: "初一", value: "初一" },
+ { text: "初二", value: "初二" },
+ { text: "初三", value: "初三" },
+ { text: "高一", value: "高一" },
+ { text: "高二", value: "高二" },
+ { text: "高三", value: "高三" },
+ { text: "一年级", value: "一年级" },
+ { text: "二年级", value: "二年级" },
+ { text: "三年级", value: "三年级" },
+ { text: "四年级", value: "四年级" },
+ { text: "五年级", value: "五年级" },
+ { text: "六年级", value: "六年级" }
+ ];
tableData.column.type.setting.datasource = (
await getenum("ClassTypeEnum")
).data;
diff --git a/src/views/grade/index.vue b/src/views/grade/index.vue
new file mode 100644
index 0000000..7478824
--- /dev/null
+++ b/src/views/grade/index.vue
@@ -0,0 +1,136 @@
+
+
+
+
+
diff --git a/src/views/menu/index.vue b/src/views/menu/index.vue
index 6f09a21..265f1c6 100644
--- a/src/views/menu/index.vue
+++ b/src/views/menu/index.vue
@@ -42,7 +42,7 @@
-