|
|
@ -5,7 +5,7 @@ |
|
|
|
<div class="flex-between"> |
|
|
|
<div class="flex-between"> |
|
|
|
<el-page-header @back="goBack" :content="isDetail ? '查看' : (form.id ? '更新' : '创建') + '教学实验'"></el-page-header> |
|
|
|
<el-page-header @back="goBack" :content="isDetail ? '查看' : (form.id ? '更新' : '创建') + '教学实验'"></el-page-header> |
|
|
|
<div> |
|
|
|
<div> |
|
|
|
<el-button type="primary" @click="upload" v-show="!isDetail">{{ form.id ? "更新" : "创建" }}</el-button> |
|
|
|
<el-button type="primary" @click="submit" v-show="!isDetail">{{ form.id ? "更新" : "创建" }}</el-button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</el-card> |
|
|
|
</el-card> |
|
|
@ -39,11 +39,11 @@ |
|
|
|
<!-- 手动发布显示 --> |
|
|
|
<!-- 手动发布显示 --> |
|
|
|
<div class="date-inputs" v-if="form.type==1"> |
|
|
|
<div class="date-inputs" v-if="form.type==1"> |
|
|
|
实验时长: |
|
|
|
实验时长: |
|
|
|
<el-input type="number" v-model.trim="duration.day" placeholder></el-input> |
|
|
|
<el-input type="number" min="0" v-model.trim="duration.day" placeholder></el-input> |
|
|
|
天 |
|
|
|
天 |
|
|
|
<el-input type="number" v-model.trim="duration.hour" placeholder></el-input> |
|
|
|
<el-input type="number" min="0" v-model.trim="duration.hour" placeholder></el-input> |
|
|
|
小时 |
|
|
|
小时 |
|
|
|
<el-input type="number" v-model.trim="duration.minute" placeholder></el-input> |
|
|
|
<el-input type="number" min="0" v-model.trim="duration.minute" placeholder></el-input> |
|
|
|
分 |
|
|
|
分 |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<!-- 定时发布显示 --> |
|
|
|
<!-- 定时发布显示 --> |
|
|
@ -255,7 +255,8 @@ export default { |
|
|
|
total: 0, |
|
|
|
total: 0, |
|
|
|
isToProject: false, |
|
|
|
isToProject: false, |
|
|
|
systemList: [], |
|
|
|
systemList: [], |
|
|
|
submiting: false // 新增编辑防抖标识 |
|
|
|
submiting: false, // 新增编辑防抖标识 |
|
|
|
|
|
|
|
updateTime: 0 |
|
|
|
}; |
|
|
|
}; |
|
|
|
}, |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
computed: { |
|
|
@ -273,6 +274,13 @@ export default { |
|
|
|
if (!this.isToProject) this.setAss({}); |
|
|
|
if (!this.isToProject) this.setAss({}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
watch: { |
|
|
|
watch: { |
|
|
|
|
|
|
|
// 监听信息是否有更改,有的话页面离开的时候要询问是否要保存 |
|
|
|
|
|
|
|
form: { |
|
|
|
|
|
|
|
handler(val){ |
|
|
|
|
|
|
|
this.updateTime++ |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
deep:true |
|
|
|
|
|
|
|
}, |
|
|
|
date: function(val) { |
|
|
|
date: function(val) { |
|
|
|
if (val[0] != "0000-00-00 00:00:00") { |
|
|
|
if (val[0] != "0000-00-00 00:00:00") { |
|
|
|
this.startTime = util.formatDate("yyyy-MM-dd hh:mm:ss", new Date(val[0])); |
|
|
|
this.startTime = util.formatDate("yyyy-MM-dd hh:mm:ss", new Date(val[0])); |
|
|
@ -420,7 +428,7 @@ export default { |
|
|
|
this.page = 1; |
|
|
|
this.page = 1; |
|
|
|
this.getProjectData(); |
|
|
|
this.getProjectData(); |
|
|
|
}, |
|
|
|
}, |
|
|
|
upload() { // 提交 |
|
|
|
submit() { // 提交 |
|
|
|
if (this.submiting) return false |
|
|
|
if (this.submiting) return false |
|
|
|
if (!this.form.experimentalName) return util.warningMsg("请填写考核名称"); |
|
|
|
if (!this.form.experimentalName) return util.warningMsg("请填写考核名称"); |
|
|
|
if (this.expNameRepeat) return util.warningMsg("考核名称重复,请重新输入"); |
|
|
|
if (this.expNameRepeat) return util.warningMsg("考核名称重复,请重新输入"); |
|
|
@ -435,17 +443,19 @@ export default { |
|
|
|
if (this.form.type == 1 && this.form.experimentDuration == "0d0h0m") return util.warningMsg("请填写实验时长"); |
|
|
|
if (this.form.type == 1 && this.form.experimentDuration == "0d0h0m") return util.warningMsg("请填写实验时长"); |
|
|
|
if (this.form.type == 2 && this.startTime == "0000-00-00 00:00:00") return util.warningMsg("请填写实验时间"); |
|
|
|
if (this.form.type == 2 && this.startTime == "0000-00-00 00:00:00") return util.warningMsg("请填写实验时间"); |
|
|
|
if (this.form.type == 1) { |
|
|
|
if (this.form.type == 1) { |
|
|
|
const duration = this.duration |
|
|
|
const { day, hour, minute } = this.duration |
|
|
|
if (String(duration.day).includes('.')) return util.warningMsg('实验天数请填写整数') |
|
|
|
if (String(day).includes('.')) return util.warningMsg('实验天数请填写整数') |
|
|
|
if (String(duration.hour).includes('.')) return util.warningMsg('实验小时请填写整数') |
|
|
|
if (day < 0) return util.warningMsg('实验天数请勿填写负数') |
|
|
|
if (String(duration.minute).includes('.')) return util.warningMsg('实验分钟请填写整数') |
|
|
|
if (String(hour).includes('.')) return util.warningMsg('实验小时请填写整数') |
|
|
|
|
|
|
|
if (hour < 0) return util.warningMsg('实验小时请勿填写负数') |
|
|
|
|
|
|
|
if (String(minute).includes('.')) return util.warningMsg('实验分钟请填写整数') |
|
|
|
|
|
|
|
if (minute < 0) return util.warningMsg('实验分钟请勿填写负数') |
|
|
|
} |
|
|
|
} |
|
|
|
if (!this.form.projectId) return util.warningMsg("请选择实训项目"); |
|
|
|
if (!this.form.projectId) return util.warningMsg("请选择实训项目"); |
|
|
|
if (this.form.isSpecify == 0 && this.form.isEnableCode == 1) { |
|
|
|
if (this.form.isSpecify == 0 && this.form.isEnableCode == 1) { |
|
|
|
if (!this.form.invitationCode) return util.warningMsg("请设置邀请码"); |
|
|
|
if (!this.form.invitationCode) return util.warningMsg("请设置邀请码"); |
|
|
|
if (!this.form.invitationCode || String(this.form.invitationCode).length < 6 || isNaN(this.form.invitationCode)) return util.warningMsg("请输入6位纯数字邀请码"); |
|
|
|
if (!this.form.invitationCode || String(this.form.invitationCode).length < 6 || isNaN(this.form.invitationCode)) return util.warningMsg("请输入6位纯数字邀请码"); |
|
|
|
} |
|
|
|
} |
|
|
|
debugger |
|
|
|
|
|
|
|
if (this.form.type == 2) { |
|
|
|
if (this.form.type == 2) { |
|
|
|
this.form.startTime = this.startTime; |
|
|
|
this.form.startTime = this.startTime; |
|
|
|
this.form.stopTime = this.stopTime; |
|
|
|
this.form.stopTime = this.stopTime; |
|
|
@ -549,13 +559,24 @@ export default { |
|
|
|
this.page = val; |
|
|
|
this.page = val; |
|
|
|
this.getProjectData(); |
|
|
|
this.getProjectData(); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
// 返回上一页 |
|
|
|
|
|
|
|
backPage() { |
|
|
|
|
|
|
|
this.$router.back() |
|
|
|
|
|
|
|
}, |
|
|
|
goBack() { |
|
|
|
goBack() { |
|
|
|
if (this.isDetail) { |
|
|
|
const { id } = this.form |
|
|
|
this.$router.back(); |
|
|
|
const updateTime = this.updateTime |
|
|
|
|
|
|
|
// 更改了信息才需要提示 |
|
|
|
|
|
|
|
if (updateTime > 1) { |
|
|
|
|
|
|
|
this.$confirm(`编辑的内容未保存,是否保存?`, '提示', { |
|
|
|
|
|
|
|
type: 'warning' |
|
|
|
|
|
|
|
}).then(() => { |
|
|
|
|
|
|
|
this.submit() |
|
|
|
|
|
|
|
}).catch(() => { |
|
|
|
|
|
|
|
this.backPage() |
|
|
|
|
|
|
|
}) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
this.$confirm("确定返回?未更新的信息将不会保存。", "提示", { type: "warning" }).then(() => { |
|
|
|
this.backPage() |
|
|
|
this.$router.back(); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|