+
+
+
+
+
+
+
重置
-
+
-
-
-
-
- 新 增
-
-
- 关联门禁规则
-
-
- 导 出
-
-
- 生成考核班级
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+ {{ $index + 1 + ((state.pagination?.current || 1) - 1) * (state.pagination?.size || 10) }}
+
+
班级概况
编辑
删除
-
+
-
-
+
+
+
@@ -262,8 +282,9 @@ import { useMessage, useMessageBox } from "/@/hooks/message";
import { fetchList as getRuleList } from "/@/api/stuwork/entrancerule";
import { downBlobFile, adaptationUrl } from "/@/utils/other";
import TableColumnControl from '/@/components/TableColumnControl/index.vue'
-import { List, OfficeBuilding, Grid, Document, UserFilled, Phone, User, Lock, CircleCheck, TrendCharts, Setting, Menu } from '@element-plus/icons-vue'
-import { getTableConfigFromLocal, saveTableConfigToLocal, updateUserTableConfig } from '/@/api/admin/usertable'
+import { List, OfficeBuilding, Grid, Document, UserFilled, Phone, User, Lock, CircleCheck, TrendCharts, Setting, Menu, Search } from '@element-plus/icons-vue'
+import { useTableColumnControl } from '/@/hooks/tableColumn'
+import '/@/styles/modern-page.scss'
import { defineAsyncComponent as defineStatusTag } from 'vue'
const StatusTag = defineStatusTag(() => import('/@/components/StatusTag/index.vue'))
@@ -299,94 +320,14 @@ const tableColumns = [
{ prop: 'stuLoseRate', label: '流失率', icon: TrendCharts }
]
-// 当前显示的列
-const visibleColumns = ref
([])
-// 列排序顺序
-const columnOrder = ref([])
-
-// 从本地统一存储加载配置
-const loadSavedConfig = () => {
- const routePath = route.path.replace(/^\//, '').replace(/\//g, '-')
- const storageKey = `table-columns-${routePath}`
- const savedConfig = getTableConfigFromLocal(storageKey)
-
- if (savedConfig && savedConfig.visibleColumns) {
- const validColumns = tableColumns.map(col => col.prop || col.label)
- const filteredSaved = savedConfig.visibleColumns.filter((col: string) => validColumns.includes(col))
- visibleColumns.value = filteredSaved.length > 0 ? filteredSaved : validColumns
- } else {
- visibleColumns.value = tableColumns.map(col => col.prop || col.label)
- }
-
- if (savedConfig && savedConfig.columnOrder) {
- const validColumns = tableColumns.map(col => col.prop || col.label)
- columnOrder.value = savedConfig.columnOrder.filter((key: string) => validColumns.includes(key))
- validColumns.forEach(key => {
- if (!columnOrder.value.includes(key)) {
- columnOrder.value.push(key)
- }
- })
- } else {
- columnOrder.value = tableColumns.map(col => col.prop || col.label)
- }
-}
-
-// 列变化处理
-const handleColumnChange = (value: string[]) => {
- visibleColumns.value = value
- const routePath = route.path.replace(/^\//, '').replace(/\//g, '-')
- const storageKey = `table-columns-${routePath}`
- const selectableColumns = value.filter(col => {
- const column = tableColumns.find(c => (c.prop || c.label) === col)
- return column && !column.alwaysShow && !column.fixed
- })
- // 保存到本地统一存储
- saveTableConfigToLocal(storageKey, { visibleColumns: selectableColumns })
- // 异步保存到后端
- updateUserTableConfig(storageKey, { visibleColumns: selectableColumns }).catch(() => {})
-}
-
-// 列排序变化处理
-const handleColumnOrderChange = (order: string[]) => {
- columnOrder.value = order
- const routePath = route.path.replace(/^\//, '').replace(/\//g, '-')
- const storageKey = `table-columns-${routePath}`
- // 保存到本地统一存储
- saveTableConfigToLocal(storageKey, { columnOrder: order })
- // 异步保存到后端
- updateUserTableConfig(storageKey, { columnOrder: order }).catch(() => {})
-}
-
-// 排序后的表格列
-const visibleColumnsSorted = computed(() => {
- const columns = tableColumns.filter(col => {
- const key = col.prop || col.label
- return visibleColumns.value.includes(key)
- })
-
- if (columnOrder.value.length > 0) {
- const orderedColumns: any[] = []
- const unorderedColumns: any[] = []
-
- columnOrder.value.forEach(key => {
- const col = columns.find(c => (c.prop || c.label) === key)
- if (col) {
- orderedColumns.push(col)
- }
- })
-
- columns.forEach(col => {
- const key = col.prop || col.label
- if (!columnOrder.value.includes(key)) {
- unorderedColumns.push(col)
- }
- })
-
- return [...orderedColumns, ...unorderedColumns]
- }
-
- return columns
-})
+// 使用表格列控制hook
+const {
+ visibleColumns,
+ visibleColumnsSorted,
+ checkColumnVisible,
+ handleColumnChange,
+ handleColumnOrderChange
+} = useTableColumnControl(tableColumns)
// 搜索表单
const searchForm = reactive({
@@ -583,7 +524,6 @@ const getRuleListData = async () => {
}
// 初始化
-loadSavedConfig()
onMounted(() => {
getDeptListData()
getClassListData()
diff --git a/src/views/basic/basicstudent/index.vue b/src/views/basic/basicstudent/index.vue
index 4a34d82..2cffe8c 100644
--- a/src/views/basic/basicstudent/index.vue
+++ b/src/views/basic/basicstudent/index.vue
@@ -1,9 +1,17 @@
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
重置
-
+
-
-
-
-
+
+
+
+
+
-
-
-
-
-
- 序号
-
-
+
+
+
+
+
+
+
+ {{ $index + 1 + ((state.pagination?.current || 1) - 1) * (state.pagination?.size || 10) }}
+
+
-
-
+
-
-
+
+
+
@@ -117,8 +137,9 @@ import { BasicTableProps, useTable } from "/@/hooks/table";
import { fetchList } from "/@/api/basic/basicstudentavatar";
import { getClassListByRole } from "/@/api/basic/basicclass";
import TableColumnControl from '/@/components/TableColumnControl/index.vue'
-import { Picture, List, Document, UserFilled, Grid, Menu } from '@element-plus/icons-vue'
-import { getTableConfigFromLocal, saveTableConfigToLocal, updateUserTableConfig } from '/@/api/admin/usertable'
+import { Picture, List, Document, UserFilled, Grid, Menu, Search } from '@element-plus/icons-vue'
+import { useTableColumnControl } from '/@/hooks/tableColumn'
+import '/@/styles/modern-page.scss'
// 定义变量内容
const route = useRoute()
@@ -135,94 +156,14 @@ const tableColumns = [
{ prop: 'headImg', label: '头像', icon: Picture, width: 120 }
]
-// 当前显示的列
-const visibleColumns = ref([])
-// 列排序顺序
-const columnOrder = ref([])
-
-// 从本地统一存储加载配置
-const loadSavedConfig = () => {
- const routePath = route.path.replace(/^\//, '').replace(/\//g, '-')
- const storageKey = `table-columns-${routePath}`
- const savedConfig = getTableConfigFromLocal(storageKey)
-
- if (savedConfig && savedConfig.visibleColumns) {
- const validColumns = tableColumns.map(col => col.prop || col.label)
- const filteredSaved = savedConfig.visibleColumns.filter((col: string) => validColumns.includes(col))
- visibleColumns.value = filteredSaved.length > 0 ? filteredSaved : validColumns
- } else {
- visibleColumns.value = tableColumns.map(col => col.prop || col.label)
- }
-
- if (savedConfig && savedConfig.columnOrder) {
- const validColumns = tableColumns.map(col => col.prop || col.label)
- columnOrder.value = savedConfig.columnOrder.filter((key: string) => validColumns.includes(key))
- validColumns.forEach(key => {
- if (!columnOrder.value.includes(key)) {
- columnOrder.value.push(key)
- }
- })
- } else {
- columnOrder.value = tableColumns.map(col => col.prop || col.label)
- }
-}
-
-// 列变化处理
-const handleColumnChange = (value: string[]) => {
- visibleColumns.value = value
- const routePath = route.path.replace(/^\//, '').replace(/\//g, '-')
- const storageKey = `table-columns-${routePath}`
- const selectableColumns = value.filter(col => {
- const column = tableColumns.find(c => (c.prop || c.label) === col)
- return column && !column.alwaysShow && !column.fixed
- })
- // 保存到本地统一存储
- saveTableConfigToLocal(storageKey, { visibleColumns: selectableColumns })
- // 异步保存到后端
- updateUserTableConfig(storageKey, { visibleColumns: selectableColumns }).catch(() => {})
-}
-
-// 列排序变化处理
-const handleColumnOrderChange = (order: string[]) => {
- columnOrder.value = order
- const routePath = route.path.replace(/^\//, '').replace(/\//g, '-')
- const storageKey = `table-columns-${routePath}`
- // 保存到本地统一存储
- saveTableConfigToLocal(storageKey, { columnOrder: order })
- // 异步保存到后端
- updateUserTableConfig(storageKey, { columnOrder: order }).catch(() => {})
-}
-
-// 排序后的表格列
-const visibleColumnsSorted = computed(() => {
- const columns = tableColumns.filter(col => {
- const key = col.prop || col.label
- return visibleColumns.value.includes(key)
- })
-
- if (columnOrder.value.length > 0) {
- const orderedColumns: any[] = []
- const unorderedColumns: any[] = []
-
- columnOrder.value.forEach(key => {
- const col = columns.find(c => (c.prop || c.label) === key)
- if (col) {
- orderedColumns.push(col)
- }
- })
-
- columns.forEach(col => {
- const key = col.prop || col.label
- if (!columnOrder.value.includes(key)) {
- unorderedColumns.push(col)
- }
- })
-
- return [...orderedColumns, ...unorderedColumns]
- }
-
- return columns
-})
+// 使用表格列控制hook
+const {
+ visibleColumns,
+ visibleColumnsSorted,
+ checkColumnVisible,
+ handleColumnChange,
+ handleColumnOrderChange
+} = useTableColumnControl(tableColumns)
// 搜索表单
const searchForm = reactive({
@@ -309,7 +250,6 @@ const getClassListData = async () => {
}
// 初始化
-loadSavedConfig()
onMounted(() => {
getClassListData()
})
diff --git a/src/views/stuwork/activityawards/index.vue b/src/views/stuwork/activityawards/index.vue
index 47980bf..2e76bae 100644
--- a/src/views/stuwork/activityawards/index.vue
+++ b/src/views/stuwork/activityawards/index.vue
@@ -1,112 +1,133 @@
-
-
-
-
-
-
- 新增
-
-
- 导入
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ $index + 1 + ((state.pagination?.current || 1) - 1) * (state.pagination?.size || 10) }}
+
+
+
+
+
+
+ {{ col.label }}
-
-
+
+
+
+ {{ scope.row.awards }}
+
+ -
+
+
+
+ {{ parseTime(scope.row.awardTime || scope.row.month, '{y}-{m}-{d}') }}
+
+
+
+
+
+
+ 操作
+
+
+
+ 编辑
+
+
+ 删除
+
+
+
+
+
+ 新增获奖信息
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
- {{ col.label }}
-
-
-
- {{ scope.row.awards }}
-
- -
-
-
- {{ parseTime(scope.row.awardTime || scope.row.month, '{y}-{m}-{d}') }}
-
-
-
-
-
- 操作
-
-
-
- 编辑
-
-
- 删除
-
-
-
-
-
-
-
+
@@ -155,19 +176,17 @@
-
diff --git a/src/views/stuwork/activityinfo/index.vue b/src/views/stuwork/activityinfo/index.vue
index 893132e..447e4ae 100644
--- a/src/views/stuwork/activityinfo/index.vue
+++ b/src/views/stuwork/activityinfo/index.vue
@@ -1,122 +1,144 @@
-
-
-
-
-
-
- 新增
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ $index + 1 + ((state.pagination?.current || 1) - 1) * (state.pagination?.size || 10) }}
+
+
+
+
+
+
+ {{ col.label }}
-
-
+
+
+
+ {{ scope.row.maxSub }}
+
+ -
+
+
+
+ {{ parseTime(scope.row.startTime, '{y}-{m}-{d}') }}
+
+
+
+ {{ parseTime(scope.row.endTime, '{y}-{m}-{d}') }}
+
+
+
+
+
+
+ 操作
+
+
+
+ 查看详情
+
+
+ 导入子项目
+
+
+ 编辑
+
+
+ 删除
+
+
+
+
+
+ 新增活动
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
- {{ col.label }}
-
-
-
- {{ scope.row.maxSub }}
-
- -
-
-
- {{ parseTime(scope.row.startTime, '{y}-{m}-{d}') }}
-
-
- {{ parseTime(scope.row.endTime, '{y}-{m}-{d}') }}
-
-
-
-
-
- 操作
-
-
-
- 查看详情
-
-
- 导入子项目
-
-
- 编辑
-
-
- 删除
-
-
-
-
-
-
-
+
@@ -163,20 +185,18 @@
-
diff --git a/src/views/stuwork/activityinfosub/index.vue b/src/views/stuwork/activityinfosub/index.vue
index 825fb3c..98cc2fc 100644
--- a/src/views/stuwork/activityinfosub/index.vue
+++ b/src/views/stuwork/activityinfosub/index.vue
@@ -1,9 +1,22 @@
-
-
-
-
-
+
+
+
+
+
+
+
+
- 查询
+ 查询
重置
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ $index + 1 + ((state.pagination?.current || 1) - 1) * (state.pagination?.size || 10) }}
+
+
+
+
+
+
+ {{ col.label }}
-
-
+
+
+ {{ parseTime(scope.row.startTime, '{y}-{m}-{d} {h}:{i}:{s}') }}
+
+
+
+ {{ parseTime(scope.row.endTime, '{y}-{m}-{d} {h}:{i}:{s}') }}
+
+
+
+
+ {{ scope.row.maxNum }}
+
+ -
+
+
+
+
+
+
+ 活动说明
+
+
+
+
+
+ 操作
+
+
+
+ 删除
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
- {{ col.label }}
-
-
- {{ parseTime(scope.row.startTime, '{y}-{m}-{d} {h}:{i}:{s}') }}
-
-
- {{ parseTime(scope.row.endTime, '{y}-{m}-{d} {h}:{i}:{s}') }}
-
-
-
- {{ scope.row.maxNum }}
-
- -
-
-
-
-
-
- 活动说明
-
-
-
-
-
- 操作
-
-
-
- 删除
-
-
-
-
-
-
-
+
-
diff --git a/src/views/stuwork/activityinfosubsignup/index.vue b/src/views/stuwork/activityinfosubsignup/index.vue
index b82641c..749f1ec 100644
--- a/src/views/stuwork/activityinfosubsignup/index.vue
+++ b/src/views/stuwork/activityinfosubsignup/index.vue
@@ -1,9 +1,22 @@
-
-
-
-
-
+
+
+
+
+
+
+
+
- 查询
+ 查询
重置
-
+
-
-
-
-
- 导出
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ $index + 1 + ((state.pagination?.current || 1) - 1) * (state.pagination?.size || 10) }}
+
+
+
+
+
+
+ {{ col.label }}
-
-
+
+
+
+
+
+ 操作
+
+
+
+ 删除
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
- {{ col.label }}
-
-
-
-
-
- 操作
-
-
-
- 删除
-
-
-
-
-
-
-
+
-
diff --git a/src/views/stuwork/assessmentcategory/index.vue b/src/views/stuwork/assessmentcategory/index.vue
index 7bb5308..f0e55b2 100644
--- a/src/views/stuwork/assessmentcategory/index.vue
+++ b/src/views/stuwork/assessmentcategory/index.vue
@@ -1,9 +1,22 @@
-
-
-
-
-
+
+
+
+
+
+
+
+
- 查询
+ 查询
重置
-
+
-
-
-
-
- 新增
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ $index + 1 + ((state.pagination?.current || 1) - 1) * (state.pagination?.size || 10) }}
+
+
+
+
+
+
+ {{ col.label }}
-
-
+
+
+
+ {{ formatType(scope.row.type) }}
+
+
+
+
+
+
+
+ 操作
+
+
+
+ 编辑
+
+
+ 删除
+
+
+
+
+
+ 新增考核项
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
- {{ col.label }}
-
-
-
- {{ formatType(scope.row.type) }}
-
-
-
-
-
-
- 操作
-
-
-
- 编辑
-
-
- 删除
-
-
-
-
-
-
-
+
@@ -128,18 +161,16 @@
-
diff --git a/src/views/stuwork/assessmentpoint/index.vue b/src/views/stuwork/assessmentpoint/index.vue
index a2e2936..d52dd8b 100644
--- a/src/views/stuwork/assessmentpoint/index.vue
+++ b/src/views/stuwork/assessmentpoint/index.vue
@@ -1,9 +1,22 @@
-
-
-
-
-
+
+
+
+
+
+
+
+
- 查询
+ 查询
重置
-
+
-
-
-
-
- 新增
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ $index + 1 + ((state.pagination?.current || 1) - 1) * (state.pagination?.size || 10) }}
+
+
+
+
+
+
+ {{ col.label }}
-
-
+
+
+
+ {{ scope.row.score }}
+
+ -
+
+
+
+
+
+
+ 操作
+
+
+
+ 编辑
+
+
+ 删除
+
+
+
+
+
+ 新增指标
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
- {{ col.label }}
-
-
-
- {{ scope.row.score }}
-
- -
-
-
-
-
-
- 操作
-
-
-
- 编辑
-
-
- 删除
-
-
-
-
-
-
-
+
@@ -122,18 +155,16 @@
-
diff --git a/src/views/stuwork/classactivity/index.vue b/src/views/stuwork/classactivity/index.vue
index 0ebc163..74ea3f3 100644
--- a/src/views/stuwork/classactivity/index.vue
+++ b/src/views/stuwork/classactivity/index.vue
@@ -1,9 +1,22 @@
-
-
-
-
-
+
+
+
+
+
+
+
+
- 查询
+ 查询
重置
-
+
-
-
-
-
- 新增
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ $index + 1 + ((state.pagination?.current || 1) - 1) * (state.pagination?.size || 10) }}
+
+
+
+
+
+
+ {{ col.label }}
-
-
+
+
+
+ {{ formatSchoolTerm(scope.row.schoolTerm) }}
+
+
+
+
+ {{ scope.row.activityTime || scope.row.recordDate || '-' }}
+
+
+
+
+ {{ scope.row.attendNum }}
+
+ -
+
+
+
+
+ 查看
+
+ -
+
+
+
+
+ 查看
+
+ -
+
+
+
+
+
+
+ 操作
+
+
+
+ 编辑
+
+
+ 删除
+
+
+
+
+
+ 新增活动
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
- {{ col.label }}
-
-
-
- {{ formatSchoolTerm(scope.row.schoolTerm) }}
-
-
-
- {{ scope.row.activityTime || scope.row.recordDate || '-' }}
-
-
-
- {{ scope.row.attendNum }}
-
- -
-
-
-
- 查看
-
- -
-
-
-
- 查看
-
- -
-
-
-
-
-
- 操作
-
-
-
- 编辑
-
-
- 删除
-
-
-
-
-
-
-
+
@@ -193,8 +229,7 @@
-
diff --git a/src/views/stuwork/classassessmentsettle/index.vue b/src/views/stuwork/classassessmentsettle/index.vue
index 1611249..d285262 100644
--- a/src/views/stuwork/classassessmentsettle/index.vue
+++ b/src/views/stuwork/classassessmentsettle/index.vue
@@ -1,9 +1,22 @@
-
-
-
-
-
+
+
+
+
+
+
+
+
- 查询
+ 查询
重置
-
+
-
-
-
-
- 新 增
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ $index + 1 + ((state.pagination?.current || 1) - 1) * (state.pagination?.size || 10) }}
+
+
+
+
+
+
+ {{ col.label }}
-
-
+
+
+
+ {{ formatSchoolTerm(scope.row.schoolTerm) }}
+
+
+
+
+
+
+
+ 操作
+
+
+
+ 删除
+
+
+
+
+
+ 新增结算
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
- {{ col.label }}
-
-
-
- {{ formatSchoolTerm(scope.row.schoolTerm) }}
-
-
-
-
-
-
- 操作
-
-
-
- 删除
-
-
-
-
-
-
-
+
@@ -163,30 +195,29 @@
+
+
diff --git a/src/views/stuwork/classattendance/index.vue b/src/views/stuwork/classattendance/index.vue
index 2624eda..0264976 100644
--- a/src/views/stuwork/classattendance/index.vue
+++ b/src/views/stuwork/classattendance/index.vue
@@ -1,9 +1,22 @@
-
-
-
-
-
+
+
+
+
+
+
+
+
- 查询
+ 查询
重置
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ $index + 1 }}
+
+
+
+
+
+
+ {{ col.label }}
-
-
-
-
-
-
-
-
-
-
+
+
+
+ {{ formatStudentStatus(scope.row.stuStatus) }}
+
+
+
+
+
+ {{ formatAttendanceType(scope.row.attendanceType) }}
+
+
+
+
+
+
+
+
+
+ {{ scope.row.isDeviceIn === '1' ? '是' : '否' }}
+
+
+
-
-
-
-
- {{ col.label }}
+
+
+
+ 操作
+
+
+
+ 编辑
+
+
+
+
+
+
-
-
- {{ formatStudentStatus(scope.row.stuStatus) }}
-
-
-
-
- {{ formatAttendanceType(scope.row.attendanceType) }}
-
-
-
-
-
-
-
- {{ scope.row.isDeviceIn === '1' ? '是' : '否' }}
-
-
-
-
-
-
- 操作
-
-
-
- 编辑
-
-
-
-
+
+
+
diff --git a/src/views/stuwork/classcheckdaily/index.vue b/src/views/stuwork/classcheckdaily/index.vue
index a796553..2e907ca 100644
--- a/src/views/stuwork/classcheckdaily/index.vue
+++ b/src/views/stuwork/classcheckdaily/index.vue
@@ -1,9 +1,22 @@
-
-
-
-
-
+
+
+
+
+
+
+
+
- 查询
+ 查询
重置
-
+
-
-
-
-
- 新 增
-
-
- 导 出
-
-
- 学期统计
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ $index + 1 + ((state.pagination?.current || 1) - 1) * (state.pagination?.size || 10) }}
+
+
+
+
+
+
+ {{ col.label }}
-
-
+
+
+
+ {{ scope.row.score }}
+
+ -
+
+
+
+
+
+
+ 操作
+
+
+
+ 删除
+
+
+
+
+
+ 新增记录
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
- {{ col.label }}
-
-
-
- {{ scope.row.score }}
-
- -
-
-
-
-
-
- 操作
-
-
-
- 删除
-
-
-
-
-
-
-
+
@@ -237,27 +269,23 @@
+
+
diff --git a/src/views/stuwork/classconstruction/index.vue b/src/views/stuwork/classconstruction/index.vue
index c701809..02f448b 100644
--- a/src/views/stuwork/classconstruction/index.vue
+++ b/src/views/stuwork/classconstruction/index.vue
@@ -1,9 +1,22 @@
-
-
-
-
-
+
+
+
+
+
+
+
+
- 查询
+ 查询
重置
-
+
-
-
-
-
- 新增
-
-
- 初始化
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ $index + 1 + ((state.pagination?.current || 1) - 1) * (state.pagination?.size || 10) }}
+
+
+
+
+
+
+ {{ col.label }}
-
-
+
+
+ {{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}
+
+
+
+
+
+
+ 操作
+
+
+
+ 编辑
+
+
+ 附件列表
+
+
+ 删除
+
+
+
+
+
+ 新增方案
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
- {{ col.label }}
-
-
- {{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}
-
-
-
-
-
- 操作
-
-
-
- 编辑
-
-
- 附件列表
-
-
- 删除
-
-
-
-
-
-
-
+
@@ -168,8 +200,7 @@
-
diff --git a/src/views/stuwork/classfeelog/index.vue b/src/views/stuwork/classfeelog/index.vue
index 0a934a3..296eb95 100644
--- a/src/views/stuwork/classfeelog/index.vue
+++ b/src/views/stuwork/classfeelog/index.vue
@@ -1,9 +1,22 @@
-
-
-
-
-
+
+
+
+
+
+
+
+
- 查询
+ 查询
重置
-
+
-
-
-
-
- 新增
-
-
- 导出
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ $index + 1 + ((state.pagination?.current || 1) - 1) * (state.pagination?.size || 10) }}
+
+
+
+
+
+
+ {{ col.label }}
-
-
+
+
+
+ {{ formatSchoolTerm(scope.row.schoolTerm) }}
+
+
+
+
+ {{ scope.row.operatTime || '-' }}
+
+
+
+
+ {{ formatType(scope.row.type) }}
+
+
+
+
+
+ ¥{{ scope.row.money.toFixed(2) }}
+
+ -
+
+
+
+
+ 查看
+
+ -
+
+
+
+
+
+
+ 操作
+
+
+
+ 编辑
+
+
+ 删除
+
+
+
+
+
+ 新增记录
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
- {{ col.label }}
-
-
-
- {{ formatSchoolTerm(scope.row.schoolTerm) }}
-
-
-
- {{ scope.row.operatTime || '-' }}
-
-
-
- {{ formatType(scope.row.type) }}
-
-
-
-
- ¥{{ scope.row.money.toFixed(2) }}
-
- -
-
-
-
- 查看
-
- -
-
-
-
-
-
- 操作
-
-
-
- 编辑
-
-
- 删除
-
-
-
-
-
-
-
+
@@ -222,8 +258,7 @@
-
diff --git a/src/views/stuwork/classhonor/index.vue b/src/views/stuwork/classhonor/index.vue
index fe33249..2b05de5 100644
--- a/src/views/stuwork/classhonor/index.vue
+++ b/src/views/stuwork/classhonor/index.vue
@@ -1,9 +1,22 @@
-
-
-
-
-
+
+
+
+
+
+
+
+
- 查询
+ 查询
重置
-
+
-
-
-
-
- 新增
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{ col.label }}
-
-
-
-
- {{ formatSchoolTerm(scope.row.schoolTerm) }}
-
-
-
-
- {{ parseTime(scope.row.updateTime, '{y}-{m}-{d} {h}:{i}:{s}') }}
-
-
-
-
- {{ formatBelong(scope.row.belong) }}
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ $index + 1 + ((state.pagination?.current || 1) - 1) * (state.pagination?.size || 10) }}
-
-
-
-
- 操作
+
+
+
+
+ {{ col.label }}
+
+
+
+
+ {{ formatSchoolTerm(scope.row.schoolTerm) }}
+
+
+
+
+ {{ parseTime(scope.row.updateTime, '{y}-{m}-{d} {h}:{i}:{s}') }}
+
+
+
+
+ {{ formatBelong(scope.row.belong) }}
+
+
+
+
+
+ 查看
+
+ -
+
+
-
-
- 归档
-
-
- 编辑
-
-
- 删除
-
+
+
+
+ 操作
+
+
+
+ 归档
+
+
+ 编辑
+
+
+ 删除
+
+
+
+
+
+ 新增荣誉
+
-
-
+
-
-
+
+
+
@@ -210,8 +240,7 @@
-
diff --git a/src/views/stuwork/classhygienedaily/index.vue b/src/views/stuwork/classhygienedaily/index.vue
index 4a4288c..c06bdc5 100644
--- a/src/views/stuwork/classhygienedaily/index.vue
+++ b/src/views/stuwork/classhygienedaily/index.vue
@@ -1,9 +1,22 @@
-
-
-
-
-
+
+
+
+
+
+
+
+
- 查询
+ 查询
重置
-
+
-
-
-
-
- 新 增
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ $index + 1 + ((state.pagination?.current || 1) - 1) * (state.pagination?.size || 10) }}
+
+
+
+
+
+
+ {{ col.label }}
-
-
+
+
+
+ {{ scope.row.score }}
+
+ -
+
+
+
+
+
+
+ 操作
+
+
+
+ 编辑
+
+
+ 删除
+
+
+
+
+
+ 新增记录
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
- {{ col.label }}
-
-
-
- {{ scope.row.score }}
-
- -
-
-
-
-
-
- 操作
-
-
-
- 编辑
-
-
- 删除
-
-
-
-
-
-
-
+
@@ -167,25 +199,22 @@
+
+
diff --git a/src/views/stuwork/classhygienedailyanalysis/index.vue b/src/views/stuwork/classhygienedailyanalysis/index.vue
index a1c2f96..c5f011a 100644
--- a/src/views/stuwork/classhygienedailyanalysis/index.vue
+++ b/src/views/stuwork/classhygienedailyanalysis/index.vue
@@ -1,9 +1,22 @@
-
-
-
-
-
+
+
+
+
+
+
+
+
- 查询
+ 查询
重置
-
+
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
-
- {{ col.label }}
+
-
-
-
- {{ scope.row.totalScore }}
-
- -
-
-
-
-
- {{ scope.row.rank }}
-
- -
+
+ {{ $index + 1 }}
-
-
-
-
-
- {{ day }}日
+
+
+
+
+ {{ col.label }}
+
+
+
+
+ {{ scope.row.totalScore }}
+
+ -
+
+
+
+
+ {{ scope.row.rank }}
+
+ -
+
+
-
-
-
-
- 操作
+
+
+
+
+ {{ day }}日
+
+
+
+
+
+ 操作
+
+
+
+ 加分
+
+
+ 减分
+
+
+
+
+
+
-
-
- 加分
-
-
- 减分
-
-
-
-
-
-
+
+
@@ -216,142 +244,42 @@
+
+
diff --git a/src/views/stuwork/classleaveapply/index.vue b/src/views/stuwork/classleaveapply/index.vue
index c2ceef1..db2ab98 100644
--- a/src/views/stuwork/classleaveapply/index.vue
+++ b/src/views/stuwork/classleaveapply/index.vue
@@ -1,9 +1,22 @@
-
-
-
-
-
+
+
+
+
+
+
+
+
- 查询
+ 查询
重置
-
+
-
-
-
-
- 批量新增
-
-
- 整班删除
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ $index + 1 + ((state.pagination?.current || 1) - 1) * (state.pagination?.size || 10) }}
+
+
+
+
+
+
+ {{ col.label }}
-
-
+
+
+
+ {{ formatSchoolTerm(scope.row.schoolTerm) }}
+
+
+
+
+
+ {{ scope.row.num }}
+
+ -
+
+
+
+ {{ scope.row.startTime ? formatDateTime(scope.row.startTime) : '-' }}
+
+
+
+ {{ scope.row.endTime ? formatDateTime(scope.row.endTime) : '-' }}
+
+
+
+
+ {{ formatLeaveType(scope.row.leaveType) }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ formatSchoolDoor(scope.row.schoolDoor) }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 操作
+
+
+
+ 查看
+
+
+ 删除
+
+
+
+
+
+ 批量新增
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
- {{ col.label }}
-
-
-
- {{ formatSchoolTerm(scope.row.schoolTerm) }}
-
-
-
-
- {{ scope.row.num }}
-
- -
-
-
- {{ scope.row.startTime ? formatDateTime(scope.row.startTime) : '-' }}
-
-
- {{ scope.row.endTime ? formatDateTime(scope.row.endTime) : '-' }}
-
-
-
- {{ formatLeaveType(scope.row.leaveType) }}
-
-
-
-
-
-
-
-
-
-
- {{ formatSchoolDoor(scope.row.schoolDoor) }}
-
-
-
-
-
-
-
-
-
-
-
-
- 操作
-
-
-
- 查看
-
-
- 删除
-
-
-
-
-
-
-
+
@@ -262,8 +303,7 @@
-
diff --git a/src/views/stuwork/classmasterevaluation/index.vue b/src/views/stuwork/classmasterevaluation/index.vue
index d9d158e..d279653 100644
--- a/src/views/stuwork/classmasterevaluation/index.vue
+++ b/src/views/stuwork/classmasterevaluation/index.vue
@@ -1,9 +1,22 @@
-
-
-
-
-
+
+
+
+
+
+
+
+
- 查询
+ 查询
重置
-
+
-
-
-
-
- 新 增
-
-
- 导 入
-
-
- 导 出
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
-
- {{ col.label }}
+
-
-
- {{ getAssessmentCategoryName(scope.row.assessmentCategory) || '-' }}
-
-
-
- {{ getAssessmentPointName(scope.row.assessmentPoint) || '-' }}
-
-
-
-
- {{ scope.row.type === '1' ? '加分' : scope.row.type === '2' ? '减分' : '-' }}
-
-
-
-
-
- {{ scope.row.score }}
-
- -
+
+ {{ $index + 1 + ((state.pagination?.current || 1) - 1) * (state.pagination?.size || 10) }}
-
-
-
-
- 操作
+
+
+
+
+ {{ col.label }}
+
+
+
+ {{ getAssessmentCategoryName(scope.row.assessmentCategory) || '-' }}
+
+
+
+ {{ getAssessmentPointName(scope.row.assessmentPoint) || '-' }}
+
+
+
+
+ {{ scope.row.type === '1' ? '加分' : scope.row.type === '2' ? '减分' : '-' }}
+
+
+
+
+
+ {{ scope.row.score }}
+
+ -
+
+
-
-
- 申诉
-
-
- 编辑
-
-
- 删除
-
+
+
+
+ 操作
+
+
+
+ 申诉
+
+
+ 编辑
+
+
+ 删除
+
+
+
+
+
+ 新增考核
+
-
-
+
-
-
+
+
+
@@ -288,8 +321,7 @@
+
+
diff --git a/src/views/stuwork/classmasterevaluationappeal/index.vue b/src/views/stuwork/classmasterevaluationappeal/index.vue
index fd63540..4f97664 100644
--- a/src/views/stuwork/classmasterevaluationappeal/index.vue
+++ b/src/views/stuwork/classmasterevaluationappeal/index.vue
@@ -1,9 +1,17 @@
-
-
-
-
-
+
+
+
+
+
+
+
+
重置
-
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ $index + 1 + ((state.pagination?.current || 1) - 1) * (state.pagination?.size || 10) }}
+
+
+
+
+
+
+ {{ col.label }}
+
+
+
+
+
+
+
+
+
+ 操作
+
+
+
+ 审核
+
+
+ 删除
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
- {{ col.label }}
-
-
-
-
-
-
-
-
- 操作
-
-
-
- 审核
-
-
- 删除
-
-
-
-
-
-
-
+
@@ -219,13 +244,12 @@ import { useMessage, useMessageBox } from "/@/hooks/message";
import { getDeptList, getClassListByRole } from '/@/api/basic/basicclass'
import { getTypeValue } from '/@/api/admin/dict'
import TableColumnControl from '/@/components/TableColumnControl/index.vue'
-import { List, Grid, UserFilled, Calendar, Tickets, DataAnalysis, Document, Warning, User, CircleCheck, EditPen, Setting, Menu } from '@element-plus/icons-vue'
-import { getTableConfigFromLocal, saveTableConfigToLocal, updateUserTableConfig } from '/@/api/admin/usertable'
+import { List, Grid, UserFilled, Calendar, Tickets, DataAnalysis, Document, Warning, User, CircleCheck, EditPen, Setting, Menu, Search } from '@element-plus/icons-vue'
+import { useTableColumnControl } from '/@/hooks/tableColumn'
import { defineAsyncComponent } from 'vue'
const StatusTag = defineAsyncComponent(() => import('/@/components/StatusTag/index.vue'))
// 定义变量内容
-const route = useRoute()
const searchFormRef = ref()
const auditFormRef = ref()
const columnControlRef = ref()
@@ -252,94 +276,13 @@ const tableColumns = [
{ prop: 'appealReply', label: '反馈意见', icon: EditPen }
]
-// 当前显示的列
-const visibleColumns = ref([])
-// 列排序顺序
-const columnOrder = ref([])
-
-// 从本地统一存储加载配置
-const loadSavedConfig = () => {
- const routePath = route.path.replace(/^\//, '').replace(/\//g, '-')
- const storageKey = `table-columns-${routePath}`
- const savedConfig = getTableConfigFromLocal(storageKey)
-
- if (savedConfig && savedConfig.visibleColumns) {
- const validColumns = tableColumns.map(col => col.prop || col.label)
- const filteredSaved = savedConfig.visibleColumns.filter((col: string) => validColumns.includes(col))
- visibleColumns.value = filteredSaved.length > 0 ? filteredSaved : validColumns
- } else {
- visibleColumns.value = tableColumns.map(col => col.prop || col.label)
- }
-
- if (savedConfig && savedConfig.columnOrder) {
- const validColumns = tableColumns.map(col => col.prop || col.label)
- columnOrder.value = savedConfig.columnOrder.filter((key: string) => validColumns.includes(key))
- validColumns.forEach(key => {
- if (!columnOrder.value.includes(key)) {
- columnOrder.value.push(key)
- }
- })
- } else {
- columnOrder.value = tableColumns.map(col => col.prop || col.label)
- }
-}
-
-// 列变化处理
-const handleColumnChange = (value: string[]) => {
- visibleColumns.value = value
- const routePath = route.path.replace(/^\//, '').replace(/\//g, '-')
- const storageKey = `table-columns-${routePath}`
- const selectableColumns = value.filter(col => {
- const column = tableColumns.find(c => (c.prop || c.label) === col)
- return column && !column.alwaysShow && !column.fixed
- })
- // 保存到本地统一存储
- saveTableConfigToLocal(storageKey, { visibleColumns: selectableColumns })
- // 异步保存到后端
- updateUserTableConfig(storageKey, { visibleColumns: selectableColumns }).catch(() => {})
-}
-
-// 列排序变化处理
-const handleColumnOrderChange = (order: string[]) => {
- columnOrder.value = order
- const routePath = route.path.replace(/^\//, '').replace(/\//g, '-')
- const storageKey = `table-columns-${routePath}`
- // 保存到本地统一存储
- saveTableConfigToLocal(storageKey, { columnOrder: order })
- // 异步保存到后端
- updateUserTableConfig(storageKey, { columnOrder: order }).catch(() => {})
-}
-
-// 排序后的表格列
-const visibleColumnsSorted = computed(() => {
- const columns = tableColumns.filter(col => {
- const key = col.prop || col.label
- return visibleColumns.value.includes(key)
- })
-
- if (columnOrder.value.length > 0) {
- const orderedColumns: any[] = []
- const unorderedColumns: any[] = []
-
- columnOrder.value.forEach(key => {
- const col = columns.find(c => (c.prop || c.label) === key)
- if (col) {
- orderedColumns.push(col)
- }
- })
-
- columns.forEach(col => {
- const key = col.prop || col.label
- if (!columnOrder.value.includes(key)) {
- unorderedColumns.push(col)
- }
- })
-
- return [...orderedColumns, ...unorderedColumns]
- }
-
- return columns
-})
+// 使用表格列控制 Hook
+const {
+ visibleColumnsSorted,
+ checkColumnVisible,
+ handleColumnChange,
+ handleColumnOrderChange
+} = useTableColumnControl(tableColumns)
// 审核表单
const auditForm = reactive({
@@ -510,10 +453,13 @@ const getAppealStatusListData = async () => {
}
// 初始化
-loadSavedConfig()
onMounted(() => {
getDeptListData()
getClassListData()
getAppealStatusListData()
})
+
+
diff --git a/src/views/stuwork/classmasterresume/index.vue b/src/views/stuwork/classmasterresume/index.vue
index 25365df..0c617c0 100644
--- a/src/views/stuwork/classmasterresume/index.vue
+++ b/src/views/stuwork/classmasterresume/index.vue
@@ -1,9 +1,22 @@
-
-
-
-
-
+
+
+
+
+
+
+
+
- 查询
+ 查询
重置
-
+
-
-
-
-
- 新 增
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ $index + 1 + ((state.pagination?.current || 1) - 1) * (state.pagination?.size || 10) }}
+
+
+
+
+
+
+ {{ col.label }}
-
-
+
+
+
+
+
+ 操作
+
+
+
+ 查看履历详情
+
+
+
+
+
+ 新增履历
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
- {{ col.label }}
-
-
-
-
-
- 操作
-
-
-
- 查看履历详情
-
-
-
-
-
-
-
+
@@ -131,22 +163,19 @@
+
diff --git a/src/views/stuwork/classpaper/index.vue b/src/views/stuwork/classpaper/index.vue
index 2495543..593c577 100644
--- a/src/views/stuwork/classpaper/index.vue
+++ b/src/views/stuwork/classpaper/index.vue
@@ -1,9 +1,17 @@
-
-
-
-
-
+
+
+
+
+
+
+
+
重置
-
+
-
-
-
-
- 新增
-
-
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
-
- {{ col.label }}
+
+
+ {{ $index + 1 + ((state.pagination?.current || 1) - 1) * (state.pagination?.size || 10) }}
+
+
+
+
+
+
+ {{ col.label }}
+
@@ -183,46 +200,56 @@
-
-
-
- 查看
-
-
- 编辑
-
-
- 加分
-
-
- 删除
-
+
+
+
+ 操作
+
+
+
+ 查看
+
+
+ 编辑
+
+
+ 加分
+
+
+ 删除
+
+
+
+
+
-
-
+
-
-
+
+
+
@@ -234,8 +261,7 @@
diff --git a/src/views/stuwork/classplan/index.vue b/src/views/stuwork/classplan/index.vue
index 573d0a1..2d9d29c 100644
--- a/src/views/stuwork/classplan/index.vue
+++ b/src/views/stuwork/classplan/index.vue
@@ -151,10 +151,10 @@
- {{ $index + 1 + (state.pagination.current - 1) * state.pagination.size }}
+ {{ $index + 1 + (state.pagination.current - 1) * state.pagination.size }}
-
+
-
+
{{ formatStatus(scope.row.status) }}
@@ -243,7 +243,8 @@ import { parseTime } from "/@/utils/formatTime";
import TableColumnControl from '/@/components/TableColumnControl/index.vue'
import FormDialog from './form.vue'
import { List, OfficeBuilding, Calendar, CircleCheck, Clock, Grid, Document, User, Setting, Menu, Search, EditPen } from '@element-plus/icons-vue'
-import { getTableConfigFromLocal, saveTableConfigToLocal, updateUserTableConfig } from '/@/api/admin/usertable'
+import { useTableColumnControl } from '/@/hooks/tableColumn'
+import '/@/styles/modern-page.scss'
// 定义变量内容
const route = useRoute()
@@ -281,104 +282,14 @@ const columnConfigMap: Record = {
createBy: { icon: User }
}
-// 当前显示的列
-const visibleColumns = ref([])
-// 列排序顺序
-const columnOrder = ref([])
-
-// 从本地统一存储加载配置
-const loadSavedConfig = () => {
- const routePath = route.path.replace(/^\//, '').replace(/\//g, '-')
- const storageKey = `table-columns-${routePath}`
- const savedConfig = getTableConfigFromLocal(storageKey)
-
- if (savedConfig && savedConfig.visibleColumns) {
- const validColumns = tableColumns.map(col => col.prop || col.label)
- const filteredSaved = savedConfig.visibleColumns.filter((col: string) => validColumns.includes(col))
- visibleColumns.value = filteredSaved.length > 0 ? filteredSaved : validColumns
- } else {
- visibleColumns.value = tableColumns.map(col => col.prop || col.label)
- }
-
- if (savedConfig && savedConfig.columnOrder) {
- const validColumns = tableColumns.map(col => col.prop || col.label)
- columnOrder.value = savedConfig.columnOrder.filter((key: string) => validColumns.includes(key))
- validColumns.forEach(key => {
- if (!columnOrder.value.includes(key)) {
- columnOrder.value.push(key)
- }
- })
- } else {
- columnOrder.value = tableColumns.map(col => col.prop || col.label)
- }
-}
-
-loadSavedConfig()
-
-// 排序后的表格列
-const sortedTableColumns = computed(() => {
- const columns = tableColumns.filter(col => {
- const key = col.prop || col.label
- return visibleColumns.value.includes(key)
- })
-
- if (columnOrder.value.length > 0) {
- const orderedColumns: typeof tableColumns = []
- const unorderedColumns: typeof tableColumns = []
-
- columnOrder.value.forEach(key => {
- const col = columns.find(c => (c.prop || c.label) === key)
- if (col) {
- orderedColumns.push(col)
- }
- })
-
- columns.forEach(col => {
- const key = col.prop || col.label
- if (!columnOrder.value.includes(key)) {
- unorderedColumns.push(col)
- }
- })
-
- return [...orderedColumns, ...unorderedColumns]
- }
-
- return columns
-})
-
-// 列显示控制函数
-const checkColumnVisible = (prop: string): boolean => {
- if (visibleColumns.value.length === 0) {
- return true
- }
- return visibleColumns.value.includes(prop)
-}
-
-// 监听列变化
-const handleColumnChange = (columns: string[]) => {
- visibleColumns.value = columns
- const routePath = route.path.replace(/^\//, '').replace(/\//g, '-')
- const storageKey = `table-columns-${routePath}`
- const selectableColumns = columns.filter(col => {
- const column = tableColumns.find(c => (c.prop || c.label) === col)
- return column && !column.alwaysShow && !column.fixed
- })
- // 保存到本地统一存储
- saveTableConfigToLocal(storageKey, { visibleColumns: selectableColumns })
- // 异步保存到后端
- updateUserTableConfig(storageKey, { visibleColumns: selectableColumns }).catch(() => {})
-}
-
-// 监听列排序变化
-const handleColumnOrderChange = (order: string[]) => {
- columnOrder.value = order
- const routePath = route.path.replace(/^\//, '').replace(/\//g, '-')
- const storageKey = `table-columns-${routePath}`
- // 保存到本地统一存储
- saveTableConfigToLocal(storageKey, { columnOrder: order })
- // 异步保存到后端
- updateUserTableConfig(storageKey, { columnOrder: order }).catch(() => {})
-}
+// 使用表格列控制hook
+const {
+ visibleColumns,
+ visibleColumnsSorted,
+ checkColumnVisible,
+ handleColumnChange,
+ handleColumnOrderChange
+} = useTableColumnControl(tableColumns)
// 配置 useTable
const state: BasicTableProps = reactive({
@@ -421,6 +332,25 @@ const formatStatus = (value: string) => {
return item ? item.label : value
}
+// 获取状态标签类型
+const getStatusTagType = (value: string) => {
+ if (!value) return 'info'
+ const item = statusList.value.find((item: any) => item.value === value)
+ if (!item) return 'info'
+
+ const label = item.label || item.dictLabel || item.name || ''
+ // 已提交用蓝色
+ if (label.includes('已提交') || label.includes('提交')) {
+ return 'primary'
+ }
+ // 审核通过用绿色
+ if (label.includes('审核通过') || label.includes('通过')) {
+ return 'success'
+ }
+ // 其他状态默认用灰色
+ return 'info'
+}
+
// 重置
const handleReset = () => {
searchFormRef.value?.resetFields()
@@ -537,7 +467,6 @@ onMounted(() => {
getStatusDict()
nextTick(() => {
if (visibleColumns.value.length === 0) {
- loadSavedConfig()
}
})
})
diff --git a/src/views/stuwork/classpublicity/index.vue b/src/views/stuwork/classpublicity/index.vue
index f15fac9..ac3d4d7 100644
--- a/src/views/stuwork/classpublicity/index.vue
+++ b/src/views/stuwork/classpublicity/index.vue
@@ -1,9 +1,17 @@
-
-
-
-
-
+
+
+
+
+
+
+
+
重置
-
+
-
-
-
-
- 新增
-
-
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
-
- {{ col.label }}
+
+
+ {{ $index + 1 + ((state.pagination?.current || 1) - 1) * (state.pagination?.size || 10) }}
+
+
+
+
+
+
+ {{ col.label }}
+
@@ -158,57 +175,63 @@
-
-
-
- 操作
+
+
+
+ 操作
+
+
+
+ 查看
+
+
+ 加分
+
+
+ 归档
+
+
+ 编辑
+
+
+ 删除
+
+
+
+
+
-
-
- 查看
-
-
- 加分
-
-
- 归档
-
-
- 编辑
-
-
- 删除
-
-
-
-
+
-
-
+
+
+
@@ -220,8 +243,7 @@
diff --git a/src/views/stuwork/classroombase/index.vue b/src/views/stuwork/classroombase/index.vue
index f5e1d1f..08d1237 100644
--- a/src/views/stuwork/classroombase/index.vue
+++ b/src/views/stuwork/classroombase/index.vue
@@ -1,9 +1,17 @@
-
-
-
-
-
+
+
+
+
+
+
+
+
重置
-
+
-
-
-
-
- 导出
-
-
- 同步教室安排
-
-
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
-
- {{ col.label }}
+
+
+ {{ $index + 1 + ((state.pagination?.current || 1) - 1) * (state.pagination?.size || 10) }}
+
+
+
+
+
+
+ {{ col.label }}
+
@@ -162,24 +181,34 @@
-
-
-
- 教室安排
-
+
+
+
+ 操作
+
+
+
+ 教室安排
+
+
+
+
+
-
-
+
-
-
+
+
+
@@ -188,8 +217,7 @@
diff --git a/src/views/stuwork/classroomhygienedaily/index.vue b/src/views/stuwork/classroomhygienedaily/index.vue
index 7250175..b073ac6 100644
--- a/src/views/stuwork/classroomhygienedaily/index.vue
+++ b/src/views/stuwork/classroomhygienedaily/index.vue
@@ -1,9 +1,22 @@
-
-
-
-
-
+
+
+
+
+
+
+
+
- 查询
+ 查询
重置
-
+
-
-
-
-
- 新 增
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ $index + 1 + ((state.pagination?.current || 1) - 1) * (state.pagination?.size || 10) }}
+
+
+
+
+
+
+ {{ col.label }}
-
-
+
+
+
+ {{ scope.row.score }}
+
+ -
+
+
+
+
+
+
+ 操作
+
+
+
+ 编辑
+
+
+ 删除
+
+
+
+
+
+ 新增记录
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
- {{ col.label }}
-
-
-
- {{ scope.row.score }}
-
- -
-
-
-
-
-
- 操作
-
-
-
- 编辑
-
-
- 删除
-
-
-
-
-
-
-
+
@@ -166,22 +199,20 @@
+
+
diff --git a/src/views/stuwork/classroomhygienedailyanalysis/index.vue b/src/views/stuwork/classroomhygienedailyanalysis/index.vue
index 953c68f..692dbaa 100644
--- a/src/views/stuwork/classroomhygienedailyanalysis/index.vue
+++ b/src/views/stuwork/classroomhygienedailyanalysis/index.vue
@@ -1,9 +1,17 @@
-
-
-
-
-
+
+
+
+
+
+
+
+
重置
-
+
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
-
- {{ col.label }}
+
+
+ {{ $index + 1 }}
+
+
+
+
+
+
+ {{ col.label }}
+
@@ -134,31 +154,33 @@
{{ day }}日
-
-
-
- 操作
+
+
+
+ 操作
+
+
+
+ 加分
+
+
+ 减分
+
+
+
+
+
-
-
- 加分
-
-
- 减分
-
-
-
-
-
-
+
+
@@ -216,19 +238,17 @@
+
+
diff --git a/src/views/stuwork/classroomhygienemonthly/index.vue b/src/views/stuwork/classroomhygienemonthly/index.vue
index b94267a..a2d0417 100644
--- a/src/views/stuwork/classroomhygienemonthly/index.vue
+++ b/src/views/stuwork/classroomhygienemonthly/index.vue
@@ -1,9 +1,17 @@
-
-
-
-
-
+
+
+
+
+
+
+
+
重置
-
+
-
-
-
-
- 导入
-
-
- 考核
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
-
- {{ col.label }}
+
+
+ {{ $index + 1 + ((state.pagination?.current || 1) - 1) * (state.pagination?.size || 10) }}
+
+
+
+
+
+
+ {{ col.label }}
+
@@ -160,30 +177,33 @@
-
+
+
+
+
+
+ 操作
+
+
+
+ 删除
+
+
-
-
-
-
- 操作
-
-
-
- 删除
-
-
-
-
+
-
-
+
+
+
@@ -262,8 +282,9 @@ import type { TableInstance } from 'element-plus'
// 引入组件
const UploadExcel = defineAsyncComponent(() => import('/@/components/Upload/Excel.vue'));
-import { List, Calendar, Clock, OfficeBuilding, Grid, UserFilled, Location, DataAnalysis, Document, Setting, Menu } from '@element-plus/icons-vue'
-import { getTableConfigFromLocal, saveTableConfigToLocal, updateUserTableConfig } from '/@/api/admin/usertable'
+import { List, Calendar, Clock, OfficeBuilding, Grid, UserFilled, Location, DataAnalysis, Document, Setting, Menu, Search } from '@element-plus/icons-vue'
+import { useTableColumnControl } from '/@/hooks/tableColumn'
+import '/@/styles/modern-page.scss'
// 定义变量内容
const route = useRoute()
@@ -297,126 +318,14 @@ const tableColumns = [
{ prop: '操作', label: '操作', alwaysShow: true, fixed: 'right' as const }
]
-// 当前显示的列(从 localStorage 读取或默认全部显示)
-const visibleColumns = ref
([])
-// 列排序顺序
-const columnOrder = ref([])
-
-// 从本地统一存储加载配置
-const loadSavedConfig = () => {
- const routePath = route.path.replace(/^\//, '').replace(/\//g, '-')
- const storageKey = `table-columns-${routePath}`
- const savedConfig = getTableConfigFromLocal(storageKey)
-
- const validColumns = tableColumns
- .filter(col => !col.alwaysShow && !col.fixed)
- .map(col => col.prop || col.label)
-
- if (savedConfig && savedConfig.visibleColumns) {
- const filteredSaved = savedConfig.visibleColumns.filter((col: string) => validColumns.includes(col))
- visibleColumns.value = filteredSaved.length > 0 ? filteredSaved : validColumns
- } else {
- visibleColumns.value = validColumns
- }
-
- if (savedConfig && savedConfig.columnOrder) {
- columnOrder.value = savedConfig.columnOrder.filter((key: string) => validColumns.includes(key))
- validColumns.forEach(key => {
- if (!columnOrder.value.includes(key)) {
- columnOrder.value.push(key)
- }
- })
- } else {
- columnOrder.value = validColumns
- }
-}
-
-// 立即加载保存的配置
-loadSavedConfig()
-
-// 初始化可见列(已废弃,使用 loadSavedConfig 代替)
-const initVisibleColumns = () => {
- // 配置已在组件创建时通过 loadSavedConfig() 加载
- // 这里只做兼容性处理,不重复加载
-}
-
-// 列显示控制函数
-const checkColumnVisible = (prop: string): boolean => {
- // 如果 visibleColumns 还没初始化,默认显示所有列
- if (visibleColumns.value.length === 0) {
- return true
- }
-
- // 检查 prop 是否在可见列列表中
- const isVisible = visibleColumns.value.includes(prop)
- return isVisible
-}
-
-// 监听列变化
-const handleColumnChange = (columns: string[]) => {
- visibleColumns.value = columns
- const routePath = route.path.replace(/^\//, '').replace(/\//g, '-')
- const storageKey = `table-columns-${routePath}`
- const selectableColumns = columns.filter(col => {
- const column = tableColumns.find(c => (c.prop || c.label) === col)
- return column && !column.alwaysShow && !column.fixed
- })
- // 保存到本地统一存储
- saveTableConfigToLocal(storageKey, { visibleColumns: selectableColumns })
- // 异步保存到后端
- updateUserTableConfig(storageKey, { visibleColumns: selectableColumns }).catch(() => {})
-}
-
-// 监听列排序变化
-const handleColumnOrderChange = (order: string[]) => {
- columnOrder.value = order
- const routePath = route.path.replace(/^\//, '').replace(/\//g, '-')
- const storageKey = `table-columns-${routePath}`
- // 保存到本地统一存储
- saveTableConfigToLocal(storageKey, { columnOrder: order })
- // 异步保存到后端
- updateUserTableConfig(storageKey, { columnOrder: order }).catch(() => {})
-}
-
-// 初始化列排序顺序(已废弃,使用 loadSavedConfig 代替)
-const initColumnOrder = () => {
- // 配置已在组件创建时通过 loadSavedConfig() 加载
- // 这里只做兼容性处理,不重复加载
-}
-
-// 获取排序后的列配置
-const sortedTableColumns = computed(() => {
- // 获取所有可排序的列
- const allSortableColumns = tableColumns.filter(col => !col.alwaysShow && !col.fixed)
-
- if (columnOrder.value.length === 0) {
- return allSortableColumns
- }
-
- const orderedColumns: typeof tableColumns = []
- const unorderedColumns: typeof tableColumns = []
-
- // 先按照保存的顺序添加列
- columnOrder.value.forEach(key => {
- const col = tableColumns.find(c => {
- const colKey = c.prop || c.label
- return colKey === key && !c.alwaysShow && !c.fixed
- })
- if (col) {
- orderedColumns.push(col)
- }
- })
-
- // 添加未在排序列表中的列(新增的列)
- allSortableColumns.forEach(col => {
- const key = col.prop || col.label
- if (!columnOrder.value.includes(key)) {
- unorderedColumns.push(col)
- }
- })
-
- return [...orderedColumns, ...unorderedColumns]
-})
+// 使用表格列控制hook
+const {
+ visibleColumns,
+ visibleColumnsSorted,
+ checkColumnVisible,
+ handleColumnChange,
+ handleColumnOrderChange
+} = useTableColumnControl(tableColumns.filter(col => !col.alwaysShow && !col.fixed))
// 列配置映射,包含每个列的渲染信息
const columnConfigMap: Record = {
@@ -674,15 +583,5 @@ onMounted(() => {
getDeptListData()
getClassListData()
getSchoolTermDict()
- // 配置已在组件创建时通过 loadSavedConfig() 加载
- // 确保配置已同步到 TableColumnControl 组件
- nextTick(() => {
- // 确保 visibleColumns 已正确加载
- if (visibleColumns.value.length === 0) {
- // 如果 visibleColumns 为空,重新加载配置
- loadSavedConfig()
- }
- // visibleColumns 已经通过 v-model 绑定到 TableColumnControl,应该会自动同步
- })
})
diff --git a/src/views/stuwork/classsafeedu/index.vue b/src/views/stuwork/classsafeedu/index.vue
index ab6cde2..20f94fd 100644
--- a/src/views/stuwork/classsafeedu/index.vue
+++ b/src/views/stuwork/classsafeedu/index.vue
@@ -1,9 +1,17 @@
-
-
-
-
-
+
+
+
+
+
+
+
+
重置
-
+
-
-
-
-
- 新增
-
-
- 导出
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ $index + 1 + ((state.pagination?.current || 1) - 1) * (state.pagination?.size || 10) }}
+
+
+
+
+
+
+ {{ col.label }}
+
+
+
+ {{ formatSchoolTerm(scope.row.schoolTerm) }}
+
+
+
+
+ {{ scope.row.attendNum }}
+
+ -
+
+
+
+ 查看
+
+ -
+
+
+
+ 查看
+
+ -
+
+
+
+
+
+
+ 操作
+
+
+
+ 查看详情
+
+
+ 编辑
+
+
+ 删除
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
- {{ col.label }}
-
-
-
- {{ formatSchoolTerm(scope.row.schoolTerm) }}
-
-
-
-
- {{ scope.row.attendNum }}
-
- -
-
-
-
- 查看
-
- -
-
-
-
- 查看
-
- -
-
-
-
-
-
- 操作
-
-
-
- 查看详情
-
-
- 编辑
-
-
- 删除
-
-
-
-
-
-
-
+
@@ -215,8 +239,7 @@
diff --git a/src/views/stuwork/classsummary/index.vue b/src/views/stuwork/classsummary/index.vue
index bcb102f..a92d177 100644
--- a/src/views/stuwork/classsummary/index.vue
+++ b/src/views/stuwork/classsummary/index.vue
@@ -1,9 +1,17 @@
-
-
-
-
-
+
+
+
+
+
+
+
+
重置
-
+
-
-
-
-
- 新增
-
-
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
- {{ col.label }}
-
+
+
+
+
+
+
+
+ {{ $index + 1 + ((state.pagination?.current || 1) - 1) * (state.pagination?.size || 10) }}
+
+
+
+
+
+
+ {{ col.label }}
+
{{ formatSchoolTerm(scope.row.schoolTerm) }}
@@ -222,42 +239,48 @@
-
-
-
- 操作
+
+
+
+ 操作
+
+
+
+ 查看
+
+
+ 编辑
+
+
+ 删除
+
+
+
+
+
-
-
- 查看
-
-
- 编辑
-
-
- 删除
-
-
-
-
+
-
-
+
+
+
@@ -269,8 +292,7 @@
diff --git a/src/views/stuwork/classtheme/index.vue b/src/views/stuwork/classtheme/index.vue
index e18b8ad..8a43587 100644
--- a/src/views/stuwork/classtheme/index.vue
+++ b/src/views/stuwork/classtheme/index.vue
@@ -1,9 +1,17 @@
-