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

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> <script>
import Step1 from './form/ProjectForm' import Step1 from './form/ProjectForm'
import Step2 from './form/ProjectUnitSelect' import Step2 from './form/ProjectUnitSelect'
import Step3 from './form/ProjectCourseSelect' import Step3 from './form/ProjectCourseList'
export default { export default {
components: { components: {
@ -82,6 +82,7 @@ export default {
}, },
// //
prevStep () { prevStep () {
console.log("返回上一步")
if (this.currentTab > 0) { if (this.currentTab > 0) {
this.currentTab -= 1 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> <template>
<a-form-model :model="form" :label-col="labelCol" :wrapper-col="wrapperCol" :layout="vertical"> <a-modal
<a-space direction="vertical" style="width: 100%"> :title="modalTitle"
<a-space direction="horizontal"> :width="1000"
<span>总课时{{ totalHours }}, 总学时要求{{ totalLearnHours }}, 总题目数量{{ totalTopicNum }} </span> :visible="visible"
课程名: :confirmLoading="confirmLoading"
<a-input v-model="queryParam.projectName" style="width: 100%" /> :destroyOnClose="true"
<a-button type="primary" icon="search" @click="$refs.table.refresh(true)">查询</a-button> @ok="handleSubmit"
<a-button icon="select" @click="() => (queryParam = {})">添加课程</a-button> @cancel="handleCancel"
</a-space>
<s-table
ref="table"
size="default"
rowKey="id"
:columns="columns"
:data="loadData"
> >
<span slot="serial" slot-scope="text, record, index"> <a-layout>
{{ index + 1 }} <a-layout-sider>
</span> <a-menu v-model="current" mode="horizontal">
<span slot="action" slot-scope="text, record" > <a-menu-item key="mail"> <a-icon type="mail" />系统课程</a-menu-item>
<template> <a-menu-item key="app"> <a-icon type="appstore" />自制课程</a-menu-item>
<a-button type="primary" @click="$refs.table.refresh(true)">课程预览</a-button> </a-menu>
<a-button type="primary" @click="$refs.table.refresh(true)">题库预览</a-button> </a-layout-sider>
<a-button type="primary" @click="$refs.table.refresh(true)">必选题设置</a-button> <a-layout>
<a-popconfirm title="是否删除?" @confirm="() => handleDelete(record)"> <a-layout-content>Content</a-layout-content>
<a-button type="primary" @click="$refs.table.refresh(true)">删除</a-button> </a-layout>
</a-popconfirm> </a-layout>
</template> </a-modal>
</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>
</template> </template>
<script> <script>
//jsjsjson //jsjsjson
//import from '' //import from ''
import { STable } from '@/components'
export default { export default {
//import使 //import使
components: { components: {},
STable,
},
props: {}, props: {},
data() { data() {
// //
return { return {
form: this.$form.createForm(this, { name: 'project' }), visible: false,
totalHours: 0, // confirmLoading: false,
totalLearnHours: 0, // current: ['mail'],
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 // data
@ -88,22 +44,25 @@ export default {
watch: {}, watch: {},
// //
methods: { methods: {
toNext() { //
console.log('ProjectCourseSelect-toNext', this.form) edit(record) {
const { console.log(record)
form: { validateFields }, this.modalTitle = '选择课程'
} = this this.visible = true
// this.formLoading = false
validateFields((err, values) => { },
if (!err) { handleCancel() {
this.$emit('nextStep') console.log('课程选择关闭')
} this.visible = false
}) this.formLoading = false
},
handleSubmit() {
console.log('课程选择提交了')
this.visible = false
this.formLoading = false
}, },
}, },
created() {}, // - 访this
// - 访this
created() {},
mounted() {}, // - 访DOM mounted() {}, // - 访DOM
beforeCreate() {}, // - beforeCreate() {}, // -
beforeMount() {}, // - beforeMount() {}, // -
@ -115,4 +74,24 @@ export default {
} }
</script> </script>
<style scoped> <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> </style>

View File

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

View File

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