Browse Source

修改显示隐藏初始不隐藏bug

lwx_v9
liwenxuan 1 year ago
parent
commit
fddfec646a
  1. 42
      src/components/DesignForm/formControlAttr.vue
  2. 64
      src/components/DesignForm/public/form/form.vue

42
src/components/DesignForm/formControlAttr.vue

@ -1917,7 +1917,7 @@ function getAsfasfFieldTreeOptionsValue3() {
});
}
//
const asfasfFieldTree = ref<Tree[]>()
const asfasfFieldTreeOptionsValue3 = ref<Tree[]>()
@ -1956,6 +1956,8 @@ function formidChangedOptionsValue3(){
if(data.id==="cfid为空"){
//alert("cfid")
}else{
if(data.treeAttrs.onlyToShowTableId==""){//
let resData = ref(data.children)
//let rootid_ = data.value.label
asfasfFieldTreeOptionsValue3.value = [{
@ -1964,6 +1966,44 @@ function formidChangedOptionsValue3(){
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 = ""
}
}
}
}
}
});

64
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
}
// 线AB
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
}
// 线AB
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) {

Loading…
Cancel
Save