|
|
@ -3,7 +3,10 @@ |
|
|
|
|
|
|
|
|
<div class="container"> |
|
|
<div class="container"> |
|
|
<!-- <span style="font-size: 14px; margin-right: 12px;padding-top: 4px;" class="small-span" >{{ props.data.item?props.data.item.label:"关联表单" }}</span> --> |
|
|
<!-- <span style="font-size: 14px; margin-right: 12px;padding-top: 4px;" class="small-span" >{{ props.data.item?props.data.item.label:"关联表单" }}</span> --> |
|
|
<el-select v-model="value1" placeholder="请选择" class="big-span" @change="asfValueChanged"> |
|
|
<el-select v-if="!tableFlag" v-model="value1" placeholder="请选择" class="big-span" @change="asfValueChanged"> |
|
|
|
|
|
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" /> |
|
|
|
|
|
</el-select> |
|
|
|
|
|
<el-select v-if="tableFlag" v-model="value2" placeholder="请选择" class="big-span" @change="asfValueChangedTable"> |
|
|
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" /> |
|
|
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" /> |
|
|
</el-select> |
|
|
</el-select> |
|
|
</div> |
|
|
</div> |
|
|
@ -33,20 +36,59 @@ const props = withDefaults( |
|
|
data: FormList |
|
|
data: FormList |
|
|
formProps:Object |
|
|
formProps:Object |
|
|
tablekey: any |
|
|
tablekey: any |
|
|
|
|
|
rowIndex:number |
|
|
}>(), |
|
|
}>(), |
|
|
{} |
|
|
{} |
|
|
) |
|
|
) |
|
|
const emits = defineEmits(["valueChanged"]); |
|
|
const emits = defineEmits(["valueChanged","valueChangedTable"]); |
|
|
const value1 = ref('') |
|
|
const value1 = ref('') |
|
|
|
|
|
const value2 = ref('') |
|
|
|
|
|
const valueTest = ref('') |
|
|
|
|
|
let tableFlag = false |
|
|
const options = ref([]) |
|
|
const options = ref([]) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function hasTableProperty(obj: object): boolean { |
|
|
|
|
|
for (let key in obj) { |
|
|
|
|
|
if (key.startsWith("table")) { |
|
|
|
|
|
return true; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
onMounted(()=>{ |
|
|
onMounted(()=>{ |
|
|
// console.log(props.data.control) |
|
|
|
|
|
if(props.data.control.formid!=null&&props.data.control.formid!=""){ |
|
|
if(props.data.control.formid!=null&&props.data.control.formid!=""){ |
|
|
getAsfDataTitles().then(({ data }) => { |
|
|
getAsfDataTitles().then(({ data }) => { |
|
|
//console.log(data) |
|
|
|
|
|
options.value = data |
|
|
options.value = data |
|
|
value1.value = props.formProps.model[props.data.name] |
|
|
value1.value = props.formProps.model[props.data.name] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 确定哪个或哪些表单是被放置在子表中的 |
|
|
|
|
|
valueTest.value = props.formProps.model |
|
|
|
|
|
for (let key in valueTest.value) { |
|
|
|
|
|
if (key.startsWith("table")) { |
|
|
|
|
|
if(Array.isArray(valueTest.value[key])){ |
|
|
|
|
|
|
|
|
|
|
|
if(valueTest.value[key].length>0){ |
|
|
|
|
|
for (let key1 in valueTest.value[key][0]) { |
|
|
|
|
|
if(key1==props.data.name){ |
|
|
|
|
|
tableFlag = true |
|
|
|
|
|
|
|
|
|
|
|
//当前关联表单在子表的第几行 |
|
|
|
|
|
|
|
|
|
|
|
value2.value = props.formProps.model[key][props.rowIndex][key1] |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -68,9 +110,24 @@ function asfValueChanged(){ |
|
|
emits("valueChanged",val) |
|
|
emits("valueChanged",val) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function asfValueChangedTable(){ |
|
|
|
|
|
|
|
|
|
|
|
let val = { |
|
|
|
|
|
options:options.value, |
|
|
|
|
|
currentVal:value2.value, |
|
|
|
|
|
fillFieldsMaster:fillFieldsMaster, |
|
|
|
|
|
fillFieldsChild:fillFieldsChild, |
|
|
|
|
|
asfFormId:props.data.control.formid, |
|
|
|
|
|
glbbddbd:props.data.control.glbbddbd, |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
emits("valueChangedTable",val) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
function getAsfDataTitles() { |
|
|
function getAsfDataTitles() { |
|
|
let dataTitle = '' |
|
|
let dataTitle = '' |
|
|
if(props.tablekey.dataTitle!=null&&props.tablekey.dataTitle.length>0){ |
|
|
//console.log(props) |
|
|
|
|
|
if(props.tablekey&&props.tablekey.dataTitle&&props.tablekey.dataTitle!=null&&props.tablekey.dataTitle.length>0){ |
|
|
for(let i = 0;i<props.tablekey.dataTitle.length;i++){ |
|
|
for(let i = 0;i<props.tablekey.dataTitle.length;i++){ |
|
|
dataTitle = dataTitle+props.tablekey.dataTitle[i]+"###" |
|
|
dataTitle = dataTitle+props.tablekey.dataTitle[i]+"###" |
|
|
} |
|
|
} |
|
|
|