|
|
|
|
@ -1,28 +1,56 @@
|
|
|
|
|
<template>
|
|
|
|
|
<div class="container">
|
|
|
|
|
<el-card shadow="always">
|
|
|
|
|
<el-card shadow="always" class="card" style="height: 2000px;">
|
|
|
|
|
<template #header>
|
|
|
|
|
<p>{{ config.customModel ? config.customModel.name : '办理' }}</p>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
<div class="steps">
|
|
|
|
|
<el-steps :space="120" finish-status="success" align-center>
|
|
|
|
|
<el-step :title="node.name" status="finish" icon="el-icon-edit"></el-step>
|
|
|
|
|
<el-step v-for="nextNode in node.nextNodes"
|
|
|
|
|
:key="nextNode.id"
|
|
|
|
|
:title="nextNode.name"
|
|
|
|
|
icon="el-icon-right"
|
|
|
|
|
status="wait"></el-step>
|
|
|
|
|
</el-steps>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<el-divider></el-divider>
|
|
|
|
|
|
|
|
|
|
<div class="form-container">
|
|
|
|
|
<template v-if="device === 'desktop'">
|
|
|
|
|
<DesktopForm :device="device" :sub-form="subConfig" :info="fields" :original-form="form"></DesktopForm>
|
|
|
|
|
<DesktopForm :device="device"
|
|
|
|
|
ref="desktopForm"
|
|
|
|
|
:sub-form="subConfig"
|
|
|
|
|
:fields="fields"
|
|
|
|
|
:original-form="form"
|
|
|
|
|
:readable="readableFields"
|
|
|
|
|
:file-list="fileList"
|
|
|
|
|
:writeable="writeableFields"></DesktopForm>
|
|
|
|
|
</template>
|
|
|
|
|
<template v-else>
|
|
|
|
|
<MobileForm :device="device" :info="fields"></MobileForm>
|
|
|
|
|
</template>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="btns" ref="btns">
|
|
|
|
|
<el-button type="primary" size="small" @click="submit">保存并流转 <i class="el-icon-right"></i></el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</el-card>
|
|
|
|
|
|
|
|
|
|
<el-backtop></el-backtop>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import DesktopForm from "./DesktopForm.vue";
|
|
|
|
|
import MobileForm from "./MobileForm.vue";
|
|
|
|
|
import { preConfig } from "@/api/flow"
|
|
|
|
|
import { preConfig, deal, create } from "@/api/flow"
|
|
|
|
|
import { deepCopy } from "@/utils";
|
|
|
|
|
export default {
|
|
|
|
|
components: {
|
|
|
|
|
DesktopForm,
|
|
|
|
|
@ -41,6 +69,9 @@ export default {
|
|
|
|
|
methods: {
|
|
|
|
|
generateForm(object,fields) {
|
|
|
|
|
fields.forEach(field => {
|
|
|
|
|
if(field.type === 'file') {
|
|
|
|
|
this.fileList[field.name] = []
|
|
|
|
|
}
|
|
|
|
|
if(field.type === 'relation') {
|
|
|
|
|
object[field.name] = [{}]
|
|
|
|
|
|
|
|
|
|
@ -58,7 +89,7 @@ export default {
|
|
|
|
|
background: 'rgba(0, 0, 0, 0.8)'
|
|
|
|
|
});
|
|
|
|
|
try {
|
|
|
|
|
const res = await preConfig(this.$route.query.id)
|
|
|
|
|
const res = await preConfig(this.$route.query.module_id)
|
|
|
|
|
const { fields } = res?.customModel;
|
|
|
|
|
let subFormRequest = []
|
|
|
|
|
const getSubForm = (id) => {
|
|
|
|
|
@ -84,6 +115,39 @@ export default {
|
|
|
|
|
this.$message.error("配置失败")
|
|
|
|
|
loading.close()
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
submit() {
|
|
|
|
|
if(this.device === 'desktop') {
|
|
|
|
|
console.log(this.$refs['desktopForm'].form)
|
|
|
|
|
let copyForm = deepCopy(this.$refs['desktopForm'].form)
|
|
|
|
|
let copyFile = deepCopy(this.$refs['desktopForm'].file)
|
|
|
|
|
for (let [key, value] of Object.entries(copyFile)) {
|
|
|
|
|
if (copyForm.hasOwnProperty(key)) {
|
|
|
|
|
copyForm[key] = value.map(i => i.response?.id)?.toString()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for (let key in copyForm) {
|
|
|
|
|
if(copyForm[key] instanceof Array && copyForm[key][0]) {
|
|
|
|
|
let formatObj = {}
|
|
|
|
|
let subKeys = Object.keys(copyForm[key][0])
|
|
|
|
|
subKeys.forEach(key => {
|
|
|
|
|
formatObj[key] = []
|
|
|
|
|
})
|
|
|
|
|
copyForm[key].forEach(item => {
|
|
|
|
|
subKeys.forEach(subKey => {
|
|
|
|
|
formatObj[subKey].push(item[subKey])
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
delete formatObj['_X_ROW_KEY']
|
|
|
|
|
copyForm[key] = formatObj
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
create(copyForm,this.$route.query.module_id)
|
|
|
|
|
console.log(copyForm)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
computed: {
|
|
|
|
|
@ -92,10 +156,21 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
fields() {
|
|
|
|
|
return this.config?.customModel?.fields || []
|
|
|
|
|
},
|
|
|
|
|
readableFields() {
|
|
|
|
|
return this.config?.currentNode?.readable || []
|
|
|
|
|
},
|
|
|
|
|
writeableFields() {
|
|
|
|
|
return this.config?.currentNode?.writeable || []
|
|
|
|
|
},
|
|
|
|
|
node() {
|
|
|
|
|
return this.config?.currentNode || {}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
|
this.getConfig()
|
|
|
|
|
},
|
|
|
|
|
mounted() {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
@ -106,6 +181,16 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
.container {
|
|
|
|
|
padding: 20px;
|
|
|
|
|
|
|
|
|
|
.card {
|
|
|
|
|
position: relative;
|
|
|
|
|
}
|
|
|
|
|
.btns {
|
|
|
|
|
|
|
|
|
|
margin-top: 10px;
|
|
|
|
|
position: sticky;
|
|
|
|
|
bottom: 20px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.form-container {
|
|
|
|
|
}
|
|
|
|
|
|