添加页面

This commit is contained in:
Yuanjianghong 2021-08-31 17:17:18 +08:00
parent d4062016cf
commit 39ebbb6f7f
8 changed files with 263 additions and 155 deletions

View File

@ -84,24 +84,24 @@ export const asyncRouterMap = [
component: () => import('@/views/project/ProjectList'),
meta: { title: '自主项目', keepAlive: true, permission: ['form'] },
},
{
path: '/project/add',
name: 'ProjectForm',
component: () => import('@/views/project/ProjectForm'),
meta: { title: '新增项目', keepAlive: true, permission: ['form'], show: false }
},
// {
// path: '/project/add',
// name: 'ProjectForm',
// component: () => import('@/views/project/ProjectForm'),
// meta: { title: '新增项目', keepAlive: true, permission: ['form'], show: false }
// },
{
path: '/project/projectStepForm',
name: 'projectStepForm',
component: () => import('@/views/project/ProjectStepForm'),
component: () => import('@/views/project/form/ProjectStepForm'),
meta: { title: '新增项目-分布', keepAlive: true, permission: ['form'] }
},
{
path: '/project/unitSelect',
name: 'unitSelect',
component: () => import('@/views/project/ProjectUnitSelect'),
meta: { title: '选择单位', keepAlive: true, permission: ['form'] }
},
// {
// path: '/project/unitSelect',
// name: 'unitSelect',
// component: () => import('@/views/project/ProjectUnitSelect'),
// meta: { title: '选择单位', keepAlive: true, permission: ['form'] }
// },
{
path: '/form/step-form',
name: 'StepForm',

View File

@ -49,7 +49,7 @@ const errorHandler = (error) => {
request.interceptors.request.use(config => {
// const token = storage.get(ACCESS_TOKEN)
// 由于登录接口待联调token使用默认值
const token = 'eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6ImY1ODZhMzc5LWQ3MjYtNDYxZS04MmFiLTUyNWRhNzI1ZjBhZCJ9.4AsSbHaR9W7dz1wBJ-u6-dL8VS5Su12eoXPnFriX-nn-CIiOMtSctMciECijN4F7uYrzUU8KP8jwkCJbPlMaQA'
const token = 'eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6IjIwMzU2Nzg5LWYyOGEtNDYxYi1iNTRhLTM2MWYzZjdhZjg2NSJ9.4vGoaj9KK8aYp9gEz2cnRM8MBWPrqIo8O5wNgbYK4-JUE3naeEuejjr3JfZ57TLbMYWqG1MkJ0kAT-2GMgreGQ'
// 如果 token 存在,让每个请求携带自定义 token 请根据实际情况自行修改
if (token) {
config.headers[ACCESS_TOKEN] = token

View File

@ -1,132 +0,0 @@
<template>
<!-- <page-header-wrapper :title="新增项目"> -->
<a-form-model :model="form" :label-col="labelCol" :wrapper-col="wrapperCol" :layout="vertical">
<a-form-model-item label="项目名称">
<a-input
v-model="form.projectName"
v-decorator="[
'projectName',
{
rules: [{ required: true, message: '项目名称为必填' }],
},
]"
/>
</a-form-model-item>
<a-form-model-item label="培训种类">
<a-select v-model="form.trainClass" placeholder="--请选择--">
<a-select-option value="shanghai"> Zone one </a-select-option>
<a-select-option value="beijing"> Zone two </a-select-option>
</a-select>
</a-form-model-item>
<a-form-model-item label="培训类型">
<a-select v-model="form.trainType" placeholder="--请选择--">
<a-select-option value="1"> 必修课 </a-select-option>
<a-select-option value="2"> 选修课 </a-select-option>
</a-select>
</a-form-model-item>
<a-form-model-item label="培训方式">
<a-select v-model="form.trainWay" placeholder="--请选择--">
<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-option value="4"> 培训-练习-考试 </a-select-option>
</a-select>
</a-form-model-item>
<a-form-model-item label="人员类型">
<a-select v-model="form.personType" placeholder="--请选择--">
<a-select-option v-for="item in personType" :key="item.id"> {{ item.name }} </a-select-option>
</a-select>
</a-form-model-item>
<!-- 时间选择器呢 -->
<a-form-item label="培训时间" style="margin-bottom: 0">
<a-form-item :style="{ display: 'inline-block', width: 'calc(50% - 12px)' }">
<a-date-picker v-model="form.trainSdate" style="width: 100%" valueFormat="YYYY-MM-DD HH:mm:ss" />
</a-form-item>
<span :style="{ display: 'inline-block', width: '24px', textAlign: 'center' }"> - </span>
<a-form-item :style="{ display: 'inline-block', width: 'calc(50% - 12px)' }">
<a-date-picker v-model="form.trainEdate" style="width: 100%" valueFormat="YYYY-MM-DD HH:mm:ss" />
</a-form-item>
</a-form-item>
<!-- 时间选择器 -->
<a-form-item v-if="['2', '3', '4'].includes(form.trainWay)" label="练习时间" style="margin-bottom: 0">
<a-form-item :style="{ display: 'inline-block', width: 'calc(50% - 12px)' }">
<a-date-picker v-model="form.practiceSdate" style="width: 100%" valueFormat="YYYY-MM-DD HH:mm:ss" />
</a-form-item>
<span :style="{ display: 'inline-block', width: '24px', textAlign: 'center' }"> - </span>
<a-form-item :style="{ display: 'inline-block', width: 'calc(50% - 12px)' }">
<a-date-picker v-model="form.practiceEdate" style="width: 100%" valueFormat="YYYY-MM-DD HH:mm:ss" />
</a-form-item>
</a-form-item>
<!-- 时间选择器 -->
<a-form-item v-if="['2', '3', '4'].includes(form.trainWay)" label="考试时间" style="margin-bottom: 0">
<a-form-item :style="{ display: 'inline-block', width: 'calc(50% - 12px)' }">
<a-date-picker v-model="form.examSdate" style="width: 100%" valueFormat="YYYY-MM-DD HH:mm:ss" />
</a-form-item>
<span :style="{ display: 'inline-block', width: '24px', textAlign: 'center' }"> - </span>
<a-form-item :style="{ display: 'inline-block', width: 'calc(50% - 12px)' }">
<a-date-picker v-model="form.examEdate" style="width: 100%" valueFormat="YYYY-MM-DD HH:mm:ss" />
</a-form-item>
</a-form-item>
<!-- 考试次数 -->
<a-form-item v-if="['2', '3', '4'].includes(form.trainWay)" label="考试次数" style="margin-bottom: 0">
<a-form-item :style="{ display: 'inline-block', width: 'calc(30% - 1px)' }">
<a-input-number v-model="form.examNumber" :min="0" style="width: 100%" />
</a-form-item>
<span> 补考次数: </span>
<a-form-item :style="{ display: 'inline-block', width: 'calc(30% - 1px)' }">
<a-input-number v-model="form.resitNumber" :min="0" style="width: 100%" />
</a-form-item>
<a-form-item :style="{ display: 'inline-block', width: 'calc(30% - 1px)' }">
<a-button type="primary" @click="javascript;"> 随机补考 </a-button>
</a-form-item>
</a-form-item>
<a-form-model-item label="模拟考试" v-if="['2', '3', '4'].includes(form.trainWay)">
<a-radio-group v-model="form.mockExam">
<a-radio value="1"> 允许 </a-radio>
<a-radio value="0"> 不允许 </a-radio>
</a-radio-group>
</a-form-model-item>
<a-form-model-item label="备注">
<a-input v-model="form.remark" type="textarea" />
</a-form-model-item>
<a-form-model-item :wrapper-col="{ span: 14, offset: 4 }">
<a-button type="primary" @click="toNext"> 下一步 </a-button>
<a-button style="margin-left: 10px"> 取消 </a-button>
</a-form-model-item>
</a-form-model>
<!-- </page-header-wrapper> -->
</template>
<script>
import { dictGet } from '@/api/project/project'
export default {
data() {
return {
labelCol: { span: 4 },
wrapperCol: { span: 14 },
form: {
projectName: '',
},
}
},
components: {
dictGet,
},
created: {},
methods: {
//
getPersonType() {
return dictGet(Object.assign(parameter)).then((res) => {
return res
})
},
//from
toNext() {
console.log('toNext', this.form)
},
},
}
</script>

View File

@ -75,7 +75,7 @@
import moment from 'moment'
import { STable } from '@/components'
import { getProjectList } from '@/api/project/project'
import ProjectForm from '@/views/project/ProjectForm'
import ProjectForm from '@/views/project/form/ProjectForm'
import router from '@/router/index.js'
export default {
@ -107,7 +107,6 @@ export default {
{
title: '项目状态',
dataIndex: 'status',
key: 'status',
customRender: (text, record, index) => {
// 1- 2- 3- 4- 5-
if (text == 1) {
@ -132,7 +131,6 @@ export default {
{
title: '操作',
width: 200,
key: 'status',
align: 'center',
scopedSlots: { customRender: 'action' },
},

View File

@ -0,0 +1,38 @@
<template>
<div>
<h1>课程选择</h1>
</div>
</template>
<script>
//jsjsjson
//import from ''
export default {
//import使
components: {},
props: {},
data() {
//
return {};
},
// data
computed: {},
//data
watch: {},
//
methods: {},
created() {}, // - 访this
mounted() {}, // - 访DOM
beforeCreate() {}, // -
beforeMount() {}, // -
beforeUpdate() {}, // -
updated() {}, // -
beforeDestroy() {}, // -
destroyed() {}, // -
activated() {} //keep-alive
};
</script>
<style scoped>
</style>

View File

@ -0,0 +1,188 @@
<template>
<!-- <page-header-wrapper :title="新增项目"> -->
<a-form-model :model="form" :label-col="labelCol" :wrapper-col="wrapperCol" :layout="vertical">
<a-row :gutter="24">
<a-col :md="24" :sm="24">
<a-form-model-item label="项目名称">
<a-input
v-model="form.projectName"
v-decorator="[
'projectName',
{
rules: [{ required: true, message: '项目名称为必填' }],
},
]"
/>
</a-form-model-item>
</a-col>
</a-row>
<a-row>
<a-col :span="12">
<a-form-model-item label="培训种类">
<a-select v-model="form.trainClass" placeholder="--请选择--">
<a-select-option value="shanghai"> Zone one </a-select-option>
</a-select>
<a-button type="primary" @click="createClass"> 新增种类 </a-button>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="培训类型">
<a-select v-model="form.trainType" placeholder="--请选择--">
<a-select-option value="1"> 必修课 </a-select-option>
<a-select-option value="2"> 选修课 </a-select-option>
</a-select>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="培训方式">
<a-select v-model="form.trainWay" placeholder="--请选择--">
<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-option value="4"> 培训-练习-考试 </a-select-option>
</a-select>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="人员类型">
<a-select v-model="form.personType" placeholder="--请选择--">
<a-select-option v-for="item in personType" :key="item.value"> {{ item.name }} </a-select-option>
</a-select>
</a-form-model-item>
</a-col>
<!-- 时间选择器呢 -->
<a-col :span="24">
<a-form-item label="培训时间" style="margin-bottom: 0">
<a-form-item :style="{ display: 'inline-block', width: 'calc(50% - 12px)' }">
<a-date-picker v-model="form.trainSdate" style="width: 100%" valueFormat="YYYY-MM-DD HH:mm:ss" />
</a-form-item>
<span :style="{ display: 'inline-block', width: '24px', textAlign: 'center' }"> - </span>
<a-form-item :style="{ display: 'inline-block', width: 'calc(50% - 12px)' }">
<a-date-picker v-model="form.trainEdate" style="width: 100%" valueFormat="YYYY-MM-DD HH:mm:ss" />
</a-form-item>
</a-form-item>
</a-col>
<!-- 时间选择器 -->
<a-col :span="24">
<a-form-item v-if="['2', '3', '4'].includes(form.trainWay)" label="练习时间" style="margin-bottom: 0">
<a-form-item :style="{ display: 'inline-block', width: 'calc(50% - 12px)' }">
<a-date-picker v-model="form.practiceSdate" style="width: 100%" valueFormat="YYYY-MM-DD HH:mm:ss" />
</a-form-item>
<span :style="{ display: 'inline-block', width: '24px', textAlign: 'center' }"> - </span>
<a-form-item :style="{ display: 'inline-block', width: 'calc(50% - 12px)' }">
<a-date-picker v-model="form.practiceEdate" style="width: 100%" valueFormat="YYYY-MM-DD HH:mm:ss" />
</a-form-item>
</a-form-item>
</a-col>
<!-- 时间选择器 -->
<a-col :span="24">
<a-form-item v-if="['2', '3', '4'].includes(form.trainWay)" label="考试时间" style="margin-bottom: 0">
<a-form-item :style="{ display: 'inline-block', width: 'calc(50% - 12px)' }">
<a-date-picker v-model="form.examSdate" style="width: 100%" valueFormat="YYYY-MM-DD HH:mm:ss" />
</a-form-item>
<span :style="{ display: 'inline-block', width: '24px', textAlign: 'center' }"> - </span>
<a-form-item :style="{ display: 'inline-block', width: 'calc(50% - 12px)' }">
<a-date-picker v-model="form.examEdate" style="width: 100%" valueFormat="YYYY-MM-DD HH:mm:ss" />
</a-form-item>
</a-form-item>
</a-col>
<!-- 考试次数 -->
<a-col :span="24">
<a-form-item v-if="['2', '3', '4'].includes(form.trainWay)" label="考试次数" style="margin-bottom: 0">
<a-form-item :style="{ display: 'inline-block', width: 'calc(30% - 1px)' }">
<a-input-number v-model="form.examNumber" :min="0" style="width: 100%" />
</a-form-item>
<span> 补考次数: </span>
<a-form-item :style="{ display: 'inline-block', width: 'calc(30% - 1px)' }">
<a-input-number v-model="form.resitNumber" :min="0" style="width: 100%" />
</a-form-item>
<a-form-item :style="{ display: 'inline-block', width: 'calc(30% - 1px)' }">
<a-button type="primary" @click="javascript;"> 随机补考 </a-button>
</a-form-item>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="模拟考试" v-if="['2', '3', '4'].includes(form.trainWay)">
<a-radio-group v-model="form.mockExam">
<a-radio value="1"> 允许 </a-radio>
<a-radio value="0"> 不允许 </a-radio>
</a-radio-group>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="备注">
<a-input v-model="form.remark" type="textarea" />
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item :wrapper-col="{ span: 14, offset: 4 }">
<a-button type="primary" @click="toNext"> 下一步 </a-button>
<a-button style="margin-left: 10px"> 取消 </a-button>
</a-form-model-item>
</a-col>
</a-row>
</a-form-model>
<!-- </page-header-wrapper> -->
</template>
<script>
import { dictGet } from '@/api/project/project'
export default {
data() {
return {
labelCol: { span: 4 },
wrapperCol: { span: 14 },
form: this.$form.createForm(this),
personType: [],
}
},
components: {
dictGet,
},
created() {
this.fetchTemplateData()
},
methods: {
//
fetchTemplateData() {
console.log('fetchTemplateData')
let formData = { type: 1 }
//
dictGet(formData).then((res) => {
console.log(res)
//
if (res.code == 200) {
const result = res.data
result.forEach((r) => {
this.personType.push({
value: r.value,
name: r.name,
})
})
console.log("----------------",this.personType)
}
})
},
//
//from
toNext() {
console.log('toNext', this.form)
const {
form: { validateFields },
} = this
//
validateFields((err, values) => {
if (!err) {
this.$emit('nextStep')
}
})
},
createClass(){
console.log("-------createClass--------")
}
},
}
</script>

View File

@ -8,12 +8,16 @@
<a-steps class="steps" :current="currentTab">
<a-step title="基本信息" />
<a-step title="选择单位" />
<a-step title="选择课程" />
<a-step title="选择人员" />
<a-step title="完成" />
</a-steps>
<div class="content">
<step1 v-if="currentTab === 0" @nextStep="nextStep"/>
<step2 v-if="currentTab === 1" @nextStep="nextStep" @prevStep="prevStep"/>
<step3 v-if="currentTab === 2" @prevStep="prevStep" @finish="finish"/>
<step2 v-if="currentTab === 2" @nextStep="nextStep" @prevStep="prevStep"/>
<step2 v-if="currentTab === 3" @nextStep="nextStep" @prevStep="prevStep"/>
<step3 v-if="currentTab === 4" @prevStep="prevStep" @finish="finish"/>
</div>
</a-card>
</page-header-wrapper>
@ -22,20 +26,20 @@
<script>
import Step1 from './ProjectForm'
import Step2 from './ProjectUnitSelect.vue'
import Step3 from '../form/stepForm/Step3'
import Step3 from './ProjectCourseSelect.vue'
export default {
name: 'StepForm',
components: {
Step1,
Step2,
Step3
Step3,
},
data () {
return {
currentTab: 0,
// form
form: null
form: null,
}
},
methods: {

View File

@ -1,7 +1,7 @@
<template>
<page-header-wrapper title="请选择受训单位">
<a-form-model :model="form">
<a-form-model-item :wrapper-col="{ span: 14, offset: 4,}" >
<a-form-model-item :wrapper-col="{ span: 14, offset: 4 }">
<a-button type="primary" @click="toNext"> 下一步 </a-button>
<a-button style="margin-left: 10px"> 取消 </a-button>
</a-form-model-item>
@ -111,7 +111,7 @@ function handleTreeData(data, targetKeys = []) {
export default {
data() {
return {
form: {},
form: this.$form.createForm(this),
targetKeys: [],
dataSource: transferDataSource,
@ -131,6 +131,18 @@ export default {
},
},
methods: {
toNext() {
console.log('toNext', this.form)
const {
form: { validateFields },
} = this
//
validateFields((err, values) => {
if (!err) {
this.$emit('nextStep')
}
})
},
onChange(targetKeys) {
console.log('Target Keys:', targetKeys)
this.targetKeys = targetKeys