项目管理更新
This commit is contained in:
parent
df8c6723d8
commit
66acffc8ff
|
@ -3,11 +3,8 @@ import request from '@/utils/request'
|
|||
const projectApi = {
|
||||
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'
|
||||
list: 'project/pageList',
|
||||
projectCourseList: ''
|
||||
}
|
||||
|
||||
export function projectAdd (params) {
|
||||
|
@ -24,39 +21,10 @@ export function dictGet (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) {
|
||||
console.log("------------{}",params)
|
||||
return request({
|
||||
url: projectApi.list,
|
||||
method: 'get',
|
||||
params: params
|
||||
})
|
||||
}
|
||||
// export function menuUpdateStatus (params) {
|
||||
// return request({
|
||||
// url: menuApi.updateStatus,
|
||||
// method: 'post',
|
||||
// data: params
|
||||
// })
|
||||
// }
|
||||
|
|
|
@ -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
|
||||
})
|
||||
}
|
|
@ -6,7 +6,7 @@ const terminalTrainSignApi = {
|
|||
}
|
||||
|
||||
export function terminalTrainSignList(params) {
|
||||
console.log("terminalTrainList------------{}", params)
|
||||
// console.log("terminalTrainList------------{}", params)
|
||||
return request({
|
||||
url: terminalTrainSignApi.list,
|
||||
method: 'get',
|
||||
|
|
|
@ -7,16 +7,15 @@
|
|||
<!-- v-if="['2', '3', '4'].includes(form.trainWay)" -->
|
||||
<a-step title="选择课程" />
|
||||
<a-step title="选择人员" />
|
||||
<a-step title="组卷策略" />
|
||||
<a-step title="完成" />
|
||||
</a-steps>
|
||||
<div class="content">
|
||||
<keep-alive>
|
||||
<step1 v-if="currentTab === 0" @nextStep="nextStep" />
|
||||
<step2 v-if="currentTab === 1" @nextStep="nextStep" @prevStep="prevStep" />
|
||||
<step3 v-if="currentTab === 2" @nextStep="nextStep" @prevStep="prevStep" />
|
||||
<step4 v-if="currentTab === 3" @nextStep="nextStep" @prevStep="prevStep" />
|
||||
<step5 v-if="currentTab === 4" @prevStep="prevStep" @finish="finish" />
|
||||
</keep-alive>
|
||||
<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" />
|
||||
</div>
|
||||
</a-card>
|
||||
</template>
|
||||
|
@ -25,12 +24,14 @@
|
|||
import Step1 from './form/ProjectForm'
|
||||
import Step2 from './form/ProjectUnitSelect'
|
||||
import Step3 from './form/ProjectCourseList'
|
||||
import Step4 from './form/ProjectPersonForm'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
Step1,
|
||||
Step2,
|
||||
Step3,
|
||||
Step4,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
@ -68,16 +69,18 @@ export default {
|
|||
|
||||
// handler
|
||||
//下一步
|
||||
nextStep() {
|
||||
console.log('1111', this)
|
||||
nextStep(childValue) {
|
||||
console.log('进入下一步', childValue)
|
||||
if (this.currentTab < 5) {
|
||||
this.form = childValue;
|
||||
this.currentTab += 1
|
||||
}
|
||||
},
|
||||
//上一步
|
||||
prevStep() {
|
||||
console.log('返回上一步')
|
||||
prevStep(childValue) {
|
||||
console.log('返回上一步',childValue)
|
||||
if (this.currentTab > 0) {
|
||||
this.form = childValue
|
||||
this.currentTab -= 1
|
||||
}
|
||||
},
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
@cancel="handleCancel"
|
||||
>
|
||||
<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-input v-model="form.value" />
|
||||
<a-form-model-item ref="name" label="种类名称" prop="name">
|
||||
<a-input v-model="form.name" />
|
||||
</a-form-model-item>
|
||||
</a-form-model>
|
||||
</a-modal>
|
||||
|
@ -33,33 +33,19 @@ export default {
|
|||
visible: false,
|
||||
confirmLoading: false,
|
||||
form: {
|
||||
value: '',
|
||||
name: '',
|
||||
type: 1,
|
||||
},
|
||||
rules: {
|
||||
value: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入种类名称',
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
name: [{equired: true,message: '请输入种类名称',trigger: 'blur', }],
|
||||
},
|
||||
labelCol: {
|
||||
xs: {
|
||||
span: 24,
|
||||
},
|
||||
sm: {
|
||||
span: 5,
|
||||
},
|
||||
xs: { span: 24, },
|
||||
sm: { span: 5, },
|
||||
},
|
||||
wrapperCol: {
|
||||
xs: {
|
||||
span: 24,
|
||||
},
|
||||
sm: {
|
||||
span: 18,
|
||||
},
|
||||
xs: { span: 24, },
|
||||
sm: { span: 18, },
|
||||
},
|
||||
}
|
||||
},
|
||||
|
@ -72,7 +58,12 @@ export default {
|
|||
showModal() {
|
||||
this.visible = true
|
||||
},
|
||||
|
||||
//保存数据
|
||||
handleOk(e) {
|
||||
this.$refs.classForm.validate(valid => {
|
||||
if (valid) {
|
||||
// alert('submit!');
|
||||
this.confirmLoading = true
|
||||
classAdd(this.form).then((res) => {
|
||||
if (res.code == 200) {
|
||||
|
@ -81,14 +72,15 @@ export default {
|
|||
this.handleCancel()
|
||||
} else {
|
||||
this.$message.error('新增失败:' + res.msg)
|
||||
this.handleCancel()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
handleCancel(e) {
|
||||
// console.log('Clicked cancel button')
|
||||
// this.$refs.table.refresh()
|
||||
this.$parent.handleRefresh(false)
|
||||
this.$emit('refreshPageData')
|
||||
this.visible = false
|
||||
},
|
||||
},
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
</template>
|
||||
</span>
|
||||
</s-table>
|
||||
<class-form ref="ClassForm"></class-form>
|
||||
<class-form @refreshPageData="refreshPageData" ref="ClassForm"></class-form>
|
||||
</a-card>
|
||||
</template>
|
||||
|
||||
|
@ -35,7 +35,7 @@ export default {
|
|||
},
|
||||
columns: [
|
||||
{ title: '序号', key: 'id', dataIndex: 'id', scopedSlots: { customRender: 'serial' } },
|
||||
{ title: '项目种类名称', dataIndex: 'value', key: 'value', align: 'center' },
|
||||
{ title: '项目种类名称', dataIndex: 'name', key: 'name', align: 'center' },
|
||||
{
|
||||
title: '操作',
|
||||
align: 'center',
|
||||
|
@ -50,19 +50,18 @@ export default {
|
|||
classDel,
|
||||
},
|
||||
methods: {
|
||||
//删除培训种类
|
||||
handledDel(record) {
|
||||
console.log('delete-id', record)
|
||||
classDel({ ids: record.id }).then((res) => {
|
||||
if (res.code == 200) {
|
||||
this.$message.success('删除成功')
|
||||
this.handleRefresh(false)
|
||||
this.$refs.table.refresh(true)
|
||||
}
|
||||
})
|
||||
},
|
||||
getData() {},
|
||||
// 搜索按钮
|
||||
handleRefresh(bool) {
|
||||
this.$refs.table.refresh(bool)
|
||||
//刷新表格
|
||||
refreshPageData() {
|
||||
this.$refs.table.refresh(true)
|
||||
},
|
||||
},
|
||||
created: {},
|
||||
|
|
|
@ -38,12 +38,14 @@
|
|||
//例如:import 《组件名称》 from '《s组件路径》'
|
||||
import { STable } from '@/components'
|
||||
import ProjectCourseSelect from './ProjectCourseSelect.vue'
|
||||
import { getCourseList } from '@/api/project/projectCourse'
|
||||
|
||||
export default {
|
||||
//import引入的组件需要注入到对象中才能使用
|
||||
components: {
|
||||
STable,
|
||||
ProjectCourseSelect,
|
||||
getCourseList,
|
||||
},
|
||||
props: {},
|
||||
data() {
|
||||
|
@ -52,11 +54,12 @@ export default {
|
|||
labelCol: {},
|
||||
wrapperCol: {},
|
||||
vertical: 'vertical',
|
||||
data1: {},
|
||||
totalHours: 0, //总课时
|
||||
totalLearnHours: 0, //总学时
|
||||
totalTopicNum: 0, //题目数量
|
||||
queryParam: {},//查询数据
|
||||
queryParam: {
|
||||
id: 1,
|
||||
},//查询数据
|
||||
columns: [
|
||||
{ title: '序号', key: 'id', dataIndex: 'id', width: 60, scopedSlots: { customRender: 'serial' } },
|
||||
{ title: '课程编号', dataIndex: 'courseNo', key: 'courseNo' },
|
||||
|
@ -67,6 +70,7 @@ export default {
|
|||
{ title: '项目名称', dataIndex: 'projectName', key: 'projectName' },
|
||||
{ title: '操作', width: 200, align: 'center', scopedSlots: { customRender: 'action' }, },
|
||||
], // 表头
|
||||
loadData: parameter => { return getCourseList(Object.assign(parameter, this.queryParam)).then(res => { return res }) }
|
||||
}
|
||||
},
|
||||
//计算属性 类似于data概念
|
||||
|
@ -77,20 +81,26 @@ export default {
|
|||
methods: {
|
||||
toNext() {
|
||||
console.log('ProjectCourseSelect-toNext', this.form)
|
||||
const {
|
||||
form: { validateFields },
|
||||
} = this
|
||||
// 先校验,通过表单校验后,才进入下一步
|
||||
validateFields((err, values) => {
|
||||
if (!err) {
|
||||
this.$emit('nextStep')
|
||||
}
|
||||
})
|
||||
// 先校验,通过表单校验后,才进入下一步
|
||||
// validateFields((err, values) => {
|
||||
// if (!err) {
|
||||
|
||||
// }
|
||||
// })
|
||||
},
|
||||
toPrep() {
|
||||
console.log('toPrep', this.form)
|
||||
this.$emit('prevStep', this.form)
|
||||
},
|
||||
getProjectCourseList(){
|
||||
getCourseList(this.queryParam).then((res) => {
|
||||
if(res.code == 200){
|
||||
this.data1 = res.rows;
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
//生命周期 - 创建完成(可以访问当前this实例)
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
<a-modal
|
||||
id="modal"
|
||||
:title="modalTitle"
|
||||
:width="1200"
|
||||
:width="1500"
|
||||
:height="750"
|
||||
:visible="visible"
|
||||
:confirmLoading="confirmLoading"
|
||||
:destroyOnClose="true"
|
||||
|
@ -10,10 +11,10 @@
|
|||
@cancel="handleCancel"
|
||||
>
|
||||
<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-item key="sys"> <a-icon type="sys" />系统课程</a-menu-item>
|
||||
<a-menu-item key="self"> <a-icon type="self" />自制课程</a-menu-item>
|
||||
<a-menu-item key="sys">系统课程</a-menu-item>
|
||||
<a-menu-item key="self">自制课程</a-menu-item>
|
||||
</a-menu>
|
||||
<a-tree
|
||||
:replace-fields="replaceFields"
|
||||
|
@ -25,10 +26,10 @@
|
|||
>
|
||||
</a-tree>
|
||||
</a-col>
|
||||
<a-col :span="18">
|
||||
<a-col :span="20">
|
||||
<div id="content">
|
||||
<a-transfer
|
||||
:data-source="courseList.mockData"
|
||||
:data-source="courseList.courseData"
|
||||
:titles="['待选课程', '已选课程']"
|
||||
:target-keys="courseList.targetKeys"
|
||||
:selected-keys="courseList.selectedKeys"
|
||||
|
@ -41,7 +42,33 @@
|
|||
width: '408px',
|
||||
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>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
@ -50,27 +77,43 @@
|
|||
|
||||
<script>
|
||||
import { coursewareClassList } from '@/api/course/courseware'
|
||||
import { getCourseList } from '@/api/course/course'
|
||||
import difference from 'lodash/difference'
|
||||
//这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
|
||||
//例如:import 《组件名称》 from '《组件路径》'
|
||||
|
||||
// const coData = [];
|
||||
|
||||
const leftTableColumns = [
|
||||
{
|
||||
dataIndex: 'courseCode',
|
||||
title: '课程编号',
|
||||
},
|
||||
{
|
||||
dataIndex: 'courseName',
|
||||
title: '课程名称',
|
||||
},
|
||||
]
|
||||
const rightTableColumns = [
|
||||
{
|
||||
dataIndex: 'courseCode',
|
||||
title: '课程编号',
|
||||
},
|
||||
{
|
||||
dataIndex: 'courseName',
|
||||
title: '课程名称',
|
||||
},
|
||||
]
|
||||
export default {
|
||||
//import引入的组件需要注入到对象中才能使用
|
||||
|
||||
components: {
|
||||
coursewareClassList,
|
||||
difference,
|
||||
getCourseList,
|
||||
},
|
||||
props: {},
|
||||
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 {
|
||||
replaceFields: {
|
||||
|
@ -87,10 +130,13 @@ export default {
|
|||
autoExpandParent: true,
|
||||
treeData: [],
|
||||
courseList: {
|
||||
mockData: [],
|
||||
targetKeys: [],
|
||||
queryParam: {},
|
||||
courseData: [],
|
||||
targetKeys: originTargetKeys,
|
||||
selectedKeys: [],
|
||||
disabled: false,
|
||||
leftColumns: leftTableColumns,
|
||||
rightColumns: rightTableColumns,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
@ -163,9 +209,40 @@ export default {
|
|||
console.log('direction:', direction)
|
||||
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() {
|
||||
this.handleMenuClick()
|
||||
this.handleMenuClick();
|
||||
// this.queryCourseList();
|
||||
}, //生命周期 - 创建完成(可以访问当前this实例)
|
||||
mounted() {}, //生命周期 - 挂载完成(可以访问DOM元素)
|
||||
beforeCreate() {}, //生命周期 - 创建之前
|
||||
|
@ -179,8 +256,8 @@ export default {
|
|||
</script>
|
||||
<style scoped>
|
||||
#content {
|
||||
background-color: beige;
|
||||
background-color: rgb(202, 221, 188);
|
||||
width: 100%;
|
||||
height: 500px;
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
|
@ -124,12 +124,17 @@ import { dictGet } from '@/api/project/project'
|
|||
import ClassList from '../classAdd/ClassList.vue'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
form: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
labelCol: { span: 4 },
|
||||
wrapperCol: { span: 14 },
|
||||
personType: [],
|
||||
form: {},
|
||||
modalTitle: '新增项目',
|
||||
visible: false,
|
||||
confirmLoading: false,
|
||||
|
@ -140,7 +145,7 @@ export default {
|
|||
ClassList,
|
||||
},
|
||||
created(ClassList) {
|
||||
console.log('第一个表单创建了');
|
||||
console.log('第一个表单创建了')
|
||||
this.fetchTemplateData()
|
||||
},
|
||||
methods: {
|
||||
|
@ -149,14 +154,11 @@ export default {
|
|||
this.visible = true
|
||||
this.formLoading = false
|
||||
},
|
||||
//获取字典值
|
||||
//获取字典值,请求查询培训种类
|
||||
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) => {
|
||||
|
@ -165,7 +167,6 @@ export default {
|
|||
name: r.name,
|
||||
})
|
||||
})
|
||||
console.log('----------------', this.personType)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
@ -176,18 +177,9 @@ export default {
|
|||
console.log('toNext', this.form)
|
||||
this.$emit('nextStep', this.form)
|
||||
},
|
||||
|
||||
createClass() {
|
||||
console.log('-------createClass--------')
|
||||
},
|
||||
|
||||
//范回一个随机数
|
||||
randomResit() {
|
||||
this.form.resitNumber = Math.floor(Math.random() * (5 - 1) + 1)
|
||||
},
|
||||
},
|
||||
destroyed() {
|
||||
console.log('第一个表单销毁了')
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -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>
|
||||
// 这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
|
||||
// 例如: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>
|
|
@ -81,7 +81,7 @@ const treeData = [
|
|||
|
||||
const transferDataSource = []
|
||||
function flatten(list = []) {
|
||||
console.log('执行了flatten函数:list', list)
|
||||
// console.log('执行了flatten函数:list', list)
|
||||
list.forEach((item) => {
|
||||
transferDataSource.push(item)
|
||||
flatten(item.children)
|
||||
|
@ -90,12 +90,12 @@ function flatten(list = []) {
|
|||
flatten(JSON.parse(JSON.stringify(treeData)))
|
||||
|
||||
function isChecked(selectedKeys, eventKey) {
|
||||
console.log('执行了isChecked函数:', eventKey, selectedKeys)
|
||||
// console.log('执行了isChecked函数:', eventKey, selectedKeys)
|
||||
return selectedKeys.indexOf(eventKey) !== -1
|
||||
}
|
||||
|
||||
function handleTreeData(data, targetKeys = []) {
|
||||
console.log('执行了handleTreeData函数:', data, targetKeys)
|
||||
// console.log('执行了handleTreeData函数:', data, targetKeys)
|
||||
data.forEach((item) => {
|
||||
item['disabled'] = targetKeys.includes(item.key)
|
||||
if (item.children) {
|
||||
|
@ -106,9 +106,14 @@ function handleTreeData(data, targetKeys = []) {
|
|||
}
|
||||
|
||||
export default {
|
||||
props: {
|
||||
form:{
|
||||
type: Object,
|
||||
default: ()=>({}),
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
form: this.$form.createForm(this, { name: 'project' }),
|
||||
targetKeys: [],
|
||||
dataSource: transferDataSource,
|
||||
|
||||
|
@ -139,7 +144,7 @@ export default {
|
|||
// 先校验,通过表单校验后,才进入下一步
|
||||
validateFields((err, values) => {
|
||||
if (!err) {
|
||||
this.$emit('nextStep')
|
||||
this.$emit('nextStep',this.form)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
|
|
@ -1,39 +1,68 @@
|
|||
<template>
|
||||
<a-card :bordered="false" :title="titleName">
|
||||
<a-form-model @submit="handleSubmit" :model="form" :layout="layout" :labelCol="{span: 2}" :wrapperCol="{span: 10}">
|
||||
<a-form-model-item label="培训名称">
|
||||
<a-form-model
|
||||
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-form-model-item>
|
||||
<a-form-item label="培训时间" style="margin-bottom: 0">
|
||||
<a-form-item :style="{ display: 'inline-block', width: 'calc(50% - 12px)' }">
|
||||
<a-form-model-item label="培训时间" style="margin-bottom: 0" porp="date" >
|
||||
<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-form-item>
|
||||
</a-form-model-item>
|
||||
<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-form-item>
|
||||
</a-form-item>
|
||||
<a-form-model-item label="主持人">
|
||||
</a-form-model-item>
|
||||
</a-form-model-item>
|
||||
<a-form-model-item label="主持人" prop="host">
|
||||
<a-input v-model="form.host" />
|
||||
</a-form-model-item>
|
||||
<a-form-model-item label="会议人数">
|
||||
<a-form-model-item label="会议人数" prop="number">
|
||||
<a-input-number v-model="form.personNum" />
|
||||
</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-form-model-item>
|
||||
<a-form-model-item label="联系人">
|
||||
<a-form-model-item label="联系人" prop="contact">
|
||||
<a-input v-model="form.contact" />
|
||||
</a-form-model-item>
|
||||
<a-form-model-item label="联系方式">
|
||||
<a-form-model-item label="联系方式" prop="phone">
|
||||
<a-input v-model="form.phone" />
|
||||
</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-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 htmlType="submit" type="primary" @click="() => { this.form.status = 2}"> 保存并发布 </a-button>
|
||||
<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>
|
||||
</a-card>
|
||||
|
@ -69,7 +98,17 @@ export default {
|
|||
status: 1,
|
||||
},
|
||||
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概念
|
||||
|
@ -79,25 +118,33 @@ export default {
|
|||
//方法集合
|
||||
methods: {
|
||||
handleSubmit(e) {
|
||||
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,
|
||||
},
|
||||
})
|
||||
this.$refs.trainForm.validate(valid => {
|
||||
if (valid) {
|
||||
alert('submit!');
|
||||
} 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() {
|
||||
|
|
Loading…
Reference in New Issue