|
|
|
<template>
|
|
|
|
<div ref="main" class="main" v-loading="loading">
|
|
|
|
<el-row :gutter="20">
|
|
|
|
<el-col :span="24">
|
|
|
|
<el-card shadow="hover" class="mgb20">
|
|
|
|
<div class="flex-between">
|
|
|
|
<el-page-header @back="back" content="项目配置"></el-page-header>
|
|
|
|
<div v-if="!isDetail">
|
|
|
|
<el-button type="success" :loading="submiting === 0"
|
|
|
|
@click="handleSubmit(0, projectManage.isOpen = 1, projectManage.ztOpen = 1)">保存为草稿
|
|
|
|
</el-button>
|
|
|
|
<el-button type="primary" :loading="submiting === 1" @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-input v-model.trim="projectManage.remark" placeholder="20个字符以内"></el-input>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="项目用途">
|
|
|
|
<el-select :disabled="isDetail" v-model="projectManage.permissions" placeholder="请选择"
|
|
|
|
@change="permissionChange">
|
|
|
|
<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"
|
|
|
|
:type.sync="projectManage.experimentTargetType" radio :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"
|
|
|
|
:type.sync="projectManage.experimentDescriptionType" radio :minHeight="150" :height="150"
|
|
|
|
:index="1" />
|
|
|
|
</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="handleAddJudgment"
|
|
|
|
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>
|
|
|
|
<div class="draggable">
|
|
|
|
<el-table ref="projectJudgementTable" :data="projectJudgmentData" class="table" stripe header-align="center"
|
|
|
|
:use-virtual="isLc" :max-height="600" :row-height="60" :border="false"
|
|
|
|
@selection-change="handleSelectionProjectJudgment" row-key="judgmentId" v-loading="listLoading">
|
|
|
|
<el-table-column type="selection" width="55" align="center"></el-table-column>
|
|
|
|
<el-table-column prop="sort" label="序号" width="80" align="center">
|
|
|
|
<template slot-scope="scope">
|
|
|
|
{{ scope.row.sort }}
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
<el-table-column prop="name" label="判分指标" align="center" show-overflow-tooltip
|
|
|
|
min-width="140"></el-table-column>
|
|
|
|
<el-table-column prop="name" label="判分点名称" align="center" show-overflow-tooltip
|
|
|
|
min-width="140"></el-table-column>
|
|
|
|
<el-table-column label="实验要求" align="center" width="600">
|
|
|
|
<template slot-scope="scope">
|
|
|
|
<quill :readonly="true" elseRead="true" v-model="scope.row.experimentalRequirements" :index="2" />
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
<el-table-column prop="score" label="分数" align="center" width="120">
|
|
|
|
<template slot-scope="scope">
|
|
|
|
<el-input :disabled="isDetail" :key="scope.$index" type="number" step="0.1"
|
|
|
|
v-model.trim="scope.row.score"></el-input>
|
|
|
|
<!--
|
|
|
|
@input="scoreChange(scope.row, scope.$index)" -->
|
|
|
|
</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>
|
|
|
|
</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-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"
|
|
|
|
:type.sync="projectManage.experimentHintType" radio :minHeight="150" :height="400" :index="3" />
|
|
|
|
</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"
|
|
|
|
@close="closeJudgment">
|
|
|
|
<div class="text-right mgb10">
|
|
|
|
<div>
|
|
|
|
<el-input placeholder="请输入需要查找的判分点" prefix-icon="el-icon-search" v-model.trim="judgementpointsquery"
|
|
|
|
clearable></el-input>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<el-table v-loading="visibleLoading" :data="judgementData" ref="judgementTable" class="table" stripe
|
|
|
|
header-align="center" use-virtual :row-height="45" :max-height="400" :border="false"
|
|
|
|
@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="closeJudgment">取 消</el-button>
|
|
|
|
<el-button type="primary" :loading="savingJud" @click="saveJudgment">确 定</el-button>
|
|
|
|
</div>
|
|
|
|
</el-dialog>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import Setting from "@/setting";
|
|
|
|
import quill from "@/components/quill";
|
|
|
|
import Sortable from "sortablejs";
|
|
|
|
import { UTable, UTableColumn } from 'umy-ui'
|
|
|
|
import Decimal from 'decimal.js'
|
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
quill,
|
|
|
|
UTable,
|
|
|
|
UTableColumn
|
|
|
|
},
|
|
|
|
data () {
|
|
|
|
return {
|
|
|
|
projectId: this.$route.query.projectId,
|
|
|
|
founder: this.$route.query.founder,
|
|
|
|
token: btoa(sessionStorage.getItem("token")),
|
|
|
|
isDetail: this.$route.query.show,
|
|
|
|
isDetails: this.$route.query.isDetails,
|
|
|
|
projectManage: {
|
|
|
|
founder: 0, // 创建人角色(0、系统 1、老师)
|
|
|
|
projectName: "", // 项目名称
|
|
|
|
remark: '',
|
|
|
|
permissions: 0, // 项目用途(0、练习 1、考核 2、竞赛)
|
|
|
|
systemId: this.$route.query.systemId, // 系统id
|
|
|
|
hintOpen: 1, // 实验提示是否开启(0开启 1不开启 默认1)
|
|
|
|
experimentHint: "", // 实验提示
|
|
|
|
experimentTarget: "", // 实验目标
|
|
|
|
experimentDescription: "", // 项目背景
|
|
|
|
state: 0, // 状态(0、草稿箱 1、已发布)
|
|
|
|
isOpen: 0, // 是否开启(0开启 1未开启 默认0)
|
|
|
|
ztOpen: 0, // 是否开启(0开启 1未开启 默认0)
|
|
|
|
isDel: 0, // 是否删除(0、未删除 1、已删除 默认0)
|
|
|
|
experimentTargetType: '0',
|
|
|
|
experimentDescriptionType: '0',
|
|
|
|
experimentHintType: '0',
|
|
|
|
},
|
|
|
|
projectJudgmentData: [], //实验任务(项目判分点)
|
|
|
|
oriPer: '', // 原始项目用途,用于保存的时候对比是否有修改该值,如果有,要调另一个接口查询提示
|
|
|
|
selectedProjectJudgment: [], // 选中的项目判分点
|
|
|
|
|
|
|
|
dialogVisible: false, // 选择判分点对话框
|
|
|
|
judgementpointsquery: "", //条件筛选判分点
|
|
|
|
judgementData: [], // 判分点列表数据
|
|
|
|
selectedJudgment: [], // 选中的判分点
|
|
|
|
rowKey: "", // 判分点行数据的 Key
|
|
|
|
projectNameRepeat: false, // 项目名称是否重复
|
|
|
|
originName: '',
|
|
|
|
|
|
|
|
flag: false, //判分点表格分数是否禁用
|
|
|
|
avgValuelist: [], //取得判分点平均分的数组
|
|
|
|
|
|
|
|
searchTimer: null,
|
|
|
|
isToPoint: false, // 判断是否是跳转到判分点系统
|
|
|
|
visibleLoading: false, // 加载判分点数据
|
|
|
|
listLoading: false,// 列表加载
|
|
|
|
submiting: false, // 新增编辑防抖标识
|
|
|
|
updateTime: 0,
|
|
|
|
savingJud: false,
|
|
|
|
loading: false,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
lastSystemId () {
|
|
|
|
return this.$store.state.lastSystemId;
|
|
|
|
},
|
|
|
|
projectFields () {
|
|
|
|
return this.$store.state.projectFields;
|
|
|
|
},
|
|
|
|
handDistributionScore () {
|
|
|
|
//计算判分点分值,超出100提示,
|
|
|
|
let score = 0;
|
|
|
|
this.projectJudgmentData.forEach(e => {
|
|
|
|
if (e.score && !isNaN(e.score)) score = Decimal(e.score).add(Decimal(score))
|
|
|
|
});
|
|
|
|
if (isNaN(score)) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
if (score > 100) {
|
|
|
|
this.$message.error("分配的数值已超过100");
|
|
|
|
}
|
|
|
|
return score;
|
|
|
|
},
|
|
|
|
// 是否流程点分类
|
|
|
|
isLc () {
|
|
|
|
const systemId = +this.$route.query.systemId
|
|
|
|
return systemId === 11 || systemId === 12 || systemId === 19
|
|
|
|
},
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
// 监听信息是否有更改,有的话页面离开的时候要询问是否要保存
|
|
|
|
projectManage: {
|
|
|
|
handler () {
|
|
|
|
this.updateTime++
|
|
|
|
},
|
|
|
|
deep: true
|
|
|
|
},
|
|
|
|
judgementpointsquery (n) {
|
|
|
|
clearTimeout(this.searchTimer);
|
|
|
|
this.searchTimer = setTimeout(() => {
|
|
|
|
this.handleQueryJudgment();
|
|
|
|
}, 500);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
mounted () {
|
|
|
|
if (this.$route.query.projectId) {
|
|
|
|
this.projectId = this.$route.query.projectId;
|
|
|
|
this.getInfoData();
|
|
|
|
} else {
|
|
|
|
this.rowDrop()
|
|
|
|
}
|
|
|
|
// 判断有没有缓存数据
|
|
|
|
if (JSON.stringify(this.projectFields) != "{}") {
|
|
|
|
let { projectManage, projectJudgmentData } = this.projectFields;
|
|
|
|
this.projectManage = projectManage;
|
|
|
|
this.projectJudgmentData = projectJudgmentData;
|
|
|
|
}
|
|
|
|
this.$refs.main.scrollTop = 0;
|
|
|
|
},
|
|
|
|
beforeDestroy () {
|
|
|
|
if (!this.isToPoint) {
|
|
|
|
this.$store.dispatch("setProject", {});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
permissionChange () {
|
|
|
|
if (this.projectManage.permissions) {
|
|
|
|
this.projectManage.hintOpen = 1
|
|
|
|
} else {
|
|
|
|
this.projectManage.hintOpen = 0
|
|
|
|
}
|
|
|
|
},
|
|
|
|
getInfoData () { // 获取详情数据
|
|
|
|
if (!this.isToPoint) {
|
|
|
|
this.loading = true
|
|
|
|
this.$get(`${this.api.getProjectDetail}?projectId=${this.projectId}`).then(res => {
|
|
|
|
let { projectManage, projectJudgmentVos } = res;
|
|
|
|
if (!projectManage.remark) projectManage.remark = projectManage.projectName // 如果没有备注,则直接显示项目名称
|
|
|
|
if (!projectManage.experimentDescriptionType) projectManage.experimentDescriptionType = '0'
|
|
|
|
if (!projectManage.experimentHintType) projectManage.experimentHintType = '0'
|
|
|
|
if (!projectManage.experimentTargetType) projectManage.experimentTargetType = '0'
|
|
|
|
this.projectManage = projectManage;
|
|
|
|
this.projectJudgmentData = projectJudgmentVos;
|
|
|
|
this.oriPer = projectManage.permissions
|
|
|
|
this.projectJudgmentData.forEach((e, i) => {
|
|
|
|
e.sort = i + 1;
|
|
|
|
});
|
|
|
|
this.loading = false
|
|
|
|
this.$nextTick(() => {
|
|
|
|
this.updateTime = 0
|
|
|
|
this.$refs.main.scrollTop = 0;
|
|
|
|
this.rowDrop();
|
|
|
|
});
|
|
|
|
}).catch(err => {
|
|
|
|
this.loading = false
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
projectNameExistis () { // 项目管理名称判重
|
|
|
|
const { projectName } = this.projectManage
|
|
|
|
if (this.originName === projectName) {
|
|
|
|
this.projectNameRepeat = false
|
|
|
|
} else {
|
|
|
|
this.$post(this.api.queryNameIsExist, { projectName }).then(res => {
|
|
|
|
if (res.status === 200) {
|
|
|
|
this.projectNameRepeat = false
|
|
|
|
}
|
|
|
|
}).catch(err => {
|
|
|
|
this.projectNameRepeat = true
|
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
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");
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
// 去除空白标签
|
|
|
|
removeTag (val) {
|
|
|
|
return val.replace('<p><br></p>', '')
|
|
|
|
},
|
|
|
|
judgmentRelease (state) { //判断能否成功发布
|
|
|
|
let {
|
|
|
|
projectName,
|
|
|
|
experimentTarget,
|
|
|
|
experimentDescription,
|
|
|
|
experimentHint,
|
|
|
|
hintOpen
|
|
|
|
} = this.projectManage;
|
|
|
|
if (!projectName) {
|
|
|
|
this.$message.error("请输入项目名称");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (this.projectNameRepeat) {
|
|
|
|
this.$message.error("项目名称重复!");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (state) {
|
|
|
|
if (!experimentTarget || !this.removeTag(experimentTarget)) {
|
|
|
|
this.$message.error("请输入实验目标");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (!experimentDescription || !this.removeTag(experimentDescription)) {
|
|
|
|
this.$message.error("请输入案例描述");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (this.projectJudgmentData.length == 0) {
|
|
|
|
this.$message.error("请添加判分点");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (this.handDistributionScore < 100) {
|
|
|
|
this.$message.error("判分点分数未满100");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (this.handDistributionScore > 100) {
|
|
|
|
this.$message.error("判分点分数已超过100");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if ((!experimentHint || !this.removeTag(experimentHint)) && hintOpen == 0) {
|
|
|
|
this.$message.error("请输入实验提示");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
},
|
|
|
|
handleSubmit (state) { //处理提交
|
|
|
|
if (this.submiting === 0 || this.submiting === 1) return false
|
|
|
|
if (!this.judgmentRelease(state)) { //判断页面是否有没有输入的内容
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
this.submiting = state
|
|
|
|
this.$store.dispatch("setSystemId", this.projectManage.systemId);
|
|
|
|
this.projectManage.state = state;
|
|
|
|
this.projectManage.ztOpen = state ? 0 : 1
|
|
|
|
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 : "",
|
|
|
|
judgmentId: i.judgmentId,
|
|
|
|
score: i.score,
|
|
|
|
sort: i.sort
|
|
|
|
};
|
|
|
|
return obj;
|
|
|
|
});
|
|
|
|
|
|
|
|
let params = {
|
|
|
|
projectManage: this.projectManage,
|
|
|
|
projectJudgmentList: tempArr
|
|
|
|
};
|
|
|
|
this.addProject(params);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
updateProject (params) { // 更新项目
|
|
|
|
this.$post(this.api[params.projectManage.state ? 'updateProjectManage' : 'editProjectDraft'], params).then(res => {
|
|
|
|
if (res.status === 200) {
|
|
|
|
// 中台创建的项目,并且更改了项目用途,就需要调这个接口
|
|
|
|
if (!params.projectManage.founder && this.oriPer !== params.projectManage.permissions) {
|
|
|
|
this.$get(`${this.api.checkConfig}?projectId=${this.projectId}`).then(res => {
|
|
|
|
this.$message.success(res.message === 'success' ? '更新实验项目成功' : res.message)
|
|
|
|
}).catch(err => { })
|
|
|
|
} else {
|
|
|
|
this.$message.success('更新实验项目成功')
|
|
|
|
}
|
|
|
|
this.toList();
|
|
|
|
}
|
|
|
|
}).catch(err => {
|
|
|
|
this.submiting = false
|
|
|
|
});
|
|
|
|
},
|
|
|
|
addProject (params) { // 添加项目
|
|
|
|
this.$post(this.api[params.projectManage.state ? 'addProjectManage' : 'saveProjectDraft'], params).then(res => {
|
|
|
|
if (res.status === 200) {
|
|
|
|
this.$message.success("添加实验项目成功");
|
|
|
|
this.$router.back();
|
|
|
|
}
|
|
|
|
}).catch(err => {
|
|
|
|
this.submiting = false
|
|
|
|
});
|
|
|
|
},
|
|
|
|
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;
|
|
|
|
});
|
|
|
|
// this.updateProjectJudgment();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
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, i) {
|
|
|
|
row.score = row.score.replace(/[^\d\.]/g, '')
|
|
|
|
this.projectJudgmentData.splice(i, 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.error("请选择判分点");
|
|
|
|
}
|
|
|
|
},
|
|
|
|
handleAddJudgment () { // 处理添加判分点
|
|
|
|
this.dialogVisible = true;
|
|
|
|
this.handleQueryJudgment();
|
|
|
|
},
|
|
|
|
handleQueryJudgment () { // 查询判分点数据
|
|
|
|
let { systemId } = this.projectManage;
|
|
|
|
this.$nextTick(() => {
|
|
|
|
this.$refs.judgementTable.clearSelection();
|
|
|
|
});
|
|
|
|
let params = {
|
|
|
|
name: this.judgementpointsquery,
|
|
|
|
pageNum: 1,
|
|
|
|
pageSize: 10000,
|
|
|
|
enable: 0,
|
|
|
|
systemId
|
|
|
|
};
|
|
|
|
if (systemId == 2 || systemId == 3) {
|
|
|
|
console.log("系统id:", systemId);
|
|
|
|
} else if (this.isLc) {
|
|
|
|
// (流程)交易类
|
|
|
|
this.rowKey = "lcId";
|
|
|
|
this.getProcessClassData(params);
|
|
|
|
} else {
|
|
|
|
// 编程类
|
|
|
|
this.rowKey = "bcId";
|
|
|
|
this.getProgrammingClassData(params);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
getProcessClassData (params) { // 获取流程类判分点列表数据
|
|
|
|
this.visibleLoading = true;
|
|
|
|
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.visibleLoading = false;
|
|
|
|
this.judgementData = result;
|
|
|
|
}
|
|
|
|
}).catch(err => {
|
|
|
|
this.visibleLoading = false
|
|
|
|
});
|
|
|
|
},
|
|
|
|
getProgrammingClassData (params) { // 获取编程类判分点列表数据
|
|
|
|
this.visibleLoading = true;
|
|
|
|
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.visibleLoading = false;
|
|
|
|
this.judgementData = result;
|
|
|
|
}
|
|
|
|
}).catch(err => {
|
|
|
|
this.visibleLoading = false
|
|
|
|
});
|
|
|
|
},
|
|
|
|
handleSelectionJudgment (val) { // 处理多选判分点
|
|
|
|
this.selectedJudgment = val;
|
|
|
|
},
|
|
|
|
closeJudgment () { // 关闭判分点对话框
|
|
|
|
this.judgementpointsquery = "";
|
|
|
|
this.dialogVisible = false;
|
|
|
|
},
|
|
|
|
saveJudgment () { // 确认选择判分点
|
|
|
|
if (this.selectedJudgment.length) {
|
|
|
|
this.savingJud = true
|
|
|
|
this.judgementpointsquery = "";
|
|
|
|
this.dialogVisible = false;
|
|
|
|
let tempArr = this.selectedJudgment.map(i => {
|
|
|
|
this.$set(i, 'score', 0)
|
|
|
|
return i;
|
|
|
|
});
|
|
|
|
this.projectJudgmentData = this.projectJudgmentData.concat(tempArr);
|
|
|
|
this.projectJudgmentData.map((e, i) => {
|
|
|
|
e.sort = i + 1;
|
|
|
|
});
|
|
|
|
this.$nextTick(() => {
|
|
|
|
this.savingJud = false
|
|
|
|
this.$refs.projectJudgementTable.clearSelection();
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
this.$message.error("请选择判分点");
|
|
|
|
}
|
|
|
|
},
|
|
|
|
// 行拖拽
|
|
|
|
rowDrop () {
|
|
|
|
// 此时找到的元素是要拖拽元素的父容器
|
|
|
|
const tbody = document.querySelector(".el-table__body tbody");
|
|
|
|
const that = this;
|
|
|
|
this.$refs.projectJudgementTable && Sortable.create(tbody, {
|
|
|
|
// 指定父元素下可被拖拽的子元素
|
|
|
|
// draggable: ".draggable .el-table__row",
|
|
|
|
onUpdate ({ newIndex, oldIndex }) {
|
|
|
|
console.log("🚀 ~ onEnd ~ newIndex, oldIndex:", newIndex, oldIndex)
|
|
|
|
if (newIndex == oldIndex) return false
|
|
|
|
const currentRow = that.projectJudgmentData.splice(oldIndex, 1)[0]
|
|
|
|
that.projectJudgmentData.splice(newIndex, 0, currentRow)
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
// 修改判分点中间表
|
|
|
|
async updateProjectJudgment () {
|
|
|
|
let param = this.projectJudgmentData.map((e, i) => {
|
|
|
|
let obj = {
|
|
|
|
judgmentId: e.judgmentId,
|
|
|
|
projectId: this.projectId || "",
|
|
|
|
score: e.score,
|
|
|
|
sort: i + 1,
|
|
|
|
id: e.id
|
|
|
|
};
|
|
|
|
return obj;
|
|
|
|
});
|
|
|
|
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;
|
|
|
|
});
|
|
|
|
let params = {
|
|
|
|
projectManage: this.projectManage,
|
|
|
|
projectJudgmentList: tempArr
|
|
|
|
};
|
|
|
|
this.updateProject(params);
|
|
|
|
}).catch(err => {
|
|
|
|
console.log(err);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
handleCacheData () { // 处理缓存数据
|
|
|
|
this.isToPoint = true;
|
|
|
|
this.$store.dispatch("setProject", {
|
|
|
|
projectManage: this.projectManage,
|
|
|
|
projectJudgmentData: this.projectJudgmentData
|
|
|
|
});
|
|
|
|
},
|
|
|
|
toJudgePoint (type, row) { // 进入判分点系统
|
|
|
|
this.handleCacheData();
|
|
|
|
let jumpPath = Setting.jumpPath;
|
|
|
|
let { systemId } = this.projectManage;
|
|
|
|
let href = "";
|
|
|
|
if (type === "view") {
|
|
|
|
// 查看
|
|
|
|
if (systemId == 2) {
|
|
|
|
console.log(systemId);
|
|
|
|
} else if (systemId == 3) {
|
|
|
|
console.log(systemId);
|
|
|
|
} else if (this.isLc) {
|
|
|
|
// 交易类判分点(银行综合系统)
|
|
|
|
href = `${jumpPath}/#/Transaction?isView=true&systemId=${systemId}&lcId=${row.judgmentId}&token=${this.token}&referrer=${btoa(location.href)}`;
|
|
|
|
} else {
|
|
|
|
// 编程类判分点(python子系统)
|
|
|
|
href = `${jumpPath}/#/program?isView=true&systemId=${systemId}&bcId=${row.judgmentId}&token=${this.token}&referrer=${btoa(location.href)}`;
|
|
|
|
}
|
|
|
|
} else if (type === "edit") {
|
|
|
|
// 自定义(老师端隐藏此功能)
|
|
|
|
if (systemId == 2) {
|
|
|
|
console.log(systemId);
|
|
|
|
} else if (systemId == 3) {
|
|
|
|
console.log(systemId);
|
|
|
|
} else if (this.isLc) {
|
|
|
|
// 交易类判分点(银行综合系统)
|
|
|
|
href = `${jumpPath}/#/Transaction?isEdit=true&systemId=${systemId}&lcId=${row.judgmentId}&token=${this.token}&referrer=${btoa(location.href)}`;
|
|
|
|
} else {
|
|
|
|
// 编程类判分点(python子系统)
|
|
|
|
href = `${jumpPath}/#/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 = `${jumpPath}/#/list`;
|
|
|
|
} else {
|
|
|
|
// 进入判分点系统首页(老师端隐藏此功能)
|
|
|
|
href = `${jumpPath}#/?systemId=${systemId}&token=${this.token}&referrer=${btoa(location.href)}`;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
location.href = href;
|
|
|
|
},
|
|
|
|
// 返回列表
|
|
|
|
toList () {
|
|
|
|
this.$router.push(this.$store.state.innerReferrer)
|
|
|
|
},
|
|
|
|
// 返回
|
|
|
|
back () {
|
|
|
|
// 更改了信息才需要提示
|
|
|
|
if (this.updateTime) {
|
|
|
|
this.$confirm('编辑的内容未保存,是否保存?', "提示", {
|
|
|
|
type: "warning",
|
|
|
|
closeOnClickModal: false
|
|
|
|
}).then(() => {
|
|
|
|
this.handleSubmit(this.projectManage.state)
|
|
|
|
}).catch(() => {
|
|
|
|
this.toList()
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
this.toList()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
/deep/ .readonly .ql-toolbar {
|
|
|
|
height: 0;
|
|
|
|
padding: 0;
|
|
|
|
border-bottom: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.main {
|
|
|
|
overflow: auto;
|
|
|
|
overflow-x: hidden;
|
|
|
|
height: calc(100vh - 161px);
|
|
|
|
}
|
|
|
|
</style>
|