From b73fd7fbbe832e91a6ce620763b663fbd4ba7f51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E8=A3=95=E8=B4=A2?= Date: Sun, 8 Oct 2023 22:59:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/mdp/form/formDef/Form.vue | 5 ++-- src/views/mdp/form/source/Index.vue | 44 +++++++++++++++++++++-------- 2 files changed, 36 insertions(+), 13 deletions(-) diff --git a/src/views/mdp/form/formDef/Form.vue b/src/views/mdp/form/formDef/Form.vue index 5532002..e438efd 100644 --- a/src/views/mdp/form/formDef/Form.vue +++ b/src/views/mdp/form/formDef/Form.vue @@ -58,7 +58,7 @@ - + @@ -71,11 +71,12 @@ import * as FormDefApi from '@/api/mdp/form/formDef'; import { mapGetters } from 'vuex' import { MdpFormMixin } from '@/components/mdp-ui/mixin/MdpFormMixin.js'; import FormField from '../formField/Index' +import MdpSource from '../source/Index' export default { name:'formDefForm', mixins:[MdpFormMixin], components: { - FormField + FormField,MdpSource }, computed: { pkOptions(){ diff --git a/src/views/mdp/form/source/Index.vue b/src/views/mdp/form/source/Index.vue index c4fe855..051c04c 100644 --- a/src/views/mdp/form/source/Index.vue +++ b/src/views/mdp/form/source/Index.vue @@ -1,6 +1,6 @@ @@ -8,10 +8,7 @@ import treeTool from '@/components/mdp-ui/js/treeTool.js' export default { - computed: { - ...mapGetters([ - 'userInfo' - ]) + computed: { }, props:{ visible:{ @@ -165,23 +162,48 @@ export default { var sourceStr=""; this.fields=treeTool.translateDataToTree(this.formFields,'pid','id') this.fields.forEach(f=>{ - sourceStr=""+this.createSubSource(f.children)+"" + if(!f.children || f.children.length==0){ + sourceStr=sourceStr+ + "\n"+ + "\n" + }else{ + sourceStr=sourceStr+ + "\n\n"+ + "\t"+this.createSubSource(1,f.children)+ + "\n" + } + }) return sourceStr; }, - createSubSource(children){ + createSubSource(lvl,children){ var sourceStr="" if(!children || children.length==0){ return sourceStr; - }else{ - } children.forEach(f=>{ - sourceStr=sourceStr+""+this.createSubSource(f.children)+"" + if( !f.children || f.children.length==0){ + sourceStr=sourceStr+"\n"+ + this.getTabByLvl(lvl)+"\n"+ + this.getTabByLvl(lvl)+"" + }else{ + sourceStr=sourceStr+"\n"+ + this.getTabByLvl(lvl)+"\n"+ + this.getTabByLvl(lvl+1)+this.createSubSource(lvl+1,f.children)+"\n"+ + this.getTabByLvl(lvl)+"" + } + }) return sourceStr; - } + }, + getTabByLvl(lvl){ + var str="" + for(var i=0;i