parent
f2b6fb204f
commit
9dd6f20a62
23 changed files with 2781 additions and 518 deletions
@ -1,204 +0,0 @@ |
||||
<template> |
||||
<div> |
||||
<el-row :gutter="20"> |
||||
<el-col :span="24"> |
||||
<el-card shadow="hover" class="mgb20"> |
||||
<div class="flex-between"> |
||||
<div class="per_title" @click="goback()"> |
||||
<i class="el-icon-arrow-left"></i> |
||||
<span class="per_back">返回</span> |
||||
<span class="per_school">添加环节</span> |
||||
</div> |
||||
<div> |
||||
<el-button type="primary" round class="mag" @click="saveAdd('form')">确定 |
||||
</el-button> |
||||
</div> |
||||
</div> |
||||
</el-card> |
||||
|
||||
<el-card shadow="hover" class="mgb20"> |
||||
<div class="flex-between mgb20 user_header"> |
||||
<div class="flex-center"> |
||||
<p class="addhr_tag"></p> |
||||
<span>环节1.1</span> |
||||
</div> |
||||
<el-button type="primary" round class="mag" @click="addcourse()">添加环节</el-button> |
||||
</div> |
||||
|
||||
<div> |
||||
<el-form :model="form" ref="form" label-width="120px" class="courseware"> |
||||
<ul class="mgb20"> |
||||
<li v-for="(item,index) in form.courseList" :key="index" class="flex-between"> |
||||
<div style="width: 50%;"> |
||||
<el-form-item label="环节名称" :prop="'courseList.' + index + '.linkName'" |
||||
:rules="{required: true, message: '请输入项目课件', trigger: 'blur'}"> |
||||
<el-input placeholder="请输入项目课件" v-model="item.linkName"></el-input> |
||||
</el-form-item> |
||||
<el-form-item label="资源添加" :prop="'courseList.' + index + '.fileLink'" |
||||
:rules="{required: true, message: '请添加文件', trigger: 'blur'}"> |
||||
<el-upload |
||||
class="link_upload" |
||||
:headers="{token}" |
||||
:action="api.uploadFiles" |
||||
:on-remove="(file, fileList)=>{return handleRemove(file, fileList, index)}" |
||||
:on-error="uploadError" |
||||
:on-success="(response, file, fileList)=>{return uploadSuccess(response, file, fileList, index)}" |
||||
:before-remove="beforeRemove" |
||||
:limit="1" |
||||
:on-exceed="handleExceed" |
||||
:file-list="item.uploadList"> |
||||
<el-button size="medium" type="primary" icon="el-icon-upload" |
||||
class="uploadTitle">点击上传 |
||||
</el-button> |
||||
</el-upload> |
||||
</el-form-item> |
||||
</div> |
||||
<div> |
||||
<el-button size="medium" type="primary" @click="delCourse(index)">删除课件 |
||||
</el-button> |
||||
</div> |
||||
</li> |
||||
</ul> |
||||
</el-form> |
||||
</div> |
||||
</el-card> |
||||
</el-col> |
||||
</el-row> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
export default { |
||||
data() { |
||||
return { |
||||
token: this.$store.state.loginToken, |
||||
form: { |
||||
courseList: [{ |
||||
projectId: this.$store.state.systemId, |
||||
courseId: this.$store.state.courseId, |
||||
linkName: "", |
||||
fileLink: "", |
||||
uploadList: [] |
||||
}] |
||||
} |
||||
}; |
||||
}, |
||||
mounted() { |
||||
this.getData(); |
||||
}, |
||||
methods: { |
||||
getData() { |
||||
let data = { |
||||
projectId: this.form.courseList[0].projectId, |
||||
courseId: this.form.courseList[0].courseId |
||||
}; |
||||
this.$get(this.api.queryLinkDetails, data).then((res) => { |
||||
res.message.map(e => { |
||||
var arr = []; |
||||
arr.push({ name: e.linkName, url: e.fileLink }); |
||||
this.$set(e, "uploadList", arr); |
||||
}); |
||||
this.form.courseList = res.message; |
||||
}).catch((res) => { |
||||
}); |
||||
}, |
||||
saveAdd(formName) { |
||||
this.$refs[formName].validate((valid) => { |
||||
if (valid) { |
||||
var arr = this.form.courseList.map(v => { |
||||
var obj = { |
||||
...v |
||||
}; |
||||
delete obj.uploadList; |
||||
return obj; |
||||
}); |
||||
let data = { |
||||
courseLink: arr |
||||
}; |
||||
this.$post(this.api.addCourseLink, data).then((res) => { |
||||
this.$message.success("添加成功!"); |
||||
this.goback(); |
||||
}).catch((res) => { |
||||
}); |
||||
} |
||||
}); |
||||
}, |
||||
addcourse() { |
||||
this.form.courseList = this.form.courseList.concat({ |
||||
projectId: this.$store.state.systemId, |
||||
courseId: this.$store.state.courseId, |
||||
linkName: "", |
||||
fileLink: "", |
||||
uploadList: [] |
||||
}); |
||||
}, |
||||
// 上传文件 |
||||
handleExceed(files, fileList) { |
||||
this.$message.warning( |
||||
`当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!` |
||||
); |
||||
}, |
||||
uploadSuccess(response, file, fileList, idx) { |
||||
this.form.courseList[idx].uploadList.push({ name: file.name, url: response.message.fileUrl }); |
||||
this.form.courseList[idx].fileLink = response.message.fileUrl; |
||||
}, |
||||
uploadError(err, file, fileList) { |
||||
this.$message({ |
||||
message: "上传出错,请重试!", |
||||
type: "error", |
||||
center: true |
||||
}); |
||||
}, |
||||
beforeRemove(file, fileList) { |
||||
return this.$confirm(`确定移除 ${file.name}?`); |
||||
}, |
||||
handleRemove(file, fileList, idx) { |
||||
let uploadList = this.form.courseList[idx].uploadList; |
||||
uploadList.forEach((item, index) => { |
||||
if (file.name == item.name) { |
||||
uploadList.splice(index, 1); |
||||
} |
||||
}); |
||||
}, |
||||
delCourse(index) { |
||||
this.$confirm("确定要删除该课件吗?", "提示", { |
||||
type: "warning" |
||||
}) |
||||
.then(() => { |
||||
this.form.courseList.splice(index, 1); |
||||
this.$message.success("删除成功"); |
||||
}) |
||||
.catch(() => { |
||||
}); |
||||
}, |
||||
goback() { |
||||
this.$router.go(-1); |
||||
} |
||||
} |
||||
}; |
||||
</script> |
||||
|
||||
<style scoped> |
||||
/* .courseware ul .el-input{ |
||||
width: 30%; |
||||
} */ |
||||
|
||||
.courseware ul li { |
||||
margin-top: 20px; |
||||
padding: 0 0 10px 0; |
||||
border-bottom: 1px dashed #eee; |
||||
} |
||||
|
||||
.courseware ul li:first-child { |
||||
margin-top: 0; |
||||
} |
||||
|
||||
.courseware ul li:last-child { |
||||
border-bottom: none; |
||||
} |
||||
|
||||
.uploadTitle { |
||||
height: 40px !important; |
||||
font-size: 16px; |
||||
} |
||||
</style> |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,973 @@ |
||||
<template> |
||||
<div class="wrap"> |
||||
<el-card v-if="!id" shadow="hover" class="m-b-20"> |
||||
<div class="flex-between"> |
||||
<el-page-header @back="back" :content="'新建课程'"></el-page-header> |
||||
</div> |
||||
</el-card> |
||||
<div class="page"> |
||||
<div class="overflow"> |
||||
<ul :class="['steps', { pointer: !editing && id && publishStatus }]"> |
||||
<li :class="{ active: step === 1, done: step > 1 }" @click="toStep(1)"> |
||||
<span class="circle">1</span> |
||||
<p class="text">填写课程信息</p> |
||||
</li> |
||||
<li :class="{ active: step === 2, done: step > 2 }" @click="toStep(2)"> |
||||
<span class="circle circle2">2</span> |
||||
<p class="text">设置练习项目</p> |
||||
</li> |
||||
<li :class="{ active: step === 3, done: step > 3 }" @click="toStep(3)"> |
||||
<span class="circle circle3">3</span> |
||||
<p class="text">设置考核项目</p> |
||||
</li> |
||||
<li :class="{ done: step > 3 }"> |
||||
<span class="circle circle4">4</span> |
||||
<p class="text">完成</p> |
||||
</li> |
||||
</ul> |
||||
<div class="page-content"> |
||||
<el-form v-show="step === 1" :model="form" :rules="rules" ref="form" label-width="100px"> |
||||
<el-form-item label="课程名称" prop="curriculumName"> |
||||
<el-input class="w-input" id="focus-el" placeholder="请输入课程名称" |
||||
v-model.trim="form.curriculumName"></el-input> |
||||
</el-form-item> |
||||
<el-form-item label="课程类别" prop="curriculumType"> |
||||
<el-select class="w-input" v-model="form.curriculumType" clearable placeholder="请选择课程类型"> |
||||
<el-option label="实训课程" :value="1"></el-option> |
||||
<el-option label="理论课程" :value="0"></el-option> |
||||
<el-option label="理实课程" :value="2"></el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
|
||||
<el-form-item class="req" label="适用专业" required> |
||||
<div class="subject"> |
||||
<div v-for="(item, i) in form.mallDisciplines" :key="i" class="line"> |
||||
<el-form-item label="学科类别"> |
||||
<el-select v-model="item.categoryId" @change="getProfessionalClass(item)"> |
||||
<el-option v-for="(item, index) in subjectList" :key="index" :label="item.disciplineName" |
||||
:value="item.disciplineId"></el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item label="专业类"> |
||||
<el-select v-model="item.professionalCategoryId" :disabled="item.categoryId ? false : true" |
||||
@change="getProfessional(item)"> |
||||
<el-option v-for="(item, index) in item.professionalClassList" :key="index" |
||||
:label="item.professionalClassName" :value="item.professionalClassId"></el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item label="专业"> |
||||
<el-select v-model="item.professionalId" :disabled="item.professionalCategoryId ? false : true"> |
||||
<el-option v-for="(item, index) in item.professionalList" :key="index" |
||||
:label="item.professionalName" :value="item.professionalId"></el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
<i v-if="i && !isDetail" class="del el-icon-delete" @click="form.mallDisciplines.splice(i, 1)"></i> |
||||
</div> |
||||
</div> |
||||
<div v-if="!isDetail" class="subject-plus" @click="addSubject"> |
||||
<i class="el-icon-circle-plus-outline"></i> |
||||
</div> |
||||
</el-form-item> |
||||
|
||||
<el-form-item label="预计课时" prop="expectedCourse"> |
||||
<el-select class="w-input" v-model="form.expectedCourse" clearable placeholder="请选择预计课时"> |
||||
<el-option label="32课时" value="32课时"></el-option> |
||||
<el-option label="64课时" value="64课时"></el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item label="供应厂商" prop="supplier"> |
||||
<el-select class="w-input" v-model="form.supplier" clearable placeholder="请选择供应厂商" multiple> |
||||
<el-option v-for="(item, i) in suppliers" :key="i" :label="item.supplierName" |
||||
:value="item.supplierId"></el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item label="课程封面"> |
||||
<el-card shadow="hover"> |
||||
<div class="cover-wrap"> |
||||
<el-upload name="file" accept=".jpg,.png,.jpeg,.gif" ref="upload" drag :on-remove="handleRemove" |
||||
:on-error="uploadError" :before-remove="beforeRemove" :limit="1" :on-exceed="handleExceed" action="" |
||||
:http-request="handleRequest"> |
||||
<i class="el-icon-upload"></i> |
||||
<div class="el-upload__text"> |
||||
<p>将图片拖到此处,或<em>点击上传</em></p> |
||||
<p style="font-size: 12px;color: #9f9f9f;line-height: 1.4;">建议上传484*278像素图片</p> |
||||
</div> |
||||
</el-upload> |
||||
<div class="preview"> |
||||
<p class="preview-title">默认图片预览</p> |
||||
<img class="preview-pic" :src="form.coverUrl" alt=""> |
||||
</div> |
||||
</div> |
||||
</el-card> |
||||
</el-form-item> |
||||
|
||||
<el-form-item label="课程简介" prop="briefIntroduction"> |
||||
<Editor api-key='rnk6zw9v267xqz7pf98twt1vmrvltmd436je7a642pckltda' v-model="form.briefIntroduction" |
||||
:init="editorConfig" :disabled="isDetail" /> |
||||
</el-form-item> |
||||
<el-form-item label="详情介绍" prop="teachingObjectives"> |
||||
<Editor api-key='rnk6zw9v267xqz7pf98twt1vmrvltmd436je7a642pckltda' v-model="form.teachingObjectives" |
||||
:init="editorConfig" :disabled="isDetail" /> |
||||
</el-form-item> |
||||
</el-form> |
||||
|
||||
<template v-if="step === 2"> |
||||
<div class="tool"> |
||||
<ul class="filter"> |
||||
<li> |
||||
<label>状态:</label> |
||||
<el-select v-model="form.courseType" clearable placeholder="请选择状态" style="width: 150px" |
||||
@change="getData"> |
||||
<el-option v-for="(item, index) in status" :key="index" :label="item.name" |
||||
:value="item.id"></el-option> |
||||
</el-select> |
||||
</li> |
||||
<li> |
||||
<label>搜索:</label> |
||||
<el-input placeholder="请输入实训项目名称、理论试卷名称" suffix-icon="el-icon-search" v-model="form.keyWord" clearable |
||||
size="small" style="width: 300px"></el-input> |
||||
</li> |
||||
</ul> |
||||
<div> |
||||
<el-button @click="handleBatchDelete(0)">批量移除</el-button> |
||||
<el-button @click="handleConfig(0)" icon="el-icon-plus" circle></el-button> |
||||
</div> |
||||
</div> |
||||
|
||||
<div> |
||||
<el-table :data="practiceData" class="table" header-align="center" max-height="400" |
||||
@selection-change="handleSelectionPractice"> |
||||
<el-table-column type="selection" width="55" align="center"></el-table-column> |
||||
<el-table-column type="index" width="100" label="序号" align="center"></el-table-column> |
||||
<el-table-column prop="projectName" label="项目名称" align="center"> |
||||
<template slot-scope="scope"> |
||||
{{ scope.row.projectName || scope.row.paperName }} |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="remark" label="备注名称" align="center"></el-table-column> |
||||
<el-table-column prop="systemName" label="系统名称" align="center"></el-table-column> |
||||
<el-table-column prop="remark" label="状态" align="center"></el-table-column> |
||||
<el-table-column label="排序" align="center" width="100"> |
||||
<template slot-scope="scope"> |
||||
<el-input v-model.trim="scope.row.sort" |
||||
@input="practiceSortChange(scope.row, scope.$index)"></el-input> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="展示控制" align="center" width="100"> |
||||
<template slot-scope="scope"> |
||||
<el-switch v-model="scope.row.isShow" :active-value="0" :inactive-value="1" |
||||
:disabled="scope.row.disabled"> |
||||
</el-switch> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="操作" align="center" width="100"> |
||||
<template slot-scope="scope"> |
||||
<el-button :disabled="scope.row.disabled" |
||||
@click.native.prevent="handleDelete(scope.$index, practiceData)">移除 |
||||
</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
</div> |
||||
</template> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<!-- 配置弹窗 --> |
||||
<el-dialog :visible.sync="configVisible" width="1200px" center custom-class="config-dia"> |
||||
<div class="config-wrap"> |
||||
<div class="item system"> |
||||
<div class="title-wrap flex-center"> |
||||
<p class="addhr_tag"></p> |
||||
<span>系统列表</span> |
||||
</div> |
||||
<el-input placeholder="请输入系统名称" prefix-icon="el-icon-search" v-model.trim="systemKeyword" |
||||
clearable></el-input> |
||||
|
||||
<ul class="systems"> |
||||
<li v-for="(item, i) in systems" :key="i" :title="item.systemName"> |
||||
<el-checkbox v-model="item.check" @change="val => systemChange(val, item)"></el-checkbox> |
||||
<div :class="['name', { active: curSystem == item.systemId }]" @click="getProject(item)"> |
||||
<span>{{ item.systemName }}</span> |
||||
<i class="el-icon-arrow-right"></i> |
||||
</div> |
||||
</li> |
||||
</ul> |
||||
</div> |
||||
|
||||
<div class="item project"> |
||||
<div class="title-wrap flex-center"> |
||||
<p class="addhr_tag"></p> |
||||
<span>项目列表</span> |
||||
</div> |
||||
<el-input placeholder="请输入项目名称" prefix-icon="el-icon-search" v-model.trim="projectKeyword" |
||||
clearable></el-input> |
||||
|
||||
<ul class="systems"> |
||||
<el-checkbox v-if="projects.length" v-model="checkAll" label="全选" |
||||
@change="val => checkAllChange(val, projects[0].systemId)"></el-checkbox> |
||||
<li v-for="(item, i) in projects" :key="i" :title="item.projectName"> |
||||
<el-checkbox v-model="item.check" |
||||
:label="item.remark ? item.remark + '(' + item.projectName + ')' : (item.projectName || item.paperName)" |
||||
@change="val => projectChange(val, item)"></el-checkbox> |
||||
</li> |
||||
</ul> |
||||
</div> |
||||
|
||||
<div class="item checked"> |
||||
<div class="title-wrap flex-center"> |
||||
<p class="addhr_tag"></p> |
||||
<span>已选择项目({{ checkeds.length }}个)</span> |
||||
</div> |
||||
<el-input style="width: 200px;margin-bottom: 20px;" placeholder="请输入项目名称" prefix-icon="el-icon-search" |
||||
v-model.trim="checkedKeyword" clearable></el-input> |
||||
<el-table :data="checkeds" class="table" header-align="center" max-height="470"> |
||||
<el-table-column type="index" width="55" label="序号" align="center"></el-table-column> |
||||
<el-table-column prop="systemName" label="系统名称" align="center"></el-table-column> |
||||
<el-table-column prop="projectName" width="80" label="系统类型" align="center"> |
||||
<template slot-scope="scope"> |
||||
{{ scope.row.type === 1 ? '流程类' : scope.row.type === 3 ? '理论' : '编程类' }} |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="remark" label="备注名称" align="center"></el-table-column> |
||||
<el-table-column prop="projectName" label="项目名称" align="center"> |
||||
<template slot-scope="scope"> |
||||
{{ scope.row.projectName || scope.row.paperName }} |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="操作" align="center" width="55"> |
||||
<template slot-scope="scope"> |
||||
<i :class="['el-icon-delete rm', { disabled: scope.row.disabled }]" |
||||
@click="delProject(scope.$index, scope.row)"></i> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
</div> |
||||
</div> |
||||
|
||||
<span slot="footer" class="dialog-footer"> |
||||
<el-button @click="configVisible = false">取 消</el-button> |
||||
<el-button type="primary" @click="handleConfirm">确 定</el-button> |
||||
</span> |
||||
</el-dialog> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import Util from '@/libs/util' |
||||
import Editor from '@tinymce/tinymce-vue' |
||||
import editorConfig from '@/utils/editor' |
||||
import Oss from '@/components/upload/upload.js' |
||||
export default { |
||||
components: { |
||||
Editor, |
||||
}, |
||||
data () { |
||||
return { |
||||
headers: { |
||||
token: sessionStorage.getItem("token") |
||||
}, |
||||
editorConfig, |
||||
isDetail: Boolean(this.$route.query.isDetail), |
||||
step: 1, |
||||
form: { |
||||
cid: this.$route.query.cid, |
||||
curriculumName: "", |
||||
curriculumType: '', |
||||
courseType: "", |
||||
categoryId: 1, |
||||
professionalCategoryId: 1, |
||||
professionalId: 1, |
||||
expectedCourse: "", |
||||
briefIntroduction: "", |
||||
teachingObjectives: "", |
||||
systemIdByAssessment: [], |
||||
systemIdByPractice: [], |
||||
supplier: [], |
||||
coverUrl: 'https://izhixinyun.com/images/course-cover.png', |
||||
mallDisciplines: [ |
||||
{ |
||||
professionalClassList: [], |
||||
professionalList: [], |
||||
categoryId: 1, |
||||
professionalCategoryId: 1, |
||||
professionalId: 1, |
||||
} |
||||
], |
||||
}, |
||||
rules: { |
||||
curriculumName: [ |
||||
{ required: true, message: "请输入课程名称", trigger: "blur" } |
||||
], |
||||
categoryId: [ |
||||
{ required: true, message: "请选择学科类别", trigger: "change" } |
||||
], |
||||
professionalId: [ |
||||
{ required: true, message: "请选择专业", trigger: "change" } |
||||
], |
||||
supplier: [ |
||||
{ required: true, message: "请选择供应厂商", trigger: "change" } |
||||
], |
||||
expectedCourse: [ |
||||
{ required: true, message: "请选择预计课时", trigger: "change" } |
||||
], |
||||
professionalCategoryId: [ |
||||
{ required: true, message: "请选择专业类", trigger: "change" } |
||||
], |
||||
courseType: [ |
||||
{ required: true, message: "请选择课程类别", trigger: "change" } |
||||
], |
||||
}, |
||||
subjectList: [], |
||||
ProfessionalClassList: [], |
||||
ProfessionalList: [], |
||||
|
||||
pageNo: 1, |
||||
pageSize: 10, |
||||
multipleSelection: [], |
||||
systemKeyword: "", |
||||
searchTimer: null, |
||||
configVisible: false,// 配置弹框 |
||||
|
||||
permissions: "", // 练习:0;考核:1 |
||||
practiceData: [], |
||||
practiceTotal: 0, |
||||
multiplePractice: [], |
||||
|
||||
matches: [], |
||||
matcheTotal: 0, |
||||
multipleMatch: [], |
||||
submiting: false, // 新增编辑防抖标识 |
||||
loadIns: null, |
||||
updateTime: 0, |
||||
systemAll: [], |
||||
systems: [], |
||||
systemsAll: [], |
||||
systemChecked: [], |
||||
curSystem: '', |
||||
projects: [], |
||||
projectKeyword: '', |
||||
checkedKeyword: '', |
||||
checkeds: [], |
||||
checkedAll: [], |
||||
checkAll: false, |
||||
suppliers: [], |
||||
mulSystem: this.$store.state.btns.includes('/curriculum:支持多系统组课'), // 是否支持多系统组课 |
||||
|
||||
|
||||
status: [ |
||||
{ |
||||
id: 0, |
||||
name: '正常' |
||||
} |
||||
], |
||||
practiceData: [], |
||||
practiceTotal: 0, |
||||
multiplePractice: [], |
||||
|
||||
assessmentData: [], |
||||
assessmentTotal: 0, |
||||
multipleAssessment: [], |
||||
}; |
||||
}, |
||||
watch: { |
||||
// 监听信息是否有更改,有的话页面离开的时候要询问是否要保存 |
||||
form: { |
||||
handler () { |
||||
this.updateTime++ |
||||
}, |
||||
deep: true |
||||
}, |
||||
systemKeyword: function (val) { |
||||
clearTimeout(this.searchTimer); |
||||
this.searchTimer = setTimeout(() => { |
||||
this.getConfig(); |
||||
}, 500); |
||||
}, |
||||
projectKeyword: function (val) { |
||||
clearTimeout(this.searchTimer); |
||||
this.searchTimer = setTimeout(() => { |
||||
this.getProject(); |
||||
}, 500); |
||||
}, |
||||
checkedKeyword: function (val) { |
||||
clearTimeout(this.searchTimer); |
||||
this.searchTimer = setTimeout(() => { |
||||
this.filterChecked(); |
||||
}, 500); |
||||
} |
||||
}, |
||||
created () { |
||||
|
||||
}, |
||||
mounted () { |
||||
this.getSubject() |
||||
this.getConfig() |
||||
this.getSystem() |
||||
this.getSupplier() |
||||
this.form.cid && this.getInfoData() |
||||
}, |
||||
methods: { |
||||
getInfoData () { |
||||
this.$post(`${this.api.curriculumDetail}?cid=${this.form.cid}`).then(({ data }) => { |
||||
if (data.supplier) data.supplier = data.supplier.split(',').map(e => +e) |
||||
if (data.categoryId) { |
||||
this.$get(this.api.courseProfessionalClass, { disciplineId: data.categoryId }).then(res => { |
||||
this.ProfessionalClassList = res.list; |
||||
}).catch(res => { }); |
||||
} |
||||
if (data.professionalCategoryId) { |
||||
this.$get(this.api.courseProfessional, { professionalClassId: data.professionalCategoryId }).then(res => { |
||||
this.ProfessionalList = res.list; |
||||
}).catch(res => { }); |
||||
} |
||||
this.$nextTick(() => { |
||||
this.form = data; |
||||
const pList = data.practiceConfig |
||||
const { systemsAll } = this |
||||
pList.map(e => { |
||||
if (!systemsAll.find(n => n.systemId == e.systemId)) e.disabled = true |
||||
}) |
||||
this.practiceData = pList |
||||
|
||||
const aList = data.assessmentConfig |
||||
aList.map(e => { |
||||
if (!systemsAll.find(n => n.systemId == e.systemId)) e.disabled = true |
||||
}) |
||||
this.assessmentData = aList |
||||
|
||||
const cList = data.competitionConfig |
||||
cList.map(e => { |
||||
if (!systemsAll.find(n => n.systemId == e.systemId)) e.disabled = true |
||||
}) |
||||
this.matches = cList |
||||
}); |
||||
}).catch(err => { |
||||
}); |
||||
}, |
||||
// 获取供应厂商 |
||||
getSupplier () { |
||||
const sid = this.$store.state.dataPer.find(e => e.permissionName === '课程管理') |
||||
this.$get(this.api.getSupplierListByRole, { |
||||
permissionId: sid.permissionId |
||||
}).then(res => { |
||||
this.suppliers = res.supplierList |
||||
}).catch(res => { }) |
||||
}, |
||||
// 获取系统 |
||||
getSystem () { |
||||
const checked = this[!this.permissions ? |
||||
'practiceData' : |
||||
this.permissions == 1 ? |
||||
'assessmentData' : |
||||
'matches'] |
||||
const sid = this.$store.state.dataPer.find(e => e.permissionName === '课程管理') |
||||
this.$post(this.api.queryServiceConfig, { |
||||
systemName: '', |
||||
pageNum: 1, |
||||
pageSize: 1000, |
||||
supplierId: sid ? sid.supplierId : '' |
||||
}).then(({ serviceList }) => { |
||||
this.systemsAll = serviceList.records |
||||
}).catch(err => { }) |
||||
}, |
||||
|
||||
// 添加学科 |
||||
addSubject () { |
||||
const e = { |
||||
professionalClassList: [], |
||||
professionalList: [], |
||||
categoryId: 1, |
||||
professionalCategoryId: 1, |
||||
professionalId: 1, |
||||
} |
||||
this.form.mallDisciplines.push(e) |
||||
this.getProfessionalClassData(e) |
||||
}, |
||||
// 获取学科类别 |
||||
getSubject () { |
||||
this.$get(this.api.courseDiscipline).then(res => { |
||||
this.subjectList = res.list |
||||
this.form.mallDisciplines.forEach(e => { |
||||
e.categoryId === 1 && this.getProfessionalClass(e) |
||||
}) |
||||
}).catch(err => { }) |
||||
}, |
||||
// 清除学科类别 |
||||
clearClass (item) { |
||||
item.professionalCategoryId = item.categoryId === 1 ? 1 : '' |
||||
item.professionalId = item.categoryId === 1 ? 1 : '' |
||||
}, |
||||
// 获取专业类 |
||||
getProfessionalClass (item) { |
||||
this.clearClass(item); |
||||
this.getProfessionalClassData(item); |
||||
}, |
||||
getProfessionalClassData (item) { |
||||
this.$get(this.api.courseProfessionalClass, { |
||||
disciplineId: item.categoryId |
||||
}).then(res => { |
||||
item.professionalClassList = res.list |
||||
this.form.mallDisciplines.forEach(e => { |
||||
e.professionalCategoryId === 1 && this.getProfessional(e) |
||||
}) |
||||
}).catch(err => { }) |
||||
}, |
||||
// 清除专业类 |
||||
clearProfess (item) { |
||||
item.professionalId = item.professionalCategoryId === 1 ? 1 : '' |
||||
}, |
||||
// 获取专业 |
||||
getProfessional (item) { |
||||
this.clearProfess(item); |
||||
this.getProfessionalData(item); |
||||
}, |
||||
getProfessionalData (item) { |
||||
this.$get(this.api.courseProfessional, { |
||||
professionalClassId: item.professionalCategoryId |
||||
}).then(res => { |
||||
item.professionalList = res.list |
||||
}).catch(err => { }) |
||||
}, |
||||
|
||||
|
||||
handleExceed (files, fileList) { |
||||
Util.warningMsg(`当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!`); |
||||
}, |
||||
// 封面自定义上传 |
||||
async handleRequest ({ file }) { |
||||
Oss.upload(file).then(res => { |
||||
this.form.coverUrl = res.url |
||||
}) |
||||
}, |
||||
uploadError (err, file, fileList) { |
||||
this.$message({ |
||||
message: "上传出错,请重试!", |
||||
type: "error", |
||||
center: true |
||||
}) |
||||
}, |
||||
beforeRemove (file, fileList) { |
||||
return this.$confirm(`确定移除 ${file.name}?`); |
||||
}, |
||||
handleRemove () { |
||||
Oss.del(this.form.coverUrl) |
||||
this.form.coverUrl = '' |
||||
}, |
||||
|
||||
// 获取系统 |
||||
getConfig () { |
||||
const checked = this[!this.permissions ? |
||||
'practiceData' : |
||||
this.permissions == 1 ? |
||||
'assessmentData' : |
||||
'matches'] |
||||
const sid = this.$store.state.dataPer.find(e => e.permissionName === '课程管理') |
||||
this.$post(this.api.queryServiceConfig, { |
||||
systemName: this.systemKeyword, |
||||
pageNum: 1, |
||||
pageSize: 1000, |
||||
supplierId: sid ? sid.supplierId : '' |
||||
}).then(res => { |
||||
const list = res.serviceList.records |
||||
this.systemAll = JSON.parse(JSON.stringify(list)) // 全部系统,另外保存 |
||||
const result = [] |
||||
list.map(e => { |
||||
// 如果选中的项目里有该系统的项目,则隐藏 |
||||
// if (!checked.find(n => n.systemId == e.systemId)) { |
||||
// e.check = !!checked.find(n => n.systemId == e.systemId) |
||||
e.check = false |
||||
result.push(e) |
||||
// } |
||||
}) |
||||
this.systems = result |
||||
this.checkAll = !!checked.find(n => n.systemId == result[0].systemId) // 因为默认显示第一个系统的项目,所以如果系统默认选中,则全选也勾选上 |
||||
result.length && this.getProject(result[0]) |
||||
}).catch(err => { }) |
||||
}, |
||||
// 获取项目列表 |
||||
async getProject (item, fromSystemChange) { |
||||
const checked = this.checkeds |
||||
if (item) this.curSystem = item.systemId |
||||
let res |
||||
if (!fromSystemChange) { |
||||
res = await this.$get(`${this.api.getInternalProjectBySystemId}?permissions=${this.permissions}&systemId=${this.curSystem}&keyword=${this.projectKeyword}`) |
||||
} |
||||
const result = [] |
||||
const projects = fromSystemChange ? this.projects : res |
||||
projects.map(e => { |
||||
// 如果选择了该项目,则禁用并选中 |
||||
const include = checked.some(n => (e.projectId && n.projectId == e.projectId && n.systemId == e.systemId) || (e.paperId && n.paperId == e.paperId)) |
||||
e.check = include |
||||
result.push(e) |
||||
}) |
||||
this.checkAll = !result.filter(e => !e.check).length |
||||
this.projects = result |
||||
}, |
||||
// 系统选择回调 |
||||
systemChange (val, item) { |
||||
// 项目列表选中状态同步 |
||||
const { projects, checkeds } = this |
||||
if (projects.length && projects[0].systemId == item.systemId) { |
||||
projects.map(e => { |
||||
e.check = val |
||||
}) |
||||
} |
||||
this.projectKeyword = '' |
||||
this.$get(`${this.api.getInternalProjectBySystemId}?permissions=${this.permissions}&systemId=${item.systemId}&keyword=${this.projectKeyword}`).then(res => { |
||||
if (val) { |
||||
// 如果不支持多选系统,选中后全部取消选中再选中当前系统 |
||||
if (!this.mulSystem) { |
||||
this.systems.map(e => e.check = false) |
||||
item.check = true |
||||
} |
||||
res.map(e => { |
||||
if (!checkeds.find(n => (e.projectId && n.projectId == e.projectId && n.systemId == e.systemId) || (e.paperId && e.paperId == n.paperId))) { |
||||
checkeds.push(e) |
||||
} |
||||
}) |
||||
} else { |
||||
res.map(e => { |
||||
const i = checkeds.findIndex(n => (e.projectId && n.projectId == e.projectId && n.systemId == e.systemId) || (e.paperId && e.paperId == n.paperId)) |
||||
i === -1 || checkeds.splice(i, 1) |
||||
}) |
||||
} |
||||
this.checkedAll = JSON.parse(JSON.stringify(checkeds)) // 全部已选项目,另外保存 |
||||
this.getProject(item, 1) |
||||
}).catch(err => { }) |
||||
}, |
||||
// 项目全选回调 |
||||
checkAllChange (val, systemId) { |
||||
this.systemChange(val, { systemId }) |
||||
this.systems.map(e => { |
||||
if (e.systemId == systemId) e.check = val |
||||
}) |
||||
}, |
||||
// 项目选择回调 |
||||
projectChange (val, item) { |
||||
const { systemId, paperId } = item |
||||
const i = this.checkeds.findIndex(e => (item.projectId && e.projectId == item.projectId && e.systemId == systemId) || (paperId && paperId == e.paperId)) |
||||
// 选中,则push,否则移除 |
||||
if (val) { |
||||
this.checkeds.push(item) |
||||
} else if (i !== -1) { |
||||
this.checkeds.splice(i, 1) |
||||
} |
||||
// 同步系统 |
||||
this.systems.map(e => { |
||||
if (e.systemId == systemId) e.check = !this.projects.filter(n => !n.check).length |
||||
}) |
||||
this.checkAll = !this.projects.find(e => !e.check) // 同步全选框 |
||||
this.checkedAll = JSON.parse(JSON.stringify(this.checkeds)) // 全部已选项目,另外保存 |
||||
}, |
||||
// 已选择项目模糊查询 |
||||
filterChecked () { |
||||
const val = this.checkedKeyword |
||||
this.checkeds = this.checkedAll.filter(e => (e.projectName && e.projectName.includes(val)) || (e.paperName && e.paperName.includes(val))) |
||||
}, |
||||
// 删除已选项目 |
||||
delProject (i, e) { |
||||
if (e.disabled) return |
||||
this.$confirm("确定要删除吗?", "提示", { |
||||
type: "warning" |
||||
}).then(() => { |
||||
this.checkeds.splice(i, 1) |
||||
// 如果当前展示的项目列表跟删掉的项目是同个系统,则找到项目列表里删掉的该项目,重置check和disabled |
||||
if (e.systemId == this.curSystem) { |
||||
const { projectId, paperId } = e |
||||
this.projects.map(n => { |
||||
if ((projectId && n.projectId == projectId) || (paperId && n.paperId == paperId)) { |
||||
n.check = false |
||||
} |
||||
}) |
||||
this.checkAll = !this.projects.find(e => !e.check) |
||||
} |
||||
this.systems.map(n => { |
||||
if (n.systemId == e.systemId) n.check = false |
||||
}) |
||||
}).catch(() => { }) |
||||
}, |
||||
// 确认系统 |
||||
handleConfirm () { |
||||
const list = this.checkeds |
||||
if (!list.length) { |
||||
this.$message.warning("请选择系统!"); |
||||
} else { |
||||
this.configVisible = false |
||||
list.map((e, i) => { |
||||
e.isShow = 0; // isShow是否展示(默认0:展示 1:不展示) |
||||
e.sort = i + 1; // 排序 |
||||
}); |
||||
if (!this.permissions) { |
||||
this.practiceData = JSON.parse(JSON.stringify(list)) |
||||
this.practiceTotal = this.practiceData.length; |
||||
} else if (this.permissions == 1) { |
||||
this.assessmentData = JSON.parse(JSON.stringify(list)) |
||||
this.assessmentTotal = this.assessmentData.length; |
||||
} else if (this.permissions == 2) { |
||||
this.matches = JSON.parse(JSON.stringify(list)) |
||||
this.matchTotal = this.matches.length; |
||||
} |
||||
} |
||||
}, |
||||
handleSelectionPractice (val) { // 多选练习项目 |
||||
this.multiplePractice = val; |
||||
}, |
||||
handleSelectionMatch (val) { // 多选竞赛项目 |
||||
this.multipleMatch = val; |
||||
}, |
||||
|
||||
// 练习考核弹框 |
||||
handleConfig (type) { |
||||
this.systemKeyword = '' |
||||
this.projectKeyword = '' |
||||
this.checkedKeyword = '' |
||||
this.permissions = type; |
||||
this.configVisible = true; |
||||
this.pageNo = 1; |
||||
this.getConfig(); |
||||
this.checkeds = JSON.parse(JSON.stringify(type == 1 ? this.assessmentData : type == 2 ? this.matches : this.practiceData)) |
||||
this.checkedAll = JSON.parse(JSON.stringify(this.checkeds)) |
||||
}, |
||||
handleBatchDelete (type) { // 批量移除 |
||||
if (type == 1 && !this.multipleAssessment.length) { |
||||
this.$message.warning("请勾选考核项目!"); |
||||
return; |
||||
} else if (!type && !this.multiplePractice.length) { |
||||
this.$message.warning("请勾选练习项目!"); |
||||
return; |
||||
} else if (type == 2 && !this.multipleMatch.length) { |
||||
this.$message.warning("请勾选竞赛项目!"); |
||||
return; |
||||
} |
||||
this.$confirm("此操作将批量移除项目, 是否继续?", "提示", { |
||||
type: "warning" |
||||
}).then(() => { |
||||
if (type == 1) { |
||||
let ids = this.multipleAssessment.map(i => i.projectId); |
||||
let tempArr = []; |
||||
for (let i = 0; i < this.assessmentData.length; i++) { |
||||
if (!ids.includes(this.assessmentData[i].projectId)) { |
||||
tempArr.push(this.assessmentData[i]); |
||||
} |
||||
} |
||||
this.assessmentData = tempArr; |
||||
} else if (!type) { |
||||
let ids = this.multiplePractice.map(i => i.projectId); |
||||
let tempArr = []; |
||||
for (let i = 0; i < this.practiceData.length; i++) { |
||||
if (!ids.includes(this.practiceData[i].projectId)) { |
||||
tempArr.push(this.practiceData[i]); |
||||
} |
||||
} |
||||
this.practiceData = tempArr; |
||||
} else { |
||||
let ids = this.multipleMatch.map(i => i.projectId); |
||||
let tempArr = []; |
||||
for (let i = 0; i < this.matches.length; i++) { |
||||
if (!ids.includes(this.matches[i].projectId)) { |
||||
tempArr.push(this.matches[i]); |
||||
} |
||||
} |
||||
this.matches = tempArr; |
||||
} |
||||
this.$message.success("批量移除成功"); |
||||
}).catch(() => { |
||||
this.$message.info("已取消批量移除"); |
||||
}); |
||||
}, |
||||
handleDelete (index, data) { // 移除 |
||||
this.$confirm("此操作将移除该项目, 是否继续?", "提示", { |
||||
type: "warning" |
||||
}).then(() => { |
||||
data.splice(index, 1); |
||||
this.$message.success("移除成功"); |
||||
}).catch(() => { |
||||
this.$message.info("已取消移除"); |
||||
}); |
||||
}, |
||||
practiceSortChange (row, index) { // 处理排序 |
||||
this.practiceData.splice(index, 1, row); |
||||
}, |
||||
|
||||
save () { |
||||
this.$refs.form.validate((valid) => { |
||||
if (valid) { |
||||
if (this.submiting) return false |
||||
const form = JSON.parse(JSON.stringify(this.form)) |
||||
form.supplier = form.supplier.join() |
||||
|
||||
this.submiting = true |
||||
this.loadIns = this.$loading({ |
||||
lock: true, |
||||
text: 'Loading', |
||||
spinner: 'el-icon-loading', |
||||
background: 'rgba(0, 0, 0, 0.7)' |
||||
}) |
||||
debugger |
||||
if (form.cid) { |
||||
this.$post(this.api.modifyCourse, form).then((res) => { |
||||
this.$message.success("编辑成功"); |
||||
}).catch((res) => { |
||||
this.submiting = false |
||||
this.loadIns.close() |
||||
}); |
||||
} else { |
||||
this.$post(this.api.createCurriculum, form).then((res) => { |
||||
this.loadIns.close() |
||||
this.$router.push('/curriculum') |
||||
}).catch((res) => { |
||||
this.submiting = false |
||||
this.loadIns.close() |
||||
}); |
||||
} |
||||
} else { |
||||
return false; |
||||
} |
||||
}); |
||||
}, |
||||
} |
||||
}; |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
.wrap { |
||||
width: 1000px; |
||||
margin: 0 auto; |
||||
|
||||
/deep/.w-input { |
||||
width: 400px; |
||||
} |
||||
|
||||
.cover-wrap { |
||||
display: flex; |
||||
justify-content: space-around; |
||||
|
||||
.preview-title { |
||||
margin-bottom: 10px; |
||||
font-size: 16px; |
||||
color: #000; |
||||
text-align: center; |
||||
} |
||||
|
||||
.preview-pic { |
||||
width: 220px; |
||||
max-height: 140px; |
||||
} |
||||
} |
||||
|
||||
.subject { |
||||
padding: 10px; |
||||
border: 1px dashed #ccc; |
||||
|
||||
.line { |
||||
position: relative; |
||||
display: flex; |
||||
padding-right: 50px; |
||||
margin-bottom: 10px; |
||||
|
||||
&:last-child { |
||||
margin-bottom: 0; |
||||
} |
||||
} |
||||
|
||||
.el-form-item { |
||||
margin-bottom: 0; |
||||
} |
||||
|
||||
.del { |
||||
position: absolute; |
||||
top: 11px; |
||||
right: 20px; |
||||
cursor: pointer; |
||||
} |
||||
} |
||||
|
||||
.subject-plus { |
||||
margin-top: 5px; |
||||
text-align: center; |
||||
font-size: 18px; |
||||
color: #062c87; |
||||
cursor: pointer; |
||||
} |
||||
} |
||||
|
||||
/deep/.config-dia { |
||||
.config-wrap { |
||||
display: flex; |
||||
} |
||||
|
||||
.title-wrap { |
||||
margin-bottom: 15px; |
||||
} |
||||
|
||||
.item { |
||||
width: 250px; |
||||
max-height: 600px; |
||||
padding: 10px; |
||||
margin-right: 20px; |
||||
overflow: hidden; |
||||
} |
||||
|
||||
.system { |
||||
background-color: #f9f9f9; |
||||
} |
||||
|
||||
.systems { |
||||
margin-top: 10px; |
||||
max-height: 520px; |
||||
overflow: auto; |
||||
|
||||
li { |
||||
display: flex; |
||||
align-items: center; |
||||
margin: 10px 0; |
||||
} |
||||
|
||||
.name { |
||||
display: inline-flex; |
||||
flex: 1; |
||||
justify-content: space-between; |
||||
align-items: center; |
||||
margin-left: 5px; |
||||
cursor: pointer; |
||||
|
||||
&.active, |
||||
&:hover { |
||||
color: #062c87; |
||||
} |
||||
|
||||
span { |
||||
max-width: 200px; |
||||
text-overflow: ellipsis; |
||||
white-space: nowrap; |
||||
overflow: hidden; |
||||
} |
||||
} |
||||
} |
||||
|
||||
.checked { |
||||
flex: 1; |
||||
width: auto; |
||||
|
||||
.el-table .cell { |
||||
font-size: 12px; |
||||
} |
||||
} |
||||
|
||||
.rm { |
||||
font-size: 14px; |
||||
cursor: pointer; |
||||
|
||||
&.disabled { |
||||
color: #ccc; |
||||
cursor: not-allowed; |
||||
} |
||||
|
||||
&:hover { |
||||
color: #17161f; |
||||
} |
||||
} |
||||
} |
||||
</style> |
@ -0,0 +1,200 @@ |
||||
<template> |
||||
<div> |
||||
|
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import util from "@/libs/util"; |
||||
import Const from '@/const/match' |
||||
import _ from 'lodash' |
||||
export default { |
||||
props: ['editing'], |
||||
data () { |
||||
return { |
||||
id: this.$route.query.id, |
||||
|
||||
|
||||
pageNo: 1, |
||||
pageSize: 10, |
||||
multipleSelection: [], |
||||
systemKeyword: "", |
||||
searchTimer: null, |
||||
configVisible: false,// 配置弹框 |
||||
}; |
||||
}, |
||||
watch: { |
||||
// 监听信息是否有更改,有的话页面离开的时候要询问是否要保存 |
||||
form: { |
||||
handler () { |
||||
this.updateTime++ |
||||
}, |
||||
deep: true |
||||
}, |
||||
}, |
||||
mounted () { |
||||
this.ruleForm = JSON.parse(JSON.stringify(this.form.competitionStageList[0])) |
||||
this.id && this.getData() |
||||
this.step1 || this.getStep1() // 如果没有第一步的数据,则直接接口获取 |
||||
}, |
||||
methods: { |
||||
|
||||
|
||||
|
||||
save () { |
||||
this.$refs.form.validate((valid) => { |
||||
if (valid) { |
||||
if (this.submiting) return false |
||||
const form = JSON.parse(JSON.stringify(this.form)) |
||||
form.supplier = form.supplier.join() |
||||
if (!this.practiceData.length) { |
||||
this.$message.warning("请添加练习项目配置"); |
||||
return; |
||||
} else { |
||||
form.systemIdByPractice = this.practiceData.map(i => { |
||||
let obj = { |
||||
isShow: i.isShow, |
||||
projectId: i.projectId || '', |
||||
paperId: i.paperId || '', |
||||
sort: Number(i.sort), |
||||
systemId: i.systemId |
||||
}; |
||||
return obj; |
||||
}); |
||||
form.systemIdByPractice.sort((a, b) => a.sort - b.sort) |
||||
} |
||||
if (!this.assessmentData.length) { |
||||
this.$message.warning("请添加考核项目配置"); |
||||
return; |
||||
} else { |
||||
form.systemIdByAssessment = this.assessmentData.map(i => { |
||||
let obj = { |
||||
isShow: i.isShow, |
||||
projectId: i.projectId, |
||||
paperId: i.paperId || '', |
||||
sort: Number(i.sort), |
||||
systemId: i.systemId |
||||
}; |
||||
return obj; |
||||
}); |
||||
form.systemIdByAssessment.sort((a, b) => a.sort - b.sort) |
||||
} |
||||
// 大赛项目配置 |
||||
form.systemIdByCompetition = this.matches.map(i => { |
||||
let obj = { |
||||
isShow: i.isShow, |
||||
projectId: i.projectId, |
||||
paperId: i.paperId || '', |
||||
sort: Number(i.sort), |
||||
systemId: i.systemId |
||||
}; |
||||
return obj; |
||||
}); |
||||
form.systemIdByCompetition.sort((a, b) => a.sort - b.sort) |
||||
|
||||
this.submiting = true |
||||
this.loadIns = this.$loading({ |
||||
lock: true, |
||||
text: 'Loading', |
||||
spinner: 'el-icon-loading', |
||||
background: 'rgba(0, 0, 0, 0.7)' |
||||
}) |
||||
debugger |
||||
if (form.cid) { |
||||
this.$post(this.api.modifyCourse, form).then((res) => { |
||||
this.$message.success("编辑成功"); |
||||
}).catch((res) => { |
||||
this.submiting = false |
||||
this.loadIns.close() |
||||
}); |
||||
} else { |
||||
this.$post(this.api.createCurriculum, form).then((res) => { |
||||
this.loadIns.close() |
||||
this.$confirm("课程创建成功,是否马上进行课程内容设置?", "提示", { |
||||
type: "success", |
||||
confirmButtonText: "马上设置", |
||||
cancelButtonText: "稍后操作", |
||||
closeOnClickModal: false |
||||
}).then(() => { |
||||
this.$router.push(`/contentSettings?cid=${res.cid}&name=${form.curriculumName}`); |
||||
}).catch(() => { |
||||
this.$router.push('/curriculum') |
||||
}) |
||||
}).catch((res) => { |
||||
this.submiting = false |
||||
this.loadIns.close() |
||||
}); |
||||
} |
||||
} else { |
||||
return false; |
||||
} |
||||
}); |
||||
}, |
||||
} |
||||
}; |
||||
</script> |
||||
|
||||
<style scoped lang="scss"> |
||||
/deep/ .d-inline-block { |
||||
width: 216px; |
||||
|
||||
.el-select, |
||||
.el-input { |
||||
width: 100%; |
||||
} |
||||
} |
||||
|
||||
.inline-input { |
||||
.input-wrap { |
||||
display: flex; |
||||
align-items: center; |
||||
margin-bottom: 10px; |
||||
|
||||
.el-input { |
||||
display: inline-block; |
||||
width: 216px; |
||||
margin-right: 8px; |
||||
} |
||||
|
||||
.remove { |
||||
width: 16px; |
||||
height: 16px; |
||||
background: url('../../../assets/img/close.png') 0 0 / cover no-repeat; |
||||
cursor: pointer; |
||||
} |
||||
} |
||||
|
||||
.add-btn { |
||||
margin-left: 32px; |
||||
} |
||||
} |
||||
|
||||
.input-center { |
||||
display: flex; |
||||
align-items: center; |
||||
width: 216px; |
||||
white-space: nowrap; |
||||
|
||||
.el-input { |
||||
margin-right: 5px; |
||||
} |
||||
} |
||||
|
||||
.step-set { |
||||
padding: 15px; |
||||
background-color: #fbfbfb; |
||||
} |
||||
|
||||
.tips { |
||||
font-size: 13px; |
||||
color: #959595; |
||||
} |
||||
|
||||
.req { |
||||
color: #f00; |
||||
} |
||||
|
||||
.line { |
||||
margin-bottom: 10px; |
||||
} |
||||
</style> |
@ -0,0 +1,202 @@ |
||||
<template> |
||||
<div> |
||||
<div class="mgb20 flex-between"> |
||||
<div class="flex-center "> |
||||
<p class="addhr_tag"></p> |
||||
<span>考核项目配置</span> |
||||
</div> |
||||
<div> |
||||
<el-button @click="handleBatchDelete(1)">批量移除</el-button> |
||||
<el-button @click="handleConfig(1)" icon="el-icon-plus" circle></el-button> |
||||
</div> |
||||
</div> |
||||
<div class="border-b-dashed"></div> |
||||
<!-- 实训配置 --> |
||||
<div> |
||||
<el-table :data="assessmentData" class="table" header-align="center" max-height="400" |
||||
@selection-change="handleSelectionAssessment"> |
||||
<el-table-column type="selection" width="55" align="center"></el-table-column> |
||||
<el-table-column type="index" width="100" label="序号" align="center"></el-table-column> |
||||
<el-table-column prop="projectName" label="项目名称" align="center"> |
||||
<template slot-scope="scope"> |
||||
{{ scope.row.projectName || scope.row.paperName }} |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="remark" label="备注名称" align="center"></el-table-column> |
||||
<el-table-column prop="systemName" label="系统名称" align="center"></el-table-column> |
||||
<el-table-column label="排序" align="center" width="100"> |
||||
<template slot-scope="scope"> |
||||
<el-input v-model.trim="scope.row.sort" @input="assessmentSortChange(scope.row, scope.$index)"></el-input> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="展示控制" align="center" width="100"> |
||||
<template slot-scope="scope"> |
||||
<el-switch v-model="scope.row.isShow" :active-value="0" :inactive-value="1" :disabled="scope.row.disabled"> |
||||
</el-switch> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="操作" align="center" width="100"> |
||||
<template slot-scope="scope"> |
||||
<el-button :disabled="scope.row.disabled" |
||||
@click.native.prevent="handleDelete(scope.$index, assessmentData)">移除</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
</div> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import Oss from '@/components/upload/upload.js' |
||||
import Setting from '@/setting' |
||||
import Util from '@/libs/util' |
||||
export default { |
||||
props: ['setupId', 'competitionId', 'editing'], |
||||
data () { |
||||
return { |
||||
|
||||
}; |
||||
}, |
||||
watch: { |
||||
// 监听信息是否有更改,有的话页面离开的时候要询问是否要保存 |
||||
form: { |
||||
handler () { |
||||
this.updateTime++ |
||||
}, |
||||
deep: true |
||||
}, |
||||
}, |
||||
mounted () { |
||||
|
||||
}, |
||||
methods: { |
||||
|
||||
// 练习考核弹框 |
||||
handleConfig (type) { |
||||
this.systemKeyword = '' |
||||
this.projectKeyword = '' |
||||
this.checkedKeyword = '' |
||||
this.permissions = type; |
||||
this.configVisible = true; |
||||
this.pageNo = 1; |
||||
this.getConfig(); |
||||
this.checkeds = JSON.parse(JSON.stringify(type == 1 ? this.assessmentData : type == 2 ? this.matches : this.practiceData)) |
||||
this.checkedAll = JSON.parse(JSON.stringify(this.checkeds)) |
||||
}, |
||||
handleBatchDelete (type) { // 批量移除 |
||||
if (type == 1 && !this.multipleAssessment.length) { |
||||
this.$message.warning("请勾选考核项目!"); |
||||
return; |
||||
} else if (!type && !this.multiplePractice.length) { |
||||
this.$message.warning("请勾选练习项目!"); |
||||
return; |
||||
} else if (type == 2 && !this.multipleMatch.length) { |
||||
this.$message.warning("请勾选竞赛项目!"); |
||||
return; |
||||
} |
||||
this.$confirm("此操作将批量移除项目, 是否继续?", "提示", { |
||||
type: "warning" |
||||
}).then(() => { |
||||
if (type == 1) { |
||||
let ids = this.multipleAssessment.map(i => i.projectId); |
||||
let tempArr = []; |
||||
for (let i = 0; i < this.assessmentData.length; i++) { |
||||
if (!ids.includes(this.assessmentData[i].projectId)) { |
||||
tempArr.push(this.assessmentData[i]); |
||||
} |
||||
} |
||||
this.assessmentData = tempArr; |
||||
} else if (!type) { |
||||
let ids = this.multiplePractice.map(i => i.projectId); |
||||
let tempArr = []; |
||||
for (let i = 0; i < this.practiceData.length; i++) { |
||||
if (!ids.includes(this.practiceData[i].projectId)) { |
||||
tempArr.push(this.practiceData[i]); |
||||
} |
||||
} |
||||
this.practiceData = tempArr; |
||||
} else { |
||||
let ids = this.multipleMatch.map(i => i.projectId); |
||||
let tempArr = []; |
||||
for (let i = 0; i < this.matches.length; i++) { |
||||
if (!ids.includes(this.matches[i].projectId)) { |
||||
tempArr.push(this.matches[i]); |
||||
} |
||||
} |
||||
this.matches = tempArr; |
||||
} |
||||
this.$message.success("批量移除成功"); |
||||
}).catch(() => { |
||||
this.$message.info("已取消批量移除"); |
||||
}); |
||||
}, |
||||
assessmentSortChange (row, index) { // 处理排序 |
||||
this.assessmentData.splice(index, 1, row); |
||||
}, |
||||
handleSelectionAssessment (val) { // 多选考核项目 |
||||
this.multipleAssessment = val; |
||||
}, |
||||
handleDelete (index, data) { // 移除 |
||||
this.$confirm("此操作将移除该项目, 是否继续?", "提示", { |
||||
type: "warning" |
||||
}).then(() => { |
||||
data.splice(index, 1); |
||||
this.$message.success("移除成功"); |
||||
}).catch(() => { |
||||
this.$message.info("已取消移除"); |
||||
}); |
||||
}, |
||||
} |
||||
}; |
||||
</script> |
||||
|
||||
<style scoped lang="scss"> |
||||
.step { |
||||
padding-bottom: 10px; |
||||
background-color: #f9f9f9; |
||||
|
||||
.title { |
||||
display: flex; |
||||
justify-content: space-between; |
||||
align-items: center; |
||||
padding: 10px 15px; |
||||
margin-bottom: 10px; |
||||
background-color: #ededed; |
||||
} |
||||
} |
||||
|
||||
.line { |
||||
margin-bottom: 10px; |
||||
} |
||||
|
||||
/deep/.req { |
||||
.el-form-item__label { |
||||
&:before { |
||||
content: '*'; |
||||
margin-right: 5px; |
||||
font-size: 18px; |
||||
vertical-align: middle; |
||||
color: #f00; |
||||
} |
||||
} |
||||
} |
||||
|
||||
/deep/.file-upload { |
||||
width: 500px; |
||||
|
||||
.download { |
||||
position: absolute; |
||||
bottom: -63px; |
||||
right: 0; |
||||
font-size: 12px; |
||||
color: #007eff; |
||||
cursor: pointer; |
||||
} |
||||
} |
||||
|
||||
/deep/.tips-dia { |
||||
.el-dialog__body { |
||||
padding: 10px 20px; |
||||
} |
||||
} |
||||
</style> |
@ -0,0 +1,56 @@ |
||||
<template> |
||||
<div class="wrap"> |
||||
<div class="modal"> |
||||
<el-steps :space="200" |
||||
:active="4" |
||||
finish-status="success"> |
||||
<el-step title="大赛信息填写"></el-step> |
||||
<el-step title="赛程与规则设置"></el-step> |
||||
<el-step title="比赛内容设置"></el-step> |
||||
<el-step title="发布"></el-step> |
||||
</el-steps> |
||||
<h1>大赛已发布!</h1> |
||||
<div class="btns"> |
||||
<el-button type="primary" |
||||
@click="back">确定</el-button> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
export default { |
||||
data () { |
||||
return { |
||||
|
||||
}; |
||||
}, |
||||
mounted () { |
||||
|
||||
}, |
||||
methods: { |
||||
back () { |
||||
this.$router.push(this.$store.state.referrer || '/match') |
||||
} |
||||
} |
||||
}; |
||||
</script> |
||||
|
||||
<style scoped lang="scss"> |
||||
.wrap { |
||||
height: calc(100vh - 300px); |
||||
background-color: #fefefe; |
||||
} |
||||
.modal { |
||||
width: 500px; |
||||
padding-top: 150px; |
||||
margin: 0 auto; |
||||
h1 { |
||||
margin: 20px; |
||||
text-align: center; |
||||
} |
||||
.btns { |
||||
text-align: center; |
||||
} |
||||
} |
||||
</style> |
Loading…
Reference in new issue