|
|
|
@ -7,6 +7,7 @@ |
|
|
|
import '@/assets/scss/element-var.scss' |
|
|
|
import '@/assets/scss/index.scss' |
|
|
|
import FormGroup from './formGroup.vue' |
|
|
|
|
|
|
|
import { FormData,FormList,FormDataStyle } from '@/api/DesignForm/types' |
|
|
|
import { getRequest } from '@/api/DesignForm' |
|
|
|
import { useRoute, useRouter } from 'vue-router' |
|
|
|
@ -75,12 +76,14 @@ const props = withDefaults( |
|
|
|
type:Boolean, |
|
|
|
default:true |
|
|
|
}, |
|
|
|
key:1 |
|
|
|
} |
|
|
|
) |
|
|
|
const emits = defineEmits<{ |
|
|
|
(e: 'btnClick', type: string): void |
|
|
|
(e: 'change', val: any): void // 表单组件值发生变化时 |
|
|
|
(e: 'update:issave', type: boolean): void |
|
|
|
(e: 'refresh'): void |
|
|
|
}>() |
|
|
|
const route = useRoute() |
|
|
|
const router = useRouter() |
|
|
|
@ -170,6 +173,237 @@ const forEachGetFormModel = (list: FormList[], obj: any) => { |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
function arrayEqual(a: string[], b: any[]) { |
|
|
|
//alert("开始比较") |
|
|
|
//先将数组排序 |
|
|
|
let a_ = JSON.parse(JSON.stringify(a)); |
|
|
|
for(let i = 0;i<a_.length;i++){ |
|
|
|
a_[i] = a_[i]+"" |
|
|
|
} |
|
|
|
//console.log(a_) |
|
|
|
//console.log(b) |
|
|
|
a_ = a_.sort(); |
|
|
|
b = b.sort(); |
|
|
|
//判断数组长度是否相等,若不相等返回false |
|
|
|
if (a_.length != b.length) |
|
|
|
return false; |
|
|
|
//逐个比较数组元素 |
|
|
|
for (var i = 0; i < a_.length; ++i) { |
|
|
|
if (a_[i] !== b[i]) |
|
|
|
return false; |
|
|
|
} |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
interface hideFieldConditionArritem { |
|
|
|
toShow:string |
|
|
|
conditions: any[] |
|
|
|
} |
|
|
|
|
|
|
|
const recursionToGetFinallyHideFields = (hideFieldArr: any[],radioSelectArr3: string | any[],defaultHideFields: any[]) => { |
|
|
|
|
|
|
|
|
|
|
|
nextTick(() => { |
|
|
|
/* console.log("以showFields的处理过冒号的每个元素为key,其对应的optionValue为value,新建的数组radioselectArr3 --- 内容为完整显示隐藏条件") |
|
|
|
console.log(radioSelectArr3) |
|
|
|
console.log("当前表单的值-------------------") |
|
|
|
console.log(model.value) |
|
|
|
console.log("默认隐藏的字段-----------------") |
|
|
|
console.log(defaultHideFields) */ |
|
|
|
let modelKeyArr = [];//所有字段 |
|
|
|
for(let i= 0;i<props.formData.list.length;i++){ |
|
|
|
modelKeyArr.push(props.formData.list[i].name+"") |
|
|
|
} |
|
|
|
/* console.log("所有字段modelKeyArr^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^") |
|
|
|
console.log(modelKeyArr) */ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//当前处于显示状态的默认隐藏的字段 |
|
|
|
let nowShowingDefaultHideFieldArr = defaultHideFields.filter(a => !hideFieldArr.includes(a)) |
|
|
|
//当前所有处于显示状态的字段 |
|
|
|
let nowShowingFieldArr = modelKeyArr.filter(a => !hideFieldArr.includes(a)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//以被默认隐藏的每个字段为key,显示该字段的所有条件的数组作为value,来作为该数组的每一项。 |
|
|
|
const hideFieldConditionArr:hideFieldConditionArritem[] = [] |
|
|
|
//保存应多选条件造成的应隐藏的字段 |
|
|
|
let hideFieldsFromCheckbox: string[] = [] |
|
|
|
for(let i = 0;i < hideFieldArr.length;i++){ |
|
|
|
hideFieldConditionArr.push({ |
|
|
|
toShow:hideFieldArr[i], |
|
|
|
conditions:[], |
|
|
|
}) |
|
|
|
} |
|
|
|
//console.log(hideFieldConditionArr) |
|
|
|
//遍历所有配置条件数组radioSelectArr3,当radioSelectArr3 [ i ] . toshowFieldKey 【i】==hideFieldArr【i】时 |
|
|
|
for(let i = 0;i < radioSelectArr3.length;i++){ |
|
|
|
for(let j = 0;j < radioSelectArr3[i].toShowFieldKey.length;j++){ |
|
|
|
for(let n = 0;n < hideFieldConditionArr.length;n++){ |
|
|
|
/* console.log(i) |
|
|
|
console.log(j) |
|
|
|
console.log(n) */ |
|
|
|
if(radioSelectArr3[i].toShowFieldKey[j]==hideFieldConditionArr[n].toShow){ |
|
|
|
if(Array.isArray(radioSelectArr3[i].conditionFieldValue)){ |
|
|
|
let valStr = ""; |
|
|
|
for(let x = 0;x<radioSelectArr3[i].conditionFieldValue.length;x++){ |
|
|
|
valStr = valStr+radioSelectArr3[i].conditionFieldValue[x]+"," |
|
|
|
} |
|
|
|
hideFieldConditionArr[n].conditions.push({ |
|
|
|
conditionFrom:"radioOrSelect",//本条件来自于单选或者下拉 |
|
|
|
condition:[{//条件详细信息//当表单字段conditionField的值为conditionFieldValue时,显示hideFieldConditionArr[n] |
|
|
|
conditionField:radioSelectArr3[i].conditionFieldKey, |
|
|
|
conditionFieldValue:valStr |
|
|
|
}] |
|
|
|
}) |
|
|
|
}else{ |
|
|
|
hideFieldConditionArr[n].conditions.push({ |
|
|
|
conditionFrom:"radioOrSelect",//本条件来自于单选或者下拉 |
|
|
|
condition:[{//条件详细信息//当表单字段conditionField的值为conditionFieldValue时,显示hideFieldConditionArr[n] |
|
|
|
conditionField:radioSelectArr3[i].conditionFieldKey, |
|
|
|
conditionFieldValue:radioSelectArr3[i].conditionFieldValue// |
|
|
|
}] |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
//console.log(hideFieldConditionArr); |
|
|
|
//要显示的和其满足显示条件的个数. |
|
|
|
//let showfieldsCountX = []; |
|
|
|
for(let i = 0;i<hideFieldConditionArr.length;i++){ |
|
|
|
let x = 0//满足显示条件的次数 |
|
|
|
let toshow = hideFieldConditionArr[i].toShow |
|
|
|
let conditions = hideFieldConditionArr[i].conditions |
|
|
|
//console.log(conditions) |
|
|
|
for(let j = 0;j<conditions.length;j++){ |
|
|
|
let conditionField = conditions[j].condition[0].conditionField |
|
|
|
let conditionFieldValue = conditions[j].condition[0].conditionFieldValue |
|
|
|
//console.log(conditionField) |
|
|
|
if(conditionFieldValue.includes(",")){//来自多选 |
|
|
|
let conditionFieldValueArr = conditionFieldValue.split(",") |
|
|
|
conditionFieldValueArr = conditionFieldValueArr.slice(0, -1); |
|
|
|
/* console.log(conditionFieldValueArr) |
|
|
|
console.log(conditionFieldValue) */ |
|
|
|
for(let n = 0; n< modelKeyArr.length;n++){ |
|
|
|
if(modelKeyArr[n]==conditionField){ |
|
|
|
let count_1 = 0; |
|
|
|
let trueValue = model.value[modelKeyArr[n]] |
|
|
|
if(trueValue.length>0&&arrayEqual(trueValue,conditionFieldValueArr)){ |
|
|
|
//此时满足了条件,但是必须看一下conditionField有没有被隐藏.如果被隐藏了,则x不能增加. |
|
|
|
//alert("多选条件成功触发") |
|
|
|
/* console.log(conditionField) |
|
|
|
console.log(toshow) */ |
|
|
|
let flag = false//其依赖的选项的父字段是否被隐藏.默认没被隐藏, |
|
|
|
//如果此时的conditionField有可能被隐藏且已被隐藏,x不能++ |
|
|
|
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++){ |
|
|
|
if(hideFieldConditionArr[a].conditions[b].condition[c]==conditionField){ |
|
|
|
//暂时写到这里,先去组装多选条件数组. |
|
|
|
//console.log(1) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if(flag==false){ |
|
|
|
x++ |
|
|
|
hideFieldsFromCheckbox.push(toshow) |
|
|
|
//console.log(hideFieldArr) |
|
|
|
/* for(let i = 0;i<hideFieldsFromCheckbox.length;i++){ |
|
|
|
hideFieldArr = hideFieldArr.filter((item: string) => item!=hideFieldsFromCheckbox[i]) |
|
|
|
//emits('refresh') |
|
|
|
} */ |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}else{//来自单选下拉 |
|
|
|
//console.log(conditionFieldValue) |
|
|
|
for(let n = 0; n< modelKeyArr.length;n++){ |
|
|
|
if(modelKeyArr[n]==conditionField){ |
|
|
|
let count_1 = 0; |
|
|
|
let trueValue = model.value[modelKeyArr[n]] |
|
|
|
//console.log(modelKeyArr[n]) |
|
|
|
//console.log(trueValue) |
|
|
|
if(trueValue==conditionFieldValue){ |
|
|
|
//此时满足了条件,但是必须看一下conditionField有没有被隐藏.如果被隐藏了,则x不能增加. |
|
|
|
let flag = false//其依赖的选项的父字段是否被隐藏.默认没被隐藏, |
|
|
|
//如果此时的conditionField有可能被隐藏且已被隐藏,x不能++ |
|
|
|
/* 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++){ |
|
|
|
if(hideFieldConditionArr[a].conditions[b].condition[c]==conditionField){ |
|
|
|
//暂时写到这里,先去组装多选条件数组. |
|
|
|
console.log(1) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} */ |
|
|
|
if(flag==false){ |
|
|
|
x++ |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if(x>0){ |
|
|
|
hideFieldArr = hideFieldArr.filter((item: string) => item!=toshow) |
|
|
|
} |
|
|
|
} |
|
|
|
//将隐藏的字段值重置 |
|
|
|
for(let i = 0; i< hideFieldArr.length;i++){ |
|
|
|
//console.log(i+"dsfafdasdfasfsda===="+hideFieldArr[i]+"=====jiuopfdsahokjuhuiofadshuiofadsjbknfdjisahuifhjken wij================"+model.value[hideFieldArr[i]]) |
|
|
|
if(typeof model.value[hideFieldArr[i]] === "string" || typeof model.value[hideFieldArr[i]] === "number"){ |
|
|
|
model.value[hideFieldArr[i]] = "" |
|
|
|
}else if( model.value[hideFieldArr[i]] instanceof Array){ |
|
|
|
model.value[hideFieldArr[i]] = [] |
|
|
|
} |
|
|
|
} |
|
|
|
//默认隐藏的字段中目前被显示出来的 |
|
|
|
nowShowingDefaultHideFieldArr = defaultHideFields.filter(a => !hideFieldArr.includes(a)) |
|
|
|
/* console.log("(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((())))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))") |
|
|
|
console.log(nowShowingDefaultHideFieldArr) */ |
|
|
|
/* for(let i = 0;i< nowShowingDefaultHideFieldArr.length; i++){ |
|
|
|
//当被显示出来的字段涉及到的conditionfield已经被隐藏了时,其x应-1,如果x-1后造成该field被隐藏,应递归重新敲定hideFieldArr |
|
|
|
if() |
|
|
|
} */ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//console.log("条件筛选过后最终要隐藏的字段-----"+hideFieldArr) |
|
|
|
|
|
|
|
|
|
|
|
//编辑表单页不隐藏任何字段。 |
|
|
|
if(formProps.value.type!=5){ |
|
|
|
props.formData.config.hideField?.push(...hideFieldArr) |
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return hideFieldArr |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 表单组件值改变事件 tProp为子表格相关 |
|
|
|
provide(constControlChange, ({ key, value, data, tProp, type, attribute }: any) => { |
|
|
|
|
|
|
|
@ -239,16 +473,212 @@ provide(constControlChange, ({ key, value, data, tProp, type, attribute }: any) |
|
|
|
} |
|
|
|
// }) |
|
|
|
|
|
|
|
//liwenxuan 关联选项设置效果实现 start |
|
|
|
/* console.log("监听表单-1-constControlChange-->",props.formData) |
|
|
|
console.log("监听表单-2-constControlChange-->",key) |
|
|
|
console.log("监听表单-3-constControlChange-->", value) |
|
|
|
console.log("监听表单-4-constControlChange-->",data) |
|
|
|
console.log("监听表单-5-constControlChange-->",type) |
|
|
|
console.log("监听表单-6-constControlChange-->",attribute) */ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//得到当前表单各选项的值 |
|
|
|
//props.formData.config.hideField.push("nin2yuan4yi4wei4wo3menda3fen1ma101939") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// console.log("监听表单-1-constControlChange-->",props.formData) |
|
|
|
// console.log("监听表单-2-constControlChange-->",key) |
|
|
|
// console.log("监听表单-3-constControlChange-->", value) |
|
|
|
// console.log("监听表单-4-constControlChange-->",data) |
|
|
|
// console.log("监听表单-5-constControlChange-->",type) |
|
|
|
// console.log("监听表单-6-constControlChange-->",attribute) |
|
|
|
|
|
|
|
//得到所有配置对象,包括radio,checkbox,select |
|
|
|
const radioSelectShowConfigArr = [] |
|
|
|
const checkboxShowConfigArr = [] |
|
|
|
//以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"){ |
|
|
|
props.formData.config.hideField = []; |
|
|
|
} |
|
|
|
//console.log(props.formData.list[i].type) |
|
|
|
if(props.formData.list[i].type=="radio"||props.formData.list[i].type=="select"){ |
|
|
|
radioSelectShowConfigArr.push(props.formData.list[i].control.glxxsz) |
|
|
|
|
|
|
|
console.log("监听表单--constControlChange-->",key, value, data, tProp,type,attribute) |
|
|
|
}else if(props.formData.list[i].type=="checkbox"){ |
|
|
|
|
|
|
|
checkboxShowConfigArr.push(props.formData.list[i].control.glxxszForCheckBox) |
|
|
|
} |
|
|
|
} |
|
|
|
//数组深拷贝 |
|
|
|
const radioSelectShowConfigArr2 = JSON.parse(JSON.stringify(radioSelectShowConfigArr)); |
|
|
|
const checkboxShowConfigArr2 = JSON.parse(JSON.stringify(checkboxShowConfigArr)); |
|
|
|
/* console.log(radioSelectShowConfigArr2) |
|
|
|
console.log(checkboxShowConfigArr2) */ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(radioSelectShowConfigArr2.length>0){ |
|
|
|
for(let i = 0;i<radioSelectShowConfigArr2.length;i++){ |
|
|
|
if( radioSelectShowConfigArr2[i].length>0){ |
|
|
|
for(let j = 0;j<radioSelectShowConfigArr2[i].length;j++){ |
|
|
|
//数组深拷贝 |
|
|
|
const jArr = JSON.parse(JSON.stringify(radioSelectShowConfigArr2[i][j])); |
|
|
|
const optionValueJArr = jArr.optionValue |
|
|
|
if(jArr.showFields!=undefined&&jArr.showFields.length>0){ |
|
|
|
for(let n = 0;n<jArr.showFields.length;n++){ |
|
|
|
let fieldKeyArr = jArr.showFields[n].split(":") |
|
|
|
let fieldKeyStr = fieldKeyArr[fieldKeyArr.length-1] |
|
|
|
radioSelectArr2.push({ |
|
|
|
//conditionFieldKey:jArr.conditionField, |
|
|
|
//conditionFieldValue:optionValueJArr, |
|
|
|
toShowFieldKey:fieldKeyStr, |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//将出现在多选配置中的字段放入radioSelectArr2,radioSelectArr2是未去重的所有可能被隐藏的字段 |
|
|
|
if(checkboxShowConfigArr2.length>0){ |
|
|
|
for(let i = 0;i<checkboxShowConfigArr2.length;i++){ |
|
|
|
//console.log(i) |
|
|
|
if(checkboxShowConfigArr2[i].length>0){ |
|
|
|
for(let j = 0;j<checkboxShowConfigArr2[i].length;j++){ |
|
|
|
//console.log(j) |
|
|
|
//console.log(checkboxShowConfigArr2[i][j].showFields) |
|
|
|
if(checkboxShowConfigArr2[i][j].showFields.length>0){ |
|
|
|
for(let n = 0; n<checkboxShowConfigArr2[i][j].showFields.length;n++){ |
|
|
|
let fieldKeyArr = checkboxShowConfigArr2[i][j].showFields[n].split(":") |
|
|
|
let fieldKeyStr = fieldKeyArr[fieldKeyArr.length-1] |
|
|
|
//console.log(fieldKeyStr) |
|
|
|
radioSelectArr2.push({ |
|
|
|
toShowFieldKey:fieldKeyStr, |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//以showFields的处理过冒号的每个元素为key,其对应的optionValue为value,新建一个数组radioselectArr3 ---用于组装完整显示隐藏条件、 |
|
|
|
const radioSelectArr3:any[] = [] |
|
|
|
|
|
|
|
if(radioSelectShowConfigArr2.length>0){ |
|
|
|
for(let i = 0;i<radioSelectShowConfigArr2.length;i++){ |
|
|
|
if( radioSelectShowConfigArr2[i].length>0){ |
|
|
|
for(let j = 0;j<radioSelectShowConfigArr2[i].length;j++){ |
|
|
|
//数组深拷贝 |
|
|
|
const jArr = JSON.parse(JSON.stringify(radioSelectShowConfigArr2[i][j])); |
|
|
|
const optionValueJArr = jArr.optionValue |
|
|
|
if(jArr.showFields!=undefined&&jArr.showFields.length>0){ |
|
|
|
if(jArr.showFields.length>1){ |
|
|
|
let arr1 = [] |
|
|
|
for(let n = 0;n<jArr.showFields.length;n++){ |
|
|
|
let fieldKeyArr = jArr.showFields[n].split(":") |
|
|
|
let fieldKeyStr = fieldKeyArr[fieldKeyArr.length-1] |
|
|
|
arr1.push(fieldKeyStr) |
|
|
|
} |
|
|
|
radioSelectArr3.push({ |
|
|
|
conditionFieldKey:jArr.conditionField, |
|
|
|
conditionFieldValue:optionValueJArr, |
|
|
|
toShowFieldKey:arr1, |
|
|
|
}) |
|
|
|
}else{//等于1 |
|
|
|
for(let n = 0;n<jArr.showFields.length;n++){ |
|
|
|
let fieldKeyArr = jArr.showFields[n].split(":") |
|
|
|
let fieldKeyStr = fieldKeyArr[fieldKeyArr.length-1] |
|
|
|
radioSelectArr3.push({ |
|
|
|
conditionFieldKey:jArr.conditionField, |
|
|
|
conditionFieldValue:optionValueJArr, |
|
|
|
toShowFieldKey:[fieldKeyStr], |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
//console.log(radioSelectArr3) |
|
|
|
//将多选配置也放入radioSelectArr3 |
|
|
|
if(checkboxShowConfigArr2.length>0){ |
|
|
|
for(let i = 0;i<checkboxShowConfigArr2.length;i++){ |
|
|
|
if( checkboxShowConfigArr2[i].length>0){ |
|
|
|
for(let j = 0;j<checkboxShowConfigArr2[i].length;j++){ |
|
|
|
//数组深拷贝 |
|
|
|
const jArr = JSON.parse(JSON.stringify(checkboxShowConfigArr2[i][j])); |
|
|
|
const optionValueJArr = jArr.selectedOptions |
|
|
|
if(jArr.showFields!=undefined&&jArr.showFields.length>0){ |
|
|
|
if(jArr.showFields.length>1){ |
|
|
|
let arr1 = [] |
|
|
|
for(let n = 0;n<jArr.showFields.length;n++){ |
|
|
|
let fieldKeyArr = jArr.showFields[n].split(":") |
|
|
|
let fieldKeyStr = fieldKeyArr[fieldKeyArr.length-1] |
|
|
|
arr1.push(fieldKeyStr) |
|
|
|
} |
|
|
|
radioSelectArr3.push({ |
|
|
|
conditionFieldKey:jArr.conditionField, |
|
|
|
conditionFieldValue:optionValueJArr, |
|
|
|
toShowFieldKey:arr1, |
|
|
|
}) |
|
|
|
}else{//等于1 |
|
|
|
for(let n = 0;n<jArr.showFields.length;n++){ |
|
|
|
let fieldKeyArr = jArr.showFields[n].split(":") |
|
|
|
let fieldKeyStr = fieldKeyArr[fieldKeyArr.length-1] |
|
|
|
radioSelectArr3.push({ |
|
|
|
conditionFieldKey:jArr.conditionField, |
|
|
|
conditionFieldValue:optionValueJArr, |
|
|
|
toShowFieldKey:[fieldKeyStr], |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
//console.log(radioSelectArr3) |
|
|
|
|
|
|
|
|
|
|
|
//暂时使用的隐藏数组,数据敲定后赋给props.formData.config.hideField |
|
|
|
let hideFieldArr: any[] = []; |
|
|
|
|
|
|
|
//但凡配置条件的字段先放入隐藏数组中 |
|
|
|
for(let i = 0;i< radioSelectArr2.length;i++){ |
|
|
|
hideFieldArr.push(radioSelectArr2[i].toShowFieldKey) |
|
|
|
} |
|
|
|
hideFieldArr = Array.from(new Set(hideFieldArr)) |
|
|
|
const defaultHideFields: any[] = JSON.parse(JSON.stringify(hideFieldArr)) |
|
|
|
|
|
|
|
for(let i = 0;i<defaultHideFields.length;i++){ |
|
|
|
hideFieldArr = recursionToGetFinallyHideFields(hideFieldArr,radioSelectArr3,defaultHideFields) |
|
|
|
} |
|
|
|
hideFieldArr = recursionToGetFinallyHideFields(hideFieldArr,radioSelectArr3,defaultHideFields) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//props.formData.config?.hideField?.push("nin2yuan4yi4wei4wo3menda3fen1ma101939") |
|
|
|
//console.log("监听表单--constControlChange-->",key, value, data, tProp,type,attribute)//liwenxuan |
|
|
|
|
|
|
|
if (typeof props.changeKeyVal === 'function') { |
|
|
|
props.changeKeyVal(key, value,type,attribute) |
|
|
|
@ -275,6 +705,9 @@ provide(constControlChange, ({ key, value, data, tProp, type, attribute }: any) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
|
|
|
*/ |
|
|
|
}) |
|
|
|
const dictForm = computed(() => { |
|
|
|
const storage = window.localStorage.getItem('akFormDict') |
|
|
|
@ -295,6 +728,10 @@ const formProps = computed(() => { |
|
|
|
dict: dictForm.value |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
provide(constFormProps, formProps) |
|
|
|
|
|
|
|
// 提供一个方法,用于根据name从formData.list里查找数据 |
|
|
|
@ -709,6 +1146,11 @@ watch( |
|
|
|
} |
|
|
|
) |
|
|
|
// ------------------------数据处理结束------------------------ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 重置表单方法 |
|
|
|
const resetFields = () => { |
|
|
|
ruleForm.value.resetFields() |
|
|
|
|