Browse Source

ai自动化

qin_v20
herenshan112 8 months ago
parent
commit
3fa41884a0
  1. 1
      src/api/DesignForm/fieldUnit.ts
  2. 16
      src/api/DesignForm/filterUnit.ts
  3. 212
      src/components/DesignForm/formControlPropertiNew.vue
  4. 46
      src/views/sysworkflow/lowcodepage/appPage/appPageForm/aiPage.vue
  5. 7
      src/views/sysworkflow/lowcodepage/appPage/appPageForm/pageForm.vue
  6. 2
      src/views/sysworkflow/lowcodepage/appPage/createAppFormPage.vue

1
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"]

16
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
}

212
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<Tree[]>();
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,
},
]);
</script>
<template>
<DataSourcePage
@ -4166,16 +4204,22 @@ const updataBase = (val: any) => {
</div>
</el-row>
<el-row v-else-if="item.type === 'lowcodeImage_url'">
<el-upload
:action="uploadUrl" :before-remove="beforeRemove"
:on-success="lowcodeImageUploadSuccess"
:on-error="videoUploadErr"
:limit="1"
accept=".jpg,.jpeg,.png,.tif,.tga,.bmp,.dds,.svg,.eps,.pdf,.hdr,.raw,.exr,.psd,.afphoto,.afdesign">
<el-button v-if="!controlData.control.uploadFlag" type="primary">默认图片</el-button>
<el-button v-if="controlData.control.uploadFlag" type="primary">已上传默认图片,点击修改</el-button>
</el-upload>
</el-row>
<el-upload
:action="uploadUrl"
:before-remove="beforeRemove"
:on-success="lowcodeImageUploadSuccess"
:on-error="videoUploadErr"
:limit="1"
accept=".jpg,.jpeg,.png,.tif,.tga,.bmp,.dds,.svg,.eps,.pdf,.hdr,.raw,.exr,.psd,.afphoto,.afdesign"
>
<el-button v-if="!controlData.control.uploadFlag" type="primary"
>默认图片</el-button
>
<el-button v-if="controlData.control.uploadFlag" type="primary"
>已上传默认图片,点击修改</el-button
>
</el-upload>
</el-row>
<!-- <el-row v-else-if="item.type === 'lowcodeImage_radius'">
<el-switch v-model="controlData.control.radius" style="margin-right: 15px;"/>
<el-popover
@ -5257,6 +5301,55 @@ const updataBase = (val: any) => {
</template>
</el-form>
</el-tab-pane>
<el-tab-pane label="AI配置" name="aiConfig">
<el-divider content-position="left">AI触发条件设置</el-divider>
{{ props.state }}
<el-card v-for="(item, index) in props.formInfo.aiConfig" class="aiCardBox">
<template #header>
<div class="card-header">
<i class="fa fa-close" @click="delList(index)"></i>
</div>
</template>
<el-form :model="item" label-width="auto">
<el-form-item label="触发字段">
<div v-for="llItem in props.formList">{{ llItem.item }}</div>
</el-form-item>
<el-form-item label="触发方式">
<el-radio-group v-model="item.trigger">
<el-radio :value="1">全部有值</el-radio>
<el-radio :value="2">任一有值</el-radio>
<el-radio :value="3">半数以上有值</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="采用的知识库">
<el-select
v-model="item.library"
multiple
collapse-tags
placeholder="请选择采用的知识库"
>
<el-option
v-for="lItem in libraryList"
:key="lItem.value"
:label="lItem.label"
:value="lItem.value"
/>
</el-select>
</el-form-item>
<el-form-item label="结果呈现方式">
<el-radio-group v-model="item.openShowType">
<el-radio :value="1">底部展示</el-radio>
<el-radio :value="2">消息弹出框</el-radio>
<el-radio :value="3">抽屉</el-radio>
<el-radio :value="4">消息提示</el-radio>
<el-radio :value="5">通知框</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
</el-card>
<el-button type="primary" class="aiBut" @click="addPickTracn">添加条件</el-button>
</el-tab-pane>
</el-tabs>
</div>
<!-- 轮播图设置弹窗 20240122 start -->
@ -5844,7 +5937,8 @@ const updataBase = (val: any) => {
@del-role="delRole"
@child-role-right-changed="childRoleRightChanged"
>
</AssociatedFormsFillRole><!-- -->
</AssociatedFormsFillRole
><!-- -->
</template>
</div>
</div>

46
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;
};
</script>
<template>
<div class="common-layout">
@ -123,8 +141,14 @@ onMounted(() => {
</el-main>
<el-aside width="400px" class="asideBox">
<el-divider content-position="left">AI触发条件设置</el-divider>
<el-button type="warning" class="aiButs" @click="sendPickTracn"
>发布AI触发条件</el-button
>
<el-scrollbar class="aiBox">
<el-card v-for="(item, index) in aiList" class="aiCardBox">
<el-card
v-for="(item, index) in props.state.formData.aiConfig"
class="aiCardBox"
>
<template #header>
<div class="card-header">
<i class="fa fa-close" @click="delList(index)"></i>
@ -202,6 +226,10 @@ onMounted(() => {
.asideBox {
height: calc(100vh - 40px);
}
.aiButs {
width: 94%;
margin-left: 3%;
}
.contBox {
border-right: 1px solid #ccc;
}

7
src/views/sysworkflow/lowcodepage/appPage/appPageForm/pageForm.vue

@ -326,6 +326,12 @@ const gainTableForm = () => {
let kjdkjksd = string2json(result.mastesformjson);
// console.log("-begin-->",state.value.formData.purview)
state.value.formData.purview = kjdkjksd.purview;
if (kjdkjksd.aiConfig) {
state.value.formData.aiConfig = kjdkjksd.aiConfig;
} else {
state.value.formData.aiConfig = [];
}
// console.log("--->",kjdkjksd)
}
state.value.formData.config.groupKey = result.groupKey;
@ -746,6 +752,7 @@ const dialogConfirmTree = (val: treeStruct[], types: string) => {
:is-edit="isEdit"
:form-field="formFieldAry"
:sun-form-field="sunFormFieldAry"
:state="state"
@open-dialog="openAceEditDrawer"
@form-name-change="formNameChanged"
/>

2
src/views/sysworkflow/lowcodepage/appPage/createAppFormPage.vue

@ -222,7 +222,7 @@ onBeforeMount(() => {
<el-tab-pane label="① 页面管理" :name="1"> </el-tab-pane>
<el-tab-pane label="② 流程设计" :name="2"> </el-tab-pane>
<el-tab-pane label="③ 列表设计" :name="3"> </el-tab-pane>
<el-tab-pane label="④ AI设置" :name="4"> </el-tab-pane>
<!-- <el-tab-pane label="④ AI设置" :name="4"> </el-tab-pane> -->
<el-tab-pane label="⑤ 打印设计" :name="5"> </el-tab-pane>
</el-tabs>
</div>

Loading…
Cancel
Save