diff --git a/src/api/DesignForm/filterUnit.ts b/src/api/DesignForm/filterUnit.ts index 7ff71d3..f18f301 100644 --- a/src/api/DesignForm/filterUnit.ts +++ b/src/api/DesignForm/filterUnit.ts @@ -12,6 +12,8 @@ const analysisFromUnit = (unitInfo:formStruct) => { unitInfo.formData.list.forEach((item:any) => { // console.log("解析出表单可作为AI变量的元素------1---1--->",item.label?1:2) if(!layoutUnit.includes(item.type)){ + //by han2015: 暂时只支持普通类型字段 + if (item.type!='input' && item.type!='digitpage') return; let labelName = "" if(item.label){ labelName = item.label @@ -20,7 +22,7 @@ const analysisFromUnit = (unitInfo:formStruct) => { }else{ labelName = item.unitName } - console.log("解析出表单可作为AI变量的元素----2--1-1----->",item) + //console.log("解析出表单可作为AI变量的元素----2--1-1----->",item) optionsInfo.push({ label:labelName, value:item.name diff --git a/src/api/DesignForm/types.ts b/src/api/DesignForm/types.ts index 145f3cf..95669c7 100644 --- a/src/api/DesignForm/types.ts +++ b/src/api/DesignForm/types.ts @@ -57,6 +57,12 @@ export interface FormData { labelStyle:{}, inputStyle:{} } + aiConfig?:{ + library:string[]; + title:string[]; + trigger:number; + openShowType:number; + }[] } export interface TableData { diff --git a/src/api/DesignForm/utils.ts b/src/api/DesignForm/utils.ts index 7772d81..d0f5e32 100644 --- a/src/api/DesignForm/utils.ts +++ b/src/api/DesignForm/utils.ts @@ -106,3 +106,4 @@ export const constSetFormOptions = prefix + 'SetFormOptions' // 使用setOptions export const constGetControlByName = prefix + 'GetControlByName' // 根据name从formData.list查找数据 export const constFormBtnEvent = prefix + 'FormBtnEvent' // 按钮组件事件 export const constFormProps = prefix + 'FormProps' // 按钮组件事件 +export const constAiEffect = prefix + 'AiEffect' // 表单组件触发AI查询事件 diff --git a/src/api/doc/space.ts b/src/api/doc/space.ts index 3dd52b7..2a66158 100644 --- a/src/api/doc/space.ts +++ b/src/api/doc/space.ts @@ -178,4 +178,15 @@ export function setAiChat(data: any){ method: 'post', data: data }); +} + +/** + * 获取智能体 + */ +export function getAiagentList(data?: any){ + return request({ + url: '/aibot/agent/list', + method: 'post', + data: data + }); } \ No newline at end of file diff --git a/src/components/DesignForm/formControlPropertiNew.vue b/src/components/DesignForm/formControlPropertiNew.vue index ba90745..fba6633 100644 --- a/src/components/DesignForm/formControlPropertiNew.vue +++ b/src/components/DesignForm/formControlPropertiNew.vue @@ -21,6 +21,10 @@ import { optionsInfo, } from "@/api/DesignForm/types"; +import { + getAiagentList +} from "@/api/doc/space"; + import { chineseToPinyin, customerFormGroupList, @@ -3561,6 +3565,14 @@ const gainFormGroupList = () => { } }); }; + +//by han2015 +const gainAiagentList=()=>{ + getAiagentList().then(resp=>{ + aiAgentList.value=resp.data + }) +}; + //liwenxuan 2025 移动端单选扫描输入功能 start const scanTypes = [ { @@ -3666,6 +3678,7 @@ watch( onMounted(() => { gainFormGroupList(); analysisFromUnit(props.state); + gainAiagentList() }); watch( @@ -4033,24 +4046,31 @@ const addPickTracn = () => { ]; } }; + +function delList(dex:number){ + if(props.formInfo.aiConfig){ + props.formInfo.aiConfig.splice(dex,1) + } +} + /** @ 作者: 秦东 @ 时间: 2025-04-10 08:12:21 @ 功能: 知识库 */ -const libraryList = ref([ - { - label: "法律法规", - value: 1, - }, - { - label: "安全环保", - value: 2, - }, - { - label: "员工守则", - value: 3, - }, +const aiAgentList = ref([ + // { + // label: "法律法规", + // value: 1, + // }, + // { + // label: "安全环保", + // value: 2, + // }, + // { + // label: "员工守则", + // value: 3, + // }, ]); diff --git a/src/components/DesignForm/public/form/formItem.vue b/src/components/DesignForm/public/form/formItem.vue index e302718..dc118d1 100644 --- a/src/components/DesignForm/public/form/formItem.vue +++ b/src/components/DesignForm/public/form/formItem.vue @@ -16,6 +16,7 @@ import { constControlChange, constSetFormOptions, constFormProps, + constAiEffect, constGetControlByName, } from "@/api/DesignForm/utils"; import validate from "@/api/DesignForm/validate"; @@ -122,6 +123,17 @@ const updateModel = (val: any) => { attribute: controlAttribute, }); }; + +//----------by han2015: support AI event emitting---------------- +//区别与changeEvent,changeEvent是变动即派发,fieldChange是更改完成才派发事件 +const fieldChangeEnt = inject(constAiEffect, '') as any +function onValueChange(_type:string){ + if(_type=="password") return; + fieldChangeEnt && + fieldChangeEnt({key:props.data.name,value:props.modelValue, field:props.data.item.label}) +} +//-------------------------------------- + const value = computed({ get() { if (props.tProp) { @@ -1222,10 +1234,11 @@ const diGuiJilian = (val: any, options: any[]) => { :style="getFormItemInputStyle(configStyle, 2)" :input-style="getFormItemInputStyle(configStyle, 3)" v-if="['input', 'password'].includes(data.type)" + @change="onValueChange(data.type)" :placeholder=" data.control.placeholder ? data.control.placeholder - : '请输入' + getLabel(data.item) + : '请输入>>>' + getLabel(data.item) " >