|
|
|
@ -1,12 +1,16 @@
|
|
|
|
|
<template>
|
|
|
|
|
<div>
|
|
|
|
|
<nav-bar ></nav-bar>
|
|
|
|
|
<nav-bar></nav-bar>
|
|
|
|
|
<time-select style="margin-top: 20px" ref="timeSelect"></time-select>
|
|
|
|
|
<div style="margin-bottom: 10px">
|
|
|
|
|
<el-row :gutter="20">
|
|
|
|
|
<el-col :span="2"><el-button type="success" @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 :span="2">
|
|
|
|
|
<el-button type="success" @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>
|
|
|
|
@ -21,8 +25,8 @@
|
|
|
|
|
<el-table-column label="授课人数" prop="population"></el-table-column>
|
|
|
|
|
<el-table-column label="是否有课件" prop="isHaveDocuments"></el-table-column>
|
|
|
|
|
<el-table-column label="备注" prop="remind"></el-table-column>
|
|
|
|
|
<el-table-column label="操作" >
|
|
|
|
|
<template slot-scope="scope" >
|
|
|
|
|
<el-table-column label="操作">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<el-button
|
|
|
|
|
@click="editCourse(scope.row)"
|
|
|
|
|
type="text"
|
|
|
|
@ -42,10 +46,10 @@
|
|
|
|
|
</el-table>
|
|
|
|
|
|
|
|
|
|
<el-dialog :title="edit===1?'编辑课程信息':'添加课程'" :visible.sync="dialogForm" :close-on-click-modal="false">
|
|
|
|
|
<el-form :model="courseForm" :inline="true" label-width="100px" ref="courseForm" >
|
|
|
|
|
<el-form :model="courseForm" :inline="true" label-width="100px" ref="courseForm">
|
|
|
|
|
<div v-if="edit===1">
|
|
|
|
|
<el-form-item label="学年:" >
|
|
|
|
|
<el-select v-model="courseForm.year" size="small" >
|
|
|
|
|
<el-form-item label="学年:">
|
|
|
|
|
<el-select v-model="courseForm.year" size="small">
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="item in selectOptions1"
|
|
|
|
|
:key="item.value"
|
|
|
|
@ -56,7 +60,7 @@
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="学期:">
|
|
|
|
|
<el-select v-model="courseForm.semester" size="small" >
|
|
|
|
|
<el-select v-model="courseForm.semester" size="small">
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="item in selectOptions2"
|
|
|
|
|
:key="item.value"
|
|
|
|
@ -69,17 +73,31 @@
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<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-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-select v-model="courseForm.isHaveDocuments">
|
|
|
|
|
<el-option label="是" value='1'></el-option>
|
|
|
|
|
<el-option label="否" value='0'></el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
</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 label="备注" prop="remind" :rules="{ required: true, message: '此处不可为空', trigger: 'blur' }">
|
|
|
|
|
<el-input v-model="courseForm.remind"></el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
<span slot="footer">
|
|
|
|
|
<el-button type="primary" @click="add">添加</el-button>
|
|
|
|
@ -94,74 +112,75 @@
|
|
|
|
|
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:'',
|
|
|
|
|
dialogForm:false,
|
|
|
|
|
edit:'',
|
|
|
|
|
user:{},
|
|
|
|
|
tableData:[{year:'1819',semester:'1',uc_id:111,u_id:111,name:'林大池',software:'westorm,微信开发者平台',classes:'软件工程6班',population:'41',isHaveDocuments:'1',remind:'高级课室'}],
|
|
|
|
|
courseForm:{
|
|
|
|
|
year:'',
|
|
|
|
|
semester:'',
|
|
|
|
|
uc_id:'',
|
|
|
|
|
u_id:'',
|
|
|
|
|
name:'',
|
|
|
|
|
software:'',
|
|
|
|
|
classes:'',
|
|
|
|
|
population:'',
|
|
|
|
|
isHaveDocuments:'',
|
|
|
|
|
remind:'',
|
|
|
|
|
components: {navBar, timeSelect},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
search: '',
|
|
|
|
|
dialogForm: false,
|
|
|
|
|
edit: '',
|
|
|
|
|
user: {},
|
|
|
|
|
tableData: [],
|
|
|
|
|
courseForm: {
|
|
|
|
|
year: '',
|
|
|
|
|
semester: '',
|
|
|
|
|
uc_id: '',
|
|
|
|
|
u_id: '',
|
|
|
|
|
name: '',
|
|
|
|
|
software: '',
|
|
|
|
|
classes: '',
|
|
|
|
|
population: '',
|
|
|
|
|
isHaveDocuments: '',
|
|
|
|
|
remind: '',
|
|
|
|
|
},
|
|
|
|
|
selectOptions1:[
|
|
|
|
|
selectOptions1: [
|
|
|
|
|
{
|
|
|
|
|
value:'1718',
|
|
|
|
|
label:'2017-2018年'
|
|
|
|
|
value: '1718',
|
|
|
|
|
label: '2017-2018年'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
value:'1819',
|
|
|
|
|
label:'2018-2019年'
|
|
|
|
|
value: '1819',
|
|
|
|
|
label: '2018-2019年'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
value:'1920',
|
|
|
|
|
label:'2019-2020年'
|
|
|
|
|
value: '1920',
|
|
|
|
|
label: '2019-2020年'
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
selectOptions2:[
|
|
|
|
|
selectOptions2: [
|
|
|
|
|
{
|
|
|
|
|
value:'1',
|
|
|
|
|
label:'第一学期'
|
|
|
|
|
value: '1',
|
|
|
|
|
label: '第一学期'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
value:'2',
|
|
|
|
|
label:'第二学期'
|
|
|
|
|
value: '2',
|
|
|
|
|
label: '第二学期'
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods:{
|
|
|
|
|
methods: {
|
|
|
|
|
//加载表格数据
|
|
|
|
|
async load(){
|
|
|
|
|
this.tableData=await get('lb/course/courseManagement')
|
|
|
|
|
async load() {
|
|
|
|
|
this.tableData = await get('lb/course/courseManagement')
|
|
|
|
|
},
|
|
|
|
|
//添加课程
|
|
|
|
|
addCourse(){
|
|
|
|
|
this.edit=0
|
|
|
|
|
addCourse() {
|
|
|
|
|
this.edit = 0
|
|
|
|
|
console.log(this.edit)
|
|
|
|
|
this.dialogForm=true
|
|
|
|
|
this.dialogForm = true
|
|
|
|
|
this.$refs.courseForm.resetFields()
|
|
|
|
|
},
|
|
|
|
|
//编辑课程
|
|
|
|
|
editCourse(rowData){
|
|
|
|
|
this.edit=1
|
|
|
|
|
this.dialogForm=true
|
|
|
|
|
this.courseForm=rowData
|
|
|
|
|
editCourse(rowData) {
|
|
|
|
|
this.edit = 1
|
|
|
|
|
this.dialogForm = true
|
|
|
|
|
this.courseForm = rowData
|
|
|
|
|
},
|
|
|
|
|
//删除课程
|
|
|
|
|
deleteCourse(rowData){
|
|
|
|
|
deleteCourse(rowData) {
|
|
|
|
|
showDialog("确认要删除吗?", this)
|
|
|
|
|
post('lb/user/deleteCourse', {
|
|
|
|
|
uid: rowData.uc_id
|
|
|
|
@ -173,7 +192,7 @@
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
//确定添加
|
|
|
|
|
add:function () {
|
|
|
|
|
add: function () {
|
|
|
|
|
//验证
|
|
|
|
|
this.$refs['courseForm'].validate(async (valid) => {
|
|
|
|
|
if (valid) {
|
|
|
|
@ -181,41 +200,40 @@
|
|
|
|
|
await showDialog("确定要" + (this.edit ? '编辑' : '新增') + '吗?', this)
|
|
|
|
|
//编辑提交
|
|
|
|
|
if (this.edit) {
|
|
|
|
|
await post('lb/user/updateUser', {
|
|
|
|
|
year:this.$refs.timeSelect.year,
|
|
|
|
|
semester:this.$refs.timeSelect.semester,
|
|
|
|
|
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
|
|
|
|
|
await post('lb/usercourse/updatecourse', {
|
|
|
|
|
year: this.$refs.timeSelect.year,
|
|
|
|
|
semester: this.$refs.timeSelect.semester,
|
|
|
|
|
uc_id: this.courseForm.uc_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.dialogForm = false //添加成功则关闭
|
|
|
|
|
this.load() //重新加载数据
|
|
|
|
|
} else {
|
|
|
|
|
// 新增提交
|
|
|
|
|
await post('lb/user/addUser', {
|
|
|
|
|
year:this.$refs.timeSelect.year,
|
|
|
|
|
semester:this.$refs.timeSelect.semester,
|
|
|
|
|
name:this.courseForm.name,
|
|
|
|
|
software:this.courseForm.software,
|
|
|
|
|
classes:this.courseForm.classes,
|
|
|
|
|
population:this.courseForm.population,
|
|
|
|
|
remind:this.courseForm.remind,
|
|
|
|
|
isHaveDocuments:this.courseForm.isHaveDocuments
|
|
|
|
|
await post('lb/usercourse/addusercourse', {
|
|
|
|
|
year: this.$refs.timeSelect.year,
|
|
|
|
|
semester: this.$refs.timeSelect.semester,
|
|
|
|
|
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.dialogForm = false
|
|
|
|
|
this.load() //重新加载数据
|
|
|
|
|
}
|
|
|
|
|
this.$emit('confirm')
|
|
|
|
@ -223,14 +241,14 @@
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
//取消添加
|
|
|
|
|
cancel:function () {
|
|
|
|
|
cancel: function () {
|
|
|
|
|
this.$refs.courseForm.resetFields()
|
|
|
|
|
this.dialogForm=false
|
|
|
|
|
this.dialogForm = false
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
//过滤表格数据
|
|
|
|
|
computed:{
|
|
|
|
|
tableDataComputed(){
|
|
|
|
|
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())
|
|
|
|
|