diff --git a/src/components/DesignForm/assembly/index.ts b/src/components/DesignForm/assembly/index.ts
index 9487aec..4074d41 100644
--- a/src/components/DesignForm/assembly/index.ts
+++ b/src/components/DesignForm/assembly/index.ts
@@ -942,11 +942,12 @@ export default [
config: {},
styles: {
divStyle: {
- marginBot: "15"
- },
- labelStyle: {
+ marginBot: "15",
paddingLeft: "7",
},
+ /* labelStyle: {
+ paddingLeft: "7",
+ }, */
inputStyle: {}
}
},
diff --git a/src/components/DesignForm/public/form/childTable.vue b/src/components/DesignForm/public/form/childTable.vue
index 902b021..ccae241 100644
--- a/src/components/DesignForm/public/form/childTable.vue
+++ b/src/components/DesignForm/public/form/childTable.vue
@@ -183,6 +183,14 @@ const timeToString = (timeVal:any,types:int) => {
return timeStr
}
let associatedFormsIndexTablekey = 0
+const emits = defineEmits<{
+ (e: 'asfValueChanged', val: any): void
+}>()
+
+function asfValueChanged(val:any){
+ //console.log("childTable-asfValueChanged",val)
+ emits("asfValueChanged",val)
+}
@@ -226,6 +234,7 @@ let associatedFormsIndexTablekey = 0
:tProp="`${data.name}.${scope.$index}.${item.name}`"
:row-index="scope.$index"
:data="item"
+ @asf-value-changed="asfValueChanged"
/>
diff --git a/src/components/DesignForm/public/form/formGroup.vue b/src/components/DesignForm/public/form/formGroup.vue
index 1585049..fa44caa 100644
--- a/src/components/DesignForm/public/form/formGroup.vue
+++ b/src/components/DesignForm/public/form/formGroup.vue
@@ -461,11 +461,19 @@ function getNewObject(obj:any, arr:any) {
return {};
}
function asfValueChanged(val:any){
+
- /* console.log("asfValueChanged",val)
+ /* console.log("formGroup-asfValueChanged",val)
console.log(val.currentVal)
console.log(val.fillFieldsMaster)
console.log(val.fillFieldsChild) */
+
+
+ //[key][props.rowIndex][key1]
+ /* console.log(val.tableFlag)
+ console.log(val.key)
+ console.log(val.propsRowIndex)
+ console.log(val.key1) */
let fillFieldsMaster = ""
let masterFillRoleFieldsArray1: any[] = [];
@@ -541,7 +549,7 @@ function asfValueChanged(val:any){
if(val.options[0].fillRolesFieldsMap){
val.options.forEach((item:any)=>{
if(item.fillRolesFieldsMap.value == val.currentVal){
-
+ //console.log(masterFillRoleFieldsArray1)
if(masterFillRoleFieldsArray1.length>0){
masterFillRoleFieldsArray1.forEach((item1:any)=>{
//console.log(item.fillRolesFieldsMap)
@@ -553,6 +561,8 @@ function asfValueChanged(val:any){
if(isString(strOrNumber)&&strOrNumber.includes("[")){
strOrNumberOrArray = convertIfValidNumberArray(strOrNumber)
}
+ /* console.log(strOrNumber)
+ console.log(strOrNumberOrArray) */
/* console.log(x[1])
console.log(strOrNumberOrArray)
@@ -560,7 +570,27 @@ function asfValueChanged(val:any){
if(strOrNumberOrArray){
formProps.value.model[x[0]] = strOrNumberOrArray
}else{
- formProps.value.model[x[0]] = strOrNumber
+ /* console.log(x)
+ console.log(formProps.value.model)
+ console.log(val.tableFlag)
+ console.log(val.key)
+ console.log(val.propsRowIndex)
+ console.log(val.key1) */
+
+ if(val.tableFlag){
+ //console.log(formProps.value.model)
+ let urlArr = findPathInObject(formProps.value.model,x[0])
+ //console.log(urlArr)
+ if(urlArr[0]==x[0]){
+ formProps.value.model[x[0]] = strOrNumber
+ }else{
+ formProps.value.model[val.key][val.propsRowIndex][x[0]] = strOrNumber
+ }
+
+ }else{
+ formProps.value.model[x[0]] = strOrNumber
+ }
+
}
//console.log(formProps.value.model[x[0]])
@@ -576,6 +606,34 @@ function asfValueChanged(val:any){
}
}
+function findPathInObject(obj: any, target: string): string[] {
+ function search(obj: any, target: string, path: string[] = []): string[] | null {
+ if (typeof obj === "object" && obj!== null) {
+ for (let key in obj) {
+ let newPath = path.concat(key);
+ if (key === target) {
+ return newPath;
+ } else if (Array.isArray(obj[key])) {
+ for (let i = 0; i < obj[key].length; i++) {
+ let result = search(obj[key][i], target, newPath);
+ if (result) {
+ return result;
+ }
+ }
+ } else if (typeof obj[key] === "object" && obj[key]!== null) {
+ let result = search(obj[key], target, newPath);
+ if (result) {
+ return result;
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ return search(obj, target) || [];
+}
+
interface DetailObject {
[key: string]: any
}
@@ -774,7 +832,7 @@ function optionsValue3Get1(data: any,fieldName: string){
-
+
diff --git a/src/components/DesignForm/public/form/formItem.vue b/src/components/DesignForm/public/form/formItem.vue
index 69231e2..600ee84 100644
--- a/src/components/DesignForm/public/form/formItem.vue
+++ b/src/components/DesignForm/public/form/formItem.vue
@@ -900,7 +900,7 @@ const pickUserVal = (val:any) => {
function asfValueChanged(val:any){
- //console.log("asfValueChanged",val)
+ //console.log("formItem-asfValueChanged",val)
emits("asfValueChanged",val)
}
/**
diff --git a/src/widget/associatedforms/associatedForms.vue b/src/widget/associatedforms/associatedForms.vue
index 5430427..3d13e69 100644
--- a/src/widget/associatedforms/associatedForms.vue
+++ b/src/widget/associatedforms/associatedForms.vue
@@ -59,6 +59,7 @@ function hasTableProperty(obj: object): boolean {
onMounted(()=>{
if(props.data.control.formid!=null&&props.data.control.formid!=""){
getAsfDataTitles().then(({ data }) => {
+ //console.log(data)
options.value = data
value1.value = props.formProps.model[props.data.name]
@@ -76,7 +77,7 @@ onMounted(()=>{
tableFlag = true
//当前关联表单在子表的第几行
-
+ //console.log(props.formProps.model[key][props.rowIndex][key1])
value2.value = props.formProps.model[key][props.rowIndex][key1]
}
}
@@ -105,6 +106,7 @@ function asfValueChanged(){
fillFieldsChild:fillFieldsChild,
asfFormId:props.data.control.formid,
glbbddbd:props.data.control.glbbddbd,
+ tableFlag:false,
}
emits("valueChanged",val)
@@ -119,6 +121,7 @@ function asfValueChangedTable(){
fillFieldsChild:fillFieldsChild,
asfFormId:props.data.control.formid,
glbbddbd:props.data.control.glbbddbd,
+ tableFlag:true,
}
emits("valueChangedTable",val)
diff --git a/src/widget/associatedforms/index.vue b/src/widget/associatedforms/index.vue
index 673ac81..fe8143d 100644
--- a/src/widget/associatedforms/index.vue
+++ b/src/widget/associatedforms/index.vue
@@ -172,7 +172,7 @@ const valueChangedTable = (val: any) => {
//console.log("关联表单选择table--->", val)
- emits("asfValueChanged", val)
+ //emits("asfValueChanged", val)
//确定哪个或哪些表单是被放置在子表中的
@@ -192,6 +192,10 @@ const valueChangedTable = (val: any) => {
console.log(formProps.value.model[key][props.rowIndex][key1])
console.log(val.currentVal) */
formProps.value.model[key][props.rowIndex][key1] = val.currentVal
+ val.key = key
+ val.propsRowIndex = props.rowIndex
+ val.key1 = key1
+ emits("asfValueChanged", val)
}
}
}