You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1075 lines
46 KiB

4 years ago
<template>
<div>
<el-form :disabled="isDetail">
<el-card shadow="hover" class="m-b-20">
<div class="flex-between">
<el-page-header @back="goBack" content="项目配置"></el-page-header>
<div>
<template v-if="!isDetail">
<template v-if="!id">
<el-button type="success" size="small" @click="saveAsDraft">保存为草稿</el-button>
<el-button type="primary" size="small" @click="insertProjectManagement">确定并发布</el-button>
</template>
<template v-else>
<el-button type="primary" size="small" @click="insertProjectManagement">确定并发布</el-button>
</template>
</template>
</div>
</div>
</el-card>
<el-card shadow="hover" class="m-b-20">
<h6 class="p-title">基本信息</h6>
<div>
<el-form label-width="80px">
<div class="flex">
<el-form-item label="项目名称">
<el-input :disabled="isDetail" v-model="projectName" placeholder="20个字符以内" @change="projectNameExistis"></el-input>
</el-form-item>
<el-form-item label="项目权限">
<el-select :disabled="isDetail" v-model="projectPermission" placeholder="请选择">
<el-option
v-for="item in projectPermissions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="系统">
<el-select v-model="systemId" placeholder="请选择" @change="systemChange">
<el-option
v-for="item in systemList"
:key="item.value"
:label="item.label"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
</div>
</el-form>
</div>
</el-card>
<el-card shadow="hover" class="m-b-20">
<h6 class="p-title">实验目标</h6>
<div>
<el-form label-width="0">
<el-form-item>
<quill :border="true" :readonly="isDetail" v-model="experimentalGoal" :minHeight="150" :height="150" />
</el-form-item>
</el-form>
</div>
</el-card>
<el-card shadow="hover" class="m-b-20">
<h6 class="p-title">案例描述</h6>
<div>
<el-form label-width="0">
<el-form-item>
<quill :border="true" :readonly="isDetail" v-model="caseDescription" :minHeight="150" :height="150" />
</el-form-item>
</el-form>
</div>
</el-card>
<el-card shadow="hover" class="m-b-20">
<div class="m-b-20 flex-between">
<h6 class="p-title" style="margin-bottom: 0">实验任务</h6>
<div>
<el-button type="primary" size="small" @click="toJudgePoint(0)">进入判分点</el-button>
</div>
</div>
<div class="m-b-20 flex-between">
<div class="flex-center">
<div class="m-r-20" style="color: #f00">项目总分值100</div>
<!-- <div>权重&emsp;<div class="dib"><el-input></el-input></div></div> -->
</div>
<div>
<el-button class="m-r-20" type="text" @click="avgDistributionScore">平均分配分值</el-button>
<el-button class="m-r-20" type="text" @click="manualDistributionScore">手动分配分值</el-button>
<span>(待分配分值: {{handDistributionScore}}/100)</span>
</div>
</div>
<el-button type="primary" icon="el-icon-plus" round size="small" @click="dialog1" style="margin-bottom: 10px">判分点</el-button>
<el-table :data="experimentData" class="table" stripe :span-method="SpanMethod" header-align="center">
<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="judgmentPointsName" label="判分指标" align="center">
</el-table-column>
<el-table-column prop="judgmentPointsName" label="判分点名称" align="center">
</el-table-column>
<el-table-column label="实验要求" align="center">
<template slot-scope="scope">
4 years ago
<quill :border="true" :readonly="true" elseRead="true" v-model="scope.row.experimentalRequirements" :minHeight="150" :height="150" />
4 years ago
</template>
</el-table-column>
<el-table-column label="操作" width="140" align="center">
<template slot-scope="scope">
<el-link type="primary" style="margin-right: 10px" @click="toJudgePoint(scope.row)">自定义</el-link>
<el-link type="primary" @click="delJudgePoint(scope.$index)">删除</el-link>
</template>
</el-table-column>
<el-table-column label="分数" align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.score"></el-input>
</template>
</el-table-column>
</el-table>
</el-card>
<el-card shadow="hover" class="m-b-20" v-if="!isHh">
<div class="m-b-20 flex-between">
<h6 class="p-title" style="margin-bottom: 0">实验数据</h6>
<div>
<el-button type="primary" size="small" style="margin-right: 20px" @click="dialogVisible = true">新增案例数据对象</el-button>
启用 <el-switch v-model="flag01" @click="flag01_switch()"></el-switch>
</div>
</div>
<el-table :data="experimentalData" class="table" stripe :span-method="SpanMethod" header-align="center">
<el-table-column prop="id" label="序号" align="center">
<template slot-scope="scope">
{{scope.$index+1}}
</template>
</el-table-column>
<el-table-column prop="roleType" label="角色类型" align="center">
</el-table-column>
<el-table-column prop="roleAttribute" label="角色属性" align="center">
</el-table-column>
<el-table-column prop="roleNumber" label="角色对象个数" align="center">
</el-table-column>
<el-table-column label="数据详情" align="center">
<template slot-scope="scope">
<el-button size="mini" @click="reader(scope.row)" disabled>查看</el-button>
</template>
</el-table-column>
<el-table-column label="操作" align="center">
<template slot-scope="scope">
<el-button size="mini" @click="updateRole(scope.row)" disabled>编辑</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
<el-card shadow="hover" class="m-b-20">
<div class="m-b-20 flex-between">
<h6 class="p-title" style="margin-bottom: 0">实验提示</h6>
<div>
启用 <el-switch v-model="flag02"></el-switch>
</div>
</div>
<div>
<el-form label-width="0">
<el-form-item prop="tips" label="">
<quill :border="true" :readonly="isDetail" v-model="experimentSuggests" :minHeight="150" :height="150" />
</el-form-item>
</el-form>
</div>
</el-card>
<el-card shadow="hover" class="m-b-20" v-if="!isHh">
<div class="m-b-20 flex-between">
<h6 class="p-title" style="margin-bottom: 0">知识点</h6>
<div>
启用 <el-switch v-model="knowledgePointsIsEnable"></el-switch>
</div>
</div>
<div>
<el-form label-width="0">
<el-form-item prop="tips" label="">
<quill :border="true" :readonly="isDetail" v-model="knowledgePoints" :minHeight="150" :height="150" />
</el-form-item>
</el-form>
</div>
</el-card>
<el-card shadow="hover" class="m-b-20" v-if="!isHh">
<div class="m-b-20 flex-between">
<h6 class="p-title" style="margin-bottom: 0">实验介绍</h6>
<div>
启用 <el-switch v-model="experimentIntroductionIsEnable"></el-switch>
</div>
</div>
<div>
<el-form label-width="0">
<el-form-item prop="tips" label="">
<quill :border="true" :readonly="isDetail" v-model="experimentIntroduction" :minHeight="150" :height="150" />
</el-form-item>
</el-form>
</div>
</el-card>
</el-form>
<el-dialog title="新建角色数据" :visible.sync="dialogVisible" width="30%" @close="closeRole" :close-on-click-modal="false">
<el-form :model="dataObjectform" ref="roleData" label-width="80px">
<el-form-item label="角色数量" prop="desc">
<el-input v-model="dataObjectform.roleNumber">
<template slot="append"></template>
</el-input>
</el-form-item>
<el-form-item label="角色类型" prop="desc">
<el-select v-model="dataObjectform.roleType" 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>
<el-form-item label="角色属性" prop="answerAnalysis">
<el-select v-model="dataObjectform.roleAttribute" placeholder="请选择角色属性">
<el-option label="个人" value="0"></el-option>
<el-option label="公司" value="1"></el-option>
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="onSubmit">确定</el-button>
</div>
</el-dialog>
<el-dialog title="添加判分点" :visible.sync="dialogVisible1" 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="judgementpointsquery" clearable></el-input></div>
</div>
<el-table :data="judgementData" ref="judgementTable" class="table" stripe :span-method="SpanMethod" header-align="center" max-height="400" @selection-change="handleSelectionChange" row-key="judgmentPointsId">
<el-table-column type="selection" width="55" align="center" :reserve-selection="true"></el-table-column>
<el-table-column prop="id" label="序号" align="center">
<template slot-scope="scope">
{{scope.$index+1}}
</template>
</el-table-column>
<el-table-column prop="judgmentPointsName" label="判分点名称" align="center">
</el-table-column>
<el-table-column label="操作" align="center">
<template slot-scope="scope">
<el-button size="mini" @click="check(scope.row.judgmentPointsId)">查看</el-button>
</template>
</el-table-column>
</el-table>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogVisible1 = false"> </el-button>
<el-button type="primary" @click="judgmentPoints"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import Setting from '@/setting'
import util from '@/libs/util'
import { mapState, mapActions } from 'vuex'
import quill from '@/components/quill'
export default {
data (){
return {
4 years ago
host: Setting.apiBaseURL,
4 years ago
isHh: Setting.isHh,
id: this.$route.query.id,
systemList: Setting.systemList,
token: btoa(util.local.get(Setting.tokenKey)),
userIdEd: this.userId,
4 years ago
systemId: this.$store.state.project.lastSystemId,
4 years ago
isDetail: Boolean(this.$route.query.show),
roleIdEd: this.roleId,
newroleArray: [],
judgementpointsquery: "", //筛选判分点
flag01: false, //实验数据是否启用
flag02: true, //实验提示是否启用
knowledgePointsIsEnable: true, //知识点是否启用
experimentIntroductionIsEnable: true, //实验结束是否启用
uploadExperimentData: [], //上传的实验数据对象
experimentSuggests: "", //实验提示
caseDescription: "", //案例描述
experimentalGoal: "", //实验目标
projectName: "", //项目名称
projectPermission: 0, //项目权限
projectPermissions: [
{
value: 0,
label: "练习"
},
{
value: 1,
label: "考核"
},
// {
// value: 2,
// label: "竞赛"
// }
],
flag: false, //判分点表格分数是否禁用
multipleTable: [],
roleArray: [], //新建角色的数组
judgementData: [],
dataObjectform: {
roleNumber: "",
roleType: "",
roleAttribute: ""
},
dialogVisible1: false,
dialogVisible: false,
value1: true,
experimentData: [], //判分点列表
experimentalData: [], //实验数据表
multipleSelection: [],
avgValuelist: [], //取得判分点平均分的数组
state: "", //状态是草稿箱还是已发布
knSwitch: '',
desSwitch: '',
scoreSysData: [
{
id: 1,
scoreName: 'KPI考核一',
experimentName: ''
},
{
id: 2,
scoreName: 'KPI考核二',
experimentName: ''
}
],
experimentalName: '',
auth: '',
oneDepList: [
{
name: '币币交易',
value: 1
}
],
twoDepList: [
{
name: '币币交易',
value: 1
}
],
actionList: [
{
name: '币币交易',
value: 1
}
],
indexAreaList1: [],
knowledgePoints: '',
editorOption: {
theme: 'snow',
boundary: document.body,
modules: {
toolbar: [
['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']
]
},
placeholder: '',
readOnly: this.isDetail
},
experimentIntroduction: '',
projectNameRepeat: false,
originalName: '',
searchTimer: null,
isToPoint: false
}
},
components: {
quill
},
4 years ago
created(){
console.log(this.systemId,'this.systemId',this.lastSystemId);
},
4 years ago
computed: {
...mapState('user', [
'userId','roleId'
]),
4 years ago
4 years ago
...mapState('project', [
4 years ago
'projectFields','lastSystemId'
4 years ago
]),
4 years ago
4 years ago
handDistributionScore: function() {
//计算判分点分值,超出100提示,
let score = 0;
this.experimentData.forEach(e => {
score += parseInt(e.score);
});
if (isNaN(score)) {
return 0;
}
if (score > 100) {
util.errorMsg("分配的数值已超过100");
}
return score;
}
},
watch: {
"dataObjectform.roleNumber"(a) {
if (a < 0) {
this.dataObjectform.roleNumber = 0;
}
},
experimentData: {
handler(newValue) {
console.log(newValue);
},
deep: true
},
judgementpointsquery(n) {
clearTimeout(this.searchTimer)
this.searchTimer = setTimeout(() => {
this.dialog1()
},500)
},
projectPermission(val){
if(val){
this.flag02 = false
}else{
this.flag02 = true
}
}
},
mounted(){
this.recoveryData()
},
beforeDestroy(){
if(!this.isToPoint){
this.setProject({})
}
},
methods: {
...mapActions('project', [
'setSystemId','setProject'
]),
getData(){
let url = this.api.getProjectId
if(this.systemId == 2 || this.systemId == 3) url = this.api.getTrdingJudgmentPoints
this.$get(url, {
projectId: this.id
}).then(res => {
this.userId = res.message[0].userId;
// this.systemId = res.message[0].systemId;
this.projectName = res.message[0].projectName;
this.originalName = res.message[0].projectName
this.projectPermission = res.message[0].projectPermissions;
this.state = res.message[0].state;
this.experimentalGoal = res.message[0].experimentalGoal;
this.caseDescription = res.message[0].caseDescription;
this.knowledgePoints = res.message[0].knowledgePoints;
this.experimentIntroduction = res.message[0].experimentIntroduction;
res.message[1].forEach;
this.experimentData = res.message[1];
res.message[2].forEach(e => {
//将获取的实验数据进行处理
e.roleType = this.orderRoleType(e.roleType);
e.roleAttribute = this.orderRoleAttribute(e.roleAttribute);
});
this.experimentalData = res.message[2];
this.experimentSuggests = res.message[0].experimentSuggests;
this.flag01 = res.message[0].isstartexperimental == 0 ? true : false;
this.flag02 = res.message[0].isstartexperimentSuggests == 0 ? true : false;
this.knowledgePointsIsEnable = res.message[0].knowledgePointsIsEnable == 0 ? true : false;
this.experimentIntroductionIsEnable = res.message[0].experimentIntroductionIsEnable == 0 ? true : false;
this.$nextTick(() => {
window.scrollTo(0,0)
})
});
},
recoveryData(){
let cacheData = this.projectFields
if(JSON.stringify(cacheData) != '{}'){
let data = cacheData
this.userId = data.userId;
this.projectName = data.projectName;
this.originalName = data.projectName
this.systemId = data.systemId
this.projectPermission = data.projectPermission;
this.state = data.state;
setTimeout(() => {
this.$get(this.api.queryUserIds).then(res => {
this.$get(this.api.QueryPointOfJudgement, {
systemId: this.systemId,
userId: this.userId,
pageNum: 1,
pageSize: 1000,
queryName: this.judgementpointsquery,
userIdList: res.message.retvalue.join()
}).then(res => {
let list = res.message.rows
let experimentData = data.experimentData
experimentData.map(n => {
let item = list.find(e => e.judgmentPointsId == n.judgmentPointsId)
n.experimentalRequirements = item.experimentalRequirements
n.judgmentPointsName = item.judgmentPointsName
})
this.experimentData = experimentData
}).catch(err => {})
}).catch(res => {})
},1000)
this.experimentalGoal = data.experimentalGoal;
this.caseDescription = data.caseDescription;
this.knowledgePoints = data.knowledgePoints;
this.experimentIntroduction = data.experimentIntroduction;
this.experimentalData = data.experimentalData
this.experimentSuggests = data.experimentSuggests;
this.flag01 = data.flag01
this.flag02 = data.flag02
this.projectNameRepeat = data.projectNameRepeat
this.$nextTick(() => {
window.scrollTo(0,0)
// this.id && setTimeout(() => {
// this.getData()
// },500)
})
}else{
this.id && this.getData()
}
},
projectNameExistis(){
if(this.projectName !== this.originalName){
let data = {
projectName: encodeURI(this.projectName)
}
this.$get(this.api.isNameExistis,data).then(res => {
this.projectNameRepeat = false
}).catch(res => {
this.projectNameRepeat = true
})
}else{
this.projectNameRepeat = false
}
},
systemChange(){
if(this.experimentData.length && this.isHh){
this.$confirm('更换系统会清空实验任务,确认更换?', '提示', {
type: 'warning'
}).then(() => {
this.experimentData = []
this.setSystemId(this.systemId)
}).catch(() => {
this.systemId = this.lastSystemId
4 years ago
console.log(this.lastSystemId,'this.lastSystemId');
4 years ago
})
}
},
flag01_switch(){},
updateRole() {
this.dialogVisible = true;
},
check(judgmentPointsId) {
this.handleCacheData()
let url = ''
if(this.systemId == 2){
url = `programOption?id=${judgmentPointsId}`
}else if(this.systemId == 3){
url = `programOptions?id=${judgmentPointsId}`
}else{
url = `program?judgmentPointsId=${judgmentPointsId}`
}
this.$router.push(url)
},
judgmentRelease() {
//判断能否成功发布
if (this.projectName == "") {
this.$message.warning("请输入项目名称");
return false;
}
if (this.projectNameRepeat) {
this.$message.warning("该项目名称已存在");
return false;
}
if (this.experimentalGoal == "") {
this.$message.warning("请输入实验目标");
return false;
}
if (this.caseDescription == "") {
this.$message.warning("请输入案例描述");
return false;
}
if (this.experimentData.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 (this.experimentalData.length == 0 && this.flag01 && !isHh) {
this.$message.warning("请添加实验数据");
return false;
}
if (this.experimentSuggests == "" && this.flag02) {
this.$message.warning("请输入实验提示");
return false;
}
if (this.knowledgePoints == "" && this.knowledgePointsIsEnable && !isHh) {
this.$message.warning("请输入知识点");
return false;
}
if (this.experimentIntroduction == "" && this.experimentIntroductionIsEnable && !isHh) {
this.$message.warning("请输入实验介绍");
return false;
}
return true;
},
saveAsDraft() {
//点击保存为草稿
this.experimentalData.forEach(ele => {
this.newroleArray.push(ele.roleId);
});
let sum = 0; //判断判分点的分数是否超过100 如超过100则返回
if (sum > 100) {
this.$message.warning("您输入的判分点分数超过100,请重新输入");
return;
}
if (!this.judgmentRelease()) {
//判断页面是否有没有输入的内容
return;
}
4 years ago
console.log(this.systemId,'this.systemId---670');
4 years ago
this.setSystemId(this.systemId)
if (this.id != null) {
let url = this.api.updateProjectManagement
if(this.systemId == 2 || this.systemId == 3) url = this.api.updateProjectManagementTrad
this.$post(url, {
management: {
projectId: this.id,
projectName: this.projectName,
projectPermissions: this.projectPermission,
experimentalGoal: this.experimentalGoal,
caseDescription: this.caseDescription,
systemId: this.systemId,
experimentSuggests: this.experimentSuggests,
state: 0,
founder: this.roleIdEd,
isstartexperimental: this.flag01 == true ? 0 : 1,
isstartexperimentSuggests: this.flag02 == true ? 0 : 1,
knowledgePointsIsEnable: this.knowledgePointsIsEnable == true ? 0 : 1,
experimentIntroductionIsEnable: this.experimentIntroductionIsEnable == true ? 0 : 1,
userId: this.userId,
knowledgePoints: this.knowledgePoints,
experimentIntroduction: this.experimentIntroduction,
},
pooints: this.experimentData,
roleId: this.newroleArray,
founder: this.roleIdEd,
})
.then(() => {
util.successMsg('保存成功')
this.$router.go(-1)
})
.catch(() => {
console.log("err");
});
} else {
let url = this.api.addProjectManagement
if(this.systemId == 2 || this.systemId == 3) url = this.api.addProjectManagementTrad
this.$post(url, {
management: {
projectName: this.projectName,
projectPermissions: this.projectPermission,
experimentalGoal: this.experimentalGoal,
caseDescription: this.caseDescription,
systemId: this.systemId,
userId: this.userId,
experimentSuggests: this.experimentSuggests,
state: 0,
founder: this.roleIdEd,
isstartexperimental: this.flag01 == true ? 0 : 1,
isstartexperimentSuggests: this.flag02 == true ? 0 : 1,
knowledgePointsIsEnable: this.knowledgePointsIsEnable == true ? 0 : 1,
experimentIntroductionIsEnable: this.experimentIntroductionIsEnable == true ? 0 : 1,
knowledgePoints: this.knowledgePoints,
experimentIntroduction: this.experimentIntroduction,
},
pooints: this.experimentData,
roleId: this.newroleArray,
founder: this.roleIdEd,
})
.then(() => {
util.successMsg('保存成功')
this.$router.go(-1)
})
.catch(() => {
console.log("err");
});
}
},
insertProjectManagement() {
//点击确定并发布
this.experimentalData.forEach(ele => {
this.newroleArray.push(ele.roleId);
});
let sum = 0;
if (sum > 100) {
this.$message.warning("您输入的判分点分数超过100,请重新输入");
return;
}
if (!this.judgmentRelease()) {
//判断页面是否有没有输入的内容
return;
}
4 years ago
console.log(this.systemId,'this.systemId---755');
4 years ago
this.setSystemId(this.systemId)
if (this.id != null) {
let url = this.api.updateProjectManagement
if(this.systemId == 2 || this.systemId == 3) url = this.api.updateProjectManagementTrad
this.$post(url, {
management: {
projectId: this.id,
projectName: this.projectName,
projectPermissions: this.projectPermission,
experimentalGoal: this.experimentalGoal,
caseDescription: this.caseDescription,
systemId: this.systemId,
experimentSuggests: this.experimentSuggests,
state: 1,
founder: this.roleIdEd,
isstartexperimental: this.flag01 == true ? 0 : 1,
isstartexperimentSuggests: this.flag02 == true ? 0 : 1,
knowledgePointsIsEnable: this.knowledgePointsIsEnable == true ? 0 : 1,
experimentIntroductionIsEnable: this.experimentIntroductionIsEnable == true ? 0 : 1,
userId: this.userId,
knowledgePoints: this.knowledgePoints,
experimentIntroduction: this.experimentIntroduction,
},
pooints: this.experimentData,
roleId: this.newroleArray,
founder: this.roleIdEd,
})
.then(() => {
util.successMsg('发布成功')
this.$router.go(-1)
})
.catch(() => {
console.log("err");
});
} else {
let url = this.api.addProjectManagement
if(this.systemId == 2 || this.systemId == 3) url = this.api.addProjectManagementTrad
this.$post(url, {
management: {
projectName: this.projectName,
projectPermissions: this.projectPermission,
experimentalGoal: this.experimentalGoal,
caseDescription: this.caseDescription,
systemId: this.systemId,
userId: this.userId,
experimentSuggests: this.experimentSuggests,
state: 1,
founder: this.roleIdEd,
isstartexperimental: this.flag01 == true ? 0 : 1,
isstartexperimentSuggests: this.flag02 == true ? 0 : 1,
knowledgePointsIsEnable: this.knowledgePointsIsEnable == true ? 0 : 1,
experimentIntroductionIsEnable: this.experimentIntroductionIsEnable == true ? 0 : 1,
knowledgePoints: this.knowledgePoints,
experimentIntroduction: this.experimentIntroduction,
},
pooints: this.experimentData,
roleId: this.newroleArray,
founder: this.roleIdEd,
})
.then(() => {
util.successMsg('发布成功')
this.$router.go(-1)
})
.catch(() => {
console.log("err");
});
}
},
manualDistributionScore() {
//点击手动分配分值
if (this.experimentData.length == 0) {
return;
}
this.flag = false;
this.experimentData;
},
avgDistributionScore() {
//点击平均分配分值
if (this.experimentData.length == 0) {
return;
}
this.$get(this.api.avgValues, {
number: this.experimentData.length
}).then(res => {
this.avgValuelist = res.message;
this.experimentData.forEach((e, index) => {
e.score = this.avgValuelist[index];
});
this.flag = true; //禁用判分点分值输入
});
},
judgmentPoints() {
let list = [];
this.multipleSelection.forEach(e => {
list.push(e.judgmentPointsId);
});
let newlist = list.join();
if(newlist){
this.dialogVisible1 = false;
let experimentData = this.multipleSelection
experimentData.map(n => {
this.$set(n,'score',0)
this.$set(n,'userId',this.userId)
this.$set(n,'systemId',this.systemId)
})
this.experimentData = this.experimentData.concat(experimentData)
}else{
this.$message.warning('请添加判分点')
}
},
dialog1() {
let systemId = this.systemId
// if(systemId == 4 || systemId == 5) systemId = 1
this.dialogVisible1 = true;
this.$nextTick(() => {
this.$refs.judgementTable.clearSelection()
})
if(systemId == 2 || systemId == 3){
let data = {
systemId,
userId: this.userId,
pageNum: 1,
pageSize: 100,
judgmentPointsName: this.judgementpointsquery
}
this.$get(this.api.queryListTrading,data)
.then((res) => {
let list = res.message.rows
let experimentData = this.experimentData
let result = []
list.map(n => {
n.judgmentPointsId = n.id
experimentData.find(e => e.judgmentPointsId == n.id) || result.push(n)
})
this.judgementData = result
}).catch((err) => {
this.judgementData = []
})
}else{
this.$get(this.api.queryUserIds).then(res => {
this.$get(this.api.QueryPointOfJudgement, {
systemId: this.systemId,
userId: this.userId,
pageNum: 1,
pageSize: 1000,
queryName: this.judgementpointsquery,
userIdList: res.message.retvalue.join()
}).then(res => {
let list = res.message.rows
let experimentData = this.experimentData
let result = []
list.map(n => {
experimentData.find(e => e.judgmentPointsId == n.judgmentPointsId) || result.push(n)
})
this.judgementData = result
}).catch(err => {})
}).catch(res => {})
}
},
objclone(arr) {
//数组中有多个对象的深拷贝
let newarr = [];
for (let a = 0; a < arr.length; a++) {
newarr[a] = JSON.parse(JSON.stringify(arr[a]));
}
return newarr;
},
closeRole(){
this.dataObjectform = {
roleNumber: "",
roleType: "",
roleAttribute: ""
}
},
onSubmit() {
if(this.dataObjectform.roleNumber === '') return this.$message.warning('请填写角色数量')
if(this.dataObjectform.roleType === '') return this.$message.warning('请选择角色类型')
if(this.dataObjectform.roleAttribute === '') return this.$message.warning('请选择角色属性')
this.$post(
this.api.addRole, //新增案例数据对象 ok
JSON.stringify(this.dataObjectform)
)
.then(res => {
this.roleArray.push(res.message);
//取得新增对象的id进行第二次axios请求,获取实验数据表格信息
let newlist = this.roleArray.join();
return this.$get(this.api.getByRoleId, { roleId: newlist });
})
.then(res => {
//将请求的respone进行克隆 ok
this.uploadExperimentData = this.objclone(res.message);
res.message.forEach(e => {
//将获取的实验数据进行处理
e.roleType = this.orderRoleType(e.roleType);
e.roleAttribute = this.orderRoleAttribute(e.roleAttribute);
});
this.experimentalData.push(res.message[0]);
})
.catch(err => {
console.log(err);
});
this.dialogVisible = false;
},
back() {
// this.$router.go(-1);
this.$router.push({ path: "/" });
},
toggleSelection(rows) {
if (rows) {
rows.forEach(row => {
this.$refs.multipleTable.toggleRowSelection(row);
});
} else {
this.$refs.multipleTable.clearSelection();
}
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
SpanMethod({ row, column, rowIndex, columnIndex }) {
if (rowIndex % 2 === 0) {
if (columnIndex === 6) {
if(!row.Intranet){
return [1, 2];
}
}
// else if (columnIndex === 1) {
// return [0, 0];
// }
}
},
chooseIp(){
this.ipVisible = true
},
goBack() {
if(this.isDetail){
this.$router.back()
}else{
this.$confirm('确定返回?未更新的信息将不会保存。', '提示', {
type: 'warning'
})
.then(() => {
this.$router.back()
})
.catch(() => {});
}
},
handleCacheData(){
let data = {}
this.userId && (data.userId = this.userId)
this.projectName && (data.projectName = this.projectName)
this.originalName && (data.originalName = this.originalName)
data.systemId = this.systemId
data.projectPermission = this.projectPermission
this.state && (data.state = this.state)
if(this.experimentData){
let experimentData = this.experimentData
experimentData.map(n => {
delete n.experimentalRequirements
delete n.judgmentPointsName
})
data.experimentData = experimentData
}
this.experimentalGoal && (data.experimentalGoal = this.experimentalGoal)
this.caseDescription && (data.caseDescription = this.caseDescription)
this.knowledgePoints && (data.knowledgePoints = this.knowledgePoints)
this.experimentIntroduction && (data.experimentIntroduction = this.experimentIntroduction)
this.experimentalData && (data.experimentalData = this.experimentalData)
this.experimentSuggests && (data.experimentSuggests = this.experimentSuggests)
this.flag01 && (data.flag01 = this.flag01)
this.flag02 && (data.flag02 = this.flag02)
this.projectNameRepeat && (data.projectNameRepeat = this.projectNameRepeat)
this.isToPoint = true
4 years ago
console.log(data,'取得数据查看');
4 years ago
this.setProject(data)
},
toJudgePoint(row){
let host = this.host
let systemId = this.systemId
4 years ago
console.log(this.systemId,'sys');
4 years ago
this.handleCacheData()
let href = ''
if(row){
if(systemId == 2){
href = `${host}jdTrials/#/programOption?id=${row.judgmentPointsId}`
}if(systemId == 3){
href = `${host}jdTrials/#/programOptions?id=${row.judgmentPointsId}`
}else{
href = `${host}jdTrials/#/program?judgmentPointsId=${row.judgmentPointsId}&systemId=${systemId}&userId=${this.userId}&token=${this.token}&referrer=${btoa(location.href)}`
}
}else{
if(systemId == 2 || systemId == 3){
href = `${host}jdTrials/#/list`
}else{
href = `${host}jdTrials/#/?systemId=${systemId}&userId=${this.userId}&token=${this.token}&referrer=${btoa(location.href)}`
}
// if(process.env.NODE_ENV === 'development') href = `http://192.168.31.154:8087/#/?systemId=${systemId}&userId=${this.userId}&token=${this.token}&referrer=${btoa(location.href)}`
}
location.href = href
},
delJudgePoint(index){
this.$confirm('确定要删除吗?', '提示', {
type: 'warning'
}).then(() => {
this.experimentData.splice(index,1)
})
.catch(() => {})
}
}
}
</script>
<style lang="scss" scoped>
/deep/.readonly .ql-toolbar{
height: 0;
padding: 0;
border-bottom: 0;
}
</style>