项目管理Form表单更新

This commit is contained in:
Yuanjianghong 2021-11-30 19:37:27 +08:00
parent 1818eb00ee
commit ef74dfef4a
6 changed files with 60 additions and 31 deletions

View File

@ -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',

View File

@ -350,8 +350,6 @@ export default {
.detail-layout {
margin-left: unset;
}
.text {
}
.status-list {
text-align: left;
}

View File

@ -42,7 +42,14 @@
<a-button v-if="hasPerm('project:add')" type="primary" icon="plus" @click="handledCreate">新增项目</a-button>
</a-space>
<s-table ref="table" size="default" rowKey="id" :columns="columns" :data="loadData" :pageNum="Number(this.$route.query.projectPageNum) || 1">
<s-table
ref="table"
size="default"
rowKey="id"
:columns="columns"
:data="loadData"
:pageNum="Number(this.$route.query.projectPageNum) || 1"
>
<span slot="serial" slot-scope="text, record, index">
{{ index + 1 }}
</span>
@ -50,12 +57,11 @@
<template>
<a v-if="hasPerm('project:edit')" href="javascript:;" @click="handledCreate(record)">修改</a>
<a-divider type="vertical" />
<a v-if="hasPerm('project:list')" href="javascript:;" @click="handleDetail(record)">详情</a>
<a-divider type="vertical" />
<a-popconfirm title="是否删除?" @confirm="() => handleDelete(record)">
<a v-if="hasPerm('project:del')" href="javascript:;">删除</a>
</a-popconfirm>
<a-divider type="vertical" />
<a v-if="hasPerm('project:list')" href="javascript:;" @click="handleDetail(record)">详情</a>
<a-divider type="vertical" />
</template>
</span>
</s-table>
@ -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',
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]
},
},
}
</script>

View File

@ -12,7 +12,7 @@
</a-steps>
<div class="content">
<!-- <keep-alive exclude="result"> -->
<step1 v-if="currentTab === 0" :projectForm="form" @nextStep="nextStep" />
<step1 v-if="currentTab === 0" :projectForm="form" @nextStep="nextStep" @close="close" />
<step2 v-if="currentTab === 1" :projectForm="form" @nextStep="nextStep" @prevStep="prevStep" />
<step3 v-if="currentTab === 2" :projectForm="form" @nextStep="nextStep" @prevStep="prevStep" />
<step4 v-if="currentTab === 3" :projectForm="form" @nextStep="nextStep" @prevStep="prevStep" />
@ -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,
},
})
},
},

View File

@ -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() {

View File

@ -1,7 +1,6 @@
<template>
<a-result :status="projectSaveStatus" :title="projectSaveStatus" :sub-title="description">
<template #extra>
<a-button type="primary" @click="toPrev">返回修改</a-button>
<a-button type="primary" @click="toProjectList">去列表页</a-button>
</template>
</a-result>
@ -45,8 +44,12 @@ export default {
},
toProjectList() {
this.$router.push({
path: '/project/list',
query: { projectPageNum: 1 },
path: '/project/list'+this.$route.query.t,
query: {
t: this.$route.query.t,
projectPageNum: 1 ,
queryParam: this.$route.query.projectQueryParam,
},
})
},
},