项目管理更新

This commit is contained in:
Yuanjianghong 2021-11-15 00:38:53 +08:00
parent df8c6723d8
commit 66acffc8ff
12 changed files with 364 additions and 177 deletions

View File

@ -3,11 +3,8 @@ import request from '@/utils/request'
const projectApi = { const projectApi = {
add: 'project/add', add: 'project/add',
getDict:'project/dict/get', getDict:'project/dict/get',
// get: 'sys/menu/get', list: 'project/pageList',
// update: 'sys/menu/update', projectCourseList: ''
// del: 'sys/menu/delete',
// updateStatus: 'sys/menu/updateStatus',
list: 'project/pageList'
} }
export function projectAdd (params) { export function projectAdd (params) {
@ -24,39 +21,10 @@ export function dictGet (params) {
params: params params: params
}) })
} }
// export function menuGet (params) {
// return request({
// url: menuApi.get,
// method: 'post',
// data: params
// })
// }
// export function menuUpdate (params) {
// return request({
// url: menuApi.update,
// method: 'post',
// data: params
// })
// }
// export function menuDelete (params) {
// return request({
// url: menuApi.del,
// method: 'post',
// data: params
// })
// }
export function getProjectList (params) { export function getProjectList (params) {
console.log("------------{}",params)
return request({ return request({
url: projectApi.list, url: projectApi.list,
method: 'get', method: 'get',
params: params params: params
}) })
} }
// export function menuUpdateStatus (params) {
// return request({
// url: menuApi.updateStatus,
// method: 'post',
// data: params
// })
// }

View File

@ -0,0 +1,21 @@
import request from '@/utils/request'
const projectCourseApi = {
// add: 'project/add',
// getDict:'project/dict/get',
// get: 'sys/menu/get',
// update: 'sys/menu/update',
// del: 'sys/menu/delete',
// // updateStatus: 'sys/menu/updateStatus',
// list: 'project/pageList',
projectCourseList: '/project/course/list'
}
export function getCourseList (params) {
// console.log("------------{}",params)
return request({
url: projectCourseApi.projectCourseList,
method: 'get',
params: params
})
}

View File

