终端培训增加验证,项目基本信息增加字典查询培训种类
This commit is contained in:
parent
ec171306ab
commit
c550abd36d
|
@ -13,7 +13,7 @@
|
||||||
<a-col :md="24" :sm="24">
|
<a-col :md="24" :sm="24">
|
||||||
<a-form-model-item label="培训种类">
|
<a-form-model-item label="培训种类">
|
||||||
<a-select v-model="form.trainClass" placeholder="--请选择--">
|
<a-select v-model="form.trainClass" placeholder="--请选择--">
|
||||||
<a-select-option value="shanghai"> 参数待替换 </a-select-option>
|
<a-select-option v-for="entity in trainClass" :key="entity.value"> {{ entity.name }} </a-select-option>
|
||||||
</a-select>
|
</a-select>
|
||||||
<!-- <a-button type="primary" @click="$refs.classList.list()"> 新增种类 </a-button> -->
|
<!-- <a-button type="primary" @click="$refs.classList.list()"> 新增种类 </a-button> -->
|
||||||
</a-form-model-item>
|
</a-form-model-item>
|
||||||
|
@ -39,7 +39,7 @@
|
||||||
<a-col :span="24">
|
<a-col :span="24">
|
||||||
<a-form-model-item label="人员类型">
|
<a-form-model-item label="人员类型">
|
||||||
<a-select v-model="form.personType" placeholder="--请选择--">
|
<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-option v-for="item in personType" :key="item.value" > {{ item.name }} </a-select-option>
|
||||||
</a-select>
|
</a-select>
|
||||||
</a-form-model-item>
|
</a-form-model-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
|
@ -122,13 +122,14 @@
|
||||||
<script>
|
<script>
|
||||||
import { dictGet } from '@/api/project/project'
|
import { dictGet } from '@/api/project/project'
|
||||||
import ClassList from '../classAdd/ClassList.vue'
|
import ClassList from '../classAdd/ClassList.vue'
|
||||||
|
import { classList } from '@/api/project/class'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
form: {
|
// form: {
|
||||||
type: Object,
|
// type: Object,
|
||||||
default: () => ({}),
|
// default: () => ({}),
|
||||||
},
|
// },
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@ -138,15 +139,19 @@ export default {
|
||||||
modalTitle: '新增项目',
|
modalTitle: '新增项目',
|
||||||
visible: false,
|
visible: false,
|
||||||
confirmLoading: false,
|
confirmLoading: false,
|
||||||
|
trainClass: [],
|
||||||
|
form: {},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
dictGet,
|
dictGet,
|
||||||
ClassList,
|
ClassList,
|
||||||
|
classList,
|
||||||
},
|
},
|
||||||
created(ClassList) {
|
created(ClassList) {
|
||||||
console.log('第一个表单创建了')
|
console.log('第一个表单创建了')
|
||||||
this.fetchTemplateData()
|
this.fetchTemplateData()
|
||||||
|
this.getTrainClass()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
add(type) {
|
add(type) {
|
||||||
|
@ -156,7 +161,7 @@ export default {
|
||||||
},
|
},
|
||||||
//获取字典值,请求查询培训种类
|
//获取字典值,请求查询培训种类
|
||||||
fetchTemplateData() {
|
fetchTemplateData() {
|
||||||
let formData = { type: 1 }
|
let formData = { type: 2 }
|
||||||
dictGet(formData).then((res) => {
|
dictGet(formData).then((res) => {
|
||||||
console.log(res)
|
console.log(res)
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
|
@ -167,6 +172,25 @@ export default {
|
||||||
name: r.name,
|
name: r.name,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
// console.log("111111111111111111111111111",this.personType)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
//获取培训种类列表
|
||||||
|
getTrainClass() {
|
||||||
|
let formData = { type: 1 }
|
||||||
|
dictGet(formData).then((res) => {
|
||||||
|
console.log(res)
|
||||||
|
if(res.code == 200){
|
||||||
|
const result = res.data
|
||||||
|
result.forEach((r)=>{
|
||||||
|
this.trainClass.push({
|
||||||
|
value: r.id,
|
||||||
|
name: r.name,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
// console.log("222222222222222222222222222",this.trainClass)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
|
@ -2,32 +2,31 @@
|
||||||
<a-card :bordered="false" :title="titleName">
|
<a-card :bordered="false" :title="titleName">
|
||||||
<a-form-model
|
<a-form-model
|
||||||
ref="trainForm"
|
ref="trainForm"
|
||||||
@submit="handleSubmit"
|
|
||||||
:rules="rules"
|
:rules="rules"
|
||||||
:model="form"
|
:model="form"
|
||||||
:layout="layout"
|
:layout="layout"
|
||||||
:labelCol="{ span: 2 }"
|
:labelCol="{ span: 2 }"
|
||||||
:wrapperCol="{ span: 10 }"
|
:wrapperCol="{ span: 10 }"
|
||||||
>
|
>
|
||||||
<a-form-model-item label="培训名称" prop="name">
|
<a-form-model-item label="培训名称" prop="trainName">
|
||||||
<a-input v-model="form.trainName" />
|
<a-input v-model="form.trainName" />
|
||||||
</a-form-model-item>
|
</a-form-model-item>
|
||||||
<a-form-model-item label="培训时间" style="margin-bottom: 0" porp="date" >
|
<a-form-model-item label="培训时间" style="margin-bottom: 0">
|
||||||
<a-form-model-item :style="{ display: 'inline-block', width: 'calc(50% - 12px)' }" prop="date1">
|
<a-form-model-item :style="{ display: 'inline-block', width: 'calc(50% - 12px)' }" prop="trainSdate">
|
||||||
<a-date-picker v-model="form.trainSdate" style="width: 100%" valueFormat="YYYY-MM-DD HH:mm:ss" />
|
<a-date-picker v-model="form.trainSdate" style="width: 100%" valueFormat="YYYY-MM-DD HH:mm:ss" />
|
||||||
</a-form-model-item>
|
</a-form-model-item>
|
||||||
<span :style="{ display: 'inline-block', width: '24px', textAlign: 'center' }"> - </span>
|
<span :style="{ display: 'inline-block', width: '24px', textAlign: 'center' }"> - </span>
|
||||||
<a-form-model-item :style="{ display: 'inline-block', width: 'calc(50% - 12px)' }" prop="date2">
|
<a-form-model-item :style="{ display: 'inline-block', width: 'calc(50% - 12px)' }" prop="trainEdate">
|
||||||
<a-date-picker v-model="form.trainEdate" style="width: 100%" valueFormat="YYYY-MM-DD HH:mm:ss" />
|
<a-date-picker v-model="form.trainEdate" style="width: 100%" valueFormat="YYYY-MM-DD HH:mm:ss" />
|
||||||
</a-form-model-item>
|
</a-form-model-item>
|
||||||
</a-form-model-item>
|
</a-form-model-item>
|
||||||
<a-form-model-item label="主持人" prop="host">
|
<a-form-model-item label="主持人" prop="host">
|
||||||
<a-input v-model="form.host" />
|
<a-input v-model="form.host" />
|
||||||
</a-form-model-item>
|
</a-form-model-item>
|
||||||
<a-form-model-item label="会议人数" prop="number">
|
<a-form-model-item label="会议人数" prop="personNum">
|
||||||
<a-input-number v-model="form.personNum" />
|
<a-input-number v-model="form.personNum" :min="1"/>
|
||||||
</a-form-model-item>
|
</a-form-model-item>
|
||||||
<a-form-model-item label="学习内容" prop="content">
|
<a-form-model-item label="学习内容" prop="learningContent">
|
||||||
<a-input v-model="form.learningContent" type="textarea" />
|
<a-input v-model="form.learningContent" type="textarea" />
|
||||||
</a-form-model-item>
|
</a-form-model-item>
|
||||||
<a-form-model-item label="联系人" prop="contact">
|
<a-form-model-item label="联系人" prop="contact">
|
||||||
|
@ -36,16 +35,16 @@
|
||||||
<a-form-model-item label="联系方式" prop="phone">
|
<a-form-model-item label="联系方式" prop="phone">
|
||||||
<a-input v-model="form.phone" />
|
<a-input v-model="form.phone" />
|
||||||
</a-form-model-item>
|
</a-form-model-item>
|
||||||
<a-form-model-item label="备注" prop="remark">
|
<a-form-model-item label="备注">
|
||||||
<a-input v-model="form.remark" type="textarea" />
|
<a-input v-model="form.remark" type="textarea" />
|
||||||
</a-form-model-item>
|
</a-form-model-item>
|
||||||
<a-form-model-item>
|
<a-form-model-item>
|
||||||
<a-button
|
<a-button
|
||||||
htmlType="submit"
|
|
||||||
type="primary"
|
type="primary"
|
||||||
@click="
|
@click="
|
||||||
() => {
|
() => {
|
||||||
this.form.status = 1
|
this.form.status = 1
|
||||||
|
handleSubmit()
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
style="border-left: 200px"
|
style="border-left: 200px"
|
||||||
|
@ -53,11 +52,11 @@
|
||||||
保存
|
保存
|
||||||
</a-button>
|
</a-button>
|
||||||
<a-button
|
<a-button
|
||||||
htmlType="submit"
|
|
||||||
type="primary"
|
type="primary"
|
||||||
@click="
|
@click="
|
||||||
() => {
|
() => {
|
||||||
this.form.status = 2
|
this.form.status = 2
|
||||||
|
handleSubmit()
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
|
@ -100,12 +99,12 @@ export default {
|
||||||
titleName: '终端培训表单',
|
titleName: '终端培训表单',
|
||||||
layout: 'horizontal',
|
layout: 'horizontal',
|
||||||
rules: {
|
rules: {
|
||||||
name: [{ required: true, message: '培训名称不能为空', trigger: 'blur' }],
|
trainName: [{ required: true, message: '培训名称不能为空', trigger: 'blur' }],
|
||||||
date1: [{ required: true, message: '培训开始时间不能为空', trigger: 'change'}],
|
trainSdate: [{ required: true, message: '培训开始时间不能为空', trigger: 'change' }],
|
||||||
date2: [{ required: true, message: '培训结束时间不能为空', trigger: 'change'}],
|
trainEdate: [{ required: true, message: '培训结束时间不能为空', trigger: 'change' }],
|
||||||
host: [{ required: true, message: '主持人不能为空', trigger: 'blur' }],
|
host: [{ required: true, message: '主持人不能为空', trigger: 'blur' }],
|
||||||
number: [{ required: true, message: '会议人数不能为空', trigger: 'blur' }],
|
personNum: [{ required: true, message: '会议人数不能为空', trigger: 'blur' }],
|
||||||
content: [{ required: true, message: '学习内容不能为空', trigger: 'blur' }],
|
learningContent: [{ required: true, message: '学习内容不能为空', trigger: 'blur' }],
|
||||||
contact: [{ required: true, message: '联系人不能为空', trigger: 'blur' }],
|
contact: [{ required: true, message: '联系人不能为空', trigger: 'blur' }],
|
||||||
phone: [{ required: true, message: '联系方式不能为空', trigger: 'blur' }],
|
phone: [{ required: true, message: '联系方式不能为空', trigger: 'blur' }],
|
||||||
},
|
},
|
||||||
|
@ -118,37 +117,36 @@ export default {
|
||||||
//方法集合
|
//方法集合
|
||||||
methods: {
|
methods: {
|
||||||
handleSubmit(e) {
|
handleSubmit(e) {
|
||||||
this.$refs.trainForm.validate(valid => {
|
this.$refs.trainForm.validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
alert('submit!');
|
console.log('提交的数据', this.form)
|
||||||
|
terminalTrainEdit(this.form).then((res) => {
|
||||||
|
if (res.code == 200) {
|
||||||
|
this.$message.success('保存成功!')
|
||||||
|
this.$router.push({
|
||||||
|
//跳转list页面
|
||||||
|
path: '/project/project/terminalTrain/list',
|
||||||
|
query: {
|
||||||
|
terminalTrainName: this.$route.query.terminalTrainName,
|
||||||
|
terminalTrainStatus: this.$route.query.terminalTrainStatus,
|
||||||
|
terminalTrainStartDate: this.$route.query.terminalTrainStartDate,
|
||||||
|
terminalTrainEndDate: this.$route.query.terminalTrainEndDate,
|
||||||
|
terminalTrainPageNum: this.$route.query.terminalTrainPageNum,
|
||||||
|
},
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
console.log('error submit!!');
|
this.$message.error('保存失败:' + res.msg)
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
// console.log('提交的数据', this.form)
|
} else {
|
||||||
// terminalTrainEdit(this.form).then((res) => {
|
console.log('error submit!!')
|
||||||
// if (res.code == 200) {
|
return false
|
||||||
// this.$message.success('保存成功!')
|
}
|
||||||
// this.$router.push({
|
})
|
||||||
// //跳转list页面
|
|
||||||
// path: '/project/project/terminalTrain/list',
|
|
||||||
// query: {
|
|
||||||
// terminalTrainName: this.$route.query.terminalTrainName,
|
|
||||||
// terminalTrainStatus: this.$route.query.terminalTrainStatus,
|
|
||||||
// terminalTrainStartDate: this.$route.query.terminalTrainStartDate,
|
|
||||||
// terminalTrainEndDate: this.$route.query.terminalTrainEndDate,
|
|
||||||
// terminalTrainPageNum: this.$route.query.terminalTrainPageNum,
|
|
||||||
// },
|
|
||||||
// })
|
|
||||||
// } else {
|
|
||||||
// this.$message.error('保存失败:' + res.msg)
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
console.log('1---', this.$store.state.user)
|
console.log('1---', this.$store.state.user.info.name)
|
||||||
if (this.$route.query.id) {
|
if (this.$route.query.id) {
|
||||||
this.form = terminalTrainGet(this.$route.query.id).then((res) => {
|
this.form = terminalTrainGet(this.$route.query.id).then((res) => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
|
|
Loading…
Reference in New Issue