diff --git a/src/api/project/project.js b/src/api/project/project.js index 3409795..6355e9f 100644 --- a/src/api/project/project.js +++ b/src/api/project/project.js @@ -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 -// }) -// } diff --git a/src/api/project/projectCourse.js b/src/api/project/projectCourse.js new file mode 100644 index 0000000..1321eab --- /dev/null +++ b/src/api/project/projectCourse.js @@ -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 + }) +} \ No newline at end of file diff --git a/src/api/project/terminalTrainSign.js b/src/api/project/terminalTrainSign.js index 88b218b..1d81c41 100644 --- a/src/api/project/terminalTrainSign.js +++ b/src/api/project/terminalTrainSign.js @@ -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', diff --git a/src/views/project/ProjectStepForm.vue b/src/views/project/ProjectStepForm.vue index f702973..4aea7ba 100644 --- a/src/views/project/ProjectStepForm.vue +++ b/src/views/project/ProjectStepForm.vue @@ -7,16 +7,15 @@ +
- - - - - - - + + + + +
@@ -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 } }, diff --git a/src/views/project/classAdd/ClassForm.vue b/src/views/project/classAdd/ClassForm.vue index e095bd8..7e54981 100644 --- a/src/views/project/classAdd/ClassForm.vue +++ b/src/views/project/classAdd/ClassForm.vue @@ -8,8 +8,8 @@ @cancel="handleCancel" > - - + + @@ -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,23 +58,29 @@ export default { showModal() { this.visible = true }, + + //保存数据 handleOk(e) { - this.confirmLoading = true - classAdd(this.form).then((res) => { - if (res.code == 200) { - this.$message.success('新增成功') - this.confirmLoading = false - this.handleCancel() + this.$refs.classForm.validate(valid => { + if (valid) { + // alert('submit!'); + this.confirmLoading = true + classAdd(this.form).then((res) => { + if (res.code == 200) { + this.$message.success('新增成功') + this.confirmLoading = false + this.handleCancel() + } else { + this.$message.error('新增失败:' + res.msg) + } + }) } else { - this.$message.error('新增失败:' + res.msg) - this.handleCancel() + return false; } - }) + }); }, handleCancel(e) { - // console.log('Clicked cancel button') - // this.$refs.table.refresh() - this.$parent.handleRefresh(false) + this.$emit('refreshPageData') this.visible = false }, }, diff --git a/src/views/project/classAdd/ClassList.vue b/src/views/project/classAdd/ClassList.vue index 1e5930c..1be58c3 100644 --- a/src/views/project/classAdd/ClassList.vue +++ b/src/views/project/classAdd/ClassList.vue @@ -15,7 +15,7 @@ - + @@ -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: {}, diff --git a/src/views/project/form/ProjectCourseList.vue b/src/views/project/form/ProjectCourseList.vue index be0a795..ba687f7 100644 --- a/src/views/project/form/ProjectCourseList.vue +++ b/src/views/project/form/ProjectCourseList.vue @@ -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 + this.$emit('nextStep') // 先校验,通过表单校验后,才进入下一步 - 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实例) diff --git a/src/views/project/form/ProjectCourseSelect.vue b/src/views/project/form/ProjectCourseSelect.vue index 66ce767..252bed1 100644 --- a/src/views/project/form/ProjectCourseSelect.vue +++ b/src/views/project/form/ProjectCourseSelect.vue @@ -2,7 +2,8 @@ - + - 系统课程 - 自制课程 + 系统课程 + 自制课程 - +
+ > + +
@@ -50,27 +77,43 @@ \ No newline at end of file diff --git a/src/views/project/form/ProjectForm.vue b/src/views/project/form/ProjectForm.vue index 3498433..6924bc7 100644 --- a/src/views/project/form/ProjectForm.vue +++ b/src/views/project/form/ProjectForm.vue @@ -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('第一个表单销毁了') - } + }, } diff --git a/src/views/project/form/ProjectPersonForm.vue b/src/views/project/form/ProjectPersonForm.vue new file mode 100644 index 0000000..3422713 --- /dev/null +++ b/src/views/project/form/ProjectPersonForm.vue @@ -0,0 +1,73 @@ + + + + \ No newline at end of file diff --git a/src/views/project/form/ProjectUnitSelect.vue b/src/views/project/form/ProjectUnitSelect.vue index 03a13df..3a9477e 100644 --- a/src/views/project/form/ProjectUnitSelect.vue +++ b/src/views/project/form/ProjectUnitSelect.vue @@ -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) } }) }, diff --git a/src/views/project/terminalTrain/TerminalTrainForm.vue b/src/views/project/terminalTrain/TerminalTrainForm.vue index a7564cf..91e6a42 100644 --- a/src/views/project/terminalTrain/TerminalTrainForm.vue +++ b/src/views/project/terminalTrain/TerminalTrainForm.vue @@ -1,39 +1,68 @@