新增 排序功能

优化 旧版本配置
This commit is contained in:
小肥羊 2025-09-04 18:34:14 +08:00
parent 85a4ee0ef6
commit 492a3e8163
14 changed files with 245 additions and 304 deletions

View File

@ -7,12 +7,12 @@ VITE_PUBLIC_PATH = /
# 开发环境路由历史模式Hash模式传"hash"、HTML5模式传"h5"、Hash模式带base参数传"hash,base参数"、HTML5模式带base参数传"h5,base参数" # 开发环境路由历史模式Hash模式传"hash"、HTML5模式传"h5"、Hash模式带base参数传"hash,base参数"、HTML5模式带base参数传"h5,base参数"
VITE_ROUTER_HISTORY = "hash" VITE_ROUTER_HISTORY = "hash"
# # 接口地址
# VITE_API_BASEURL = "http://192.168.2.33:5199/api"
# #数据中心后台地址
# VITE_API_USERCENTER_URL = "https://dca.w.23544.com:8843/api"
# 接口地址 # 接口地址
VITE_API_BASEURL = "https://learn-archives-admin-dev.23544.com/api" VITE_API_BASEURL = "http://192.168.2.33:5199/api"
#数据中心后台地址 #数据中心后台地址
VITE_API_USERCENTER_URL = "https://dca.w.23544.com:8843/api" VITE_API_USERCENTER_URL = "https://dca.w.23544.com:8843/api"
# # 接口地址
# VITE_API_BASEURL = "https://learn-archives-admin-dev.23544.com/api"
# #数据中心后台地址
# VITE_API_USERCENTER_URL = "https://dca.w.23544.com:8843/api"

View File

