parent
13ceb7ea8a
commit
121b50bc31
6 changed files with 317 additions and 487 deletions
@ -0,0 +1,169 @@ |
||||
<template> |
||||
<div> |
||||
<el-card shadow="hover" class="m-b-20"> |
||||
<div class="flex-between"> |
||||
<el-page-header @back="back" content="设置大赛内容"></el-page-header> |
||||
<div> |
||||
<el-button type="primary" @click="save">保存</el-button> |
||||
</div> |
||||
</div> |
||||
</el-card> |
||||
<el-card shadow="hover" class="m-b-20"> |
||||
<div> |
||||
<p class="m-b-20">比赛名称</p> |
||||
{{ form.stageName }} |
||||
</div> |
||||
</el-card> |
||||
<el-card shadow="hover" class="m-b-20"> |
||||
<div> |
||||
<p class="m-b-20">比赛时间</p> |
||||
<div class="date-inputs"> |
||||
起止时间: |
||||
<el-date-picker |
||||
v-model="form.time" |
||||
type="datetimerange" |
||||
range-separator="~" |
||||
start-placeholder="开始日期" |
||||
end-placeholder="结束日期" |
||||
format="yyyy-MM-dd HH:mm:ss" |
||||
value-format="yyyy-MM-dd HH:mm:ss"> |
||||
</el-date-picker> |
||||
</div> |
||||
</div> |
||||
</el-card> |
||||
<el-card shadow="hover" class="mgr20 m-b-20"> |
||||
<div> |
||||
<p class="m-b-20">课程</p> |
||||
<div class="inline-input"> |
||||
<el-select v-model="form.cid" @change="courseChange"> |
||||
<el-option |
||||
v-for="item in curriculumList" |
||||
:key="item.cid" |
||||
:label="item.curriculumName" |
||||
:value="item.cid"> |
||||
</el-option> |
||||
</el-select> |
||||
</div> |
||||
</div> |
||||
</el-card> |
||||
<el-card shadow="hover" class="m-b-20"> |
||||
<div class="flex-between m-b-20"> |
||||
<span>实训项目</span> |
||||
<div style="display: inline-flex;"> |
||||
<div> |
||||
<el-input placeholder="请输入项目名称" prefix-icon="el-icon-search" v-model.trim="keyword" clearable></el-input> |
||||
</div> |
||||
<el-button style="margin-left: 5px" type="primary" round>自定义实验项目</el-button> |
||||
</div> |
||||
</div> |
||||
<!-- 实训项目表格 --> |
||||
<el-table :data="projects" class="table" stripe header-align="center"> |
||||
<el-table-column width="60" label="选择" align="center"> |
||||
<template slot-scope="scope"> |
||||
<el-radio v-model="form.projectId" :label="scope.row.projectId"> </el-radio> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="projectName" label="项目名称" align="center"></el-table-column> |
||||
<el-table-column prop="auth" label="项目权限" align="center"> |
||||
<template slot-scope="scope"> |
||||
{{ permissionsKeys[scope.row.permissions] }} |
||||
</template> |
||||
</el-table-column> |
||||
<!-- <el-table-column prop="createUser" label="创建人" align="center"></el-table-column> --> |
||||
<el-table-column prop="founder" label="创建人" align="center"> |
||||
<template slot-scope="scope"> |
||||
{{ scope.row.createUser }} |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="createTime" label="创建时间" align="center"></el-table-column> |
||||
<!-- <el-table-column label="操作" align="center"> |
||||
<template slot-scope="scope"> |
||||
<el-button type="text" @click="showProject(scope.row)">查看</el-button> |
||||
</template> |
||||
</el-table-column> --> |
||||
</el-table> |
||||
<!-- <div class="pagination"> |
||||
<el-pagination |
||||
background |
||||
:page-size="pageSize" |
||||
@current-change="handleCurrentChange" |
||||
layout="total,prev, pager, next" |
||||
:total="total" |
||||
></el-pagination> |
||||
</div> --> |
||||
</el-card> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import util from "@/libs/util"; |
||||
export default { |
||||
props: ['form'], |
||||
data() { |
||||
return { |
||||
curriculumList: [], |
||||
keyword: '', |
||||
projects: [], |
||||
permissionsKeys: ['练习', '考核', '竞赛'], |
||||
}; |
||||
}, |
||||
watch: { |
||||
// 监听信息是否有更改,有的话页面离开的时候要询问是否要保存 |
||||
form: { |
||||
handler(){ |
||||
this.updateTime++ |
||||
}, |
||||
deep:true |
||||
}, |
||||
}, |
||||
mounted() { |
||||
this.getCourse() |
||||
}, |
||||
methods: { |
||||
// 获取课程 |
||||
getCourse() { |
||||
const sid = this.$store.state.dataPer.find(e => e.permissionName === '课程管理') |
||||
this.$post(this.api.curriculumList, { |
||||
isShelves: 1, |
||||
pageNum: 1, |
||||
pageSize: 10000, |
||||
supplierId: sid ? sid.supplierId : '' |
||||
}).then(({ page }) => { |
||||
this.curriculumList = page.records |
||||
}).catch(err => {}); |
||||
}, |
||||
// 课程选择回调 |
||||
courseChange() { |
||||
const { sysId, sysName } = this.curriculumList.find(e => e.cid == this.form.cid) |
||||
this.form.sysName = sysName |
||||
this.$get(this.api.getInternalProjectBySystemId, { |
||||
permissions: 2, |
||||
systemId: sysId |
||||
}).then(res => { |
||||
this.projects = res |
||||
}).catch(err => {}); |
||||
}, |
||||
// 提交 |
||||
save() { |
||||
const { form } = this |
||||
if (!form.time.length) return util.warningMsg('请选择比赛时间') |
||||
if (!form.cid) return util.warningMsg('请选择课程') |
||||
if (!form.projectId) return util.warningMsg('请选择项目') |
||||
const { systemId, projectName } = this.projects.find(e => e.projectId == form.projectId) |
||||
form.systemId = systemId |
||||
form.projectName = projectName |
||||
form.startTime = form.time[0] |
||||
form.endTime = form.time[1] |
||||
this.$emit('hideSet', this.form) |
||||
}, |
||||
// 返回 |
||||
back() { |
||||
this.$emit('hideSet') |
||||
} |
||||
} |
||||
}; |
||||
</script> |
||||
|
||||
<style scoped lang="scss"> |
||||
|
||||
</style> |
Loading…
Reference in new issue