|
|
|
@ -472,179 +472,189 @@ 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) |
|
|
|
//请求数据 |
|
|
|
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 |
|
|
|
}); */ |
|
|
|
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){ |
|
|
|
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]+"!@#@!"+"启用" |
|
|
|
}); |
|
|
|
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]+"!@#@!"+"启用" |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
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 |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
checkboxs.forEach(function(element) { |
|
|
|
if(attr_name==element.name){ |
|
|
|
//表格属性中存在此单选,将其value根据options替换为可读值 |
|
|
|
}); |
|
|
|
asfs.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+"," |
|
|
|
} |
|
|
|
}); |
|
|
|
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++ |
|
|
|
} |
|
|
|
}); |
|
|
|
toAddStr = toAddStr.slice(0, -1) |
|
|
|
currentFieldsMap[attr_name] = currentFieldsMap[attr_name].split("!@#@!")[0]+"!@#@!"+toAddStr |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
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){ |
|
|
|
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() |
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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("未选中任何一条,请先选择") |
|
|
|
|
|
|
|
|