'项目表单更新'

This commit is contained in:
hbzgyjh 2021-11-21 01:59:40 +08:00
parent cceaa92f8f
commit 4cf34a5ccc
8 changed files with 105 additions and 43 deletions

View File

@ -20,7 +20,7 @@ const toast = (msg, description) => {
const request = axios.create({ const request = axios.create({
// API 请求的默认前缀 // API 请求的默认前缀
baseURL: process.env.VUE_APP_API_BASE_URL, baseURL: process.env.VUE_APP_API_BASE_URL,
timeout: 6000 // 请求超时时间 timeout: 60000 // 请求超时时间
}) })
// 异常拦截处理器 // 异常拦截处理器

View File

@ -5,20 +5,20 @@
<a-step title="基本信息" /> <a-step title="基本信息" />
<a-step title="选择单位" /> <a-step title="选择单位" />
<!-- v-if="['2', '3', '4'].includes(form.trainWay)" --> <!-- v-if="['2', '3', '4'].includes(form.trainWay)" -->
<a-step title="选择课程" /> <a-step v-if="['2', '3', '4'].includes(form.trainWay)" title="选择课程" />
<a-step title="选择人员" /> <a-step v-if="['2', '3', '4'].includes(form.trainWay)" title="选择人员" />
<a-step title="组卷策略" /> <a-step v-if="['2', '3', '4'].includes(form.trainWay)" title="组卷策略" />
<a-step :title="this.result ? '完成' : '失败'" /> <a-step :title="this.result ? '完成' : '失败'" />
</a-steps> </a-steps>
<div class="content"> <div class="content">
<keep-alive exclude="result"> <!-- <keep-alive exclude="result"> -->
<step1 v-if="currentTab === 0" :projectForm="form" @nextStep="nextStep" /> <step1 v-if="currentTab === 0" :projectForm="form" @nextStep="nextStep" />
<step2 v-if="currentTab === 1" :projectForm="form" @nextStep="nextStep" @prevStep="prevStep" /> <step2 v-if="currentTab === 1" :projectForm="form" @nextStep="nextStep" @prevStep="prevStep" />
<step3 v-if="currentTab === 2" :projectForm="form" @nextStep="nextStep" @prevStep="prevStep" /> <step3 v-if="currentTab === 2" :projectForm="form" @nextStep="nextStep" @prevStep="prevStep" />
<step4 v-if="currentTab === 3" :projectForm="form" @nextStep="nextStep" @prevStep="prevStep" /> <step4 v-if="currentTab === 3" :projectForm="form" @nextStep="nextStep" @prevStep="prevStep" />
<step5 v-if="currentTab === 4" :projectForm="form" @prevStep="prevStep" @executeSave="executeSave" @executeIssue="executeIssue" /> <step5 v-if="currentTab === 4" :projectForm="form" @prevStep="prevStep" @executeSave="executeSave" @executeIssue="executeIssue" />
<result v-if="currentTab === 5" :projectForm="form" @nextStep="nextStep" :projectSaveStatus="status"/> <result v-if="currentTab === 5" :projectForm="form" @prevStep="prevStep" :projectSaveStatus="status" />
</keep-alive> <!-- </keep-alive> -->
</div> </div>
</a-card> </a-card>
</template> </template>
@ -31,7 +31,6 @@ 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'
export default { export default {
components: { components: {
Step1, Step1,
@ -41,7 +40,13 @@ export default {
step5, step5,
result, result,
}, },
// - 访this
created() {
console.log('分步表单创建完成')
},
destroyed() {
console.log('分步表单销毁了。。。。。')
}, // -
data() { data() {
return { return {
title: '', title: '',
@ -58,7 +63,9 @@ export default {
visible: false, visible: false,
confirmLoading: false, confirmLoading: false,
type: '', type: '',
form: {}, form: {
trainWay: '1',
},
result: true, result: true,
status: '', status: '',
} }
@ -104,6 +111,7 @@ export default {
this.form = childValue this.form = childValue
this.currentTab += 1 this.currentTab += 1
} }
console.log('ProjectStepForm表单数据', this.form)
}, },
// //
prevStep(childValue) { prevStep(childValue) {
@ -112,6 +120,7 @@ export default {
this.form = childValue this.form = childValue
this.currentTab -= 1 this.currentTab -= 1
} }
console.log('ProjectStepForm表单数据', this.form)
}, },
finish() { finish() {

View File

@ -60,11 +60,15 @@ export default {
STable, STable,
ProjectCourseSelect, ProjectCourseSelect,
}, },
props: {}, props: {
projectForm: {
type: Object,
},
},
data() { data() {
// //
return { return {
form: {}, form: this.projectForm,
labelCol: {}, labelCol: {},
wrapperCol: {}, wrapperCol: {},
vertical: 'vertical', vertical: 'vertical',
@ -93,6 +97,7 @@ export default {
} else { } else {
/** 新建的没有项目id传当前的所选的课程id */ /** 新建的没有项目id传当前的所选的课程id */
return getCourseListByCourseIds(Object.assign(parameter, this.queryParam)).then((res) => { return getCourseListByCourseIds(Object.assign(parameter, this.queryParam)).then((res) => {
return res.data return res.data
}) })
} }
@ -105,14 +110,37 @@ export default {
watch: {}, watch: {},
// //
methods: { methods: {
//
toNext() { toNext() {
this.form.lessonIds = []
let ids = this.queryParam.ids.split(',')
ids.forEach((id, index, arr) => {
console.log('id-----------------------',id)
this.form.lessonIds.push({ ids: id, sort: index })
})
console.log('ProjectCourseSelect-toNext', this.form) console.log('ProjectCourseSelect-toNext', this.form)
this.$emit('nextStep') this.$emit('nextStep',this.form)
}, },
//
toPrep() { toPrep() {
this.form.lessonIds = []
let ids = this.queryParam.ids.split(',')
ids.forEach((id, index, arr) => {
this.form.lessonIds.push({ ids: id, sort: index })
})
console.log('toPrep', this.form) console.log('toPrep', this.form)
this.$emit('prevStep', this.form) this.$emit('prevStep', this.form)
}, },
//ids
initIds(){
let str = this.projectForm.lessonIds.join(',')
console.log('initIds',str)
if(str){
this.queryParam.ids = str
}
},
/**查询了列表数据 */ /**查询了列表数据 */
getProjectCourseList() { getProjectCourseList() {
// if (this.$route.query.projectId) { // if (this.$route.query.projectId) {
@ -138,7 +166,7 @@ export default {
// - 访this // - 访this
created() { created() {
// this.getProjectCourseList() this.initIds()
}, },
mounted() {}, // - 访DOM mounted() {}, // - 访DOM
beforeCreate() {}, // - beforeCreate() {}, // -

View File

@ -126,10 +126,9 @@ import { classList } from '@/api/project/class'
export default { export default {
props: { props: {
// form: { projectForm: {
// type: Object, type: Object,
// default: () => ({}), },
// },
}, },
data() { data() {
return { return {
@ -140,7 +139,7 @@ export default {
visible: false, visible: false,
confirmLoading: false, confirmLoading: false,
trainClass: [], trainClass: [],
form: {}, form: this.projectForm,
} }
}, },
components: { components: {

View File

@ -78,10 +78,15 @@ export default {
orgList, orgList,
STable, STable,
}, },
props: {}, props: {
projectForm: {
type: Object,
}
},
data() { data() {
// //
return { return {
form: this.projectForm,
// //
queryParam: { orgType: 1 }, queryParam: { orgType: 1 },
replaceFields: { children: 'children', title: 'name', key: 'id', value: 'id' }, replaceFields: { children: 'children', title: 'name', key: 'id', value: 'id' },
@ -118,11 +123,13 @@ export default {
methods: { methods: {
// //
toNext() { toNext() {
this.$emit('nextStep',this.selectedRowKeys) this.form.personIds = this.selectedRowKeys
this.$emit('nextStep',this.form)
}, },
// //
toPrev() { toPrev() {
this.$emit('prevStep',this.selectedRowKeys) this.form.personIds = this.selectedRowKeys
this.$emit('prevStep',this.form)
}, },
/** 表格行选中后触发 */ /** 表格行选中后触发 */
@ -176,6 +183,13 @@ export default {
this.autoExpandParent = false this.autoExpandParent = false
}, },
//
initPersonList(){
if(this.form.personIds){
}
},
/** /**
* 获取到机构树展开顶级下树节点考虑到后期数据量变大不建议全部展开 * 获取到机构树展开顶级下树节点考虑到后期数据量变大不建议全部展开
*/ */

View File

@ -20,10 +20,16 @@
export default { export default {
// import使 // import使
components: {}, components: {},
props: {}, props: {
projectForm: {
type: Object,
}
},
data() { data() {
// //
return {} return {
form: this.projectForm,
}
}, },
// data // data
computed: {}, computed: {},
@ -32,11 +38,11 @@ export default {
// //
methods: { methods: {
// //
toSave() { this.$emit('executeSave') }, toSave() { this.$emit('executeSave'), this.form },
// //
toIssue(){ this.$emit("executeIssue") }, toIssue(){ this.$emit("executeIssue"), this.form },
// //
toPrev() { this.$emit('prevStep') }, toPrev() { this.$emit('prevStep'), this.form },
}, },
// - 访this // - 访this
created() {}, created() {},

View File

@ -107,13 +107,13 @@ function handleTreeData(data, targetKeys = []) {
export default { export default {
props: { props: {
form:{ projectForm: {
type: Object, type: Object,
default: ()=>({}),
}, },
}, },
data() { data() {
return { return {
form: this.projectForm,
targetKeys: [], targetKeys: [],
dataSource: transferDataSource, dataSource: transferDataSource,
@ -127,7 +127,7 @@ export default {
}, },
} }
}, },
created(){ created() {
console.log('第2个表单创建了') console.log('第2个表单创建了')
}, },
computed: { computed: {
@ -137,8 +137,9 @@ export default {
}, },
methods: { methods: {
toNext() { toNext() {
this.form.unitIds = this.targetKeys
console.log('toNext', this.form) console.log('toNext', this.form)
this.$emit('nextStep',this.form) this.$emit('nextStep', this.form)
// const { // const {
// form: { validateFields }, // form: { validateFields },
// } = this // } = this
@ -150,6 +151,7 @@ export default {
// }) // })
}, },
toPrep() { toPrep() {
this.form.unitIds = this.targetKeys
console.log('toPrep', this.form) console.log('toPrep', this.form)
this.$emit('prevStep', this.form) this.$emit('prevStep', this.form)
}, },

View File

@ -19,12 +19,16 @@ export default {
type: String, type: String,
default: 'success', default: 'success',
}, },
projectForm: {
type: Object,
},
}, },
data() { data() {
// //
return { return {
// status: 'success', // status: 'success',
// title: '', // title: '',
form: this.projectForm,
description: '请返回列表中查看', description: '请返回列表中查看',
} }
}, },
@ -34,15 +38,15 @@ export default {
watch: {}, watch: {},
// //
methods: { methods: {
toPrev(){ toPrev() {
// this.$emit('prevStep',this.selectedRowKeys) // this.$emit('prevStep',this.selectedRowKeys)
console.log('结果页返回修改') console.log('结果页返回修改')
this.$emit('prevStep', { tab: 1 }) this.$emit('prevStep', this.form)
}, },
toProjectList() { toProjectList() {
this.$router.push({ this.$router.push({
path: '/project/list', path: '/project/list',
query: {projectPageNum: 1,}, query: { projectPageNum: 1 },
}) })
}, },
}, },