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({
// API 请求的默认前缀
baseURL: process.env.VUE_APP_API_BASE_URL,
timeout: 6000 // 请求超时时间
timeout: 60000 // 请求超时时间
})
// 异常拦截处理器

View File

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

View File

@ -5,17 +5,20 @@
<a-step title="基本信息" />
<a-step title="选择单位" />
<!-- v-if="['2', '3', '4'].includes(form.trainWay)" -->
<a-step title="选择课程" />
<a-step title="选择人员" />
<a-step title="组卷策略" />
<a-step title="完成" />
<a-step v-if="['2', '3', '4'].includes(form.trainWay)" title="选择课程" />
<a-step v-if="['2', '3', '4'].includes(form.trainWay)" title="选择人员" />
<a-step v-if="['2', '3', '4'].includes(form.trainWay)" title="组卷策略" />
<a-step :title="this.result ? '完成' : '失败'" />
</a-steps>
<div class="content">
<step1 v-bind:form="form" v-if="currentTab === 0" @nextStep="nextStep" />
<step2 v-bind:form="form" v-if="currentTab === 1" @nextStep="nextStep" @prevStep="prevStep" />
<step3 v-bind:form="form" v-if="currentTab === 2" @nextStep="nextStep" @prevStep="prevStep" />
<step4 v-bind:form="form" v-if="currentTab === 3" @nextStep="nextStep" @prevStep="prevStep" />
<step5 v-bind:form="form" v-if="currentTab === 4" @prevStep="prevStep" @finish="finish" />
<!-- <keep-alive exclude="result"> -->
<step1 v-if="currentTab === 0" :projectForm="form" @nextStep="nextStep" />
<step2 v-if="currentTab === 1" :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" />
<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>
</a-card>
</template>
@ -25,6 +28,8 @@ import Step1 from './form/ProjectForm'
import Step2 from './form/ProjectUnitSelect'
import Step3 from './form/ProjectCourseList'
import Step4 from './form/ProjectPersonForm'
import step5 from './form/ProjectTestPaperFormationStrategy'
import result from './form/Result'
export default {
components: {
@ -32,7 +37,16 @@ export default {
Step2,
Step3,
Step4,
step5,
result,
},
// - 访this
created() {
console.log('分步表单创建完成')
},
destroyed() {
console.log('分步表单销毁了。。。。。')
}, // -
data() {
return {
title: '',
@ -49,7 +63,11 @@ export default {
visible: false,
confirmLoading: false,
type: '',
form: {},
form: {
trainWay: '1',
},
result: true,
status: '',
}
},
methods: {
@ -67,23 +85,44 @@ export default {
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) {
console.log('进入下一步', childValue)
if (this.currentTab < 5) {
this.form = childValue;
this.form = childValue
this.currentTab += 1
}
console.log('ProjectStepForm表单数据', this.form)
},
//
prevStep(childValue) {
console.log('返回上一步',childValue)
console.log('返回上一步', childValue)
if (this.currentTab > 0) {
this.form = childValue
this.currentTab -= 1
}
console.log('ProjectStepForm表单数据', this.form)
},
finish() {
this.currentTab = 0
},

View File

@ -10,7 +10,7 @@
<s-table ref="table" size="default" rowKey="id" :columns="columns" :data="loadData" :showPagination="false">
<span slot="serial" slot-scope="text, record, index">
{{ index + 1 }}
{{ index + 1 }}
</span>
<span slot="action" slot-scope="text, record">
<template>
@ -60,11 +60,15 @@ export default {
STable,
ProjectCourseSelect,
},
props: {},
props: {
projectForm: {
type: Object,
},
},
data() {
//
return {
form: {},
form: this.projectForm,
labelCol: {},
wrapperCol: {},
vertical: 'vertical',
@ -93,6 +97,7 @@ export default {
} else {
/** 新建的没有项目id传当前的所选的课程id */
return getCourseListByCourseIds(Object.assign(parameter, this.queryParam)).then((res) => {
return res.data
})
}
@ -105,14 +110,37 @@ export default {
watch: {},
//
methods: {
//
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)
this.$emit('nextStep')
this.$emit('nextStep',this.form)
},
//
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)
this.$emit('prevStep', this.form)
},
//ids
initIds(){
let str = this.projectForm.lessonIds.join(',')
console.log('initIds',str)
if(str){
this.queryParam.ids = str
}
},
/**查询了列表数据 */
getProjectCourseList() {
// if (this.$route.query.projectId) {
@ -138,7 +166,7 @@ export default {
// - 访this
created() {
// this.getProjectCourseList()
this.initIds()
},
mounted() {}, // - 访DOM
beforeCreate() {}, // -

View File

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

View File

@ -1,50 +1,219 @@
<template>
<a-form-model :model="form" :label-col="labelCol" :wrapper-col="wrapperCol" layout="horizontal">
<div>
<a-row type="flex" justify="center" align="top">
<a-col :span="4" id="tree">
<a-tree>
<div>
<a-row type="flex" justify="center" align="top">
<a-col :span="4" id="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>
</div>
</a-col>
<a-col :span="20" id="content">
<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="20" id="content">
<h1>人员选择</h1>
<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-row>
<a-button type="primary" @click="toNext">下一步</a-button>
<a-button type="primary" @click="toPrev">上一步</a-button>
</div>
</a-form-model>
</a-col>
</a-row>
<a-button type="primary" @click="toNext">一步</a-button>
<a-button type="primary" @click="toPrev">上一步</a-button>
</div>
</template>
<script>
// jsjsjson
// 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 {
// import使
components: {},
props: {},
components: {
orgList,
STable,
},
props: {
projectForm: {
type: Object,
}
},
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
computed: {},
computed: {
hasSelected() {
return this.selectedRowKeys.length > 0
},
},
// data
watch: {},
//
methods: {
//
toNext() {
this.$emit('nextStep')
this.form.personIds = this.selectedRowKeys
this.$emit('nextStep',this.form)
},
//
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
created() {},
created() {
this.getOrgTree()
},
// - 访DOM
mounted() {},
// -
@ -64,7 +233,7 @@ export default {
}
</script>
<style scoped>
#tree {
/* #tree {
height: 750px;
background-color: beige;
}
@ -72,6 +241,6 @@ export default {
#content {
height: 750px;
background-color: bisque;
}
} */
/* /project/form/ProjectPersonForm.vue */
</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 {
props: {
form:{
projectForm: {
type: Object,
default: ()=>({}),
},
},
data() {
return {
form: this.projectForm,
targetKeys: [],
dataSource: transferDataSource,
@ -127,7 +127,7 @@ export default {
},
}
},
created(){
created() {
console.log('第2个表单创建了')
},
computed: {
@ -137,8 +137,9 @@ export default {
},
methods: {
toNext() {
this.form.unitIds = this.targetKeys
console.log('toNext', this.form)
this.$emit('nextStep',this.form)
this.$emit('nextStep', this.form)
// const {
// form: { validateFields },
// } = this
@ -150,6 +151,7 @@ export default {
// })
},
toPrep() {
this.form.unitIds = this.targetKeys
console.log('toPrep', 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>