diff --git a/src/api/project/project.js b/src/api/project/project.js index c42a51b..8d2d006 100644 --- a/src/api/project/project.js +++ b/src/api/project/project.js @@ -1,7 +1,7 @@ import request from '@/utils/request' const projectApi = { - add: 'project/add', + add: 'project/addOrUpdate', getDict:'project/dict/get', list: 'project/pageList', get: 'project/get', diff --git a/src/views/project/ProjectDetail.vue b/src/views/project/ProjectDetail.vue index 3240ab7..8aa2268 100644 --- a/src/views/project/ProjectDetail.vue +++ b/src/views/project/ProjectDetail.vue @@ -350,8 +350,6 @@ export default { .detail-layout { margin-left: unset; } - .text { - } .status-list { text-align: left; } diff --git a/src/views/project/ProjectList.vue b/src/views/project/ProjectList.vue index 8bdcc46..625ddb3 100644 --- a/src/views/project/ProjectList.vue +++ b/src/views/project/ProjectList.vue @@ -42,7 +42,14 @@ 新增项目 - + {{ index + 1 }} @@ -50,12 +57,11 @@ @@ -129,20 +135,43 @@ export default { }, } }, - created() {}, + //生命周期 - 创建完成 + created() { + this.changeType() + }, + //生命周期 - 销毁完成 + destroyed() {}, + // 监控data中的数据变化 + watch: { + $route(to, from) { //to是前往的路由 from是去往的路由 同一个组件只会渲染一次 + this.changeType(to.path) + this.$refs.table.refresh(true) + }, + }, methods: { // 增 handledCreate(record) { this.$router.push({ - path: '/project/projectStepForm', + path: '/project/projectStepForm', query: { + t: this.queryParam.type, //自主项目还是系统项目,控制路由跳转 projectId: record.id, //项目id projectQueryParam: this.queryParam, //查询参数 - projectPageNum: this.$refs.table.localPagination.current //当前页 - } - }); - } - } + projectPageNum: this.$refs.table.localPagination.current, //当前页 + }, + }) + }, + //变更类型 + changeType(path) { + var arr = [] + if(path){ + arr = path.split('/') + }else{ + arr = this.$route.path.split('/') + } + this.queryParam.type = arr[arr.length - 1] + }, + }, } diff --git a/src/views/project/ProjectStepForm.vue b/src/views/project/ProjectStepForm.vue index 9f13b4a..93366fe 100644 --- a/src/views/project/ProjectStepForm.vue +++ b/src/views/project/ProjectStepForm.vue @@ -12,7 +12,7 @@
- + @@ -52,7 +52,7 @@ export default { }, //生命周期 - 创建完成(可以访问当前this实例) created() { - console.log('分步表单创建完成') + console.log('分步表单创建完成',this.$route) if (this.$route.query.projectId) { getProjectDetail({ id: this.$route.query.projectId }).then((res) => { this.form = res.data @@ -66,6 +66,8 @@ export default { return { title: '', currentTab: 0, + sourcePath: '', + t: '', labelCol: { xs: { span: 24 }, sm: { span: 6 }, @@ -79,6 +81,7 @@ export default { confirmLoading: false, type: '', form: { + t: this.$route.query.t, trainWay: '2', totalScore: '100', }, @@ -139,11 +142,13 @@ export default { }, //关闭页面,跳转list页面 close() { + console.log('close------', this.$route.query.t) this.$router.push({ - path: '/project/list', - query:{ - - } + path: '/project/list/'+this.$route.query.t, + query: { + t: this.$route.query.t, + queryParam: this.$route.query.projectQueryParam, + }, }) }, }, diff --git a/src/views/project/form/ProjectForm.vue b/src/views/project/form/ProjectForm.vue index 7553232..16da7aa 100644 --- a/src/views/project/form/ProjectForm.vue +++ b/src/views/project/form/ProjectForm.vue @@ -155,14 +155,8 @@ export default { }, methods: { close() { - this.$router.push({ - path: '/project/list', - }) - }, - add(type) { - this.modalTitle = '新增菜单' - this.visible = true - this.formLoading = false + console.log('Form返回list页面') + this.$emit('close'); }, //获取字典值,请求查询培训种类 fetchTemplateData() { diff --git a/src/views/project/form/Result.vue b/src/views/project/form/Result.vue index 34b5420..a4bfb59 100644 --- a/src/views/project/form/Result.vue +++ b/src/views/project/form/Result.vue @@ -1,7 +1,6 @@