Merge branch 'develop' of https://gitee.com/siwa-team/dawa-vue into develop

This commit is contained in:
qinjie 2021-11-22 15:54:09 +08:00
commit ce69b05ee5
9 changed files with 430 additions and 51 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

@ -74,7 +74,7 @@ export default {
data() { data() {
return { return {
// //
queryParam: {}, queryParam: this.$route.query.queryParam || {},
// //
columns: [ columns: [
{ title: '序号', key: 'id', dataIndex: 'id', width: 60, scopedSlots: { customRender: 'serial' } }, { title: '序号', key: 'id', dataIndex: 'id', width: 60, scopedSlots: { customRender: 'serial' } },

View File

@ -5,17 +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="完成" /> <a-step :title="this.result ? '完成' : '失败'" />
</a-steps> </a-steps>
<div class="content"> <div class="content">
<step1 v-bind:form="form" v-if="currentTab === 0" @nextStep="nextStep" /> <!-- <keep-alive exclude="result"> -->
<step2 v-bind:form="form" v-if="currentTab === 1" @nextStep="nextStep" @prevStep="prevStep" /> <step1 v-if="currentTab === 0" :projectForm="form" @nextStep="nextStep" />
<step3 v-bind:form="form" v-if="currentTab === 2" @nextStep="nextStep" @prevStep="prevStep" /> <step2 v-if="currentTab === 1" :projectForm="form" @nextStep="nextStep" @prevStep="prevStep" />
<step4 v-bind:form="form" v-if="currentTab === 3" @nextStep="nextStep" @prevStep="prevStep" /> <step3 v-if="currentTab === 2" :projectForm="form" @nextStep="nextStep" @prevStep="prevStep" />
<step5 v-bind:form="form" v-if="currentTab === 4" @prevStep="prevStep" @finish="finish" /> <step4 v-if="currentTab === 3" :projectForm="form" @nextStep="nextStep" @prevStep="prevStep" />
<step5 v-if="currentTab === 4" :projectForm="form" @prevStep="prevStep" @executeSave="executeSave" @executeIssue="executeIssue" />
<result v-if="currentTab === 5" :projectForm="form" @prevStep="prevStep" :projectSaveStatus="status" />
<!-- </keep-alive> -->
</div> </div>
</a-card> </a-card>
</template> </template>
@ -25,6 +28,8 @@ 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'
import Step4 from './form/ProjectPersonForm' import Step4 from './form/ProjectPersonForm'
import step5 from './form/ProjectTestPaperFormationStrategy'
import result from './form/Result'
export default { export default {
components: { components: {
@ -32,7 +37,16 @@ export default {
Step2, Step2,
Step3, Step3,
Step4, Step4,
step5,
result,
}, },
// - 访this
created() {
console.log('分步表单创建完成')
},
destroyed() {
console.log('分步表单销毁了。。。。。')
}, // -
data() { data() {
return { return {
title: '', title: '',
@ -49,7 +63,11 @@ export default {
visible: false, visible: false,
confirmLoading: false, confirmLoading: false,
type: '', type: '',
form: {}, form: {
trainWay: '1',
},
result: true,
status: '',
} }
}, },
methods: { methods: {
@ -67,23 +85,44 @@ export default {
this.formLoading = false this.formLoading = false
}, },
// handler //
executeSave(childValue) {
console.log('保存项目', childValue)
if (true) {
this.status = 'success'
this.currentTab = 5
}
},
//
executeIssue(childValue) {
console.log('保存并发布项目', childValue)
if (true) {
this.status = 'error'
this.currentTab = 5
this.result = false
}
},
// //
nextStep(childValue) { nextStep(childValue) {
console.log('进入下一步', childValue) console.log('进入下一步', childValue)
if (this.currentTab < 5) { if (this.currentTab < 5) {
this.form = childValue; this.form = childValue
this.currentTab += 1 this.currentTab += 1
} }
console.log('ProjectStepForm表单数据', this.form)
}, },
// //
prevStep(childValue) { prevStep(childValue) {
console.log('返回上一步',childValue) console.log('返回上一步', childValue)
if (this.currentTab > 0) { if (this.currentTab > 0) {
this.form = childValue this.form = childValue
this.currentTab -= 1 this.currentTab -= 1
} }
console.log('ProjectStepForm表单数据', this.form)
}, },
finish() { finish() {
this.currentTab = 0 this.currentTab = 0
}, },

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

@ -1,50 +1,219 @@
<template> <template>
<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 :span="4" id="tree">
<a-tree> <a-page-header title="单位列表" sub-title="" />
<div v-if="this.orgTree != ''">
<a-tree
:treeData="orgTree"
v-if="orgTree.length"
@select="onSelect"
:defaultExpandAll="true"
:defaultExpandedKeys="defaultExpandedKeys"
:replaceFields="replaceFields"
>
<a-icon slot="switcherIcon" type="down" />
</a-tree> </a-tree>
</div>
</a-col> </a-col>
<a-col :span="20" id="content"> <a-col :span="20" id="content">
<h1>人员选择</h1> <a-page-header title="人员选择" sub-title="" />
<a-col :span="18" id="table">
<a-form layout="inline">
<a-row>
<a-form-item label="姓名">
<a-input v-model="queryParam.name" placeholder="请输入姓名" />
</a-form-item>
<a-form-item label="人员类型">
<a-select default-value="0" style="width: 120px">
<a-select-option value="0"> - - </a-select-option>
<a-select-option value="1"> </a-select-option>
<a-select-option value="2"> </a-select-option>
<a-select-option value="3"> </a-select-option>
</a-select>
</a-form-item>
<a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
<a-button style="margin-left: 8px" @click="() => (queryParam = {})">重置</a-button>
</a-row>
</a-form>
<s-table
ref="table"
:columns="columns"
:data="loadData"
:rowKey="(record) => record.id"
:rowSelection="{ selectedRowKeys: selectedRowKeys, selectedRows: selectedRows, onChange: onSelectChange }"
>
<span slot="serial" slot-scope="text, record, index">
{{ index + 1 }}
</span>
</s-table>
</a-col>
<a-col :span="6" id="select">
<p>点击列表项取消选择或<a @click="removeAllSelece">清空所有</a></p>
<a-list size="small" :data-source="selectedRows" :rowKey="(item) => item.id">
<a-list-item slot="renderItem" slot-scope="item" @click="changeList({ item })">
{{ item.name + '' + item.userName + '' }}
</a-list-item>
</a-list>
</a-col>
</a-col> </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>
</div> </div>
</a-form-model>
</template> </template>
<script> <script>
// jsjsjson // jsjsjson
// import from '' // import from ''
import { orgList } from '@/api/org/org'
import { listToTree } from '@/utils/util'
import { personPage } from '@/api/person/person'
import { STable } from '@/components'
const rootParentId = 0
export default { export default {
// import使 // import使
components: {}, components: {
props: {}, orgList,
STable,
},
props: {
projectForm: {
type: Object,
}
},
data() { data() {
// //
return {} return {
form: this.projectForm,
//
queryParam: { orgType: 1 },
replaceFields: { children: 'children', title: 'name', key: 'id', value: 'id' },
expandedKeys: [],
autoExpandParent: true,
defaultExpandedKeys: [],
selectedRowKeys: [],
selectedRows: [],
orgTree: [],
orgId: '',
orgType: 1,
columns: [
{ title: '序号', key: 'id', dataIndex: 'id', width: 60, scopedSlots: { customRender: 'serial' } },
{ title: '姓名', dataIndex: 'name' },
{ title: '用户名', dataIndex: 'userName' },
],
//
loadData: (parameter) => {
return personPage(Object.assign(parameter, this.queryParam)).then((res) => {
return res
})
},
}
}, },
// data // data
computed: {}, computed: {
hasSelected() {
return this.selectedRowKeys.length > 0
},
},
// data // data
watch: {}, watch: {},
// //
methods: { methods: {
// //
toNext() { toNext() {
this.$emit('nextStep') this.form.personIds = this.selectedRowKeys
this.$emit('nextStep',this.form)
}, },
//
toPrev() { toPrev() {
this.$emit('prevStep') this.form.personIds = this.selectedRowKeys
this.$emit('prevStep',this.form)
},
/** 表格行选中后触发 */
onSelectChange(selectedRowKeys, selectedRows) {
console.log('selectedRowKeys changed: ', selectedRowKeys)
console.log('选择的表格数据 : ', selectedRows)
this.selectedRowKeys = this.uniqueKeys([...this.selectedRowKeys, ...selectedRowKeys])
this.selectedRows = this.unique([...this.selectedRows, ...selectedRows])
},
//
unique(arr) {
const res = new Map()
return arr.filter((arr) => !res.has(arr.id) && res.set(arr.id, 1))
},
//key
uniqueKeys(arr) {
const res = new Map()
return arr.filter((arr) => !res.has(arr) && res.set(arr, 1))
},
//
changeList(item) {
console.log('列表点击删除列表项 : ', item)
this.selectedRows = this.selectedRows.filter(function (i) {
return i.id != item.item.id
})
this.selectedRowKeys = this.selectedRowKeys.filter(function (i) {
return i != item.item.id
})
},
//
removeAllSelece() {
this.selectedRowKeys = []
this.selectedRows = []
},
//
onSelect(selectedKey, info) {
console.log('selected', selectedKey, info)
this.queryParam.orgId = selectedKey.toString()
this.orgId = selectedKey.toString()
this.$refs.table.refresh(true)
},
//使
onExpand(expandedKeys) {
this.expandedKeys = expandedKeys
this.autoExpandParent = false
},
//
initPersonList(){
if(this.form.personIds){
}
},
/**
* 获取到机构树展开顶级下树节点考虑到后期数据量变大不建议全部展开
*/
async getOrgTree() {
await orgList({ orgType: this.orgType }).then((res) => {
this.treeLoading = false
if (!res.code === 200 || !res.data.length) {
return
}
this.defaultExpandedKeys = []
this.orgTree = listToTree(res.data, [], rootParentId)
this.orgId = this.orgTree[0].id
for (var item of this.orgTree) {
if (item.pid === 0) {
this.defaultExpandedKeys.push(item.id)
}
}
})
}, },
}, },
// - 访this // - 访this
created() {}, created() {
this.getOrgTree()
},
// - 访DOM // - 访DOM
mounted() {}, mounted() {},
// - // -
@ -64,7 +233,7 @@ export default {
} }
</script> </script>
<style scoped> <style scoped>
#tree { /* #tree {
height: 750px; height: 750px;
background-color: beige; background-color: beige;
} }
@ -72,6 +241,6 @@ export default {
#content { #content {
height: 750px; height: 750px;
background-color: bisque; background-color: bisque;
} } */
/* /project/form/ProjectPersonForm.vue */ /* /project/form/ProjectPersonForm.vue */
</style> </style>

View File

@ -0,0 +1,68 @@
<template>
<div>
<a-card :bordered="false">
<p>hahahahhahahahahhahahah</p>
</a-card>
<a-card :bordered="false">
<p>ppppppsdapppsdapppp</p>
</a-card>
<a-button type="primary" @click="toSave"> </a-button>
<a-button type="primary" @click="toIssue"> </a-button>
<a-button type="primary" @click="toPrev">上一步</a-button>
</div>
</template>
<script>
// jsjsjson
// import from ''
export default {
// import使
components: {},
props: {
projectForm: {
type: Object,
}
},
data() {
//
return {
form: this.projectForm,
}
},
// data
computed: {},
// data
watch: {},
//
methods: {
//
toSave() { this.$emit('executeSave'), this.form },
//
toIssue(){ this.$emit("executeIssue"), this.form },
//
toPrev() { this.$emit('prevStep'), this.form },
},
// - 访this
created() {},
// - 访DOM
mounted() {},
// -
beforeCreate() {},
// -
beforeMount() {},
// -
beforeUpdate() {},
// -
updated() {},
// -
beforeDestroy() {},
// -
destroyed() {},
// keep-alive
activated() {},
}
</script>
<style scoped>
</style>

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

@ -0,0 +1,74 @@
<template>
<a-result :status="projectSaveStatus" :title="projectSaveStatus" :sub-title="description">
<template #extra>
<a-button type="primary" @click="toPrev">返回修改</a-button>
<a-button type="primary" @click="toProjectList">去列表页</a-button>
</template>
</a-result>
</template>
<script>
// jsjsjson
// import from ''
export default {
// import使
components: {},
props: {
projectSaveStatus: {
type: String,
default: 'success',
},
projectForm: {
type: Object,
},
},
data() {
//
return {
// status: 'success',
// title: '',
form: this.projectForm,
description: '请返回列表中查看',
}
},
// data
computed: {},
// data
watch: {},
//
methods: {
toPrev() {
// this.$emit('prevStep',this.selectedRowKeys)
console.log('结果页返回修改')
this.$emit('prevStep', this.form)
},
toProjectList() {
this.$router.push({
path: '/project/list',
query: { projectPageNum: 1 },
})
},
},
// - 访this
created() {},
// - 访DOM
mounted() {},
// -
beforeCreate() {},
// -
beforeMount() {},
// -
beforeUpdate() {},
// -
updated() {},
// -
beforeDestroy() {},
// -
destroyed() {},
// keep-alive
activated() {},
}
</script>
<style scoped>
</style>