人才+教师管理

main
lijingyu007 6 months ago
parent 8e6765d921
commit 797e9dbd57
  1. 2
      .env.development
  2. 101
      src/api/trainService/index.js
  3. 140
      src/views/trainService/talentPool.vue
  4. 59
      src/views/trainService/trainTeacher.vue

@ -5,7 +5,7 @@ ENV = 'development'
VUE_APP_BASE_API = '/test-api'
# VUE_APP_BASE_TARGET = 'http://www.keyitest.cn/test-api'
VUE_APP_BASE_TARGET = 'http://192.168.0.229:9999'
VUE_APP_BASE_TARGET = 'http://192.168.0.129:9999'
# VUE_APP_BASE_TARGET = 'http://172.16.36.180:9999'
# 路由懒加载

@ -80,4 +80,105 @@ export function searchNum(id, query) {
params: query,
})
}
// 人才库+教师
// 新增人才
export function listTalent() {
return request({
url: '/talent/admin/list',
method: 'get',
headers: {
isToken: false
}
})
}
export function addTalent(data) {
return request({
url: '/talent/admin/add',
method: 'post',
data,
headers: {
isToken: false
}
})
}
// 修改人才
export function updateTalent(data) {
return request({
url: '/talent/admin/update',
method: 'post',
data,
headers: {
isToken: false
}
})
}
// 删除人才-删除教师
export function deleteTalent(id) {
return request({
url: '/talent/admin/' + id,
method: 'delete',
headers: {
isToken: false
}
})
}
// 查看人才-教师详情
export function detailTalent(id) {
return request({
url: '/talent/admin/' + id,
method: 'get',
headers: {
isToken: false
}
})
}
export function listTeacher() {
return request({
url: '/talent/admin/teacherList',
method: 'get',
headers: {
isToken: false
}
})
}
// 新增教师
export function addTeacher(data) {
return request({
url: '/talent/admin/teacher/add',
method: 'post',
data,
headers: {
isToken: false
}
})
}
// 修改教师
export function updateTeacher(data) {
return request({
url: '/talent/admin/teacher/update',
method: 'post',
data,
headers: {
isToken: false
}
})
}
// 下载模板
export function importTemplate() {
return request({
url: '/talent/admin/download',
method: 'get',
responseType: 'blob',
headers: {
isToken: false
}
})
}

