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.
 
 
 
 

1083 lines
48 KiB

<template>
<div>
<el-form :disabled="isDetail">
<el-card shadow="hover" class="mgb20">
<div class="flex-between">
<div class="per_title" v-preventReClick @click="goback()">
<i class="el-icon-arrow-left"></i>
<span class="per_back">返回</span>
<span class="per_school">项目配置</span>
</div>
<div>
<template v-if="!isDetail">
<template v-if="!id">
<el-button type="success" size="small" round v-preventReClick @click="saveAsDraft">保存为草稿</el-button>
<el-button type="primary" size="small" round v-preventReClick @click="insertProjectManagement">确定并发布</el-button>
</template>
<template v-else>
<!-- <el-button type="success" size="small" round v-preventReClick @click="saveAsDraft">更新</el-button> -->
<el-button type="primary" size="small" round v-preventReClick @click="insertProjectManagement">确定并发布</el-button>
</template>
</template>
</div>
</div>
</el-card>
<el-card shadow="hover" class="mgb20">
<div class="flex-center mgb20 user_header">
<p class="addhr_tag"></p>
<span>基本信息</span>
</div>
<div>
<el-form label-width="80px">
<el-col :span="6">
<el-form-item label="项目名称">
<el-input :disabled="isDetail" v-model="projectName" placeholder="20个字符以内" @change="projectNameExistis"></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="项目权限">
<el-select :disabled="true" 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-col>
<el-col :span="6">
<el-form-item label="模式">
<el-select :disabled="isDetail" v-model="pattern" placeholder="请选择">
<el-option
v-for="item in patternList"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-form>
</div>
</el-card>
<el-card shadow="hover" class="mgb20">
<div class="flex-center mgb20 user_header">
<p class="addhr_tag"></p>
<span>实验目标</span>
</div>
<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="mgb20">
<div class="flex-center mgb20 user_header">
<p class="addhr_tag"></p>
<span>案例描述</span>
</div>
<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="mgb20">
<div class="mgb20 flex-between">
<div class="flex-center">
<p class="addhr_tag"></p>
<span>实验任务</span>
</div>
<div>
<el-button type="primary" size="small" @click="toJudgePoint(0)">进入判分点</el-button>
</div>
</div>
<div class="mgb20 flex-between">
<div class="flex-center">
<div class="mr20" style="color: #f00">项目总分值:100分</div>
<!-- <div>权重&emsp;<div class="dib"><el-input></el-input></div></div> -->
</div>
<div>
<el-button class="mr20" type="text" @click="avgDistributionScore">平均分配分值</el-button>
<el-button class="mr20" 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">
<el-input
:disabled="true"
v-model="scope.row.experimentalRequirements"
placeholder="请输入实验要求"
></el-input>
</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="mgb20">
<div class="mgb20 flex-between">
<div class="flex-center">
<p class="addhr_tag"></p>
<span>实验数据</span>
</div>
<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="mgb20">
<div class="mgb20 flex-between">
<div class="flex-center">
<p class="addhr_tag"></p>
<span>实验提示</span>
</div>
<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="mgb20">
<div class="mgb20 flex-between">
<div class="flex-center">
<p class="addhr_tag"></p>
<span>知识点</span>
</div>
<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="mgb20">
<div class="mgb20 flex-between">
<div class="flex-center">
<p class="addhr_tag"></p>
<span>实验介绍</span>
</div>
<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="flex-jc-end" style="margin-bottom: 10px">
<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" :selectable="disabledSelection"></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 quill from '@/components/common/quill'
export default {
data (){
return {
id: '',
isDetail: Boolean(this.$route.query.show),
roleId: Number(this.$store.state.userRoleId),
token: btoa(this.$store.state.loginToken),
newroleArray: [],
userLoginId: this.$store.state.userLoginId,
userId: this.$store.state.userLoginId,
systemId: this.$config.systemId,
judgementpointsquery: "", //筛选判分点
flag01: false, //实验数据是否启用
flag02: true, //实验提示是否启用
knowledgePointsIsEnable: true, //知识点是否启用
experimentIntroductionIsEnable: true, //实验结束是否启用
uploadExperimentData: [], //上传的实验数据对象
experimentSuggests: "", //实验提示
caseDescription: "", //案例描述
experimentalGoal: "", //实验目标
projectName: "", //项目名称
projectPermission: 1, //项目权限
projectPermissions: [
{
value: 0,
label: "练习"
},
{
value: 1,
label: "考核"
},
// {
// value: 2,
// label: "竞赛"
// }
],
pattern: 0,
patternList: [
{
value: 0,
label: "基础模式"
},
{
value: 1,
label: "挑战模式"
}
],
flag: false, //判分点表格分数是否禁用
multipleTable: [],
roleArray: [], //新建角色的数组
judgementData: [],
dataObjectform: {
roleNumber: "",
roleType: "",
roleAttribute: ""
},
dialogVisible1: false,
dialogVisible: false,
value1: true,
experimentData: [], //判分点列表
experimentalData: [], //实验数据表
multipleSelection: [],
avgValuelist: [], //取得判分点平均分的数组
state: "", //状态是草稿箱还是已发布
founder: this.$store.state.founderId,
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
},
computed: {
handDistributionScore: function() {
//计算判分点分值,超出100提示,
let score = 0;
this.experimentData.forEach(e => {
score += parseInt(e.score);
});
if (isNaN(score)) {
return 0;
}
if (score > 100) {
this.$message.error("分配的数值已超过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)
}
},
mounted(){
this.id = this.$route.query.id
this.recoveryData()
},
beforeDestroy(){
if(!this.isToPoint){
this.$store.commit('addProjectData',{addProject: {}})
}
},
methods: {
getData(){
this.$get(this.api.getProjectId, {
projectId: this.id
}).then(res => {
this.userId = res.message[0].userId;
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;
this.pattern = res.message[0].pattern;
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.$store.state.addProject
if(JSON.stringify(cacheData) != '{}'){
let data = cacheData
this.userId = data.userId;
this.projectName = data.projectName;
this.originalName = data.projectName
this.projectPermission = data.projectPermission;
this.state = data.state;
this.experimentData = data.experimentData
this.experimentalGoal = data.experimentalGoal;
this.caseDescription = data.caseDescription;
this.knowledgePoints = data.knowledgePoints;
this.experimentIntroduction = data.experimentIntroduction;
this.experimentData = data.experimentData
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)
})
}else{
this.id && this.getData()
}
},
projectNameExistis(){
if(this.projectName !== this.originalName){
let data = {
projectName: this.projectName
}
this.$get(this.api.isNameExistis,data).then(res => {
this.projectNameRepeat = false
}).catch(res => {
this.projectNameRepeat = true
})
}else{
this.projectNameRepeat = false
}
},
flag01_switch(){},
updateRole() {
this.dialogVisible = true;
},
// 自定义
start() {
window.location = "http://www.liuwanr.cn:8080/Score/#/";
},
check(judgmentPointsId) {
this.handleCacheData()
this.$router.push(`programOptions?id=${judgmentPointsId}&pattern=${this.pattern}`)
},
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) {
this.$message.warning("请添加实验数据");
return false;
}
if (this.experimentSuggests == "" && this.flag02) {
this.$message.warning("请输入实验提示");
return false;
}
if (this.knowledgePoints == "" && this.knowledgePointsIsEnable) {
this.$message.warning("请输入知识点");
return false;
}
if (this.experimentIntroduction == "" && this.experimentIntroductionIsEnable) {
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;
}
if (this.id != null) {
this.$post(this.api.updateProjectManagement, {
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.roleId,
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,
pattern: this.pattern
},
pooints: this.experimentData,
roleId: this.newroleArray,
founder: this.roleId,
})
.then(() => {
this.$message.success('保存成功')
this.$router.go(-1)
})
.catch(() => {
console.log("err");
});
} else {
this.$post(this.api.addProjectManagement, {
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.roleId,
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,
pattern: this.pattern
},
pooints: this.experimentData,
roleId: this.newroleArray,
founder: this.roleId,
})
.then(() => {
this.$message.success('保存成功')
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;
}
if (this.id != null) {
this.$post(this.api.updateProjectManagement, {
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.roleId,
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,
pattern: this.pattern
},
pooints: this.experimentData,
roleId: this.newroleArray,
founder: this.roleId,
})
.then(() => {
this.$message.success('发布成功')
this.$router.go(-1)
})
.catch(() => {
console.log("err");
});
} else {
this.$post(this.api.addProjectManagement, {
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.roleId,
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,
pattern: this.pattern
},
pooints: this.experimentData,
roleId: this.newroleArray,
founder: this.roleId,
})
.then(() => {
this.$message.success('发布成功')
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() {
this.dialogVisible1 = true;
this.$nextTick(() => {
this.$refs.judgementTable.clearSelection()
})
this.$get(this.api.queryUserIds).then(res => {
let data = {
systemId: this.pattern ? 12 : 11,
userId: this.userLoginId,
pageNum: 1,
pageSize: 100,
judgmentPointsName: this.judgementpointsquery,
userIdList: res.message.retvalue.join()
}
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 = []
})
}).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;
},
review() {
},
addData() {
this.dataDialog = true
},
saveAdd(status){
let data = this.form
if(this.id){
this.$post(this.api.projectUpdate,data).then((res) => {
this.$message.success('编辑成功');
this.$router.back()
}).catch((res) => {
})
}else{
data.status = status
data.createTime = this.formatDate("yyyy-MM-dd hh:mm:ss",new Date())
this.$post(this.api.projectSave,data).then((res) => {
this.$message.success('添加成功');
this.$router.back()
}).catch((res) => {
})
}
},
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.projectPermission = this.projectPermission
this.state && (data.state = this.state)
this.experimentData && (data.experimentData = this.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.experimentData && (data.experimentData = this.experimentData)
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
this.$store.commit('addProjectData',{addProject: data})
},
toJudgePoint(row){
this.handleCacheData()
let systemId = this.pattern ? 12 : 11
if(row){
location.href = `http://www.liuwanr.cn/jdTrials/#/programOptions?id=${row.judgmentPointsId}&systemId=${systemId}&userId=${this.userLoginId}&projectId=${this.id}&token=${this.token}&pattern=${this.pattern}&host=${location.host.includes('122.9.154.146') ? 1 : 2}&referrer=${btoa(location.href)}`
}else{
location.href = `http://www.liuwanr.cn/jdTrials/#/list?systemId=${systemId}&userId=${this.userLoginId}&projectId=${this.id ? this.id : ''}&token=${this.token}&pattern=${this.pattern}&host=${location.host.includes('122.9.154.146') ? 1 : 2}&referrer=${btoa(location.href)}`
// location.href = `http://192.168.31.154:8081/#/list?systemId=${this.systemId}&userId=${this.userId}&projectId=${this.id ? this.id : ''}&token=${this.token}&pattern=${this.pattern}&host=${location.host.includes('122.9.154.146') ? 1 : 2}&referrer=${btoa(location.href)}`
}
},
disabledSelection(row,index){
let experimentData = this.experimentData
if(experimentData.find(n => n.id == row.id)) return false
return true
},
delJudgePoint(index){
this.$confirm('确定要删除吗?', '提示', {
type: 'warning'
}).then(() => {
this.experimentData.splice(index,1)
})
.catch(() => {})
}
}
}
</script>
<style scoped lang="scss">
.dib{
display: inline-block;
}
/deep/.ql-editor{
height: 400px;
}
.rules{
.rule-header{
display: flex;
justify-content: space-between;
padding: 10px 20px;
color: #fff;
background-color: #9278FF;
}
.rule-body{
display: flex;
justify-content: space-between;
align-items: center;
padding: 15px;
.rule-block{
width: 40%;
padding: 15px;
text-align: center;
.rule-bd{
padding: 10px;
margin-top: 10px;
border: 1px solid #ddd;
}
}
.connect{
width: 50px;
line-height: 50px;
text-align: center;
border: 1px solid #ddd;
border-radius: 50%;
}
}
}
.mr20{
margin-right: 20px;
}
.mgb10{
margin-bottom: 10px;
}
.flex-jc-end{
display: flex;
justify-content: flex-end;
}
</style>