教师端职站实验项目管理功能完成

dev_2022-05-11
e 3 years ago
parent 711829036a
commit 4a10986a2f
  1. 6
      package-lock.json
  2. 1
      package.json
  3. 11
      src/api/index.js
  4. 284
      src/pages/project/add/index.vue

6
package-lock.json generated

@ -11394,9 +11394,9 @@
} }
}, },
"sortablejs": { "sortablejs": {
"version": "1.10.1", "version": "1.14.0",
"resolved": "https://registry.npmjs.org/sortablejs/-/sortablejs-1.10.1.tgz", "resolved": "https://registry.nlark.com/sortablejs/download/sortablejs-1.14.0.tgz",
"integrity": "sha512-N6r7GrVmO8RW1rn0cTdvK3JR0BcqecAJ0PmYMCL3ZuqTH3pY+9QyqkmJSkkLyyDvd+AJnwaxTP22Ybr/83V9hQ==" "integrity": "sha1-bS4XzL2yX0ZHNN9iHU811Ks1s9g="
}, },
"source-list-map": { "source-list-map": {
"version": "2.0.1", "version": "2.0.1",

@ -17,6 +17,7 @@
"mavon-editor": "^2.6.17", "mavon-editor": "^2.6.17",
"postcss-px2rem": "^0.3.0", "postcss-px2rem": "^0.3.0",
"px2rem-loader": "^0.1.9", "px2rem-loader": "^0.1.9",
"sortablejs": "^1.14.0",
"vue": "^2.6.10", "vue": "^2.6.10",
"vue-cropperjs": "^3.0.0", "vue-cropperjs": "^3.0.0",
"vue-i18n": "^8.10.0", "vue-i18n": "^8.10.0",

@ -1,7 +1,7 @@
import Setting from "@/setting"; import Setting from "@/setting";
// let host = Setting.apiBaseURL // let host = Setting.apiBaseURL
let host = "http://192.168.31.151:9000/"; // 榕 // let host = "http://192.168.31.151:9000/"; // 榕
// let host = 'http://192.168.31.125:9000/'; // 坤 let host = 'http://192.168.31.125:9000/'; // 坤
let xsHost = "http://39.108.250.202:9000/"; // 线上 let xsHost = "http://39.108.250.202:9000/"; // 线上
@ -84,10 +84,17 @@ export default {
addProjectManage: `${host}occupationlab/projectManage/addProjectManage`, // 新增项目管理 addProjectManage: `${host}occupationlab/projectManage/addProjectManage`, // 新增项目管理
updateProjectManage: `${host}occupationlab/projectManage/updateProjectManage`, // 修改项目管理 updateProjectManage: `${host}occupationlab/projectManage/updateProjectManage`, // 修改项目管理
copyProjectManage: `${host}occupationlab/projectManage/copyProjectManage`, // 复制项目管理 copyProjectManage: `${host}occupationlab/projectManage/copyProjectManage`, // 复制项目管理
// 判分点 // 判分点
getBcJudgmentPoint: `${host}judgment/bcJudgmentPoint/getBcJudgmentPoint`, // 获取编程类判分点列表(分页) getBcJudgmentPoint: `${host}judgment/bcJudgmentPoint/getBcJudgmentPoint`, // 获取编程类判分点列表(分页)
getLcJudgmentPoint: `${host}judgment/lcJudgmentPoint/queryAllJudgmentPoint`, // 获取流程类判分点列表(分页) getLcJudgmentPoint: `${host}judgment/lcJudgmentPoint/queryAllJudgmentPoint`, // 获取流程类判分点列表(分页)
addProjectJudgment: `${host}occupationlab/projectJudgment/addProjectJudgment`, // 添加项目管理、判分点中间表
updateProjectJudgment: `${host}occupationlab/projectJudgment/updateProjectJudgment`, // 判分点中间表批量更新
deleteProjectJudgment: `${host}occupationlab/projectJudgment/deleteProjectJudgment`, // 判分点中间表批量删除
// 赛事管理 // 赛事管理
addContest: `${host}occupationlab/enterprise/match/contest/addContest`, addContest: `${host}occupationlab/enterprise/match/contest/addContest`,

@ -75,7 +75,6 @@
<div class="m-r-20" style="color: #f00">项目总分值100</div> <div class="m-r-20" style="color: #f00">项目总分值100</div>
<!-- <div>权重&emsp;<div class="dib"><el-input></el-input></div></div> --> <!-- <div>权重&emsp;<div class="dib"><el-input></el-input></div></div> -->
</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="avgDistributionScore">平均分配分值</el-button>
<el-button :disabled="isDetail" class="m-r-20" type="text" @click="manualDistributionScore">手动分配分值</el-button> <el-button :disabled="isDetail" class="m-r-20" type="text" @click="manualDistributionScore">手动分配分值</el-button>
@ -84,61 +83,43 @@
</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-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-button :disabled="isDetail" type="primary" icon="el-icon-delete" round @click="batchDeleteProjectJudgment" style="margin-bottom: 10px">批量删除</el-button>
<el-table <div class="draggable" style="padding: 20px">
ref="projectJudgementTable" <el-table
:data="projectJudgmentData" ref="projectJudgementTable"
class="table" :data="projectJudgmentData"
stripe class="table"
header-align="center" stripe
@selection-change="handleSelectionProjectJudgment" header-align="center"
row-key="judgmentId" @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"> <el-table-column type="selection" width="55" align="center"></el-table-column>
<template slot-scope="scope"> <el-table-column prop="sort" label="序号" width="80" align="center">
{{ scope.$index + 1 }} <template slot-scope="scope">
</template> {{scope.row.sort}}
</el-table-column> </template>
<el-table-column prop="name" label="判分指标" align="center"></el-table-column> </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"> <el-table-column prop="name" label="判分点名称" align="center"></el-table-column>
<template slot-scope="scope"> <el-table-column label="实验要求" align="center">
<el-button <template slot-scope="scope">
:disabled="isDetail" <quill :border="true" :readonly="true" elseRead="true" v-model="scope.row.experimentalRequirements" :minHeight="150" :height="150" />
v-show="scope.$index > 0" </template>
type="text" </el-table-column>
icon="el-icon-top" <el-table-column label="操作" width="140" align="center">
@click="handleMoveUp(scope.$index)" <template slot-scope="scope">
style="font-size: 24px" <!--<el-button :disabled="isDetail" type="text" style="margin-right: 10px" @click="toJudgePoint('edit', scope.row)">自定义</el-button>-->
></el-button> <el-button :disabled="isDetail" type="text" @click="delJudgePoint(scope.$index)">删除</el-button>
<el-button </template>
:disabled="isDetail" </el-table-column>
v-show="(scope.$index+1) < projectJudgmentData.length" <el-table-column prop="score" label="分数" align="center">
type="text" <template slot-scope="scope">
icon="el-icon-bottom" <!--type="number"-->
@click="handleMoveDown(scope.$index)" <el-input :disabled="isDetail" v-model.trim="scope.row.score" @input="scoreChange(scope.row, scope.$index,$event)"></el-input>
style="font-size: 24px" </template>
></el-button> </el-table-column>
</template> </el-table>
</el-table-column> </div>
<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>
<el-card shadow="hover" class="m-b-20"> <el-card shadow="hover" class="m-b-20">
@ -160,13 +141,12 @@
</el-form> </el-form>
<!--选择判分点对话框--> <!--选择判分点对话框-->
<el-dialog title="添加判分点" :visible.sync="dialogVisible" width="40%" :close-on-click-modal="false"> <el-dialog title="添加判分点" v-loading="visibleLoading" :visible.sync="dialogVisible" width="40%" :close-on-click-modal="false">
<div class="text-right m-b-10"> <div class="text-right m-b-10">
<div> <div>
<el-input placeholder="请输入需要查找的判分点" prefix-icon="el-icon-search" v-model.trim="judgementpointsquery" clearable></el-input> <el-input placeholder="请输入需要查找的判分点" prefix-icon="el-icon-search" v-model.trim="judgementpointsquery" clearable></el-input>
</div> </div>
</div> </div>
<el-table <el-table
:data="judgementData" :data="judgementData"
ref="judgementTable" ref="judgementTable"
@ -203,7 +183,7 @@ import Setting from "@/setting";
import util from "@/libs/util"; import util from "@/libs/util";
import { mapState, mapActions } from "vuex"; import { mapState, mapActions } from "vuex";
import quill from "@/components/quill"; import quill from "@/components/quill";
import Sortable from 'sortablejs';
export default { export default {
components: { components: {
quill quill
@ -244,7 +224,8 @@ export default {
avgValuelist: [], // avgValuelist: [], //
searchTimer: null, searchTimer: null,
isToPoint: false // isToPoint: false, //
visibleLoading:false,//
}; };
}, },
computed: { computed: {
@ -295,6 +276,7 @@ export default {
this.projectManage = projectManage; this.projectManage = projectManage;
this.projectJudgmentData = projectJudgmentData; this.projectJudgmentData = projectJudgmentData;
} }
this.rowDrop()
}, },
beforeDestroy() { beforeDestroy() {
if (!this.isToPoint) { if (!this.isToPoint) {
@ -323,6 +305,9 @@ export default {
let { projectManage, projectJudgmentVos } = res; let { projectManage, projectJudgmentVos } = res;
this.projectManage = projectManage; this.projectManage = projectManage;
this.projectJudgmentData = projectJudgmentVos; this.projectJudgmentData = projectJudgmentVos;
this.projectJudgmentData.forEach((e,i)=>{
e.sort = i+1
})
} else { } else {
util.warningMsg(res.message); util.warningMsg(res.message);
} }
@ -410,7 +395,8 @@ export default {
let obj = { let obj = {
projectId: this.projectId ? this.projectId : "", projectId: this.projectId ? this.projectId : "",
judgmentId: i.judgmentId, judgmentId: i.judgmentId,
score: i.score score: i.score,
sort:i.sort
}; };
return obj; return obj;
}); });
@ -475,24 +461,28 @@ export default {
}); });
} }
}, },
handleMoveUp(index) { // // handleMoveUp(index) { //
let x = index; // let x = index;
let y = index + 1; // let y = index + 1;
this.projectJudgmentData.splice(x - 1, 1, ...this.projectJudgmentData.splice(y - 1, 1, this.projectJudgmentData[x - 1])); // this.projectJudgmentData.splice(x - 1, 1, ...this.projectJudgmentData.splice(y - 1, 1, this.projectJudgmentData[x - 1]));
}, // },
handleMoveDown(index) { // // handleMoveDown(index) { //
let x = index + 1; // let x = index + 1;
let y = index + 2; // let y = index + 2;
this.projectJudgmentData.splice(x - 1, 1, ...this.projectJudgmentData.splice(y - 1, 1, this.projectJudgmentData[x - 1])); // this.projectJudgmentData.splice(x - 1, 1, ...this.projectJudgmentData.splice(y - 1, 1, this.projectJudgmentData[x - 1]));
}, // },
scoreChange(row, index) { // scoreChange(row, index,val) { //
this.projectJudgmentData.splice(index, 1, row); this.projectJudgmentData.splice(index, 1, row);
}, },
delJudgePoint(index) { // delJudgePoint(index) { //
this.$confirm("确定要删除吗?", "提示", { this.$confirm("确定要删除吗?", "提示", {
type: "warning" type: "warning"
}).then(() => { }).then(() => {
this.projectJudgmentData.splice(index, 1); if(this.projectId){
this.deleteProjectJudgment([this.projectJudgmentData[index].id])
}else{
this.projectJudgmentData.splice(index, 1);
}
}).catch(() => { }).catch(() => {
}); });
}, },
@ -505,12 +495,17 @@ export default {
type: "warning" type: "warning"
}).then(() => { }).then(() => {
// this.projectJudgmentData.splice(index, 1); // this.projectJudgmentData.splice(index, 1);
let list = this.projectJudgmentData; if(this.projectId){//
let result = []; let param = this.selectedProjectJudgment.map(e=>e.id)
list.map(i => { this.deleteProjectJudgment(param)//
this.selectedProjectJudgment.find(j => j.judgmentId === i.judgmentId) || result.push(i); }else{
}); let list = this.projectJudgmentData;
this.projectJudgmentData = result; let result = [];
list.map(i => {
this.selectedProjectJudgment.find(j => j.judgmentId === i.judgmentId) || result.push(i);
});
this.projectJudgmentData = result;
}
}).catch(() => { }).catch(() => {
}); });
} else { } else {
@ -542,6 +537,7 @@ export default {
} }
}, },
getProcessClassData(params) { // getProcessClassData(params) { //
this.visibleLoading = true
this.$post(`${this.api.getLcJudgmentPoint}`, params).then(res => { this.$post(`${this.api.getLcJudgmentPoint}`, params).then(res => {
if (res.status === 200) { if (res.status === 200) {
let list = res.message.records; let list = res.message.records;
@ -550,6 +546,7 @@ export default {
i.judgmentId = i.lcId; i.judgmentId = i.lcId;
this.projectJudgmentData.find(j => j.judgmentId === i.judgmentId) || result.push(i); this.projectJudgmentData.find(j => j.judgmentId === i.judgmentId) || result.push(i);
}); });
this.visibleLoading = false
this.judgementData = result; this.judgementData = result;
} }
}).catch(err => { }).catch(err => {
@ -557,6 +554,7 @@ export default {
}); });
}, },
getProgrammingClassData(params) { // getProgrammingClassData(params) { //
this.visibleLoading = true
this.$post(this.api.getBcJudgmentPoint, params).then(res => { this.$post(this.api.getBcJudgmentPoint, params).then(res => {
if (res.status === 200) { if (res.status === 200) {
let list = res.message.records; let list = res.message.records;
@ -565,7 +563,10 @@ export default {
i.judgmentId = i.bcId; i.judgmentId = i.bcId;
this.projectJudgmentData.find(j => j.judgmentId === i.judgmentId) || result.push(i); this.projectJudgmentData.find(j => j.judgmentId === i.judgmentId) || result.push(i);
}); });
this.visibleLoading = false
this.judgementData = result; this.judgementData = result;
console.log(res,'res')
console.log(this.projectJudgmentData,'projectJudgmentData')
} }
}).catch(err => { }).catch(err => {
@ -577,15 +578,24 @@ export default {
}, },
addJudgment() { // addJudgment() { //
if (this.selectedJudgment.length) { if (this.selectedJudgment.length) {
console.log(this.selectedJudgment,'queren')
this.dialogVisible = false; this.dialogVisible = false;
let tempArr = this.selectedJudgment.map(i => { if(this.projectId){ //
i.score = 0; this.addProjectJudgment()
return i; }else{
}); //
this.projectJudgmentData = this.projectJudgmentData.concat(tempArr); let tempArr = this.selectedJudgment.map(i => {
this.$nextTick(() => { i.score = 0;
this.$refs.projectJudgementTable.clearSelection(); return i;
}); });
this.projectJudgmentData = this.projectJudgmentData.concat(tempArr);
this.projectJudgmentData.map((e,i)=>{
e.sort = i+1
})
this.$nextTick(() => {
this.$refs.projectJudgementTable.clearSelection();
});
}
} else { } else {
util.warningMsg("请选择判分点"); util.warningMsg("请选择判分点");
} }
@ -635,7 +645,105 @@ export default {
} }
} }
location.href = href; location.href = href;
} },
//
rowDrop() {
//
const tbody = document.querySelector('.draggable .el-table__body-wrapper tbody');
const _this = this;
Sortable.create(tbody, {
//
draggable: ".draggable .el-table__row",
onEnd({newIndex, oldIndex}) {
let newItem = _this.projectJudgmentData[newIndex]
_this.projectJudgmentData[newIndex] = _this.projectJudgmentData[oldIndex]
_this.projectJudgmentData[oldIndex] = newItem
//
_this.projectJudgmentData.forEach((e,i)=>{
_this.$set(e,'sort',i+1)//
_this.$set(e,'name',e.name+"?")
_this.$set(e,'name',e.name.slice(0,e.name.length-1)) //
})
//
if(_this.projectId){//
_this.updateProjectJudgment()
}
}
});
},
//
addProjectJudgment(){
let param = this.selectedJudgment.map((e,i)=>{
let obj = {
judgmentId:e.judgmentId,
projectId:this.projectId||'',
score:0,
sort:i+1
}
return obj
})
console.log(param,'param',this.projectId,)
this.$post(this.api.addProjectJudgment,param).then(res => {
//
console.log('添加成功',res)
if(this.projectId){ // idid
this.listAgain()
}
}).catch(err => {
console.log(err);
});
},
//
updateProjectJudgment(){
// data
let param = this.projectJudgmentData.map((e,i)=>{
let obj = {
judgmentId:e.judgmentId,
projectId:this.projectId||'',
score:0,
sort:i+1,
id:e.id
}
return obj
})
this.$post(this.api.updateProjectJudgment, param).then(res => {
//
if(this.projectId){ // idid
this.listAgain()
}
}).catch(err => {
console.log(err);
});
},
//
deleteProjectJudgment(values){
if(values&&values.length>0){
this.$post(this.api.deleteProjectJudgment+"?projectJudgmentIds="+`${values}`).then(res => {
//
if(this.projectId){ // idid
this.listAgain()
}
}).catch(err => {
});
}
},
// ,
listAgain(){
this.$get(`${this.api.getProjectDetail}?projectId=${this.projectId}`).then(res => {
let { projectManage, projectJudgmentVos } = res;
this.projectJudgmentData = projectJudgmentVos;
this.projectJudgmentData.map((e,i)=>{
e.sort = i+1
})
})
},
} }
}; };
</script> </script>

Loading…
Cancel
Save