|
|
|
@ -4,6 +4,7 @@ |
|
|
|
@ 备注: 属性 |
|
|
|
--> |
|
|
|
<script lang='ts' setup> |
|
|
|
import { reactive, computed, toRefs, ref, watch, inject, onBeforeMount, onMounted } from "vue"; |
|
|
|
import validateConfig from "@/components/DesignForm/validate"; |
|
|
|
import { useDesignFormStore } from "@/store/DesignForm/designForm"; |
|
|
|
import { getRequest, uploadUrl } from "@/api/DesignForm"; |
|
|
|
@ -15,7 +16,7 @@ import type { UploadInstance, UploadProps, UploadRawFile,ElTree } from "element- |
|
|
|
import { ElMessage, genFileId } from "element-plus"; |
|
|
|
import { getAssociatedFormsCurrentFieldTree, getAssociatedFormsOrgAndManTree, getCustomerFormList, getAsfasfFieldTree, getAsfasfFieldTreeOptionsValue3, getPersonByRoleId, getAllRole,getQrCodeImgInside, getAssociatedFormsRoleTree } from "@/api/javaRequest"; |
|
|
|
import Draggable from "vuedraggable-es"; |
|
|
|
|
|
|
|
import AssociatedformsForCreate from "@/widget/associatedforms/associatedFormsForCreate.vue"; |
|
|
|
//数学计算公式编辑器 |
|
|
|
import MathFormula from "@/components/DesignForm/math/mathFormula.vue"; |
|
|
|
import { orgInfo } from "@/api/hr/org/type"; |
|
|
|
@ -42,8 +43,8 @@ import errimg from "@/assets/404_images/untilUploadImg.png"; |
|
|
|
const transferSelectUserRangeData = ref({"type":"lowcodeTransfer","unitName":"请选择","iconFont":"fa-arrows-h","control":{"modelValue":[],"fixedOptions":[{"id":"thefirstrootnode","label":"根节点1","unitName":"","disabled":false,"children":[]},{"id":"thesecondrootnode","label":"根节点2","unitName":"","disabled":false,"children":[]}]},"config":{"transferName":"请选择","transferDataSource":"数据源","apiUrl":"/javasys/lowCode/transfer/getOrgAndManTree","method":"post"},"name":"lowcodeTransfer1758525493710","item":{"label":"穿梭框"},"styles":{"divStyle":{"divbox":"all","transparency":100},"labelStyle":{"divbox":"all","transparency":100},"inputStyle":{"transparency":100}}}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const preFillDialogFlag = ref(false) |
|
|
|
const upload = ref<UploadInstance>(); |
|
|
|
const props = withDefaults( |
|
|
|
//接收父级参数 |
|
|
|
defineProps<{ |
|
|
|
@ -93,10 +94,12 @@ const emits = defineEmits<{ |
|
|
|
const { formConfig, formData, formInfo } = toRefs(props); |
|
|
|
const dataSourceOption = ref([]); |
|
|
|
const designType = inject("formDesignType"); |
|
|
|
const resDataForGlxxszExceptself= ref<any>([]); |
|
|
|
//////////////////////////////////////////////// |
|
|
|
const userRangeDialogFlag = ref(false) |
|
|
|
// Local ref for AI config to avoid direct prop modification |
|
|
|
const localAiConfig = ref(props.formInfo.aiConfig || []); |
|
|
|
|
|
|
|
const fileSignAry = reactive<any>([]); |
|
|
|
// Watch for changes in formInfo.aiConfig and update local ref |
|
|
|
watch(() => formInfo.value?.aiConfig, (newVal) => { |
|
|
|
localAiConfig.value = newVal || []; |
|
|
|
@ -104,7 +107,7 @@ watch(() => formInfo.value?.aiConfig, (newVal) => { |
|
|
|
|
|
|
|
// Watch for changes in localAiConfig and emit back to parent |
|
|
|
watch(() => localAiConfig.value, (newVal) => { |
|
|
|
console.log("localAiConfig.value",newVal) |
|
|
|
// console.log("localAiConfig.value",newVal) |
|
|
|
if (formInfo.value) { |
|
|
|
const updatedFormInfo = { ...formInfo.value }; |
|
|
|
updatedFormInfo.aiConfig = newVal; |
|
|
|
@ -132,6 +135,7 @@ const total = ref(10) |
|
|
|
const aft = ref(); |
|
|
|
const aftRange = ref(); |
|
|
|
const roleTree = ref<Tree[]>([]); |
|
|
|
const associatedFormsHideDialogFlag = ref(false); |
|
|
|
//表单基础设置 |
|
|
|
const page = ref<number>(1); |
|
|
|
const pageSize = ref<number>(200000); |
|
|
|
@ -145,6 +149,8 @@ const roleTreeFilterText = ref(""); |
|
|
|
const fieldTreeRef = ref<InstanceType<typeof ElTree>>(); |
|
|
|
const orgTreeRef = ref<InstanceType<typeof ElTree>>(); |
|
|
|
const roleTreeRef = ref<InstanceType<typeof ElTree>>(); |
|
|
|
let resDataForGlxxszExceptself1: any[] = []; |
|
|
|
const videoIndex = ref(0); |
|
|
|
watch(fieldTreeFilterText, (val) => { |
|
|
|
fieldTreeRef.value!.filter(val); |
|
|
|
}); |
|
|
|
@ -154,6 +160,48 @@ watch(orgTreeFilterText, (val) => { |
|
|
|
watch(roleTreeFilterText, (val) => { |
|
|
|
roleTreeRef.value!.filter(val); |
|
|
|
}); |
|
|
|
const treeRefcsk = ref<TreeInstance>(); |
|
|
|
const multipleSelection = ref<User[]>([]) |
|
|
|
const defaultProps = { |
|
|
|
children: 'children', |
|
|
|
label: 'label', |
|
|
|
disabled: 'disabled', |
|
|
|
} |
|
|
|
/** |
|
|
|
@ 作者: 秦东 |
|
|
|
@ 时间: 2026-03-03 08:41:39 |
|
|
|
@ 功能: 原始选项数组(标题行=列,索引列=行),将空值选项放在末尾,键改为'未选择' |
|
|
|
*/ |
|
|
|
const titleOptions = computed(() => { |
|
|
|
const options = currentTitleColumnNode.value?.options || [] |
|
|
|
// 将空值选项放在正常选项后面,键改为'未选择' |
|
|
|
return [...options, { label: '未选择', value: 'notChosen' }] |
|
|
|
}) |
|
|
|
const indexOptions = computed(() => { |
|
|
|
const options = currentIndexColumnNode.value?.options || [] |
|
|
|
// 将空值选项放在正常选项后面,键改为'未选择' |
|
|
|
return [...options, { label: '未选择', value: 'notChosen' }] |
|
|
|
}) |
|
|
|
|
|
|
|
interface User { |
|
|
|
id: number |
|
|
|
name: string |
|
|
|
number: string |
|
|
|
key: string |
|
|
|
|
|
|
|
} |
|
|
|
const componentKey = ref(0); |
|
|
|
const showImagePreview = ref(false); |
|
|
|
//关联表单 |
|
|
|
const customerFormTree = ref<Tree[]>([]); |
|
|
|
const fieldTreeSearchFlag = ref(false); |
|
|
|
const roleTreeSearchFlag = ref(false); |
|
|
|
// 使用 ref 替代 computed,使其可写 |
|
|
|
const zdtcszTableData = ref([]) |
|
|
|
const multipleTableRef = ref<TableInstance>() |
|
|
|
// 定义treeSelectRef |
|
|
|
const treeSelectRef = ref(); |
|
|
|
const unitFormList = ref<optionsInfo[]>([]); |
|
|
|
/** |
|
|
|
@ 作者: 秦东 |
|
|
|
@ 时间: 2026-02-25 11:36:09 |
|
|
|
@ -1371,7 +1419,7 @@ const formidChangedOptionsValue3 = () => { |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
let resDataForGlxxszExceptself1: any[] = []; |
|
|
|
|
|
|
|
/** |
|
|
|
@ 作者: 秦东 |
|
|
|
@ 时间: 2026-02-25 15:57:30 |
|
|
|
@ -1467,7 +1515,7 @@ watch(() => store.activeKey, (val: string) => { |
|
|
|
// // resDataForGlxxszExceptself1 = JSON.parse(JSON.stringify(resDataForGlxxszExceptself.value)); |
|
|
|
// } |
|
|
|
// console.log(resDataForGlxxszExceptself1) |
|
|
|
|
|
|
|
resDataForGlxxszExceptself1 = JSON.parse(JSON.stringify(resDataForGlxxszExceptself.value)); |
|
|
|
for (let i = 0; i < resDataForGlxxszExceptself1.length; i++) { |
|
|
|
let strArr: [string] = resDataForGlxxszExceptself1[i].id.split(":"); |
|
|
|
// console.log(strArr) |
|
|
|
@ -1479,7 +1527,7 @@ watch(() => store.activeKey, (val: string) => { |
|
|
|
i--; // 如果不减,将漏掉一个元素 |
|
|
|
} |
|
|
|
} |
|
|
|
//console.log(resDataForGlxxszExceptself1); |
|
|
|
console.log("getAssociatedFormsCurrentFieldTreeData.value--->",getAssociatedFormsCurrentFieldTreeData.value); |
|
|
|
if ( |
|
|
|
getAssociatedFormsCurrentFieldTreeData.value && |
|
|
|
getAssociatedFormsCurrentFieldTreeData.value.treeAttrs && |
|
|
|
@ -1504,7 +1552,7 @@ watch(() => store.activeKey, (val: string) => { |
|
|
|
immediate: true, |
|
|
|
}) |
|
|
|
|
|
|
|
const fileSignAry = reactive<any>([]); |
|
|
|
|
|
|
|
/** |
|
|
|
@ 作者: 秦东 |
|
|
|
@ 时间: 2026-02-25 16:28:28 |
|
|
|
@ -1921,7 +1969,7 @@ const beforeRemove = ():boolean => { |
|
|
|
@ 功能: 上传成功钩子 |
|
|
|
*/ |
|
|
|
//每个视频上传控件对应一个videoMsg[videoIndex] |
|
|
|
const videoIndex = ref(0); |
|
|
|
|
|
|
|
const videoUploadOk = (response: any) => { |
|
|
|
const { control = {} }: { control: any } = controlData.value; |
|
|
|
control.videoMsg[videoIndex.value].url = response.data.url; |
|
|
|
@ -1951,7 +1999,7 @@ const videoUploadErr = (error: Error) => { |
|
|
|
@ 功能: 检查文件类型 |
|
|
|
更改已上传的视频:el-upload中设置 limit 和 on-exceed 可以在选中时自动替换上一个文件。 |
|
|
|
*/ |
|
|
|
const upload = ref<UploadInstance>(); |
|
|
|
|
|
|
|
const handleExceed: UploadProps["onExceed"] = (files) => { |
|
|
|
upload.value!.clearFiles(); |
|
|
|
const file = files[0] as UploadRawFile; |
|
|
|
@ -1988,7 +2036,7 @@ const lowcodeImageUploadSuccess = ( |
|
|
|
@ 时间: 2026-02-26 13:24:24 |
|
|
|
@ 功能: 子表预填充设置 |
|
|
|
*/ |
|
|
|
const preFillDialogFlag = ref(false) |
|
|
|
|
|
|
|
const preFillDialogShow = () => { |
|
|
|
preFillDialogFlag.value = true |
|
|
|
console.log("子表预填充设置----->",preFillDialogFlag.value) |
|
|
|
@ -2002,7 +2050,7 @@ const preFillDialogDetermine = () => { |
|
|
|
@ 时间: 2026-02-26 13:27:17 |
|
|
|
@ 功能: 用户组织联动选择 showSelectOrgConnectUser |
|
|
|
*/ |
|
|
|
const selectOrgConnectUserDialogFlag = ref(false) |
|
|
|
|
|
|
|
const showSelectOrgConnectUser = () => { |
|
|
|
console.log("showSelectOrgConnectUser--------->",selectOrgConnectUserDialogFlag.value) |
|
|
|
selectOrgConnectUserDialogFlag.value = true |
|
|
|
@ -2047,7 +2095,7 @@ const queryAllRole = () => { |
|
|
|
@ 时间: 2026-02-26 13:34:01 |
|
|
|
@ 功能: 选择用户数据范围 |
|
|
|
*/ |
|
|
|
const userRangeDialogFlag = ref(false) |
|
|
|
|
|
|
|
const handleUserRangeDialogFlag = () => { |
|
|
|
userRangeDialogFlag.value = true |
|
|
|
if(controlData.value.control.queryBy=='role'){ |
|
|
|
@ -2071,7 +2119,7 @@ const formatTooltip = (val: number) => { |
|
|
|
@ 功能: 点击开启隐藏设置 |
|
|
|
*/ |
|
|
|
//关联表单隐藏条件弹窗flag |
|
|
|
const associatedFormsHideDialogFlag = ref(false); |
|
|
|
|
|
|
|
const associatedFormsHideDialoghandle = () => { |
|
|
|
associatedFormsHideDialogFlag.value = true |
|
|
|
controlData.value.control.hideConditionHtmlCopy = controlData.value.control.hideConditionHtml; |
|
|
|
@ -2088,7 +2136,7 @@ watch(()=>associatedFormsHideDialogFlag.value, (val) => { |
|
|
|
} |
|
|
|
}); |
|
|
|
// |
|
|
|
const associatedFormsChooseDialogFlag = ref(false); |
|
|
|
|
|
|
|
const chooseAssociatedForm = () => { |
|
|
|
getCustomerFormTree(); |
|
|
|
associatedFormsChooseDialogFlag.value = true; |
|
|
|
@ -2136,7 +2184,7 @@ const associatedFormsCurrentFormFieldTree = ref<Tree[]>(); |
|
|
|
const associatedFormsCurrentFormFieldTree1 = ref<Tree[]>(); |
|
|
|
const currentFormChildTableFieldsForFillRole = ref<Tree[]>(); |
|
|
|
const associatedFormsCurrentFormFieldTreeNoTable1 = ref<any>([]); |
|
|
|
const resDataForGlxxszExceptself= ref<any>([]); |
|
|
|
|
|
|
|
const associatedFormsCurrentFormFieldTreeForGlxxsz = ref<Tree[]>(); |
|
|
|
const associatedFormsCurrentFormFieldTreeForGlxxszExceptSelf = ref<Tree[]>(); |
|
|
|
let currentChildTableCount = 0 |
|
|
|
@ -3014,7 +3062,7 @@ const beforeAvatarUpload: UploadProps["beforeUpload"] = (rawFile) => { |
|
|
|
|
|
|
|
const getAssociatedFormsCurrentFieldTree1 = () => { |
|
|
|
getAssociatedFormsCurrentFieldTree(props.customerformid).then(({ data }) => { |
|
|
|
// console.log(data) |
|
|
|
console.log("获取关联表单字段--------------------->",data) |
|
|
|
getAssociatedFormsCurrentFieldTreeData.value = JSON.parse(JSON.stringify(data)); |
|
|
|
// console.log(getAssociatedFormsCurrentFieldTreeData) |
|
|
|
if (data.id === "cfid为空" || data.id === "masterTable为null") { |
|
|
|
@ -3260,7 +3308,7 @@ const getDataSource = () => { |
|
|
|
//关联表单数据填充时无法获取当前表单新增且保存的字段,只有关闭重启后方能获取----bug修改 |
|
|
|
//穿梭框编辑固定选项时,修改的节点无法立即预览到,需保存后退出重进才能预览到修改后的----bug修改 |
|
|
|
*/ |
|
|
|
const showAssociatedFormsFillRole = ref(true); |
|
|
|
|
|
|
|
const saveRefreshFormControlAttr = () => { |
|
|
|
getAssociatedFormsCurrentFieldTree1(); |
|
|
|
showAssociatedFormsFillRole.value = false; |
|
|
|
@ -3308,10 +3356,7 @@ const addPickTracn = () => { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const unitFormList = ref<optionsInfo[]>([]); |
|
|
|
const currentAsfChangeCount = ref(0); |
|
|
|
const asfsExpectCurrent = ref<any>([]); |
|
|
|
const asfs = ref<any>([]); |
|
|
|
|
|
|
|
/** |
|
|
|
@ 作者: 秦东 |
|
|
|
@ 时间: 2026-02-27 13:58:13 |
|
|
|
@ -3499,16 +3544,7 @@ const handleExpandTabChange = () => { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
const multipleSelection = ref<User[]>([]) |
|
|
|
|
|
|
|
interface User { |
|
|
|
id: number |
|
|
|
name: string |
|
|
|
number: string |
|
|
|
key: string |
|
|
|
|
|
|
|
} |
|
|
|
const componentKey = ref(0); |
|
|
|
|
|
|
|
const reRenderComponent = () => { |
|
|
|
componentKey.value++; |
|
|
|
@ -3666,7 +3702,7 @@ const changeCurrentUploadImgid = (clickedRow: any) => { |
|
|
|
}; |
|
|
|
|
|
|
|
//图片展示显示控制 |
|
|
|
const showImagePreview = ref(false); |
|
|
|
|
|
|
|
/** |
|
|
|
@ 作者: 秦东 |
|
|
|
@ 时间: 2026-02-28 15:37:09 |
|
|
|
@ -3769,10 +3805,11 @@ const append = (data: Tree) => { |
|
|
|
const changeLabel = (node: TreeNode, data: Tree) => { |
|
|
|
let favDrink = prompt("请输入:"); |
|
|
|
if (favDrink != null && favDrink.length > 0) { |
|
|
|
const parent = node.parent; |
|
|
|
const children: Tree[] = parent.data.children || [parent.data]; |
|
|
|
const index = children.findIndex((d) => d.id === data.id); |
|
|
|
children[index].label = favDrink; |
|
|
|
data.label = favDrink; |
|
|
|
// const parent = node.parent; |
|
|
|
// const children: Tree[] = parent.data.children || [parent.data]; |
|
|
|
// const index = children.findIndex((d) => d.id === data.id); |
|
|
|
// children[index].label = favDrink; |
|
|
|
dataSource.value = [...dataSource.value]; |
|
|
|
} |
|
|
|
}; |
|
|
|
@ -3782,37 +3819,53 @@ const changeLabel = (node: TreeNode, data: Tree) => { |
|
|
|
@ 功能: 设为可选/不可选 |
|
|
|
*/ |
|
|
|
const setNodeEnable = (node: TreeNode, data: Tree) => { |
|
|
|
const parent = node.parent; |
|
|
|
const children: Tree[] = parent.data.children || [parent.data]; |
|
|
|
|
|
|
|
console.log("设为可选/不可选------->",children) |
|
|
|
console.log("设为可选/不可选--node----->",node) |
|
|
|
console.log("设为可选/不可选---data---->",data) |
|
|
|
|
|
|
|
const index = children.findIndex((d) => d.id === data.id); |
|
|
|
node.data.disabled = !node.data.disabled; |
|
|
|
// const parent = node.parent; |
|
|
|
// const children: Tree[] = parent.data.children || [parent.data]; |
|
|
|
|
|
|
|
// console.log("设为可选/不可选------->",children) |
|
|
|
|
|
|
|
if(children[index].disabled){ |
|
|
|
children[index].disabled = !children[index].disabled; |
|
|
|
} |
|
|
|
// const index = children.findIndex((d) => d.id === data.id); |
|
|
|
|
|
|
|
|
|
|
|
// if(children[index].disabled){ |
|
|
|
// children[index].disabled = !children[index].disabled; |
|
|
|
// } |
|
|
|
// console.log("设为可选/不可选---2---->",children) |
|
|
|
dataSource.value = [...dataSource.value]; |
|
|
|
}; |
|
|
|
|
|
|
|
/** |
|
|
|
@ 作者: 秦东 |
|
|
|
@ 时间: 2026-02-28 16:08:04 |
|
|
|
@ 功能: 删除节点 |
|
|
|
*/ |
|
|
|
const remove = (node: TreeNode, data: Tree) => { |
|
|
|
// console.log("删除节点--node----->",node) |
|
|
|
// console.log("删除节点---data---->",data) |
|
|
|
let really = confirm("确认删除吗?\n将删除本节点与本节点的所有子孙节点!1111"); |
|
|
|
if (really) { |
|
|
|
const parent = node.parent; |
|
|
|
const children: Tree[] = parent.data.children || [parent.data]; |
|
|
|
const index = children.findIndex((d) => d.id === data.id); |
|
|
|
children.splice(index, 1); |
|
|
|
treeRefcsk.value?.remove(data) |
|
|
|
// if(controlData.value.control.fixedOptions&&Array.isArray(controlData.value.control.fixedOptions)){ |
|
|
|
// controlData.value.control.fixedOptions.forEach((item: any,index:number) => { |
|
|
|
// if(item.id !== data.id){ |
|
|
|
// controlData.value.control.fixedOptions.splice(index, 1); |
|
|
|
// } |
|
|
|
// }); |
|
|
|
// } |
|
|
|
// const parent = node.parent; |
|
|
|
// const children: Tree[] = parent.data.children || [parent.data]; |
|
|
|
// const index = children.findIndex((d) => d.id === data.id); |
|
|
|
// children.splice(index, 1); |
|
|
|
dataSource.value = [...dataSource.value]; |
|
|
|
} |
|
|
|
}; |
|
|
|
//关联表单 |
|
|
|
const customerFormTree = ref<Tree[]>([]); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ 作者: 秦东 |
|
|
|
@ 时间: 2026-02-28 16:47:42 |
|
|
|
@ -3871,7 +3924,7 @@ const treeDefaultProps = { |
|
|
|
children: "children", |
|
|
|
label: "label", |
|
|
|
}; |
|
|
|
const fieldTreeSearchFlag = ref(false); |
|
|
|
|
|
|
|
const filterNode = (value: string, data: any) => { |
|
|
|
if (!value) return true; |
|
|
|
return data.label ? data.label.includes(value) : false; |
|
|
|
@ -3920,7 +3973,6 @@ const getRoleTree = async () => { |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
const roleTreeSearchFlag = ref(false); |
|
|
|
const handleRoleTreeExpand = () => { |
|
|
|
roleTreeSearchFlag.value = true; |
|
|
|
} |
|
|
|
@ -4332,6 +4384,97 @@ const titleColumnLabel = computed(() => { |
|
|
|
const leftTopLabel = computed(() => { |
|
|
|
return `${indexColumnLabel.value}\\${titleColumnLabel.value}` |
|
|
|
}) |
|
|
|
|
|
|
|
// 监听标题行和索引列的变化,重新生成表格数据 |
|
|
|
watch([titleOptions, indexOptions], ([newTitleOptions, newIndexOptions]) => { |
|
|
|
|
|
|
|
// 如果都没有选择,清空表格数据 |
|
|
|
if (!newTitleOptions.length && !newIndexOptions.length) { |
|
|
|
console.log("如果都没有选择,清空表格数据") |
|
|
|
zdtcszTableData.value = [] |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
// 从 controlData 中获取之前保存的数据,并兼容旧数据(空字符串键) |
|
|
|
const savedData = controlData.value?.control?.zdtcsz?.tableData || {} |
|
|
|
|
|
|
|
// 转换旧数据:将空字符串键转换为'未选择' |
|
|
|
const convertOldData = (data) => { |
|
|
|
const converted = {} |
|
|
|
Object.keys(data).forEach(rowKey => { |
|
|
|
const newRowKey = rowKey === '' ? 'notChosen' : rowKey |
|
|
|
converted[newRowKey] = {} |
|
|
|
Object.keys(data[rowKey]).forEach(colKey => { |
|
|
|
const newColKey = colKey === '' ? 'notChosen' : colKey |
|
|
|
converted[newRowKey][newColKey] = data[rowKey][colKey] |
|
|
|
}) |
|
|
|
}) |
|
|
|
return converted |
|
|
|
} |
|
|
|
|
|
|
|
const convertedSavedData = convertOldData(savedData) |
|
|
|
|
|
|
|
// 情况1:只有标题行,没有索引列 |
|
|
|
if (newTitleOptions.length && !newIndexOptions.length) { |
|
|
|
// 创建一行数据,键为'未选择' |
|
|
|
const rowKey = 'notChosen' |
|
|
|
const rowObj = { |
|
|
|
rowKey: rowKey, |
|
|
|
rowLabel: '未选择' // 第一列显示"未选择" |
|
|
|
} |
|
|
|
|
|
|
|
// 为每个标题列生成值,如果有保存的数据则使用保存的数据 |
|
|
|
newTitleOptions.forEach(colItem => { |
|
|
|
const colKey = colItem.value |
|
|
|
const savedValue = convertedSavedData[rowKey]?.[colKey] || '' |
|
|
|
rowObj[`col_${colKey}`] = savedValue |
|
|
|
}) |
|
|
|
|
|
|
|
zdtcszTableData.value = [rowObj] |
|
|
|
} |
|
|
|
// 情况2:只有索引列,没有标题行 |
|
|
|
else if (!newTitleOptions.length && newIndexOptions.length) { |
|
|
|
// 创建一个默认列 |
|
|
|
const newTableData = newIndexOptions.map(rowItem => { |
|
|
|
const rowKey = rowItem.value |
|
|
|
const rowObj = { |
|
|
|
rowKey: rowKey, |
|
|
|
rowLabel: rowItem.label |
|
|
|
} |
|
|
|
|
|
|
|
// 创建一个默认列 |
|
|
|
const defaultColKey = 'notChosen' |
|
|
|
const savedValue = convertedSavedData[rowKey]?.[defaultColKey] || '' |
|
|
|
rowObj[`col_${defaultColKey}`] = savedValue |
|
|
|
|
|
|
|
return rowObj |
|
|
|
}) |
|
|
|
|
|
|
|
zdtcszTableData.value = newTableData |
|
|
|
} |
|
|
|
// 情况3:标题行和索引列都有(包括空值选项) |
|
|
|
else if (newTitleOptions.length && newIndexOptions.length) { |
|
|
|
// 生成新的表格数据 |
|
|
|
const newTableData = newIndexOptions.map(rowItem => { |
|
|
|
const rowKey = rowItem.value |
|
|
|
const rowObj = { |
|
|
|
rowKey: rowKey, |
|
|
|
rowLabel: rowItem.label |
|
|
|
} |
|
|
|
|
|
|
|
// 为每个标题列生成值,如果有保存的数据则使用保存的数据 |
|
|
|
newTitleOptions.forEach(colItem => { |
|
|
|
const colKey = colItem.value |
|
|
|
const savedValue = convertedSavedData[rowKey]?.[colKey] || '' |
|
|
|
rowObj[`col_${colKey}`] = savedValue |
|
|
|
}) |
|
|
|
|
|
|
|
return rowObj |
|
|
|
}) |
|
|
|
|
|
|
|
zdtcszTableData.value = newTableData |
|
|
|
} |
|
|
|
}, { immediate: true }) |
|
|
|
/** |
|
|
|
@ 作者: 秦东 |
|
|
|
@ 时间: 2026-03-02 16:53:00 |
|
|
|
@ -4782,18 +4925,9 @@ const asfPropsData = computed(()=>{ |
|
|
|
}); |
|
|
|
return result |
|
|
|
}) |
|
|
|
/** |
|
|
|
@ 作者: 秦东 |
|
|
|
@ 时间: 2026-03-03 08:41:39 |
|
|
|
@ 功能: 原始选项数组(标题行=列,索引列=行),将空值选项放在末尾,键改为'未选择' |
|
|
|
*/ |
|
|
|
const titleOptions = computed(() => { |
|
|
|
const options = currentTitleColumnNode.value?.options || [] |
|
|
|
// 将空值选项放在正常选项后面,键改为'未选择' |
|
|
|
return [...options, { label: '未选择', value: 'notChosen' }] |
|
|
|
}) |
|
|
|
// 使用 ref 替代 computed,使其可写 |
|
|
|
const zdtcszTableData = ref([]) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ 作者: 秦东 |
|
|
|
@ 时间: 2026-03-02 16:53:31 |
|
|
|
@ -5085,6 +5219,9 @@ const glxxszTree = computed(()=>{ |
|
|
|
} |
|
|
|
|
|
|
|
console.log(datapropsformList) |
|
|
|
console.log(associatedFormsCurrentFormFieldTreeForGlxxszExceptSelf.value) |
|
|
|
|
|
|
|
|
|
|
|
if(associatedFormsCurrentFormFieldTreeForGlxxszExceptSelf.value && associatedFormsCurrentFormFieldTreeForGlxxszExceptSelf.value[0].children && associatedFormsCurrentFormFieldTreeForGlxxszExceptSelf.value[0].children.length>0){ |
|
|
|
|
|
|
|
|
|
|
|
@ -5576,7 +5713,9 @@ function mergeFormTrees(treeA: any[], treeB: any[]) { |
|
|
|
|
|
|
|
return cTree; |
|
|
|
} |
|
|
|
const multipleTableRef = ref<TableInstance>() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 提取字符串中最后一个英文冒号后的内容,无冒号则返回原字符串 |
|
|
|
* @param {string} str - 输入的字符串 |
|
|
|
@ -5606,12 +5745,17 @@ const xTree = computed(()=>{ |
|
|
|
if(datapropsformList&&datapropsformList.length==0){ |
|
|
|
datapropsformList = JSON.parse(JSON.stringify(props.formList)) |
|
|
|
} |
|
|
|
console.log("datapropsformList------------------>",datapropsformList) |
|
|
|
console.log("associatedFormsCurrentFormFieldTreeForGlxxszExceptSelf------------------>",associatedFormsCurrentFormFieldTreeForGlxxszExceptSelf.value) |
|
|
|
|
|
|
|
console.log("datapropsformList------------------>",associatedFormsCurrentFormFieldTreeForGlxxszExceptSelf.value && associatedFormsCurrentFormFieldTreeForGlxxszExceptSelf.value[0].children && associatedFormsCurrentFormFieldTreeForGlxxszExceptSelf.value[0].children.length>0) |
|
|
|
|
|
|
|
if(associatedFormsCurrentFormFieldTreeForGlxxszExceptSelf.value && associatedFormsCurrentFormFieldTreeForGlxxszExceptSelf.value[0].children && associatedFormsCurrentFormFieldTreeForGlxxszExceptSelf.value[0].children.length>0){ |
|
|
|
let datab = JSON.parse(JSON.stringify(associatedFormsCurrentFormFieldTreeForGlxxszExceptSelf.value[0].children)) |
|
|
|
let currentCompId = controlData.value.name |
|
|
|
//console.log(currentCompId) |
|
|
|
console.log(currentCompId) |
|
|
|
const treeC = mergeAndFilterAssociatedForms(datapropsformList, datab); |
|
|
|
console.log(treeC) |
|
|
|
return treeC |
|
|
|
}else{ |
|
|
|
return [] |
|
|
|
@ -6020,27 +6164,31 @@ function mergeAndFilterAssociatedForms(treeA, treeB) { |
|
|
|
return cTree; |
|
|
|
} |
|
|
|
|
|
|
|
const asfsCurrentTable = computed(()=>{ |
|
|
|
let currentTable: any[] = [] |
|
|
|
let count = 0 |
|
|
|
let result = [] |
|
|
|
xTree.value.forEach((element:any) => { |
|
|
|
const asfsCurrentTable = computed(() => { |
|
|
|
const matchingNodes: any[] = []; |
|
|
|
|
|
|
|
if(getAfterLastColon(element.value) == controlData.value.name){ |
|
|
|
currentTable.push(element) |
|
|
|
count++ |
|
|
|
} |
|
|
|
}); |
|
|
|
if(count>0){ |
|
|
|
result = currentTable[0].children |
|
|
|
}else{ |
|
|
|
result = [] |
|
|
|
// 递归遍历函数 |
|
|
|
function traverse(nodes: any[]) { |
|
|
|
for (const node of nodes) { |
|
|
|
// 检查当前节点是否匹配 |
|
|
|
if (getAfterLastColon(node.value) === controlData.value.name) { |
|
|
|
matchingNodes.push(node); |
|
|
|
} |
|
|
|
// 继续遍历子节点 |
|
|
|
if (node.children && node.children.length > 0) { |
|
|
|
traverse(node.children); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
traverse(xTree.value); |
|
|
|
|
|
|
|
// 返回第一个匹配节点的 children,若无匹配则返回空数组 |
|
|
|
return matchingNodes.length > 0 ? matchingNodes[0].children || [] : []; |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return result |
|
|
|
}) |
|
|
|
// 定义treeSelectRef |
|
|
|
const treeSelectRef = ref(); |
|
|
|
|
|
|
|
const handleTreeSelectChange = (value: any) => { |
|
|
|
console.log(value) |
|
|
|
@ -6105,7 +6253,13 @@ const saveChanges = () => { |
|
|
|
controlData.value.options = mergeArrays(controlData.value.options,options.value); |
|
|
|
options.value = []; |
|
|
|
}; |
|
|
|
|
|
|
|
// 表格列配置 |
|
|
|
const zdtcszTableColumns = computed(() => { |
|
|
|
return titleOptions.value.map(item => ({ |
|
|
|
label: item.label, |
|
|
|
value: item.value |
|
|
|
})) |
|
|
|
}) |
|
|
|
/** |
|
|
|
@ 作者: 秦东 |
|
|
|
@ 时间: 2026-03-03 08:28:29 |
|
|
|
@ -7832,7 +7986,7 @@ const updataBase = (val: any) => { |
|
|
|
title="创建穿梭框选项树" |
|
|
|
top="150px" |
|
|
|
style="margin-top: 70px" |
|
|
|
width="50%" |
|
|
|
width="80%" |
|
|
|
> |
|
|
|
<div v-if="controlData.type == 'lowcodeTransfer'"> |
|
|
|
<el-button |
|
|
|
@ -7845,16 +7999,19 @@ const updataBase = (val: any) => { |
|
|
|
</el-button> |
|
|
|
<!-- 建立树 --> |
|
|
|
<div class="custom-tree-container"> |
|
|
|
|
|
|
|
<el-tree |
|
|
|
ref="treeRefcsk" |
|
|
|
:data="controlData.control.fixedOptions" |
|
|
|
show-checkbox |
|
|
|
node-key="id" |
|
|
|
:default-expand-all="false" |
|
|
|
:expand-on-click-node="true" |
|
|
|
:expand-on-click-node="false" |
|
|
|
:props="defaultProps" |
|
|
|
> |
|
|
|
<template #default="{ node, data }"> |
|
|
|
<span class="custom-tree-node"> |
|
|
|
<span>{{ node.label }}</span> |
|
|
|
<span>{{ node.label }}-->{{ node.id }}</span> |
|
|
|
<span style="float: right"> |
|
|
|
<a style="color: green" @click="append(data)"> 新增子节点 </a> |
|
|
|
<a style="margin-left: 8px" @click="changeLabel(node, data)">编辑节点名</a> |
|
|
|
@ -8543,6 +8700,7 @@ const updataBase = (val: any) => { |
|
|
|
/> |
|
|
|
</div> |
|
|
|
<div style="width: 100%; padding: 20px; overflow-x: auto;"> |
|
|
|
|
|
|
|
<el-table |
|
|
|
:data="zdtcszTableData" |
|
|
|
border |
|
|
|
|