jenkins 更新测试
This commit is contained in:
67708
docs/默认模块.openapi.json
67708
docs/默认模块.openapi.json
File diff suppressed because one or more lines are too long
1
src/api/jsonflow/Untitled
Normal file
1
src/api/jsonflow/Untitled
Normal file
@@ -0,0 +1 @@
|
|||||||
|
basic/basicdept/page
|
||||||
69
src/api/stuwork/classconstruction.ts
Normal file
69
src/api/stuwork/classconstruction.ts
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
import request from '/@/utils/request';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询班级建设方案列表
|
||||||
|
* @param query
|
||||||
|
*/
|
||||||
|
export const fetchList = (query?: any) => {
|
||||||
|
return request({
|
||||||
|
url: '/stuwork/classconstruction/page',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化班级建设方案
|
||||||
|
* @param data
|
||||||
|
*/
|
||||||
|
export const initObj = (data?: any) => {
|
||||||
|
return request({
|
||||||
|
url: '/stuwork/classconstruction',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取详情
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
|
export const getDetail = (id: string) => {
|
||||||
|
return request({
|
||||||
|
url: '/stuwork/classconstruction/detail',
|
||||||
|
method: 'get',
|
||||||
|
params: { id }
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑班级建设方案(新增和修改都用这个接口)
|
||||||
|
* @param data
|
||||||
|
*/
|
||||||
|
export const editObj = (data: any) => {
|
||||||
|
return request({
|
||||||
|
url: '/stuwork/classconstruction/edit',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增班级建设方案(使用编辑接口)
|
||||||
|
* @param data
|
||||||
|
*/
|
||||||
|
export const addObj = (data: any) => {
|
||||||
|
return editObj(data);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除班级建设方案
|
||||||
|
* @param ids
|
||||||
|
*/
|
||||||
|
export const delObj = (ids: string[]) => {
|
||||||
|
return request({
|
||||||
|
url: '/stuwork/classconstruction/delete',
|
||||||
|
method: 'post',
|
||||||
|
data: ids
|
||||||
|
});
|
||||||
|
};
|
||||||
62
src/api/stuwork/classplan.ts
Normal file
62
src/api/stuwork/classplan.ts
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
import request from '/@/utils/request';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询班级计划列表
|
||||||
|
* @param query
|
||||||
|
*/
|
||||||
|
export const fetchList = (query?: any) => {
|
||||||
|
return request({
|
||||||
|
url: '/stuwork/classplan/page',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增班级计划
|
||||||
|
* @param data
|
||||||
|
*/
|
||||||
|
export const addObj = (data: any) => {
|
||||||
|
return request({
|
||||||
|
url: '/stuwork/classplan',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取详情
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
|
export const getDetail = (id: string) => {
|
||||||
|
return request({
|
||||||
|
url: '/stuwork/classplan/detail',
|
||||||
|
method: 'get',
|
||||||
|
params: { id }
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑班级计划
|
||||||
|
* @param data
|
||||||
|
*/
|
||||||
|
export const editObj = (data: any) => {
|
||||||
|
return request({
|
||||||
|
url: '/stuwork/classplan/edit',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除班级计划
|
||||||
|
* @param ids
|
||||||
|
*/
|
||||||
|
export const delObj = (ids: string[]) => {
|
||||||
|
return request({
|
||||||
|
url: '/stuwork/classplan/delete',
|
||||||
|
method: 'post',
|
||||||
|
data: ids
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
110
src/views/stuwork/classconstruction/fileList.vue
Normal file
110
src/views/stuwork/classconstruction/fileList.vue
Normal file
@@ -0,0 +1,110 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog
|
||||||
|
title="附件列表"
|
||||||
|
v-model="visible"
|
||||||
|
:width="800"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
draggable>
|
||||||
|
<div v-loading="loading">
|
||||||
|
<div v-if="fileList.length === 0" class="text-center text-gray-400 py-10">
|
||||||
|
暂无附件
|
||||||
|
</div>
|
||||||
|
<div v-else>
|
||||||
|
<div
|
||||||
|
v-for="(file, index) in fileList"
|
||||||
|
:key="index"
|
||||||
|
class="flex items-center px-4 py-3 mb-2 rounded border border-gray-200 hover:bg-blue-50 transition-colors">
|
||||||
|
<el-icon class="mr-3 text-blue-500 text-lg"><Document /></el-icon>
|
||||||
|
<span class="flex-1 text-gray-700 truncate">{{ getFileName(file) }}</span>
|
||||||
|
<el-button
|
||||||
|
icon="Download"
|
||||||
|
text
|
||||||
|
type="primary"
|
||||||
|
size="small"
|
||||||
|
@click="handleDownload(file)">
|
||||||
|
下载
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<template #footer>
|
||||||
|
<span class="dialog-footer">
|
||||||
|
<el-button @click="visible = false">关 闭</el-button>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts" name="ClassConstructionFileListDialog">
|
||||||
|
import { ref } from 'vue'
|
||||||
|
import { Document, Download } from '@element-plus/icons-vue'
|
||||||
|
import { getDetail } from '/@/api/stuwork/classconstruction'
|
||||||
|
import { useMessage } from '/@/hooks/message'
|
||||||
|
import other from '/@/utils/other'
|
||||||
|
|
||||||
|
// 定义变量内容
|
||||||
|
const visible = ref(false)
|
||||||
|
const loading = ref(false)
|
||||||
|
const fileList = ref<string[]>([])
|
||||||
|
const currentRow = ref<any>(null)
|
||||||
|
|
||||||
|
// 获取文件名
|
||||||
|
const getFileName = (url: string): string => {
|
||||||
|
if (!url) return '未知文件'
|
||||||
|
return other.getQueryString(url, 'fileName') || other.getQueryString(url, 'originalFileName') || url.split('/').pop() || '未知文件'
|
||||||
|
}
|
||||||
|
|
||||||
|
// 下载文件
|
||||||
|
const handleDownload = (url: string) => {
|
||||||
|
if (!url) {
|
||||||
|
useMessage().warning('文件地址无效')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
window.open(url, '_blank')
|
||||||
|
}
|
||||||
|
|
||||||
|
// 打开弹窗
|
||||||
|
const openDialog = async (row: any) => {
|
||||||
|
visible.value = true
|
||||||
|
currentRow.value = row
|
||||||
|
fileList.value = []
|
||||||
|
|
||||||
|
if (!row.id) {
|
||||||
|
useMessage().warning('数据异常')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
loading.value = true
|
||||||
|
try {
|
||||||
|
// API文档中没有单独的附件列表接口,直接从row中获取fileUrl
|
||||||
|
if (row.fileUrl) {
|
||||||
|
const urls = row.fileUrl
|
||||||
|
fileList.value = typeof urls === 'string' ? urls.split(',').filter((url: string) => url.trim()) : []
|
||||||
|
} else {
|
||||||
|
// 如果没有fileUrl,尝试获取详情
|
||||||
|
const res = await getDetail(row.id)
|
||||||
|
if (res.data && res.data.fileUrl) {
|
||||||
|
const urls = res.data.fileUrl
|
||||||
|
fileList.value = typeof urls === 'string' ? urls.split(',').filter((url: string) => url.trim()) : []
|
||||||
|
} else {
|
||||||
|
fileList.value = []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (err: any) {
|
||||||
|
console.error('获取附件列表失败', err)
|
||||||
|
useMessage().error(err.msg || '获取附件列表失败')
|
||||||
|
fileList.value = []
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 暴露方法
|
||||||
|
defineExpose({
|
||||||
|
openDialog
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
</style>
|
||||||
|
|
||||||
167
src/views/stuwork/classconstruction/form.vue
Normal file
167
src/views/stuwork/classconstruction/form.vue
Normal file
@@ -0,0 +1,167 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog
|
||||||
|
:title="form.id ? '编辑' : '新增'"
|
||||||
|
v-model="visible"
|
||||||
|
:width="800"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
draggable>
|
||||||
|
<el-form
|
||||||
|
ref="dataFormRef"
|
||||||
|
:model="form"
|
||||||
|
:rules="dataRules"
|
||||||
|
label-width="100px"
|
||||||
|
v-loading="loading">
|
||||||
|
<el-row :gutter="24">
|
||||||
|
<el-col :span="24" class="mb20">
|
||||||
|
<el-form-item label="标题" prop="title">
|
||||||
|
<el-input
|
||||||
|
v-model="form.title"
|
||||||
|
placeholder="请输入标题"
|
||||||
|
style="width: 100%" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24" class="mb20">
|
||||||
|
<el-form-item label="内容" prop="content">
|
||||||
|
<Editor
|
||||||
|
v-model:getHtml="form.content"
|
||||||
|
:height="'400'"
|
||||||
|
placeholder="请输入内容" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24" class="mb20">
|
||||||
|
<el-form-item label="备注" prop="remarks">
|
||||||
|
<el-input
|
||||||
|
v-model="form.remarks"
|
||||||
|
type="textarea"
|
||||||
|
:rows="4"
|
||||||
|
placeholder="请输入备注"
|
||||||
|
:maxlength="250"
|
||||||
|
show-word-limit
|
||||||
|
style="width: 100%" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<span class="dialog-footer">
|
||||||
|
<el-button @click="visible = false">取 消</el-button>
|
||||||
|
<el-button type="primary" @click="onSubmit" :disabled="loading">确 认</el-button>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts" name="ClassConstructionFormDialog">
|
||||||
|
import { ref, reactive, nextTick } from 'vue'
|
||||||
|
import { useMessage } from '/@/hooks/message'
|
||||||
|
import { addObj, editObj, getDetail } from '/@/api/stuwork/classconstruction'
|
||||||
|
import Editor from '/@/components/Editor/index.vue'
|
||||||
|
|
||||||
|
const emit = defineEmits(['refresh'])
|
||||||
|
|
||||||
|
// 定义变量内容
|
||||||
|
const dataFormRef = ref()
|
||||||
|
const visible = ref(false)
|
||||||
|
const loading = ref(false)
|
||||||
|
const operType = ref('add') // add 或 edit
|
||||||
|
|
||||||
|
// 提交表单数据
|
||||||
|
const form = reactive({
|
||||||
|
id: '',
|
||||||
|
title: '',
|
||||||
|
content: '',
|
||||||
|
remarks: ''
|
||||||
|
})
|
||||||
|
|
||||||
|
// 定义校验规则
|
||||||
|
const dataRules = {
|
||||||
|
title: [
|
||||||
|
{ required: true, message: '请输入标题', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
content: [
|
||||||
|
{ required: true, message: '请输入内容', trigger: 'blur' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
// 打开弹窗
|
||||||
|
const openDialog = async (type: string = 'add', row?: any) => {
|
||||||
|
visible.value = true
|
||||||
|
operType.value = type
|
||||||
|
|
||||||
|
// 重置表单数据
|
||||||
|
nextTick(() => {
|
||||||
|
dataFormRef.value?.resetFields()
|
||||||
|
form.id = ''
|
||||||
|
form.title = ''
|
||||||
|
form.content = ''
|
||||||
|
form.remarks = ''
|
||||||
|
|
||||||
|
// 编辑时填充数据
|
||||||
|
if (type === 'edit' && row) {
|
||||||
|
form.id = row.id
|
||||||
|
form.title = row.title || ''
|
||||||
|
form.content = row.content || ''
|
||||||
|
form.remarks = row.remarks || ''
|
||||||
|
|
||||||
|
// 如果需要获取详情
|
||||||
|
if (row.id && !row.content) {
|
||||||
|
loading.value = true
|
||||||
|
getDetail(row.id).then((res: any) => {
|
||||||
|
if (res.data) {
|
||||||
|
form.content = res.data.content || ''
|
||||||
|
form.remarks = res.data.remarks || ''
|
||||||
|
}
|
||||||
|
}).finally(() => {
|
||||||
|
loading.value = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 提交表单
|
||||||
|
const onSubmit = async () => {
|
||||||
|
if (!dataFormRef.value) return
|
||||||
|
|
||||||
|
await dataFormRef.value.validate(async (valid: boolean) => {
|
||||||
|
if (!valid) return
|
||||||
|
|
||||||
|
loading.value = true
|
||||||
|
try {
|
||||||
|
const submitData = {
|
||||||
|
title: form.title,
|
||||||
|
content: form.content,
|
||||||
|
remarks: form.remarks
|
||||||
|
}
|
||||||
|
|
||||||
|
if (operType.value === 'add') {
|
||||||
|
await addObj(submitData)
|
||||||
|
useMessage().success('新增成功')
|
||||||
|
} else {
|
||||||
|
await editObj({
|
||||||
|
id: form.id,
|
||||||
|
...submitData
|
||||||
|
})
|
||||||
|
useMessage().success('编辑成功')
|
||||||
|
}
|
||||||
|
visible.value = false
|
||||||
|
emit('refresh')
|
||||||
|
} catch (err: any) {
|
||||||
|
useMessage().error(err.msg || (operType.value === 'add' ? '新增失败' : '编辑失败'))
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 暴露方法
|
||||||
|
defineExpose({
|
||||||
|
openDialog
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.mb20 {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
276
src/views/stuwork/classconstruction/index.vue
Normal file
276
src/views/stuwork/classconstruction/index.vue
Normal file
@@ -0,0 +1,276 @@
|
|||||||
|
<template>
|
||||||
|
<div class="layout-padding">
|
||||||
|
<div class="layout-padding-auto layout-padding-view">
|
||||||
|
<!-- 搜索表单 -->
|
||||||
|
<el-row v-show="showSearch">
|
||||||
|
<el-form :model="state.queryForm" ref="searchFormRef" :inline="true" @keyup.enter="getDataList">
|
||||||
|
<el-form-item label="学院" prop="deptCode">
|
||||||
|
<el-select
|
||||||
|
v-model="state.queryForm.deptCode"
|
||||||
|
placeholder="请选择学院"
|
||||||
|
clearable
|
||||||
|
filterable
|
||||||
|
style="width: 200px"
|
||||||
|
@change="handleDeptChange">
|
||||||
|
<el-option
|
||||||
|
v-for="item in deptList"
|
||||||
|
:key="item.deptCode"
|
||||||
|
:label="item.deptName"
|
||||||
|
:value="item.deptCode">
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="班级" prop="classNo">
|
||||||
|
<el-select
|
||||||
|
v-model="state.queryForm.classNo"
|
||||||
|
placeholder="请选择班级"
|
||||||
|
clearable
|
||||||
|
filterable
|
||||||
|
style="width: 200px">
|
||||||
|
<el-option
|
||||||
|
v-for="item in classList"
|
||||||
|
:key="item.classNo"
|
||||||
|
:label="item.classNo"
|
||||||
|
:value="item.classNo">
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="标题" prop="title">
|
||||||
|
<el-input
|
||||||
|
v-model="state.queryForm.title"
|
||||||
|
placeholder="请输入标题"
|
||||||
|
clearable
|
||||||
|
style="width: 200px" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" plain icon="Search" @click="getDataList">查询</el-button>
|
||||||
|
<el-button icon="Refresh" @click="handleReset">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<!-- 操作按钮 -->
|
||||||
|
<el-row>
|
||||||
|
<div class="mb8" style="width: 100%">
|
||||||
|
<el-button
|
||||||
|
icon="Plus"
|
||||||
|
type="primary"
|
||||||
|
class="ml10"
|
||||||
|
@click="formDialogRef.openDialog()">
|
||||||
|
新增
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
icon="RefreshLeft"
|
||||||
|
type="warning"
|
||||||
|
class="ml10"
|
||||||
|
@click="handleInit">
|
||||||
|
初始化
|
||||||
|
</el-button>
|
||||||
|
<right-toolbar
|
||||||
|
v-model:showSearch="showSearch"
|
||||||
|
class="ml10 mr20"
|
||||||
|
style="float: right;"
|
||||||
|
@queryTable="getDataList">
|
||||||
|
</right-toolbar>
|
||||||
|
</div>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<!-- 表格 -->
|
||||||
|
<el-table
|
||||||
|
:data="state.dataList"
|
||||||
|
v-loading="state.loading"
|
||||||
|
border
|
||||||
|
:cell-style="tableStyle.cellStyle"
|
||||||
|
:header-cell-style="tableStyle.headerCellStyle">
|
||||||
|
<el-table-column type="index" label="序号" width="60" align="center" />
|
||||||
|
<el-table-column prop="deptName" label="学院" show-overflow-tooltip align="center" />
|
||||||
|
<el-table-column prop="classNo" label="班级" show-overflow-tooltip align="center" />
|
||||||
|
<el-table-column prop="title" label="标题" show-overflow-tooltip align="center" min-width="200" />
|
||||||
|
<el-table-column prop="createTime" label="创建时间" show-overflow-tooltip align="center" width="180">
|
||||||
|
<template #default="scope">
|
||||||
|
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="remarks" label="备注" show-overflow-tooltip align="center" min-width="200" />
|
||||||
|
<el-table-column label="操作" width="250" align="center" fixed="right">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button
|
||||||
|
icon="Edit"
|
||||||
|
text
|
||||||
|
type="primary"
|
||||||
|
@click="handleEdit(scope.row)">
|
||||||
|
编辑
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
icon="Document"
|
||||||
|
text
|
||||||
|
type="info"
|
||||||
|
@click="handleFileList(scope.row)">
|
||||||
|
附件列表
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
icon="Delete"
|
||||||
|
text
|
||||||
|
type="danger"
|
||||||
|
@click="handleDelete(scope.row)">
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<!-- 分页 -->
|
||||||
|
<pagination
|
||||||
|
@size-change="sizeChangeHandle"
|
||||||
|
@current-change="currentChangeHandle"
|
||||||
|
v-bind="state.pagination" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 新增/编辑表单弹窗 -->
|
||||||
|
<form-dialog ref="formDialogRef" @refresh="getDataList" />
|
||||||
|
|
||||||
|
<!-- 附件列表弹窗 -->
|
||||||
|
<file-list-dialog ref="fileListDialogRef" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts" name="ClassConstruction">
|
||||||
|
import { reactive, ref, onMounted } from 'vue'
|
||||||
|
import { BasicTableProps, useTable } from "/@/hooks/table";
|
||||||
|
import { fetchList, delObj, initObj } from "/@/api/stuwork/classconstruction";
|
||||||
|
import { getDeptList } from "/@/api/basic/basicclass";
|
||||||
|
import { list as getClassList } from "/@/api/basic/basicclass";
|
||||||
|
import { useMessage, useMessageBox } from "/@/hooks/message";
|
||||||
|
import { parseTime } from "/@/utils/formatTime"
|
||||||
|
import FormDialog from './form.vue'
|
||||||
|
import FileListDialog from './fileList.vue'
|
||||||
|
|
||||||
|
// 定义变量内容
|
||||||
|
const formDialogRef = ref()
|
||||||
|
const fileListDialogRef = ref()
|
||||||
|
const searchFormRef = ref()
|
||||||
|
const showSearch = ref(true)
|
||||||
|
const deptList = ref<any[]>([])
|
||||||
|
const classList = ref<any[]>([])
|
||||||
|
|
||||||
|
// 配置 useTable
|
||||||
|
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||||
|
queryForm: {
|
||||||
|
deptCode: '',
|
||||||
|
classNo: '',
|
||||||
|
title: ''
|
||||||
|
},
|
||||||
|
pageList: fetchList,
|
||||||
|
props: {
|
||||||
|
item: 'records',
|
||||||
|
totalCount: 'total'
|
||||||
|
},
|
||||||
|
createdIsNeed: true
|
||||||
|
})
|
||||||
|
|
||||||
|
// table hook
|
||||||
|
const {
|
||||||
|
getDataList,
|
||||||
|
currentChangeHandle,
|
||||||
|
sizeChangeHandle,
|
||||||
|
tableStyle
|
||||||
|
} = useTable(state)
|
||||||
|
|
||||||
|
// 学院变化时更新班级列表
|
||||||
|
const handleDeptChange = async (deptCode: string) => {
|
||||||
|
state.queryForm.classNo = ''
|
||||||
|
if (deptCode) {
|
||||||
|
await getClassListByDept(deptCode)
|
||||||
|
} else {
|
||||||
|
classList.value = []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据学院获取班级列表
|
||||||
|
const getClassListByDept = async (deptCode: string) => {
|
||||||
|
try {
|
||||||
|
const res = await getClassList()
|
||||||
|
if (res.data && Array.isArray(res.data)) {
|
||||||
|
classList.value = res.data.filter((item: any) => item.deptCode === deptCode)
|
||||||
|
} else {
|
||||||
|
classList.value = []
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.error('获取班级列表失败', err)
|
||||||
|
classList.value = []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 重置
|
||||||
|
const handleReset = () => {
|
||||||
|
searchFormRef.value?.resetFields()
|
||||||
|
state.queryForm.deptCode = ''
|
||||||
|
state.queryForm.classNo = ''
|
||||||
|
state.queryForm.title = ''
|
||||||
|
classList.value = []
|
||||||
|
getDataList()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 编辑
|
||||||
|
const handleEdit = (row: any) => {
|
||||||
|
formDialogRef.value?.openDialog('edit', row)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除
|
||||||
|
const handleDelete = async (row: any) => {
|
||||||
|
const { confirm } = useMessageBox()
|
||||||
|
try {
|
||||||
|
await confirm('确定要删除该班级建设方案吗?')
|
||||||
|
await delObj([row.id])
|
||||||
|
useMessage().success('删除成功')
|
||||||
|
getDataList()
|
||||||
|
} catch (err: any) {
|
||||||
|
if (err !== 'cancel') {
|
||||||
|
useMessage().error(err.msg || '删除失败')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 初始化
|
||||||
|
const handleInit = async () => {
|
||||||
|
const { confirm } = useMessageBox()
|
||||||
|
try {
|
||||||
|
await confirm('确定要初始化班级建设方案吗?')
|
||||||
|
await initObj()
|
||||||
|
useMessage().success('初始化成功')
|
||||||
|
getDataList()
|
||||||
|
} catch (err: any) {
|
||||||
|
if (err !== 'cancel') {
|
||||||
|
useMessage().error(err.msg || '初始化失败')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 附件列表
|
||||||
|
const handleFileList = (row: any) => {
|
||||||
|
fileListDialogRef.value?.openDialog(row)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取学院列表
|
||||||
|
const getDeptListData = async () => {
|
||||||
|
try {
|
||||||
|
const res = await getDeptList()
|
||||||
|
if (res.data && Array.isArray(res.data)) {
|
||||||
|
deptList.value = res.data
|
||||||
|
} else {
|
||||||
|
deptList.value = []
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.error('获取学院列表失败', err)
|
||||||
|
deptList.value = []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 初始化
|
||||||
|
onMounted(() => {
|
||||||
|
getDeptListData()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
</style>
|
||||||
168
src/views/stuwork/classplan/form.vue
Normal file
168
src/views/stuwork/classplan/form.vue
Normal file
@@ -0,0 +1,168 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog
|
||||||
|
:title="form.id ? '编辑' : '新增'"
|
||||||
|
v-model="visible"
|
||||||
|
:width="800"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
draggable>
|
||||||
|
<el-form
|
||||||
|
ref="dataFormRef"
|
||||||
|
:model="form"
|
||||||
|
:rules="dataRules"
|
||||||
|
label-width="100px"
|
||||||
|
v-loading="loading">
|
||||||
|
<el-row :gutter="24">
|
||||||
|
<el-col :span="24" class="mb20">
|
||||||
|
<el-form-item label="标题" prop="title">
|
||||||
|
<el-input
|
||||||
|
v-model="form.title"
|
||||||
|
placeholder="请输入标题"
|
||||||
|
style="width: 100%" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24" class="mb20">
|
||||||
|
<el-form-item label="内容" prop="content">
|
||||||
|
<Editor
|
||||||
|
v-model:getHtml="form.content"
|
||||||
|
:height="'400'"
|
||||||
|
placeholder="请输入内容" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24" class="mb20">
|
||||||
|
<el-form-item label="备注" prop="remarks">
|
||||||
|
<el-input
|
||||||
|
v-model="form.remarks"
|
||||||
|
type="textarea"
|
||||||
|
:rows="4"
|
||||||
|
placeholder="请输入备注"
|
||||||
|
:maxlength="250"
|
||||||
|
show-word-limit
|
||||||
|
style="width: 100%" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<span class="dialog-footer">
|
||||||
|
<el-button @click="visible = false">取 消</el-button>
|
||||||
|
<el-button type="primary" @click="onSubmit" :disabled="loading">确 认</el-button>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts" name="ClassPlanFormDialog">
|
||||||
|
import { ref, reactive, nextTick } from 'vue'
|
||||||
|
import { useMessage } from '/@/hooks/message'
|
||||||
|
import { addObj, editObj, getDetail } from '/@/api/stuwork/classplan'
|
||||||
|
import Editor from '/@/components/Editor/index.vue'
|
||||||
|
|
||||||
|
const emit = defineEmits(['refresh'])
|
||||||
|
|
||||||
|
// 定义变量内容
|
||||||
|
const dataFormRef = ref()
|
||||||
|
const visible = ref(false)
|
||||||
|
const loading = ref(false)
|
||||||
|
const operType = ref('add') // add 或 edit
|
||||||
|
|
||||||
|
// 提交表单数据
|
||||||
|
const form = reactive({
|
||||||
|
id: '',
|
||||||
|
title: '',
|
||||||
|
content: '',
|
||||||
|
remarks: ''
|
||||||
|
})
|
||||||
|
|
||||||
|
// 定义校验规则
|
||||||
|
const dataRules = {
|
||||||
|
title: [
|
||||||
|
{ required: true, message: '请输入标题', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
content: [
|
||||||
|
{ required: true, message: '请输入内容', trigger: 'blur' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
// 打开弹窗
|
||||||
|
const openDialog = async (type: string = 'add', row?: any) => {
|
||||||
|
visible.value = true
|
||||||
|
operType.value = type
|
||||||
|
|
||||||
|
// 重置表单数据
|
||||||
|
nextTick(() => {
|
||||||
|
dataFormRef.value?.resetFields()
|
||||||
|
form.id = ''
|
||||||
|
form.title = ''
|
||||||
|
form.content = ''
|
||||||
|
form.remarks = ''
|
||||||
|
|
||||||
|
// 编辑时填充数据
|
||||||
|
if (type === 'edit' && row) {
|
||||||
|
form.id = row.id
|
||||||
|
form.title = row.title || ''
|
||||||
|
form.content = row.content || ''
|
||||||
|
form.remarks = row.remarks || ''
|
||||||
|
|
||||||
|
// 如果需要获取详情
|
||||||
|
if (row.id && !row.content) {
|
||||||
|
loading.value = true
|
||||||
|
getDetail(row.id).then((res: any) => {
|
||||||
|
if (res.data) {
|
||||||
|
form.content = res.data.content || ''
|
||||||
|
form.remarks = res.data.remarks || ''
|
||||||
|
}
|
||||||
|
}).finally(() => {
|
||||||
|
loading.value = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 提交表单
|
||||||
|
const onSubmit = async () => {
|
||||||
|
if (!dataFormRef.value) return
|
||||||
|
|
||||||
|
await dataFormRef.value.validate(async (valid: boolean) => {
|
||||||
|
if (!valid) return
|
||||||
|
|
||||||
|
loading.value = true
|
||||||
|
try {
|
||||||
|
const submitData = {
|
||||||
|
title: form.title,
|
||||||
|
content: form.content,
|
||||||
|
remarks: form.remarks
|
||||||
|
}
|
||||||
|
|
||||||
|
if (operType.value === 'add') {
|
||||||
|
await addObj(submitData)
|
||||||
|
useMessage().success('新增成功')
|
||||||
|
} else {
|
||||||
|
await editObj({
|
||||||
|
id: form.id,
|
||||||
|
...submitData
|
||||||
|
})
|
||||||
|
useMessage().success('编辑成功')
|
||||||
|
}
|
||||||
|
visible.value = false
|
||||||
|
emit('refresh')
|
||||||
|
} catch (err: any) {
|
||||||
|
useMessage().error(err.msg || (operType.value === 'add' ? '新增失败' : '编辑失败'))
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 暴露方法
|
||||||
|
defineExpose({
|
||||||
|
openDialog
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.mb20 {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
352
src/views/stuwork/classplan/index.vue
Normal file
352
src/views/stuwork/classplan/index.vue
Normal file
@@ -0,0 +1,352 @@
|
|||||||
|
<template>
|
||||||
|
<div class="layout-padding">
|
||||||
|
<div class="layout-padding-auto layout-padding-view">
|
||||||
|
<!-- 搜索表单 -->
|
||||||
|
<el-row v-show="showSearch">
|
||||||
|
<el-form :model="state.queryForm" ref="searchFormRef" :inline="true" @keyup.enter="getDataList">
|
||||||
|
<el-form-item label="学年" prop="schoolYear">
|
||||||
|
<el-select
|
||||||
|
v-model="state.queryForm.schoolYear"
|
||||||
|
placeholder="请选择学年"
|
||||||
|
clearable
|
||||||
|
filterable
|
||||||
|
style="width: 200px">
|
||||||
|
<el-option
|
||||||
|
v-for="item in schoolYearList"
|
||||||
|
:key="item.year"
|
||||||
|
:label="item.year"
|
||||||
|
:value="item.year">
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="学期" prop="schoolTerm">
|
||||||
|
<el-select
|
||||||
|
v-model="state.queryForm.schoolTerm"
|
||||||
|
placeholder="请选择学期"
|
||||||
|
clearable
|
||||||
|
style="width: 200px">
|
||||||
|
<el-option
|
||||||
|
v-for="item in schoolTermList"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value">
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="学院" prop="deptCode">
|
||||||
|
<el-select
|
||||||
|
v-model="state.queryForm.deptCode"
|
||||||
|
placeholder="请选择学院"
|
||||||
|
clearable
|
||||||
|
filterable
|
||||||
|
style="width: 200px">
|
||||||
|
<el-option
|
||||||
|
v-for="item in deptList"
|
||||||
|
:key="item.deptCode"
|
||||||
|
:label="item.deptName"
|
||||||
|
:value="item.deptCode">
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="班号" prop="classNo">
|
||||||
|
<el-select
|
||||||
|
v-model="state.queryForm.classNo"
|
||||||
|
placeholder="请选择班号"
|
||||||
|
clearable
|
||||||
|
filterable
|
||||||
|
style="width: 200px">
|
||||||
|
<el-option
|
||||||
|
v-for="item in classList"
|
||||||
|
:key="item.classCode"
|
||||||
|
:label="item.classNo"
|
||||||
|
:value="item.classNo">
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="状态" prop="status">
|
||||||
|
<el-select
|
||||||
|
v-model="state.queryForm.status"
|
||||||
|
placeholder="请选择状态"
|
||||||
|
clearable
|
||||||
|
style="width: 200px">
|
||||||
|
<el-option
|
||||||
|
v-for="item in statusList"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value">
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" plain icon="Search" @click="getDataList">查询</el-button>
|
||||||
|
<el-button icon="Refresh" @click="handleReset">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<!-- 操作按钮 -->
|
||||||
|
<el-row>
|
||||||
|
<div class="mb8" style="width: 100%">
|
||||||
|
<el-button
|
||||||
|
icon="Plus"
|
||||||
|
type="primary"
|
||||||
|
class="ml10"
|
||||||
|
@click="formDialogRef.openDialog()">
|
||||||
|
新增
|
||||||
|
</el-button>
|
||||||
|
<right-toolbar
|
||||||
|
v-model:showSearch="showSearch"
|
||||||
|
class="ml10 mr20"
|
||||||
|
style="float: right;"
|
||||||
|
@queryTable="getDataList">
|
||||||
|
</right-toolbar>
|
||||||
|
</div>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<!-- 表格 -->
|
||||||
|
<el-table
|
||||||
|
:data="state.dataList"
|
||||||
|
v-loading="state.loading"
|
||||||
|
border
|
||||||
|
:cell-style="tableStyle.cellStyle"
|
||||||
|
:header-cell-style="tableStyle.headerCellStyle">
|
||||||
|
<el-table-column type="index" label="序号" width="60" align="center" />
|
||||||
|
<el-table-column prop="deptName" label="学院" show-overflow-tooltip align="center" />
|
||||||
|
<el-table-column prop="schoolYear" label="学年" show-overflow-tooltip align="center" />
|
||||||
|
<el-table-column prop="status" label="状态" show-overflow-tooltip align="center">
|
||||||
|
<template #default="scope">
|
||||||
|
<span>{{ formatStatus(scope.row.status) }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="schoolTerm" label="学期" show-overflow-tooltip align="center">
|
||||||
|
<template #default="scope">
|
||||||
|
<span>{{ formatSchoolTerm(scope.row.schoolTerm) }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="classNo" label="班号" show-overflow-tooltip align="center" />
|
||||||
|
<el-table-column prop="title" label="标题" show-overflow-tooltip align="center" min-width="200" />
|
||||||
|
<el-table-column prop="updateTime" label="更新时间" show-overflow-tooltip align="center" width="180">
|
||||||
|
<template #default="scope">
|
||||||
|
<span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="createBy" label="填报人" show-overflow-tooltip align="center" />
|
||||||
|
<el-table-column label="操作" width="150" align="center" fixed="right">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button
|
||||||
|
icon="Edit"
|
||||||
|
text
|
||||||
|
type="primary"
|
||||||
|
@click="handleEdit(scope.row)">
|
||||||
|
编辑
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
icon="Delete"
|
||||||
|
text
|
||||||
|
type="danger"
|
||||||
|
@click="handleDelete(scope.row)">
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<!-- 分页 -->
|
||||||
|
<pagination
|
||||||
|
@size-change="sizeChangeHandle"
|
||||||
|
@current-change="currentChangeHandle"
|
||||||
|
v-bind="state.pagination" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 新增/编辑表单弹窗 -->
|
||||||
|
<form-dialog ref="formDialogRef" @refresh="getDataList" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts" name="ClassPlan">
|
||||||
|
import { reactive, ref, onMounted } from 'vue'
|
||||||
|
import { BasicTableProps, useTable } from "/@/hooks/table";
|
||||||
|
import { fetchList, delObj } from "/@/api/stuwork/classplan";
|
||||||
|
import { getDeptList } from "/@/api/basic/basicclass";
|
||||||
|
import { queryAllSchoolYear } from "/@/api/basic/basicyear";
|
||||||
|
import { getClassListByRole } from "/@/api/basic/basicclass";
|
||||||
|
import { getDicts } from "/@/api/admin/dict";
|
||||||
|
import { useMessage, useMessageBox } from "/@/hooks/message";
|
||||||
|
import { parseTime } from "/@/utils/formatTime";
|
||||||
|
import FormDialog from './form.vue'
|
||||||
|
|
||||||
|
// 定义变量内容
|
||||||
|
const formDialogRef = ref()
|
||||||
|
const searchFormRef = ref()
|
||||||
|
const showSearch = ref(true)
|
||||||
|
const schoolYearList = ref<any[]>([])
|
||||||
|
const schoolTermList = ref<any[]>([])
|
||||||
|
const deptList = ref<any[]>([])
|
||||||
|
const classList = ref<any[]>([])
|
||||||
|
const statusList = ref<any[]>([])
|
||||||
|
|
||||||
|
// 配置 useTable
|
||||||
|
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||||
|
queryForm: {
|
||||||
|
schoolYear: '',
|
||||||
|
schoolTerm: '',
|
||||||
|
deptCode: '',
|
||||||
|
classNo: '',
|
||||||
|
status: ''
|
||||||
|
},
|
||||||
|
pageList: fetchList,
|
||||||
|
props: {
|
||||||
|
item: 'records',
|
||||||
|
totalCount: 'total'
|
||||||
|
},
|
||||||
|
createdIsNeed: true
|
||||||
|
})
|
||||||
|
|
||||||
|
// table hook
|
||||||
|
const {
|
||||||
|
getDataList,
|
||||||
|
currentChangeHandle,
|
||||||
|
sizeChangeHandle,
|
||||||
|
tableStyle
|
||||||
|
} = useTable(state)
|
||||||
|
|
||||||
|
// 格式化学期
|
||||||
|
const formatSchoolTerm = (value: string | number) => {
|
||||||
|
if (value === null || value === undefined || value === '') {
|
||||||
|
return '-'
|
||||||
|
}
|
||||||
|
const dictItem = schoolTermList.value.find(item => item.value == value)
|
||||||
|
return dictItem ? dictItem.label : value
|
||||||
|
}
|
||||||
|
|
||||||
|
// 格式化状态
|
||||||
|
const formatStatus = (value: string) => {
|
||||||
|
if (!value) return '-'
|
||||||
|
const item = statusList.value.find((item: any) => item.value === value)
|
||||||
|
return item ? item.label : value
|
||||||
|
}
|
||||||
|
|
||||||
|
// 重置
|
||||||
|
const handleReset = () => {
|
||||||
|
searchFormRef.value?.resetFields()
|
||||||
|
state.queryForm.schoolYear = ''
|
||||||
|
state.queryForm.schoolTerm = ''
|
||||||
|
state.queryForm.deptCode = ''
|
||||||
|
state.queryForm.classNo = ''
|
||||||
|
state.queryForm.status = ''
|
||||||
|
getDataList()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 编辑
|
||||||
|
const handleEdit = (row: any) => {
|
||||||
|
formDialogRef.value?.openDialog('edit', row)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除
|
||||||
|
const handleDelete = async (row: any) => {
|
||||||
|
const { confirm } = useMessageBox()
|
||||||
|
try {
|
||||||
|
await confirm('确定要删除该班级计划吗?')
|
||||||
|
await delObj([row.id])
|
||||||
|
useMessage().success('删除成功')
|
||||||
|
getDataList()
|
||||||
|
} catch (err: any) {
|
||||||
|
if (err !== 'cancel') {
|
||||||
|
useMessage().error(err.msg || '删除失败')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取学年列表
|
||||||
|
const getSchoolYearList = async () => {
|
||||||
|
try {
|
||||||
|
const res = await queryAllSchoolYear()
|
||||||
|
if (res.data && Array.isArray(res.data)) {
|
||||||
|
schoolYearList.value = res.data
|
||||||
|
} else {
|
||||||
|
schoolYearList.value = []
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.error('获取学年列表失败', err)
|
||||||
|
schoolYearList.value = []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取学期字典
|
||||||
|
const getSchoolTermDict = async () => {
|
||||||
|
try {
|
||||||
|
const res = await getDicts('school_term')
|
||||||
|
if (res.data && Array.isArray(res.data)) {
|
||||||
|
schoolTermList.value = res.data.map((item: any) => ({
|
||||||
|
label: item.label || item.dictLabel || item.name,
|
||||||
|
value: item.value || item.dictValue || item.code
|
||||||
|
}))
|
||||||
|
} else {
|
||||||
|
schoolTermList.value = []
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.error('获取学期字典失败', err)
|
||||||
|
schoolTermList.value = []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取学院列表
|
||||||
|
const getDeptListData = async () => {
|
||||||
|
try {
|
||||||
|
const res = await getDeptList()
|
||||||
|
if (res.data && Array.isArray(res.data)) {
|
||||||
|
deptList.value = res.data
|
||||||
|
} else {
|
||||||
|
deptList.value = []
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.error('获取学院列表失败', err)
|
||||||
|
deptList.value = []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取班号列表
|
||||||
|
const getClassListData = async () => {
|
||||||
|
try {
|
||||||
|
const res = await getClassListByRole()
|
||||||
|
if (res.data && Array.isArray(res.data)) {
|
||||||
|
classList.value = res.data
|
||||||
|
} else {
|
||||||
|
classList.value = []
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.error('获取班号列表失败', err)
|
||||||
|
classList.value = []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取状态字典
|
||||||
|
const getStatusDict = async () => {
|
||||||
|
try {
|
||||||
|
const res = await getDicts('status_type')
|
||||||
|
if (res.data && Array.isArray(res.data)) {
|
||||||
|
statusList.value = res.data.map((item: any) => ({
|
||||||
|
label: item.label || item.dictLabel || item.name,
|
||||||
|
value: item.value || item.dictValue || item.code
|
||||||
|
}))
|
||||||
|
} else {
|
||||||
|
statusList.value = []
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.error('获取状态字典失败', err)
|
||||||
|
statusList.value = []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 初始化
|
||||||
|
onMounted(() => {
|
||||||
|
getSchoolYearList()
|
||||||
|
getSchoolTermDict()
|
||||||
|
getDeptListData()
|
||||||
|
getClassListData()
|
||||||
|
getStatusDict()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
</style>
|
||||||
@@ -81,7 +81,8 @@ import { ref, reactive, nextTick, onMounted } from 'vue'
|
|||||||
import { useMessage } from '/@/hooks/message'
|
import { useMessage } from '/@/hooks/message'
|
||||||
import { editObj } from '/@/api/stuwork/classroombase'
|
import { editObj } from '/@/api/stuwork/classroombase'
|
||||||
import { queryAllClass } from '/@/api/basic/basicclass'
|
import { queryAllClass } from '/@/api/basic/basicclass'
|
||||||
import { getClassRoomList, getBuildingList } from '/@/api/stuwork/teachclassroom'
|
import { getClassRoomList } from '/@/api/stuwork/teachclassroom'
|
||||||
|
import { getBuildingList } from '/@/api/stuwork/teachbuilding'
|
||||||
|
|
||||||
const emit = defineEmits(['refresh'])
|
const emit = defineEmits(['refresh'])
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user