项目管理更新

This commit is contained in:
Yuanjianghong 2021-11-16 18:05:57 +08:00
parent 0ee7f728f9
commit c55c81c701
5 changed files with 126 additions and 91 deletions

View File

@ -8,14 +8,23 @@ const projectCourseApi = {
// del: 'sys/menu/delete', // del: 'sys/menu/delete',
// // updateStatus: 'sys/menu/updateStatus', // // updateStatus: 'sys/menu/updateStatus',
// list: 'project/pageList', // list: 'project/pageList',
projectCourseList: '/project/course/list' projectCourseList: '/project/course/list',
courseList: '/project/course/listByCourseIds'
} }
/** 通过项目id查询 */
export function getCourseList (params) { export function getCourseList (params) {
// console.log("------------{}",params)
return request({ return request({
url: projectCourseApi.projectCourseList, url: projectCourseApi.projectCourseList,
method: 'get', method: 'get',
params: params params: params
}) })
} }
/** 通过课程列表查询 */
export function getCourseListByCourseIds (params) {
return request({
url: projectCourseApi.courseList,
method: 'Post',
params: params
})
}

View File

@ -1,36 +1,50 @@
<template> <template>
<a-form-model :model="form" :label-col="labelCol" :wrapper-col="wrapperCol" :layout="vertical"> <a-space direction="vertical" style="width: 100%">
<a-space direction="vertical" style="width: 100%"> <a-space direction="horizontal">
<a-space direction="horizontal"> <span>总课时{{ totalHours }}, 总学时要求{{ totalLearnHours }}, 总题目数量{{ totalTopicNum }} </span>
<span>总课时{{ totalHours }}, 总学时要求{{ totalLearnHours }}, 总题目数量{{ totalTopicNum }} </span> 课程名:
课程名: <a-input v-model="queryParam.courseName" style="width: 100%" />
<a-input v-model="queryParam.projectName" style="width: 100%" /> <a-button type="primary" icon="search" @click="$refs.table.refresh(true)">查询</a-button>
<a-button type="primary" icon="search" @click="$refs.table.refresh(true)">查询</a-button> <a-button icon="select" @click="$refs.CourseSelect.edit({})">添加课程</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="data1">
<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(false)">课程预览</a-button>
<a-button type="primary" @click="$refs.table.refresh(false)">题库预览</a-button>
<a-button type="primary" @click="$refs.table.refresh(false)">必选题设置</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> </a-space>
<s-table ref="table" size="default" rowKey="id" :columns="columns" :data="loadData" :showPagination="false">
<span slot="serial" slot-scope="text, record, index">
{{ index + 1 }}
</span>
<span slot="action" slot-scope="text, record">
<template>
<a-dropdown>
<a class="ant-dropdown-link"
>操作
<a-icon type="down" />
</a>
<a-menu slot="overlay">
<a-menu-item>
<a href="javascript:;" @click="$refs.table.refresh(false)">课程预览</a>
</a-menu-item>
<a-menu-item>
<a href="javascript:;" @click="$refs.table.refresh(false)">题库预览</a>
</a-menu-item>
<a-menu-item>
<a href="javascript:;" @click="$refs.table.refresh(false)">必选题设置</a>
</a-menu-item>
<a-menu-item>
<a-popconfirm title="是否删除?" @confirm="() => handleDelete(record)">
<a href="javascript:;" @click="$refs.table.refresh(true)">删除</a>
</a-popconfirm>
</a-menu-item>
</a-menu>
</a-dropdown>
</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>
<project-course-select ref="CourseSelect"></project-course-select> <project-course-select ref="CourseSelect"></project-course-select>
</a-form-model> </a-space>
</template> </template>
<script> <script>
@ -38,19 +52,19 @@
//import from 's' //import from 's'
import { STable } from '@/components' import { STable } from '@/components'
import ProjectCourseSelect from './ProjectCourseSelect.vue' import ProjectCourseSelect from './ProjectCourseSelect.vue'
import { getCourseList } from '@/api/project/projectCourse' import { getCourseList, getCourseListByCourseIds } from '@/api/project/projectCourse'
export default { export default {
//import使 //import使
components: { components: {
STable, STable,
ProjectCourseSelect, ProjectCourseSelect,
getCourseList,
}, },
props: {}, props: {},
data() { data() {
// //
return { return {
form: {},
labelCol: {}, labelCol: {},
wrapperCol: {}, wrapperCol: {},
vertical: 'vertical', vertical: 'vertical',
@ -58,8 +72,8 @@ export default {
totalLearnHours: 0, // totalLearnHours: 0, //
totalTopicNum: 0, // totalTopicNum: 0, //
queryParam: { queryParam: {
id: 1, ids: '1,2,3',
},// }, //
columns: [ columns: [
{ title: '序号', key: 'id', dataIndex: 'id', width: 60, scopedSlots: { customRender: 'serial' } }, { title: '序号', key: 'id', dataIndex: 'id', width: 60, scopedSlots: { customRender: 'serial' } },
{ title: '课程编号', dataIndex: 'courseNo', key: 'courseNo' }, { title: '课程编号', dataIndex: 'courseNo', key: 'courseNo' },
@ -67,10 +81,22 @@ export default {
{ title: '课时', dataIndex: 'courseHours', key: 'courseHours', customRender: (text) => text + '分' }, { title: '课时', dataIndex: 'courseHours', key: 'courseHours', customRender: (text) => text + '分' },
{ title: '学时要求', dataIndex: 'learnHours', key: 'learnHours', customRender: (text) => text + '分' }, { title: '学时要求', dataIndex: 'learnHours', key: 'learnHours', customRender: (text) => text + '分' },
{ title: '题量', dataIndex: 'topicNumber', key: 'topicNumber' }, { title: '题量', dataIndex: 'topicNumber', key: 'topicNumber' },
{ title: '项目名称', dataIndex: 'projectName', key: 'projectName' }, // { title: '', dataIndex: 'projectName', key: 'projectName' },
{ title: '操作', width: 200, align: 'center', scopedSlots: { customRender: 'action' }, }, { title: '操作', width: 200, align: 'center', scopedSlots: { customRender: 'action' } },
], // ], //
loadData: parameter => { return getCourseList(Object.assign(parameter, this.queryParam)).then(res => { return res }) } loadData: (parameter) => {
if (this.$route.query.projectId) {
/** 编辑进来的有项目id */
return getCourseList(this.$route.query.projectId).then((res) => {
return res.data
})
} else {
/** 新建的没有项目id传当前的所选的课程id */
return getCourseListByCourseIds(Object.assign(parameter, this.queryParam)).then((res) => {
return res.data
})
}
},
} }
}, },
// data // data
@ -82,29 +108,38 @@ export default {
toNext() { toNext() {
console.log('ProjectCourseSelect-toNext', this.form) console.log('ProjectCourseSelect-toNext', this.form)
this.$emit('nextStep') this.$emit('nextStep')
//
// validateFields((err, values) => {
// if (!err) {
// }
// })
}, },
toPrep() { toPrep() {
console.log('toPrep', this.form) console.log('toPrep', this.form)
this.$emit('prevStep', this.form) this.$emit('prevStep', this.form)
}, },
getProjectCourseList(){ /**查询了列表数据 */
getCourseList(this.queryParam).then((res) => { getProjectCourseList() {
if(res.code == 200){ // if (this.$route.query.projectId) {
this.data1 = res.rows; // /** id */
} // getCourseList(this.$route.query.projectId).then((res) => {
}) // if (res.code == 200) {
} // // this.data1 = res.data
// return res
// }
// })
// } else {
// /** idid */
// getCourseListByCourseIds(this.queryParam.ids.join(',')).then((res)=>{
// if (res.code == 200) {
// // this.data1 = res.data
// // console.log(this.data1)
// return res
// }
// })
// }
},
}, },
// - 访this // - 访this
created() {}, created() {
// this.getProjectCourseList()
},
mounted() {}, // - 访DOM mounted() {}, // - 访DOM
beforeCreate() {}, // - beforeCreate() {}, // -
beforeMount() {}, // - beforeMount() {}, // -

View File

@ -84,26 +84,10 @@ import difference from 'lodash/difference'
// const coData = []; // const coData = [];
const leftTableColumns = [ const leftTableColumns = [{dataIndex: 'courseCode', title: '课程编号', },{dataIndex: 'courseName', title: '课程名称', },]
{ const rightTableColumns = [ {dataIndex: 'courseCode',title: '课程编号',},{dataIndex: 'courseName',title: '课程名称',},]
dataIndex: 'courseCode',
title: '课程编号',
},
{
dataIndex: 'courseName',
title: '课程名称',
},
]
const rightTableColumns = [
{
dataIndex: 'courseCode',
title: '课程编号',
},
{
dataIndex: 'courseName',
title: '课程名称',
},
]
export default { export default {
//import使 //import使
@ -132,7 +116,7 @@ export default {
courseList: { courseList: {
queryParam: {}, queryParam: {},
courseData: [], courseData: [],
targetKeys: originTargetKeys, targetKeys: [],
selectedKeys: [], selectedKeys: [],
disabled: false, disabled: false,
leftColumns: leftTableColumns, leftColumns: leftTableColumns,
@ -162,6 +146,8 @@ export default {
console.log('课程选择提交了') console.log('课程选择提交了')
this.visible = false this.visible = false
this.formLoading = false this.formLoading = false
this.$parent.queryParam.ids = this.courseList.selectedKeys.join(",")
this.$parent.$refs.table.refresh(true);
}, },
onExpand(expandedKeys) { onExpand(expandedKeys) {
this.expandedKeys = expandedKeys this.expandedKeys = expandedKeys

View File

@ -2,8 +2,14 @@
<a-form-model :model="form" :label-col="labelCol" :wrapper-col="wrapperCol" layout="horizontal"> <a-form-model :model="form" :label-col="labelCol" :wrapper-col="wrapperCol" layout="horizontal">
<div> <div>
<a-row type="flex" justify="center" align="top"> <a-row type="flex" justify="center" align="top">
<a-col :span="4" id="tree"> </a-col> <a-col :span="4" id="tree">
<a-col :span="20" id="content"> </a-col> <a-tree>
</a-tree>
</a-col>
<a-col :span="20" id="content">
<h1>人员选择</h1>
</a-col>
</a-row> </a-row>
<a-button type="primary" @click="toNext">下一步</a-button> <a-button type="primary" @click="toNext">下一步</a-button>
<a-button type="primary" @click="toPrev">上一步</a-button> <a-button type="primary" @click="toPrev">上一步</a-button>
@ -59,14 +65,12 @@ export default {
</script> </script>
<style scoped> <style scoped>
#tree { #tree {
width: 100%; height: 750px;
height: 100%;
background-color: beige; background-color: beige;
} }
#content { #content {
width: 100%; height: 750px;
height: 100%;
background-color: bisque; background-color: bisque;
} }
/* /project/form/ProjectPersonForm.vue */ /* /project/form/ProjectPersonForm.vue */

View File

@ -138,15 +138,16 @@ export default {
methods: { methods: {
toNext() { toNext() {
console.log('toNext', this.form) console.log('toNext', this.form)
const { this.$emit('nextStep',this.form)
form: { validateFields }, // const {
} = this // form: { validateFields },
// // } = this
validateFields((err, values) => { // //
if (!err) { // validateFields((err, values) => {
this.$emit('nextStep',this.form) // if (!err) {
} // this.$emit('nextStep',this.form)
}) // }
// })
}, },
toPrep() { toPrep() {
console.log('toPrep', this.form) console.log('toPrep', this.form)