@ -181,7 +181,7 @@ export class TableColumnSearch {
* @param searchType * @param searchType
*/ */
constructor(yes: boolean = false, constructor(yes: boolean = false,
searchType: ConditionalType = ConditionalType.Like,sort: boolean = false,){ searchType: ConditionalType = ConditionalType.Like,sort: boolean = false){
this.yes = yes; this.yes = yes;
this.sort = sort; this.sort = sort;
this.searchType = searchType; this.searchType = searchType;

View File

@ -15,7 +15,7 @@ import {
} from "vue"; } from "vue";
import { Search } from "@element-plus/icons-vue"; import { Search } from "@element-plus/icons-vue";
import { ElMessage, ElMessageBox } from "element-plus"; import { ElMessage, ElMessageBox, TableColumnCtx } from "element-plus";
import { defineAsyncComponent, AsyncComponentLoader } from "vue"; import { defineAsyncComponent, AsyncComponentLoader } from "vue";
import { import {
ButtonCustomConfig, ButtonCustomConfig,
@ -77,6 +77,7 @@ let Api: hTableAPI = null;
const init = ref(false); const init = ref(false);
const tableHeight = ref(0); const tableHeight = ref(0);
let defaultOrderBy = null;
const dialog = ref<Dialog>({ const dialog = ref<Dialog>({
visible: false, visible: false,
@ -251,6 +252,21 @@ function pageIndexChange(o) {
table.value.search.PageIndex = o - 1; table.value.search.PageIndex = o - 1;
fetchPagedData(); fetchPagedData();
} }
/**
* 排序变化时
* @param selection
*/
function sortChange(data: { column: TableColumnCtx<any>; prop: string; order: any }) {
if (data.order == undefined) {
table.value.search.OrderBy = defaultOrderBy.OrderBy;
table.value.search.OrderByType = defaultOrderBy.OrderByType;
} else {
table.value.search.OrderBy = data.prop;
table.value.search.OrderByType = data.order === "ascending" ? 1 : 0;
}
handleReloadPaged();
}
// //
function handleSelectionChange(selection) { function handleSelectionChange(selection) {
console.log("selection-change", selection); console.log("selection-change", selection);
@ -272,6 +288,12 @@ function searchReload() {
} }
// //
function handleReloadPaged(reload = true) { function handleReloadPaged(reload = true) {
if (defaultOrderBy == null) {
defaultOrderBy = {
OrderBy: table.value.search.OrderBy,
OrderByType: table.value.search.OrderByType,
};
}
if (table.value.search === undefined || table.value.search.PageIndex === undefined) { if (table.value.search === undefined || table.value.search.PageIndex === undefined) {
table.value.search.PageIndex = 0; table.value.search.PageIndex = 0;
table.value.search.PageSize = 20; table.value.search.PageSize = 20;
@ -358,7 +380,7 @@ function fetchPagedData() {
<div ref="appB_S" class="search-container1"> <div ref="appB_S" class="search-container1">
<!-- 搜索项目 --> <!-- 搜索项目 -->
<el-form v-if="table.search.show" :inline="true" :model="table.search"> <el-form v-if="table.search.show" :inline="true" :model="table.search">
<el-form-item v-for="(o, n, i) in table.column" v-show="o.search" :key="i"> <el-form-item v-for="(o, n, i) in table.column" v-show="o.search.yes" :key="i">
<el-date-picker <el-date-picker
v-if="o.type.trim() == 'datetime'" v-if="o.type.trim() == 'datetime'"
v-model="o.search.value as Date" v-model="o.search.value as Date"
@ -465,6 +487,7 @@ function fetchPagedData() {
style="width: 100%" style="width: 100%"
:row-key="rowKeyFun" :row-key="rowKeyFun"
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
@sort-change="sortChange"
> >
<el-table-column v-if="table.selectColumn" type="selection" width="40" /> <el-table-column v-if="table.selectColumn" type="selection" width="40" />
<el-table-column <el-table-column
@ -500,6 +523,7 @@ function fetchPagedData() {
:prop="name" :prop="name"
:label="item.label" :label="item.label"
:width="item.width" :width="item.width"
:sortable="item.search.sort ? `custom` : false"
> >
<template v-slot="scope"> <template v-slot="scope">
<div class="columnTemplate"> <div class="columnTemplate">

View File

@ -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 { ConditionalType, TableConfig } from "@/components/hTable/hTable"; import { ConditionalType, intTableData, TableConfig } from "@/components/hTable/hTable";
import { onMounted, ref, defineOptions } from "vue"; import { onMounted, ref, defineOptions } 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";
@ -29,7 +29,7 @@ function searchCallback(data) {
} }
const RoleApi = new hTableAPI("AdminRole"); const RoleApi = new hTableAPI("AdminRole");
const table = ref<{ initTable: (config: TableConfig) => void }>(null); const table = ref<{ initTable: (config: TableConfig) => void }>(null);
const tableData: TableConfig = { const tableData: TableConfig = intTableData({
apiUrl: ControllerName, apiUrl: ControllerName,
selectColumn: false, // selectColumn: false, //
border: false, // border: false, //
@ -70,63 +70,41 @@ const tableData: TableConfig = {
// //
id: { id: {
label: "编号", label: "编号",
search: true, search: { yes: true, searchType: ConditionalType.Equal },
add: false, //
edit: false, //
width: "150px", width: "150px",
}, },
name: { name: {
label: "名称", label: "名称",
width: "180px", width: "180px",
rules: ruleRequiredI(12, 2), search: { yes: true, searchType: ConditionalType.Like },
search: true, edit: { add: true, edit: true, rules: ruleRequiredI(12, 2) },
searchType: ConditionalType.Like,
add: true, //
edit: true, //
}, },
phone: { phone: {
label: "手机号", label: "手机号",
rules: rulePhone,
width: "200px", width: "200px",
search: true, search: { yes: true, searchType: ConditionalType.Like },
add: true, // edit: { add: true, edit: true, rules: rulePhone },
edit: true, //
}, },
account: { account: {
label: "账号", label: "账号",
rules: ruleRequiredI(20, 8), search: { yes: true },
search: true, edit: { add: true, edit: false, rules: ruleRequiredI(20, 8) },
add: true, //
edit: false, //
}, },
password: { password: {
label: "密码", label: "密码",
show: false, show: false,
/**长度必须大于6 */ edit: { add: true, edit: false, rules: ruleRequiredI(32, 6) },
rules: ruleRequiredI(32, 6),
search: false,
add: true, //
edit: false, //
}, },
enable: { enable: {
label: "启用", label: "启用",
type: "switch", type: "switch",
search: false, edit: { add: true, edit: true, editDefault: true },
add: true, //
edit: true, //
valueE: true, //
}, },
roleId: { roleId: {
label: "角色", label: "角色",
type: "dropdown", type: "dropdown",
rules: ruleRequired, search: { yes: true },
search: true, edit: { add: true, edit: false, rules: ruleRequired },
add: true, //
edit: false, //
setting: {
datasource: [],
},
}, },
}, },
data: [], data: [],
@ -134,7 +112,7 @@ const tableData: TableConfig = {
total: 0, total: 0,
}, },
selectRows: [], selectRows: [],
}; });
const showTable = ref(false); const showTable = ref(false);
onMounted(async () => { onMounted(async () => {

View File

@ -1,6 +1,11 @@
<script setup lang="ts"> <script setup lang="ts">
import ahTable from "@/components/hTable/index.vue"; import ahTable from "@/components/hTable/index.vue";
import { ConditionalType, TableConfig } from "@/components/hTable/hTable"; import {
ConditionalType,
intTableData,
TableColumnSearch,
TableConfig,
} from "@/components/hTable/hTable";
import { onMounted, ref, defineOptions } from "vue"; import { onMounted, ref, defineOptions } 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";
@ -21,7 +26,7 @@ const props = defineProps<{
function searchCallback(data) {} function searchCallback(data) {}
const table = ref<{ initTable: (config: TableConfig) => void }>(); const table = ref<{ initTable: (config: TableConfig) => void }>();
const tableData: TableConfig = { const tableData: TableConfig = intTableData({
apiUrl: ControllerName, apiUrl: ControllerName,
selectColumn: false, // selectColumn: false, //
border: false, // border: false, //
@ -75,33 +80,22 @@ const tableData: TableConfig = {
// //
schoolName: { schoolName: {
label: "学校", label: "学校",
search: true,
searchType: ConditionalType.Like, //
add: false, //
edit: false, //
width: "180px", width: "180px",
search: new TableColumnSearch(true, ConditionalType.Like),
}, },
grade: { grade: {
label: "年级", label: "年级",
width: "100px", width: "100px",
search: true, search: new TableColumnSearch(true),
add: false, //
edit: false, //
}, },
className: { className: {
label: "班级", label: "班级",
width: "150px", width: "150px",
search: true, search: new TableColumnSearch(true, ConditionalType.Like),
searchType: ConditionalType.Like, //
add: false, //
edit: false, //
}, },
peopleCount: { peopleCount: {
label: "参考人数", label: "参考人数",
width: "100px", width: "100px",
search: false,
add: false, //
edit: false, //
}, },
// entryPerson: { // entryPerson: {
// label: "", // label: "",
@ -113,9 +107,6 @@ const tableData: TableConfig = {
createTime: { createTime: {
label: "录入时间", label: "录入时间",
width: "200px", width: "200px",
search: false,
add: false, //
edit: false, //
}, },
}, },
data: [], data: [],
@ -123,7 +114,7 @@ const tableData: TableConfig = {
total: 0, total: 0,
}, },
selectRows: [], selectRows: [],
}; });
async function deleteInfo(o, row, c) { async function deleteInfo(o, row, c) {
try { try {

View File

@ -1,6 +1,11 @@
<script setup lang="ts"> <script setup lang="ts">
import ahTable from "@/components/hTable/index.vue"; import ahTable from "@/components/hTable/index.vue";
import { ConditionalType, TableConfig } from "@/components/hTable/hTable"; import {
ConditionalType,
intTableData,
TableColumnSearch,
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";
@ -18,7 +23,7 @@ const props = defineProps<{
function searchCallback(data) {} function searchCallback(data) {}
const table = ref<{ initTable: (config: TableConfig) => void }>(); const table = ref<{ initTable: (config: TableConfig) => void }>();
const tableData: TableConfig = { const tableData: TableConfig = intTableData({
apiUrl: ControllerName, apiUrl: ControllerName,
selectColumn: false, // selectColumn: false, //
border: false, // border: false, //
@ -53,52 +58,39 @@ const tableData: TableConfig = {
// //
schoolName: { schoolName: {
label: "学校", label: "学校",
search: true,
searchType: ConditionalType.Like, //
add: false, //
edit: false, //
width: "180px", width: "180px",
search: new TableColumnSearch(true, ConditionalType.Like),
}, },
grade: { grade: {
label: "年级", label: "年级",
width: "120px", width: "120px",
// custom: (s) => `${s.gradeLevel}${s.gradeYear}`, search: new TableColumnSearch(true),
search: true,
add: false, //
edit: false, //
}, },
className: { className: {
label: "班级", label: "班级",
width: "80px", width: "80px",
search: true, search: new TableColumnSearch(true, ConditionalType.Like),
searchType: ConditionalType.Like, //
add: false, //
edit: false, //
}, },
examName: { examName: {
label: "最近考试", label: "最近考试",
width: "200px", width: "200px",
search: false,
}, },
peopleCount: { peopleCount: {
label: "参考人数", label: "参考人数",
width: "100px", width: "100px",
search: false,
}, },
onLineCount: { onLineCount: {
label: "重本人数", label: "重本人数",
width: "100px", width: "100px",
search: false,
}, },
onLineRate: { onLineRate: {
label: "重本率", label: "重本率",
width: "100px", width: "100px",
custom: (row) => `${row.onLineRate * 100}%`, custom: (row) => `${row.onLineRate * 100}%`,
search: false,
}, },
onLineRanking: { onLineRanking: {
label: "重本率排名", label: "重本率排名",
search: false, width: "100px",
}, },
}, },
data: [], data: [],
@ -106,7 +98,7 @@ const tableData: TableConfig = {
total: 0, total: 0,
}, },
selectRows: [], selectRows: [],
}; });
const showTable = ref(false); const showTable = ref(false);
onMounted(async () => { onMounted(async () => {

View File

@ -1,6 +1,11 @@
<script setup lang="ts"> <script setup lang="ts">
import ahTable from "@/components/hTable/index.vue"; import ahTable from "@/components/hTable/index.vue";
import { ConditionalType, TableConfig } from "@/components/hTable/hTable"; import {
ConditionalType,
intTableData,
TableColumnSearch,
TableConfig,
} from "@/components/hTable/hTable";
import { onMounted, ref, defineOptions } from "vue"; import { onMounted, ref, defineOptions } 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";
@ -22,7 +27,7 @@ const props = defineProps<{
function searchCallback(data) {} function searchCallback(data) {}
const table = ref<{ initTable: (config: TableConfig) => void }>(); const table = ref<{ initTable: (config: TableConfig) => void }>();
const tableData: TableConfig = { const tableData: TableConfig = intTableData({
apiUrl: `ExamClassInfo`, apiUrl: `ExamClassInfo`,
selectColumn: false, // selectColumn: false, //
border: false, // border: false, //
@ -63,76 +68,63 @@ const tableData: TableConfig = {
// //
examName: { examName: {
label: "考试名称", label: "考试名称",
search: true,
width: "150px", width: "150px",
search: new TableColumnSearch(true),
}, },
type: { type: {
label: "考试类型", label: "考试类型",
search: true,
type: "dropdown",
setting: {},
width: "80px", width: "80px",
type: "dropdown",
search: new TableColumnSearch(true),
}, },
testPaperType: { testPaperType: {
label: "试卷类型", label: "试卷类型",
search: true,
type: "dropdown",
setting: {},
width: "80px", width: "80px",
type: "dropdown",
search: new TableColumnSearch(true),
}, },
grade: { grade: {
label: "年级", label: "年级",
search: true,
// type: "dropdown",
// setting: {},
width: "60px", width: "60px",
search: new TableColumnSearch(true),
}, },
onLineCount: { onLineCount: {
label: "重本人数", label: "重本人数",
search: false,
width: "80px", width: "80px",
}, },
onLineRate: { onLineRate: {
label: "重本率", label: "重本率",
search: false,
custom: (row) => `${Math.round(row.onLineRate * 100)}%`, custom: (row) => `${Math.round(row.onLineRate * 100)}%`,
width: "80px", width: "80px",
}, },
onLineRanking: { onLineRanking: {
label: "重本率排名", label: "重本率排名",
search: false,
width: "100px", width: "100px",
}, },
maxScore: { maxScore: {
label: "最高分[赋分]", label: "最高分[赋分]",
search: false,
width: "140px", width: "140px",
}, },
minScore: { minScore: {
label: "最低分[赋分]", label: "最低分[赋分]",
search: false,
width: "140px", width: "140px",
}, },
average: { average: {
label: "总平均分[赋分]", label: "总平均分[赋分]",
search: false,
custom: (row) => `${Math.round(row.average)}`, custom: (row) => `${Math.round(row.average)}`,
width: "140px", width: "140px",
}, },
average1: { average1: {
label: "资源校平均分[赋分]", label: "资源校平均分[赋分]",
search: false,
width: "160px", width: "160px",
}, },
averageRank: { averageRank: {
label: "总平均分排名", label: "总平均分排名",
search: false,
width: "110px", width: "110px",
}, },
rank: { rank: {
label: "远端平均/资源校平均", label: "远端平均/资源校平均",
search: false,
width: "95px", width: "95px",
custom: (row) => custom: (row) =>
`${ `${
@ -147,7 +139,7 @@ const tableData: TableConfig = {
total: 0, total: 0,
}, },
selectRows: [], selectRows: [],
}; });
const showTable = ref(false); const showTable = ref(false);
onMounted(async () => { onMounted(async () => {

View File

@ -1,6 +1,11 @@
<script setup lang="ts"> <script setup lang="ts">
import ahTable from "@/components/hTable/index.vue"; import ahTable from "@/components/hTable/index.vue";
import { ConditionalType, TableConfig } from "@/components/hTable/hTable"; import {
ConditionalType,
intTableData,
TableColumnSearch,
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";
@ -24,7 +29,7 @@ defineOptions({
function searchCallback(data) {} function searchCallback(data) {}
const table = ref<{ initTable: (config: TableConfig) => void }>(); const table = ref<{ initTable: (config: TableConfig) => void }>();
const tableData: TableConfig = { const tableData: TableConfig = intTableData({
apiUrl: ControllerName, apiUrl: ControllerName,
selectColumn: false, // selectColumn: false, //
border: false, // border: false, //
@ -92,81 +97,85 @@ const tableData: TableConfig = {
// //
id: { id: {
label: "编号", label: "编号",
search: true, search: new TableColumnSearch(true),
add: false, //
edit: false, //
width: "150px", width: "150px",
}, },
name: { name: {
label: "考试名称", label: "考试名称",
rules: ruleRequired,
width: "200px", width: "200px",
search: true, search: new TableColumnSearch(true, ConditionalType.Like), //
searchType: ConditionalType.Like, // edit: {
add: true, // add: true,
edit: true, // edit: true,
setting: {}, rules: ruleRequired,
},
}, },
grade: { grade: {
label: "年级", label: "年级",
rules: ruleRequiredGrade,
width: "100px", width: "100px",
search: true, search: new TableColumnSearch(true),
add: true, // edit: {
edit: false, // add: true,
edit: false,
rules: ruleRequiredGrade,
},
}, },
testPaperType: { testPaperType: {
label: "试卷类型", label: "试卷类型",
rules: ruleRequired,
width: "100px", width: "100px",
type: "dropdown", type: "dropdown",
setting: {}, search: new TableColumnSearch(true),
search: true, edit: {
add: true, // add: true,
edit: true, // edit: true,
rules: ruleRequired,
},
}, },
type: { type: {
label: "考试类型", label: "考试类型",
rules: ruleRequired,
width: "100px", width: "100px",
type: "dropdown", type: "dropdown",
setting: {}, search: new TableColumnSearch(true),
search: true, edit: {
add: true, // add: true,
edit: true, // edit: true,
rules: ruleRequired,
},
}, },
scoreLine: { scoreLine: {
label: "划线分数", label: "划线分数",
rules: ruleNumber,
search: false,
width: "100px", width: "100px",
add: true, // edit: {
edit: true, // add: true,
edit: true,
rules: ruleNumber,
},
}, },
baseSchoolScore: { baseSchoolScore: {
label: "资源校平均分", label: "资源校平均分",
rules: ruleNumber,
search: false,
width: "150px", width: "150px",
add: true, // edit: {
edit: true, // add: true,
edit: true,
rules: ruleNumber,
},
}, },
startTime: { startTime: {
label: "考试时间", label: "考试时间",
width: "210px", width: "210px",
rules: ruleRequired,
search: true,
type: "datetime", type: "datetime",
setting: {}, custom: (row) => row.startTime?.replace("T", " ").substring(0, 10) ?? "",
add: true, // search: new TableColumnSearch(true),
edit: true, // edit: {
add: true,
edit: true,
rules: ruleRequired,
},
}, },
createTime: { createTime: {
label: "创建时间", label: "创建时间",
type: "datetime", type: "datetime",
search: false, custom: (row) => row.startTime?.replace("T", " ").substring(0, 10) ?? "",
add: false, //
edit: false, //
}, },
}, },
data: [], data: [],
@ -174,7 +183,7 @@ const tableData: TableConfig = {
total: 0, total: 0,
}, },
selectRows: [], selectRows: [],
}; });
function DwImportTemplate(obj, row, callBack) { function DwImportTemplate(obj, row, callBack) {
const baseUrl = import.meta.env.VITE_API_BASEURL; const baseUrl = import.meta.env.VITE_API_BASEURL;

View File

@ -1,6 +1,11 @@
<script setup lang="ts"> <script setup lang="ts">
import ahTable from "@/components/hTable/index.vue"; import ahTable from "@/components/hTable/index.vue";
import { ConditionalType, TableConfig } from "@/components/hTable/hTable"; import {
ConditionalType,
intTableData,
TableColumnSearch,
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";
@ -18,7 +23,7 @@ const props = defineProps<{
function searchCallback(data) {} function searchCallback(data) {}
const table = ref<{ initTable: (config: TableConfig) => void }>(); const table = ref<{ initTable: (config: TableConfig) => void }>();
const tableData: TableConfig = { const tableData: TableConfig = intTableData({
apiUrl: ControllerName, apiUrl: ControllerName,
selectColumn: false, // selectColumn: false, //
border: false, // border: false, //
@ -44,26 +49,6 @@ const tableData: TableConfig = {
}, },
operationColumn: true, // operationColumn: true, //
operationColumnData: [ operationColumnData: [
{
//
topBtn: true, //
label: "成绩升序",
btnStyle: "primary",
click: (o, r, c) => {
tableData.search.OrderByType = 1;
c();
},
},
{
//
topBtn: true, //
label: "成绩降序",
btnStyle: "primary",
click: (o, r, c) => {
tableData.search.OrderByType = 0;
c();
},
},
{ {
topBtn: false, // topBtn: false, //
label: "个人详情", label: "个人详情",
@ -81,72 +66,61 @@ const tableData: TableConfig = {
// //
userName: { userName: {
label: "姓名", label: "姓名",
search: true,
searchType: ConditionalType.Like, //
width: "180px", width: "180px",
search: new TableColumnSearch(true, ConditionalType.Like),
}, },
语文: { 语文: {
label: "语文", label: "语文",
search: false,
width: "100px", width: "100px",
custom: (row) => row.subjectDic.语文, custom: (row) => row.subjectDic.语文,
search: { sort: true },
}, },
数学: { 数学: {
label: "数学", label: "数学",
search: false,
width: "100px", width: "100px",
custom: (row) => row.subjectDic.数学, custom: (row) => row.subjectDic.数学,
}, },
英语: { 英语: {
label: "英语", label: "英语",
search: false,
width: "100px", width: "100px",
custom: (row) => row.subjectDic.英语, custom: (row) => row.subjectDic.英语,
}, },
物理: { 物理: {
label: "物理", label: "物理",
search: false,
width: "100px", width: "100px",
custom: (row) => row.subjectDic.物理, custom: (row) => row.subjectDic.物理,
}, },
化学: { 化学: {
label: "化学", label: "化学",
search: false,
width: "100px", width: "100px",
custom: (row) => row.subjectDic.化学, custom: (row) => row.subjectDic.化学,
}, },
生物: { 生物: {
label: "生物", label: "生物",
search: false,
width: "100px", width: "100px",
custom: (row) => row.subjectDic.生物, custom: (row) => row.subjectDic.生物,
}, },
政治: { 政治: {
label: "政治", label: "政治",
search: false,
width: "100px", width: "100px",
custom: (row) => row.subjectDic.政治, custom: (row) => row.subjectDic.政治,
}, },
历史: { 历史: {
label: "历史", label: "历史",
search: false,
width: "100px", width: "100px",
custom: (row) => row.subjectDic.历史, custom: (row) => row.subjectDic.历史,
}, },
地理: { 地理: {
label: "地理", label: "地理",
search: false,
width: "100px", width: "100px",
custom: (row) => row.subjectDic.地理 ?? "--", custom: (row) => row.subjectDic.地理 ?? "--",
}, },
assignScore: { assignScore: {
label: "赋分总分", label: "赋分总分",
search: false,
width: "180px", width: "180px",
}, },
assignRanking: { assignRanking: {
label: "赋分后的排名", label: "赋分后的排名",
search: false,
width: "200px", width: "200px",
}, },
}, },
@ -155,12 +129,11 @@ const tableData: TableConfig = {
total: 0, total: 0,
}, },
selectRows: [], selectRows: [],
}; });
const showTable = ref(false); const showTable = ref(false);
onMounted(async () => { onMounted(async () => {
// //
showTable.value = true; showTable.value = true;
}); });
const exam = props.data[0]; const exam = props.data[0];

View File

@ -1,6 +1,11 @@
<script setup lang="ts"> <script setup lang="ts">
import ahTable from "@/components/hTable/index.vue"; import ahTable from "@/components/hTable/index.vue";
import { ConditionalType, TableConfig } from "@/components/hTable/hTable"; import {
ConditionalType,
intTableData,
TableColumnSearch,
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";
@ -19,7 +24,7 @@ const props = defineProps<{
function searchCallback(data) {} function searchCallback(data) {}
const table = ref<{ initTable: (config: TableConfig) => void }>(); const table = ref<{ initTable: (config: TableConfig) => void }>();
const tableData: TableConfig = { const tableData: TableConfig = intTableData({
apiUrl: ControllerName, apiUrl: ControllerName,
selectColumn: false, // selectColumn: false, //
border: false, // border: false, //
@ -28,7 +33,7 @@ const tableData: TableConfig = {
// //
show: true, show: true,
PageIndex: 0, PageIndex: 0,
PageSize: 60, PageSize: 999,
OrderBy: "Id", // OrderBy: "Id", //
OrderByType: 1, OrderByType: 1,
defaultConditions: [ defaultConditions: [
@ -45,94 +50,80 @@ const tableData: TableConfig = {
// //
examName: { examName: {
label: "考试名称", label: "考试名称",
search: true, search: new TableColumnSearch(true, ConditionalType.Like),
searchType: ConditionalType.Like, //
width: "180px", width: "180px",
}, },
// //
type: { type: {
label: "考试类型", label: "考试类型",
search: true,
type: "dropdown",
setting: {},
width: "150px", width: "150px",
type: "dropdown",
search: new TableColumnSearch(true),
}, },
// //
grade: { grade: {
label: "考试阶段", label: "考试阶段",
search: true,
searchType: ConditionalType.Like, //
width: "120px", width: "120px",
search: new TableColumnSearch(true, ConditionalType.Like),
}, // }, //
testPaperType: { testPaperType: {
label: "试卷类型", label: "试卷类型",
search: true,
type: "dropdown",
setting: {},
width: "150px", width: "150px",
type: "dropdown",
search: new TableColumnSearch(true),
}, },
语文: { 语文: {
label: "语文", label: "语文",
search: false,
width: "80px", width: "80px",
custom: (row) => row.subjectDic.语文 ?? "--", custom: (row) => row.subjectDic.语文 ?? "--",
search: { sort: true },
}, },
数学: { 数学: {
label: "数学", label: "数学",
search: false,
width: "80px", width: "80px",
custom: (row) => row.subjectDic.数学 ?? "--", custom: (row) => row.subjectDic.数学 ?? "--",
}, },
英语: { 英语: {
label: "英语", label: "英语",
search: false,
width: "80px", width: "80px",
custom: (row) => row.subjectDic.英语 ?? "--", custom: (row) => row.subjectDic.英语 ?? "--",
}, },
物理: { 物理: {
label: "物理", label: "物理",
search: false,
width: "80px", width: "80px",
custom: (row) => row.subjectDic.物理 ?? "--", custom: (row) => row.subjectDic.物理 ?? "--",
}, },
化学: { 化学: {
label: "化学", label: "化学",
search: false,
width: "80px", width: "80px",
custom: (row) => row.subjectDic.化学 ?? "--", custom: (row) => row.subjectDic.化学 ?? "--",
}, },
生物: { 生物: {
label: "生物", label: "生物",
search: false,
width: "80px", width: "80px",
custom: (row) => row.subjectDic.生物 ?? "--", custom: (row) => row.subjectDic.生物 ?? "--",
}, },
政治: { 政治: {
label: "政治", label: "政治",
search: false,
width: "80px", width: "80px",
custom: (row) => row.subjectDic.政治 ?? "--", custom: (row) => row.subjectDic.政治 ?? "--",
}, },
历史: { 历史: {
label: "历史", label: "历史",
search: false,
width: "80px", width: "80px",
custom: (row) => row.subjectDic.历史 ?? "--", custom: (row) => row.subjectDic.历史 ?? "--",
}, },
地理: { 地理: {
label: "地理", label: "地理",
search: false,
width: "80px", width: "80px",
custom: (row) => row.subjectDic.地理 ?? "--", custom: (row) => row.subjectDic.地理 ?? "--",
}, },
assignScore: { assignScore: {
label: "赋分总分", label: "赋分总分",
search: false,
width: "80px", width: "80px",
}, },
assignRanking: { assignRanking: {
label: "赋分后的排名", label: "赋分后的排名",
search: false,
width: "120px", width: "120px",
}, },
}, },
@ -141,7 +132,7 @@ const tableData: TableConfig = {
total: 0, total: 0,
}, },
selectRows: [], selectRows: [],
}; });
const showTable = ref(false); const showTable = ref(false);
const exam = props.data[0]; const exam = props.data[0];

View File

@ -9,7 +9,7 @@ import { ruleRequired } from "@/utils/rules";
const ControllerName = "Grade"; const ControllerName = "Grade";
defineOptions({ defineOptions({
name: ControllerName name: ControllerName,
}); });
const SchoolApi = new hTableAPI("usercenter/back/schools"); const SchoolApi = new hTableAPI("usercenter/back/schools");
@ -28,7 +28,7 @@ const tableData: TableConfig = {
PageSize: 20, PageSize: 20,
OrderBy: "CreateTime", // OrderBy: "CreateTime", //
defaultConditions: [], // defaultConditions: [], //
Conditions: [] Conditions: [],
}, },
operationColumn: true, // operationColumn: true, //
operationColumnData: [ operationColumnData: [
@ -36,92 +36,90 @@ const tableData: TableConfig = {
// //
topBtn: false, // topBtn: false, //
label: "修改", label: "修改",
btnType: "edit" // add edit del custom btnType: "edit", // add edit del custom
}, },
{ {
// //
topBtn: true, // topBtn: true, //
label: "添加", label: "添加",
btnStyle: "success", btnStyle: "success",
btnType: "add" // add edit del custom btnType: "add", // add edit del custom
}, },
{ {
topBtn: false, // topBtn: false, //
show: true, show: true,
label: "删除", label: "删除",
btnType: "del", // add edit del btnType: "del", // add edit del
btnStyle: "danger" // topBtn: true success danger btnStyle: "danger", // topBtn: true success danger
} },
], ],
column: { column: {
// // //
id: { // id: {
label: "编号", // label: "",
search: true, // search: true,
add: false, // // add: false, //
edit: false, // // edit: false, //
width: "150px" // width: "150px"
}, // },
schoolId: { // schoolId: {
label: "学校", // label: "",
rules: ruleRequired, // rules: ruleRequired,
width: "200px", // width: "200px",
search: true, // search: true,
type: "dropdown", // type: "dropdown",
add: true, // // add: true, //
edit: true, // // edit: true, //
setting: {} // setting: {}
}, // },
name: { // name: {
label: "名称[动态]", // label: "[]",
rules: ruleRequired, // rules: ruleRequired,
width: "100px", // width: "100px",
search: false, // search: false,
searchType: ConditionalType.Like, // searchType: ConditionalType.Like,
add: false, // // add: false, //
edit: false // // edit: false //
}, // },
level: { // level: {
label: "年级", // label: "",
rules: ruleRequired, // rules: ruleRequired,
width: "80px", // width: "80px",
type: "dropdown", // type: "dropdown",
search: true, // search: true,
setting: {}, // setting: {},
add: true, // // add: true, //
edit: true // // edit: true //
}, // },
year: { // year: {
label: "毕业届", // label: "",
width: "80px", // width: "80px",
rules: ruleRequired, // rules: ruleRequired,
search: true, // search: true,
setting: {}, // setting: {},
add: true, // // add: true, //
edit: true // // edit: true //
}, // },
createTime: { // createTime: {
label: "创建时间", // label: "",
type: "datetime", // type: "datetime",
search: true, // search: true,
add: false, // // add: false, //
edit: false // // edit: false //
} // }
}, },
data: [], data: [],
pageData: { pageData: {
total: 0 total: 0,
}, },
selectRows: [] selectRows: [],
}; };
const showTable = ref(false); const showTable = ref(false);
onMounted(async () => { onMounted(async () => {
// //
tableData.column.level.setting.datasource = ( tableData.column.level.setting.datasource = (await getenum("GradeLevelEnum")).data;
await getenum("GradeLevelEnum")
).data;
tableData.column.schoolId.setting.datasource = ( tableData.column.schoolId.setting.datasource = (
await SchoolApi.querycombo({ TextName: "Name", ValueName: "Id" }) await SchoolApi.querycombo({ TextName: "Name", ValueName: "Id" })

View File

@ -2,6 +2,7 @@
import ahTable from "@/components/hTable/index.vue"; import ahTable from "@/components/hTable/index.vue";
import { import {
ConditionalType, ConditionalType,
intTableData,
TableColumnSearch, TableColumnSearch,
TableConfig, TableConfig,
} from "@/components/hTable/hTable"; } from "@/components/hTable/hTable";
@ -16,7 +17,7 @@ function searchCallback(data) {
//let c = data.Conditions.find((s) => s.FieldName == "Pname"); //let c = data.Conditions.find((s) => s.FieldName == "Pname");
} }
const table = ref<{ initTable: (config: TableConfig) => void }>(null); const table = ref<{ initTable: (config: TableConfig) => void }>(null);
const tableData: TableConfig = { const tableData: TableConfig = intTableData({
apiUrl: "usercenter/back/schools", apiUrl: "usercenter/back/schools",
selectColumn: false, // selectColumn: false, //
border: false, // border: false, //
@ -89,7 +90,7 @@ const tableData: TableConfig = {
total: 0, total: 0,
}, },
selectRows: [], selectRows: [],
}; });
</script> </script>
<template> <template>

View File

@ -1,6 +1,11 @@
<script setup lang="ts"> <script setup lang="ts">
import ahTable from "@/components/hTable/index.vue"; import ahTable from "@/components/hTable/index.vue";
import { ConditionalType, TableConfig } from "@/components/hTable/hTable"; import {
ConditionalType,
intTableData,
TableColumnSearch,
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({
@ -15,7 +20,7 @@ function searchCallback(data) {
//let c = data.Conditions.find((s) => s.FieldName == "Pname"); //let c = data.Conditions.find((s) => s.FieldName == "Pname");
} }
const table = ref<{ initTable: (config: TableConfig) => void }>(null); const table = ref<{ initTable: (config: TableConfig) => void }>(null);
const tableData: TableConfig = { const tableData: TableConfig = intTableData({
apiUrl: "usercenter/back/schools", apiUrl: "usercenter/back/schools",
selectColumn: false, // selectColumn: false, //
border: false, // border: false, //
@ -35,34 +40,32 @@ const tableData: TableConfig = {
// //
id: { id: {
label: "编号", label: "编号",
search: true,
add: false, //
edit: false, //
width: "150px", width: "150px",
search: new TableColumnSearch(true),
}, },
name: { name: {
label: "学校名称", label: "学校名称",
width: "300px", width: "300px",
search: true, search: new TableColumnSearch(true),
searchType: ConditionalType.Like, edit: {
add: true, // add: true,
edit: true, // edit: true,
},
}, },
pname: { pname: {
label: "地区", label: "地区",
width: "300px", width: "300px",
search: false,
custom: (row) => `${row.pname}-${row.cname}-${row.rname}`, custom: (row) => `${row.pname}-${row.cname}-${row.rname}`,
add: false, //
edit: false, //
}, },
enable: { enable: {
label: "启用", label: "启用",
type: "switch", type: "switch",
search: true,
custom: (row) => (row.enable ? "启用" : "禁用"), custom: (row) => (row.enable ? "启用" : "禁用"),
add: true, // search: new TableColumnSearch(true),
edit: true, // edit: {
add: true,
edit: true,
},
}, },
}, },
data: [], data: [],
@ -70,7 +73,7 @@ const tableData: TableConfig = {
total: 0, total: 0,
}, },
selectRows: [], selectRows: [],
}; });
</script> </script>
<template> <template>
<div> <div>

View File

@ -1,11 +0,0 @@
<script setup lang="ts" name="Testxb">
import { ref } from "vue";
// defineOptions({
// name: "Testxb"
// });
let name = ref("nihao");
</script>
<template>
<div>测试菜单</div>
</template>