diff --git a/src/components/DesignForm/app/index.vue b/src/components/DesignForm/app/index.vue index 1ce7ded..c712391 100644 --- a/src/components/DesignForm/app/index.vue +++ b/src/components/DesignForm/app/index.vue @@ -74,6 +74,7 @@ const props = withDefaults( viewPage?: viewPageType; formBasicConfig?: any; fieldsDetailList?:any; + orgAndManTree?:any; }>(), { showPage: true, @@ -119,6 +120,9 @@ const props = withDefaults( fieldsDetailList: () => { return {}; }, + orgAndManTree: () => { + return {}; + }, } ); const emits = defineEmits<{ @@ -321,6 +325,7 @@ let checkboxs: any[] = []; let switchs: any[] = []; let selects: any[] = []; let tables: any[] = []; +let dofs: any[] = [];//deptOrgAndOrgCententAndFounderArr function getAsfs() { //setTimeout(() => { let dataList = ref({}); @@ -337,7 +342,9 @@ function getAsfs() { switchs.push(dataList.value[i]) } else if(dataList.value[i].type == "select"){ selects.push(dataList.value[i]) - } else if ( + } else if(dataList.value[i].type == "deptOrg"||dataList.value[i].type == "orgCentent"||dataList.value[i].type == "founder"){//||dataList.value[i].type == "owner"拥有者,"expand-user"选择用户 + dofs.push(dataList.value[i]) + }else if ( dataList.value[i].type == "card" || dataList.value[i].type == "flex" || dataList.value[i].type == "div" || @@ -358,6 +365,8 @@ function getAsfs() { switchs.push(element) }else if(element.type == "select"){ selects.push(element) + }else if(element.type == "deptOrg"||element.type == "orgCentent"||element.type == "founder"){ + dofs.push(element) } }); } else if (dataList.value[i].type == "grid") { @@ -378,6 +387,8 @@ function getAsfs() { switchs.push(a) }else if(a.type == "select"){ selects.push(a) + }else if(a.type == "deptOrg"||a.type == "orgCentent"||a.type == "founder"){ + dofs.push(a) } } } @@ -400,6 +411,8 @@ function getAsfs() { switchs.push(a) }else if(a.type == "select"){ selects.push(a) + }else if(a.type == "deptOrg"||a.type == "orgCentent"||a.type == "founder"){ + dofs.push(a) }else if (a.type == "flex" || a.type == "table") { if (a.type == "table") { tables.push(dataList.value[i]); @@ -419,6 +432,8 @@ function getAsfs() { switchs.push(q) }else if(q.type == "select"){ selects.push(q) + }else if(q.type == "deptOrg"||q.type == "orgCentent"||q.type == "founder"){ + dofs.push(q) } } } @@ -448,6 +463,36 @@ function convertStringToArray(str: string) { let parts = str.split(','); return parts.map(part => parseFloat(part)); } +interface Tree { + id?: string; + label: string; + disabled?: boolean; + children?: Tree[]; + parentId?: string; + [key: string]: any; +} +function getLabelById(id: string): string | undefined { + //console.log(id) + const treeNodes = props.orgAndManTree; + + const findLabel = (nodes: Tree[]): string | undefined => { + for (const node of nodes) { + // 检查当前节点是否匹配目标id + if (node.id === id) { + return node.label; + } + // 递归遍历子节点 + if (node.children?.length) { + const found = findLabel(node.children); + if (found) return found; + } + } + return undefined; + }; + + return findLabel(treeNodes); +} + //liwenxuan 20250120 二维码 end @@ -472,11 +517,11 @@ const setUpClick = (val: string, id: string) => { //在此组装参数,以生成二维码图片 let idArray = state.selectionChecked.map(item => item.id); if(idArray.length>0){ - /* const loadingInstance1 = ElLoading.service({ + const loadingInstance1 = ElLoading.service({ fullscreen: true, text: '正在生成二维码,请稍候...' // 添加的文字内容,可根据需要修改 - }); */ - console.log(props.formBasicConfig) + }); + //console.log(props.formBasicConfig) if(props.formBasicConfig.qrCodeFlag==true){ if(props.formBasicConfig.qrCodeInside==true){ if(props.formBasicConfig.qrCodePrintStyle&&props.formBasicConfig.qrCodePrintStyle=="2"&&props.formBasicConfig.qrCodeShowFields.length==0){ @@ -532,6 +577,15 @@ const setUpClick = (val: string, id: string) => { } } }); + //console.log(dofs) + dofs.forEach(function(element) { + if(attr_name==element.name){ + //表格属性中存在此单选,将其value根据options替换为可读值 + let toConvertValue = currentFieldsMap[attr_name].split("!@#@!")[1] + let orgName = getLabelById(toConvertValue) + currentFieldsMap[attr_name] = currentFieldsMap[attr_name].split("!@#@!")[0]+"!@#@!"+orgName + } + }); switchs.forEach(function(element) { if(attr_name==element.name){ //表格属性中存在此单选,将其value根据options替换为可读值 @@ -636,7 +690,7 @@ const setUpClick = (val: string, id: string) => { setTimeout(()=>{ - //loadingInstance1.close() + loadingInstance1.close() qrCodesPrintDialogFlag.value = true },820) @@ -644,9 +698,11 @@ const setUpClick = (val: string, id: string) => { //fieldsMap = null tablesData.value = getDetailQrCodesData qrCodesPrintDialogFlag.value = true - //loadingInstance1.close() + loadingInstance1.close() } + }).finally(()=>{ + loadingInstance1.close() }) }else{ alert("内部二维码功能未启用") @@ -899,6 +955,7 @@ const getPageData = () => { switchs = []; selects = []; tables = []; + dofs = []; getAsfs() }); } diff --git a/src/components/DesignForm/tableListPage/index.vue b/src/components/DesignForm/tableListPage/index.vue index 7e6caf2..f51cecf 100644 --- a/src/components/DesignForm/tableListPage/index.vue +++ b/src/components/DesignForm/tableListPage/index.vue @@ -70,6 +70,7 @@ const props = withDefaults( viewPage?: viewPageType; formBasicConfig?: any; fieldsDetailList?:any; + orgAndManTree?:any; }>(), { showPage: true, @@ -112,6 +113,9 @@ const props = withDefaults( fieldsDetailList: () => { return {}; }, + orgAndManTree: () => { + return {}; + }, } ); const emits = defineEmits<{ @@ -314,6 +318,8 @@ let checkboxs: any[] = []; let switchs: any[] = []; let selects: any[] = []; let tables: any[] = []; +let dofs: any[] = [];//deptOrgAndOrgCententAndFounderArr + function getAsfs() { //setTimeout(() => { let dataList = ref({}); @@ -330,7 +336,9 @@ function getAsfs() { switchs.push(dataList.value[i]) } else if(dataList.value[i].type == "select"){ selects.push(dataList.value[i]) - } else if ( + } else if(dataList.value[i].type == "deptOrg"||dataList.value[i].type == "orgCentent"||dataList.value[i].type == "founder"){//||dataList.value[i].type == "owner"拥有者,"expand-user"选择用户 + dofs.push(dataList.value[i]) + }else if ( dataList.value[i].type == "card" || dataList.value[i].type == "flex" || dataList.value[i].type == "div" || @@ -351,6 +359,8 @@ function getAsfs() { switchs.push(element) }else if(element.type == "select"){ selects.push(element) + }else if(element.type == "deptOrg"||element.type == "orgCentent"||element.type == "founder"){ + dofs.push(element) } }); } else if (dataList.value[i].type == "grid") { @@ -371,6 +381,8 @@ function getAsfs() { switchs.push(a) }else if(a.type == "select"){ selects.push(a) + }else if(a.type == "deptOrg"||a.type == "orgCentent"||a.type == "founder"){ + dofs.push(a) } } } @@ -393,6 +405,8 @@ function getAsfs() { switchs.push(a) }else if(a.type == "select"){ selects.push(a) + }else if(a.type == "deptOrg"||a.type == "orgCentent"||a.type == "founder"){ + dofs.push(a) }else if (a.type == "flex" || a.type == "table") { if (a.type == "table") { tables.push(dataList.value[i]); @@ -412,6 +426,8 @@ function getAsfs() { switchs.push(q) }else if(q.type == "select"){ selects.push(q) + }else if(q.type == "deptOrg"||q.type == "orgCentent"||q.type == "founder"){ + dofs.push(q) } } } @@ -425,7 +441,6 @@ function getAsfs() { //}, 500); } - function convertStringToArray(str: string) { if (typeof str!== 'string') { throw new Error('Input must be a string.'); @@ -442,6 +457,45 @@ function convertStringToArray(str: string) { return parts.map(part => parseFloat(part)); } +interface Tree { + id?: string; + label: string; + disabled?: boolean; + children?: Tree[]; + parentId?: string; + [key: string]: any; +} +function getLabelById(id: string): string | undefined { + //console.log(id) + const treeNodes = props.orgAndManTree; + + const findLabel = (nodes: Tree[]): string | undefined => { + for (const node of nodes) { + // 检查当前节点是否匹配目标id + if (node.id === id) { + return node.label; + } + // 递归遍历子节点 + if (node.children?.length) { + const found = findLabel(node.children); + if (found) return found; + } + } + return undefined; + }; + + return findLabel(treeNodes); +} +function isAllCharactersNumbers(str: string) { + // 遍历字符串中的每个字符 + for (let i = 0; i < str.length; i++) { + // 检查当前字符是否不是数字字符 + if (isNaN(parseInt(str[i], 10))) { + return false; + } + } + return true; +} //liwenxuan 20250120 二维码 end @@ -462,11 +516,11 @@ const setUpClick = (val: string, id: string) => { //在此组装参数,以生成二维码图片 let idArray = state.selectionChecked.map(item => item.id); if(idArray.length>0){ - /* const loadingInstance1 = ElLoading.service({ + const loadingInstance1 = ElLoading.service({ fullscreen: true, text: '正在生成二维码,请稍候...' // 添加的文字内容,可根据需要修改 - }); */ - console.log(props.formBasicConfig) + }); + //console.log(props.formBasicConfig) if(props.formBasicConfig.qrCodeFlag==true){ if(props.formBasicConfig.qrCodeInside==true){ @@ -524,6 +578,20 @@ const setUpClick = (val: string, id: string) => { } } }); + //console.log(dofs) + dofs.forEach(function(element) { + if(attr_name==element.name){ + //表格属性中存在此单选,将其value根据options替换为可读值 + let toConvertValue = currentFieldsMap[attr_name].split("!@#@!")[1] + //console.log(toConvertValue) + if(isAllCharactersNumbers(toConvertValue)){ + let orgName = getLabelById(toConvertValue) + currentFieldsMap[attr_name] = currentFieldsMap[attr_name].split("!@#@!")[0]+"!@#@!"+orgName + } + + + } + }); switchs.forEach(function(element) { if(attr_name==element.name){ //表格属性中存在此单选,将其value根据options替换为可读值 @@ -628,7 +696,7 @@ const setUpClick = (val: string, id: string) => { setTimeout(()=>{ - //loadingInstance1.close() + loadingInstance1.close() qrCodesPrintDialogFlag.value = true },820) @@ -636,9 +704,11 @@ const setUpClick = (val: string, id: string) => { //fieldsMap = null tablesData.value = getDetailQrCodesData qrCodesPrintDialogFlag.value = true - //loadingInstance1.close() + loadingInstance1.close() } + }).finally(()=>{ + loadingInstance1.close() }) }else{ diff --git a/src/views/sysworkflow/lowcodepage/appPage/appPageForm/openAppFormPage.vue b/src/views/sysworkflow/lowcodepage/appPage/appPageForm/openAppFormPage.vue index aaf993a..1dce546 100644 --- a/src/views/sysworkflow/lowcodepage/appPage/appPageForm/openAppFormPage.vue +++ b/src/views/sysworkflow/lowcodepage/appPage/appPageForm/openAppFormPage.vue @@ -5,6 +5,7 @@ -->