|
@@ -189,12 +189,31 @@ export default {
|
|
|
console.log(this.data)
|
|
|
this.templateData = this.data.list
|
|
|
this.generateModle(this.templateData);
|
|
|
+
|
|
|
+ // 选项关联不支付子表单
|
|
|
if (!this.preview) {
|
|
|
let tempData = this.templateData;
|
|
|
let hiddenFormList = this.getSelectValueObject(tempData);
|
|
|
this.formStatus = hiddenFormList;
|
|
|
+ console.log(tempData, hiddenFormList, this.formStatus, '111')
|
|
|
this.relationFormChange();
|
|
|
- console.log(this.data);
|
|
|
+ } else {
|
|
|
+ let tempData = this.templateData
|
|
|
+ let ids = this.getSelectValueObject(tempData, true)
|
|
|
+ const values = this.models[ids.model]
|
|
|
+ console.log(ids, 1111111111111, this.models, values)
|
|
|
+ let relationArray = []
|
|
|
+ ids.options && ids.options.options.forEach(item => {
|
|
|
+ if(values == item.value) {
|
|
|
+ let tempRelation = item.relationOptions || []
|
|
|
+ relationArray.push(...tempRelation)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ console.log(relationArray, 'relationArray')
|
|
|
+ if(relationArray.length > 0) {
|
|
|
+ this.relationFormChange(relationArray)
|
|
|
+ }
|
|
|
+ console.log(this.templateData, 'templateData')
|
|
|
}
|
|
|
},
|
|
|
mounted() {},
|
|
@@ -235,12 +254,14 @@ export default {
|
|
|
this.models[item.model].push(subformFields);
|
|
|
this.models.status = 1;
|
|
|
},
|
|
|
- getSelectValueObject(tpls) {
|
|
|
+ getSelectValueObject(tpls, relationStatus) {
|
|
|
let tempList = tpls || [];
|
|
|
let status = false;
|
|
|
+ let relationId = ''
|
|
|
tempList.forEach(list => {
|
|
|
if (list.type == "select" && list.options.relationStatus) {
|
|
|
status = true;
|
|
|
+ relationId = list
|
|
|
}
|
|
|
if (list.type == "subform") {
|
|
|
let childList = list.columns || [];
|
|
@@ -249,20 +270,19 @@ export default {
|
|
|
childList.forEach(c => {
|
|
|
if (c.type == "select" && list.options.relationStatus) {
|
|
|
status = true;
|
|
|
+ relationId = list
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
- return status;
|
|
|
+ return relationStatus ? relationId : status;
|
|
|
},
|
|
|
relationFormChange(value) {
|
|
|
- console.log(value)
|
|
|
// false 为显示,true 为隐藏
|
|
|
let temp = value || [];
|
|
|
let tempData = JSON.parse(JSON.stringify(this.templateData));
|
|
|
tempData.forEach(item => {
|
|
|
- // console.log(!item.options.relationStatus, 'relationStatus')
|
|
|
if (this.formStatus) {
|
|
|
if (
|
|
|
item.type != "text" &&
|