项目管理表单调整

This commit is contained in:
Yuanjianghong 2021-11-29 15:00:00 +08:00
parent d966101089
commit 1dd3235872
6 changed files with 84 additions and 50 deletions

View File

@ -4,7 +4,8 @@ const projectApi = {
add: 'project/add', add: 'project/add',
getDict:'project/dict/get', getDict:'project/dict/get',
list: 'project/pageList', list: 'project/pageList',
projectCourseList: '' get: 'project/get',
projectCourseList: '',
} }
export function projectAdd (params) { export function projectAdd (params) {
@ -21,6 +22,7 @@ export function dictGet (params) {
params: params params: params
}) })
} }
export function getProjectList (params) { export function getProjectList (params) {
return request({ return request({
url: projectApi.list, url: projectApi.list,
@ -28,3 +30,13 @@ export function getProjectList (params) {
params: params params: params
}) })
} }
export function getProjectDetail (params) {
return request({
url: projectApi.get,
method: 'get',
params: params
})
}

View File

@ -48,13 +48,13 @@
</span> </span>
<span slot="action" slot-scope="text, record"> <span slot="action" slot-scope="text, record">
<template> <template>
<a v-if="hasPerm('project:edit')" href="javascript:;" @click="$refs.projectStepForm.edit(record)">修改</a> <a v-if="hasPerm('project:edit')" href="javascript:;" @click="handledCreate(record)">修改</a>
<a-divider type="vertical" /> <a-divider type="vertical" />
<a-popconfirm title="是否删除?" @confirm="() => handleDelete(record)"> <a-popconfirm title="是否删除?" @confirm="() => handleDelete(record)">
<a v-if="hasPerm('project:del')" href="javascript:;">删除</a> <a v-if="hasPerm('project:del')" href="javascript:;">删除</a>
</a-popconfirm> </a-popconfirm>
<a-divider type="vertical" /> <a-divider type="vertical" />
<a href="javascript:;" @click="handleDetail(record)">详情</a> <a v-if="hasPerm('project:list')" href="javascript:;" @click="handleDetail(record)">详情</a>
<a-divider type="vertical" /> <a-divider type="vertical" />
</template> </template>
</span> </span>
@ -136,9 +136,9 @@ export default {
this.$router.push({ this.$router.push({
path: '/project/projectStepForm', path: '/project/projectStepForm',
query: { query: {
id: record.id, projectId: record.id, //id
projectQueryParam: this.queryParam, projectQueryParam: this.queryParam, //
projectPageNum: this.$refs.table.localPagination.current projectPageNum: this.$refs.table.localPagination.current //
} }
}); });
} }

View File

@ -30,6 +30,7 @@
</template> </template>
<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/ProjectCourseList' import Step3 from './form/ProjectCourseList'
@ -37,6 +38,9 @@ import Step4 from './form/ProjectPersonForm'
import step5 from './form/ProjectTestPaperFormationStrategy' import step5 from './form/ProjectTestPaperFormationStrategy'
import result from './form/Result' import result from './form/Result'
//api
import { projectAdd, getProjectDetail } from '@/api/project/project'
export default { export default {
components: { components: {
Step1, Step1,
@ -49,6 +53,11 @@ export default {
// - 访this // - 访this
created() { created() {
console.log('分步表单创建完成') console.log('分步表单创建完成')
if (this.$route.query.projectId) {
getProjectDetail({ id: this.$route.query.projectId }).then((res) => {
this.form = res.data
})
}
}, },
destroyed() { destroyed() {
console.log('分步表单销毁了。。。。。') console.log('分步表单销毁了。。。。。')
@ -78,37 +87,32 @@ export default {
} }
}, },
methods: { methods: {
//
add(type) {
this.modalTitle = '新增项目'
this.visible = true
this.formLoading = false
},
//
edit(record) {
console.log(record)
this.modalTitle = '编辑项目'
this.visible = true
this.formLoading = false
},
// //
executeSave(childValue) { executeSave(childValue) {
console.log('保存项目', childValue) console.log('保存项目', childValue)
if (true) { this.form = childValue
this.status = 'success' this.saveData()
this.currentTab = 5
}
}, },
// //
executeIssue(childValue) { executeIssue(childValue) {
console.log('保存并发布项目', childValue) console.log('保存并发布项目', childValue)
if (true) { this.form = childValue
this.status = 'error' this.saveData()
},
//
saveData() {
projectAdd(Object.assign({}, this.form)).then((res) => {
if (res.code == 200) {
this.status = 'success'
this.currentTab = 5 this.currentTab = 5
} else {
this.status = 'error'
this.result = false this.result = false
this.currentTab = 5
} }
})
}, },
// //
@ -133,13 +137,14 @@ export default {
} }
console.log('ProjectStepForm表单数据', this.form) console.log('ProjectStepForm表单数据', this.form)
}, },
//list
close() {
this.$router.push({
path: '/project/list',
query:{
finish() { }
this.currentTab = 0 })
},
handleSubmit() {},
handleCancel() {
this.visible = false
}, },
}, },
} }

View File

