From 4bcdf4d84aef9d36bdae69b6b36aa2cdf6b5ed84 Mon Sep 17 00:00:00 2001 From: liwenxuan <1298531568@qq.com> Date: Mon, 19 Aug 2024 16:38:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=B3=E8=81=94=E8=A1=A8=E5=8D=95-=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=A1=AB=E5=85=85=E8=A7=84=E5=88=99-v0.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/DesignForm/assembly/index.ts | 32 ++- .../DesignForm/formControlPropertiNew.vue | 183 ++++++++++++++++-- .../associatedFormsFillRole.vue | 4 +- 3 files changed, 194 insertions(+), 25 deletions(-) diff --git a/src/components/DesignForm/assembly/index.ts b/src/components/DesignForm/assembly/index.ts index f1370b1..70c43ee 100644 --- a/src/components/DesignForm/assembly/index.ts +++ b/src/components/DesignForm/assembly/index.ts @@ -906,13 +906,31 @@ export default [ }, saveFlag: false, asfasfLabel:'', - fillRoles: [ - { - leftValue: '', - rightValue: '', - id: '', - } - ], + fillRoles: { + master: [ + { + leftValue: '', + rightValue: '', + id: '', + }, + ], + child: [ + { + id: '', + tableKey: '', + filterCondition:{ + conditionHtml: '', + conditionHtmlCopy: '', + gongShi:{ + formulaHtml:'', + mathsFormula:'', + mathsString:'', + }, + }, + childRoles:[] + }, + ], + }, }, config: {} }, diff --git a/src/components/DesignForm/formControlPropertiNew.vue b/src/components/DesignForm/formControlPropertiNew.vue index 65deb79..b822411 100644 --- a/src/components/DesignForm/formControlPropertiNew.vue +++ b/src/components/DesignForm/formControlPropertiNew.vue @@ -1781,9 +1781,9 @@ const showImagePreview = ref(false) controlData.value.item.label = "关联表单" } controlData.value.item.showLabel = true */ - console.log(controlData.value.control.fillRoles) - if(controlData.value.control.fillRoles.length==0){ - controlData.value.control.fillRoles = [ + console.log(controlData.value.control.fillRoles.master) + if(controlData.value.control.fillRoles&&controlData.value.control.fillRoles.master.length==0){ + controlData.value.control.fillRoles.master = [ { leftValue: '', rightValue: '', @@ -1791,7 +1791,26 @@ const showImagePreview = ref(false) } ] } - controlData.value.control.fillRoles[0].id = uuidv4().replaceAll('-','').toString(); + if(controlData.value.control.fillRoles&&controlData.value.control.fillRoles.child.length==0){ + controlData.value.control.fillRoles.child = [ + { + id: '', + tableKey: '', + filterCondition:{ + conditionHtml: '', + conditionHtmlCopy: '', + gongShi:{ + formulaHtml:'', + mathsFormula:'', + mathsString:'', + }, + }, + childRoles:[] + }, + ] + } + controlData.value.control.fillRoles.master[0].id = uuidv4().replaceAll('-','').toString(); + controlData.value.control.fillRoles.child[0].id = uuidv4().replaceAll('-','').toString(); } //实现关联表单设置可选字段中没有当前字段效果 start // console.log(controlData.value.name) @@ -2011,6 +2030,7 @@ const transferDataSourceOptions = [ import AssociatedFormsTinyace from '@/widget/associatedforms/associatedFormsTinyace.vue' import AssociatedFormsTinyaceRange from '@/widget/associatedforms/associatedFormsTinyaceRange.vue' import AssociatedFormsFillRole from '@/widget/associatedforms/associatedFormsFillRole.vue' +import AssociatedFormsChildFillRole from '@/widget/associatedforms/associatedFormsChildFillRole.vue' const treeDefaultProps = { children: 'children', @@ -2077,8 +2097,14 @@ function getAsfasfFieldTreeOptionsValue3() { // const asfasfFieldTree = ref() +const asfasfMasterFieldTree = ref() + +const asfasfChildTableList = ref() + const asfasfFieldTreeOptionsValue3 = ref() +let currentChildTableCount = 0 + function formidChanged(){ if(controlData.value.control.formid===''){ @@ -2090,12 +2116,43 @@ function formidChanged(){ //alert("cfid为空") }else{ let resData = ref(data.children) - //let rootid_ = data.value.label + let dataExceptChild = JSON.parse(JSON.stringify(data.children)) + let dataOnlyChild = JSON.parse(JSON.stringify(data.children)) + dataExceptChild = dataExceptChild.filter((obj: { type: string }) => obj.type!== 'table'); + dataOnlyChild = dataOnlyChild.filter((obj: { type: string }) => obj.type== 'table'); + for(let m = 0;m { label: '当前表单-'+data.treeAttrs.show, children: [...resData.value], treeAttrs: data.treeAttrs, + disabled: true, }] resDataNoTable = resDataNoTable.filter((item: { type: string | null }) => item.type!="table") @@ -2382,13 +2440,46 @@ function associatedFormsDataRangeDialoghandle(){ //alert("cfid为空") }else{ let resData = ref(data.children) - //let rootid_ = data.value.label + let dataExceptChild = JSON.parse(JSON.stringify(data.children)) + let dataOnlyChild = JSON.parse(JSON.stringify(data.children)) + dataExceptChild = dataExceptChild.filter((obj: { type: string }) => obj.type!== 'table'); + dataOnlyChild = dataOnlyChild.filter((obj: { type: string }) => obj.type== 'table'); + for(let m = 0;mstore.activeKey, () => { function addFillRole(){ let onlyNumber = uuidv4().replaceAll('-','').toString(); //获取唯一编码 - controlData.value.control.fillRoles.push({ + controlData.value.control.fillRoles.master.push({ leftValue:'', rightValue:'', id:onlyNumber, }) } +function addChildFillRole(){ + let onlyNumber = uuidv4().replaceAll('-','').toString(); //获取唯一编码 + controlData.value.control.fillRoles.child.push({ + id: onlyNumber, + tableKey: '', + filterCondition:{ + conditionHtml: '', + conditionHtmlCopy: '', + gongShi:{ + formulaHtml:'', + mathsFormula:'', + mathsString:'', + }, + }, + childRoles:[] + }) +} + function delRole(id:String){ - const delRoleData:any = controlData.value.control.fillRoles + const delRoleData:any = controlData.value.control.fillRoles.master + for (var i = 0; i < delRoleData.length; i++) { + if(delRoleData[i].id===id){ + delRoleData.splice(i, 1); + i--; // 如果不减,将漏掉一个元素 + } + } +} + + +function delChildRole(id:String){ + const delRoleData:any = controlData.value.control.fillRoles.child for (var i = 0; i < delRoleData.length; i++) { if(delRoleData[i].id===id){ delRoleData.splice(i, 1); @@ -4388,16 +4508,47 @@ const radioChangeSet = (val:any) => {