@ -16,19 +16,19 @@
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</div> -->
<div style="margin-top: 5px;margin-bottom: 10px">
<div style="margin-top: 5px; margin-bottom: 10px">
<el-button type="primary" icon="el-icon-plus" size="mini" @click="addsign">新增</el-button>
<el-button type="warning" icon="el-icon-plus" size="mini">导入</el-button>
<el-button type="warning" icon="el-icon-plus" size="mini" @click="handleImport">导入</el-button>
</div>
</el-form>
<el-table v-loading="loading" :data="schoolList">
<el-table-column label="序号" align="center" type="index" />
<el-table-column label="姓名" align="center" prop="schoolName" />
<el-table-column label="手机号" align="center" prop="schoolName" />
<el-table-column label="证书编号" align="center" prop="schoolName" />
<el-table-column label="学校" align="center" prop="schoolName" />
<el-table-column label="二级学院" align="center" prop="schoolName" />
<el-table-column label="备注" align="center" prop="schoolName" />
<el-table-column label="姓名" align="center" prop="name" />
<el-table-column label="手机号" align="center" prop="phone" />
<el-table-column label="证书编号" align="center" prop="certificateNo" />
<el-table-column label="学校" align="center" prop="university" />
<el-table-column label="二级学院" align="center" prop="college" />
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="操作" align="center">
<template slot-scope="scope">
<el-button size="mini" type="text" @click="modify(scope.row)">修改</el-button>
@ -53,23 +53,23 @@
@close="colsedia"
>
<el-form :model="form" :rules="rules" ref="form" label-width="70px">
<el-form-item label="姓名" prop="schoolName">
<el-input v-model="form.schoolName"></el-input>
<el-form-item label="姓名" prop="name">
<el-input v-model="form.name"></el-input>
</el-form-item>
<el-form-item label="手机号" prop="schoolName">
<el-input v-model="form.schoolName"></el-input>
<el-form-item label="手机号" prop="phone">
<el-input v-model="form.phone"></el-input>
</el-form-item>
<el-form-item label="证书编号" prop="schoolName">
<el-input v-model="form.schoolName"></el-input>
<el-form-item label="证书编号" prop="certificateNo">
<el-input v-model="form.certificateNo"></el-input>
</el-form-item>
<el-form-item label="学校" prop="schoolName">
<el-input v-model="form.schoolName"></el-input>
<el-form-item label="学校" prop="university">
<el-input v-model="form.university"></el-input>
</el-form-item>
<el-form-item label="二级学院" prop="schoolName">
<el-input v-model="form.schoolName"></el-input>
<el-form-item label="二级学院" prop="college">
<el-input v-model="form.college"></el-input>
</el-form-item>
<el-form-item label="备注" prop="schoolName">
<el-input v-model="form.schoolName"></el-input>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark"></el-input>
</el-form-item>
<el-form-item style="margin-top: 80px; text-align: center; margin-left: -150px">
<el-button
@ -86,11 +86,45 @@
</el-form-item>
</el-form>
</el-dialog>
<!-- 导入对话框 -->
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
<el-upload
ref="upload"
:limit="1"
accept=".xlsx, .xls"
:headers="upload.headers"
:action="upload.url + '?updateSupport=' + upload.updateSupport"
:disabled="upload.isUploading"
:on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess"
:auto-upload="false"
drag
>
<i class="el-icon-upload"></i>
<div class="el-upload__text">
将文件拖到此处
<em>点击上传</em>
</div>
<div class="el-upload__tip" slot="tip">
<el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据
<el-link type="info" style="font-size: 12px" @click="importTemplate">下载模板</el-link>
</div>
<div class="el-upload__tip" style="color: red" slot="tip">提示仅允许导入xlsxlsx格式文件</div>
</el-upload>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitFileForm"> </el-button>
<el-button @click="upload.open = false"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { getSchoolList, addSchool, updateSchool, delSchool } from '@/api/trainService/index.js'
import { listTalent, addTalent, updateTalent, deleteTalent, importTemplate } from '@/api/trainService/index.js'
import ImageUpload from '@/components/ImgUpload/index.vue'
import { getToken } from '@/utils/auth'
import { saveAs } from 'file-saver'
export default {
name: 'peixunbaoming',
components: { ImageUpload },
@ -106,39 +140,54 @@ export default {
pageNum: 1,
pageSize: 10,
},
title: '新增教师',
title: '新增人才',
visibleopen: false,
form: {},
rules: {},
upload: {
//
open: false,
//
title: '',
//
isUploading: false,
//
updateSupport: 0,
//
// headers: { Authorization: 'Bearer ' + getToken() },
headers: { isToken: false },
//
url: process.env.VUE_APP_BASE_API + '/talent/admin/import',
},
}
},
mounted() {},
methods: {
async getList() {
const res = await getSchoolList(this.queryParams)
const res = await listTalent(this.queryParams)
this.total = res.total
this.schoolList = res.rows
},
//
addsign() {
this.title = '新增教师'
this.title = '新增人才'
this.visibleopen = true
},
//
async modify(row) {
this.title = '修改教师'
this.title = '修改人才'
this.visibleopen = true
this.form = row
},
async delrow(row) {
this.$confirm('是否确认删除教师', '警告', {
this.$confirm('是否确认删除人才', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(function () {
return delSchool(row.schoolId)
return deleteTalent(row.talentId)
})
.then(() => {
this.getList()
@ -147,12 +196,13 @@ export default {
},
//
async submitto() {
if (this.form.schoolId) {
if (this.form.talentId) {
//
await updateSchool(this.form)
await updateTalent(this.form)
this.$message.success('修改成功')
} else {
await addSchool(this.form)
// console.log(this.form);
await addTalent(this.form)
this.$message.success('新增成功')
}
this.colsedia()
@ -169,6 +219,36 @@ export default {
this.resetForm('queryForm')
this.getList()
},
/** 导入按钮操作 */
handleImport() {
this.upload.title = '用户导入'
this.upload.open = true
},
/** 下载模板操作 */
importTemplate() {
importTemplate().then((response) => {
console.log(response)
const blob = new Blob([response])
saveAs(blob, '人才导入模板.xlsx')
})
},
//
handleFileUploadProgress(event, file, fileList) {
this.upload.isUploading = true
},
//
handleFileSuccess(response, file, fileList) {
this.upload.open = false
this.upload.isUploading = false
this.$refs.upload.clearFiles()
this.$alert(response.msg, '导入结果', { dangerouslyUseHTMLString: true })
this.getList()
},
//
submitFileForm() {
this.$refs.upload.submit()
},
},
created() {
this.getList()

@ -22,11 +22,11 @@
</el-form>
<el-table v-loading="loading" :data="schoolList">
<el-table-column label="序号" align="center" type="index" />
<el-table-column label="姓名" align="center" prop="schoolName" />
<el-table-column label="手机号" align="center" prop="schoolName" />
<el-table-column label="教学方向" align="center" prop="schoolName" />
<el-table-column label="职称" align="center" prop="schoolName" />
<el-table-column label="简介" align="center" prop="schoolName" />
<el-table-column label="姓名" align="center" prop="name" />
<el-table-column label="手机号" align="center" prop="phone" />
<el-table-column label="教学方向" align="center" prop="teaching" />
<el-table-column label="职称" align="center" prop="title" />
<el-table-column label="简介" align="center" prop="profile" />
<el-table-column label="操作" align="center">
<template slot-scope="scope">
<el-button size="mini" type="text" @click="modify(scope.row)">修改</el-button>
@ -51,25 +51,25 @@
@close="colsedia"
>
<el-form :model="form" :rules="rules" ref="form" label-width="70px">
<el-form-item label="姓名" prop="schoolName">
<el-input v-model="form.schoolName"></el-input>
<el-form-item label="姓名" prop="name">
<el-input v-model="form.name"></el-input>
</el-form-item>
<el-form-item label="手机号" prop="schoolName">
<el-input v-model="form.schoolName"></el-input>
<el-form-item label="手机号" prop="phone">
<el-input v-model="form.phone"></el-input>
</el-form-item>
<el-form-item label="教学方向" prop="schoolName">
<el-input v-model="form.schoolName"></el-input>
<el-form-item label="教学方向" prop="teaching">
<el-input v-model="form.teaching"></el-input>
</el-form-item>
<el-form-item label="职称" prop="schoolName">
<el-input v-model="form.schoolName"></el-input>
<el-form-item label="职称" prop="title">
<el-input v-model="form.title"></el-input>
</el-form-item>
<el-form-item label="简介" prop="schoolName">
<el-input v-model="form.schoolName" type="textarea" :rows="6"></el-input>
<el-form-item label="简介" prop="profile">
<el-input v-model="form.profile" type="textarea" :rows="6"></el-input>
</el-form-item>
<el-form-item label="图片">
<el-form-item label="图片" prop="avatar">
<ImageUpload
ref="imgupload"
v-model="form.c"
v-model="form.avatar"
listtype="picture-card"
fileName="publicize"
:limit="1"
@ -94,14 +94,14 @@
</div>
</template>
<script>
import { getSchoolList, addSchool, updateSchool, delSchool } from '@/api/trainService/index.js'
import { listTeacher, addTeacher, updateTeacher, deleteTalent } from '@/api/trainService/index.js'
import ImageUpload from '@/components/ImageUpload/index.vue'
export default {
name: 'peixunbaoming',
components: { ImageUpload },
data() {
return {
imgAction: process.env.VUE_APP_BASE_API + '/upload',
imgbase: process.env.VUE_APP_BASE_TARGET,
loading: false,
schoolList: [],
//
@ -113,9 +113,7 @@ export default {
},
title: '新增教师',
visibleopen: false,
form: {
c: 'http://192.168.0.229:9999/profile/upload/2024/05/21/13b358f9-8fbb-4f3e-839e-6595d33247db.png'
},
form: {},
rules: {},
}
},
@ -123,7 +121,7 @@ export default {
mounted() {},
methods: {
async getList() {
const res = await getSchoolList(this.queryParams)
const res = await listTeacher(this.queryParams)
this.total = res.total
this.schoolList = res.rows
},
@ -137,6 +135,9 @@ export default {
this.title = '修改教师'
this.visibleopen = true
this.form = row
if (this.form.avatar) {
this.form.avatar = this.imgbase + this.form.avatar
}
},
async delrow(row) {
this.$confirm('是否确认删除教师', '警告', {
@ -145,7 +146,7 @@ export default {
type: 'warning',
})
.then(function () {
return delSchool(row.schoolId)
return deleteTalent(row.talentId)
})
.then(() => {
this.getList()
@ -154,12 +155,16 @@ export default {
},
//
async submitto() {
if (this.form.schoolId) {
if (this.form.talentId) {
//
await updateSchool(this.form)
const url = this.form.avatar
const index = url.indexOf('/profile')
this.form.avatar = url.substring(index)
console.log(this.form)
await updateTeacher(this.form)
this.$message.success('修改成功')
} else {
await addSchool(this.form)
await addTeacher(this.form)
this.$message.success('新增成功')
}
this.colsedia()

Loading…
Cancel
Save