添加老师排序
This commit is contained in:
parent
1416ffced7
commit
22a68dae35
|
@ -2,9 +2,9 @@ import { BasicColumn } from '/@/components/Table';
|
|||
import { FormSchema } from '/@/components/Table';
|
||||
import { rules } from '/@/utils/helper/validator';
|
||||
import { render } from '/@/utils/common/renderUtils';
|
||||
import { ref, onMounted,reactive } from 'vue';
|
||||
import { ref, onMounted, reactive } from 'vue';
|
||||
|
||||
const groupOptions=ref()
|
||||
const groupOptions = ref();
|
||||
// 创建一个简单的事件总线
|
||||
export const updateGroupOptions = reactive({
|
||||
updateGroupOptions(newOptions: any) {
|
||||
|
@ -17,34 +17,39 @@ export const columns: BasicColumn[] = [
|
|||
{
|
||||
title: '姓名',
|
||||
align: 'center',
|
||||
sorter: true,
|
||||
dataIndex: 'userName',
|
||||
},
|
||||
{
|
||||
title: '用户ID',
|
||||
align: 'center',
|
||||
sorter: true,
|
||||
dataIndex: 'userId',
|
||||
},
|
||||
{
|
||||
title: '工号',
|
||||
align: 'center',
|
||||
sorter: true,
|
||||
dataIndex: 'teacherId',
|
||||
},
|
||||
{
|
||||
title: '手机号',
|
||||
align: 'center',
|
||||
sorter: true,
|
||||
dataIndex: 'phone',
|
||||
},
|
||||
{
|
||||
title: '学科',
|
||||
align: 'center',
|
||||
dataIndex: 'majorId'
|
||||
sorter: true,
|
||||
dataIndex: 'majorId',
|
||||
},
|
||||
{
|
||||
title: '所属分组',
|
||||
align: 'center',
|
||||
//dataIndex: 'groupId',
|
||||
customRender: ({ text }) => {
|
||||
const group = groupOptions.value.find(item => item.value === text.groupId);
|
||||
const group = groupOptions.value.find((item) => item.value === text.groupId);
|
||||
if (group) {
|
||||
return group.label;
|
||||
}
|
||||
|
@ -54,6 +59,7 @@ export const columns: BasicColumn[] = [
|
|||
{
|
||||
title: '是否第一次阅卷',
|
||||
align: 'center',
|
||||
sorter: true,
|
||||
dataIndex: 'status',
|
||||
},
|
||||
//{
|
||||
|
@ -62,13 +68,11 @@ export const columns: BasicColumn[] = [
|
|||
// dataIndex: 'userMajorId',
|
||||
//},
|
||||
|
||||
|
||||
//{
|
||||
// title: '使用次数',
|
||||
// align: 'center',
|
||||
// dataIndex: 'numberuse',
|
||||
//},
|
||||
|
||||
];
|
||||
//查询数据
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
|
@ -90,7 +94,7 @@ export const searchFormSchema: FormSchema[] = [
|
|||
{ label: '政治', value: 8 },
|
||||
],
|
||||
},
|
||||
}
|
||||
},
|
||||
];
|
||||
//表单数据
|
||||
export const formSchema: FormSchema[] = [
|
||||
|
|
|
@ -18,41 +18,49 @@ export const columns: BasicColumn[] = [
|
|||
{
|
||||
title: '姓名',
|
||||
align: 'center',
|
||||
sorter: true,
|
||||
dataIndex: 'userName',
|
||||
},
|
||||
{
|
||||
title: '用户ID',
|
||||
align: 'center',
|
||||
sorter: true,
|
||||
dataIndex: 'userId',
|
||||
},
|
||||
{
|
||||
title: '年龄',
|
||||
align: 'center',
|
||||
sorter: true,
|
||||
dataIndex: 'age',
|
||||
},
|
||||
{
|
||||
title: '性别',
|
||||
align: 'center',
|
||||
sorter: true,
|
||||
dataIndex: 'sex',
|
||||
},
|
||||
{
|
||||
title: '学科',
|
||||
align: 'center',
|
||||
dataIndex: 'majorId'
|
||||
sorter: true,
|
||||
dataIndex: 'majorId',
|
||||
},
|
||||
{
|
||||
title: '手机号',
|
||||
align: 'center',
|
||||
sorter: true,
|
||||
dataIndex: 'phone',
|
||||
},
|
||||
{
|
||||
title: '职称',
|
||||
align: 'center',
|
||||
sorter: true,
|
||||
dataIndex: 'jobTitle',
|
||||
},
|
||||
{
|
||||
title: '职务',
|
||||
align: 'center',
|
||||
sorter: true,
|
||||
dataIndex: 'office',
|
||||
},
|
||||
{
|
||||
|
|
|
@ -1,8 +1,15 @@
|
|||
<template>
|
||||
<div>
|
||||
<!--引用表格-->
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection" ref="tableRef" :expandedRowKeys="expandedKeys"
|
||||
rowKey="id" :expandedRowRender="renderExpandedRow" @expand="handleExpand">
|
||||
<BasicTable
|
||||
@register="registerTable"
|
||||
:rowSelection="rowSelection"
|
||||
ref="tableRef"
|
||||
:expandedRowKeys="expandedKeys"
|
||||
rowKey="id"
|
||||
:expandedRowRender="renderExpandedRow"
|
||||
@expand="handleExpand"
|
||||
>
|
||||
<!--插槽:table标题-->
|
||||
<template #tableTitle>
|
||||
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
|
||||
|
@ -17,7 +24,8 @@
|
|||
</a-menu-item>
|
||||
</a-menu>
|
||||
</template>
|
||||
<a-button>批量操作
|
||||
<a-button
|
||||
>批量操作
|
||||
<Icon icon="mdi:chevron-down" />
|
||||
</a-button>
|
||||
</a-dropdown>
|
||||
|
@ -52,16 +60,21 @@
|
|||
</span>
|
||||
<span v-if="column.dataIndex === 'dormitoryName'">
|
||||
<!-- 选择逻辑存在问题使placeholder没办法显示 -->
|
||||
<a-select placeholder="请选择" size="small" style="width: 120px" v-model:value="record.dormitoryName"
|
||||
:disabled="record.dormitoryId != null" @focus="handleFocus(record.sex, record)"
|
||||
@change="handleChange(record.userId, record.dormitoryName, record)" filterables>
|
||||
<a-select
|
||||
placeholder="请选择"
|
||||
size="small"
|
||||
style="width: 120px"
|
||||
v-model:value="record.dormitoryName"
|
||||
:disabled="record.dormitoryName != null"
|
||||
@focus="handleFocus(record.sex, record)"
|
||||
@change="handleChange(record.userId, record.dormitoryName, record)"
|
||||
filterables
|
||||
>
|
||||
<template v-if="dormOptions.length === 0">
|
||||
<a-option value="" label="加载中..." disabled />
|
||||
</template>
|
||||
|
||||
<a-select-option v-for="item in dormOptions" :key="item.value" :label="item.label" :value="item.value">{{
|
||||
item.label
|
||||
}}</a-select-option>
|
||||
<a-select-option v-for="item in dormOptions" :key="item.value" :label="item.label" :value="item.value">{{ item.label }}</a-select-option>
|
||||
|
||||
<template v-if="dormOptions.length === 0">
|
||||
<a-option value="" label="暂无数据" disabled />
|
||||
|
@ -76,30 +89,40 @@
|
|||
</template>
|
||||
|
||||
<script lang="tsx" name="cees-ceesWaiTeacher" setup>
|
||||
import { ref, reactive, computed, unref, onMounted } from 'vue';
|
||||
import { BasicTable, useTable, TableAction } from '/@/components/Table';
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import CeesWaiTeacherModal from './components/CeesWaiTeacherModal.vue';
|
||||
import { columns, searchFormSchema, superQuerySchema, updateGroupOptions } from './CeesWaiTeacher.data';
|
||||
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl, getGroup, updateDormitory, cancelCheckIn, confirmCheckIn } from './CeesWaiTeacher.api';
|
||||
import { selectBySex } from '/@/views/cees/dormitory/CeesDormitoryInfo.api';
|
||||
import { downloadFile } from '/@/utils/common/renderUtils';
|
||||
import { useUserStore } from '/@/store/modules/user';
|
||||
const queryParam = reactive<any>({});
|
||||
const checkedKeys = ref<Array<string | number>>([]);
|
||||
const userStore = useUserStore();
|
||||
import { configStyleImportPlugin } from 'build/vite/plugin/styleImport';
|
||||
import { message } from 'ant-design-vue';
|
||||
import { registerCoordinateSystem } from 'echarts';
|
||||
import { ref, reactive, computed, unref, onMounted } from 'vue';
|
||||
import { BasicTable, useTable, TableAction } from '/@/components/Table';
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import CeesWaiTeacherModal from './components/CeesWaiTeacherModal.vue';
|
||||
import { columns, searchFormSchema, superQuerySchema, updateGroupOptions } from './CeesWaiTeacher.data';
|
||||
import {
|
||||
list,
|
||||
deleteOne,
|
||||
batchDelete,
|
||||
getImportUrl,
|
||||
getExportUrl,
|
||||
getGroup,
|
||||
updateDormitory,
|
||||
cancelCheckIn,
|
||||
confirmCheckIn,
|
||||
} from './CeesWaiTeacher.api';
|
||||
import { selectBySex } from '/@/views/cees/dormitory/CeesDormitoryInfo.api';
|
||||
import { downloadFile } from '/@/utils/common/renderUtils';
|
||||
import { useUserStore } from '/@/store/modules/user';
|
||||
const queryParam = reactive<any>({});
|
||||
const checkedKeys = ref<Array<string | number>>([]);
|
||||
const userStore = useUserStore();
|
||||
import { configStyleImportPlugin } from 'build/vite/plugin/styleImport';
|
||||
import { message } from 'ant-design-vue';
|
||||
import { registerCoordinateSystem } from 'echarts';
|
||||
|
||||
// 定义响应式数据
|
||||
const dormOptions = ref([]);
|
||||
// 定义响应式数据
|
||||
const dormOptions = ref([]);
|
||||
|
||||
//注册model
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
//注册table数据
|
||||
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
||||
//注册model
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
//注册table数据
|
||||
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
title: '外校老师管理',
|
||||
api: list,
|
||||
|
@ -129,11 +152,11 @@ const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
|||
url: getImportUrl,
|
||||
success: handleSuccess,
|
||||
},
|
||||
});
|
||||
// 指定默认展开的行(根据 rowKey 属性传入行的 key 值)
|
||||
const expandedKeys = ref<string[]>(['1']); // 默认展开第一行
|
||||
// 定义展开行内容的渲染函数
|
||||
const renderExpandedRow = (record: Record<string, any>) => {
|
||||
});
|
||||
// 指定默认展开的行(根据 rowKey 属性传入行的 key 值)
|
||||
const expandedKeys = ref<string[]>(['1']); // 默认展开第一行
|
||||
// 定义展开行内容的渲染函数
|
||||
const renderExpandedRow = (record: Record<string, any>) => {
|
||||
return (
|
||||
<a-descriptions column={2}>
|
||||
<a-descriptions-item label="身份证号"> {record.record.identityId} </a-descriptions-item>
|
||||
|
@ -146,9 +169,9 @@ const renderExpandedRow = (record: Record<string, any>) => {
|
|||
<a-descriptions-item label="饭卡号"> {record.record.mealCard} </a-descriptions-item>
|
||||
</a-descriptions>
|
||||
);
|
||||
};
|
||||
// 监听展开/收起事件,更新 expandedKeys
|
||||
const handleExpand = (expanded: boolean, record: Record<string, any>) => {
|
||||
};
|
||||
// 监听展开/收起事件,更新 expandedKeys
|
||||
const handleExpand = (expanded: boolean, record: Record<string, any>) => {
|
||||
console.log('展开/收起', expanded, record);
|
||||
if (expanded) {
|
||||
if (!expandedKeys.value.includes(record.id)) {
|
||||
|
@ -157,13 +180,13 @@ const handleExpand = (expanded: boolean, record: Record<string, any>) => {
|
|||
} else {
|
||||
expandedKeys.value = expandedKeys.value.filter((key) => key !== record.id);
|
||||
}
|
||||
};
|
||||
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
};
|
||||
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
|
||||
// 在组件加载时获取分组数据
|
||||
const groupOptions = ref<{ label: string; value: number }[]>([]);
|
||||
// 在组件加载时获取分组数据
|
||||
const groupOptions = ref<{ label: string; value: number }[]>([]);
|
||||
|
||||
onMounted(async () => {
|
||||
onMounted(async () => {
|
||||
console.log('组件已加载');
|
||||
try {
|
||||
const res = await getGroup();
|
||||
|
@ -177,71 +200,71 @@ onMounted(async () => {
|
|||
} catch (error) {
|
||||
console.error('获取分组数据失败:', error);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// 高级查询配置
|
||||
const superQueryConfig = reactive(superQuerySchema);
|
||||
// 高级查询配置
|
||||
const superQueryConfig = reactive(superQuerySchema);
|
||||
|
||||
/**
|
||||
/**
|
||||
* 高级查询事件
|
||||
*/
|
||||
function handleSuperQuery(params) {
|
||||
function handleSuperQuery(params) {
|
||||
Object.keys(params).map((k) => {
|
||||
queryParam[k] = params[k];
|
||||
});
|
||||
reload();
|
||||
}
|
||||
/**
|
||||
}
|
||||
/**
|
||||
* 新增事件
|
||||
*/
|
||||
function handleAdd() {
|
||||
function handleAdd() {
|
||||
openModal(true, {
|
||||
isUpdate: false,
|
||||
showFooter: true,
|
||||
});
|
||||
}
|
||||
/**
|
||||
}
|
||||
/**
|
||||
* 编辑事件
|
||||
*/
|
||||
function handleEdit(record: Recordable) {
|
||||
function handleEdit(record: Recordable) {
|
||||
openModal(true, {
|
||||
record,
|
||||
isUpdate: true,
|
||||
showFooter: true,
|
||||
});
|
||||
}
|
||||
/**
|
||||
}
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
function handleDetail(record: Recordable) {
|
||||
function handleDetail(record: Recordable) {
|
||||
openModal(true, {
|
||||
record,
|
||||
isUpdate: true,
|
||||
showFooter: false,
|
||||
});
|
||||
}
|
||||
/**
|
||||
}
|
||||
/**
|
||||
* 删除事件
|
||||
*/
|
||||
async function handleDelete(record) {
|
||||
async function handleDelete(record) {
|
||||
await deleteOne({ id: record.id }, handleSuccess);
|
||||
}
|
||||
/**
|
||||
}
|
||||
/**
|
||||
* 批量删除事件
|
||||
*/
|
||||
async function batchHandleDelete() {
|
||||
async function batchHandleDelete() {
|
||||
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
|
||||
}
|
||||
/**
|
||||
}
|
||||
/**
|
||||
* 成功回调
|
||||
*/
|
||||
function handleSuccess() {
|
||||
function handleSuccess() {
|
||||
(selectedRowKeys.value = []) && reload();
|
||||
}
|
||||
/**
|
||||
}
|
||||
/**
|
||||
* 操作栏
|
||||
*/
|
||||
function getTableAction(record) {
|
||||
function getTableAction(record) {
|
||||
const actions = [
|
||||
{
|
||||
label: '编辑',
|
||||
|
@ -250,8 +273,8 @@ function getTableAction(record) {
|
|||
];
|
||||
|
||||
return actions;
|
||||
}
|
||||
function ConfirmRegistration(record) {
|
||||
}
|
||||
function ConfirmRegistration(record) {
|
||||
const actions = [{}];
|
||||
// 添加“确认报到”和“取消确认”按钮
|
||||
if (record.status === 0) {
|
||||
|
@ -268,9 +291,9 @@ function ConfirmRegistration(record) {
|
|||
});
|
||||
}
|
||||
return actions;
|
||||
}
|
||||
}
|
||||
|
||||
async function updateStatus(id, action = '') {
|
||||
async function updateStatus(id, action = '') {
|
||||
try {
|
||||
let params = { id };
|
||||
if (action === 'un') {
|
||||
|
@ -289,11 +312,11 @@ async function updateStatus(id, action = '') {
|
|||
} catch (error) {
|
||||
console.error('操作失败:', error);
|
||||
}
|
||||
}
|
||||
/**
|
||||
}
|
||||
/**
|
||||
* 下拉操作栏
|
||||
*/
|
||||
function getDropDownAction(record) {
|
||||
function getDropDownAction(record) {
|
||||
return [
|
||||
{
|
||||
label: '详情',
|
||||
|
@ -308,10 +331,10 @@ function getDropDownAction(record) {
|
|||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
// 定义 handleFocus 函数
|
||||
async function handleFocus(sex, record) {
|
||||
// 定义 handleFocus 函数
|
||||
async function handleFocus(sex, record) {
|
||||
console.log('dormitory11:', record.dormitoryId);
|
||||
console.log('性别:', sex);
|
||||
try {
|
||||
|
@ -337,12 +360,12 @@ async function handleFocus(sex, record) {
|
|||
} catch (error) {
|
||||
console.error('在 handleFocus 中发生错误:', error);
|
||||
}
|
||||
}
|
||||
// 定义 handleFocus 函数
|
||||
async function handleChange(userId, dormitory, record) {
|
||||
console.log("userId", userId)
|
||||
console.log("dormitory", dormitory)
|
||||
console.log("record", record)
|
||||
}
|
||||
// 定义 handleFocus 函数
|
||||
async function handleChange(userId, dormitory, record) {
|
||||
console.log('userId', userId);
|
||||
console.log('dormitory', dormitory);
|
||||
console.log('record', record);
|
||||
let params = {
|
||||
id: userId,
|
||||
dormitory: dormitory,
|
||||
|
@ -354,11 +377,11 @@ async function handleChange(userId, dormitory, record) {
|
|||
} catch (error) {
|
||||
console.error('在 handleFocus 中发生错误:', error);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.ant-select .ant-input__inner::placeholder {
|
||||
.ant-select .ant-input__inner::placeholder {
|
||||
color: #999 !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
Loading…
Reference in New Issue