项目管理新增选择课程页面

This commit is contained in:
Yuanjianghong 2021-09-10 18:27:25 +08:00
parent 085e040ed2
commit a4ed1960f2
5 changed files with 188 additions and 86 deletions

View File

@ -32,7 +32,7 @@
<script>
import Step1 from './form/ProjectForm'
import Step2 from './form/ProjectUnitSelect'
import Step3 from './form/ProjectCourseSelect'
import Step3 from './form/ProjectCourseList'
export default {
components: {
@ -82,6 +82,7 @@ export default {
},
//
prevStep () {
console.log("返回上一步")
if (this.currentTab > 0) {
this.currentTab -= 1
}

View File

@ -0,0 +1,119 @@
<template>
<a-form-model :model="form" :label-col="labelCol" :wrapper-col="wrapperCol" :layout="vertical">
<a-space direction="vertical" style="width: 100%">
<a-space direction="horizontal">
<span>总课时{{ totalHours }}, 总学时要求{{ totalLearnHours }}, 总题目数量{{ totalTopicNum }} </span>
课程名:
<a-input v-model="queryParam.projectName" style="width: 100%" />
<a-button type="primary" icon="search" @click="$refs.table.refresh(true)">查询</a-button>
<a-button icon="select" @click="$refs.CourseSelect.edit({})">添加课程</a-button>
</a-space>
<s-table ref="table" size="default" rowKey="id" :columns="columns" :data="loadData">
<span slot="serial" slot-scope="text, record, index">
{{ index + 1 }}
</span>
<span slot="action" slot-scope="text, record">
<template>
<a-button type="primary" @click="$refs.table.refresh(true)">课程预览</a-button>
<a-button type="primary" @click="$refs.table.refresh(true)">题库预览</a-button>
<a-button type="primary" @click="$refs.table.refresh(true)">必选题设置</a-button>
<a-popconfirm title="是否删除?" @confirm="() => handleDelete(record)">
<a-button type="primary" @click="$refs.table.refresh(true)">删除</a-button>
</a-popconfirm>
</template>
</span>
</s-table>
<a-form-model-item :wrapper-col="{ span: 14, offset: 4 }">
<a-button type="primary" @click="toNext"> 下一步 </a-button>
<a-button style="margin-left: 10px" @click="toPrep"> 上一步 </a-button>
</a-form-model-item>
</a-space>
<project-course-select ref="CourseSelect"></project-course-select>
</a-form-model>
</template>
<script>
//jsjsjson
//import from ''
import { STable } from '@/components'
import ProjectCourseSelect from './ProjectCourseSelect.vue'
export default {
//import使
components: {
STable,
ProjectCourseSelect,
},
props: {},
data() {
//
return {
form: this.$form.createForm(this, { name: 'project' }),
totalHours: 0, //
totalLearnHours: 0, //
totalTopicNum: 0, //
//
queryParam: {},
//
columns: [
{ title: '序号', key: 'id', dataIndex: 'id', width: 60, scopedSlots: { customRender: 'serial' } },
{ title: '课程编号', dataIndex: 'courseNo', key: 'courseNo' },
{ title: '课程名称', dataIndex: 'courseName', key: 'courseName' },
{ title: '课时', dataIndex: 'courseHours', key: 'courseHours', customRender: (text) => text + '分' },
{ title: '学时要求', dataIndex: 'learnHours', key: 'learnHours', customRender: (text) => text + '分' },
{ title: '题量', dataIndex: 'topicNumber', key: 'projectName' },
{ title: '项目名称', dataIndex: 'projectName', key: 'projectName' },
{
title: '操作',
width: 200,
align: 'center',
scopedSlots: { customRender: 'action' },
},
],
// Promise
loadData: (parameter) => {
return getProjectList(Object.assign(parameter, this.queryParam)).then((res) => {
return res
})
},
}
},
// data
computed: {},
//data
watch: {},
//
methods: {
toNext() {
console.log('ProjectCourseSelect-toNext', this.form)
const {
form: { validateFields },
} = this
//
validateFields((err, values) => {
if (!err) {
this.$emit('nextStep')
}
})
},
toPrep() {
console.log('toPrep', this.form)
this.$emit('prevStep', this.form)
},
},
// - 访this
created() {},
mounted() {}, // - 访DOM
beforeCreate() {}, // -
beforeMount() {}, // -
beforeUpdate() {}, // -
updated() {}, // -
beforeDestroy() {}, // -
destroyed() {}, // -
activated() {}, //keep-alive
}
</script>
<style scoped>
</style>

View File

@ -1,85 +1,41 @@
<template>
<a-form-model :model="form" :label-col="labelCol" :wrapper-col="wrapperCol" :layout="vertical">
<a-space direction="vertical" style="width: 100%">
<a-space direction="horizontal">
<span>总课时{{ totalHours }}, 总学时要求{{ totalLearnHours }}, 总题目数量{{ totalTopicNum }} </span>
课程名:
<a-input v-model="queryParam.projectName" style="width: 100%" />
<a-button type="primary" icon="search" @click="$refs.table.refresh(true)">查询</a-button>
<a-button icon="select" @click="() => (queryParam = {})">添加课程</a-button>
</a-space>
<s-table
ref="table"
size="default"
rowKey="id"
:columns="columns"
:data="loadData"
<a-modal
:title="modalTitle"
:width="1000"
:visible="visible"
:confirmLoading="confirmLoading"
:destroyOnClose="true"
@ok="handleSubmit"
@cancel="handleCancel"
>
<span slot="serial" slot-scope="text, record, index">
{{ index + 1 }}
</span>
<span slot="action" slot-scope="text, record" >
<template>
<a-button type="primary" @click="$refs.table.refresh(true)">课程预览</a-button>
<a-button type="primary" @click="$refs.table.refresh(true)">题库预览</a-button>
<a-button type="primary" @click="$refs.table.refresh(true)">必选题设置</a-button>
<a-popconfirm title="是否删除?" @confirm="() => handleDelete(record)">
<a-button type="primary" @click="$refs.table.refresh(true)">删除</a-button>
</a-popconfirm>
</template>
</span>
</s-table>
<a-form-model-item :wrapper-col="{ span: 14, offset: 4 }">
<a-button type="primary" @click="toNext"> 下一步 </a-button>
<a-button style="margin-left: 10px"> 取消 </a-button>
</a-form-model-item>
</a-space>
</a-form-model>
<a-layout>
<a-layout-sider>
<a-menu v-model="current" mode="horizontal">
<a-menu-item key="mail"> <a-icon type="mail" />系统课程</a-menu-item>
<a-menu-item key="app"> <a-icon type="appstore" />自制课程</a-menu-item>
</a-menu>
</a-layout-sider>
<a-layout>
<a-layout-content>Content</a-layout-content>
</a-layout>
</a-layout>
</a-modal>
</template>
<script>
//jsjsjson
//import from ''
import { STable } from '@/components'
export default {
//import使
components: {
STable,
},
components: {},
props: {},
data() {
//
return {
form: this.$form.createForm(this, { name: 'project' }),
totalHours: 0, //
totalLearnHours: 0, //
totalTopicNum: 0, //
//
queryParam: {},
//
columns: [
{ title: '序号', key: 'id', dataIndex: 'id', width: 60, scopedSlots: { customRender: 'serial' } },
{ title: '课程编号', dataIndex: 'courseNo', key: 'courseNo' },
{ title: '课程名称', dataIndex: 'courseName', key: 'courseName' },
{ title: '课时', dataIndex: 'courseHours', key: 'courseHours', customRender: (text) => text + '分' },
{ title: '学时要求', dataIndex: 'learnHours', key: 'learnHours', customRender: (text) => text + '分' },
{ title: '题量', dataIndex: 'topicNumber', key: 'projectName' },
{ title: '项目名称', dataIndex: 'projectName', key: 'projectName' },
{
title: '操作',
width: 200,
align: 'center',
scopedSlots: { customRender: 'action' },
},
],
// Promise
loadData: (parameter) => {
return getProjectList(Object.assign(parameter, this.queryParam)).then((res) => {
return res
})
},
visible: false,
confirmLoading: false,
current: ['mail'],
}
},
// data
@ -88,22 +44,25 @@ export default {
watch: {},
//
methods: {
toNext() {
console.log('ProjectCourseSelect-toNext', this.form)
const {
form: { validateFields },
} = this
//
validateFields((err, values) => {
if (!err) {
this.$emit('nextStep')
}
})
//
edit(record) {
console.log(record)
this.modalTitle = '选择课程'
this.visible = true
this.formLoading = false
},
handleCancel() {
console.log('课程选择关闭')
this.visible = false
this.formLoading = false
},
handleSubmit() {
console.log('课程选择提交了')
this.visible = false
this.formLoading = false
},
},
// - 访this
created() {},
created() {}, // - 访this
mounted() {}, // - 访DOM
beforeCreate() {}, // -
beforeMount() {}, // -
@ -115,4 +74,24 @@ export default {
}
</script>
<style scoped>
#components-layout-demo-basic {
text-align: center;
}
#components-layout-demo-basic .ant-layout-sider {
background: #3ba0e9;
color: #fff;
line-height: 150px;
}
#components-layout-demo-basic .ant-layout-content {
background: rgba(16, 142, 233, 1);
color: #fff;
min-height: 1100px;
line-height: 120px;
}
#components-layout-demo-basic > .ant-layout {
margin-bottom: 48px;
}
#components-layout-demo-basic > .ant-layout:last-child {
margin: 0;
}
</style>

View File

@ -112,7 +112,6 @@
<a-col :span="24">
<a-form-model-item :wrapper-col="{ span: 14, offset: 4 }">
<a-button type="primary" @click="toNext"> 下一步 </a-button>
<a-button style="margin-left: 10px" @click="toNext"> 上一步 </a-button>
</a-form-model-item>
</a-col>
</a-row>

View File

@ -38,7 +38,7 @@
</a-transfer>
<a-form-model-item :wrapper-col="{ span: 14, offset: 4 }">
<a-button type="primary" @click="toNext"> 下一步 </a-button>
<a-button style="margin-left: 10px"> 取消 </a-button>
<a-button style="margin-left: 10px" @click="toPrep">上一步</a-button>
</a-form-model-item>
</a-form-model>
</template>
@ -140,6 +140,10 @@ export default {
}
})
},
toPrep() {
console.log('toPrep', this.form)
this.$emit('prevStep',this.form)
},
onChange(targetKeys) {
console.log('Target Keys:', targetKeys)
this.targetKeys = targetKeys