112 lines
3.7 KiB
Vue
112 lines
3.7 KiB
Vue
<template>
|
||
<a-card :bordered="false" :title="titleName">
|
||
<a-form-model @submit="handleSubmit" :model="form" >
|
||
<a-form-model-item label="培训名称">
|
||
<a-input v-model="form.trainName" />
|
||
</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-model-item label="主持人">
|
||
<a-input v-model="form.host" />
|
||
</a-form-model-item>
|
||
<a-form-model-item label="会议人数">
|
||
<a-input-number v-model="form.personNum" />
|
||
</a-form-model-item>
|
||
<a-form-model-item label="学习内容">
|
||
<a-input v-model="form.learningContent" type="textarea" />
|
||
</a-form-model-item>
|
||
<a-form-model-item label="联系人">
|
||
<a-input v-model="form.contact" />
|
||
</a-form-model-item>
|
||
<a-form-model-item label="联系方式">
|
||
<a-input v-model="form.phone" />
|
||
</a-form-model-item>
|
||
<a-form-model-item label="备注">
|
||
<a-input v-model="form.remark" type="textarea" />
|
||
</a-form-model-item>
|
||
<a-button htmlType="submit" type="primary"> 保存 </a-button>
|
||
</a-form-model>
|
||
</a-card>
|
||
</template>
|
||
|
||
<script>
|
||
//这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
|
||
//例如:import 《组件名称》 from '《组件路径》'
|
||
import { terminalTrainEdit, terminalTrainGet } from '@/api/project/terminalTrain'
|
||
|
||
export default {
|
||
//import引入的组件需要注入到对象中才能使用
|
||
components: {
|
||
terminalTrainEdit,
|
||
terminalTrainGet,
|
||
},
|
||
props: {},
|
||
data() {
|
||
//这里存放数据
|
||
return {
|
||
form: {
|
||
id: '',
|
||
orgId: '',
|
||
trainName: '',
|
||
trainSdate: '',
|
||
trainEdate: '',
|
||
host: '',
|
||
personNum: 1,
|
||
learningContent: '',
|
||
contact: '',
|
||
phone: '',
|
||
remark: '',
|
||
},
|
||
titleName: '新增终端培训',
|
||
}
|
||
},
|
||
//计算属性 类似于data概念
|
||
computed: {},
|
||
//监控data中的数据变化
|
||
watch: {},
|
||
//方法集合
|
||
methods: {
|
||
handleSubmit(e) {
|
||
console.log('提交的数据', this.form)
|
||
terminalTrainEdit(this.form).then((res) => {
|
||
if (res.code == 200) {
|
||
this.$message.success('新增成功')
|
||
this.handleCancel()
|
||
} else {
|
||
this.$message.error('新增失败:' + res.msg)
|
||
this.handleCancel()
|
||
}
|
||
})
|
||
},
|
||
},
|
||
created() {
|
||
if(this.$route.query.id){
|
||
this.form = terminalTrainGet(this.$route.query.id).then((res) => {
|
||
if (res.code == 200) {
|
||
this.form = res.data;
|
||
} else {
|
||
this.$message.error('获取数据失败:' + res.msg)
|
||
}
|
||
}
|
||
)
|
||
}
|
||
}, //生命周期 - 创建完成(可以访问当前this实例)
|
||
mounted() {}, //生命周期 - 挂载完成(可以访问DOM元素)
|
||
beforeCreate() {}, //生命周期 - 创建之前
|
||
beforeMount() {}, //生命周期 - 挂载之前
|
||
beforeUpdate() {}, //生命周期 - 更新之前
|
||
updated() {}, //生命周期 - 更新之后
|
||
beforeDestroy() {}, //生命周期 - 销毁之前
|
||
destroyed() {}, //生命周期 - 销毁完成
|
||
activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
|
||
}
|
||
</script>
|
||
<style scoped>
|
||
</style> |