|
|
@ -11,6 +11,7 @@ import FormGroup from '@/components/DesignForm/public/form/formGroup.vue' |
|
|
|
|
|
|
|
|
import { FormData,FormList,FormDataStyle } from '@/api/DesignForm/types' |
|
|
import { FormData,FormList,FormDataStyle } from '@/api/DesignForm/types' |
|
|
import { getRequest } from '@/api/DesignForm' |
|
|
import { getRequest } from '@/api/DesignForm' |
|
|
|
|
|
import request from '@/utils/request'; |
|
|
import { useRoute, useRouter } from 'vue-router' |
|
|
import { useRoute, useRouter } from 'vue-router' |
|
|
import { |
|
|
import { |
|
|
constGetControlByName, |
|
|
constGetControlByName, |
|
|
@ -178,7 +179,7 @@ const forEachGetFormModel = (list: FormList[], obj: any) => { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
showOrHide() |
|
|
showOrHide("onMounted") |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function arrayEqual(a: string[], b: any[]) { |
|
|
function arrayEqual(a: string[], b: any[]) { |
|
|
@ -408,6 +409,10 @@ const recursionToGetFinallyHideFields = (hideFieldArr: any[],radioSelectArr3: st |
|
|
if(formProps.value.type!=5){ |
|
|
if(formProps.value.type!=5){ |
|
|
//console.log(hideFieldArr) |
|
|
//console.log(hideFieldArr) |
|
|
props.formData.config.hideField?.push(...hideFieldArr)//实际造成隐藏效果 |
|
|
props.formData.config.hideField?.push(...hideFieldArr)//实际造成隐藏效果 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
}); |
|
|
}); |
|
|
@ -419,16 +424,17 @@ if(formProps.value.type!=5){ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 表单组件值改变事件 tProp为子表格相关 |
|
|
// 表单组件值改变事件 tProp为子表格相关 |
|
|
provide(constControlChange, ({ key, value, data, tProp, type, attribute }: any) => { |
|
|
provide(constControlChange, ({ key, value, data, tProp, type, attribute }: any) => { |
|
|
|
|
|
|
|
|
// console.log("表单组件值改变事件----------1--------->",key) |
|
|
/* console.log("表单组件值改变事件----------1--------->",key) |
|
|
// console.log("表单组件值改变事件----------2--------->",value) |
|
|
console.log("表单组件值改变事件----------2--------->",value) |
|
|
// console.log("表单组件值改变事件----------3--------->",data) |
|
|
console.log("表单组件值改变事件----------3--------->",data) |
|
|
// console.log("表单组件值改变事件----------4--------->",tProp) |
|
|
console.log("表单组件值改变事件----------4--------->",tProp) |
|
|
// console.log("表单组件值改变事件----------5--------->",type) |
|
|
console.log("表单组件值改变事件----------5--------->",type) |
|
|
// console.log("表单组件值改变事件----------6--------->",attribute) |
|
|
console.log("表单组件值改变事件----------6--------->",attribute) |
|
|
// console.log("表单组件值改变事件----------11--------->",model.value) |
|
|
console.log("表单组件值改变事件----------11--------->",model.value) */ |
|
|
let fieldVal = {} |
|
|
let fieldVal = {} |
|
|
for(let i in model.value){ |
|
|
for(let i in model.value){ |
|
|
if(i == key){ |
|
|
if(i == key){ |
|
|
@ -494,7 +500,7 @@ provide(constControlChange, ({ key, value, data, tProp, type, attribute }: any) |
|
|
} |
|
|
} |
|
|
// }) |
|
|
// }) |
|
|
|
|
|
|
|
|
showOrHide() |
|
|
showOrHide(data) |
|
|
|
|
|
|
|
|
if (typeof props.changeKeyVal === 'function') { |
|
|
if (typeof props.changeKeyVal === 'function') { |
|
|
props.changeKeyVal(key, value,type,attribute) |
|
|
props.changeKeyVal(key, value,type,attribute) |
|
|
@ -525,8 +531,163 @@ provide(constControlChange, ({ key, value, data, tProp, type, attribute }: any) |
|
|
|
|
|
|
|
|
*/ |
|
|
*/ |
|
|
}) |
|
|
}) |
|
|
|
|
|
let mustBeHidden: any = [] |
|
|
|
|
|
function showOrHide (data:any){ |
|
|
|
|
|
//console.log(data) |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
|
企管部有当前用户, |
|
|
|
|
|
当前用户是什么权限角色. |
|
|
|
|
|
某表单某字段值大于等于小于不等于某个值 |
|
|
|
|
|
|
|
|
|
|
|
所需接口 |
|
|
|
|
|
接口1:当前用户是不是指定的权限角色 |
|
|
|
|
|
接口2:当前用户是否在指定的机构下或机构的祖先机构下 |
|
|
|
|
|
接口3:本表单(关联关联表单的表单)的某字段的当前值大于等于小于不等于指定的值???也许不需要接口呢? |
|
|
|
|
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
//关联表单隐藏条件判定 start |
|
|
|
|
|
for(let i = 0; i < props.formData.list.length; i++){ |
|
|
|
|
|
if(props.formData.list[i].type=="associatedForms"&&formProps.value.type!=5){ |
|
|
|
|
|
//console.log(props.formData.list[i].name) |
|
|
|
|
|
let asfHideCondition = props.formData.list[i].control.hideGongShi.mathsFormula |
|
|
|
|
|
const leftOperatorsAndRight = splitString(asfHideCondition) |
|
|
|
|
|
|
|
|
|
|
|
if(leftOperatorsAndRight){ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let leftArr = leftOperatorsAndRight.left.split(":") |
|
|
|
|
|
//console.log(leftArr) |
|
|
|
|
|
if(data=="onMounted"||(leftArr[0]=="formField"&&leftArr.length==3)){ |
|
|
|
|
|
if(data=="onMounted"||(data!="kong"&&data.name==leftArr[2])){//关联表单隐藏相关的值发生了变化 |
|
|
|
|
|
|
|
|
|
|
|
if(leftOperatorsAndRight.operator=="包含"){ |
|
|
|
|
|
|
|
|
|
|
|
if(leftOperatorsAndRight.right=="当前用户"){ |
|
|
|
|
|
|
|
|
|
|
|
if(leftOperatorsAndRight.left.startsWith("orgOrPerson")){ |
|
|
|
|
|
//接口2 |
|
|
|
|
|
|
|
|
|
|
|
queryIfOrgOrPerson(leftOperatorsAndRight).then(({ data }) => { |
|
|
|
|
|
if(data==true){ |
|
|
|
|
|
props.formData.config.hideField = addStringIfNotExists(props.formData.config.hideField,props.formData.list[i].name) |
|
|
|
|
|
mustBeHidden.push(props.formData.list[i].name) |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
}else if(leftOperatorsAndRight.left.startsWith("roleid")){ |
|
|
|
|
|
//接口1 |
|
|
|
|
|
queryHideRoleCondition(leftOperatorsAndRight).then(({ data }) => { |
|
|
|
|
|
if(data==true){ |
|
|
|
|
|
//alert(data) |
|
|
|
|
|
props.formData.config.hideField = addStringIfNotExists(props.formData.config.hideField,props.formData.list[i].name) |
|
|
|
|
|
mustBeHidden.push(props.formData.list[i].name) |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}else if(leftOperatorsAndRight.operator=="不包含"){ |
|
|
|
|
|
|
|
|
|
|
|
if(leftOperatorsAndRight.right=="当前用户"){ |
|
|
|
|
|
|
|
|
|
|
|
if(leftOperatorsAndRight.left.startsWith("orgOrPerson")){ |
|
|
|
|
|
|
|
|
|
|
|
//接口2 |
|
|
|
|
|
queryIfOrgOrPerson(leftOperatorsAndRight).then(({ data }) => { |
|
|
|
|
|
if(data==false){ |
|
|
|
|
|
props.formData.config.hideField = addStringIfNotExists(props.formData.config.hideField,props.formData.list[i].name) |
|
|
|
|
|
mustBeHidden.push(props.formData.list[i].name) |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
}else if(leftOperatorsAndRight.left.startsWith("roleid")){ |
|
|
|
|
|
//接口1 |
|
|
|
|
|
queryHideRoleCondition(leftOperatorsAndRight).then(({ data }) => { |
|
|
|
|
|
if(data==false){ |
|
|
|
|
|
//alert(data) |
|
|
|
|
|
props.formData.config.hideField = addStringIfNotExists(props.formData.config.hideField,props.formData.list[i].name) |
|
|
|
|
|
mustBeHidden.push(props.formData.list[i].name) |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}else{ |
|
|
|
|
|
//console.log(leftOperatorsAndRight) |
|
|
|
|
|
if(leftOperatorsAndRight.right=="当前用户"){ |
|
|
|
|
|
|
|
|
|
|
|
if(leftOperatorsAndRight.operator=="=="){ |
|
|
|
|
|
//接口2 |
|
|
|
|
|
queryIfOrgOrPerson(leftOperatorsAndRight).then(({ data }) => { |
|
|
|
|
|
if(data==true){ |
|
|
|
|
|
props.formData.config.hideField = addStringIfNotExists(props.formData.config.hideField,props.formData.list[i].name) |
|
|
|
|
|
mustBeHidden.push(props.formData.list[i].name) |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
}else if(leftOperatorsAndRight.operator=="!="){ |
|
|
|
|
|
//接口2 |
|
|
|
|
|
queryIfOrgOrPerson(leftOperatorsAndRight).then(({ data }) => { |
|
|
|
|
|
if(data==true){ |
|
|
|
|
|
props.formData.config.hideField = addStringIfNotExists(props.formData.config.hideField,props.formData.list[i].name) |
|
|
|
|
|
mustBeHidden.push(props.formData.list[i].name) |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
}else{ |
|
|
|
|
|
//接口3 |
|
|
|
|
|
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) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//关联表单隐藏条件判定 end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function showOrHide (){ |
|
|
|
|
|
//liwenxuan 关联选项设置效果实现 start |
|
|
//liwenxuan 关联选项设置效果实现 start |
|
|
/* console.log("监听表单-1-constControlChange-->",props.formData) |
|
|
/* console.log("监听表单-1-constControlChange-->",props.formData) |
|
|
console.log("监听表单-2-constControlChange-->",key) |
|
|
console.log("监听表单-2-constControlChange-->",key) |
|
|
@ -767,14 +928,11 @@ function showOrHide (){ |
|
|
hideFieldArr = recursionToGetFinallyHideFields(hideFieldArr,radioSelectArr3,defaultHideFields) |
|
|
hideFieldArr = recursionToGetFinallyHideFields(hideFieldArr,radioSelectArr3,defaultHideFields) |
|
|
} |
|
|
} |
|
|
hideFieldArr = recursionToGetFinallyHideFields(hideFieldArr,radioSelectArr3,defaultHideFields) |
|
|
hideFieldArr = recursionToGetFinallyHideFields(hideFieldArr,radioSelectArr3,defaultHideFields) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
props.formData.config.hideField?.push(...mustBeHidden) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -786,6 +944,46 @@ function showOrHide (){ |
|
|
//console.log("监听表单--constControlChange-->",key, value, data, tProp,type,attribute)//liwenxuan |
|
|
//console.log("监听表单--constControlChange-->",key, value, data, tProp,type,attribute)//liwenxuan |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function addStringIfNotExists(arr: string[], str: string) { |
|
|
|
|
|
if (!arr.includes(str)) { |
|
|
|
|
|
arr.push(str); |
|
|
|
|
|
} |
|
|
|
|
|
return arr; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function queryIfOrgOrPerson(obj: { left: string; operator: string; right: string }) { |
|
|
|
|
|
|
|
|
|
|
|
return request({ |
|
|
|
|
|
url: '/javasys/lowCode/AssociatedForms/queryIfOrgOrPerson', |
|
|
|
|
|
method: 'post', |
|
|
|
|
|
data: obj, |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function queryHideRoleCondition(obj: { left: string; operator: string; right: string }) { |
|
|
|
|
|
|
|
|
|
|
|
return request({ |
|
|
|
|
|
url: '/javasys/lowCode/AssociatedForms/queryHideRoleCondition', |
|
|
|
|
|
method: 'post', |
|
|
|
|
|
data: obj, |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function splitString(str:string) { |
|
|
|
|
|
const operators = ['==', '>', '>=', '<', '<=', '!=', '不包含' ,'包含']; |
|
|
|
|
|
for (let operator of operators) { |
|
|
|
|
|
if (str.includes(operator)) { |
|
|
|
|
|
let index = str.indexOf(operator); |
|
|
|
|
|
let left = str.slice(0, index).trim(); |
|
|
|
|
|
let right = str.slice(index + operator.length).trim(); |
|
|
|
|
|
return { left,operator, right }; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
const dictForm = computed(() => { |
|
|
const dictForm = computed(() => { |
|
|
const storage = window.localStorage.getItem('akFormDict') |
|
|
const storage = window.localStorage.getItem('akFormDict') |
|
|
let storageDict = {} |
|
|
let storageDict = {} |
|
|
@ -1239,7 +1437,7 @@ onMounted(() => { |
|
|
nextTick(() => { |
|
|
nextTick(() => { |
|
|
appendRemoveStyle(true) |
|
|
appendRemoveStyle(true) |
|
|
}) |
|
|
}) |
|
|
showOrHide() |
|
|
showOrHide("kong") |
|
|
}) |
|
|
}) |
|
|
onUnmounted(() => { |
|
|
onUnmounted(() => { |
|
|
if (eventName) { |
|
|
if (eventName) { |
|
|
|