|
|
|
@ -899,6 +899,9 @@ function showOrHide(data: any) { |
|
|
|
//以showFields的处理过冒号的每个元素为key,其对应的optionValue为value,新建一个数组radioselectArr2。----用于获取所有出现在配置中的字段。 |
|
|
|
const radioSelectArr2: any[] = []; |
|
|
|
|
|
|
|
|
|
|
|
const radioSelectZdtcszConfigArr = []; |
|
|
|
|
|
|
|
//20240815 关联选项设置的隐藏效果嵌套在内时不生效的问题修复 liwenxuan start |
|
|
|
//console.log(props.formData.list) newModelKeyArr |
|
|
|
for (let i = 0; i < props.formData.list.length; i++) { |
|
|
|
@ -915,8 +918,16 @@ function showOrHide(data: any) { |
|
|
|
) { |
|
|
|
if (!props.formData.list[i].control.multiple) { |
|
|
|
radioSelectShowConfigArr.push(props.formData.list[i].control.glxxsz); |
|
|
|
if(props.formData.list[i].control.zdtcsz){ |
|
|
|
props.formData.list[i].control.zdtcsz.name = props.formData.list[i].name |
|
|
|
radioSelectZdtcszConfigArr.push(props.formData.list[i].control.zdtcsz) |
|
|
|
} |
|
|
|
} else { |
|
|
|
checkboxShowConfigArr.push(props.formData.list[i].control.glxxsz); |
|
|
|
if(props.formData.list[i].control.zdtcsz){ |
|
|
|
props.formData.list[i].control.zdtcsz.name = props.formData.list[i].name |
|
|
|
radioSelectZdtcszConfigArr.push(props.formData.list[i].control.zdtcsz) |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (props.formData.list[i].type == "checkbox") { |
|
|
|
checkboxShowConfigArr.push(props.formData.list[i].control.glxxszForCheckBox); |
|
|
|
@ -939,6 +950,10 @@ function showOrHide(data: any) { |
|
|
|
} else { |
|
|
|
checkboxShowConfigArr.push(a[w].control.glxxsz); |
|
|
|
} |
|
|
|
if(a[w].control.zdtcsz){ |
|
|
|
a[w].control.zdtcsz.name = a[w].name |
|
|
|
radioSelectZdtcszConfigArr.push(a[w].control.zdtcsz) |
|
|
|
} |
|
|
|
//radioSelectShowConfigArr.push(a[w].control.glxxsz); |
|
|
|
} else if (a[w].type == "checkbox") { |
|
|
|
checkboxShowConfigArr.push(a[w].control.glxxszForCheckBox); |
|
|
|
@ -960,6 +975,11 @@ function showOrHide(data: any) { |
|
|
|
} else { |
|
|
|
checkboxShowConfigArr.push(a.control.glxxsz); |
|
|
|
} |
|
|
|
if(a.control.zdtcsz){ |
|
|
|
a.control.zdtcsz.name = a.name |
|
|
|
radioSelectZdtcszConfigArr.push(a.control.zdtcsz) |
|
|
|
} |
|
|
|
|
|
|
|
//radioSelectShowConfigArr.push(a.control.glxxsz); |
|
|
|
} else if (a.type == "checkbox") { |
|
|
|
checkboxShowConfigArr.push(a.control.glxxszForCheckBox); |
|
|
|
@ -984,6 +1004,10 @@ function showOrHide(data: any) { |
|
|
|
} else { |
|
|
|
checkboxShowConfigArr.push(a.control.glxxsz); |
|
|
|
} |
|
|
|
if(a.control.zdtcsz){ |
|
|
|
a.control.zdtcsz.name = a.name |
|
|
|
radioSelectZdtcszConfigArr.push(a.control.zdtcsz) |
|
|
|
} |
|
|
|
//radioSelectShowConfigArr.push(a.control.glxxsz); |
|
|
|
} else if (a.type == "checkbox") { |
|
|
|
checkboxShowConfigArr.push(a.control.glxxszForCheckBox); |
|
|
|
@ -999,6 +1023,10 @@ function showOrHide(data: any) { |
|
|
|
} else { |
|
|
|
checkboxShowConfigArr.push(q.control.glxxsz); |
|
|
|
} |
|
|
|
if(q.control.zdtcsz){ |
|
|
|
q.control.zdtcsz.name = q.name |
|
|
|
radioSelectZdtcszConfigArr.push(q.control.zdtcsz) |
|
|
|
} |
|
|
|
//radioSelectShowConfigArr.push(q.control.glxxsz); |
|
|
|
} else if (q.type == "checkbox") { |
|
|
|
checkboxShowConfigArr.push(q.control.glxxszForCheckBox); |
|
|
|
@ -1019,6 +1047,7 @@ function showOrHide(data: any) { |
|
|
|
newModelKeyArr = Array.from(new Set(newModelKeyArr)); |
|
|
|
//20240815 关联选项设置的隐藏效果嵌套在内时不生效的问题修复 liwenxuan end |
|
|
|
//console.log(radioSelectShowConfigArr) |
|
|
|
//console.log(radioSelectZdtcszConfigArr) |
|
|
|
//数组深拷贝 |
|
|
|
const radioSelectShowConfigArr2 = JSON.parse(JSON.stringify(radioSelectShowConfigArr)); |
|
|
|
const checkboxShowConfigArr2 = JSON.parse(JSON.stringify(checkboxShowConfigArr)); |
|
|
|
@ -1237,6 +1266,81 @@ function showOrHide(data: any) { |
|
|
|
|
|
|
|
//props.formData.config?.hideField?.push("nin2yuan4yi4wei4wo3menda3fen1ma101939") |
|
|
|
//console.log("监听表单--constControlChange-->",key, value, data, tProp,type,attribute)//liwenxuan |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
nextTick(()=>{ |
|
|
|
//console.log(model.value)// |
|
|
|
radioSelectZdtcszConfigArr.forEach(element => { |
|
|
|
let tbx=getLastColonAfterString(element.tbx) |
|
|
|
let tby=getLastColonAfterString(element.tby) |
|
|
|
/* console.log(tbx) |
|
|
|
console.log(tby) */ |
|
|
|
let rowValue = model.value[tbx] |
|
|
|
let columnValue = model.value[tby] |
|
|
|
let cellValue = getTableCellValueV2(element.tableData, rowValue, columnValue) |
|
|
|
//console.log(cellValue); |
|
|
|
model.value[element.name] = cellValue*1 |
|
|
|
|
|
|
|
|
|
|
|
//console.log(getTableCellValueV2(element.tableData, 3, 2)); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取字符串最后一个英文冒号(:)后的字符 |
|
|
|
* @param {string} str - 待处理的原始字符串 |
|
|
|
* @returns {string} 最后一个冒号后的子串;无冒号/冒号在末尾时返回空字符串 |
|
|
|
*/ |
|
|
|
function getLastColonAfterString(str) { |
|
|
|
// 1. 输入校验:确保输入是字符串类型(处理非字符串入参) |
|
|
|
if (typeof str !== 'string') { |
|
|
|
console.warn('输入必须为字符串类型'); |
|
|
|
return ''; |
|
|
|
} |
|
|
|
|
|
|
|
// 2. 找到最后一个英文冒号的索引位置 |
|
|
|
const lastColonIndex = str.lastIndexOf(':'); |
|
|
|
|
|
|
|
// 3. 边界判断:无冒号 或 冒号在最后一位 → 返回空字符串 |
|
|
|
if (lastColonIndex === -1 || lastColonIndex === str.length - 1) { |
|
|
|
return ''; |
|
|
|
} |
|
|
|
|
|
|
|
// 4. 截取最后一个冒号后的所有字符并返回 |
|
|
|
return str.slice(lastColonIndex + 1); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 根据自动填充表格行列数据确定单元格值 |
|
|
|
function getTableCellValueV2(tableData, rowValue, columnValue) { |
|
|
|
try { |
|
|
|
// 检查输入参数 |
|
|
|
if (!tableData || typeof tableData !== 'object' || Array.isArray(tableData)) { |
|
|
|
return undefined; |
|
|
|
} |
|
|
|
|
|
|
|
// 处理null或undefined值 |
|
|
|
if (rowValue == null || columnValue == null) { |
|
|
|
return undefined; |
|
|
|
} |
|
|
|
|
|
|
|
// 转换为字符串 |
|
|
|
const rowStr = String(rowValue); |
|
|
|
const columnStr = String(columnValue); |
|
|
|
|
|
|
|
// 使用可选链操作符安全地访问嵌套属性 |
|
|
|
return tableData?.[columnStr]?.[rowStr]; |
|
|
|
} catch (error) { |
|
|
|
// 如果发生任何错误,返回undefined |
|
|
|
console.error('获取表格单元格值时发生错误:', error); |
|
|
|
return undefined; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
function addStringIfNotExists(arr: string[], str: string) { |
|
|
|
|