|
@@ -2,26 +2,26 @@
|
|
|
<div class='m-container'>
|
|
|
<h2>作业模板管理</h2>
|
|
|
<div class="m-core">
|
|
|
- <div class='newBand'>添加</div>
|
|
|
+ <div class='newBand' @click="openJob('create')">添加</div>
|
|
|
<!-- 列表 -->
|
|
|
<div class="tableWrap">
|
|
|
<el-table :data='tableList'>
|
|
|
- <el-table-column align='center'
|
|
|
+ <el-table-column align='center' prop="name"
|
|
|
label="作业模板名称">
|
|
|
</el-table-column>
|
|
|
- <el-table-column align='center'
|
|
|
+ <el-table-column align='center' prop="classGroupTypeName"
|
|
|
label="对应课程类型">
|
|
|
</el-table-column>
|
|
|
- <el-table-column align='center'
|
|
|
+ <el-table-column align='center' prop="subjectName"
|
|
|
label="声部">
|
|
|
</el-table-column>
|
|
|
- <el-table-column align='center'
|
|
|
+ <el-table-column align='center' prop="content"
|
|
|
label="模板内容">
|
|
|
</el-table-column>
|
|
|
<el-table-column align='center'
|
|
|
label="操作">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-button type="text">修改</el-button>
|
|
|
+ <el-button @click="openJob('update', scope.row)" type="text">修改</el-button>
|
|
|
<el-button type="text">删除</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
@@ -32,6 +32,45 @@
|
|
|
:page-sizes="pageInfo.page_size"
|
|
|
@pagination="getList" />
|
|
|
</div>
|
|
|
+
|
|
|
+ <el-dialog :title="formTitle[formActionTitle]" :visible.sync="jobStatus"
|
|
|
+ @close="onFormClose('ruleForm')" width="500px">
|
|
|
+ <el-form :model="form" :rules="rules" ref="ruleForm">
|
|
|
+ <el-form-item label="作业模板名称" prop="name" :label-width="formLabelWidth">
|
|
|
+ <el-input v-model="form.name" autocomplete="off"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="对应课程类型" prop="classGroupType" :label-width="formLabelWidth">
|
|
|
+ <el-radio-group v-model="form.classGroupType">
|
|
|
+ <el-radio label="NORMAL">单技课</el-radio>
|
|
|
+ <el-radio label="MIX">合奏课</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="声部选择" v-if="form.classGroupType != 'MIX'"
|
|
|
+ prop="subjectId" :label-width="formLabelWidth">
|
|
|
+ <el-select v-model="form.subjectId">
|
|
|
+ <el-option-group
|
|
|
+ v-for="group in subjectList"
|
|
|
+ :key="group.label"
|
|
|
+ :label="group.label">
|
|
|
+ <el-option
|
|
|
+ v-for="item in group.options"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value">
|
|
|
+ </el-option>
|
|
|
+ </el-option-group>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="作业内容" prop="content" :label-width="formLabelWidth">
|
|
|
+ <el-input type="textarea" :autosize="{ minRows: 2, maxRows: 4}" placeholder="请输入内容" v-model="form.content"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <span slot="footer"
|
|
|
+ class="dialog-footer">
|
|
|
+ <el-button @click="jobStatus = false">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="onJobSubmit('ruleForm')">确 定</el-button>
|
|
|
+ </span>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
@@ -39,12 +78,34 @@
|
|
|
<script>
|
|
|
import pagination from '@/components/Pagination/index'
|
|
|
import store from '@/store'
|
|
|
+import { courseHomeworkTemplateList, subjectListTree, homeWorkUpdate, homeWorkAdd } from '@/api/specialSetting'
|
|
|
export default {
|
|
|
components: { pagination },
|
|
|
name: 'adminManager',
|
|
|
data () {
|
|
|
return {
|
|
|
tableList: [],
|
|
|
+ subjectList: [], // 声部
|
|
|
+ formActionTitle: 'create',
|
|
|
+ formTitle: {
|
|
|
+ create: '添加教学点',
|
|
|
+ update: '修改教学点'
|
|
|
+ },
|
|
|
+ jobStatus: false, // 添加教学点
|
|
|
+ formLabelWidth: '120px',
|
|
|
+ form: {
|
|
|
+ name: null, // 作业模块名称
|
|
|
+ classGroupType: null,
|
|
|
+ subjectId: null,
|
|
|
+ content: null,
|
|
|
+ organId: store.getters.organ
|
|
|
+ },
|
|
|
+ rules: {
|
|
|
+ name: [{ required: true, message: '请输入作业模板名称', trigger: 'blur' }],
|
|
|
+ classGroupType: [{ required: true, message: '请选择对应课程类型', trigger: 'change' }],
|
|
|
+ subjectId: [{ required: true, message: '请选择声部', trigger: 'change' }],
|
|
|
+ content: [{ required: true, message: '请输入作业内容', trigger: 'blur' }]
|
|
|
+ },
|
|
|
pageInfo: {
|
|
|
// 分页规则
|
|
|
limit: 10, // 限制显示条数
|
|
@@ -57,9 +118,41 @@ export default {
|
|
|
},
|
|
|
mounted() {
|
|
|
this.getList()
|
|
|
- this.getAreaList()
|
|
|
+ this.getSubjectTree()
|
|
|
},
|
|
|
methods: {
|
|
|
+ onJobSubmit (formName) { // 添加数据
|
|
|
+ this.$refs[formName].validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ if (this.formActionTitle == 'create') {
|
|
|
+ homeWorkAdd(this.form).then(res => {
|
|
|
+ this.messageTips('添加', res)
|
|
|
+ })
|
|
|
+ } else if (this.formActionTitle == 'update') {
|
|
|
+ homeWorkUpdate(this.form).then(res => {
|
|
|
+ this.messageTips('修改', res)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ openJob (type, row) {
|
|
|
+ this.jobStatus = true
|
|
|
+ this.formActionTitle = type
|
|
|
+ // 修改的时候赋值
|
|
|
+ if (type == 'update') {
|
|
|
+ this.form = {
|
|
|
+ id: row.id,
|
|
|
+ name: row.name, // 作业模块名称
|
|
|
+ classGroupType: row.classGroupType,
|
|
|
+ subjectId: row.subjectId,
|
|
|
+ content: row.content,
|
|
|
+ organId: store.getters.organ
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
messageTips(title, res) {
|
|
|
if(res.code == 200) {
|
|
|
this.$message({
|
|
@@ -73,8 +166,54 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
getList () {
|
|
|
-
|
|
|
+ courseHomeworkTemplateList({
|
|
|
+ organId: this.organId,
|
|
|
+ rows: this.pageInfo.limit,
|
|
|
+ page: this.pageInfo.page
|
|
|
+ }).then(res => {
|
|
|
+ if (res.code == 200 && res.data) {
|
|
|
+ this.tableList = res.data.rows
|
|
|
+ this.pageInfo.total = res.data.total
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ onFormClose (formName) { // 关闭弹窗重置验证
|
|
|
+ this.form = {
|
|
|
+ name: null, // 作业模块名称
|
|
|
+ classGroupType: null,
|
|
|
+ subjectId: null,
|
|
|
+ content: null,
|
|
|
+ organId: store.getters.organ
|
|
|
+ },
|
|
|
+ this.$refs[formName].resetFields()
|
|
|
+ },
|
|
|
+ getSubjectTree() { // 获取声部列表
|
|
|
+ subjectListTree({
|
|
|
+ delFlag: 0,
|
|
|
+ rows: 9999
|
|
|
+ }).then(res => {
|
|
|
+ let result = res.data
|
|
|
+ if(res.code == 200) {
|
|
|
+ let tempArray = []
|
|
|
+ result.rows.forEach((item, index) => {
|
|
|
+ let subject = []
|
|
|
+ item.subjects.forEach(s => {
|
|
|
+ subject.push({
|
|
|
+ value: s.id,
|
|
|
+ label: s.name
|
|
|
+ })
|
|
|
+ })
|
|
|
+
|
|
|
+ tempArray[index] = {
|
|
|
+ label: item.name,
|
|
|
+ options: subject
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.subjectList = tempArray
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
</script>
|