This commit is contained in:
yanran200730
2022-04-06 11:59:14 +08:00
parent 7c413fa9b2
commit e67d711db3
6 changed files with 397 additions and 1099 deletions

View File

@@ -1,5 +1,5 @@
<template>
<div class="add-config" :class="[activeStep == 1 ? 'formLayout' : '']">
<div class="add-config">
<ai-detail>
<ai-title slot="title" :title="detailTitle" isShowBack isShowBottomBorder @onBackClick="handleBack"/>
<template slot="step">
@@ -11,7 +11,7 @@
</template>
<template #content v-if="refresh">
<baseInfo ref="baseInfo" :instance="instance" :dict="dict" v-show="activeStep==0"/>
<applyForm ref="applyForm" :value="filedList" :instance="instance" :dict="dict" v-show="activeStep==1"/>
<applyForm ref="applyForm" :instance="instance" :dict="dict" v-show="activeStep==1"/>
<attachmentMaterial ref="attachmentMaterial" :instance="instance" v-show="activeStep==2"/>
<processApproval ref="processApproval" :approvalSteps="applyForm.approvalSteps" :instance="instance"
:dict="dict" v-show="activeStep==3"/>
@@ -39,8 +39,7 @@ export default {
props: {
instance: Function,
dict: Object,
row: Object,
processType: String
row: Object
},
components: {baseInfo, applyForm, attachmentMaterial, processApproval},
data() {
@@ -52,12 +51,8 @@ export default {
approvalSteps: "",
},
processAnnexDefs: [],
detailObj: {
tableInfo: {}
},
refresh: true,
filedList: [],
tableFieldInfos: []
detailObj: {},
refresh: true
}
},
computed: {
@@ -89,12 +84,12 @@ export default {
this.handleBaseInfo()
break
case 1:
this.$refs['applyForm'].onConfirm().then(res => {
if (!res.length) {
return this.$message.error('表单配置不能为空')
}
this.tableFieldInfos = res
this.$refs['applyForm'].handleApplyForm().then(ret => {
this.applyForm.tableId = ret.id
this.applyForm.approvalSteps = ret.approvalSteps.toString()
this.activeStep++
}).catch(err => {
console.error(err);
})
break
case 2:
@@ -110,7 +105,7 @@ export default {
handleBaseInfo() {
this.$refs['baseInfo'].banseInfoForm().then(res => {
if (res) {
// this.$refs['applyForm'].getFormList()
this.$refs['applyForm'].getFormList()
this.baseInfo = res
this.activeStep++
}
@@ -121,22 +116,19 @@ export default {
*/
save() {
this.$refs['processApproval'].handleProcessApproval().then(res => {
this.instance.post(`/app/approval-process-def/add-update`, {
this.instance.post(`/approval-process-def/add-update`, {
...this.detailObj,
...this.baseInfo,
processDefStatus: Number(this.baseInfo.processDefStatus),
tableInfo: {
...this.detailObj.tableInfo,
tableFieldInfos: this.tableFieldInfos
},
tableType: 0,
tableId: this.applyForm.tableId,
processType: 0,
tableType: 2,
processAnnexDefs: this.annexs.map(e => ({...e, mustFill: Number(e.mustFill)})),
processNodeList: res.processNodeList,
processType: this.processType
processNodeList: res.processNodeList
}).then(res => {
if (res.code == 0) {
this.$message.success("保存成功")
this.$router.push({query:{}})
this.$emit("back")
}
})
}).catch(err => {
@@ -144,10 +136,9 @@ export default {
})
},
getDetail(id) {
this.instance.post(`/app/approval-process-def/info-id`, null, {params: {id}}).then(res => {
this.instance.post(`/approval-process-def/info-id`, null, {params: {id}}).then(res => {
if (res?.data) {
this.detailObj = res.data
this.filedList = res.data.tableInfo.tableFieldInfos
this.refreshDetail()
}
})
@@ -162,12 +153,13 @@ export default {
this.$nextTick(() => this.refresh = true)
},
handleBack() {
this.$router.push({query: {}})
this.detailObj?.id && this.$router.push({query: {}})
this.$emit('back')
}
},
created() {
if (this.row?.id) {
this.getDetail(this.row?.id)
if (this.$route.query?.id) {
this.getDetail(this.$route.query?.id)
}
}
}
@@ -177,13 +169,8 @@ export default {
.add-config {
height: 100%;
&.formLayout {
::v-deep .ai-detail__content--wrapper {
max-width: 100%;
height: calc(100%)!important;
padding: 0!important;
overflow: hidden!important;
}
::v-deep .step .el-steps {
height: 72px;
}
.step {