@ -47,7 +47,7 @@
</span> </span>
</s-table> </s-table>
</a-space> </a-space>
<project-course-select ref="CourseSelect" @selectKeyDataSubmit="selectKeyDataChange"></project-course-select> <project-course-select ref="CourseSelect" @selectKeyDataSubmit="selectKeyDataChange" :selectRows="selData"></project-course-select>
</a-card> </a-card>
</template> </template>
@ -73,6 +73,7 @@ export default {
// //
return { return {
form: this.projectForm, form: this.projectForm,
selData:[],
labelCol: {}, labelCol: {},
wrapperCol: {}, wrapperCol: {},
vertical: 'vertical', vertical: 'vertical',
@ -80,11 +81,11 @@ export default {
totalLearnHours: 0, // totalLearnHours: 0, //
totalTopicNum: 0, // totalTopicNum: 0, //
queryParam: { queryParam: {
ids: '1,2,3', ids: '',
}, // }, //
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: 'courseCode', key: 'courseCode' },
{ title: '课程名称', dataIndex: 'courseName', key: 'courseName' }, { title: '课程名称', dataIndex: 'courseName', key: 'courseName' },
{ title: '课时', dataIndex: 'courseHours', key: 'courseHours', customRender: (text) => text + 'H' }, { title: '课时', dataIndex: 'courseHours', key: 'courseHours', customRender: (text) => text + 'H' },
{ title: '学时要求', dataIndex: 'learnHours', key: 'learnHours', customRender: (text) => text + 'H' }, { title: '学时要求', dataIndex: 'learnHours', key: 'learnHours', customRender: (text) => text + 'H' },
@ -96,12 +97,15 @@ export default {
if (this.$route.query.projectId) { if (this.$route.query.projectId) {
/** 编辑进来的有项目id */ /** 编辑进来的有项目id */
return getCourseList(this.$route.query.projectId).then((res) => { return getCourseList(this.$route.query.projectId).then((res) => {
this.selData = res.data;
this.calc(res.data) this.calc(res.data)
return res.data return res.data
}) })
} else { } else {
/** 新建的没有项目id传当前的所选的课程id */ /** 新建的没有项目id传当前的所选的课程id */
return getCourseListByCourseIds(Object.assign(parameter, this.queryParam)).then((res) => { return getCourseListByCourseIds(Object.assign(parameter, this.queryParam)).then((res) => {
this.selData = res.data;
console.log('list页面----selData',this.selData)
this.calc(res.data) this.calc(res.data)
return res.data return res.data
}) })
@ -152,12 +156,16 @@ export default {
//ids //ids
initIds() { initIds() {
console.log('this.projectForm.lessonIds',this.projectForm.lessonIds) console.log('this.projectForm.lessonIds',this.projectForm.lessonIds)
let str = ''; let str = [];
if(this.projectForm.lessonIds) str = this.projectForm.lessonIds.join(',') if(this.projectForm.lessonIds) str = this.projectForm.lessonIds
// let str = this.projectForm.lessonIds.join(',') || [] // let str = this.projectForm.lessonIds.join(',') || []
console.log('initIds', str) console.log('initIds', str)
if (str) { if (str && str.length > 0) {
this.queryParam.ids = str let arr = [];
str.forEach((item) => {
arr.push(item.ids)
})
this.queryParam.ids = arr.join(',')
} }
}, },
//list //list

View File

@ -72,7 +72,11 @@ export default {
components: { components: {
STable, STable,
}, },
props: {}, props: {
selectRows: {
type: Array,
},
},
data() { data() {
// //
return { return {
@ -117,16 +121,21 @@ export default {
console.log('课程选择打开了', record) console.log('课程选择打开了', record)
this.modalTitle = '选择课程' this.modalTitle = '选择课程'
this.visible = true this.visible = true
console.log('selectRows-------------', this.selectRows)
if (this.selectRows) {
this.selectedRows = this.selectRows;
this.selectedRowKeys = this.selectedRows.map((value) => value.id)
}
}, },
handleCancel() { handleCancel() {
console.log('课程选择关闭') console.log('课程选择关闭')
this.visible = false this.visible = false
}, },
handleSubmit() { handleSubmit() {
console.log('课程选择提交了',this.selectedRowKeys) console.log('课程选择提交了', this.selectedRowKeys)
this.visible = false this.visible = false
if (this.selectedRowKeys) this.$emit('selectKeyDataSubmit',this.selectedRowKeys.join(',')); if (this.selectedRowKeys) this.$emit('selectKeyDataSubmit', this.selectedRowKeys.join(','))
else this.$emit('selectKeyDataSubmit',''); else this.$emit('selectKeyDataSubmit', '')
}, },
/** 表格行选中后触发 */ /** 表格行选中后触发 */

View File

@ -25,12 +25,12 @@
<a-row :gutter="24"> <a-row :gutter="24">
<a-col :md="10" :sm="12"> <a-col :md="10" :sm="12">
<a-form-model-item label="考试时长"> <a-form-model-item label="考试时长">
<a-input-number v-model="form.examTime" /> <a-input-number :min="0" v-model="form.examTime" />
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<a-col :md="14" :sm="12"> <a-col :md="14" :sm="12">
<a-form-model-item label="默认组卷题量"> <a-form-model-item label="默认组卷题量">
<a-input-number v-model="form.topicNumber" /> <a-input-number :min="0" v-model="form.topicNumber" />
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
</a-row> </a-row>
@ -38,7 +38,7 @@
<h4>考试开启条件</h4> <h4>考试开启条件</h4>
<a-col :md="10" :sm="12"> <a-col :md="10" :sm="12">
<a-form-model-item label="学时时长"> <a-form-model-item label="学时时长">
<a-input-number v-model="form.examOpenCondition" /> <a-input-number :min="0" v-model="form.examOpenCondition" />
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
</a-row> </a-row>