From 3fa41884a016fc59f033dbb254cd52662e3f1275 Mon Sep 17 00:00:00 2001 From: herenshan112 Date: Fri, 11 Apr 2025 15:33:50 +0800 Subject: [PATCH 1/2] =?UTF-8?q?ai=E8=87=AA=E5=8A=A8=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/DesignForm/fieldUnit.ts | 1 + src/api/DesignForm/filterUnit.ts | 16 ++ .../DesignForm/formControlPropertiNew.vue | 212 +++++++++++++----- .../appPage/appPageForm/aiPage.vue | 46 +++- .../appPage/appPageForm/pageForm.vue | 7 + .../lowcodepage/appPage/createAppFormPage.vue | 2 +- 6 files changed, 215 insertions(+), 69 deletions(-) create mode 100644 src/api/DesignForm/filterUnit.ts diff --git a/src/api/DesignForm/fieldUnit.ts b/src/api/DesignForm/fieldUnit.ts index 903c2bf..ef41804 100644 --- a/src/api/DesignForm/fieldUnit.ts +++ b/src/api/DesignForm/fieldUnit.ts @@ -5,3 +5,4 @@ export const choiceUnit = ["radio"] export const switchUnit = ["switch"] export const checkboxUnit = ["checkbox"] export const orgDeptUnit = ["deptOrg"] +export const layoutUnit = ["grid","card","flex","div","tabs","divider","title","button","lowcodeImage","videoUpAndPlay","table","baidumap","lowcodeCarsusel","signaturemap","component"] diff --git a/src/api/DesignForm/filterUnit.ts b/src/api/DesignForm/filterUnit.ts new file mode 100644 index 0000000..2d02878 --- /dev/null +++ b/src/api/DesignForm/filterUnit.ts @@ -0,0 +1,16 @@ +import { formStruct } from "@/api/DesignForm/types"; +import { layoutUnit } from "@/api/DesignForm/fieldUnit"; +/** +@ 作者: 秦东 +@ 时间: 2025-04-11 15:12:02 +@ 功能: 解析出表单可作为AI变量的元素 +*/ +const analysisFromUnit = (formData:formStruct) => { + console.log("解析出表单可作为AI变量的元素------------>",formData) +} + + + +export default { + analysisFromUnit +} diff --git a/src/components/DesignForm/formControlPropertiNew.vue b/src/components/DesignForm/formControlPropertiNew.vue index faf4b6e..03994d6 100644 --- a/src/components/DesignForm/formControlPropertiNew.vue +++ b/src/components/DesignForm/formControlPropertiNew.vue @@ -36,6 +36,9 @@ import { Plus } from "@element-plus/icons-vue"; import Draggable from "vuedraggable-es"; import { dataBaseStruct } from "@/api/date/type"; +import { formStruct } from "@/api/DesignForm/types"; + +import { analysisFromUnit } from "@/api/DesignForm/filterUnit"; const props = withDefaults( //接收父级参数 @@ -49,6 +52,7 @@ const props = withDefaults( isEdit: boolean; formField: any[]; sunFormField: any[]; + state: formStruct; }>(), { formConfig: () => { @@ -805,14 +809,14 @@ const attrList = computed(() => { vShow: ["videoUpAndPlay"], }, { - label: '默认图片', - value: config.lowcodeImage, - path: 'config.lowcodeImage', - type: 'lowcodeImage_url', - vIf: state.isSearch, - vShow: ['lowcodeImage'] - }, - /*{ + label: "默认图片", + value: config.lowcodeImage, + path: "config.lowcodeImage", + type: "lowcodeImage_url", + vIf: state.isSearch, + vShow: ["lowcodeImage"], + }, + /*{ label: '尺寸', value: config.lowcodeImage, path: 'config.lowcodeImage', @@ -2357,10 +2361,10 @@ function formidChanged() { ); //console.log(dataExceptChild) //dataExceptChild = removeFirstNumElements(dataExceptChild, 8); - - dataExceptChild.splice(0, 2); - dataExceptChild.splice(2, 4); + dataExceptChild.splice(0, 2); + + dataExceptChild.splice(2, 4); dataOnlyChild = dataOnlyChild.filter( (obj: { type: string }) => obj.type == "table" @@ -2560,32 +2564,30 @@ function getAssociatedFormsCurrentFieldTree1() { disabled: true, }, ]; - + //liwenxuan 关联选项设置对子表不生效的bug修复 start 250409 let resDataHasTableButNoTableChild = JSON.parse(JSON.stringify(data.children)); - resDataHasTableButNoTableChild.splice(0,2); - resDataHasTableButNoTableChild.splice(2,4); + resDataHasTableButNoTableChild.splice(0, 2); + resDataHasTableButNoTableChild.splice(2, 4); resDataHasTableButNoTableChild.forEach((element: any) => { - if(element.type&&element.type=="table"){ - element.children = [] - element.disabled = false + if (element.type && element.type == "table") { + element.children = []; + element.disabled = false; } - let currentIdArr = element.id.split(":") + let currentIdArr = element.id.split(":"); //console.log(currentIdArr) - let currentId = currentIdArr[currentIdArr.length-1] + let currentId = currentIdArr[currentIdArr.length - 1]; //console.log(currentId) - - if(currentId==controlData.value.name){ + + if (currentId == controlData.value.name) { /* alert(currentId) console.log(currentId) */ - element.disabled = true + element.disabled = true; } }); - //liwenxuan 关联选项设置对子表不生效的bug修复 end 250409 - resDataNoTable = resDataNoTable.filter( (item: { type: string | null }) => item.type != "table" ); @@ -2638,37 +2640,35 @@ function getAssociatedFormsCurrentFieldTree1() { }); } function removeTreeNode(tree: any, targetId: any) { - // 深拷贝原始树结构避免污染原数据 - const clonedTree = JSON.parse(JSON.stringify(tree)); - - // 递归处理节点 - function processNode(node) { - // 命中目标节点时返回null进行过滤 - if (node.id === targetId) return null; - - // 递归处理子节点并过滤空值 - if (node.children?.length) { - node.children = node.children - .map(child => processNode(child)) - .filter(Boolean); - } + // 深拷贝原始树结构避免污染原数据 + const clonedTree = JSON.parse(JSON.stringify(tree)); + + // 递归处理节点 + function processNode(node) { + // 命中目标节点时返回null进行过滤 + if (node.id === targetId) return null; - return node; + // 递归处理子节点并过滤空值 + if (node.children?.length) { + node.children = node.children.map((child) => processNode(child)).filter(Boolean); } - // 处理单根或多根树结构 - const result = Array.isArray(clonedTree) - ? clonedTree.map(node => processNode(node)).filter(Boolean) - : processNode(clonedTree); + return node; + } + + // 处理单根或多根树结构 + const result = Array.isArray(clonedTree) + ? clonedTree.map((node) => processNode(node)).filter(Boolean) + : processNode(clonedTree); - return result || null; + return result || null; } const customerFormTree = ref(); getCustomerFormList().then(({ data }) => { /* console.log(data.children) console.log(props.customerformid) */ - let datachildrenWithoutSelf = removeTreeNode(data.children,props.customerformid) + let datachildrenWithoutSelf = removeTreeNode(data.children, props.customerformid); let resData = ref(datachildrenWithoutSelf); customerFormTree.value = [ { @@ -3320,8 +3320,8 @@ watch( ) ); } else { - console.log(changedOptions) - console.log(controlData.value.control.glxxsz) + console.log(changedOptions); + console.log(controlData.value.control.glxxsz); for (var i = 0; i < changedOptions.length; i++) { if (controlData.value.control.glxxsz[i] === undefined) { //新增了某个option @@ -3498,7 +3498,7 @@ watch( () => props.formList, (dataList: any) => { //console.log(dataList) - + analysisFromUnit(props.state); if ( dataList && Array.isArray(dataList) && @@ -3581,6 +3581,7 @@ watch( onMounted(() => { gainFormGroupList(); + analysisFromUnit(props.state); }); watch( @@ -3930,6 +3931,43 @@ const updataBase = (val: any) => { // console.log("设定关联数据------2-------》", val.fields); // console.log("设定关联数据------3-------》", state.dataSourceList); }; +//添加条件 +const addPickTracn = () => { + if (props.formInfo.aiConfig) { + props.formInfo.aiConfig.push({ + title: [], + trigger: 1, + openShowType: 1, + }); + } else { + props.formInfo.aiConfig = [ + { + title: [], + trigger: 1, + openShowType: 1, + }, + ]; + } +}; +/** +@ 作者: 秦东 +@ 时间: 2025-04-10 08:12:21 +@ 功能: 知识库 +*/ +const libraryList = ref([ + { + label: "法律法规", + value: 1, + }, + { + label: "安全环保", + value: 2, + }, + { + label: "员工守则", + value: 3, + }, +]); diff --git a/src/views/sysworkflow/lowcodepage/appPage/appPageForm/aiPage.vue b/src/views/sysworkflow/lowcodepage/appPage/appPageForm/aiPage.vue index 41b7fe7..c97fd4c 100644 --- a/src/views/sysworkflow/lowcodepage/appPage/appPageForm/aiPage.vue +++ b/src/views/sysworkflow/lowcodepage/appPage/appPageForm/aiPage.vue @@ -56,18 +56,27 @@ const aiList = reactive([ const aiFormField = ref([]); //添加条件 const addPickTracn = () => { - aiList.push({ - title: "", - trigger: 1, - openShowType: 1, - }); - props.state.formData.aiConfig = aiList; + if (props.state.formData.aiConfig) { + props.state.formData.aiConfig.push({ + title: "", + trigger: 1, + openShowType: 1, + }); + } else { + props.state.formData.aiConfig = [ + { + title: "", + trigger: 1, + openShowType: 1, + }, + ]; + } }; //删除条件 const delList = (index: number) => { console.log("删除条件=========>", index); - if (aiList && aiList.length > 0) { - aiList.splice(index, 1); + if (props.state.formData.aiConfig && props.state.formData.aiConfig.length > 0) { + props.state.formData.aiConfig.splice(index, 1); } }; /** @@ -107,6 +116,15 @@ const jieForm = () => { onMounted(() => { jieForm(); }); +/** +@ 作者: 秦东 +@ 时间: 2025-04-10 13:56:29 +@ 功能: 发布 +*/ +const sendPickTracn = () => { + console.log("发布---------------------->", props); + // props.state.formData.aiConfig = aiList; +};