diff --git a/src/components/DesignForm/formControlAttr.vue b/src/components/DesignForm/formControlAttr.vue index a90bf8c37..d9518656c 100644 --- a/src/components/DesignForm/formControlAttr.vue +++ b/src/components/DesignForm/formControlAttr.vue @@ -1917,7 +1917,7 @@ function getAsfasfFieldTreeOptionsValue3() { }); } - +// const asfasfFieldTree = ref() const asfasfFieldTreeOptionsValue3 = ref() @@ -1956,14 +1956,54 @@ function formidChangedOptionsValue3(){ if(data.id==="cfid为空"){ //alert("cfid为空") }else{ - let resData = ref(data.children) - //let rootid_ = data.value.label - asfasfFieldTreeOptionsValue3.value = [{ - id: 'rootid_'+data.label, - label: '关联的表单-'+data.label, - children: [...resData.value], - treeAttrs: data.treeAttrs, - }] + + if(data.treeAttrs.onlyToShowTableId==""){//当前选中的是主表 + let resData = ref(data.children) + //let rootid_ = data.value.label + asfasfFieldTreeOptionsValue3.value = [{ + id: 'rootid_'+data.label, + label: '关联的表单-'+data.label, + children: [...resData.value], + treeAttrs: data.treeAttrs, + }] + }else{//当前选中的是子表 + let resData = ref(data.children) + resData.value = resData.value.filter((item: { children: null }) => item.children != null) + let arr = JSON.parse(JSON.stringify(resData.value)); + arr = arr.filter( (item: { label: any }) => item.label == data.treeAttrs.onlyToShowTableId ) + + arr = arr[0].children + //console.log(arr) + asfasfFieldTreeOptionsValue3.value = [{ + id: 'rootid_'+data.label, + label: '关联的表单-'+data.label, + children: [...arr], + treeAttrs: data.treeAttrs, + }] + + + } + let optionsValue3Formid = controlData.value.control.optionsValue3Formid + let str_optionsValue3Formid = optionsValue3Formid.split(":")[0] + let optionsValue3Field = controlData.value.control.optionsValue3Field + let str_optionsValue3Field = optionsValue3Field.split(":")[1] + //alert(str_optionsValue3Field) + if(typeof(str_optionsValue3Field)!='undefined'){ + if(str_optionsValue3Formid!=str_optionsValue3Field){ + controlData.value.control.optionsValue3Field = "" + }else{ + if(optionsValue3Formid.includes(":zibiaoid-")){ + let zibiaoid = optionsValue3Formid.split(":zibiaoid-")[1] + if(!optionsValue3Field.includes(zibiaoid)){ + controlData.value.control.optionsValue3Field = "" + } + } + } + + + } + + } }); diff --git a/src/components/DesignForm/public/form/form.vue b/src/components/DesignForm/public/form/form.vue index a91fd0381..b4de962df 100644 --- a/src/components/DesignForm/public/form/form.vue +++ b/src/components/DesignForm/public/form/form.vue @@ -481,6 +481,39 @@ provide(constControlChange, ({ key, value, data, tProp, type, attribute }: any) } // }) + showOrHide() + + if (typeof props.changeKeyVal === 'function') { + props.changeKeyVal(key, value,type,attribute) + } + if (key) { + if (!tProp) { + // 表格和弹性布局不是这里更新,只触change + model.value[key] = value + } + // 支持在线方式数据处理,如A组件值改变时,可自动修改B组件的值,可参考请假流程自动时长计算 + if (props.formData.events?.change) { + model.value = props.formData.events.change(key, model.value) + } + const onFormChange = props.formData.events?.change + if (onFormChange) { + if (typeof onFormChange === 'function') { + model.value = onFormChange(key, model.value) + } else { + model.value = formChangeValue(key, model.value, onFormChange) + } + } + // 当表格和弹性内的字段和外面字段冲突时,可通过tProps区分 + emits('change', { key, value, model: model.value, data, tProp }) + } + + + /* + + */ +}) + +function showOrHide (){ //liwenxuan 关联选项设置效果实现 start /* console.log("监听表单-1-constControlChange-->",props.formData) console.log("监听表单-2-constControlChange-->",key) @@ -738,36 +771,8 @@ provide(constControlChange, ({ key, value, data, tProp, type, attribute }: any) //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) - } - if (key) { - if (!tProp) { - // 表格和弹性布局不是这里更新,只触change - model.value[key] = value - } - // 支持在线方式数据处理,如A组件值改变时,可自动修改B组件的值,可参考请假流程自动时长计算 - if (props.formData.events?.change) { - model.value = props.formData.events.change(key, model.value) - } - const onFormChange = props.formData.events?.change - if (onFormChange) { - if (typeof onFormChange === 'function') { - model.value = onFormChange(key, model.value) - } else { - model.value = formChangeValue(key, model.value, onFormChange) - } - } - // 当表格和弹性内的字段和外面字段冲突时,可通过tProps区分 - emits('change', { key, value, model: model.value, data, tProp }) - } - - - /* - - */ -}) const dictForm = computed(() => { const storage = window.localStorage.getItem('akFormDict') let storageDict = {} @@ -1221,6 +1226,7 @@ onMounted(() => { nextTick(() => { appendRemoveStyle(true) }) + showOrHide() }) onUnmounted(() => { if (eventName) {