dev
parent
4c4f705af9
commit
47f6976255
23 changed files with 3355 additions and 1723 deletions
After Width: | Height: | Size: 209 B |
@ -0,0 +1,206 @@ |
||||
<template> |
||||
<div class="quill" ref="quill" :class="classes"> |
||||
<div ref="editor" :style="styles" v-loading="loading"></div> |
||||
|
||||
<el-upload :action="this.api.fileupload" :before-upload="beforeUpload" :on-success="editorUploadSuccess" style="display: none"> |
||||
<el-button class="editorUpload" size="small" type="primary">点击上传</el-button> |
||||
</el-upload> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import Quill from 'quill'; |
||||
import 'quill/dist/quill.core.css'; |
||||
import 'quill/dist/quill.snow.css'; |
||||
import 'quill/dist/quill.bubble.css'; |
||||
import toolbarOptions from './options' |
||||
|
||||
export default { |
||||
name: 'quill', |
||||
props: { |
||||
value: { |
||||
type: String, |
||||
default: '' |
||||
}, |
||||
readonly: { |
||||
type: Boolean, |
||||
default:false |
||||
}, |
||||
toTop: { |
||||
type: Boolean, |
||||
default:true |
||||
}, |
||||
border: { |
||||
type: Boolean, |
||||
default:false |
||||
}, |
||||
height: { |
||||
type: Number |
||||
}, |
||||
minHeight: { |
||||
type: Number |
||||
}, |
||||
/* |
||||
* 原本的readOnly失效,对比其他项目,发现是quill版本不同导致, |
||||
* 使用props传入elseRead = 'true',手动隐藏工具栏 |
||||
*/ |
||||
elseRead:{ |
||||
type:String,default:'false' |
||||
} |
||||
}, |
||||
data () { |
||||
return { |
||||
Quill: null, |
||||
currentValue: '', |
||||
options: { |
||||
theme: 'snow', |
||||
bounds: document.body, |
||||
debug: 'warn', |
||||
modules: { |
||||
toolbar: { |
||||
container: toolbarOptions, |
||||
handlers: { |
||||
'image': function (value) { |
||||
if (value) { |
||||
// 调用iview图片上传 |
||||
document.querySelector('.editorUpload').click() |
||||
} else { |
||||
this.Quill.format('image', false); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
}, |
||||
placeholder: '', |
||||
readOnly: this.readonly |
||||
}, |
||||
loading: false |
||||
} |
||||
}, |
||||
computed: { |
||||
classes () { |
||||
return [ |
||||
{ |
||||
'quill-no-border': !this.border |
||||
} |
||||
]; |
||||
}, |
||||
styles () { |
||||
let style = {}; |
||||
if (this.minHeight) { |
||||
style.minHeight = `${this.minHeight}px`; |
||||
} |
||||
if (this.height) { |
||||
style.height = `${this.height}px`; |
||||
} |
||||
return style; |
||||
}, |
||||
|
||||
}, |
||||
watch: { |
||||
value: { |
||||
handler (val) { |
||||
if (val !== this.currentValue) { |
||||
this.currentValue = val; |
||||
if (this.Quill) { |
||||
this.Quill.pasteHTML(this.value); |
||||
} |
||||
} |
||||
}, |
||||
immediate: true |
||||
} |
||||
}, |
||||
created(){ |
||||
}, |
||||
mounted () { |
||||
this.init(); |
||||
// 处理工具栏隐藏样式 |
||||
if(this.elseRead==='true'){ |
||||
let children = this.$refs.quill.children[0].style |
||||
children.padding = '0' |
||||
children.overflow = 'hidden' |
||||
children.height = '0' |
||||
children.borderTop = '0' |
||||
} |
||||
}, |
||||
beforeDestroy () { |
||||
// 在组件销毁后销毁实例 |
||||
this.Quill = null; |
||||
}, |
||||
methods: { |
||||
init () { |
||||
const editor = this.$refs.editor; |
||||
// 初始化编辑器 |
||||
this.Quill = new Quill(editor, this.options); |
||||
// 默认值 |
||||
this.Quill.pasteHTML(this.currentValue); |
||||
if(this.toTop){ |
||||
this.$nextTick(() => { |
||||
window.scrollTo(0,0) |
||||
}) |
||||
} |
||||
// 绑定事件 |
||||
this.Quill.on('text-change', (delta, oldDelta, source) => { |
||||
const html = this.$refs.editor.children[0].innerHTML; |
||||
const text = this.Quill.getText(); |
||||
const quill = this.Quill; |
||||
// 更新内部的值 |
||||
this.currentValue = html; |
||||
// 发出事件 v-model |
||||
this.$emit('input', html); |
||||
// 发出事件 |
||||
this.$emit('on-change', { html, text, quill }); |
||||
}); |
||||
// 将一些 quill 自带的事件传递出去 |
||||
this.Quill.on('text-change', (delta, oldDelta, source) => { |
||||
this.$emit('on-text-change', delta, oldDelta, source); |
||||
}); |
||||
this.Quill.on('selection-change', (range, oldRange, source) => { |
||||
this.$emit('on-selection-change', range, oldRange, source); |
||||
}); |
||||
this.Quill.on('editor-change', (eventName, ...args) => { |
||||
this.$emit('on-editor-change', eventName, ...args); |
||||
}); |
||||
}, |
||||
beforeUpload(file){ |
||||
this.loading = true |
||||
}, |
||||
editorUploadSuccess (res) { |
||||
// 获取富文本组件实例 |
||||
let quill = this.Quill |
||||
// 如果上传成功 |
||||
if (res.data.filesResult.fileUrl) { |
||||
// 获取光标所在位置 |
||||
let length = quill.getSelection().index; |
||||
// 插入图片,res为服务器返回的图片链接地址 |
||||
quill.insertEmbed(length, 'image', res.data.filesResult.fileUrl) |
||||
// 调整光标到最后 |
||||
quill.setSelection(length + 1) |
||||
} else { |
||||
this.$message.success('图片插入失败') |
||||
} |
||||
this.loading = false |
||||
}, |
||||
} |
||||
} |
||||
</script> |
||||
<style lang="scss" scoped> |
||||
.quill-no-border{ |
||||
.ql-toolbar.ql-snow{ |
||||
border: none; |
||||
border-bottom: 1px solid #e8eaec; |
||||
} |
||||
.ql-container.ql-snow{ |
||||
border: none; |
||||
} |
||||
} |
||||
.else{ |
||||
.ql-toolbar.ql-snow{ |
||||
height: 0; |
||||
overflow: hidden; |
||||
padding: 0; |
||||
border-top: 0; |
||||
} |
||||
} |
||||
|
||||
</style> |
@ -0,0 +1,16 @@ |
||||
export default [ |
||||
['bold', 'italic', 'underline', 'strike'], |
||||
['blockquote', 'code-block'], |
||||
[{ 'header': 1 }, { 'header': 2 }], |
||||
[{ 'list': 'ordered' }, { 'list': 'bullet' }], |
||||
[{ 'script': 'sub' }, { 'script': 'super' }], |
||||
[{ 'indent': '-1' }, { 'indent': '+1' }], |
||||
[{ 'direction': 'rtl' }], |
||||
[{ 'size': ['small', false, 'large', 'huge'] }], |
||||
[{ 'header': [1, 2, 3, 4, 5, 6, false] }], |
||||
[{ 'color': [] }, { 'background': [] }], |
||||
[{ 'font': [] }], |
||||
[{ 'align': [] }], |
||||
['clean'], |
||||
['link', 'image', 'video'] |
||||
] |
@ -0,0 +1,34 @@ |
||||
/** |
||||
* 业务配置 |
||||
* */ |
||||
const url = location.host; |
||||
const isDev = process.env.NODE_ENV === 'development'; // 开发环境
|
||||
const isTest = url.includes('10.196.131.73'); //测试服
|
||||
const isPro = url.includes('120.78.127.12'); //正式服
|
||||
|
||||
|
||||
let jumpPath = ""; |
||||
let host = ""; |
||||
if (isDev) { |
||||
jumpPath = "http://192.168.31.154:8087/"; |
||||
// host = 'http://192.168.31.216:9000'// 榕
|
||||
host = 'http://192.168.31.125:9000'// 坤
|
||||
// host = 'http://192.168.31.137:9000'// 陈赓
|
||||
} else if (isTest) { |
||||
jumpPath = ""; |
||||
host = "http://39.108.250.202:9000"; |
||||
} else if (isPro) { |
||||
jumpPath = ""; |
||||
host = ""; |
||||
} |
||||
|
||||
|
||||
const Setting = { |
||||
/** |
||||
* 基础配置 |
||||
* */ |
||||
jumpPath, // 跳转路径前缀
|
||||
host, // 请求路径前缀
|
||||
}; |
||||
|
||||
export default Setting; |
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,661 @@ |
||||
<template> |
||||
<div> |
||||
<el-row :gutter="20"> |
||||
<el-col :span="24"> |
||||
<el-card shadow="hover" class="mgb20"> |
||||
<div class="flex-between"> |
||||
<el-page-header @back="goBack" content="项目配置"></el-page-header> |
||||
<div v-if="!isDetail"> |
||||
<el-button v-if="!projectId" type="success" size="small" @click="handleSubmit(0)">保存为草稿</el-button> |
||||
<el-button type="primary" size="small" @click="handleSubmit(1)">确定并发布</el-button> |
||||
</div> |
||||
</div> |
||||
</el-card> |
||||
|
||||
<el-card shadow="hover" class="mgb20"> |
||||
<div class="flex-center mgb20"> |
||||
<p class="addhr_tag"></p> |
||||
<span>课程信息</span> |
||||
</div> |
||||
<div class="border-b-dashed"></div> |
||||
|
||||
<div> |
||||
<el-form label-width="80px"> |
||||
<div style="display: flex"> |
||||
<el-form-item label="项目名称"> |
||||
<el-input :disabled="isDetail" v-model.trim="projectManage.projectName" placeholder="20个字符以内" @blur="projectNameExistis"></el-input> |
||||
</el-form-item> |
||||
<el-form-item label="项目权限"> |
||||
<el-select :disabled="isDetail" v-model="projectManage.permissions" placeholder="请选择"> |
||||
<el-option label="练习" :value="0"></el-option> |
||||
<el-option label="考核" :value="1"></el-option> |
||||
<el-option label="竞赛" :value="2"></el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
</div> |
||||
</el-form> |
||||
</div> |
||||
</el-card> |
||||
|
||||
<el-card shadow="hover" class="mgb20"> |
||||
<div class="flex-center mgb20"> |
||||
<p class="addhr_tag"></p> |
||||
<span>实验目标</span> |
||||
</div> |
||||
<div class="border-b-dashed"></div> |
||||
<div> |
||||
<el-form label-width="0"> |
||||
<el-form-item> |
||||
<quill :border="true" :readonly="isDetail" v-model="projectManage.experimentTarget" :minHeight="150" :height="150" /> |
||||
</el-form-item> |
||||
</el-form> |
||||
</div> |
||||
</el-card> |
||||
|
||||
<el-card shadow="hover" class="mgb20"> |
||||
<div class="flex-center mgb20"> |
||||
<p class="addhr_tag"></p> |
||||
<span>案例描述</span> |
||||
</div> |
||||
<div class="border-b-dashed"></div> |
||||
<div> |
||||
<el-form label-width="0"> |
||||
<el-form-item> |
||||
<quill :border="true" :readonly="isDetail" v-model="projectManage.experimentDescription" :minHeight="150" :height="150" /> |
||||
</el-form-item> |
||||
</el-form> |
||||
</div> |
||||
</el-card> |
||||
|
||||
<el-card shadow="hover" class="mgb20"> |
||||
<div class="flex-between mgb20"> |
||||
<div class="flex-center"> |
||||
<p class="addhr_tag"></p> |
||||
<span>实验任务</span> |
||||
</div> |
||||
<div> |
||||
<el-button :disabled="isDetail" type="primary" @click="toJudgePoint('home')">进入判分点</el-button> |
||||
</div> |
||||
</div> |
||||
<div class="border-b-dashed"></div> |
||||
|
||||
<div class="mgb20 flex-between"> |
||||
<div class="flex-center"> |
||||
<div class="m-r-20" style="color: #f00">项目总分值:100分</div> |
||||
<!-- <div>权重 <div class="dib"><el-input></el-input></div></div> --> |
||||
</div> |
||||
|
||||
<div> |
||||
<el-button :disabled="isDetail" class="m-r-20" type="text" @click="avgDistributionScore">平均分配分值</el-button> |
||||
<el-button :disabled="isDetail" class="m-r-20" type="text" @click="manualDistributionScore">手动分配分值</el-button> |
||||
<span>(待分配分值: {{ handDistributionScore }}/100分)</span> |
||||
</div> |
||||
</div> |
||||
<el-button :disabled="isDetail" type="primary" icon="el-icon-plus" round @click="handleQueryJudgment" style="margin-bottom: 10px">判分点</el-button> |
||||
<el-button :disabled="isDetail" type="primary" icon="el-icon-delete" round @click="batchDeleteProjectJudgment" style="margin-bottom: 10px">批量删除</el-button> |
||||
<el-table |
||||
ref="projectJudgementTable" |
||||
:data="projectJudgmentData" |
||||
class="table" |
||||
stripe |
||||
header-align="center" |
||||
@selection-change="handleSelectionProjectJudgment" |
||||
row-key="judgmentId" |
||||
> |
||||
<el-table-column type="selection" width="55" align="center"></el-table-column> |
||||
<el-table-column prop="id" label="序号" width="80" align="center"> |
||||
<template slot-scope="scope"> |
||||
{{ scope.$index + 1 }} |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="name" label="判分指标" align="center"></el-table-column> |
||||
<el-table-column prop="name" label="判分点名称" align="center"></el-table-column> |
||||
<el-table-column label="排序" align="center"> |
||||
<template slot-scope="scope"> |
||||
<el-button |
||||
:disabled="isDetail" |
||||
v-show="scope.$index > 0" |
||||
type="text" |
||||
icon="el-icon-top" |
||||
@click="handleMoveUp(scope.$index)" |
||||
style="font-size: 24px" |
||||
></el-button> |
||||
<el-button |
||||
:disabled="isDetail" |
||||
v-show="(scope.$index+1) < projectJudgmentData.length" |
||||
type="text" |
||||
icon="el-icon-bottom" |
||||
@click="handleMoveDown(scope.$index)" |
||||
style="font-size: 24px" |
||||
></el-button> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="实验要求" align="center"> |
||||
<template slot-scope="scope"> |
||||
<quill :border="true" :readonly="true" elseRead="true" v-model="scope.row.experimentalRequirements" :minHeight="150" :height="150" /> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="操作" width="140" align="center"> |
||||
<template slot-scope="scope"> |
||||
<el-button :disabled="isDetail" type="text" style="margin-right: 10px" @click="toJudgePoint('edit', scope.row)">自定义</el-button> |
||||
<el-button :disabled="isDetail" type="text" @click="delJudgePoint(scope.$index)">删除</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="score" label="分数" align="center"> |
||||
<template slot-scope="scope"> |
||||
<!--type="number"--> |
||||
<el-input :disabled="isDetail" v-model.trim="scope.row.score" @input="scoreChange(scope.row, scope.$index)"></el-input> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
</el-card> |
||||
|
||||
<el-card shadow="hover" class="mgb20"> |
||||
<div class="flex-between mgb20"> |
||||
<div class="flex-center"> |
||||
<p class="addhr_tag"></p> |
||||
<span>案例描述</span> |
||||
</div> |
||||
<div> |
||||
启用 |
||||
<el-switch :disabled="isDetail" :active-value="0" :inactive-value="1" v-model="projectManage.hintOpen"></el-switch> |
||||
</div> |
||||
</div> |
||||
<div class="border-b-dashed"></div> |
||||
<div> |
||||
<el-form label-width="0"> |
||||
<el-form-item prop="tips" label=""> |
||||
<quill :border="true" :readonly="isDetail" v-model="projectManage.experimentHint" :minHeight="150" :height="150" /> |
||||
</el-form-item> |
||||
</el-form> |
||||
</div> |
||||
</el-card> |
||||
</el-col> |
||||
</el-row> |
||||
|
||||
<!--选择判分点对话框--> |
||||
<el-dialog title="添加判分点" :visible.sync="dialogVisible" width="40%" :close-on-click-modal="false"> |
||||
<div class="text-right m-b-10"> |
||||
<div> |
||||
<el-input placeholder="请输入需要查找的判分点" prefix-icon="el-icon-search" v-model.trim="judgementpointsquery" clearable></el-input> |
||||
</div> |
||||
</div> |
||||
|
||||
<el-table |
||||
:data="judgementData" |
||||
ref="judgementTable" |
||||
class="table" |
||||
stripe |
||||
header-align="center" |
||||
max-height="400" |
||||
@selection-change="handleSelectionJudgment" |
||||
:row-key="rowKey" |
||||
> |
||||
<el-table-column type="selection" width="55" align="center" :reserve-selection="true"></el-table-column> |
||||
<el-table-column prop="id" label="序号" align="center" width="100"> |
||||
<template slot-scope="scope"> |
||||
{{ scope.$index + 1 }} |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="name" label="判分点名称" align="center"></el-table-column> |
||||
<el-table-column label="操作" align="center" width="100"> |
||||
<template slot-scope="scope"> |
||||
<el-button size="mini" @click="toJudgePoint('view', scope.row)">查看</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<div slot="footer" class="dialog-footer"> |
||||
<el-button @click="dialogVisible = false">取 消</el-button> |
||||
<el-button type="primary" @click="addJudgment">确 定</el-button> |
||||
</div> |
||||
</el-dialog> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import Setting from "@/setting"; |
||||
import quill from "@/components/quill"; |
||||
export default { |
||||
components: { |
||||
quill |
||||
}, |
||||
data() { |
||||
return { |
||||
host: Setting.apiBaseURL, |
||||
projectId: this.$route.query.projectId, |
||||
systemList: Setting.systemList, |
||||
token: btoa(sessionStorage.getItem('token')), |
||||
isDetail: Boolean(this.$route.query.show), |
||||
|
||||
projectManage: { |
||||
founder: 0, // 创建人角色(0、系统 1、老师) |
||||
projectName: "", // 项目名称 |
||||
permissions: 0, // 项目权限(0、练习 1、考核 2、竞赛) |
||||
schoolId: Setting.schoolId, |
||||
systemId: this.$route.query.systemId, // 系统id |
||||
hintOpen: 0, // 实验提示是否开启(0开启 1不开启 默认0) |
||||
experimentHint: "", // 实验提示 |
||||
experimentTarget: "", // 实验目标 |
||||
experimentDescription: "", // 案例描述 |
||||
state: 0, // 状态(0、草稿箱 1、已发布) |
||||
isOpen: 0, // 是否开启(0开启 1未开启 默认0) |
||||
isDel: 0 // 是否删除(0、未删除 1、已删除 默认0) |
||||
}, |
||||
projectJudgmentData: [], //实验任务(项目判分点) |
||||
selectedProjectJudgment: [], // 选中的项目判分点 |
||||
|
||||
dialogVisible: false, // 选择判分点对话框 |
||||
judgementpointsquery: "", //条件筛选判分点 |
||||
judgementData: [], // 判分点列表数据 |
||||
selectedJudgment: [], // 选中的判分点 |
||||
rowKey: "", // 判分点行数据的 Key |
||||
projectNameRepeat: false, // 项目名称是否重复 |
||||
|
||||
flag: false, //判分点表格分数是否禁用 |
||||
avgValuelist: [], //取得判分点平均分的数组 |
||||
|
||||
searchTimer: null, |
||||
isToPoint: false // 判断是否是跳转到判分点系统 |
||||
}; |
||||
}, |
||||
computed: { |
||||
lastSystemId() { |
||||
return this.$store.state.lastSystemId; |
||||
}, |
||||
projectFields() { |
||||
return this.$store.state.projectFields; |
||||
}, |
||||
handDistributionScore: function() { |
||||
//计算判分点分值,超出100提示, |
||||
let score = 0; |
||||
this.projectJudgmentData.forEach(e => { |
||||
score += parseInt(e.score); |
||||
}); |
||||
if (isNaN(score)) { |
||||
return 0; |
||||
} |
||||
if (score > 100) { |
||||
this.$message.warning("分配的数值已超过100"); |
||||
} |
||||
return score; |
||||
} |
||||
}, |
||||
watch: { |
||||
projectJudgmentData: { |
||||
handler(newValue) { |
||||
console.log("newValue:", newValue); |
||||
}, |
||||
deep: true |
||||
}, |
||||
judgementpointsquery(n) { |
||||
clearTimeout(this.searchTimer); |
||||
this.searchTimer = setTimeout(() => { |
||||
this.handleQueryJudgment(); |
||||
}, 500); |
||||
} |
||||
}, |
||||
created() { |
||||
console.log(this.projectManage.systemId, "this.projectManage.systemId", this.lastSystemId); |
||||
}, |
||||
mounted() { |
||||
if (this.$route.query.projectId) { |
||||
this.projectId = this.$route.query.projectId; |
||||
this.getInfoData(); |
||||
} |
||||
// 判断有没有缓存数据 |
||||
if (JSON.stringify(this.projectFields) != '{}') { |
||||
let { projectManage, projectJudgmentData } = this.projectFields; |
||||
this.projectManage = projectManage; |
||||
this.projectJudgmentData = projectJudgmentData; |
||||
} |
||||
}, |
||||
beforeDestroy() { |
||||
if (!this.isToPoint) { |
||||
this.$store.dispatch('setProject',{}); |
||||
} |
||||
}, |
||||
methods: { |
||||
goBack() { // 返回 |
||||
if (this.isDetail) { |
||||
this.$router.back(); |
||||
} else { |
||||
this.$confirm("确定返回?未更新的信息将不会保存。", "提示", { |
||||
type: "warning" |
||||
}).then(() => { |
||||
this.$router.back(); |
||||
}).catch(() => { |
||||
}); |
||||
} |
||||
}, |
||||
getInfoData() { // 获取详情数据 |
||||
if (!this.isToPoint) { |
||||
this.$get(`${this.api.getProjectDetail}?projectId=${this.projectId}&schoolId=${this.projectManage.schoolId}`).then(res => { |
||||
if (res.status === 200) { |
||||
let { projectManage, projectJudgmentVos } = res; |
||||
this.projectManage = projectManage; |
||||
this.projectJudgmentData = projectJudgmentVos; |
||||
} else { |
||||
this.$message.warning(res.message); |
||||
} |
||||
}).catch(err => { |
||||
console.log(err); |
||||
}); |
||||
} |
||||
}, |
||||
projectNameExistis() { // 项目管理名称判重 |
||||
if (this.projectManage.projectName) { |
||||
this.$post(this.api.queryNameIsExist, { projectName: this.projectManage.projectName }).then(res => { |
||||
if (res.status === 200) { |
||||
this.projectNameRepeat = false; |
||||
} else { |
||||
this.projectNameRepeat = true; |
||||
} |
||||
}).catch(err => { |
||||
this.projectNameRepeat = true; |
||||
}); |
||||
} else { |
||||
this.projectNameRepeat = false; |
||||
} |
||||
}, |
||||
systemChange() { // 切换系统 |
||||
if (this.projectJudgmentData.length) { |
||||
this.$confirm("更换系统会清空实验任务,确认更换?", "提示", { |
||||
type: "warning" |
||||
}).then(() => { |
||||
this.projectJudgmentData = []; |
||||
this.$store.dispatch('setSystemId',this.projectManage.systemId); |
||||
}).catch(() => { |
||||
this.projectManage.systemId = this.lastSystemId; |
||||
console.log(this.lastSystemId, "this.lastSystemId"); |
||||
}); |
||||
} |
||||
}, |
||||
judgmentRelease() { //判断能否成功发布 |
||||
let { |
||||
projectName, |
||||
experimentTarget, |
||||
experimentDescription, |
||||
experimentHint, |
||||
hintOpen |
||||
} = this.projectManage; |
||||
if (!projectName) { |
||||
this.$message.warning("请输入项目名称"); |
||||
return false; |
||||
} |
||||
if (this.projectNameRepeat) { |
||||
this.$message.warning("该项目名称已存在"); |
||||
return false; |
||||
} |
||||
if (!experimentTarget) { |
||||
this.$message.warning("请输入实验目标"); |
||||
return false; |
||||
} |
||||
if (!experimentDescription) { |
||||
this.$message.warning("请输入案例描述"); |
||||
return false; |
||||
} |
||||
if (this.projectJudgmentData.length == 0) { |
||||
this.$message.warning("请添加判分点"); |
||||
return false; |
||||
} |
||||
if (this.handDistributionScore < 100) { |
||||
this.$message.warning("判分点分数未满100"); |
||||
return false; |
||||
} |
||||
if (this.handDistributionScore > 100) { |
||||
this.$message.warning("判分点分数已超过100"); |
||||
return false; |
||||
} |
||||
if (!experimentHint && hintOpen) { |
||||
this.$message.warning("请输入实验提示"); |
||||
return false; |
||||
} |
||||
return true; |
||||
}, |
||||
handleSubmit(state) { //处理提交 |
||||
if (!this.judgmentRelease()) { //判断页面是否有没有输入的内容 |
||||
return; |
||||
} |
||||
this.$store.dispatch('setSystemId',this.projectManage.systemId) |
||||
this.projectManage.state = state; |
||||
let tempArr = this.projectJudgmentData.map(i => { |
||||
let obj = { |
||||
projectId: this.projectId ? this.projectId : "", |
||||
judgmentId: i.judgmentId, |
||||
score: i.score |
||||
}; |
||||
return obj; |
||||
}); |
||||
|
||||
let params = { |
||||
projectManage: this.projectManage, |
||||
projectJudgmentList: tempArr |
||||
}; |
||||
|
||||
let { systemId } = this.projectManage; |
||||
if (this.projectId) { |
||||
if (systemId == 2 || systemId == 3) { |
||||
console.log("系统id:", systemId); |
||||
} else { |
||||
// 更新 |
||||
this.updateProject(params); |
||||
} |
||||
} else { |
||||
if (systemId == 2 || systemId == 3) { |
||||
console.log("系统id:", systemId); |
||||
} else { |
||||
// 添加 |
||||
this.addProject(params); |
||||
} |
||||
} |
||||
}, |
||||
updateProject(params) { // 更新项目 |
||||
this.$post(`${this.api.updateProjectManage}`, params).then(res => { |
||||
if (res.status === 200) { |
||||
this.$message.success("更新实验项目成功"); |
||||
this.$router.back(); |
||||
} |
||||
}).catch(err => { |
||||
console.log(err); |
||||
}); |
||||
}, |
||||
addProject(params) { // 添加项目 |
||||
this.$post(`${this.api.addProjectManage}`, params).then(res => { |
||||
if (res.status === 200) { |
||||
this.$message.success("添加实验项目成功"); |
||||
this.$router.back(); |
||||
} |
||||
}).catch(err => { |
||||
console.log(err); |
||||
}); |
||||
}, |
||||
manualDistributionScore() { //点击手动分配分值 |
||||
|
||||
}, |
||||
avgDistributionScore() { |
||||
//点击平均分配分值 |
||||
if (this.projectJudgmentData.length) { |
||||
this.$get(this.api.avgValues, { |
||||
number: this.projectJudgmentData.length |
||||
}).then(res => { |
||||
if (res.status === 200 && res.data) { |
||||
this.projectJudgmentData = this.projectJudgmentData.map((item, index) => { |
||||
item.score = res.data[index]; |
||||
return item; |
||||
}); |
||||
} |
||||
}); |
||||
} |
||||
}, |
||||
handleMoveUp(index) { // 处理上移 |
||||
let x = index; |
||||
let y = index + 1; |
||||
this.projectJudgmentData.splice(x - 1, 1, ...this.projectJudgmentData.splice(y - 1, 1, this.projectJudgmentData[x - 1])); |
||||
}, |
||||
handleMoveDown(index) { // 处理下移 |
||||
let x = index + 1; |
||||
let y = index + 2; |
||||
this.projectJudgmentData.splice(x - 1, 1, ...this.projectJudgmentData.splice(y - 1, 1, this.projectJudgmentData[x - 1])); |
||||
}, |
||||
scoreChange(row, index) { // 暂时解决,输入没有反应 |
||||
this.projectJudgmentData.splice(index, 1, row); |
||||
}, |
||||
delJudgePoint(index) { // 删除判分点 |
||||
this.$confirm("确定要删除吗?", "提示", { |
||||
type: "warning" |
||||
}).then(() => { |
||||
this.projectJudgmentData.splice(index, 1); |
||||
}).catch(() => { |
||||
}); |
||||
}, |
||||
handleSelectionProjectJudgment(val) { |
||||
this.selectedProjectJudgment = val; |
||||
}, |
||||
batchDeleteProjectJudgment() { // 批量删除判分点 |
||||
if (this.selectedProjectJudgment.length) { |
||||
this.$confirm("确定要删除吗?", "提示", { |
||||
type: "warning" |
||||
}).then(() => { |
||||
// this.projectJudgmentData.splice(index, 1); |
||||
let list = this.projectJudgmentData; |
||||
let result = []; |
||||
list.map(i => { |
||||
this.selectedProjectJudgment.find(j => j.judgmentId === i.judgmentId) || result.push(i); |
||||
}); |
||||
this.projectJudgmentData = result; |
||||
}).catch(() => { |
||||
}); |
||||
} else { |
||||
this.$message.warning("请选择判分点"); |
||||
} |
||||
}, |
||||
handleQueryJudgment() { // 查询判分点数据 |
||||
let { systemId } = this.projectManage; |
||||
this.dialogVisible = true; |
||||
this.$nextTick(() => { |
||||
this.$refs.judgementTable.clearSelection(); |
||||
}); |
||||
let params = { |
||||
name: this.judgementpointsquery, |
||||
pageNum: 1, |
||||
pageSize: 10000, |
||||
systemId |
||||
}; |
||||
if (systemId == 2 || systemId == 3) { |
||||
console.log("系统id:", systemId); |
||||
} else if (systemId == 11) { |
||||
// (流程)交易类 |
||||
this.rowKey = "lcId"; |
||||
this.getProcessClassData(params); |
||||
} else { |
||||
// 编程类 |
||||
this.rowKey = "bcId"; |
||||
this.getProgrammingClassData(params); |
||||
} |
||||
}, |
||||
getProcessClassData(params) { // 获取流程类判分点列表数据 |
||||
this.$post(`${this.api.getLcJudgmentPoint}`, params).then(res => { |
||||
if (res.status === 200) { |
||||
let list = res.message.records; |
||||
let result = []; |
||||
list.map(i => { |
||||
i.judgmentId = i.lcId; |
||||
this.projectJudgmentData.find(j => j.judgmentId === i.judgmentId) || result.push(i); |
||||
}); |
||||
this.judgementData = result; |
||||
} |
||||
}).catch(err => { |
||||
console.log(err); |
||||
}); |
||||
}, |
||||
getProgrammingClassData(params) { // 获取编程类判分点列表数据 |
||||
this.$post(this.api.getBcJudgmentPoint, params).then(res => { |
||||
if (res.status === 200) { |
||||
let list = res.message.records; |
||||
let result = []; |
||||
list.map(i => { |
||||
i.judgmentId = i.bcId; |
||||
this.projectJudgmentData.find(j => j.judgmentId === i.judgmentId) || result.push(i); |
||||
}); |
||||
this.judgementData = result; |
||||
} |
||||
|
||||
}).catch(err => { |
||||
console.log(err); |
||||
}); |
||||
}, |
||||
handleSelectionJudgment(val) { // 处理多选判分点 |
||||
this.selectedJudgment = val; |
||||
}, |
||||
addJudgment() { // 确认选择判分点 |
||||
if (this.selectedJudgment.length) { |
||||
this.dialogVisible = false; |
||||
let tempArr = this.selectedJudgment.map(i => { |
||||
i.score = 0; |
||||
return i; |
||||
}); |
||||
this.projectJudgmentData = this.projectJudgmentData.concat(tempArr); |
||||
this.$nextTick(() => { |
||||
this.$refs.projectJudgementTable.clearSelection(); |
||||
}); |
||||
} else { |
||||
this.$message.warning("请选择判分点"); |
||||
} |
||||
}, |
||||
handleCacheData() { // 处理缓存数据 |
||||
this.isToPoint = true; |
||||
this.$store.dispatch('setProject',{ projectManage: this.projectManage, projectJudgmentData: this.projectJudgmentData }); |
||||
}, |
||||
toJudgePoint(type, row) { // 进入判分点系统 |
||||
this.handleCacheData(); |
||||
// let host = this.host; |
||||
let host = "http://192.168.31.154:8087/"; // 本地 |
||||
let { systemId } = this.projectManage; |
||||
let href = ""; |
||||
if (type === "view") { |
||||
// 查看 |
||||
if (systemId == 2) { |
||||
href = `${host}jdTrials/#/programOption?id=${row.judgmentPointsId}`; |
||||
} else if (systemId == 3) { |
||||
href = `${host}jdTrials/#/programOptions?id=${row.judgmentPointsId}`; |
||||
} else if (systemId == 11) { |
||||
// 交易类判分点(银行综合系统) |
||||
href = `${host}jdTrials/#/Transaction?isView=true&systemId=${systemId}&lcId=${row.judgmentId}&token=${this.token}&referrer=${btoa(location.href)}`; |
||||
} else { |
||||
// 编程类判分点(python子系统) |
||||
href = `${host}jdTrials/#/program?isView=true&systemId=${systemId}&bcId=${row.judgmentId}&token=${this.token}&referrer=${btoa(location.href)}`; |
||||
} |
||||
} else if (type === "edit") { |
||||
// 自定义(老师端隐藏此功能) |
||||
if (systemId == 2) { |
||||
href = `${host}jdTrials/#/programOption?id=${row.judgmentPointsId}`; |
||||
} else if (systemId == 3) { |
||||
href = `${host}jdTrials/#/programOptions?id=${row.judgmentPointsId}`; |
||||
} else if (systemId == 11) { |
||||
// 交易类判分点(银行综合系统) |
||||
href = `${host}jdTrials/#/Transaction?isEdit=true&systemId=${systemId}&lcId=${row.judgmentId}&token=${this.token}&referrer=${btoa(location.href)}`; |
||||
} else { |
||||
// 编程类判分点(python子系统) |
||||
href = `${host}jdTrials/#/program?isEdit=true&systemId=${systemId}&bcId=${row.judgmentId}&token=${this.token}&referrer=${btoa(location.href)}`; |
||||
} |
||||
} else if (type === 'home') { |
||||
if (systemId == 2 || systemId == 3) { |
||||
href = `${host}jdTrials/#/list`; |
||||
} else { |
||||
// 进入判分点系统首页(老师端隐藏此功能) |
||||
href = `${host}#/?systemId=${systemId}&token=${this.token}&referrer=${btoa(location.href)}`; |
||||
} |
||||
} |
||||
location.href = href; |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
/deep/ .readonly .ql-toolbar { |
||||
height: 0; |
||||
padding: 0; |
||||
border-bottom: 0; |
||||
} |
||||
</style> |
@ -0,0 +1,372 @@ |
||||
<template> |
||||
<div> |
||||
<el-row :gutter="20"> |
||||
<el-col :span="24"> |
||||
<el-card v-if="showBack" shadow="hover" class="mgb20"> |
||||
<el-page-header content="实验项目管理" @back="goBack"></el-page-header> |
||||
</el-card> |
||||
</el-col> |
||||
|
||||
<el-col :span="24"> |
||||
<el-card shadow="hover" class="mgb20"> |
||||
<div> |
||||
<div class="flex-center mgb20"> |
||||
<p class="hr_tag"></p> |
||||
<span>筛选</span> |
||||
</div> |
||||
</div> |
||||
<div> |
||||
<el-form label-width="80px"> |
||||
<el-col :span="6"> |
||||
<el-form-item label="创建人"> |
||||
<el-select size="small" v-model="queryData.founder" clearable placeholder="请选择创建人" |
||||
@change="initData"> |
||||
<el-option v-for="(item,index) in founderList" :key="index" :label="item.label" |
||||
:value="item.value"></el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="6"> |
||||
<el-form-item label="状态"> |
||||
<el-select size="small" v-model="queryData.state" clearable placeholder="请选择状态" @change="initData"> |
||||
<el-option v-for="(item,index) in stateList" :key="index" :label="item.label" |
||||
:value="item.value"></el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="6"> |
||||
<el-form-item label="权限"> |
||||
<el-select size="small" v-model="queryData.permissions" placeholder="请选择" @change="initData"> |
||||
<el-option |
||||
v-for="item in permissionsList" |
||||
:key="item.value" |
||||
:label="item.label" |
||||
:value="item.value" |
||||
></el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="6"> |
||||
<el-form-item> |
||||
<el-input size="small" placeholder="请输入项目名称" prefix-icon="el-icon-search" v-model="keyword" clearable></el-input> |
||||
</el-form-item> |
||||
</el-col> |
||||
</el-form> |
||||
</div> |
||||
</el-card> |
||||
</el-col> |
||||
|
||||
<el-col :span="24"> |
||||
<el-card shadow="hover" class="mgb20"> |
||||
<div class="flex-between mgb20"> |
||||
<div class="flex-center"> |
||||
<p class="hr_tag"></p> |
||||
<span>项目列表</span> |
||||
</div> |
||||
<div> |
||||
<el-button type="primary" round @click="add" class="mag">新增项目</el-button> |
||||
<el-button type="primary" round @click="delAllData">批量删除</el-button> |
||||
</div> |
||||
</div> |
||||
<el-table :data="listData" class="table" ref="table" stripe header-align="center" |
||||
@selection-change="handleSelectionChange"> |
||||
<el-table-column type="selection" width="55" align="center"></el-table-column> |
||||
<el-table-column type="index" width="100" label="序号" align="center"> |
||||
<template slot-scope="scope">{{ scope.$index + (page - 1) * pageSize + 1 }}</template> |
||||
</el-table-column> |
||||
<el-table-column prop="projectName" label="实验项目名称" align="center"></el-table-column> |
||||
<el-table-column prop="founder" label="创建人" align="center"> |
||||
<template slot-scope="scope"> |
||||
{{ founderKeys[scope.row.founder] }} |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="权限" align="center"> |
||||
<template slot-scope="scope"> |
||||
{{ permissionsKeys[scope.row.permissions] }} |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="createTime" label="创建时间" align="center"></el-table-column> |
||||
<el-table-column prop="status" label="状态" align="center"> |
||||
<template slot-scope="scope"> |
||||
{{ stateKeys[scope.row.state] }} |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="操作"> |
||||
<template slot-scope="scope"> |
||||
<el-button type="text" @click="edit(scope.row)"> |
||||
编辑 |
||||
</el-button> |
||||
<el-button type="text" @click="handleDelete(scope.row.projectId)"> |
||||
删除 |
||||
</el-button> |
||||
<el-button type="text" @click="copyData(scope.row.projectId)">复制</el-button> |
||||
<el-switch |
||||
v-model="scope.row.ztOpen" |
||||
:active-text="scope.row.ztOpen ? '关闭' : '启用'" |
||||
:active-value="0" |
||||
:inactive-value="1" |
||||
style="margin: 0 10px 0 10px" |
||||
@change="switchOff(scope.row)" |
||||
></el-switch> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<div class="pagination"> |
||||
<el-pagination background @current-change="handleCurrentChange" :current-page="page" layout="total, prev, pager, next" :total="total"></el-pagination> |
||||
</div> |
||||
</el-card> |
||||
</el-col> |
||||
</el-row> |
||||
|
||||
<!--复制对话框--> |
||||
<el-dialog title="复制" :visible.sync="copyVisible" width="24%" center :close-on-click-modal="false"> |
||||
<el-form> |
||||
<el-form-item> |
||||
<!--前端不用做名称判重了:@change='projectNameExistis'--> |
||||
<el-input placeholder="请输入项目名称" v-model="projectName"></el-input> |
||||
</el-form-item> |
||||
</el-form> |
||||
<span slot="footer" class="dialog-footer"> |
||||
<el-button @click="copyVisible = false">取 消</el-button> |
||||
<el-button type="primary" @click="copySubmit">确 定</el-button> |
||||
</span> |
||||
</el-dialog> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import { mapState, mapActions } from 'vuex'; |
||||
|
||||
export default { |
||||
data() { |
||||
return { |
||||
showBack: Boolean(this.$route.query.show), |
||||
systemId: this.$route.query.systemId, |
||||
queryData: { |
||||
platformId: 3, // 平台:职站:1 中台:3 |
||||
founder: 0, // 创建人角色(0:系统 1:老师) |
||||
state: "", // 状态(0:草稿箱 1:已发布) |
||||
permissions: "", // 项目权限(0:练习 1:考核 2:竞赛) |
||||
}, |
||||
keyword: '', |
||||
status: '', |
||||
listData: [], |
||||
total: 0, |
||||
permissionsList: [ |
||||
{ |
||||
value: '', |
||||
label: '不限' |
||||
}, |
||||
{ |
||||
value: 0, |
||||
label: '练习' |
||||
}, |
||||
{ |
||||
value: 1, |
||||
label: '考核' |
||||
}, |
||||
{ |
||||
value: 2, |
||||
label: '竞赛' |
||||
} |
||||
], |
||||
permissionsKeys: { |
||||
0: '练习', |
||||
1: '考核', |
||||
2: '竞赛' |
||||
}, |
||||
founderList: [ |
||||
{ |
||||
value: 0, |
||||
label: '系统' |
||||
}, |
||||
{ |
||||
value: 1, |
||||
label: '老师' |
||||
} |
||||
], |
||||
founderKeys: { |
||||
0: '系统', |
||||
1: '老师' |
||||
}, |
||||
stateList: [ |
||||
{ |
||||
value: '', |
||||
label: '不限' |
||||
}, |
||||
{ |
||||
value: 0, |
||||
label: '草稿箱' |
||||
}, |
||||
{ |
||||
value: 1, |
||||
label: '已发布' |
||||
} |
||||
], |
||||
stateKeys: { |
||||
0: '草稿箱', |
||||
1: '已发布' |
||||
}, |
||||
page: 1, |
||||
pageSize: 10, |
||||
multipleSelection: [], |
||||
copyVisible: false, |
||||
projectName: '', |
||||
currentRow: {}, // 复制之后,提交到后台的数据 |
||||
listDataAll: [] |
||||
}; |
||||
}, |
||||
watch: { |
||||
keyword: function(val) { |
||||
clearTimeout(this.searchTimer); |
||||
this.searchTimer = setTimeout(() => { |
||||
this.initData(); |
||||
}, 500); |
||||
} |
||||
}, |
||||
mounted() { |
||||
this.getData(); |
||||
}, |
||||
methods: { |
||||
getData() { |
||||
let data = { |
||||
...this.queryData, |
||||
projectName: this.keyword, |
||||
pageNum: this.page, |
||||
pageSize: this.pageSize, |
||||
systemId: this.systemId |
||||
}; |
||||
this.$post(this.api.queryProjectManage, data).then(res => { |
||||
let { status, data } = res; |
||||
if (status === 200 && data) { |
||||
this.listData = data.records; |
||||
this.total = data.total; |
||||
} |
||||
}).catch(err => { |
||||
console.log(err); |
||||
}); |
||||
}, |
||||
initData() { |
||||
this.page = 1; |
||||
this.getData(); |
||||
}, |
||||
handleCurrentChange(val) { // 切换页码 |
||||
this.page = val; |
||||
this.getData(); |
||||
}, |
||||
add() { // 新增项目 |
||||
this.$router.push(`/projectAdd?systemId=${this.systemId}`); |
||||
}, |
||||
edit(row) { // 编辑 |
||||
this.$router.push(`/projectAdd?systemId=${this.systemId}&projectId=${row.projectId}`); |
||||
}, |
||||
handleSelectionChange(val) { // 处理多选 |
||||
this.multipleSelection = val; |
||||
}, |
||||
delAllData() { // 批量删除 |
||||
if (this.multipleSelection.length) { |
||||
let ids = this.multipleSelection.map(item => { |
||||
return item.projectId |
||||
}); |
||||
let strIds = ids.toString(); |
||||
this.handleDelete(strIds); |
||||
} else { |
||||
this.$message.error("请先选择项目"); |
||||
} |
||||
}, |
||||
handleDelete(ids) { // 删除 |
||||
this.$confirm('确定要删除吗?', '提示', { |
||||
type: 'warning' |
||||
}).then(() => { |
||||
this.$post(`${this.api.deleteProjectManage}?projectIds=${ids}&platformId=${this.queryData.platformId}`).then(res => { |
||||
if (res.status === 200) { |
||||
this.$message.success("删除成功"); |
||||
this.getData(); |
||||
} else { |
||||
this.$message.error(res.message); |
||||
} |
||||
}).catch(err => { |
||||
console.log(err); |
||||
}); |
||||
}).catch(() => { |
||||
this.$message.info('已取消删除'); |
||||
}); |
||||
}, |
||||
switchOff(row) { // 更新是否启用 |
||||
this.$get(`${this.api.updateIsOpen}?isOpen=${row.ztOpen}&projectId=${row.projectId}&platformId=${this.queryData.platformId}`).then(res => { |
||||
if (res.status === 200) { |
||||
this.$message.success('更新启用状态成功'); |
||||
this.getData(); |
||||
} else { |
||||
this.$message.error(res.message); |
||||
} |
||||
}).catch(err => { |
||||
console.log(err); |
||||
}); |
||||
}, |
||||
projectNameExistis() { // 项目管理名称判重 |
||||
if (this.projectName) { |
||||
this.$post(this.api.queryNameIsExist, { projectName: this.projectName }).then(res => { |
||||
if (res.status === 200) { |
||||
this.projectNameRepeat = false; |
||||
} else { |
||||
this.projectNameRepeat = true; |
||||
} |
||||
}).catch(err => { |
||||
this.projectNameRepeat = true; |
||||
}); |
||||
} else { |
||||
this.projectNameRepeat = false; |
||||
} |
||||
}, |
||||
copyData(projectId) { // 复制,根据项目id查询详情 |
||||
this.copyVisible = true; |
||||
this.$get(`${this.api.getProjectDetail}?projectId=${projectId}`).then(res => { |
||||
if (res.status === 200) { |
||||
this.projectName = res.projectManage.projectName; |
||||
this.currentRow = { |
||||
projectManage: res.projectManage, |
||||
projectJudgmentList: res.projectJudgmentVos |
||||
} |
||||
} |
||||
}).catch(err => { |
||||
console.log(err); |
||||
}); |
||||
}, |
||||
copySubmit() { |
||||
if (!this.projectName) { |
||||
this.$message.warning("请输入项目名称"); |
||||
return; |
||||
} |
||||
; |
||||
if (this.projectNameRepeat) { |
||||
this.$message.warning("该项目名称已存在"); |
||||
return; |
||||
} |
||||
this.currentRow.projectManage.projectName = this.projectName; |
||||
this.currentRow.projectManage.projectId = ""; |
||||
this.currentRow.projectJudgmentList.forEach(i => { |
||||
i.projectId = ""; |
||||
}); |
||||
this.$post(`${this.api.copyProjectManage}`, this.currentRow).then(res => { |
||||
if (res.status === 200) { |
||||
this.initData(); |
||||
this.$message.success("复制实验项目成功"); |
||||
this.copyVisible = false; |
||||
} else { |
||||
this.$message.error(res.message); |
||||
} |
||||
}).catch(err => { |
||||
console.log(err); |
||||
}); |
||||
}, |
||||
goBack() { // 返回 |
||||
this.$router.back(); |
||||
} |
||||
} |
||||
}; |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
|
||||
</style> |
Loading…
Reference in new issue