Crazy 4 달 전
부모
커밋
9a0ab1ad1f

+ 1 - 1
.env

@@ -2,7 +2,7 @@
 VITE_APP_TITLE=测绘学院研究生管理系统
 
 # 项目本地运行端口号
-VITE_PORT=80
+VITE_PORT=8080
 
 # open 运行 npm run dev 时自动打开浏览器
 VITE_OPEN=true

+ 9 - 30
src/api/system/user/index.ts

@@ -37,16 +37,6 @@ export const getStudentPage = (params: PageParam) => {
   return request.get({ url: '/system/user/page1', params })
 }
 
-// 查询当前工作间下老师管理列表
-export const getUserPage0 = (params: PageParam) => {
-  return request.get({ url: '/system/user/page0', params })
-}
-
-// 查询当前工作间下学生管理列表
-export const getUserPage1 = (params: PageParam) => {
-  return request.get({ url: '/system/user/page1', params })
-}
-
 // 查询当前工作间下用户
 export const getDeptUser = () => {
   return request.get({ url: '/system/user/DeptUser' })
@@ -57,16 +47,6 @@ export const getDeptsupervisor = (deptId: number) => {
   return request.get({ url: '/system/user/DeptSupervisor?id=' + deptId })
 }
 
-// 查询毕业生管理列表(学院)
-export const getGraduateStudentPage = (params: PageParam) => {
-  return request.get({ url: '/system/user/graduateStudentPage', params })
-}
-
-// 查询毕业生管理列表(导师)
-export const getGraduateStudentTPage = (params: PageParam) => {
-  return request.get({ url: '/system/user/graduateStudentTPage', params })
-}
-
 // 查询所有导师列表
 export const getSupervisor = () => {
   return request.get({ url: '/system/user/supervisor' })
@@ -97,10 +77,6 @@ export const createUser = (data: UserVO) => {
   return request.post({ url: '/system/user/create', data })
 }
 
-// 新增教师
-export const createTeacher = (data: UserVO) => {
-  return request.post({ url: '/system/user/create_teacher', data })
-}
 
 // 修改用户
 export const updateUser = (data: UserVO) => {
@@ -122,11 +98,6 @@ export const importUserTemplate = () => {
   return request.download({ url: '/system/user/get-import-template' })
 }
 
-// 下载毕业生导入模板
-export const importGraduateStudentTemplate = () => {
-  return request.download({ url: '/system/user/get-import-GraduateStudentTemplate' })
-}
-
 // 导出教师
 export const exportTeacherList = () => {
   return request.get({ url: '/system/user/exportTeacher' })
@@ -142,11 +113,17 @@ export const exportGraduateList = () => {
   return request.get({ url: '/system/user/exportGraduate' })
 }
 
+
 // 获得用户模板
 export const importTemplate = () => {
   return request.download({ url: '/system/user/get-import-template' })
 }
 
+// 获得在校生模板
+export const importInSchoolTemplate = () => {
+  return request.download({ url: '/system/user/get-import-SchoolTemplate' })
+}
+
 // 获得毕业生模板
 export const importGraduateTemplate = () => {
   return request.download({ url: '/system/user/get-import-graduateTemplate' })
@@ -157,6 +134,7 @@ export const importTeacherTemplate = () => {
   return request.download({ url: '/system/user/get-import-teacherTemplate' })
 }
 
+//这些都没用,不是都在那个importForm定义的吗
 // 导入导师
 export const importTeacherExcel = (data) => {
   return request.post({ url: '/system/user/importTeacher', data })
@@ -172,6 +150,7 @@ export const importSchoolStudentExcel = (data) => {
   return request.post({ url: '/system/user/importSchoolStudent', data })
 }
 
+
 // 用户密码重置
 export const resetUserPwd = (id: number, password: string) => {
   const data = {
@@ -195,7 +174,7 @@ export const getSimpleUserList = (): Promise<UserVO[]> => {
   return request.get({ url: '/system/user/simple-list' })
 }
 
-// 下载模板批量
+// 下载考勤模板批量
 export const getAttendanceTemplate = async () => {
   return request.download({ url: '/system/user/get-import-attendanceTemplate' })
 }

+ 4 - 4
src/views/system/graduateStudent/UserImportForm.vue

@@ -20,7 +20,7 @@
         <div class="el-upload__tip text-center">
           <div class="el-upload__tip">
             <el-checkbox v-model="updateSupport" />
-            是否更新已经存在的用户数据
+            是否更新已经存在的毕业生数据
           </div>
           <span>仅允许导入 xls、xlsx 格式文件。</span>
           <el-link
@@ -53,7 +53,7 @@ const dialogVisible = ref(false) // 弹窗的是否展示
 const formLoading = ref(false) // 表单的加载中
 const uploadRef = ref()
 const importUrl =
-  import.meta.env.VITE_BASE_URL + import.meta.env.VITE_API_URL + '/system/user/import'
+  import.meta.env.VITE_BASE_URL + import.meta.env.VITE_API_URL + '/system/user/importGraduateStudent'
 const uploadHeaders = ref() // 上传 Header 头
 const fileList = ref([]) // 文件列表
 const updateSupport = ref(0) // 是否更新已经存在的用户数据
@@ -132,7 +132,7 @@ const handleExceed = (): void => {
 
 /** 下载模板操作 */
 const importTemplate = async () => {
-  const res = await UserApi.importUserTemplate()
-  download.excel(res, '用户导入模版.xls')
+  const res = await UserApi.importGraduateTemplate()
+  download.excel(res, '毕业生导入模版.xls')
 }
 </script>

+ 1 - 1
src/views/system/workroomCollege/user/student.vue

@@ -216,7 +216,7 @@
   <!-- 添加或修改用户对话框 -->
   <UserForm ref="formRef" @success="getList" />
   <!-- 用户导入对话框 -->
-  <UserImportForm ref="importFormRef" @success="getList" />
+  <StudentImportForm ref="importFormRef" @success="getList" />
   <!-- 批量导入对话框 -->
   <UserImportFormzip ref="importFormzipRef" @success="getList" />
   <!-- 分配角色 -->

+ 141 - 0
src/views/system/workroomCollege/user/studentImportForm.vue

@@ -0,0 +1,141 @@
+<template>
+  <Dialog v-model="dialogVisible" title="用户导入" width="400">
+    <el-upload
+      ref="uploadRef"
+      v-model:file-list="fileList"
+      :action="importUrl + '?updateSupport=' + updateSupport"
+      :auto-upload="false"
+      :disabled="formLoading"
+      :headers="uploadHeaders"
+      :limit="1"
+      :on-error="submitFormError"
+      :on-exceed="handleExceed"
+      :on-success="submitFormSuccess"
+      accept=".xlsx, .xls"
+      drag
+    >
+      <Icon icon="ep:upload" />
+      <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
+      <template #tip>
+        <div class="el-upload__tip text-center">
+          <div class="el-upload__tip">
+            <el-checkbox v-model="updateSupport" />
+            是否更新已经存在的学生数据
+          </div>
+          <span>仅允许导入 xls、xlsx 格式文件。</span>
+          <el-link
+            :underline="false"
+            style="font-size: 12px; vertical-align: baseline"
+            type="primary"
+            @click="importTemplate"
+          >
+            下载模板
+          </el-link>
+        </div>
+      </template>
+    </el-upload>
+    <template #footer>
+      <el-button :disabled="formLoading" type="primary" @click="submitForm">确 定</el-button>
+      <el-button @click="dialogVisible = false">取 消</el-button>
+    </template>
+  </Dialog>
+</template>
+<script lang="ts" setup>
+import * as UserApi from '@/api/system/user'
+import { getAccessToken, getTenantId } from '@/utils/auth'
+import download from '@/utils/download'
+
+defineOptions({ name: 'SystemUserImportForm' })
+
+const message = useMessage() // 消息弹窗
+
+const dialogVisible = ref(false) // 弹窗的是否展示
+const formLoading = ref(false) // 表单的加载中
+const uploadRef = ref()
+const importUrl =
+  import.meta.env.VITE_BASE_URL + import.meta.env.VITE_API_URL + '/system/user/importSchoolStudent'
+const uploadHeaders = ref() // 上传 Header 头
+const fileList = ref([]) // 文件列表
+const updateSupport = ref(0) // 是否更新已经存在的用户数据
+
+/** 打开弹窗 */
+const open = () => {
+  dialogVisible.value = true
+  updateSupport.value = 0
+  fileList.value = []
+  resetForm()
+}
+defineExpose({ open }) // 提供 open 方法,用于打开弹窗
+
+/** 提交表单 */
+const submitForm = async () => {
+  if (fileList.value.length == 0) {
+    message.error('请上传文件')
+    return
+  }
+  // 提交请求
+  uploadHeaders.value = {
+    Authorization: 'Bearer ' + getAccessToken(),
+    'tenant-id': getTenantId()
+  }
+  formLoading.value = true
+  uploadRef.value!.submit()
+  // console.log('67890',uploadHeaders.value);
+}
+
+/** 文件上传成功 */
+const emits = defineEmits(['success'])
+const submitFormSuccess = (response: any) => {
+  if (response.code !== 0) {
+    message.error(response.msg)
+    formLoading.value = false
+    return
+  }
+
+  // 拼接提示语
+  const data = response.data
+  console.log(data,'data');
+  let text = '上传成功数量:' + data.createUsernames.length + ';'
+  for (let username of data.createUsernames) {
+    text += '< ' + username + ' >'
+  }
+  text += '更新成功数量:' + data.updateUsernames.length + ';'
+  for (const username of data.updateUsernames) {
+    text += '< ' + username + ' >'
+  }
+  text += '更新失败数量:' + Object.keys(data.failureUsernames).length + ';'
+  for (const username in data.failureUsernames) {
+    text += '< ' + username + ': ' + data.failureUsernames[username] + ' >'
+  }
+  message.alert(text)
+  formLoading.value = false
+  dialogVisible.value = false
+  // 发送操作成功的事件
+  emits('success')
+}
+
+/** 上传错误提示 */
+const submitFormError = (): void => {
+  message.error('上传失败,请您重新上传!')
+  formLoading.value = false
+}
+
+/** 重置表单 */
+const resetForm = async (): Promise<void> => {
+  // 重置上传状态和文件
+  formLoading.value = false
+  await nextTick()
+  uploadRef.value?.clearFiles()
+}
+
+/** 文件数超出提示 */
+const handleExceed = (): void => {
+  message.error('最多只能上传一个文件!')
+}
+
+/** 下载模板操作 */
+const importTemplate = async () => {
+  const res = await UserApi.importInSchoolTemplate()
+  download.excel(res, '学生导入模板.xls')
+}
+</script>

+ 2 - 1
src/views/system/workroomCollege/user/teacher.vue

@@ -203,7 +203,7 @@
   <!-- 添加或修改用户对话框 -->
   <UserForm ref="formRef" @success="getList" :showIsGraduate="showIsGraduate"/>
   <!-- 用户导入对话框 -->
-  <UserImportForm ref="importFormRef" @success="getList" />
+  <TeacherImportForm ref="importFormRef" @success="getList" />
   <!-- 分配角色 -->
   <UserAssignRoleForm ref="assignRoleFormRef" @success="getList" />
 </template>
@@ -218,6 +218,7 @@ import UserForm from './UserForm.vue'
 import UserImportForm from './UserImportForm.vue'
 import UserAssignRoleForm from './UserAssignRoleForm.vue'
 import DeptTree from './DeptTree.vue'
+import TeacherImportForm from './teacherImportForm .vue'
 
 defineOptions({ name: 'SystemUser' })
 

+ 141 - 0
src/views/system/workroomCollege/user/teacherImportForm .vue

@@ -0,0 +1,141 @@
+<template>
+  <Dialog v-model="dialogVisible" title="用户导入" width="400">
+    <el-upload
+      ref="uploadRef"
+      v-model:file-list="fileList"
+      :action="importUrl + '?updateSupport=' + updateSupport"
+      :auto-upload="false"
+      :disabled="formLoading"
+      :headers="uploadHeaders"
+      :limit="1"
+      :on-error="submitFormError"
+      :on-exceed="handleExceed"
+      :on-success="submitFormSuccess"
+      accept=".xlsx, .xls"
+      drag
+    >
+      <Icon icon="ep:upload" />
+      <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
+      <template #tip>
+        <div class="el-upload__tip text-center">
+          <div class="el-upload__tip">
+            <el-checkbox v-model="updateSupport" />
+            是否更新已经存在的导师数据
+          </div>
+          <span>仅允许导入 xls、xlsx 格式文件。</span>
+          <el-link
+            :underline="false"
+            style="font-size: 12px; vertical-align: baseline"
+            type="primary"
+            @click="importTemplate"
+          >
+            下载模板
+          </el-link>
+        </div>
+      </template>
+    </el-upload>
+    <template #footer>
+      <el-button :disabled="formLoading" type="primary" @click="submitForm">确 定</el-button>
+      <el-button @click="dialogVisible = false">取 消</el-button>
+    </template>
+  </Dialog>
+</template>
+<script lang="ts" setup>
+import * as UserApi from '@/api/system/user'
+import { getAccessToken, getTenantId } from '@/utils/auth'
+import download from '@/utils/download'
+
+defineOptions({ name: 'SystemUserImportForm' })
+
+const message = useMessage() // 消息弹窗
+
+const dialogVisible = ref(false) // 弹窗的是否展示
+const formLoading = ref(false) // 表单的加载中
+const uploadRef = ref()
+const importUrl =
+  import.meta.env.VITE_BASE_URL + import.meta.env.VITE_API_URL + '/system/user/importTeacher'
+const uploadHeaders = ref() // 上传 Header 头
+const fileList = ref([]) // 文件列表
+const updateSupport = ref(0) // 是否更新已经存在的用户数据
+
+/** 打开弹窗 */
+const open = () => {
+  dialogVisible.value = true
+  updateSupport.value = 0
+  fileList.value = []
+  resetForm()
+}
+defineExpose({ open }) // 提供 open 方法,用于打开弹窗
+
+/** 提交表单 */
+const submitForm = async () => {
+  if (fileList.value.length == 0) {
+    message.error('请上传文件')
+    return
+  }
+  // 提交请求
+  uploadHeaders.value = {
+    Authorization: 'Bearer ' + getAccessToken(),
+    'tenant-id': getTenantId()
+  }
+  formLoading.value = true
+  uploadRef.value!.submit()
+  // console.log('67890',uploadHeaders.value);
+}
+
+/** 文件上传成功 */
+const emits = defineEmits(['success'])
+const submitFormSuccess = (response: any) => {
+  if (response.code !== 0) {
+    message.error(response.msg)
+    formLoading.value = false
+    return
+  }
+
+  // 拼接提示语
+  const data = response.data
+  console.log(data,'data');
+  let text = '上传成功数量:' + data.createUsernames.length + ';'
+  for (let username of data.createUsernames) {
+    text += '< ' + username + ' >'
+  }
+  text += '更新成功数量:' + data.updateUsernames.length + ';'
+  for (const username of data.updateUsernames) {
+    text += '< ' + username + ' >'
+  }
+  text += '更新失败数量:' + Object.keys(data.failureUsernames).length + ';'
+  for (const username in data.failureUsernames) {
+    text += '< ' + username + ': ' + data.failureUsernames[username] + ' >'
+  }
+  message.alert(text)
+  formLoading.value = false
+  dialogVisible.value = false
+  // 发送操作成功的事件
+  emits('success')
+}
+
+/** 上传错误提示 */
+const submitFormError = (): void => {
+  message.error('上传失败,请您重新上传!')
+  formLoading.value = false
+}
+
+/** 重置表单 */
+const resetForm = async (): Promise<void> => {
+  // 重置上传状态和文件
+  formLoading.value = false
+  await nextTick()
+  uploadRef.value?.clearFiles()
+}
+
+/** 文件数超出提示 */
+const handleExceed = (): void => {
+  message.error('最多只能上传一个文件!')
+}
+
+/** 下载模板操作 */
+const importTemplate = async () => {
+  const res = await UserApi.importTeacherTemplate()
+  download.excel(res, '导师导入模版.xls')
+}
+</script>

+ 2 - 2
src/views/system/workroomTeacher/user/student.vue

@@ -203,7 +203,7 @@
   <!-- 添加或修改用户对话框 -->
   <UserForm ref="formRef" @success="getList" />
   <!-- 用户导入对话框 -->
-  <UserImportForm ref="importFormRef" @success="getList" />
+  <StudentImportForm ref="importFormRef" @success="getList" />
   <!-- 分配角色 -->
   <UserAssignRoleForm ref="assignRoleFormRef" @success="getList" />
 </template>
@@ -243,7 +243,7 @@ const queryFormRef = ref() // 搜索的表单
 const getList = async () => {
   loading.value = true
   try {
-    const data = await UserApi.getUserPage1(queryParams)
+    const data = await UserApi.getStudentPage(queryParams)
     console.log(data)
     list.value = data.list
     total.value = data.total