|
|
|
@ -164,7 +164,9 @@ const forEachGetFormModel = (list: FormList[], obj: any) => { |
|
|
|
}) |
|
|
|
} else if (['card', 'div'].includes(item.type)) { |
|
|
|
forEachGetFormModel(item.list, obj) |
|
|
|
} else { |
|
|
|
} /* else if(['switch'].includes(item.type)){ |
|
|
|
console.log(item) |
|
|
|
} */else { |
|
|
|
const excludeType = ['title', 'divider', 'txt', 'button'] |
|
|
|
if (excludeType.indexOf(item.type) === -1) { |
|
|
|
obj[item.name] = jsonParseStringify(item.control.modelValue) |
|
|
|
@ -219,6 +221,9 @@ const recursionToGetFinallyHideFields = (hideFieldArr: any[],radioSelectArr3: st |
|
|
|
/* console.log("所有字段modelKeyArr^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^") |
|
|
|
console.log(modelKeyArr) */ |
|
|
|
|
|
|
|
//console.log("当前表单的值-------------------") |
|
|
|
//console.log(model.value) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//当前处于显示状态的默认隐藏的字段 |
|
|
|
@ -295,7 +300,7 @@ const recursionToGetFinallyHideFields = (hideFieldArr: any[],radioSelectArr3: st |
|
|
|
console.log(conditionFieldValue) */ |
|
|
|
for(let n = 0; n< modelKeyArr.length;n++){ |
|
|
|
if(modelKeyArr[n]==conditionField){ |
|
|
|
let count_1 = 0; |
|
|
|
//let count_1 = 0; |
|
|
|
let trueValue = model.value[modelKeyArr[n]] |
|
|
|
if(trueValue.length>0&&arrayEqual(trueValue,conditionFieldValueArr)){ |
|
|
|
//此时满足了条件,但是必须看一下conditionField有没有被隐藏.如果被隐藏了,则x不能增加. |
|
|
|
@ -304,7 +309,7 @@ const recursionToGetFinallyHideFields = (hideFieldArr: any[],radioSelectArr3: st |
|
|
|
console.log(toshow) */ |
|
|
|
let flag = false//其依赖的选项的父字段是否被隐藏.默认没被隐藏, |
|
|
|
//如果此时的conditionField有可能被隐藏且已被隐藏,x不能++ |
|
|
|
for(let a = 0;a<hideFieldConditionArr.length;a++){ |
|
|
|
/* for(let a = 0;a<hideFieldConditionArr.length;a++){ |
|
|
|
if(hideFieldConditionArr[a].toShow==conditionField){//当conditions.length>1说明时多选,=1说明是单选. |
|
|
|
for(let b = 0;b<hideFieldConditionArr[a].conditions.length;b++){ |
|
|
|
for(let c = 0;c<hideFieldConditionArr[a].conditions[b].condition.length;c++){ |
|
|
|
@ -315,7 +320,7 @@ const recursionToGetFinallyHideFields = (hideFieldArr: any[],radioSelectArr3: st |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} */ |
|
|
|
if(flag==false){ |
|
|
|
x++ |
|
|
|
hideFieldsFromCheckbox.push(toshow) |
|
|
|
@ -332,7 +337,7 @@ const recursionToGetFinallyHideFields = (hideFieldArr: any[],radioSelectArr3: st |
|
|
|
//console.log(conditionFieldValue) |
|
|
|
for(let n = 0; n< modelKeyArr.length;n++){ |
|
|
|
if(modelKeyArr[n]==conditionField){ |
|
|
|
let count_1 = 0; |
|
|
|
//let count_1 = 0; |
|
|
|
let trueValue = model.value[modelKeyArr[n]] |
|
|
|
//console.log(modelKeyArr[n]) |
|
|
|
//console.log(trueValue) |
|
|
|
@ -371,6 +376,9 @@ const recursionToGetFinallyHideFields = (hideFieldArr: any[],radioSelectArr3: st |
|
|
|
model.value[hideFieldArr[i]] = "" |
|
|
|
}else if( model.value[hideFieldArr[i]] instanceof Array){ |
|
|
|
model.value[hideFieldArr[i]] = [] |
|
|
|
}else if(typeof model.value[hideFieldArr[i]] == "boolean"){ |
|
|
|
|
|
|
|
model.value[hideFieldArr[i]] = false |
|
|
|
} |
|
|
|
} |
|
|
|
//默认隐藏的字段中目前被显示出来的 |
|
|
|
@ -492,13 +500,14 @@ provide(constControlChange, ({ key, value, data, tProp, type, attribute }: any) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//得到所有配置对象,包括radio,checkbox,select |
|
|
|
//得到所有配置对象,包括radio,checkbox,select,switch |
|
|
|
const radioSelectShowConfigArr = [] |
|
|
|
const checkboxShowConfigArr = [] |
|
|
|
const switchShowConfigArr = [] |
|
|
|
//以showFields的处理过冒号的每个元素为key,其对应的optionValue为value,新建一个数组radioselectArr2。----用于获取所有出现在配置中的字段。 |
|
|
|
const radioSelectArr2:any[] = [] |
|
|
|
for(let i = 0;i<props.formData.list.length;i++){ |
|
|
|
if(props.formData.list[i].type=="radio"||props.formData.list[i].type=="select"||props.formData.list[i].type=="checkbox"){ |
|
|
|
if(props.formData.list[i].type=="radio"||props.formData.list[i].type=="select"||props.formData.list[i].type=="checkbox"||props.formData.list[i].type=="switch"){ |
|
|
|
props.formData.config.hideField = []; |
|
|
|
} |
|
|
|
//console.log(props.formData.list[i].type) |
|
|
|
@ -508,15 +517,18 @@ provide(constControlChange, ({ key, value, data, tProp, type, attribute }: any) |
|
|
|
}else if(props.formData.list[i].type=="checkbox"){ |
|
|
|
|
|
|
|
checkboxShowConfigArr.push(props.formData.list[i].control.glxxszForCheckBox) |
|
|
|
}else if(props.formData.list[i].type=="switch"){ |
|
|
|
switchShowConfigArr.push(props.formData.list[i].control.glxxszSwitch) |
|
|
|
} |
|
|
|
} |
|
|
|
//数组深拷贝 |
|
|
|
const radioSelectShowConfigArr2 = JSON.parse(JSON.stringify(radioSelectShowConfigArr)); |
|
|
|
const checkboxShowConfigArr2 = JSON.parse(JSON.stringify(checkboxShowConfigArr)); |
|
|
|
const switchShowConfigArr2 = JSON.parse(JSON.stringify(switchShowConfigArr)); |
|
|
|
/* console.log(radioSelectShowConfigArr2) |
|
|
|
console.log(checkboxShowConfigArr2) */ |
|
|
|
|
|
|
|
|
|
|
|
//console.log("fodijafkjlsdhoidnfoidshojhfeknsidjfoiewhofnosdifhjeonoidufeinkdsaofhe") |
|
|
|
//console.log(switchShowConfigArr2) |
|
|
|
|
|
|
|
if(radioSelectShowConfigArr2.length>0){ |
|
|
|
for(let i = 0;i<radioSelectShowConfigArr2.length;i++){ |
|
|
|
@ -565,7 +577,28 @@ provide(constControlChange, ({ key, value, data, tProp, type, attribute }: any) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//将出现在开关配置中的字段放入radioSelectArr2,radioSelectArr2是未去重的所有可能被隐藏的字段 |
|
|
|
if(switchShowConfigArr2.length>0){ |
|
|
|
for(let i = 0;i<switchShowConfigArr2.length;i++){ |
|
|
|
if(switchShowConfigArr2[i].length>0){ |
|
|
|
for(let j = 0; j<switchShowConfigArr2[i].length;j++){ |
|
|
|
if(switchShowConfigArr2[i][j].showFields.length>0){ |
|
|
|
for(let n = 0; n<switchShowConfigArr2[i][j].showFields.length;n++){ |
|
|
|
//console.log("99999999999999999999------"+switchShowConfigArr2[i][j].showFields[n]) |
|
|
|
let fieldKeyArr = switchShowConfigArr2[i][j].showFields[n].split(":") |
|
|
|
let fieldKeyStr = fieldKeyArr[fieldKeyArr.length-1] |
|
|
|
//console.log(fieldKeyStr) |
|
|
|
radioSelectArr2.push({ |
|
|
|
toShowFieldKey:fieldKeyStr, |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
//console.log("radioSelectArr2radioSelectArr2radioSelectArr2radioSelectArr2radioSelectArr2=======") |
|
|
|
//console.log(radioSelectArr2) |
|
|
|
//以showFields的处理过冒号的每个元素为key,其对应的optionValue为value,新建一个数组radioselectArr3 ---用于组装完整显示隐藏条件、 |
|
|
|
const radioSelectArr3:any[] = [] |
|
|
|
|
|
|
|
@ -645,9 +678,35 @@ provide(constControlChange, ({ key, value, data, tProp, type, attribute }: any) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
//console.log(radioSelectArr3) |
|
|
|
|
|
|
|
|
|
|
|
//将开关配置也放入radioSelectArr3 |
|
|
|
if(switchShowConfigArr2.length>0){ |
|
|
|
for(let i = 0;i<switchShowConfigArr2.length;i++){ |
|
|
|
if(switchShowConfigArr2[i].length>0){ |
|
|
|
for(let j = 0;j<switchShowConfigArr2[i].length;j++){ |
|
|
|
//数组深拷贝 |
|
|
|
const jArr = JSON.parse(JSON.stringify(switchShowConfigArr2[i][j])); |
|
|
|
//console.log("111111111111111111111-----------"+JSON.stringify(switchShowConfigArr2[i][j])) |
|
|
|
if(jArr.showFields!=undefined&&jArr.showFields.length>0){ |
|
|
|
const optionValueJArr = typeof(jArr.openValue)=="undefined"?jArr.offValue:jArr.openValue |
|
|
|
let arr1 = [] |
|
|
|
for(let n = 0;n<jArr.showFields.length;n++){ |
|
|
|
let fieldKeyArr = jArr.showFields[n].split(":") |
|
|
|
let fieldKeyStr = fieldKeyArr[fieldKeyArr.length-1] |
|
|
|
//console.log(fieldKeyStr) |
|
|
|
arr1.push(fieldKeyStr) |
|
|
|
} |
|
|
|
radioSelectArr3.push({ |
|
|
|
conditionFieldKey:jArr.conditionField, |
|
|
|
conditionFieldValue:optionValueJArr, |
|
|
|
toShowFieldKey:arr1, |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
//console.log(radioSelectArr3) |
|
|
|
//暂时使用的隐藏数组,数据敲定后赋给props.formData.config.hideField |
|
|
|
let hideFieldArr: any[] = []; |
|
|
|
|
|
|
|
|