From 5dc691a71e701a2e1ea02388b324cea5c5f9df4f Mon Sep 17 00:00:00 2001 From: liwenxuan <1298531568@qq.com> Date: Tue, 12 Aug 2025 09:49:10 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A8=E5=8D=95=E5=85=B3=E8=81=94=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E4=BF=9D=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/DesignForm/requestapi.ts | 11 +++ .../appPage/appPageForm/pageForm.vue | 75 ++++++++++++++++++- 2 files changed, 84 insertions(+), 2 deletions(-) diff --git a/src/api/DesignForm/requestapi.ts b/src/api/DesignForm/requestapi.ts index 3bba436..93e1e25 100644 --- a/src/api/DesignForm/requestapi.ts +++ b/src/api/DesignForm/requestapi.ts @@ -553,6 +553,17 @@ export function afreshAppSubmit(data: any) { }); } +//保存表单时触发,更新关联表单的相关信息 +export function asfHandle(param1: any) { + return request({ + url: '/javasys/lowCode/AssociatedForms/asfHandle', + method: 'post', + data: { + param:param1 + }, + }) +} + //动态获取关联的系统字段数据作为单选下拉多选的选项 export function getFieldRecord(param1: any) { diff --git a/src/views/sysworkflow/lowcodepage/appPage/appPageForm/pageForm.vue b/src/views/sysworkflow/lowcodepage/appPage/appPageForm/pageForm.vue index 32978d8..d1b9e41 100644 --- a/src/views/sysworkflow/lowcodepage/appPage/appPageForm/pageForm.vue +++ b/src/views/sysworkflow/lowcodepage/appPage/appPageForm/pageForm.vue @@ -16,6 +16,7 @@ import { customerFormVersionCont } from "@/api/DesignForm/type"; import { FormData, formStruct, DrawerStruct, VideoMsg } from "@/api/DesignForm/types"; import { saveProductionForm, + asfHandle, getOneProductionForm, haveCustomerFormVersion, editCustomerFormInfo, @@ -384,7 +385,7 @@ const gainTableForm = () => { }; function saveRefreshFormControlAttr1() { - formControlAttrEl.value.saveRefreshFormControlAttr(); + formControlAttrEl.value.saveRefreshFormControlAttr();// } onMounted(() => { @@ -452,12 +453,82 @@ const saveAppFormData = () => { state.value.loading = false; }); }; + +interface AsfRelation { + bgldbdId: string; + asfByTablekey: string; + glbdzjm: string; +} + +function asfHandler(){ + + /* + relationArr + 当relationArr不为空时,说明本表单关联了其他表单,可以获取到所有被关联的表单id + 1.按照被关联的表单id更新asf_relation表,用glbdzjm和asf_by_tablekey可以唯一确定一个关联关系,如果没有该关联关系,则新增,如果有,则update + 2.按照被关联的表单id更新asf_config表,若无该id对应记录,则新增 + + */ + + /* + asf_config.datatitle #################### + 因为当前保存的表单并不是以被关联表单身份提供的datatitle,而数据库表中的datatitle是被关联表单身份的 + 所以把这个datatitle传到后端,并查询asf_config表中是否已存在本表,若已存在,则更新相应的数据标题记录 + + asf_config.all_fields #################### + 表单的所有字段标识数组,以["a","b","c"]的形式存储 + + 注意:即使保存的表单没有关联其他表单,也应执行上述操作 + */ + + let configDataTitle_arr = state.value.formData.form.dataTitle + let configDataTitle = configDataTitle_arr.join(','); + console.log("config数据标题----->"+configDataTitle_arr) + + let relationArr: AsfRelation[] = [] + + let configAllFields_arr:String[] = [] + state.value.formData.list.forEach((element:any) => { + if(element.type=="associatedForms"){ + let obj:AsfRelation = { + bgldbdId: element.control.formid, + asfByTablekey: element.control.glbbddbd, + glbdzjm: element.name, + } + relationArr.push(obj) + } + configAllFields_arr.push(element.name) + }); + let configAllFields = configAllFields_arr.join(','); + console.log("config所有控件名----->"+configAllFields_arr) + let configBgldbdtableKey = state.value.formData.form.name + console.log("config被关联的表单tablekey----->"+configBgldbdtableKey) + + + console.log(relationArr) + + + + + + /* + 当state.value.formData.list中存在state.value.formData.list[i].type=="associatedForms"时 + 对每个符合条件的元素进行条件拼装,成为一个对象数组 + + */ + + console.log(state.value.formData) + +} + /** @ 作者: 秦东 @ 时间: 2024-05-15 14:07:39 @ 功能: 编辑App自定义表单 */ const editAppFormTable = () => { + + asfHandler() let sendData: any = { jsondata: JSON.stringify(state.value.formData), data: objToStringify(state.value.formData), @@ -472,7 +543,7 @@ const editAppFormTable = () => { menuId: props.menuId, }; state.value.loading = true; - // console.log("编辑App自定义表单",sendData) + console.log("编辑App自定义表单",sendData) editAppPageInfo(sendData) .then((data: any) => { state.value.loading = false;