|
|
|
@ -4,37 +4,34 @@
|
|
|
|
|
<time-select style="margin-top: 20px"></time-select>
|
|
|
|
|
<div style="margin-bottom: 10px">
|
|
|
|
|
<el-row :gutter="20">
|
|
|
|
|
<el-col :span="2"><el-button type="success" class="el-icon-circle-plus-outline" style="float: right" @click="dialogAdd=true">添加课程</el-button></el-col>
|
|
|
|
|
<el-col :span="2"><el-button type="success" class="el-icon-circle-plus-outline" style="float: right" @click="addCourse">添加课程</el-button></el-col>
|
|
|
|
|
<el-col :span="8" >
|
|
|
|
|
<el-input type="text" v-model="search" style="max-width: 400px;float: left" placeholder="请输入查询关键字" ><el-button slot="append" icon="el-icon-search">查询</el-button></el-input>
|
|
|
|
|
</el-col>
|
|
|
|
|
|
|
|
|
|
</el-row>
|
|
|
|
|
</div>
|
|
|
|
|
<el-table :data="tableData" border>
|
|
|
|
|
<el-table-column
|
|
|
|
|
type="selection"
|
|
|
|
|
width="55">
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="课程编号" prop=""></el-table-column>
|
|
|
|
|
<el-table-column label="老师编号" prop=""></el-table-column>
|
|
|
|
|
<el-table-column label="课程名称" prop=""></el-table-column>
|
|
|
|
|
<el-table-column label="软件名称" prop=""></el-table-column>
|
|
|
|
|
<el-table-column label="授课班级" prop=""></el-table-column>
|
|
|
|
|
<el-table-column label="授课人数" prop=""></el-table-column>
|
|
|
|
|
<el-table-column label="是否有课件" prop=""></el-table-column>
|
|
|
|
|
<el-table-column label="备注" prop=""></el-table-column>
|
|
|
|
|
<el-table-column label="操作" prop="">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<el-table :data="tableDataComputed" border>
|
|
|
|
|
<el-table-column type="selection" width="55"></el-table-column>
|
|
|
|
|
<el-table-column label="课程编号" prop="uc_id"></el-table-column>
|
|
|
|
|
<el-table-column label="老师编号" prop="u_id"></el-table-column>
|
|
|
|
|
<el-table-column label="课程名称" prop="name"></el-table-column>
|
|
|
|
|
<el-table-column label="软件名称" prop="software"></el-table-column>
|
|
|
|
|
<el-table-column label="授课班级" prop="classes"></el-table-column>
|
|
|
|
|
<el-table-column label="授课人数" prop="population"></el-table-column>
|
|
|
|
|
<el-table-column label="是否有课件" prop="isHaveDocument"></el-table-column>
|
|
|
|
|
<el-table-column label="备注" prop="remind"></el-table-column>
|
|
|
|
|
<el-table-column label="操作" >
|
|
|
|
|
<template slot-scope="scope" >
|
|
|
|
|
<el-button
|
|
|
|
|
@click="{}"
|
|
|
|
|
@click="editCourse(scope.row)"
|
|
|
|
|
type="text"
|
|
|
|
|
class="el-icon-edit"
|
|
|
|
|
size="small">
|
|
|
|
|
编辑
|
|
|
|
|
</el-button>
|
|
|
|
|
<el-button
|
|
|
|
|
@click="{}"
|
|
|
|
|
@click="deleteCourse(scope.row)"
|
|
|
|
|
type="text"
|
|
|
|
|
class="el-icon-delete"
|
|
|
|
|
size="small">
|
|
|
|
@ -44,16 +41,16 @@
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
|
|
|
|
|
|
|
|
|
<el-dialog title="请填写以下申请信息" :visible.sync="dialogAdd">
|
|
|
|
|
<el-form :model="form" :inline="true" label-width="100px">
|
|
|
|
|
<el-form-item label="课程编号" ><el-input v-model="formData.uc_id"></el-input></el-form-item>
|
|
|
|
|
<el-form-item label="老师编号" prop="date"><el-input v-model="formData.u_id"></el-input></el-form-item>
|
|
|
|
|
<el-form-item label="课程名称" ><el-input v-model="formData.name"></el-input></el-form-item>
|
|
|
|
|
<el-form-item label="软件名称" prop="nickname"><el-input v-model="formData.software"></el-input></el-form-item>
|
|
|
|
|
<el-form-item label="授课班级" prop="tel"><el-input v-model="formData.classes"></el-input></el-form-item>
|
|
|
|
|
<el-form-item label="授课人数" prop="course_name"><el-input v-model="formData.population"></el-input> </el-form-item>
|
|
|
|
|
<el-form-item label="是否有课件" prop="class"><el-input v-model="formData.isHaveDocuments"></el-input></el-form-item>
|
|
|
|
|
<el-form-item label="备注" prop="population"> <el-input v-model="formData.remind"></el-input></el-form-item>
|
|
|
|
|
<el-dialog :title="edit?'编辑课程信息':'添加课程'" :visible.sync="dialogForm">
|
|
|
|
|
<el-form :model="courseForm" :inline="true" label-width="100px" ref="courseForm">
|
|
|
|
|
<el-form-item label="课程编号" prop="uc_id" :rules="{ required: true, message: '此处不可为空', trigger: 'blur' }" ><el-input v-model="courseForm.uc_id"></el-input></el-form-item>
|
|
|
|
|
<el-form-item label="老师编号" prop="u_id" :rules="{ required: true, message: '此处不可为空', trigger: 'blur' }"><el-input v-model="courseForm.u_id"></el-input></el-form-item>
|
|
|
|
|
<el-form-item label="课程名称" prop="name" :rules="{ required: true, message: '此处不可为空', trigger: 'blur' }"><el-input v-model="courseForm.name"></el-input></el-form-item>
|
|
|
|
|
<el-form-item label="软件名称" prop="software" :rules="{ required: true, message: '此处不可为空', trigger: 'blur' }"><el-input v-model="courseForm.software"></el-input></el-form-item>
|
|
|
|
|
<el-form-item label="授课班级" prop="classes" :rules="{ required: true, message: '此处不可为空', trigger: 'blur' }"><el-input v-model="courseForm.classes"></el-input></el-form-item>
|
|
|
|
|
<el-form-item label="授课人数" prop="population" :rules="{ required: true, message: '此处不可为空', trigger: 'blur' }"><el-input v-model="courseForm.population"></el-input> </el-form-item>
|
|
|
|
|
<el-form-item label="是否有课件" prop="isHaveDocuments" :rules="{ required: true, message: '此处不可为空', trigger: 'blur' }"><el-input v-model="courseForm.isHaveDocuments"></el-input></el-form-item>
|
|
|
|
|
<el-form-item label="备注" prop="remind" :rules="{ required: true, message: '此处不可为空', trigger: 'blur' }"> <el-input v-model="courseForm.remind"></el-input></el-form-item>
|
|
|
|
|
<el-form-item>
|
|
|
|
|
<el-button type="primary" @click="add">添加</el-button>
|
|
|
|
|
<el-button @click="cancel">取消</el-button>
|
|
|
|
@ -66,24 +63,18 @@
|
|
|
|
|
<script>
|
|
|
|
|
import navBar from "~/components/teacher/navBar";
|
|
|
|
|
import timeSelect from "~/components/timeSelect";
|
|
|
|
|
import {get, post} from "~/utils";
|
|
|
|
|
import {showDialog, showFail, showSuccess} from "~/utils/dialog";
|
|
|
|
|
export default {
|
|
|
|
|
name: "courseManagement",
|
|
|
|
|
components:{navBar,timeSelect},
|
|
|
|
|
data(){
|
|
|
|
|
return{
|
|
|
|
|
search:'',
|
|
|
|
|
dialogAdd:false,
|
|
|
|
|
tableData:[{
|
|
|
|
|
uc_id:'',
|
|
|
|
|
u_id:'',
|
|
|
|
|
name:'',
|
|
|
|
|
software:'',
|
|
|
|
|
classes:'',
|
|
|
|
|
population:'',
|
|
|
|
|
remind:'',
|
|
|
|
|
isHaveDocuments:''
|
|
|
|
|
}],
|
|
|
|
|
formData:{
|
|
|
|
|
dialogForm:false,
|
|
|
|
|
edit:'',
|
|
|
|
|
tableData:[],
|
|
|
|
|
courseForm:{
|
|
|
|
|
uc_id:'',
|
|
|
|
|
u_id:'',
|
|
|
|
|
name:'',
|
|
|
|
@ -96,12 +87,96 @@
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods:{
|
|
|
|
|
async load(){
|
|
|
|
|
this.tableData=await get('lb/course/courseManagement')
|
|
|
|
|
},
|
|
|
|
|
addCourse(){
|
|
|
|
|
this.edit=0
|
|
|
|
|
this.dialogForm=true
|
|
|
|
|
},
|
|
|
|
|
editCourse(rowData){
|
|
|
|
|
this.edit=1
|
|
|
|
|
this.dialogForm=true
|
|
|
|
|
this.courseForm=rowData
|
|
|
|
|
},
|
|
|
|
|
deleteCourse(rowData){
|
|
|
|
|
showDialog("确认要删除吗?", this)
|
|
|
|
|
post('lb/user/deleteUser', {
|
|
|
|
|
uid: rowData.uc_id
|
|
|
|
|
}).then(() => {
|
|
|
|
|
showSuccess("删除成功", this)
|
|
|
|
|
this.load()
|
|
|
|
|
}).catch(e => {
|
|
|
|
|
showFail("删除失败 " + e.msg, this)
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
add:function () {
|
|
|
|
|
this.dialogAdd=false
|
|
|
|
|
//验证
|
|
|
|
|
this.$refs['courseForm'].validate(async (valid) => {
|
|
|
|
|
if (valid) {
|
|
|
|
|
//提交
|
|
|
|
|
await showDialog("确定要" + (this.edit ? '编辑' : '新增') + '吗?', this)
|
|
|
|
|
//编辑提交
|
|
|
|
|
if (this.edit) {
|
|
|
|
|
await post('lb/user/updateUser', {
|
|
|
|
|
uc_id:this.courseForm.uc_id,
|
|
|
|
|
u_id:this.courseForm.u_id,
|
|
|
|
|
name:this.courseForm.name,
|
|
|
|
|
software:this.courseForm.software,
|
|
|
|
|
classes:this.courseForm.classes,
|
|
|
|
|
population:this.courseForm.population,
|
|
|
|
|
remind:this.courseForm.remind,
|
|
|
|
|
isHaveDocuments:this.courseForm.isHaveDocuments
|
|
|
|
|
}).catch(async e => {
|
|
|
|
|
await showFail(e.msg, this)
|
|
|
|
|
await stop()
|
|
|
|
|
})
|
|
|
|
|
showSuccess('编辑完成', this)
|
|
|
|
|
this.dialogForm=false //添加成功则关闭
|
|
|
|
|
this.load() //重新加载数据
|
|
|
|
|
} else {
|
|
|
|
|
// 新增提交
|
|
|
|
|
await post('lb/user/addUser', {
|
|
|
|
|
nickname: this.userForm.nickname,
|
|
|
|
|
tel: this.userForm.tel,
|
|
|
|
|
email: this.userForm.email,
|
|
|
|
|
username: this.userForm.username,
|
|
|
|
|
office: this.userForm.office,
|
|
|
|
|
position: parseInt(this.userForm.position),
|
|
|
|
|
password: this.userForm.password
|
|
|
|
|
}).catch(async e => {
|
|
|
|
|
await showFail(e.msg, this)
|
|
|
|
|
await stop()
|
|
|
|
|
})
|
|
|
|
|
showSuccess('新增完成', this)
|
|
|
|
|
this.dialogForm=false
|
|
|
|
|
this.load() //重新加载数据
|
|
|
|
|
}
|
|
|
|
|
this.$emit('confirm')
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
cancel:function () {
|
|
|
|
|
this.dialogAdd=false
|
|
|
|
|
this.$refs.courseForm.resetFields()
|
|
|
|
|
this.dialogForm=false
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
computed:{
|
|
|
|
|
tableDataComputed(){
|
|
|
|
|
return this.tableData.filter(data => !this.search
|
|
|
|
|
|| data.uc_id.toLowerCase().includes(this.search.toLowerCase())
|
|
|
|
|
|| data.u_id.toLowerCase().includes(this.search.toLowerCase())
|
|
|
|
|
|| data.name.toLowerCase().includes(this.search.toLowerCase())
|
|
|
|
|
|| data.software.toLowerCase().includes(this.search.toLowerCase())
|
|
|
|
|
|| data.classes.toLowerCase().includes(this.search.toLowerCase())
|
|
|
|
|
|| data.population.toLowerCase().includes(this.search.toLowerCase())
|
|
|
|
|
|| data.remind.toLowerCase().includes(this.search.toLowerCase())
|
|
|
|
|
|| data.isHaveDocuments.toLowerCase().includes(this.search.toLowerCase())
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
mounted() {
|
|
|
|
|
this.load()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|