Browse Source

关联表单隐藏效果-本表字段取值条件

lwx_v3
liwenxuan 1 year ago
parent
commit
2d2c06de43
  1. 67
      src/components/DesignForm/public/form/form.vue

67
src/components/DesignForm/public/form/form.vue

@ -619,7 +619,43 @@ function showOrHide (data:any){
} }
}else{ }else{
//3 //3
console.log(1) console.log(leftOperatorsAndRight)
console.log(data)
if(data.name==leftArr[2]){
console.log("ghasdhasdfhhsadhasd")
console.log(props.formData.list[i].name)
nextTick(()=>{
console.log(model.value[leftArr[2]])
if(leftOperatorsAndRight.operator == "=="){
if(model.value[leftArr[2]]==leftOperatorsAndRight.right){
props.formData.config.hideField = addStringIfNotExists(props.formData.config.hideField,props.formData.list[i].name)
}
}else if(leftOperatorsAndRight.operator == "!="){
if(model.value[leftArr[2]]!=leftOperatorsAndRight.right){
props.formData.config.hideField = addStringIfNotExists(props.formData.config.hideField,props.formData.list[i].name)
}
}else if(leftOperatorsAndRight.operator == ">="){
if(model.value[leftArr[2]]>=leftOperatorsAndRight.right){
props.formData.config.hideField = addStringIfNotExists(props.formData.config.hideField,props.formData.list[i].name)
}
}else if(leftOperatorsAndRight.operator == ">"){
if(model.value[leftArr[2]]>leftOperatorsAndRight.right){
props.formData.config.hideField = addStringIfNotExists(props.formData.config.hideField,props.formData.list[i].name)
}
}else if(leftOperatorsAndRight.operator == "<"){
if(model.value[leftArr[2]]<leftOperatorsAndRight.right){
props.formData.config.hideField = addStringIfNotExists(props.formData.config.hideField,props.formData.list[i].name)
}
}else if(leftOperatorsAndRight.operator == "<="){
if(model.value[leftArr[2]]<=leftOperatorsAndRight.right){
props.formData.config.hideField = addStringIfNotExists(props.formData.config.hideField,props.formData.list[i].name)
}
}
})
}
} }
} }
} }
@ -629,7 +665,6 @@ function showOrHide (data:any){
} }
} }
} }
@ -895,15 +930,7 @@ function showOrHide (data:any){
} }
function removeDuplicates(arr:any) {
//alert(1)
return arr.reduce((accumulator: any[], currentValue: any) => {
if (!accumulator.includes(currentValue)) {
accumulator.push(currentValue);
}
return accumulator;
}, []);
}
function addStringIfNotExists(arr: string[], str: string) { function addStringIfNotExists(arr: string[], str: string) {
if (!arr.includes(str)) { if (!arr.includes(str)) {
@ -921,17 +948,25 @@ function queryIfOrgOrPerson(obj: { left: string; operator: string; right: string
}); });
} }
/* function queryHideFieldCondition(obj: { left: string; operator: string; right: string }) {
return request({
url: '/javasys/lowCode/AssociatedForms/queryHideFieldCondition',
method: 'post',
data: obj,
});
} */
function splitString(str:string) { function splitString(str:string) {
const operators = ['==', '>', '>=', '<', '<=', '!=', '不包含' ,'包含']; const operators = ['==', '>', '>=', '<', '<=', '!=', '不包含' ,'包含'];
for (let operator of operators) { for (let operator of operators) {
if (str.includes(operator)) { if (str.includes(operator)) {
let index = str.indexOf(operator); let index = str.indexOf(operator);
let left = str.slice(0, index).trim(); let left = str.slice(0, index).trim();
let right = str.slice(index + operator.length).trim(); let right = str.slice(index + operator.length).trim();
return { left,operator, right }; return { left,operator, right };
} }
} }
//return { left: str, right: '' };
} }
const dictForm = computed(() => { const dictForm = computed(() => {

Loading…
Cancel
Save