项目管理表单调整

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',
getDict:'project/dict/get',
list: 'project/pageList',
projectCourseList: ''
get: 'project/get',
projectCourseList: '',
}
export function projectAdd (params) {
@ -21,6 +22,7 @@ export function dictGet (params) {
params: params
})
}
export function getProjectList (params) {
return request({
url: projectApi.list,
@ -28,3 +30,13 @@ export function getProjectList (params) {
params: params
})
}
export function getProjectDetail (params) {
return request({
url: projectApi.get,
method: 'get',
params: params
})
}

View File

@ -48,13 +48,13 @@
</span>
<span slot="action" slot-scope="text, record">
<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-popconfirm title="是否删除?" @confirm="() => handleDelete(record)">
<a v-if="hasPerm('project:del')" href="javascript:;">删除</a>
</a-popconfirm>
<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" />
</template>
</span>
@ -136,9 +136,9 @@ export default {
this.$router.push({
path: '/project/projectStepForm',
query: {
id: record.id,
projectQueryParam: this.queryParam,
projectPageNum: this.$refs.table.localPagination.current
projectId: record.id, //id
projectQueryParam: this.queryParam, //
projectPageNum: this.$refs.table.localPagination.current //
}
});
}

View File

@ -30,6 +30,7 @@
</template>
<script>
//
import Step1 from './form/ProjectForm'
import Step2 from './form/ProjectUnitSelect'
import Step3 from './form/ProjectCourseList'
@ -37,6 +38,9 @@ import Step4 from './form/ProjectPersonForm'
import step5 from './form/ProjectTestPaperFormationStrategy'
import result from './form/Result'
//api
import { projectAdd, getProjectDetail } from '@/api/project/project'
export default {
components: {
Step1,
@ -49,6 +53,11 @@ export default {
// - 访this
created() {
console.log('分步表单创建完成')
if (this.$route.query.projectId) {
getProjectDetail({ id: this.$route.query.projectId }).then((res) => {
this.form = res.data
})
}
},
destroyed() {
console.log('分步表单销毁了。。。。。')
@ -78,37 +87,32 @@ export default {
}
},
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) {
console.log('保存项目', childValue)
if (true) {
this.status = 'success'
this.currentTab = 5
}
this.form = childValue
this.saveData()
},
//
executeIssue(childValue) {
console.log('保存并发布项目', childValue)
if (true) {
this.status = 'error'
this.currentTab = 5
this.result = false
}
this.form = childValue
this.saveData()
},
//
saveData() {
projectAdd(Object.assign({}, this.form)).then((res) => {
if (res.code == 200) {
this.status = 'success'
this.currentTab = 5
} else {
this.status = 'error'
this.result = false
this.currentTab = 5
}
})
},
//
@ -133,13 +137,14 @@ export default {
}
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>
</s-table>
</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>
</template>
@ -73,6 +73,7 @@ export default {
//
return {
form: this.projectForm,
selData:[],
labelCol: {},
wrapperCol: {},
vertical: 'vertical',
@ -80,11 +81,11 @@ export default {
totalLearnHours: 0, //
totalTopicNum: 0, //
queryParam: {
ids: '1,2,3',
ids: '',
}, //
columns: [
{ 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: 'courseHours', key: 'courseHours', customRender: (text) => text + 'H' },
{ title: '学时要求', dataIndex: 'learnHours', key: 'learnHours', customRender: (text) => text + 'H' },
@ -96,12 +97,15 @@ export default {
if (this.$route.query.projectId) {
/** 编辑进来的有项目id */
return getCourseList(this.$route.query.projectId).then((res) => {
this.selData = res.data;
this.calc(res.data)
return res.data
})
} else {
/** 新建的没有项目id传当前的所选的课程id */
return getCourseListByCourseIds(Object.assign(parameter, this.queryParam)).then((res) => {
this.selData = res.data;
console.log('list页面----selData',this.selData)
this.calc(res.data)
return res.data
})
@ -152,12 +156,16 @@ export default {
//ids
initIds() {
console.log('this.projectForm.lessonIds',this.projectForm.lessonIds)
let str = '';
if(this.projectForm.lessonIds) str = this.projectForm.lessonIds.join(',')
let str = [];
if(this.projectForm.lessonIds) str = this.projectForm.lessonIds
// let str = this.projectForm.lessonIds.join(',') || []
console.log('initIds', str)
if (str) {
this.queryParam.ids = str
if (str && str.length > 0) {
let arr = [];
str.forEach((item) => {
arr.push(item.ids)
})
this.queryParam.ids = arr.join(',')
}
},
//list

View File

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

View File

@ -25,12 +25,12 @@
<a-row :gutter="24">
<a-col :md="10" :sm="12">
<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-col>
<a-col :md="14" :sm="12">
<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-col>
</a-row>
@ -38,7 +38,7 @@
<h4>考试开启条件</h4>
<a-col :md="10" :sm="12">
<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-col>
</a-row>