|
|
|
@ -143,9 +143,8 @@ |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="score" label="分数" align="center" width="120"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<!--type="number"--> |
|
|
|
|
<!--type="number" @blur="updateProjectJudgment"--> |
|
|
|
|
<el-input :disabled="isDetail" v-model.trim="scope.row.score" |
|
|
|
|
@blur="updateProjectJudgment" |
|
|
|
|
@input="scoreChange(scope.row, scope.$index,$event)"></el-input> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
@ -429,6 +428,19 @@ export default { |
|
|
|
|
} |
|
|
|
|
this.$store.dispatch("setSystemId", this.projectManage.systemId); |
|
|
|
|
this.projectManage.state = state; |
|
|
|
|
let { systemId } = this.projectManage; |
|
|
|
|
if (this.projectId) { |
|
|
|
|
if (systemId == 2 || systemId == 3) { |
|
|
|
|
console.log("系统id:", systemId); |
|
|
|
|
} else { |
|
|
|
|
// 先走更新判分点中间表接口,再走更新项目接口 |
|
|
|
|
this.updateProjectJudgment(); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
if (systemId == 2 || systemId == 3) { |
|
|
|
|
console.log("系统id:", systemId); |
|
|
|
|
} else { |
|
|
|
|
// 添加 |
|
|
|
|
let tempArr = this.projectJudgmentData.map(i => { |
|
|
|
|
let obj = { |
|
|
|
|
projectId: this.projectId ? this.projectId : "", |
|
|
|
@ -443,20 +455,6 @@ export default { |
|
|
|
|
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); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -495,6 +493,7 @@ export default { |
|
|
|
|
item.score = res.data[index]; |
|
|
|
|
return item; |
|
|
|
|
}); |
|
|
|
|
// this.updateProjectJudgment(); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
@ -613,10 +612,6 @@ export default { |
|
|
|
|
if (this.selectedJudgment.length) { |
|
|
|
|
this.judgementpointsquery = ""; |
|
|
|
|
this.dialogVisible = false; |
|
|
|
|
if (this.projectId) { // 编辑的时候,新增调接口 |
|
|
|
|
this.addProjectJudgment(); |
|
|
|
|
} else { |
|
|
|
|
// 新增时,假添加 |
|
|
|
|
let tempArr = this.selectedJudgment.map(i => { |
|
|
|
|
i.score = 0; |
|
|
|
|
return i; |
|
|
|
@ -628,7 +623,6 @@ export default { |
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
this.$refs.projectJudgementTable.clearSelection(); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
this.$message.warning("请选择判分点"); |
|
|
|
|
} |
|
|
|
@ -642,48 +636,23 @@ export default { |
|
|
|
|
// 指定父元素下可被拖拽的子元素 |
|
|
|
|
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) => { |
|
|
|
|
// 解决拖拽数据不变化的问题:在改变了数据之后 先用一个变量深拷贝这个数据,然后把这个数据清空,最后再在vue的$nextTick函数里面重新给那个数据赋值 |
|
|
|
|
_this.projectJudgmentData.splice(newIndex, 0, _this.projectJudgmentData.splice(oldIndex, 1)[0]); |
|
|
|
|
let newArray = _this.projectJudgmentData.slice(0); |
|
|
|
|
_this.projectJudgmentData = []; |
|
|
|
|
_this.$nextTick(function () { |
|
|
|
|
newArray.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(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
_this.projectJudgmentData = newArray; |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
// 添加判分点中间表 |
|
|
|
|
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) { // 有项目id,调接口,没有项目id,手动更新 |
|
|
|
|
this.listAgain(); |
|
|
|
|
} |
|
|
|
|
}).catch(err => { |
|
|
|
|
console.log(err); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
// 修改判分点中间表 |
|
|
|
|
updateProjectJudgment() { |
|
|
|
|
// 直接传data回去 |
|
|
|
|
async updateProjectJudgment() { |
|
|
|
|
let param = this.projectJudgmentData.map((e, i) => { |
|
|
|
|
let obj = { |
|
|
|
|
judgmentId: e.judgmentId, |
|
|
|
@ -694,48 +663,24 @@ export default { |
|
|
|
|
}; |
|
|
|
|
return obj; |
|
|
|
|
}); |
|
|
|
|
this.$post(this.api.updateProjectJudgment, param).then(res => { |
|
|
|
|
|
|
|
|
|
// 重新调接口 |
|
|
|
|
if (this.projectId) { // 有项目id,调接口,没有项目id,手动更新 |
|
|
|
|
this.listAgain(); |
|
|
|
|
} |
|
|
|
|
}).catch(err => { |
|
|
|
|
console.log(err); |
|
|
|
|
await this.$post(`${this.api.updateProjectJudgment}?projectId=${this.projectId}`, param).then(res => { |
|
|
|
|
let tempArr = this.projectJudgmentData.map(i => { |
|
|
|
|
let obj = { |
|
|
|
|
projectId: this.projectId ? this.projectId : "", |
|
|
|
|
judgmentId: i.judgmentId, |
|
|
|
|
score: i.score, |
|
|
|
|
sort: i.sort |
|
|
|
|
}; |
|
|
|
|
return obj; |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
// 批量删除判分点中间表 |
|
|
|
|
deleteProjectJudgment(values) { |
|
|
|
|
if (values && values.length > 0) { |
|
|
|
|
this.$post(this.api.deleteProjectJudgment + "?projectJudgmentIds=" + `${values}`).then(res => { |
|
|
|
|
|
|
|
|
|
// 重新调接口 |
|
|
|
|
if (this.projectId) { // 有项目id,调接口,没有项目id,手动更新 |
|
|
|
|
this.listAgain(); |
|
|
|
|
} |
|
|
|
|
let params = { |
|
|
|
|
projectManage: this.projectManage, |
|
|
|
|
projectJudgmentList: tempArr |
|
|
|
|
}; |
|
|
|
|
this.updateProject(params); |
|
|
|
|
}).catch(err => { |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 重新调接口,专门赋值列表 |
|
|
|
|
listAgain() { |
|
|
|
|
this.listLoading = true |
|
|
|
|
let scrollTop = this.$refs.main.scrollTop |
|
|
|
|
this.projectJudgmentData = [] |
|
|
|
|
this.$refs.main.scrollTop = scrollTop |
|
|
|
|
this.$get(`${this.api.getProjectDetail}?projectId=${this.projectId}`).then(res => { |
|
|
|
|
let { projectManage, projectJudgmentVos } = res; |
|
|
|
|
projectJudgmentVos.map((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)) // 不更新的解决方案 |
|
|
|
|
console.log(err); |
|
|
|
|
}); |
|
|
|
|
this.projectJudgmentData = projectJudgmentVos; |
|
|
|
|
this.listLoading = false |
|
|
|
|
}).catch(()=>{ |
|
|
|
|
this.listLoading = false |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
handleCacheData() { // 处理缓存数据 |
|
|
|
|
this.isToPoint = true; |
|
|
|
|