@ -6,7 +6,7 @@ const terminalTrainSignApi = {
} }
export function terminalTrainSignList(params) { export function terminalTrainSignList(params) {
console.log("terminalTrainList------------{}", params) // console.log("terminalTrainList------------{}", params)
return request({ return request({
url: terminalTrainSignApi.list, url: terminalTrainSignApi.list,
method: 'get', method: 'get',

View File

@ -7,16 +7,15 @@
<!-- v-if="['2', '3', '4'].includes(form.trainWay)" --> <!-- v-if="['2', '3', '4'].includes(form.trainWay)" -->
<a-step title="选择课程" /> <a-step title="选择课程" />
<a-step title="选择人员" /> <a-step title="选择人员" />
<a-step title="组卷策略" />
<a-step title="完成" /> <a-step title="完成" />
</a-steps> </a-steps>
<div class="content"> <div class="content">
<keep-alive> <step1 v-bind:form="form" v-if="currentTab === 0" @nextStep="nextStep" />
<step1 v-if="currentTab === 0" @nextStep="nextStep" /> <step2 v-bind:form="form" v-if="currentTab === 1" @nextStep="nextStep" @prevStep="prevStep" />
<step2 v-if="currentTab === 1" @nextStep="nextStep" @prevStep="prevStep" /> <step3 v-bind:form="form" v-if="currentTab === 2" @nextStep="nextStep" @prevStep="prevStep" />
<step3 v-if="currentTab === 2" @nextStep="nextStep" @prevStep="prevStep" /> <step4 v-bind:form="form" v-if="currentTab === 3" @nextStep="nextStep" @prevStep="prevStep" />
<step4 v-if="currentTab === 3" @nextStep="nextStep" @prevStep="prevStep" /> <step5 v-bind:form="form" v-if="currentTab === 4" @prevStep="prevStep" @finish="finish" />
<step5 v-if="currentTab === 4" @prevStep="prevStep" @finish="finish" />
</keep-alive>
</div> </div>
</a-card> </a-card>
</template> </template>
@ -25,12 +24,14 @@
import Step1 from './form/ProjectForm' 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'
export default { export default {
components: { components: {
Step1, Step1,
Step2, Step2,
Step3, Step3,
Step4,
}, },
data() { data() {
return { return {
@ -68,16 +69,18 @@ export default {
// handler // handler
// //
nextStep() { nextStep(childValue) {
console.log('1111', this) console.log('进入下一步', childValue)
if (this.currentTab < 5) { if (this.currentTab < 5) {
this.form = childValue;
this.currentTab += 1 this.currentTab += 1
} }
}, },
// //
prevStep() { prevStep(childValue) {
console.log('返回上一步') console.log('返回上一步',childValue)
if (this.currentTab > 0) { if (this.currentTab > 0) {
this.form = childValue
this.currentTab -= 1 this.currentTab -= 1
} }
}, },

View File

@ -8,8 +8,8 @@
@cancel="handleCancel" @cancel="handleCancel"
> >
<a-form-model ref="classForm" :model="form" :rules="rules" :label-col="labelCol" :wrapper-col="wrapperCol"> <a-form-model ref="classForm" :model="form" :rules="rules" :label-col="labelCol" :wrapper-col="wrapperCol">
<a-form-model-item ref="value" label="种类名称" prop="name"> <a-form-model-item ref="name" label="种类名称" prop="name">
<a-input v-model="form.value" /> <a-input v-model="form.name" />
</a-form-model-item> </a-form-model-item>
</a-form-model> </a-form-model>
</a-modal> </a-modal>
@ -33,33 +33,19 @@ export default {
visible: false, visible: false,
confirmLoading: false, confirmLoading: false,
form: { form: {
value: '', name: '',
type: 1, type: 1,
}, },
rules: { rules: {
value: [ name: [{equired: true,message: '请输入种类名称',trigger: 'blur', }],
{
required: true,
message: '请输入种类名称',
trigger: 'blur',
},
],
}, },
labelCol: { labelCol: {
xs: { xs: { span: 24, },
span: 24, sm: { span: 5, },
},
sm: {
span: 5,
},
}, },
wrapperCol: { wrapperCol: {
xs: { xs: { span: 24, },
span: 24, sm: { span: 18, },
},
sm: {
span: 18,
},
}, },
} }
}, },
@ -72,23 +58,29 @@ export default {
showModal() { showModal() {
this.visible = true this.visible = true
}, },
//
handleOk(e) { handleOk(e) {
this.confirmLoading = true this.$refs.classForm.validate(valid => {
classAdd(this.form).then((res) => { if (valid) {
if (res.code == 200) { // alert('submit!');
this.$message.success('新增成功') this.confirmLoading = true
this.confirmLoading = false classAdd(this.form).then((res) => {
this.handleCancel() if (res.code == 200) {
this.$message.success('新增成功')
this.confirmLoading = false
this.handleCancel()
} else {
this.$message.error('新增失败:' + res.msg)
}
})
} else { } else {
this.$message.error('新增失败:' + res.msg) return false;
this.handleCancel()
} }
}) });
}, },
handleCancel(e) { handleCancel(e) {
// console.log('Clicked cancel button') this.$emit('refreshPageData')
// this.$refs.table.refresh()
this.$parent.handleRefresh(false)
this.visible = false this.visible = false
}, },
}, },

View File

@ -15,7 +15,7 @@
</template> </template>
</span> </span>
</s-table> </s-table>
<class-form ref="ClassForm"></class-form> <class-form @refreshPageData="refreshPageData" ref="ClassForm"></class-form>
</a-card> </a-card>
</template> </template>
@ -35,7 +35,7 @@ export default {
}, },
columns: [ columns: [
{ title: '序号', key: 'id', dataIndex: 'id', scopedSlots: { customRender: 'serial' } }, { title: '序号', key: 'id', dataIndex: 'id', scopedSlots: { customRender: 'serial' } },
{ title: '项目种类名称', dataIndex: 'value', key: 'value', align: 'center' }, { title: '项目种类名称', dataIndex: 'name', key: 'name', align: 'center' },
{ {
title: '操作', title: '操作',
align: 'center', align: 'center',
@ -50,19 +50,18 @@ export default {
classDel, classDel,
}, },
methods: { methods: {
//
handledDel(record) { handledDel(record) {
console.log('delete-id', record)
classDel({ ids: record.id }).then((res) => { classDel({ ids: record.id }).then((res) => {
if (res.code == 200) { if (res.code == 200) {
this.$message.success('删除成功') this.$message.success('删除成功')
this.handleRefresh(false) this.$refs.table.refresh(true)
} }
}) })
}, },
getData() {}, //
// refreshPageData() {
handleRefresh(bool) { this.$refs.table.refresh(true)
this.$refs.table.refresh(bool)
}, },
}, },
created: {}, created: {},

View File

@ -38,12 +38,14 @@
//import from 's' //import from 's'
import { STable } from '@/components' import { STable } from '@/components'
import ProjectCourseSelect from './ProjectCourseSelect.vue' import ProjectCourseSelect from './ProjectCourseSelect.vue'
import { getCourseList } from '@/api/project/projectCourse'
export default { export default {
//import使 //import使
components: { components: {
STable, STable,
ProjectCourseSelect, ProjectCourseSelect,
getCourseList,
}, },
props: {}, props: {},
data() { data() {
@ -52,11 +54,12 @@ export default {
labelCol: {}, labelCol: {},
wrapperCol: {}, wrapperCol: {},
vertical: 'vertical', vertical: 'vertical',
data1: {},
totalHours: 0, // totalHours: 0, //
totalLearnHours: 0, // totalLearnHours: 0, //
totalTopicNum: 0, // totalTopicNum: 0, //
queryParam: {},// queryParam: {
id: 1,
},//
columns: [ columns: [
{ title: '序号', key: 'id', dataIndex: 'id', width: 60, scopedSlots: { customRender: 'serial' } }, { title: '序号', key: 'id', dataIndex: 'id', width: 60, scopedSlots: { customRender: 'serial' } },
{ title: '课程编号', dataIndex: 'courseNo', key: 'courseNo' }, { title: '课程编号', dataIndex: 'courseNo', key: 'courseNo' },
@ -67,6 +70,7 @@ export default {
{ title: '项目名称', dataIndex: 'projectName', key: 'projectName' }, { title: '项目名称', dataIndex: 'projectName', key: 'projectName' },
{ title: '操作', width: 200, align: 'center', scopedSlots: { customRender: 'action' }, }, { title: '操作', width: 200, align: 'center', scopedSlots: { customRender: 'action' }, },
], // ], //
loadData: parameter => { return getCourseList(Object.assign(parameter, this.queryParam)).then(res => { return res }) }
} }
}, },
// data // data
@ -77,20 +81,26 @@ export default {
methods: { methods: {
toNext() { toNext() {
console.log('ProjectCourseSelect-toNext', this.form) console.log('ProjectCourseSelect-toNext', this.form)
const { this.$emit('nextStep')
form: { validateFields },
} = this
// //
validateFields((err, values) => { // validateFields((err, values) => {
if (!err) { // if (!err) {
this.$emit('nextStep')
} // }
}) // })
}, },
toPrep() { toPrep() {
console.log('toPrep', this.form) console.log('toPrep', this.form)
this.$emit('prevStep', this.form) this.$emit('prevStep', this.form)
}, },
getProjectCourseList(){
getCourseList(this.queryParam).then((res) => {
if(res.code == 200){
this.data1 = res.rows;
}
})
}
}, },
// - 访this // - 访this

View File

@ -2,7 +2,8 @@
<a-modal <a-modal
id="modal" id="modal"
:title="modalTitle" :title="modalTitle"
:width="1200" :width="1500"
:height="750"
:visible="visible" :visible="visible"
:confirmLoading="confirmLoading" :confirmLoading="confirmLoading"
:destroyOnClose="true" :destroyOnClose="true"
@ -10,10 +11,10 @@
@cancel="handleCancel" @cancel="handleCancel"
> >
<a-row type="flex" justify="center" align="top"> <a-row type="flex" justify="center" align="top">
<a-col :span="6"> <a-col :span="4">
<a-menu v-model="current" mode="horizontal" @click="handleMenuClick"> <a-menu v-model="current" mode="horizontal" @click="handleMenuClick">
<a-menu-item key="sys"> <a-icon type="sys" />系统课程</a-menu-item> <a-menu-item key="sys">系统课程</a-menu-item>
<a-menu-item key="self"> <a-icon type="self" />自制课程</a-menu-item> <a-menu-item key="self">自制课程</a-menu-item>
</a-menu> </a-menu>
<a-tree <a-tree
:replace-fields="replaceFields" :replace-fields="replaceFields"
@ -25,10 +26,10 @@
> >
</a-tree> </a-tree>
</a-col> </a-col>
<a-col :span="18"> <a-col :span="20">
<div id="content"> <div id="content">
<a-transfer <a-transfer
:data-source="courseList.mockData" :data-source="courseList.courseData"
:titles="['待选课程', '已选课程']" :titles="['待选课程', '已选课程']"
:target-keys="courseList.targetKeys" :target-keys="courseList.targetKeys"
:selected-keys="courseList.selectedKeys" :selected-keys="courseList.selectedKeys"
@ -41,7 +42,33 @@
width: '408px', width: '408px',
height: '500px', height: '500px',
}" }"
/> >
<template
slot="children"
slot-scope="{
props: { direction, filteredItems, selectedKeys, disabled: listDisabled },
on: { itemSelectAll, itemSelect },
}"
>
<a-table
:row-selection="getRowSelection({ disabled: listDisabled, selectedKeys, itemSelectAll, itemSelect })"
:columns="direction === 'left' ? courseList.leftColumns : courseList.rightColumns"
:data-source="filteredItems"
size="default"
:style="{ pointerEvents: listDisabled ? 'none' : null }"
:custom-row="
({ key, disabled: itemDisabled }) => ({
on: {
click: () => {
if (itemDisabled || listDisabled) return
itemSelect(key, !selectedKeys.includes(key))
},
},
})
"
/>
</template>
</a-transfer>
</div> </div>
</a-col> </a-col>
</a-row> </a-row>
@ -50,27 +77,43 @@
<script> <script>
import { coursewareClassList } from '@/api/course/courseware' import { coursewareClassList } from '@/api/course/courseware'
import { getCourseList } from '@/api/course/course'
import difference from 'lodash/difference'
//jsjsjson //jsjsjson
//import from '' //import from ''
// const coData = [];
const leftTableColumns = [
{
dataIndex: 'courseCode',
title: '课程编号',
},
{
dataIndex: 'courseName',
title: '课程名称',
},
]
const rightTableColumns = [
{
dataIndex: 'courseCode',
title: '课程编号',
},
{
dataIndex: 'courseName',
title: '课程名称',
},
]
export default { export default {
//import使 //import使
components: { components: {
coursewareClassList, coursewareClassList,
difference,
getCourseList,
}, },
props: {}, props: {},
data() { data() {
const mockData = []
for (let i = 0; i < 20; i++) {
mockData.push({
key: i.toString(),
title: `content${i + 1}`,
description: `description of content${i + 1}`,
disabled: i % 3 < 1,
})
}
// const oriTargetKeys = mockData.filter(item => +item.key % 3 > 1).map(item => item.key);
// //
return { return {
replaceFields: { replaceFields: {
@ -87,10 +130,13 @@ export default {
autoExpandParent: true, autoExpandParent: true,
treeData: [], treeData: [],
courseList: { courseList: {
mockData: [], queryParam: {},
targetKeys: [], courseData: [],
targetKeys: originTargetKeys,
selectedKeys: [], selectedKeys: [],
disabled: false, disabled: false,
leftColumns: leftTableColumns,
rightColumns: rightTableColumns,
}, },
} }
}, },
@ -163,9 +209,40 @@ export default {
console.log('direction:', direction) console.log('direction:', direction)
console.log('target:', e.target) console.log('target:', e.target)
}, },
getRowSelection({ disabled, selectedKeys, itemSelectAll, itemSelect }) {
return {
getCheckboxProps: (item) => ({ props: { disabled: disabled || item.disabled } }),
onSelectAll(selected, selectedRows) {
const treeSelectedKeys = selectedRows.filter((item) => !item.disabled).map(({ key }) => key)
const diffKeys = selected
? difference(treeSelectedKeys, selectedKeys)
: difference(selectedKeys, treeSelectedKeys)
itemSelectAll(diffKeys, selected)
},
onSelect({ key }, selected) {
itemSelect(key, selected)
},
selectedRowKeys: selectedKeys,
}
},
//
queryCourseList() {
getCourseList(this.courseList.queryParam).then((res) => {
if (res.code == 200) {
res.data.map(function (currentValue, index, arr) {
this.courseList.courseData.push({
key: currentValue.id,
courseCode: currentValue.courseCode,
courseName: currentValue.courseName,
})
})
}
})
},
}, },
created() { created() {
this.handleMenuClick() this.handleMenuClick();
// this.queryCourseList();
}, // - 访this }, // - 访this
mounted() {}, // - 访DOM mounted() {}, // - 访DOM
beforeCreate() {}, // - beforeCreate() {}, // -
@ -179,8 +256,8 @@ export default {
</script> </script>
<style scoped> <style scoped>
#content { #content {
background-color: beige; background-color: rgb(202, 221, 188);
width: 100%; width: 100%;
height: 500px; height: 100%;
} }
</style> </style>

View File

@ -124,12 +124,17 @@ import { dictGet } from '@/api/project/project'
import ClassList from '../classAdd/ClassList.vue' import ClassList from '../classAdd/ClassList.vue'
export default { export default {
props: {
form: {
type: Object,
default: () => ({}),
},
},
data() { data() {
return { return {
labelCol: { span: 4 }, labelCol: { span: 4 },
wrapperCol: { span: 14 }, wrapperCol: { span: 14 },
personType: [], personType: [],
form: {},
modalTitle: '新增项目', modalTitle: '新增项目',
visible: false, visible: false,
confirmLoading: false, confirmLoading: false,
@ -140,7 +145,7 @@ export default {
ClassList, ClassList,
}, },
created(ClassList) { created(ClassList) {
console.log('第一个表单创建了'); console.log('第一个表单创建了')
this.fetchTemplateData() this.fetchTemplateData()
}, },
methods: { methods: {
@ -149,14 +154,11 @@ export default {
this.visible = true this.visible = true
this.formLoading = false this.formLoading = false
}, },
// //,
fetchTemplateData() { fetchTemplateData() {
console.log('fetchTemplateData')
let formData = { type: 1 } let formData = { type: 1 }
//
dictGet(formData).then((res) => { dictGet(formData).then((res) => {
console.log(res) console.log(res)
//
if (res.code == 200) { if (res.code == 200) {
const result = res.data const result = res.data
result.forEach((r) => { result.forEach((r) => {
@ -165,7 +167,6 @@ export default {
name: r.name, name: r.name,
}) })
}) })
console.log('----------------', this.personType)
} }
}) })
}, },
@ -176,18 +177,9 @@ export default {
console.log('toNext', this.form) console.log('toNext', this.form)
this.$emit('nextStep', this.form) this.$emit('nextStep', this.form)
}, },
createClass() {
console.log('-------createClass--------')
},
//
randomResit() {
this.form.resitNumber = Math.floor(Math.random() * (5 - 1) + 1)
},
}, },
destroyed() { destroyed() {
console.log('第一个表单销毁了') console.log('第一个表单销毁了')
} },
} }
</script> </script>

View File

@ -0,0 +1,73 @@
<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-col>
<a-col :span="20" id="content"> </a-col>
</a-row>
<a-button type="primary" @click="toNext">下一步</a-button>
<a-button type="primary" @click="toPrev">上一步</a-button>
</div>
</a-form-model>
</template>
<script>
// jsjsjson
// import from ''
export default {
// import使
components: {},
props: {},
data() {
//
return {}
},
// data
computed: {},
// data
watch: {},
//
methods: {
//
toNext() {
this.$emit('nextStep')
},
toPrev() {
this.$emit('prevStep')
},
},
// - 访this
created() {},
// - 访DOM
mounted() {},
// -
beforeCreate() {},
// -
beforeMount() {},
// -
beforeUpdate() {},
// -
updated() {},
// -
beforeDestroy() {},
// -
destroyed() {},
// keep-alive
activated() {},
}
</script>
<style scoped>
#tree {
width: 100%;
height: 100%;
background-color: beige;
}
#content {
width: 100%;
height: 100%;
background-color: bisque;
}
/* /project/form/ProjectPersonForm.vue */
</style>

View File

@ -81,7 +81,7 @@ const treeData = [
const transferDataSource = [] const transferDataSource = []
function flatten(list = []) { function flatten(list = []) {
console.log('执行了flatten函数list', list) // console.log('flattenlist', list)
list.forEach((item) => { list.forEach((item) => {
transferDataSource.push(item) transferDataSource.push(item)
flatten(item.children) flatten(item.children)
@ -90,12 +90,12 @@ function flatten(list = []) {
flatten(JSON.parse(JSON.stringify(treeData))) flatten(JSON.parse(JSON.stringify(treeData)))
function isChecked(selectedKeys, eventKey) { function isChecked(selectedKeys, eventKey) {
console.log('执行了isChecked函数', eventKey, selectedKeys) // console.log('isChecked', eventKey, selectedKeys)
return selectedKeys.indexOf(eventKey) !== -1 return selectedKeys.indexOf(eventKey) !== -1
} }
function handleTreeData(data, targetKeys = []) { function handleTreeData(data, targetKeys = []) {
console.log('执行了handleTreeData函数', data, targetKeys) // console.log('handleTreeData', data, targetKeys)
data.forEach((item) => { data.forEach((item) => {
item['disabled'] = targetKeys.includes(item.key) item['disabled'] = targetKeys.includes(item.key)
if (item.children) { if (item.children) {
@ -106,9 +106,14 @@ function handleTreeData(data, targetKeys = []) {
} }
export default { export default {
props: {
form:{
type: Object,
default: ()=>({}),
},
},
data() { data() {
return { return {
form: this.$form.createForm(this, { name: 'project' }),
targetKeys: [], targetKeys: [],
dataSource: transferDataSource, dataSource: transferDataSource,
@ -139,7 +144,7 @@ export default {
// //
validateFields((err, values) => { validateFields((err, values) => {
if (!err) { if (!err) {
this.$emit('nextStep') this.$emit('nextStep',this.form)
} }
}) })
}, },

View File

@ -1,39 +1,68 @@
<template> <template>
<a-card :bordered="false" :title="titleName"> <a-card :bordered="false" :title="titleName">
<a-form-model @submit="handleSubmit" :model="form" :layout="layout" :labelCol="{span: 2}" :wrapperCol="{span: 10}"> <a-form-model
<a-form-model-item label="培训名称"> ref="trainForm"
@submit="handleSubmit"
:rules="rules"
:model="form"
:layout="layout"
:labelCol="{ span: 2 }"
:wrapperCol="{ span: 10 }"
>
<a-form-model-item label="培训名称" prop="name">
<a-input v-model="form.trainName" /> <a-input v-model="form.trainName" />
</a-form-model-item> </a-form-model-item>
<a-form-item label="培训时间" style="margin-bottom: 0"> <a-form-model-item label="培训时间" style="margin-bottom: 0" porp="date" >
<a-form-item :style="{ display: 'inline-block', width: 'calc(50% - 12px)' }"> <a-form-model-item :style="{ display: 'inline-block', width: 'calc(50% - 12px)' }" prop="date1">
<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-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-item :style="{ display: 'inline-block', width: 'calc(50% - 12px)' }"> <a-form-model-item :style="{ display: 'inline-block', width: 'calc(50% - 12px)' }" prop="date2">
<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-item> </a-form-model-item>
</a-form-item> </a-form-model-item>
<a-form-model-item label="主持人"> <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="会议人数"> <a-form-model-item label="会议人数" prop="number">
<a-input-number v-model="form.personNum" /> <a-input-number v-model="form.personNum" />
</a-form-model-item> </a-form-model-item>
<a-form-model-item label="学习内容"> <a-form-model-item label="学习内容" prop="content">
<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="联系人"> <a-form-model-item label="联系人" prop="contact">
<a-input v-model="form.contact" /> <a-input v-model="form.contact" />
</a-form-model-item> </a-form-model-item>
<a-form-model-item label="联系方式"> <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="备注"> <a-form-model-item label="备注" prop="remark">
<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 htmlType="submit" type="primary" @click="() => { this.form.status = 1}" style="border-left: 200px;"> 保存 </a-button> <a-button
<a-button htmlType="submit" type="primary" @click="() => { this.form.status = 2}"> 保存并发布 </a-button> htmlType="submit"
type="primary"
@click="
() => {
this.form.status = 1
}
"
style="border-left: 200px"
>
保存
</a-button>
<a-button
htmlType="submit"
type="primary"
@click="
() => {
this.form.status = 2
}
"
>
保存并发布
</a-button>
</a-form-model-item> </a-form-model-item>
</a-form-model> </a-form-model>
</a-card> </a-card>
@ -69,7 +98,17 @@ export default {
status: 1, status: 1,
}, },
titleName: '终端培训表单', titleName: '终端培训表单',
layout: 'horizontal' layout: 'horizontal',
rules: {
name: [{ required: true, message: '培训名称不能为空', trigger: 'blur' }],
date1: [{ required: true, message: '培训开始时间不能为空', trigger: 'change'}],
date2: [{ required: true, message: '培训结束时间不能为空', trigger: 'change'}],
host: [{ required: true, message: '主持人不能为空', trigger: 'blur' }],
number: [{ required: true, message: '会议人数不能为空', trigger: 'blur' }],
content: [{ required: true, message: '学习内容不能为空', trigger: 'blur' }],
contact: [{ required: true, message: '联系人不能为空', trigger: 'blur' }],
phone: [{ required: true, message: '联系方式不能为空', trigger: 'blur' }],
},
} }
}, },
// data // data
@ -79,25 +118,33 @@ export default {
// //
methods: { methods: {
handleSubmit(e) { handleSubmit(e) {
console.log('提交的数据', this.form) this.$refs.trainForm.validate(valid => {
terminalTrainEdit(this.form).then((res) => { if (valid) {
if (res.code == 200) { alert('submit!');
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 {
this.$message.error('保存失败:' + res.msg) console.log('error submit!!');
return false;
} }
}) });
// 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 {
// this.$message.error('' + res.msg)
// }
// })
}, },
}, },
created() { created() {