diff --git a/src/components/DesignForm/app/index.vue b/src/components/DesignForm/app/index.vue index 507bf98..19d1b6e 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 @@ -477,174 +522,195 @@ const setUpClick = (val: string, id: string) => { text: '正在生成二维码,请稍候...' // 添加的文字内容,可根据需要修改 }); //console.log(props.formBasicConfig) - //请求数据 - let getDetailQrCodesData: any = {} - let currentFieldsMapArrObj: any = {} - getDetailQrCodes(idArray).then(({ data }) => { - getDetailQrCodesData = JSON.parse(JSON.stringify(data)); - if(props.formBasicConfig.qrCodePrintStyle&&props.formBasicConfig.qrCodePrintStyle=="2"){ - let asfQueryParams1: any[] = []; - for (let key in getDetailQrCodesData) { - currentFieldsMapArrObj[key] = getDetailQrCodesData[key] - if (getDetailQrCodesData.hasOwnProperty(key)) { - let currentFieldsMap = getDetailQrCodesData[key].fieldsMap - //console.log(currentFieldsMap) - // 遍历对象的属性 - for (let attr_name in currentFieldsMap) { - if (currentFieldsMap.hasOwnProperty(attr_name)) { - //console.log("attr_name------"+attr_name) - //console.log(`属性名: ${attr_name}, 属性值: ${currentFieldsMap[attr_name]}`); - radios.forEach(function(element) { - if(attr_name==element.name){ - //表格属性中存在此单选,将其value根据options替换为可读值 - let toConvertValue = currentFieldsMap[attr_name].split("!@#@!")[1] - let optionsHasCurrentValue = false - element.options.forEach((element1: any) => { - if(toConvertValue==element1.value){ - currentFieldsMap[attr_name] = currentFieldsMap[attr_name].split("!@#@!")[0]+"!@#@!"+element1.label - optionsHasCurrentValue = true + if(props.formBasicConfig.qrCodeFlag==true){ + if(props.formBasicConfig.qrCodeInside==true){ + if(props.formBasicConfig.qrCodePrintStyle&&props.formBasicConfig.qrCodePrintStyle=="2"&&props.formBasicConfig.qrCodeShowFields.length==0){ + alert("未选择表格展示字段") + return + } + //请求数据 + let getDetailQrCodesData: any = {} + let currentFieldsMapArrObj: any = {} + getDetailQrCodes(idArray).then(({ data }) => { + getDetailQrCodesData = JSON.parse(JSON.stringify(data)); + if(props.formBasicConfig.qrCodePrintStyle&&props.formBasicConfig.qrCodePrintStyle=="2"){ + let asfQueryParams1: any[] = []; + for (let key in getDetailQrCodesData) { + currentFieldsMapArrObj[key] = getDetailQrCodesData[key] + if (getDetailQrCodesData.hasOwnProperty(key)) { + let currentFieldsMap = getDetailQrCodesData[key].fieldsMap + //console.log(currentFieldsMap) + // 遍历对象的属性 + for (let attr_name in currentFieldsMap) { + if (currentFieldsMap.hasOwnProperty(attr_name)) { + //console.log("attr_name------"+attr_name) + //console.log(`属性名: ${attr_name}, 属性值: ${currentFieldsMap[attr_name]}`); + radios.forEach(function(element) { + if(attr_name==element.name){ + //表格属性中存在此单选,将其value根据options替换为可读值 + let toConvertValue = currentFieldsMap[attr_name].split("!@#@!")[1] + let optionsHasCurrentValue = false + element.options.forEach((element1: any) => { + if(toConvertValue==element1.value){ + currentFieldsMap[attr_name] = currentFieldsMap[attr_name].split("!@#@!")[0]+"!@#@!"+element1.label + optionsHasCurrentValue = true + } + }); + if(optionsHasCurrentValue==false){ + currentFieldsMap[attr_name] = currentFieldsMap[attr_name].split("!@#@!")[0]+"!@#@!"+"" } - }); - if(optionsHasCurrentValue==false){ - currentFieldsMap[attr_name] = currentFieldsMap[attr_name].split("!@#@!")[0]+"!@#@!"+"" } - } - }); - selects.forEach(function(element) { - if(attr_name==element.name){ - //表格属性中存在此单选,将其value根据options替换为可读值 - let toConvertValue = currentFieldsMap[attr_name].split("!@#@!")[1] - let optionsHasCurrentValue = false - element.options.forEach((element1: any) => { - if(toConvertValue==element1.value){ - currentFieldsMap[attr_name] = currentFieldsMap[attr_name].split("!@#@!")[0]+"!@#@!"+element1.label - optionsHasCurrentValue = true + }); + selects.forEach(function(element) { + if(attr_name==element.name){ + //表格属性中存在此单选,将其value根据options替换为可读值 + let toConvertValue = currentFieldsMap[attr_name].split("!@#@!")[1] + let optionsHasCurrentValue = false + element.options.forEach((element1: any) => { + if(toConvertValue==element1.value){ + currentFieldsMap[attr_name] = currentFieldsMap[attr_name].split("!@#@!")[0]+"!@#@!"+element1.label + optionsHasCurrentValue = true + } + }); + if(optionsHasCurrentValue==false){ + currentFieldsMap[attr_name] = currentFieldsMap[attr_name].split("!@#@!")[0]+"!@#@!"+"" } - }); - if(optionsHasCurrentValue==false){ - currentFieldsMap[attr_name] = currentFieldsMap[attr_name].split("!@#@!")[0]+"!@#@!"+"" } - } - }); - switchs.forEach(function(element) { - if(attr_name==element.name){ - //表格属性中存在此单选,将其value根据options替换为可读值 - let toConvertValue = currentFieldsMap[attr_name].split("!@#@!")[1] - if(toConvertValue=="0"){ - currentFieldsMap[attr_name] = currentFieldsMap[attr_name].split("!@#@!")[0]+"!@#@!"+"禁用" - }else{ - currentFieldsMap[attr_name] = currentFieldsMap[attr_name].split("!@#@!")[0]+"!@#@!"+"启用" + }); + //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 } - } - }); - checkboxs.forEach(function(element) { - if(attr_name==element.name){ - //表格属性中存在此单选,将其value根据options替换为可读值 - let toConvertValue = currentFieldsMap[attr_name].split("!@#@!")[1] - let toConvertArr = convertStringToArray(toConvertValue); - let toAddStr = "" - if(toConvertArr.length>0){ - toConvertArr.forEach((element1: any) => { - element.options.forEach((element2: any) => { - if(element1==element2.value){ - toAddStr = toAddStr+element2.label+"," - } - }); - }); - toAddStr = toAddStr.slice(0, -1) - currentFieldsMap[attr_name] = currentFieldsMap[attr_name].split("!@#@!")[0]+"!@#@!"+toAddStr + }); + switchs.forEach(function(element) { + if(attr_name==element.name){ + //表格属性中存在此单选,将其value根据options替换为可读值 + let toConvertValue = currentFieldsMap[attr_name].split("!@#@!")[1] + if(toConvertValue=="0"){ + currentFieldsMap[attr_name] = currentFieldsMap[attr_name].split("!@#@!")[0]+"!@#@!"+"禁用" + }else{ + currentFieldsMap[attr_name] = currentFieldsMap[attr_name].split("!@#@!")[0]+"!@#@!"+"启用" + } } - } - }); - asfs.forEach(function(element) { - if(attr_name==element.name){ - //表格属性中存在此关联表单,将其value根据options替换为可读值 - let toConvertValue = currentFieldsMap[attr_name].split("!@#@!")[1] - if(toConvertValue.length>0){ - //console.log(element) - let fieldCount = 0;//如果>0则有此field名 - asfQueryParams1.forEach((item1: any) => { - //如果参数数组中已存在同field的 关联表单asfQueryParamsItem1,则往已存在的如果参数数组中已存在同field的关联表单asfQueryParamsItem1.asfToSelectIds1中新增asfMasterAndAsfId1 - // 不存在则push一个新的关联表单asfQueryParamsItem1 - if(item1.field==element.name){ - fieldCount++ + }); + checkboxs.forEach(function(element) { + if(attr_name==element.name){ + //表格属性中存在此单选,将其value根据options替换为可读值 + let toConvertValue = currentFieldsMap[attr_name].split("!@#@!")[1] + let toConvertArr = convertStringToArray(toConvertValue); + let toAddStr = "" + if(toConvertArr.length>0){ + toConvertArr.forEach((element1: any) => { + element.options.forEach((element2: any) => { + if(element1==element2.value){ + toAddStr = toAddStr+element2.label+"," + } + }); + }); + toAddStr = toAddStr.slice(0, -1) + currentFieldsMap[attr_name] = currentFieldsMap[attr_name].split("!@#@!")[0]+"!@#@!"+toAddStr + } } - }); - if(fieldCount>0){ - //已存在 - //得到已存在的相关field参数对象 - asfQueryParams1.forEach((item1: any) => { - if(item1.field==element.name){ + }); + asfs.forEach(function(element) { + if(attr_name==element.name){ + //表格属性中存在此关联表单,将其value根据options替换为可读值 + let toConvertValue = currentFieldsMap[attr_name].split("!@#@!")[1] + if(toConvertValue.length>0){ + //console.log(element) + let fieldCount = 0;//如果>0则有此field名 + asfQueryParams1.forEach((item1: any) => { + //如果参数数组中已存在同field的 关联表单asfQueryParamsItem1,则往已存在的如果参数数组中已存在同field的关联表单asfQueryParamsItem1.asfToSelectIds1中新增asfMasterAndAsfId1 + // 不存在则push一个新的关联表单asfQueryParamsItem1 + if(item1.field==element.name){ + fieldCount++ + } + }); + if(fieldCount>0){ + //已存在 + //得到已存在的相关field参数对象 + asfQueryParams1.forEach((item1: any) => { + if(item1.field==element.name){ + let asfMasterAndAsfId1: any = {}; + asfMasterAndAsfId1.asfId = toConvertValue+""; + asfMasterAndAsfId1.asfMasterId = key+""; + item1.asfToSelectIds.push(asfMasterAndAsfId1) + } + }); + }else{ + //不存在 + let asfQueryParamsItem1: any = {}; + asfQueryParamsItem1.formId = element.control.formid; + asfQueryParamsItem1.field = element.name; + let asfToSelectIds1: any[] = []; + asfQueryParamsItem1.asfToSelectIds = asfToSelectIds1; let asfMasterAndAsfId1: any = {}; asfMasterAndAsfId1.asfId = toConvertValue+""; asfMasterAndAsfId1.asfMasterId = key+""; - item1.asfToSelectIds.push(asfMasterAndAsfId1) + asfToSelectIds1.push(asfMasterAndAsfId1) + asfQueryParams1.push(asfQueryParamsItem1) } - }); - }else{ - //不存在 - let asfQueryParamsItem1: any = {}; - asfQueryParamsItem1.formId = element.control.formid; - asfQueryParamsItem1.field = element.name; - let asfToSelectIds1: any[] = []; - asfQueryParamsItem1.asfToSelectIds = asfToSelectIds1; - let asfMasterAndAsfId1: any = {}; - asfMasterAndAsfId1.asfId = toConvertValue+""; - asfMasterAndAsfId1.asfMasterId = key+""; - asfToSelectIds1.push(asfMasterAndAsfId1) - asfQueryParams1.push(asfQueryParamsItem1) + } } - } - } - }) + }) + } } + setTimeout(()=>{ + getDetailQrCodesData[key].fieldsMap = modifyFieldsMap4(currentFieldsMap) + },800) } - setTimeout(()=>{ - getDetailQrCodesData[key].fieldsMap = modifyFieldsMap4(currentFieldsMap) - },800) - } - } - - getAsfDataTitlesByIds(asfQueryParams1).then(({ data }) => { - let getAsfDataTitlesByIdsData = JSON.parse(JSON.stringify(data)); - for (let key in currentFieldsMapArrObj) { - if (getDetailQrCodesData.hasOwnProperty(key)) { - let currentFieldsMap = getDetailQrCodesData[key].fieldsMap - getAsfDataTitlesByIdsData.forEach((element1: any) => { - element1.list.forEach((element2: any) => { - if(key==element2.asfMasterId){ - currentFieldsMap[element1.field] = currentFieldsMap[element1.field].split("!@#@!")[0]+"!@#@!"+element2.label - } - }) - }) } - } - }) - - - setTimeout(()=>{ - tablesData.value = getDetailQrCodesData - },810) - - - - setTimeout(()=>{ + getAsfDataTitlesByIds(asfQueryParams1).then(({ data }) => { + let getAsfDataTitlesByIdsData = JSON.parse(JSON.stringify(data)); + for (let key in currentFieldsMapArrObj) { + if (getDetailQrCodesData.hasOwnProperty(key)) { + let currentFieldsMap = getDetailQrCodesData[key].fieldsMap + getAsfDataTitlesByIdsData.forEach((element1: any) => { + element1.list.forEach((element2: any) => { + if(key==element2.asfMasterId){ + currentFieldsMap[element1.field] = currentFieldsMap[element1.field].split("!@#@!")[0]+"!@#@!"+element2.label + } + }) + }) + } + } + }) + + + + setTimeout(()=>{ + tablesData.value = getDetailQrCodesData + },810) + + + + setTimeout(()=>{ + loadingInstance1.close() + qrCodesPrintDialogFlag.value = true + },820) + + }else if(props.formBasicConfig.qrCodePrintStyle&&props.formBasicConfig.qrCodePrintStyle=="1"){ + //fieldsMap = null + tablesData.value = getDetailQrCodesData + qrCodesPrintDialogFlag.value = true + loadingInstance1.close() + } + + }).finally(()=>{ loadingInstance1.close() - qrCodesPrintDialogFlag.value = true - },820) - - }else if(props.formBasicConfig.qrCodePrintStyle&&props.formBasicConfig.qrCodePrintStyle=="1"){ - //fieldsMap = null - tablesData.value = getDetailQrCodesData - qrCodesPrintDialogFlag.value = true - loadingInstance1.close() + }) + }else{ + alert("内部二维码功能未启用") } - - })/* .finally(()=>{ - loadingInstance1.close() - qrCodesPrintDialogFlag.value = true - }) */ + }else{ + alert("请先为本表单开启二维码功能") + } + }else{ alert("未选中任何一条,请先选择") @@ -889,6 +955,7 @@ const getPageData = () => { switchs = []; selects = []; tables = []; + dofs = []; getAsfs() }); } @@ -1940,9 +2007,9 @@ const transformOption = (val: string | number, type?: string) => { title="生成的二维码" :show-close="false" style="margin-top: 10px" - width="50%" + width="40%" > -
+
{ > - - + + @@ -2065,10 +2132,13 @@ const transformOption = (val: string | number, type?: string) => { table { border-collapse: collapse; width: 100%; + font-size: 13px; + text-align: center } td, th { border: 1px solid black; padding: 8px; + vertical-align: middle; /* 设置文字上下居中 */ } diff --git a/src/components/DesignForm/assembly/index.ts b/src/components/DesignForm/assembly/index.ts index d129d2b..e3c939c 100644 --- a/src/components/DesignForm/assembly/index.ts +++ b/src/components/DesignForm/assembly/index.ts @@ -217,7 +217,9 @@ export default [ iconFont: 'fa-text-width', control: { // 组件所有属性 - modelValue: '' + modelValue: '', + scanInputFlag: false, + scanType:'', }, config: {}, // 其他配置信息 styles: { diff --git a/src/components/DesignForm/formControlPropertiNew.vue b/src/components/DesignForm/formControlPropertiNew.vue index 6957e23..f8a6585 100644 --- a/src/components/DesignForm/formControlPropertiNew.vue +++ b/src/components/DesignForm/formControlPropertiNew.vue @@ -527,6 +527,7 @@ const attrList = computed(() => { path: "config.append", vShow: ["input", "password", "digitpage"], }, + // { // label: '状态打开时的值', // value: control.activeValue, @@ -733,6 +734,14 @@ const attrList = computed(() => { vIf: state.isSearch, vShow: ["associatedForms"], }, + { + label: "移动端扫描输入", + value: config.scanInput, + path: "config.scanInput", + type: "input", + vIf: state.isSearch, + vShow: ["input"], + }, { label: "隐藏条件", value: config.associatedForms, @@ -3377,6 +3386,19 @@ const gainFormGroupList = () => { } }); }; +//liwenxuan 2025 移动端单选扫描输入功能 start +const scanTypes = [ + { + value: 'QrCode', + label: '二维码', + }, + { + value: 'OCR', + label: '光学字符识别', + }, +] +//liwenxuan 2025 移动端单选扫描输入功能 end + let asfs: any[] = []; let asfsExpectCurrent: any[] = []; @@ -4233,6 +4255,35 @@ const updataBase = (val: 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 @@ -467,174 +521,202 @@ const setUpClick = (val: string, id: string) => { text: '正在生成二维码,请稍候...' // 添加的文字内容,可根据需要修改 }); //console.log(props.formBasicConfig) - //请求数据 - let getDetailQrCodesData: any = {} - let currentFieldsMapArrObj: any = {} - getDetailQrCodes(idArray).then(({ data }) => { - getDetailQrCodesData = JSON.parse(JSON.stringify(data)); - if(props.formBasicConfig.qrCodePrintStyle&&props.formBasicConfig.qrCodePrintStyle=="2"){ - let asfQueryParams1: any[] = []; - for (let key in getDetailQrCodesData) { - currentFieldsMapArrObj[key] = getDetailQrCodesData[key] - if (getDetailQrCodesData.hasOwnProperty(key)) { - let currentFieldsMap = getDetailQrCodesData[key].fieldsMap - //console.log(currentFieldsMap) - // 遍历对象的属性 - for (let attr_name in currentFieldsMap) { - if (currentFieldsMap.hasOwnProperty(attr_name)) { - //console.log("attr_name------"+attr_name) - //console.log(`属性名: ${attr_name}, 属性值: ${currentFieldsMap[attr_name]}`); - radios.forEach(function(element) { - if(attr_name==element.name){ - //表格属性中存在此单选,将其value根据options替换为可读值 - let toConvertValue = currentFieldsMap[attr_name].split("!@#@!")[1] - let optionsHasCurrentValue = false - element.options.forEach((element1: any) => { - if(toConvertValue==element1.value){ - currentFieldsMap[attr_name] = currentFieldsMap[attr_name].split("!@#@!")[0]+"!@#@!"+element1.label - optionsHasCurrentValue = true + + if(props.formBasicConfig.qrCodeFlag==true){ + if(props.formBasicConfig.qrCodeInside==true){ + if(props.formBasicConfig.qrCodePrintStyle&&props.formBasicConfig.qrCodePrintStyle=="2"&&props.formBasicConfig.qrCodeShowFields.length==0){ + alert("未选择表格展示字段") + return + } + + //请求数据 + let getDetailQrCodesData: any = {} + let currentFieldsMapArrObj: any = {} + getDetailQrCodes(idArray).then(({ data }) => { + getDetailQrCodesData = JSON.parse(JSON.stringify(data)); + if(props.formBasicConfig.qrCodePrintStyle&&props.formBasicConfig.qrCodePrintStyle=="2"){ + let asfQueryParams1: any[] = []; + for (let key in getDetailQrCodesData) { + currentFieldsMapArrObj[key] = getDetailQrCodesData[key] + if (getDetailQrCodesData.hasOwnProperty(key)) { + let currentFieldsMap = getDetailQrCodesData[key].fieldsMap + //console.log(currentFieldsMap) + // 遍历对象的属性 + for (let attr_name in currentFieldsMap) { + if (currentFieldsMap.hasOwnProperty(attr_name)) { + //console.log("attr_name------"+attr_name) + //console.log(`属性名: ${attr_name}, 属性值: ${currentFieldsMap[attr_name]}`); + radios.forEach(function(element) { + if(attr_name==element.name){ + //表格属性中存在此单选,将其value根据options替换为可读值 + let toConvertValue = currentFieldsMap[attr_name].split("!@#@!")[1] + let optionsHasCurrentValue = false + element.options.forEach((element1: any) => { + if(toConvertValue==element1.value){ + currentFieldsMap[attr_name] = currentFieldsMap[attr_name].split("!@#@!")[0]+"!@#@!"+element1.label + optionsHasCurrentValue = true + } + }); + if(optionsHasCurrentValue==false){ + currentFieldsMap[attr_name] = currentFieldsMap[attr_name].split("!@#@!")[0]+"!@#@!"+"" } - }); - if(optionsHasCurrentValue==false){ - currentFieldsMap[attr_name] = currentFieldsMap[attr_name].split("!@#@!")[0]+"!@#@!"+"" } - } - }); - selects.forEach(function(element) { - if(attr_name==element.name){ - //表格属性中存在此单选,将其value根据options替换为可读值 - let toConvertValue = currentFieldsMap[attr_name].split("!@#@!")[1] - let optionsHasCurrentValue = false - element.options.forEach((element1: any) => { - if(toConvertValue==element1.value){ - currentFieldsMap[attr_name] = currentFieldsMap[attr_name].split("!@#@!")[0]+"!@#@!"+element1.label - optionsHasCurrentValue = true + }); + selects.forEach(function(element) { + if(attr_name==element.name){ + //表格属性中存在此单选,将其value根据options替换为可读值 + let toConvertValue = currentFieldsMap[attr_name].split("!@#@!")[1] + let optionsHasCurrentValue = false + element.options.forEach((element1: any) => { + if(toConvertValue==element1.value){ + currentFieldsMap[attr_name] = currentFieldsMap[attr_name].split("!@#@!")[0]+"!@#@!"+element1.label + optionsHasCurrentValue = true + } + }); + if(optionsHasCurrentValue==false){ + currentFieldsMap[attr_name] = currentFieldsMap[attr_name].split("!@#@!")[0]+"!@#@!"+"" } - }); - if(optionsHasCurrentValue==false){ - currentFieldsMap[attr_name] = currentFieldsMap[attr_name].split("!@#@!")[0]+"!@#@!"+"" } - } - }); - switchs.forEach(function(element) { - if(attr_name==element.name){ - //表格属性中存在此单选,将其value根据options替换为可读值 - let toConvertValue = currentFieldsMap[attr_name].split("!@#@!")[1] - if(toConvertValue=="0"){ - currentFieldsMap[attr_name] = currentFieldsMap[attr_name].split("!@#@!")[0]+"!@#@!"+"禁用" - }else{ - currentFieldsMap[attr_name] = currentFieldsMap[attr_name].split("!@#@!")[0]+"!@#@!"+"启用" + }); + //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 + } + + } - } - }); - checkboxs.forEach(function(element) { - if(attr_name==element.name){ - //表格属性中存在此单选,将其value根据options替换为可读值 - let toConvertValue = currentFieldsMap[attr_name].split("!@#@!")[1] - let toConvertArr = convertStringToArray(toConvertValue); - let toAddStr = "" - if(toConvertArr.length>0){ - toConvertArr.forEach((element1: any) => { - element.options.forEach((element2: any) => { - if(element1==element2.value){ - toAddStr = toAddStr+element2.label+"," - } - }); - }); - toAddStr = toAddStr.slice(0, -1) - currentFieldsMap[attr_name] = currentFieldsMap[attr_name].split("!@#@!")[0]+"!@#@!"+toAddStr + }); + switchs.forEach(function(element) { + if(attr_name==element.name){ + //表格属性中存在此单选,将其value根据options替换为可读值 + let toConvertValue = currentFieldsMap[attr_name].split("!@#@!")[1] + if(toConvertValue=="0"){ + currentFieldsMap[attr_name] = currentFieldsMap[attr_name].split("!@#@!")[0]+"!@#@!"+"禁用" + }else{ + currentFieldsMap[attr_name] = currentFieldsMap[attr_name].split("!@#@!")[0]+"!@#@!"+"启用" + } } - } - }); - asfs.forEach(function(element) { - if(attr_name==element.name){ - //表格属性中存在此关联表单,将其value根据options替换为可读值 - let toConvertValue = currentFieldsMap[attr_name].split("!@#@!")[1] - if(toConvertValue.length>0){ - //console.log(element) - let fieldCount = 0;//如果>0则有此field名 - asfQueryParams1.forEach((item1: any) => { - //如果参数数组中已存在同field的 关联表单asfQueryParamsItem1,则往已存在的如果参数数组中已存在同field的关联表单asfQueryParamsItem1.asfToSelectIds1中新增asfMasterAndAsfId1 - // 不存在则push一个新的关联表单asfQueryParamsItem1 - if(item1.field==element.name){ - fieldCount++ + }); + checkboxs.forEach(function(element) { + if(attr_name==element.name){ + //表格属性中存在此单选,将其value根据options替换为可读值 + let toConvertValue = currentFieldsMap[attr_name].split("!@#@!")[1] + let toConvertArr = convertStringToArray(toConvertValue); + let toAddStr = "" + if(toConvertArr.length>0){ + toConvertArr.forEach((element1: any) => { + element.options.forEach((element2: any) => { + if(element1==element2.value){ + toAddStr = toAddStr+element2.label+"," + } + }); + }); + toAddStr = toAddStr.slice(0, -1) + currentFieldsMap[attr_name] = currentFieldsMap[attr_name].split("!@#@!")[0]+"!@#@!"+toAddStr + } } - }); - if(fieldCount>0){ - //已存在 - //得到已存在的相关field参数对象 - asfQueryParams1.forEach((item1: any) => { - if(item1.field==element.name){ + }); + asfs.forEach(function(element) { + if(attr_name==element.name){ + //表格属性中存在此关联表单,将其value根据options替换为可读值 + let toConvertValue = currentFieldsMap[attr_name].split("!@#@!")[1] + if(toConvertValue.length>0){ + //console.log(element) + let fieldCount = 0;//如果>0则有此field名 + asfQueryParams1.forEach((item1: any) => { + //如果参数数组中已存在同field的 关联表单asfQueryParamsItem1,则往已存在的如果参数数组中已存在同field的关联表单asfQueryParamsItem1.asfToSelectIds1中新增asfMasterAndAsfId1 + // 不存在则push一个新的关联表单asfQueryParamsItem1 + if(item1.field==element.name){ + fieldCount++ + } + }); + if(fieldCount>0){ + //已存在 + //得到已存在的相关field参数对象 + asfQueryParams1.forEach((item1: any) => { + if(item1.field==element.name){ + let asfMasterAndAsfId1: any = {}; + asfMasterAndAsfId1.asfId = toConvertValue+""; + asfMasterAndAsfId1.asfMasterId = key+""; + item1.asfToSelectIds.push(asfMasterAndAsfId1) + } + }); + }else{ + //不存在 + let asfQueryParamsItem1: any = {}; + asfQueryParamsItem1.formId = element.control.formid; + asfQueryParamsItem1.field = element.name; + let asfToSelectIds1: any[] = []; + asfQueryParamsItem1.asfToSelectIds = asfToSelectIds1; let asfMasterAndAsfId1: any = {}; asfMasterAndAsfId1.asfId = toConvertValue+""; asfMasterAndAsfId1.asfMasterId = key+""; - item1.asfToSelectIds.push(asfMasterAndAsfId1) + asfToSelectIds1.push(asfMasterAndAsfId1) + asfQueryParams1.push(asfQueryParamsItem1) } - }); - }else{ - //不存在 - let asfQueryParamsItem1: any = {}; - asfQueryParamsItem1.formId = element.control.formid; - asfQueryParamsItem1.field = element.name; - let asfToSelectIds1: any[] = []; - asfQueryParamsItem1.asfToSelectIds = asfToSelectIds1; - let asfMasterAndAsfId1: any = {}; - asfMasterAndAsfId1.asfId = toConvertValue+""; - asfMasterAndAsfId1.asfMasterId = key+""; - asfToSelectIds1.push(asfMasterAndAsfId1) - asfQueryParams1.push(asfQueryParamsItem1) + } } - } - } - }) + }) + } } + setTimeout(()=>{ + getDetailQrCodesData[key].fieldsMap = modifyFieldsMap4(currentFieldsMap) + },800) } - setTimeout(()=>{ - getDetailQrCodesData[key].fieldsMap = modifyFieldsMap4(currentFieldsMap) - },800) - } - } - - getAsfDataTitlesByIds(asfQueryParams1).then(({ data }) => { - let getAsfDataTitlesByIdsData = JSON.parse(JSON.stringify(data)); - for (let key in currentFieldsMapArrObj) { - if (getDetailQrCodesData.hasOwnProperty(key)) { - let currentFieldsMap = getDetailQrCodesData[key].fieldsMap - getAsfDataTitlesByIdsData.forEach((element1: any) => { - element1.list.forEach((element2: any) => { - if(key==element2.asfMasterId){ - currentFieldsMap[element1.field] = currentFieldsMap[element1.field].split("!@#@!")[0]+"!@#@!"+element2.label - } - }) - }) } + + getAsfDataTitlesByIds(asfQueryParams1).then(({ data }) => { + let getAsfDataTitlesByIdsData = JSON.parse(JSON.stringify(data)); + for (let key in currentFieldsMapArrObj) { + if (getDetailQrCodesData.hasOwnProperty(key)) { + let currentFieldsMap = getDetailQrCodesData[key].fieldsMap + getAsfDataTitlesByIdsData.forEach((element1: any) => { + element1.list.forEach((element2: any) => { + if(key==element2.asfMasterId){ + currentFieldsMap[element1.field] = currentFieldsMap[element1.field].split("!@#@!")[0]+"!@#@!"+element2.label + } + }) + }) + } + } + }) + + + + setTimeout(()=>{ + tablesData.value = getDetailQrCodesData + },810) + + + + setTimeout(()=>{ + loadingInstance1.close() + qrCodesPrintDialogFlag.value = true + },820) + + }else if(props.formBasicConfig.qrCodePrintStyle&&props.formBasicConfig.qrCodePrintStyle=="1"){ + //fieldsMap = null + tablesData.value = getDetailQrCodesData + qrCodesPrintDialogFlag.value = true + loadingInstance1.close() } + + }).finally(()=>{ + loadingInstance1.close() }) - - - setTimeout(()=>{ - tablesData.value = getDetailQrCodesData - },810) - - - - setTimeout(()=>{ - loadingInstance1.close() - qrCodesPrintDialogFlag.value = true - },820) - - }else if(props.formBasicConfig.qrCodePrintStyle&&props.formBasicConfig.qrCodePrintStyle=="1"){ - //fieldsMap = null - tablesData.value = getDetailQrCodesData - qrCodesPrintDialogFlag.value = true - loadingInstance1.close() + }else{ + alert("内部二维码功能未启用") } - - })/* .finally(()=>{ - loadingInstance1.close() - qrCodesPrintDialogFlag.value = true - }) */ + }else{ + alert("请先为本表单开启二维码功能") + } }else{ alert("未选中任何一条,请先选择") @@ -1952,9 +2034,9 @@ const diGuiJilian = (val: any, options: any[]) => { title="生成的二维码" :show-close="false" style="margin-top: 10px" - width="50%" + width="40%" > -
+
{ >
{{ tablesData[tableKey].appName }}-{{ tablesData[tableKey].formName }}二维码{{ tablesData[tableKey].appName }}-{{ tablesData[tableKey].formName }}二维码
{{ item.key }}
- - + + @@ -2087,11 +2169,15 @@ const diGuiJilian = (val: any, options: any[]) => { table { border-collapse: collapse; width: 100%; + font-size: 13px; + text-align: center; + } td, th { border: 1px solid black; padding: 8px; + vertical-align: middle; /* 设置文字上下居中 */ } \ No newline at end of file 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 @@ --> @@ -732,5 +839,69 @@ function optionsValue3Get3(data: any, fieldName: string) { cursor: pointer; } } +======= + /> + + + + + + + + + diff --git a/src/views/sysworkflow/lowcodepage/pageFlow/tableFlow.vue b/src/views/sysworkflow/lowcodepage/pageFlow/tableFlow.vue index 79a9e6b..08916d9 100644 --- a/src/views/sysworkflow/lowcodepage/pageFlow/tableFlow.vue +++ b/src/views/sysworkflow/lowcodepage/pageFlow/tableFlow.vue @@ -415,143 +415,211 @@ const closeAppSubmit = () => { @ 时间: 2024-04-09 16:50:37 @ 功能: 保存草稿 */ -const saveDraftPage = (type: string, val?: any) => { - if (type === "success") { - emits("searchquery"); - if (isFlowTable.value) { - if (val.code == 0) { - let sendInfo = { - id: val.data.uuid, - flowList: flowMap.value, - state: 1, - }; - startRunFlow(sendInfo).then((data: any) => { - // console.log("流程提交成功--------1---------->",data) - }); - } - } - } - closeAppSubmit(); -}; +const saveDraftPage = (type: string,val?:any) => { + if (type === 'success') { + emits("searchquery") + if(isFlowTable.value){ + if(val.code == 0){ + let sendInfo ={ + id:val.data.uuid, + flowList:flowMap.value, + state:1 + } + startRunFlow(sendInfo) + .then((data:any)=>{ + // console.log("流程提交成功--------1---------->",data) + }) + } + } + } + closeAppSubmit() +} +//liwenxuan 20250206 在列表新增数据页增加扫码填单按钮显示填单二维码 start +let qrCodeImgInside = "" +const qrCodeInsideDialogFlag = ref(false) +function showFillFormQrCode(){ + //查看二维码展示弹窗图片,图片带有分组,app,表单名称,和二维码图片 + //在此获取必要的参数并请求后台,获取二维码图片,当图片返回成功时,显示弹窗 + //必要的参数为cfid + if(state.formData.form.qrCodeFlag==true&&state.formData.form.qrCodeInside==true){ + getQrCodeImgInside().then(({ data }) => { + qrCodeImgInside = data + if(qrCodeInsideDialogFlag.value==false){ + //console.log(qrCodeImgInside) + qrCodeInsideDialogFlag.value = true + } + }) + }else{ + alert("请先开启表单二维码功能") + } + + +} -function optionsValue3Get3(data: any, fieldName: string) { - //console.log("tableFlow","optionsValue3Get3") +function getQrCodeImgInside() { + return request({ + url: "/javasys/lowCode/QrCode/getQrCodeImgInside", + method: "post", + data: { + cfid: state.id, + }, + }); +} +//liwenxuan 20250206 在列表新增数据页增加扫码填单按钮显示填单二维码 end +function optionsValue3Get3(data: any,fieldName: string){ + //console.log("tableFlow","optionsValue3Get3") + + + if(fieldName.startsWith("childTable---")){ + let tableAndFieldNameArr = fieldName.split("---") + for(let i = 0; i < state.formData.list.length; i++){ + if(state.formData.list[i].name==tableAndFieldNameArr[1]){ + for(let u = 0; u < state.formData.list[i].list.length; u++){ + if(state.formData.list[i].list[u].name==tableAndFieldNameArr[2]){ + state.formData.list[i].list[u].options = [] + for(let j = 0;j - diff --git a/src/views/sysworkflow/lowcodepage/runApp/runAppForm.vue b/src/views/sysworkflow/lowcodepage/runApp/runAppForm.vue index 578ee22..eb766f6 100644 --- a/src/views/sysworkflow/lowcodepage/runApp/runAppForm.vue +++ b/src/views/sysworkflow/lowcodepage/runApp/runAppForm.vue @@ -15,6 +15,7 @@ import { gainAppPageInfo, getFieldRecord, } from "@/api/DesignForm/requestapi"; +import request from "@/utils/request"; import { Edit, Picture as IconPicture } from "@element-plus/icons-vue"; import { appPageDataInit, appWorkFlow } from "@/api/date/type"; import { @@ -324,6 +325,37 @@ watch( } ); + +//liwenxuan 二维码表格组织人员名称显示 start + +interface Tree { + id?: string; + label: string; + disabled?: boolean; + children?: Tree[]; + parentId?: string; + [key: string]: any; +} +const orgAndManTree = ref(); + function getAssociatedFormsOrgAndManTree() { + return request({ + url: "/javasys/lowCode/transfer/getOrgAndManTree", + method: "post", + }); +} +getAssociatedFormsOrgAndManTree().then(({ data }) => { + let resData = ref(data.children); + orgAndManTree.value = [ + { + id: data.id, + //label: data.label, + label: "组织机构", + children: [...resData.value], + }, + ]; +}); +//liwenxuan 二维码表格组织人员名称显示 end + function optionsValue3Get3(data: any, fieldName: string) { console.log("runAppForm", "optionsValue3Get3"); for (let i = 0; i < stateForm.formData.list.length; i++) { @@ -335,6 +367,8 @@ function optionsValue3Get3(data: any, fieldName: string) { } } } + +
{{ tablesData[tableKey].appName }}-{{ tablesData[tableKey].formName }}二维码{{ tablesData[tableKey].appName }}-{{ tablesData[tableKey].formName }}二维码
{{ item.key }}