dev #8
|
|
@ -28,3 +28,4 @@ export class hTableAPI {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,27 @@ export interface OperationButton {
|
||||||
custom?: ButtonCustomConfig;
|
custom?: ButtonCustomConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 类型判断枚举 */
|
||||||
|
export enum ConditionalType {
|
||||||
|
Equal,
|
||||||
|
Like,
|
||||||
|
GreaterThan,
|
||||||
|
GreaterThanOrEqual,
|
||||||
|
LessThan,
|
||||||
|
LessThanOrEqual,
|
||||||
|
In,
|
||||||
|
NotIn,
|
||||||
|
LikeLeft,
|
||||||
|
LikeRight,
|
||||||
|
NoEqual,
|
||||||
|
IsNullOrEmpty,
|
||||||
|
IsNot,
|
||||||
|
NoLike,
|
||||||
|
EqualNull,
|
||||||
|
InLike,
|
||||||
|
Range
|
||||||
|
}
|
||||||
|
|
||||||
/* 字段设置项 */
|
/* 字段设置项 */
|
||||||
export interface FieldSetting {
|
export interface FieldSetting {
|
||||||
/**map 时Value的取值的属性 */
|
/**map 时Value的取值的属性 */
|
||||||
|
|
@ -95,13 +116,7 @@ export interface TableColumn {
|
||||||
/* 是否可搜索 */
|
/* 是否可搜索 */
|
||||||
search: boolean;
|
search: boolean;
|
||||||
/* 搜索类型 */
|
/* 搜索类型 */
|
||||||
searchType?:
|
searchType?: ConditionalType;
|
||||||
| "Equal"
|
|
||||||
| "NoEqual"
|
|
||||||
| "Like"
|
|
||||||
| "GreaterThan"
|
|
||||||
| "LessThan"
|
|
||||||
| "NoLike";
|
|
||||||
/* 是否允许添加 */
|
/* 是否允许添加 */
|
||||||
add: boolean;
|
add: boolean;
|
||||||
/* 是否允许修改 */
|
/* 是否允许修改 */
|
||||||
|
|
@ -138,6 +153,18 @@ export interface PageData {
|
||||||
total: number;
|
total: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 分页数据 */
|
||||||
|
export interface ConditionalModel {
|
||||||
|
/** 字段名称 */
|
||||||
|
FieldName: string;
|
||||||
|
/** 字段查询值 */
|
||||||
|
FieldValue: string;
|
||||||
|
/** 查询方式 */
|
||||||
|
ConditionalType?: ConditionalType;
|
||||||
|
/** C#类型名称 */
|
||||||
|
CSharpTypeName?: string;
|
||||||
|
}
|
||||||
|
|
||||||
/* 搜索条件 */
|
/* 搜索条件 */
|
||||||
export interface SearchConditions {
|
export interface SearchConditions {
|
||||||
/* 是否显示搜索 */
|
/* 是否显示搜索 */
|
||||||
|
|
@ -149,7 +176,7 @@ export interface SearchConditions {
|
||||||
/* 排序字段 */
|
/* 排序字段 */
|
||||||
OrderBy: string;
|
OrderBy: string;
|
||||||
/* 默认查询条件 */
|
/* 默认查询条件 */
|
||||||
defaultConditions: any[];
|
defaultConditions: ConditionalModel[];
|
||||||
/* 查询条件 */
|
/* 查询条件 */
|
||||||
Conditions: any[];
|
Conditions: any[];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ import {
|
||||||
import { Search } from "@element-plus/icons-vue";
|
import { Search } from "@element-plus/icons-vue";
|
||||||
import { ElMessage, ElMessageBox } from "element-plus";
|
import { ElMessage, ElMessageBox } from "element-plus";
|
||||||
import { defineAsyncComponent, AsyncComponentLoader } from "vue";
|
import { defineAsyncComponent, AsyncComponentLoader } from "vue";
|
||||||
import { Dialog, TableColumn, TableConfig } from "./hTable";
|
import { ConditionalType, Dialog, TableColumn, TableConfig } from "./hTable";
|
||||||
import hTableEdit from "./hTableEdit.vue";
|
import hTableEdit from "./hTableEdit.vue";
|
||||||
import { hTableAPI } from "@/api/hTable";
|
import { hTableAPI } from "@/api/hTable";
|
||||||
import { getenum } from "@/api/enum";
|
import { getenum } from "@/api/enum";
|
||||||
|
|
@ -274,17 +274,19 @@ function handleReloadPaged(reload = true) {
|
||||||
let data: any = { ConditionalType: 0 };
|
let data: any = { ConditionalType: 0 };
|
||||||
if (table.value.column[name].type === "datetime") {
|
if (table.value.column[name].type === "datetime") {
|
||||||
// data.CSharpTypeName = 'DateTime'
|
// data.CSharpTypeName = 'DateTime'
|
||||||
data.ConditionalType = 8; // '2023-10-07%'
|
data.ConditionalType = ConditionalType.LikeLeft; // '2023-10-07%'
|
||||||
} else if (table.value.column[name].type === "switch") {
|
} else if (table.value.column[name].type === "switch") {
|
||||||
data.CSharpTypeName = "Boolean";
|
data.CSharpTypeName = "Boolean";
|
||||||
} else if (table.value.column[name].type === "string") {
|
} else if (table.value.column[name].type === "string") {
|
||||||
data.ConditionalType = "Like";
|
data.ConditionalType = ConditionalType.Like;
|
||||||
}
|
} else data.ConditionalType = ConditionalType.Equal;
|
||||||
|
|
||||||
data.FieldName = name.charAt(0).toUpperCase() + name.slice(1);
|
data.FieldName = name.charAt(0).toUpperCase() + name.slice(1);
|
||||||
data.FieldValue = table.value.column[name].value.toString();
|
data.FieldValue = table.value.column[name].value.toString();
|
||||||
|
|
||||||
if (table.value.column[name].searchType != undefined) {
|
if (table.value.column[name].searchType != undefined) {
|
||||||
data.ConditionalType = table.value.column[name].searchType || 0;
|
let v: number = table.value.column[name].searchType || 0;
|
||||||
|
data.ConditionalType = v;
|
||||||
}
|
}
|
||||||
table.value.search.Conditions.push(data);
|
table.value.search.Conditions.push(data);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,14 @@
|
||||||
export const ruleRequired = [
|
export const ruleRequired = [
|
||||||
{ required: true, message: "不能为空", trigger: "blur" }
|
{ required: true, message: "不能为空", trigger: "blur" }
|
||||||
];
|
];
|
||||||
|
export const ruleRequiredNumber = [
|
||||||
|
{ required: true, message: "不能为空", trigger: "blur" },
|
||||||
|
{
|
||||||
|
pattern: /^\d*\.?\d+$/,
|
||||||
|
message: "请输入正确数字",
|
||||||
|
trigger: "blur"
|
||||||
|
}
|
||||||
|
];
|
||||||
export const rulePassword = [
|
export const rulePassword = [
|
||||||
{ required: true, message: "不能为空", trigger: "blur" },
|
{ required: true, message: "不能为空", trigger: "blur" },
|
||||||
{ min: 6, message: "长度必须大于5", trigger: "blur" }
|
{ min: 6, message: "长度必须大于5", trigger: "blur" }
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import ahTable from "@/components/hTable/index.vue";
|
import ahTable from "@/components/hTable/index.vue";
|
||||||
import { TableConfig } from "@/components/hTable/hTable";
|
import { ConditionalType, TableConfig } from "@/components/hTable/hTable";
|
||||||
import { onMounted, ref } from "vue";
|
import { onMounted, ref } from "vue";
|
||||||
import { fa } from "element-plus/es/locales.mjs";
|
import { fa } from "element-plus/es/locales.mjs";
|
||||||
import { hTableAPI } from "@/api/hTable";
|
import { hTableAPI } from "@/api/hTable";
|
||||||
|
|
@ -79,7 +79,7 @@ const tableData: TableConfig = {
|
||||||
width: "180px",
|
width: "180px",
|
||||||
rules: ruleRequired,
|
rules: ruleRequired,
|
||||||
search: true,
|
search: true,
|
||||||
searchType: "Like",
|
searchType: ConditionalType.Like,
|
||||||
add: true, // 字段允许添加
|
add: true, // 字段允许添加
|
||||||
edit: true // 字段允许修改
|
edit: true // 字段允许修改
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import ahTable from "@/components/hTable/index.vue";
|
import ahTable from "@/components/hTable/index.vue";
|
||||||
import { TableConfig } from "@/components/hTable/hTable";
|
import { ConditionalType, TableConfig } from "@/components/hTable/hTable";
|
||||||
import { onMounted, ref } from "vue";
|
import { onMounted, ref } from "vue";
|
||||||
import { fa } from "element-plus/es/locales.mjs";
|
import { fa } from "element-plus/es/locales.mjs";
|
||||||
import { hTableAPI } from "@/api/hTable";
|
import { hTableAPI } from "@/api/hTable";
|
||||||
|
|
@ -70,7 +70,7 @@ const tableData: TableConfig = {
|
||||||
label: "角色名称",
|
label: "角色名称",
|
||||||
width: "180px",
|
width: "180px",
|
||||||
search: true,
|
search: true,
|
||||||
searchType: "Like",
|
searchType: ConditionalType.Like,
|
||||||
add: true, // 字段允许添加
|
add: true, // 字段允许添加
|
||||||
edit: true // 字段允许修改
|
edit: true // 字段允许修改
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import ahTable from "@/components/hTable/index.vue";
|
import ahTable from "@/components/hTable/index.vue";
|
||||||
import { TableConfig } from "@/components/hTable/hTable";
|
import { ConditionalType, TableConfig } from "@/components/hTable/hTable";
|
||||||
import { onMounted, ref } from "vue";
|
import { onMounted, ref } from "vue";
|
||||||
import { fa } from "element-plus/es/locales.mjs";
|
import { fa } from "element-plus/es/locales.mjs";
|
||||||
import { hTableAPI } from "@/api/hTable";
|
import { hTableAPI } from "@/api/hTable";
|
||||||
|
|
@ -83,7 +83,7 @@ const tableData: TableConfig = {
|
||||||
rules: ruleRequired,
|
rules: ruleRequired,
|
||||||
width: "180px",
|
width: "180px",
|
||||||
search: true,
|
search: true,
|
||||||
searchType: "Like",
|
searchType: ConditionalType.Like, // 搜索类型
|
||||||
add: true, // 字段允许添加
|
add: true, // 字段允许添加
|
||||||
edit: true // 字段允许修改
|
edit: true // 字段允许修改
|
||||||
},
|
},
|
||||||
|
|
@ -103,7 +103,7 @@ const tableData: TableConfig = {
|
||||||
label: "年级",
|
label: "年级",
|
||||||
search: false,
|
search: false,
|
||||||
type: "dropdown",
|
type: "dropdown",
|
||||||
searchType: "Like", // Equal等于/NoEqual不等于/Like包含/GreaterThan大于/LessThan小于/NoLike不包括
|
searchType: ConditionalType.Like,
|
||||||
add: true, // 字段允许添加
|
add: true, // 字段允许添加
|
||||||
edit: true, // 字段允许修改
|
edit: true, // 字段允许修改
|
||||||
width: "70px",
|
width: "70px",
|
||||||
|
|
@ -118,7 +118,6 @@ const tableData: TableConfig = {
|
||||||
GraduationYear: {
|
GraduationYear: {
|
||||||
label: "届",
|
label: "届",
|
||||||
search: false,
|
search: false,
|
||||||
searchType: "Like", // Equal等于/NoEqual不等于/Like包含/GreaterThan大于/LessThan小于/NoLike不包括
|
|
||||||
add: true, // 字段允许添加
|
add: true, // 字段允许添加
|
||||||
edit: true, // 字段允许修改
|
edit: true, // 字段允许修改
|
||||||
width: "80px"
|
width: "80px"
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,137 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import ahTable from "@/components/hTable/index.vue";
|
||||||
|
import { ConditionalType, 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";
|
||||||
|
import { ruleRequired, ruleRequiredNumber } from "@/utils/rules";
|
||||||
|
const ControllerName = "ExamClassInfo";
|
||||||
|
|
||||||
|
defineOptions({
|
||||||
|
name: ControllerName
|
||||||
|
});
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
data: any;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
function searchCallback(data) {}
|
||||||
|
const table = ref<{ initTable: (config: TableConfig) => void }>();
|
||||||
|
const tableData: TableConfig = {
|
||||||
|
apiUrl: ControllerName,
|
||||||
|
selectColumn: false, // 列表选择
|
||||||
|
border: false, // 是否显示表格边框
|
||||||
|
searchCallback: searchCallback,
|
||||||
|
search: {
|
||||||
|
// 查询条件
|
||||||
|
show: true,
|
||||||
|
PageIndex: 0,
|
||||||
|
PageSize: 20,
|
||||||
|
OrderBy: "Id", // 排序
|
||||||
|
defaultConditions: [
|
||||||
|
{
|
||||||
|
FieldName: "ExamId",
|
||||||
|
FieldValue: props.data[0].id + "",
|
||||||
|
ConditionalType: ConditionalType.Equal
|
||||||
|
}
|
||||||
|
], // 默认查询条件
|
||||||
|
Conditions: []
|
||||||
|
},
|
||||||
|
operationColumn: true, // 显示操作按钮
|
||||||
|
operationColumnData: [
|
||||||
|
{
|
||||||
|
// 操作按钮
|
||||||
|
topBtn: true, // 是头部按钮
|
||||||
|
label: "添加",
|
||||||
|
btnStyle: "success",
|
||||||
|
btnType: "custom"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
topBtn: false, // 头部按钮
|
||||||
|
show: true,
|
||||||
|
label: "删除",
|
||||||
|
btnType: "del", // 按钮类型 add edit del 不设置则 自定义按钮
|
||||||
|
btnStyle: "danger" // topBtn: true才生效 success danger
|
||||||
|
},
|
||||||
|
{
|
||||||
|
topBtn: false, // 头部按钮
|
||||||
|
show: true,
|
||||||
|
label: "重新录入",
|
||||||
|
btnType: "custom", // 按钮类型 add edit del 不设置则 自定义按钮
|
||||||
|
btnStyle: "primary" // topBtn: true才生效 success danger
|
||||||
|
},
|
||||||
|
{
|
||||||
|
topBtn: false, // 头部按钮
|
||||||
|
show: true,
|
||||||
|
label: "学生成绩详情",
|
||||||
|
btnType: "custom",
|
||||||
|
btnStyle: "primary" // topBtn: true才生效 success danger
|
||||||
|
}
|
||||||
|
],
|
||||||
|
column: {
|
||||||
|
// 行数据
|
||||||
|
schoolName: {
|
||||||
|
label: "学校",
|
||||||
|
search: true,
|
||||||
|
searchType: ConditionalType.Like, // 搜索类型
|
||||||
|
add: false, // 字段允许添加
|
||||||
|
edit: false, // 字段允许修改
|
||||||
|
width: "180px"
|
||||||
|
},
|
||||||
|
grade: {
|
||||||
|
label: "年级",
|
||||||
|
width: "100px",
|
||||||
|
custom: s => `${s.gradeYear}${s.gradeLevel}`,
|
||||||
|
search: true,
|
||||||
|
add: false, // 字段允许添加
|
||||||
|
edit: false // 字段允许修改
|
||||||
|
},
|
||||||
|
className: {
|
||||||
|
label: "班级",
|
||||||
|
width: "150px",
|
||||||
|
search: true,
|
||||||
|
searchType: ConditionalType.Like, // 搜索类型
|
||||||
|
add: false, // 字段允许添加
|
||||||
|
edit: false // 字段允许修改
|
||||||
|
},
|
||||||
|
peopleCount: {
|
||||||
|
label: "参考人数",
|
||||||
|
width: "100px",
|
||||||
|
search: false,
|
||||||
|
add: false, // 字段允许添加
|
||||||
|
edit: false // 字段允许修改
|
||||||
|
},
|
||||||
|
etryPerson: {
|
||||||
|
label: "录入人",
|
||||||
|
width: "200px",
|
||||||
|
search: true,
|
||||||
|
add: false, // 字段允许添加
|
||||||
|
edit: false // 字段允许修改
|
||||||
|
},
|
||||||
|
createTime: {
|
||||||
|
label: "录入时间",
|
||||||
|
width: "200px",
|
||||||
|
search: true,
|
||||||
|
add: false, // 字段允许添加
|
||||||
|
edit: false // 字段允许修改
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data: [],
|
||||||
|
pageData: {
|
||||||
|
total: 0
|
||||||
|
},
|
||||||
|
selectRows: []
|
||||||
|
};
|
||||||
|
|
||||||
|
const showTable = ref(false);
|
||||||
|
onMounted(async () => {
|
||||||
|
//初始化数据原
|
||||||
|
|
||||||
|
showTable.value = true;
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div><ahTable v-if="showTable" ref="table" :tableConfig="tableData" /></div>
|
||||||
|
</template>
|
||||||
|
|
@ -0,0 +1,177 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import ahTable from "@/components/hTable/index.vue";
|
||||||
|
import { ConditionalType, 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";
|
||||||
|
import { ruleRequired, ruleRequiredNumber } from "@/utils/rules";
|
||||||
|
const ControllerName = "Exam";
|
||||||
|
|
||||||
|
defineOptions({
|
||||||
|
name: ControllerName
|
||||||
|
});
|
||||||
|
|
||||||
|
function searchCallback(data) {}
|
||||||
|
|
||||||
|
const table = ref<{ initTable: (config: TableConfig) => void }>();
|
||||||
|
const tableData: TableConfig = {
|
||||||
|
apiUrl: ControllerName,
|
||||||
|
selectColumn: false, // 列表选择
|
||||||
|
border: false, // 是否显示表格边框
|
||||||
|
searchCallback: searchCallback,
|
||||||
|
search: {
|
||||||
|
// 查询条件
|
||||||
|
show: true,
|
||||||
|
PageIndex: 0,
|
||||||
|
PageSize: 20,
|
||||||
|
OrderBy: "Id", // 排序
|
||||||
|
defaultConditions: [], // 默认查询条件
|
||||||
|
Conditions: []
|
||||||
|
},
|
||||||
|
operationColumn: true, // 显示操作按钮
|
||||||
|
operationColumnData: [
|
||||||
|
{
|
||||||
|
// 操作按钮
|
||||||
|
topBtn: false, // 是头部按钮
|
||||||
|
label: "修改",
|
||||||
|
btnType: "edit" // 按钮类型 add edit del custom
|
||||||
|
},
|
||||||
|
{
|
||||||
|
// 操作按钮
|
||||||
|
topBtn: true, // 是头部按钮
|
||||||
|
label: "添加",
|
||||||
|
btnStyle: "success",
|
||||||
|
btnType: "add" // 按钮类型 add edit del custom
|
||||||
|
},
|
||||||
|
{
|
||||||
|
topBtn: false, // 头部按钮
|
||||||
|
show: true,
|
||||||
|
label: "删除",
|
||||||
|
btnType: "del", // 按钮类型 add edit del 不设置则 自定义按钮
|
||||||
|
btnStyle: "danger" // topBtn: true才生效 success danger
|
||||||
|
},
|
||||||
|
{
|
||||||
|
topBtn: false, // 头部按钮
|
||||||
|
show: true,
|
||||||
|
label: "详情",
|
||||||
|
btnType: "custom", // 按钮类型 add edit del 不设置则 自定义按钮
|
||||||
|
btnStyle: "primary",
|
||||||
|
custom: {
|
||||||
|
title: "考试班级详情", // 弹出框title
|
||||||
|
src: "exam/classDetails", // 组件路径
|
||||||
|
width: "1600px", // 弹框宽度
|
||||||
|
height: "520px" // 弹框高度
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
topBtn: false, // 头部按钮
|
||||||
|
show: true,
|
||||||
|
label: "录入成绩",
|
||||||
|
btnType: "custom", // 按钮类型 add edit del 不设置则 自定义按钮
|
||||||
|
btnStyle: "primary" // topBtn: true才生效 success danger
|
||||||
|
}
|
||||||
|
],
|
||||||
|
column: {
|
||||||
|
// 行数据
|
||||||
|
id: {
|
||||||
|
label: "编号",
|
||||||
|
search: true,
|
||||||
|
add: false, // 字段允许添加
|
||||||
|
edit: false, // 字段允许修改
|
||||||
|
width: "150px"
|
||||||
|
},
|
||||||
|
name: {
|
||||||
|
label: "考试名称",
|
||||||
|
rules: ruleRequired,
|
||||||
|
width: "200px",
|
||||||
|
search: true,
|
||||||
|
searchType: ConditionalType.Like, // 搜索类型
|
||||||
|
add: true, // 字段允许添加
|
||||||
|
edit: true, // 字段允许修改
|
||||||
|
setting: {}
|
||||||
|
},
|
||||||
|
level: {
|
||||||
|
label: "年级",
|
||||||
|
rules: ruleRequired,
|
||||||
|
width: "100px",
|
||||||
|
type: "dropdown",
|
||||||
|
setting: {},
|
||||||
|
search: true,
|
||||||
|
add: true, // 字段允许添加
|
||||||
|
edit: true // 字段允许修改
|
||||||
|
},
|
||||||
|
testPaperType: {
|
||||||
|
label: "试卷类型",
|
||||||
|
rules: ruleRequired,
|
||||||
|
width: "100px",
|
||||||
|
type: "dropdown",
|
||||||
|
setting: {},
|
||||||
|
search: true,
|
||||||
|
add: true, // 字段允许添加
|
||||||
|
edit: true // 字段允许修改
|
||||||
|
},
|
||||||
|
type: {
|
||||||
|
label: "考试类型",
|
||||||
|
rules: ruleRequired,
|
||||||
|
width: "100px",
|
||||||
|
type: "dropdown",
|
||||||
|
setting: {},
|
||||||
|
search: true,
|
||||||
|
add: true, // 字段允许添加
|
||||||
|
edit: true // 字段允许修改
|
||||||
|
},
|
||||||
|
scoreLine: {
|
||||||
|
label: "划线分数",
|
||||||
|
rules: ruleRequiredNumber,
|
||||||
|
search: true,
|
||||||
|
width: "100px",
|
||||||
|
setting: {},
|
||||||
|
add: true, // 字段允许添加
|
||||||
|
edit: true // 字段允许修改
|
||||||
|
},
|
||||||
|
startTime: {
|
||||||
|
label: "考试时间",
|
||||||
|
width: "210px",
|
||||||
|
rules: ruleRequired,
|
||||||
|
search: true,
|
||||||
|
type: "datetime",
|
||||||
|
setting: {},
|
||||||
|
add: true, // 字段允许添加
|
||||||
|
edit: true // 字段允许修改
|
||||||
|
},
|
||||||
|
createTime: {
|
||||||
|
label: "创建时间",
|
||||||
|
type: "datetime",
|
||||||
|
search: true,
|
||||||
|
add: false, // 字段允许添加
|
||||||
|
edit: false // 字段允许修改
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data: [],
|
||||||
|
pageData: {
|
||||||
|
total: 0
|
||||||
|
},
|
||||||
|
selectRows: []
|
||||||
|
};
|
||||||
|
|
||||||
|
const showTable = ref(false);
|
||||||
|
onMounted(async () => {
|
||||||
|
//初始化数据原
|
||||||
|
|
||||||
|
tableData.column.level.setting.datasource = (await getenum("GradeEnum")).data;
|
||||||
|
|
||||||
|
tableData.column.testPaperType.setting.datasource = (
|
||||||
|
await getenum("TestPaperTypeEnum")
|
||||||
|
).data;
|
||||||
|
tableData.column.type.setting.datasource = (
|
||||||
|
await getenum("ExamTypeEnum")
|
||||||
|
).data;
|
||||||
|
|
||||||
|
showTable.value = true;
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div><ahTable v-if="showTable" ref="table" :tableConfig="tableData" /></div>
|
||||||
|
</template>
|
||||||
|
|
@ -0,0 +1,132 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import ahTable from "@/components/hTable/index.vue";
|
||||||
|
import { ConditionalType, 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";
|
||||||
|
import { ruleRequired, ruleRequiredNumber } from "@/utils/rules";
|
||||||
|
const ControllerName = "ExamUserInfo";
|
||||||
|
|
||||||
|
defineOptions({
|
||||||
|
name: ControllerName
|
||||||
|
});
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
data: any;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
function searchCallback(data) {}
|
||||||
|
|
||||||
|
const table = ref<{ initTable: (config: TableConfig) => void }>();
|
||||||
|
const tableData: TableConfig = {
|
||||||
|
apiUrl: ControllerName,
|
||||||
|
selectColumn: false, // 列表选择
|
||||||
|
border: false, // 是否显示表格边框
|
||||||
|
searchCallback: searchCallback,
|
||||||
|
search: {
|
||||||
|
// 查询条件
|
||||||
|
show: true,
|
||||||
|
PageIndex: 0,
|
||||||
|
PageSize: 20,
|
||||||
|
OrderBy: "Id", // 排序
|
||||||
|
defaultConditions: [], // 默认查询条件
|
||||||
|
Conditions: []
|
||||||
|
},
|
||||||
|
operationColumn: true, // 显示操作按钮
|
||||||
|
operationColumnData: [
|
||||||
|
{
|
||||||
|
// 操作按钮
|
||||||
|
topBtn: true, // 是头部按钮
|
||||||
|
label: "添加",
|
||||||
|
btnStyle: "success",
|
||||||
|
btnType: "custom"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
topBtn: false, // 头部按钮
|
||||||
|
show: true,
|
||||||
|
label: "删除",
|
||||||
|
btnType: "del", // 按钮类型 add edit del 不设置则 自定义按钮
|
||||||
|
btnStyle: "danger" // topBtn: true才生效 success danger
|
||||||
|
},
|
||||||
|
{
|
||||||
|
topBtn: false, // 头部按钮
|
||||||
|
show: true,
|
||||||
|
label: "重新录入",
|
||||||
|
btnType: "custom", // 按钮类型 add edit del 不设置则 自定义按钮
|
||||||
|
btnStyle: "primary" // topBtn: true才生效 success danger
|
||||||
|
},
|
||||||
|
{
|
||||||
|
topBtn: false, // 头部按钮
|
||||||
|
show: true,
|
||||||
|
label: "学生成绩详情",
|
||||||
|
btnType: "custom",
|
||||||
|
btnStyle: "primary" // topBtn: true才生效 success danger
|
||||||
|
}
|
||||||
|
],
|
||||||
|
column: {
|
||||||
|
// 行数据
|
||||||
|
schoolName: {
|
||||||
|
label: "学校",
|
||||||
|
search: true,
|
||||||
|
searchType: ConditionalType.Like, // 搜索类型
|
||||||
|
add: false, // 字段允许添加
|
||||||
|
edit: false, // 字段允许修改
|
||||||
|
width: "180px"
|
||||||
|
},
|
||||||
|
grade: {
|
||||||
|
label: "年级",
|
||||||
|
width: "100px",
|
||||||
|
custom: s => `${s.gradeYear}${s.gradeLevel}`,
|
||||||
|
search: true,
|
||||||
|
add: false, // 字段允许添加
|
||||||
|
edit: false // 字段允许修改
|
||||||
|
},
|
||||||
|
className: {
|
||||||
|
label: "班级",
|
||||||
|
width: "150px",
|
||||||
|
search: true,
|
||||||
|
searchType: ConditionalType.Like, // 搜索类型
|
||||||
|
add: false, // 字段允许添加
|
||||||
|
edit: false // 字段允许修改
|
||||||
|
},
|
||||||
|
peopleCount: {
|
||||||
|
label: "参考人数",
|
||||||
|
width: "100px",
|
||||||
|
search: false,
|
||||||
|
add: false, // 字段允许添加
|
||||||
|
edit: false // 字段允许修改
|
||||||
|
},
|
||||||
|
etryPerson: {
|
||||||
|
label: "录入人",
|
||||||
|
width: "200px",
|
||||||
|
search: true,
|
||||||
|
add: false, // 字段允许添加
|
||||||
|
edit: false // 字段允许修改
|
||||||
|
},
|
||||||
|
createTime: {
|
||||||
|
label: "录入时间",
|
||||||
|
width: "200px",
|
||||||
|
search: true,
|
||||||
|
add: false, // 字段允许添加
|
||||||
|
edit: false // 字段允许修改
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data: [],
|
||||||
|
pageData: {
|
||||||
|
total: 0
|
||||||
|
},
|
||||||
|
selectRows: []
|
||||||
|
};
|
||||||
|
|
||||||
|
const showTable = ref(false);
|
||||||
|
onMounted(async () => {
|
||||||
|
//初始化数据原
|
||||||
|
|
||||||
|
showTable.value = true;
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div><ahTable v-if="showTable" ref="table" :tableConfig="tableData" /></div>
|
||||||
|
</template>
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import ahTable from "@/components/hTable/index.vue";
|
import ahTable from "@/components/hTable/index.vue";
|
||||||
import { TableConfig } from "@/components/hTable/hTable";
|
import { ConditionalType, TableConfig } from "@/components/hTable/hTable";
|
||||||
import { onMounted, ref } from "vue";
|
import { onMounted, ref } from "vue";
|
||||||
import { fa } from "element-plus/es/locales.mjs";
|
import { fa } from "element-plus/es/locales.mjs";
|
||||||
import { hTableAPI } from "@/api/hTable";
|
import { hTableAPI } from "@/api/hTable";
|
||||||
|
|
@ -77,7 +77,7 @@ const tableData: TableConfig = {
|
||||||
rules: ruleRequired,
|
rules: ruleRequired,
|
||||||
width: "100px",
|
width: "100px",
|
||||||
search: false,
|
search: false,
|
||||||
searchType: "Like",
|
searchType: ConditionalType.Like,
|
||||||
add: false, // 字段允许添加
|
add: false, // 字段允许添加
|
||||||
edit: false // 字段允许修改
|
edit: false // 字段允许修改
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import ahTable from "@/components/hTable/index.vue";
|
import ahTable from "@/components/hTable/index.vue";
|
||||||
import { TableConfig } from "@/components/hTable/hTable";
|
import { ConditionalType, TableConfig } from "@/components/hTable/hTable";
|
||||||
import { onMounted, ref } from "vue";
|
import { onMounted, ref } from "vue";
|
||||||
import { fa } from "element-plus/es/locales.mjs";
|
import { fa } from "element-plus/es/locales.mjs";
|
||||||
defineOptions({
|
defineOptions({
|
||||||
|
|
@ -66,7 +66,7 @@ const tableData: TableConfig = {
|
||||||
label: "学校名称",
|
label: "学校名称",
|
||||||
width: "300px",
|
width: "300px",
|
||||||
search: true,
|
search: true,
|
||||||
searchType: "Like",
|
searchType: ConditionalType.Like,
|
||||||
add: true, // 字段允许添加
|
add: true, // 字段允许添加
|
||||||
edit: true // 字段允许修改
|
edit: true // 字段允许修改
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -233,7 +233,7 @@ import {
|
||||||
editUser,
|
editUser,
|
||||||
Position
|
Position
|
||||||
} from "@/api/userCenter";
|
} from "@/api/userCenter";
|
||||||
import PositionForm from "./positionForm.vue";
|
import PositionForm from "../teacher/positionForm.vue";
|
||||||
import { getenum, getenumDic } from "@/api/enum";
|
import { getenum, getenumDic } from "@/api/enum";
|
||||||
import { ruleRequired, rulePhone } from "@/utils/rules";
|
import { ruleRequired, rulePhone } from "@/utils/rules";
|
||||||
import { ElMessage } from "element-plus";
|
import { ElMessage } from "element-plus";
|
||||||
|
|
@ -0,0 +1,855 @@
|
||||||
|
<template>
|
||||||
|
<div class="app-container" style="padding: 5px">
|
||||||
|
<div class="search-container" style="padding-top: 5px">
|
||||||
|
<!-- 搜索项目 -->
|
||||||
|
<el-form :inline="true" :model="search">
|
||||||
|
<el-form-item>
|
||||||
|
<el-input v-model="search.searchStr" placeholder="姓名/账号/学号" />
|
||||||
|
</el-form-item>
|
||||||
|
<!-- <el-form-item style="width: 100px">
|
||||||
|
<el-select
|
||||||
|
v-model="search.userType"
|
||||||
|
placeholder="用户类型"
|
||||||
|
clearable
|
||||||
|
filterable
|
||||||
|
@change="userTypeChange"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in userTypeList"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.text"
|
||||||
|
:value="item.value"
|
||||||
|
>
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item> -->
|
||||||
|
|
||||||
|
<el-form-item v-show="search.userType === 1" style="width: 100px">
|
||||||
|
<el-select
|
||||||
|
v-model="search.level"
|
||||||
|
placeholder="学生层次"
|
||||||
|
clearable
|
||||||
|
filterable
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in userLevelList"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.text"
|
||||||
|
:value="item.value"
|
||||||
|
>
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item>
|
||||||
|
<el-select
|
||||||
|
v-model="search.schoolId"
|
||||||
|
placeholder="学校"
|
||||||
|
clearable
|
||||||
|
filterable
|
||||||
|
@change="schoolChange"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in schoolList"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.text"
|
||||||
|
:value="item.value"
|
||||||
|
>
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item style="width: 100px">
|
||||||
|
<el-select
|
||||||
|
v-model="search.grade"
|
||||||
|
placeholder="年级"
|
||||||
|
clearable
|
||||||
|
filterable
|
||||||
|
@change="gradeChange"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in gradeList"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.text"
|
||||||
|
:value="item.value"
|
||||||
|
>
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item style="width: 100px">
|
||||||
|
<el-select
|
||||||
|
v-model="search.classId"
|
||||||
|
placeholder="班级"
|
||||||
|
clearable
|
||||||
|
filterable
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in classList"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.text"
|
||||||
|
:value="item.value"
|
||||||
|
>
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item style="width: 100px">
|
||||||
|
<el-select
|
||||||
|
v-model="search.subjectId"
|
||||||
|
placeholder="科目"
|
||||||
|
clearable
|
||||||
|
filterable
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in subjectList"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.text"
|
||||||
|
:value="item.value"
|
||||||
|
>
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" @click="handleReloadPaged" :icon="Search"
|
||||||
|
>查询</el-button
|
||||||
|
>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item v-show="selectUser">
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
@click="selectUserCallBack()"
|
||||||
|
icon="el-icon-check"
|
||||||
|
>选择用户</el-button
|
||||||
|
>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
<div class="toolbar-container" v-show="!selectUser">
|
||||||
|
<!-- 按钮组 -->
|
||||||
|
<el-button type="success" @click="importData">导入用户</el-button>
|
||||||
|
<el-button type="default" @click="downLoadImportUsersTemplate"
|
||||||
|
>下载导入用户模板</el-button
|
||||||
|
>
|
||||||
|
<el-button title="根据当前筛选条件导出" type="success" @click="exportUser"
|
||||||
|
>导出用户</el-button
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
<div class="toolbar-container" v-show="!selectUser">
|
||||||
|
<!-- 按钮组 -->
|
||||||
|
<el-button type="success" @click="AddDialog" plain>新增</el-button>
|
||||||
|
</div>
|
||||||
|
<el-table
|
||||||
|
@row-dblclick="setCurrent"
|
||||||
|
@row-click="selectUserClick"
|
||||||
|
ref="selectUserTable"
|
||||||
|
:data="table.data"
|
||||||
|
@selection-change="handleSelectionChange"
|
||||||
|
style="width: 100%"
|
||||||
|
:max-height="maxTableHeight"
|
||||||
|
>
|
||||||
|
<!-- <el-table-column type="selection" width="40" /> -->
|
||||||
|
<el-table-column label="操作" width="100">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button text type="primary" @click="EditDialog(scope.row)" plain
|
||||||
|
>修改</el-button
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column prop="id" label="用户Id" width="100" />
|
||||||
|
<el-table-column label="用户信息" width="200">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-tag
|
||||||
|
:type="getUserTypeTag(scope.row.userType)"
|
||||||
|
style="margin-right: 5px"
|
||||||
|
>{{
|
||||||
|
userTypeList.find(s => s.value == scope.row.userType)?.text
|
||||||
|
}}</el-tag
|
||||||
|
>
|
||||||
|
<span>{{ scope.row.realName }} </span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column prop="account" label="账号" width="120" />
|
||||||
|
<el-table-column prop="phone" label="手机号" width="120" />
|
||||||
|
|
||||||
|
<!-- <el-table-column prop="studentId" label="学号" width="120" />
|
||||||
|
<el-table-column prop="gKSubject" label="新高考学科" width="150" /> -->
|
||||||
|
|
||||||
|
<el-table-column label="所属班级">
|
||||||
|
<template #default="scope">
|
||||||
|
<div
|
||||||
|
v-for="(position, index) in scope.row.positions"
|
||||||
|
:key="'Position' + index"
|
||||||
|
v-show="
|
||||||
|
index < 3 || (index >= 3 && showAllPosition.includes(scope.row))
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<div v-if="position.enable === false">
|
||||||
|
<el-tag type="info">{{ position.schoolName || "-" }}</el-tag>
|
||||||
|
<el-tag type="info">{{
|
||||||
|
position.graduationYear ? position.graduationYear + "届" : "-"
|
||||||
|
}}</el-tag>
|
||||||
|
<el-tag type="info">{{ position.grade || "-" }}</el-tag>
|
||||||
|
<el-tag type="info">{{ position.className || "-" }}</el-tag>
|
||||||
|
<el-tag type="info">{{ position.name || "-" }}</el-tag>
|
||||||
|
</div>
|
||||||
|
<div class="subjectTagEnableDiv" v-else>
|
||||||
|
<el-tag>{{ position.schoolName || "-" }}</el-tag>
|
||||||
|
<el-tag type="warning">{{
|
||||||
|
position.graduationYear ? position.graduationYear + "届" : "-"
|
||||||
|
}}</el-tag>
|
||||||
|
<el-tag type="success">{{ position.grade || "-" }}</el-tag>
|
||||||
|
<el-tag type="primary" class="classTag">{{
|
||||||
|
position.className || "-"
|
||||||
|
}}</el-tag>
|
||||||
|
<el-tag type="danger">{{ position.name || "-" }}</el-tag>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
v-if="
|
||||||
|
scope.row.positions != undefined && scope.row.positions.length > 3
|
||||||
|
"
|
||||||
|
@click="showPosition(scope.row)"
|
||||||
|
class="userTagRow"
|
||||||
|
>
|
||||||
|
<el-icon
|
||||||
|
title="折叠职位"
|
||||||
|
class="userTagRowItop"
|
||||||
|
v-if="showAllPosition.includes(scope.row)"
|
||||||
|
><ArrowDownBold
|
||||||
|
/></el-icon>
|
||||||
|
<el-icon v-else title="展开更多职位"><ArrowDownBold /></el-icon>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<el-pagination
|
||||||
|
@size-change="pageSizeChange"
|
||||||
|
@current-change="pageIndexChange"
|
||||||
|
:current-page="pagination.total + 1"
|
||||||
|
:page-sizes="[10, 20, 40, 80, 100]"
|
||||||
|
:page-size="pagination.size"
|
||||||
|
layout="prev, pager, next,sizes, total"
|
||||||
|
:total="pagination.total"
|
||||||
|
/>
|
||||||
|
<div class="dialog-container">
|
||||||
|
<el-dialog
|
||||||
|
v-if="dialog.update.visible"
|
||||||
|
ref="UserEditFromDialog"
|
||||||
|
:title="dialog.update.title"
|
||||||
|
v-model="dialog.update.visible"
|
||||||
|
:width="dialog.update.width"
|
||||||
|
:close-on-click-modal="dialog.close"
|
||||||
|
:close-on-press-escape="dialog.close"
|
||||||
|
append-to-body
|
||||||
|
>
|
||||||
|
<UserForm :id="editId" @handlePagedCallback="handleAddCallback" />
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, reactive, onMounted } from "vue";
|
||||||
|
import { ElMessage, ElMessageBox } from "element-plus";
|
||||||
|
import type { UploadProps } from "element-plus";
|
||||||
|
import UserForm from "./edit.vue";
|
||||||
|
|
||||||
|
import {
|
||||||
|
getSchoolData,
|
||||||
|
getClassCombo,
|
||||||
|
getSubjectData,
|
||||||
|
getPageUserList,
|
||||||
|
UserDetail,
|
||||||
|
Position
|
||||||
|
} from "@/api/userCenter";
|
||||||
|
import { getenum } from "@/api/enum";
|
||||||
|
import { hTableAPI } from "@/api/hTable";
|
||||||
|
import { text } from "stream/consumers";
|
||||||
|
import {
|
||||||
|
Check,
|
||||||
|
Delete,
|
||||||
|
Edit,
|
||||||
|
Message,
|
||||||
|
ArrowDownBold,
|
||||||
|
Search,
|
||||||
|
Star
|
||||||
|
} from "@element-plus/icons-vue";
|
||||||
|
import { ComboModel } from "@/components/hTable/hTable";
|
||||||
|
|
||||||
|
const classAPI = new hTableAPI("usercenter/back/classes");
|
||||||
|
const schoolsAPI = new hTableAPI("usercenter/back/schools");
|
||||||
|
|
||||||
|
interface SearchParams {
|
||||||
|
searchStr: string;
|
||||||
|
userType: string | number;
|
||||||
|
level: string | number;
|
||||||
|
schoolId: string | number;
|
||||||
|
graduationYear: string | number;
|
||||||
|
grade: string;
|
||||||
|
classId: string | number;
|
||||||
|
subjectId: string | number;
|
||||||
|
positionId: string | number;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface TableData {
|
||||||
|
data: UserDetail[];
|
||||||
|
selectRows: UserDetail[];
|
||||||
|
sort: string;
|
||||||
|
border: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface PaginationData {
|
||||||
|
index: number;
|
||||||
|
size: number;
|
||||||
|
total: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface DialogData {
|
||||||
|
close: boolean;
|
||||||
|
update: {
|
||||||
|
title: string;
|
||||||
|
visible: boolean;
|
||||||
|
width: string;
|
||||||
|
};
|
||||||
|
editLevel: {
|
||||||
|
userIds: number[];
|
||||||
|
title: string;
|
||||||
|
visible: boolean;
|
||||||
|
width: string;
|
||||||
|
};
|
||||||
|
editSubjectLevel: {
|
||||||
|
userIds: number[];
|
||||||
|
title: string;
|
||||||
|
visible: boolean;
|
||||||
|
width: string;
|
||||||
|
};
|
||||||
|
bindUser: {
|
||||||
|
title: string;
|
||||||
|
visible: boolean;
|
||||||
|
width: string;
|
||||||
|
height: string;
|
||||||
|
};
|
||||||
|
userBindInfo: {
|
||||||
|
title: string;
|
||||||
|
visible: boolean;
|
||||||
|
width: string;
|
||||||
|
height: string;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
selectUser: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
selectCallBack: {
|
||||||
|
type: Function,
|
||||||
|
default: () => {}
|
||||||
|
},
|
||||||
|
maxTableHeight: {
|
||||||
|
type: Number,
|
||||||
|
default: 580
|
||||||
|
},
|
||||||
|
searchData: {
|
||||||
|
type: Object as () => SearchParams,
|
||||||
|
default: undefined
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const baseUrl = import.meta.env.VITE_APP_BASE_API;
|
||||||
|
const excelImportUsersUrl = `${baseUrl}api/back/users/downloadimportusersexceltemplate`;
|
||||||
|
const excelImportMeetingUrl = `${baseUrl}api/back/users/downloadimportmeetingexceltemplate`;
|
||||||
|
const excelImportOrdersUrl = `${baseUrl}api/back/users/downloadimportordersexceltemplate`;
|
||||||
|
|
||||||
|
const editId = ref(0);
|
||||||
|
const showAllPosition = ref<UserDetail[]>([]);
|
||||||
|
const selectUserTable = ref();
|
||||||
|
|
||||||
|
const search = reactive<SearchParams>({
|
||||||
|
searchStr: "",
|
||||||
|
userType: "",
|
||||||
|
level: "",
|
||||||
|
schoolId: "",
|
||||||
|
graduationYear: "",
|
||||||
|
grade: "",
|
||||||
|
classId: "",
|
||||||
|
subjectId: "",
|
||||||
|
positionId: ""
|
||||||
|
});
|
||||||
|
|
||||||
|
const userTypeList = ref<ComboModel[]>([
|
||||||
|
{ value: 1, text: "学生" },
|
||||||
|
{ value: 2, text: "教师" },
|
||||||
|
{ value: 3, text: "管理员" }
|
||||||
|
]);
|
||||||
|
|
||||||
|
const userLevelList = ref<ComboModel[]>([]);
|
||||||
|
const schoolList = ref<ComboModel[]>([]);
|
||||||
|
const gradeList = ref<ComboModel[]>([
|
||||||
|
{ value: "初一", text: "初一" },
|
||||||
|
{ value: "初二", text: "初二" },
|
||||||
|
{ value: "初三", text: "初三" },
|
||||||
|
{ value: "高一", text: "高一" },
|
||||||
|
{ value: "高二", text: "高二" },
|
||||||
|
{ value: "高三", text: "高三" }
|
||||||
|
]);
|
||||||
|
const classList = ref<ComboModel[]>([]);
|
||||||
|
const subjectList = ref<ComboModel[]>([]);
|
||||||
|
const positionList = ref<any[]>([]);
|
||||||
|
|
||||||
|
const table = reactive<TableData>({
|
||||||
|
data: [],
|
||||||
|
selectRows: [],
|
||||||
|
sort: "",
|
||||||
|
border: true
|
||||||
|
});
|
||||||
|
|
||||||
|
const pagination = reactive<PaginationData>({
|
||||||
|
index: 1,
|
||||||
|
size: 10,
|
||||||
|
total: 0
|
||||||
|
});
|
||||||
|
|
||||||
|
const dialog = reactive<DialogData>({
|
||||||
|
close: false,
|
||||||
|
update: {
|
||||||
|
title: "",
|
||||||
|
visible: false,
|
||||||
|
width: "800px"
|
||||||
|
},
|
||||||
|
editLevel: {
|
||||||
|
userIds: [],
|
||||||
|
title: "",
|
||||||
|
visible: false,
|
||||||
|
width: "400px"
|
||||||
|
},
|
||||||
|
editSubjectLevel: {
|
||||||
|
userIds: [],
|
||||||
|
title: "",
|
||||||
|
visible: false,
|
||||||
|
width: "450px"
|
||||||
|
},
|
||||||
|
bindUser: {
|
||||||
|
title: "分配权限码",
|
||||||
|
visible: false,
|
||||||
|
width: "1150px",
|
||||||
|
height: ""
|
||||||
|
},
|
||||||
|
userBindInfo: {
|
||||||
|
title: "用户权限码",
|
||||||
|
visible: false,
|
||||||
|
width: "1150px",
|
||||||
|
height: ""
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const checkUserBindInfo = () => {
|
||||||
|
if (table.selectRows.length != 1) {
|
||||||
|
ElMessage.warning("请选择一个用户");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
dialog.userBindInfo.visible = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
const showPosition = (row: UserDetail) => {
|
||||||
|
if (showAllPosition.value.includes(row)) {
|
||||||
|
showAllPosition.value.splice(showAllPosition.value.indexOf(row), 1);
|
||||||
|
} else {
|
||||||
|
showAllPosition.value.push(row);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const codeBindUser = () => {
|
||||||
|
if (table.selectRows.length == 0) {
|
||||||
|
ElMessage.warning("请选择需要分配权限的用户");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
dialog.bindUser.visible = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
const initSearchData = () => {
|
||||||
|
if (props.searchData !== undefined) {
|
||||||
|
for (const key in props.searchData) {
|
||||||
|
search[key] = props.searchData[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const selectUserClick = (row: UserDetail) => {
|
||||||
|
if (props.selectUser) {
|
||||||
|
selectUserTable.value.toggleRowSelection(row);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const setCurrent = (row: UserDetail) => {
|
||||||
|
selectUserTable.value.toggleRowSelection(row);
|
||||||
|
};
|
||||||
|
|
||||||
|
const selectUserCallBack = () => {
|
||||||
|
const u = table.selectRows;
|
||||||
|
props.selectCallBack(u);
|
||||||
|
selectUserTable.value.clearSelection();
|
||||||
|
};
|
||||||
|
|
||||||
|
const exportUser = async () => {
|
||||||
|
const data = {
|
||||||
|
SearchStr: search.searchStr,
|
||||||
|
UserType: search.userType || 0,
|
||||||
|
Level: search.level || 0,
|
||||||
|
SchoolId: search.schoolId || 0,
|
||||||
|
GraduationYear: search.graduationYear || 0,
|
||||||
|
Grade: search.grade,
|
||||||
|
ClassId: search.classId || 0,
|
||||||
|
SubjectId: search.subjectId || 0,
|
||||||
|
PositionId: search.positionId || 0,
|
||||||
|
PageIndex: pagination.index,
|
||||||
|
PageSize: pagination.size
|
||||||
|
};
|
||||||
|
|
||||||
|
// const res = await exportUserApi(data);
|
||||||
|
// if (res.type === "application/json") {
|
||||||
|
// const json = await readerBlob(res);
|
||||||
|
// if (json !== undefined && json.code !== 200) {
|
||||||
|
// ElMessage.error(json.Message);
|
||||||
|
// }
|
||||||
|
// } else if (res !== undefined && res.size !== 0) {
|
||||||
|
// ElMessage.success("导出成功,下载中🕖请稍等");
|
||||||
|
// const url = window.URL.createObjectURL(res);
|
||||||
|
// const link = document.createElement("a");
|
||||||
|
// link.href = url;
|
||||||
|
// link.setAttribute("download", "导出用户信息.xlsx");
|
||||||
|
// document.body.appendChild(link);
|
||||||
|
// link.click();
|
||||||
|
// document.body.removeChild(link);
|
||||||
|
// } else {
|
||||||
|
// ElMessage.warning("导出失败,无有效数据");
|
||||||
|
// }
|
||||||
|
};
|
||||||
|
|
||||||
|
const fetchInitData = async () => {
|
||||||
|
schoolList.value = (await getSchoolData()).data;
|
||||||
|
subjectList.value = (await getenum("SubjectEnum")).data;
|
||||||
|
userLevelList.value = (await getenum("StudentLevelEnum")).data;
|
||||||
|
userTypeList.value = (await getenum("UserTypeEnum")).data;
|
||||||
|
};
|
||||||
|
|
||||||
|
const userTypeChange = () => {
|
||||||
|
search.level = "";
|
||||||
|
};
|
||||||
|
|
||||||
|
const schoolChange = () => {
|
||||||
|
search.graduationYear = "";
|
||||||
|
search.grade = "";
|
||||||
|
search.classId = "";
|
||||||
|
search.subjectId = "";
|
||||||
|
getClass();
|
||||||
|
};
|
||||||
|
|
||||||
|
const gradeChange = () => {
|
||||||
|
search.classId = "";
|
||||||
|
search.subjectId = "";
|
||||||
|
getClass();
|
||||||
|
};
|
||||||
|
|
||||||
|
const getClass = () => {
|
||||||
|
const data = {
|
||||||
|
schoolId: search.schoolId || 0,
|
||||||
|
graduationYear: search.graduationYear || 0,
|
||||||
|
grade: search.grade
|
||||||
|
};
|
||||||
|
getClassCombo(data).then(res => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
classList.value = res.data;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const fetchPagedData = (searchUnUse = false) => {
|
||||||
|
const data = {
|
||||||
|
SearchStr: search.searchStr,
|
||||||
|
UserType: 1, // 只查询学生
|
||||||
|
Level: search.level || 0,
|
||||||
|
SchoolId: search.schoolId || 0,
|
||||||
|
GraduationYear: search.graduationYear || 0,
|
||||||
|
Grade: search.grade,
|
||||||
|
ClassId: search.classId || 0,
|
||||||
|
SubjectId: search.subjectId || 0,
|
||||||
|
PositionId: search.positionId || 0,
|
||||||
|
PageIndex: pagination.index,
|
||||||
|
PageSize: pagination.size,
|
||||||
|
UnUsed: searchUnUse
|
||||||
|
};
|
||||||
|
getPageUserList(data).then(res => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
pagination.total = res.data.total;
|
||||||
|
res.data.data.forEach(item => {
|
||||||
|
if (item.positions) {
|
||||||
|
item.positions = PositionsSort(item.positions);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
table.data = res.data.data;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleSelectionChange = (selection: UserDetail[]) => {
|
||||||
|
table.selectRows = selection;
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleDelete = () => {
|
||||||
|
// if (table.selectRows.length === 0) {
|
||||||
|
// ElMessage.warning("未勾选记录");
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// const ids: number[] = [];
|
||||||
|
// table.selectRows.forEach(it => {
|
||||||
|
// ids.push(it.Id);
|
||||||
|
// });
|
||||||
|
// ElMessageBox.confirm("此操作将永久删除勾选记录, 是否继续?", "提示", {
|
||||||
|
// confirmButtonText: "确定",
|
||||||
|
// cancelButtonText: "取消",
|
||||||
|
// type: "warning"
|
||||||
|
// }).then(() => {
|
||||||
|
// delUser(ids).then(res => {
|
||||||
|
// if (res.code === 200) {
|
||||||
|
// handleReloadPaged();
|
||||||
|
// ElMessage.success("删除成功");
|
||||||
|
// } else {
|
||||||
|
// ElMessage.error(res.Message);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleRestPass = async () => {
|
||||||
|
// if (table.selectRows.length === 0) {
|
||||||
|
// ElMessage.warning("未勾选记录");
|
||||||
|
// } else {
|
||||||
|
// const ids: number[] = [];
|
||||||
|
// table.selectRows.forEach(it => {
|
||||||
|
// ids.push(it.Id);
|
||||||
|
// });
|
||||||
|
// try {
|
||||||
|
// await ElMessageBox.confirm("是否需要重置选中用户的密码?", "提示", {
|
||||||
|
// confirmButtonText: "确定",
|
||||||
|
// cancelButtonText: "取消",
|
||||||
|
// type: "warning"
|
||||||
|
// });
|
||||||
|
// const res = await restUserPass(ids);
|
||||||
|
// if (res.code === 200) {
|
||||||
|
// ElMessage.success("重置成功");
|
||||||
|
// } else {
|
||||||
|
// ElMessage.error("重置失败");
|
||||||
|
// }
|
||||||
|
// } catch (error) {
|
||||||
|
// // User cancelled
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
};
|
||||||
|
|
||||||
|
const getUserTypeTag = (type: number) => {
|
||||||
|
return type === 1 ? "info" : "warning";
|
||||||
|
};
|
||||||
|
|
||||||
|
const getUserLevelTag = (level: number) => {
|
||||||
|
return level === 0
|
||||||
|
? "info"
|
||||||
|
: level === 1
|
||||||
|
? "success"
|
||||||
|
: level === 2
|
||||||
|
? "warning"
|
||||||
|
: "error";
|
||||||
|
};
|
||||||
|
|
||||||
|
const getUserLevelText = (level: number) => {
|
||||||
|
const r = userLevelList.value.filter(w => w.value === level);
|
||||||
|
if (r.length > 0) {
|
||||||
|
return r[0].text;
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
};
|
||||||
|
|
||||||
|
const PositionsSort = (arr: Position[]) => {
|
||||||
|
arr.sort((a, b) => {
|
||||||
|
if (a.enable === b.enable) {
|
||||||
|
return 0;
|
||||||
|
} else if (a.enable) {
|
||||||
|
return -1;
|
||||||
|
} else {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return arr;
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleReloadPaged = (event?: any, searchUnUse?: boolean) => {
|
||||||
|
pagination.index = 1;
|
||||||
|
table.selectRows = [];
|
||||||
|
fetchPagedData(searchUnUse);
|
||||||
|
};
|
||||||
|
|
||||||
|
function pageSizeChange(o) {
|
||||||
|
pagination.size = o;
|
||||||
|
fetchPagedData();
|
||||||
|
}
|
||||||
|
function pageIndexChange(o) {
|
||||||
|
pagination.index = o - 1;
|
||||||
|
fetchPagedData();
|
||||||
|
}
|
||||||
|
|
||||||
|
const AddDialog = () => {
|
||||||
|
editId.value = 0;
|
||||||
|
dialog.update.title = "添加用户";
|
||||||
|
dialog.update.visible = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
const EditDialog = (row?) => {
|
||||||
|
if (row == null && table.selectRows.length !== 1) {
|
||||||
|
ElMessage.warning("请选择要修改用户");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
dialog.update.title = "修改用户";
|
||||||
|
editId.value = row != null ? row.id : table.selectRows[0].id;
|
||||||
|
dialog.update.visible = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleAddCallback = () => {
|
||||||
|
dialog.update.visible = false;
|
||||||
|
handleReloadPaged();
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleEditLevel = () => {
|
||||||
|
if (table.selectRows.length === 0) {
|
||||||
|
ElMessage.warning("请选择要修改用户");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
dialog.editLevel.title = "修改学生层次";
|
||||||
|
dialog.editLevel.userIds = table.selectRows.map(w => w.id);
|
||||||
|
dialog.editLevel.visible = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleEditLevelCallback = () => {
|
||||||
|
dialog.editLevel.visible = false;
|
||||||
|
handleReloadPaged();
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleEditSubjectLevel = () => {
|
||||||
|
if (table.selectRows.length === 0) {
|
||||||
|
ElMessage.warning("请选择要修改用户");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
dialog.editSubjectLevel.title = "修改学生科目层次";
|
||||||
|
dialog.editSubjectLevel.userIds = table.selectRows.map(w => w.id);
|
||||||
|
dialog.editSubjectLevel.visible = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleEditSubjectLevelCallback = () => {
|
||||||
|
dialog.editSubjectLevel.visible = false;
|
||||||
|
handleReloadPaged();
|
||||||
|
};
|
||||||
|
|
||||||
|
const importData = () => {
|
||||||
|
// const fileE = document.createElement("input");
|
||||||
|
// fileE.type = "file";
|
||||||
|
// const formData = new FormData();
|
||||||
|
// fileE.onchange = async function () {
|
||||||
|
// formData.append("File", fileE.files![0]);
|
||||||
|
// const res = await ImporExportTemplate(formData);
|
||||||
|
// if (res.type === "application/json") {
|
||||||
|
// const json = await readerBlob(res);
|
||||||
|
// if (json !== undefined && json.code !== 200) {
|
||||||
|
// return ElMessage.error(json.Message);
|
||||||
|
// } else {
|
||||||
|
// return ElMessage.success("操作成功,没有重复数据");
|
||||||
|
// }
|
||||||
|
// } else if (res === undefined || res.size === 0) {
|
||||||
|
// ElMessage.success("操作成功,没有重复数据");
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// const url = res && window.URL.createObjectURL(res);
|
||||||
|
// const link = document.createElement("a");
|
||||||
|
// link.href = url;
|
||||||
|
// link.setAttribute("download", "未成功导入的用户.xlsx");
|
||||||
|
// document.body.appendChild(link);
|
||||||
|
// link.click();
|
||||||
|
// document.body.removeChild(link);
|
||||||
|
// ElMessage.success("操作成功,已导出重复数据");
|
||||||
|
// };
|
||||||
|
// try {
|
||||||
|
// fileE.click();
|
||||||
|
// } catch (error) {
|
||||||
|
// console.error(error);
|
||||||
|
// }
|
||||||
|
};
|
||||||
|
|
||||||
|
const readerBlob = (data: Blob): Promise<any> => {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
const reader = new FileReader();
|
||||||
|
reader.readAsText(data, "utf-8");
|
||||||
|
reader.onload = function () {
|
||||||
|
const dd = JSON.parse(reader.result as string);
|
||||||
|
resolve(dd);
|
||||||
|
};
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const downLoadImportUsersTemplate = () => {
|
||||||
|
window.open(excelImportUsersUrl, "_blank");
|
||||||
|
};
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
await initSearchData();
|
||||||
|
await fetchInitData();
|
||||||
|
fetchPagedData();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.userTagRowItop {
|
||||||
|
transform: rotate(180deg) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.userTagRow i {
|
||||||
|
padding-top: 3px;
|
||||||
|
transform: rotate(0deg);
|
||||||
|
font-size: 1.3rem;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.userTagRow {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
flex-wrap: nowrap;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.subjectTagEnableDiv {
|
||||||
|
display: flex;
|
||||||
|
padding: 3px;
|
||||||
|
gap: 5px;
|
||||||
|
}
|
||||||
|
.classTag {
|
||||||
|
color: #a3bf08 !important;
|
||||||
|
background-color: #f4fbd1 !important;
|
||||||
|
border-color: #f4fbd1 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.subjectTag {
|
||||||
|
color: #eb0de4 !important;
|
||||||
|
background-color: #fbd9ff !important;
|
||||||
|
border-color: #fbd9ff !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.subjectlevel_ul {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
list-style: none;
|
||||||
|
}
|
||||||
|
.toolbar-container {
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Loading…
Reference in New Issue