Commit a016dfdd authored by xioln's avatar xioln

tab切换组件

parent 6c78cb49
......@@ -5,80 +5,25 @@ export default {
title: '高级组件配置',
data: [
{
key: 'searchAttrModel',
title: '搜索模型',
key: 'searchParams',
title: '搜索参数配置',
width: 1,
component: {
defaultValue: 'JobResponseInExperment',
defaultValue: '{"layKey":"JobResponseInExpermentQuery","typeName":"JobResponseInExperment"}',
name: 'el-input',
type: 'textarea',
rows: '4'
}
},
{
key: 'searchAttrModel',
title: '搜索模型',
component: {
defaultValue: 'JobResponseInExperment',
name: 'el-input'
}
},
{
key: 'searchAttrNumber',
title: '搜索编号',
component: {
defaultValue: 'JobResponseInExpermentQuery',
name: 'el-input'
}
},
{
key: 'attrTab1Name',
title: 'TAB1名称',
component: {
defaultValue: '试验',
name: 'el-input'
}
},
{
key: 'attrTab1Model',
title: 'TAB1模型',
component: {
defaultValue: 'JobResponseInExperment',
name: 'el-input'
}
},
{
key: 'attrTab1Number',
title: 'TAB1编号',
component: {
defaultValue: 'unqualified_Table',
name: 'el-input'
}
},
{
key: 'attrTab2Name',
title: 'TAB2名称',
component: {
defaultValue: '不合格品',
name: 'el-input'
}
},
{
key: 'attrTab2Model',
title: 'TAB2模型',
component: {
defaultValue: 'JobResponseInTest',
name: 'el-input'
}
},
{
key: 'attrTab2Number',
title: 'TAB2编号',
key: 'tabParams',
title: 'TAB参数配置',
width: 1,
component: {
defaultValue: 'unqualified_Table',
defaultValue: '[{"id":1,"name":"不合格品","typeName":"JobResponseInTest","layKey":"unqualified_Table"},{"id":2,"name":"试验","typeName":"JobResponseInExperment","layKey":"unqualified_Table"}]',
name: 'el-input',
type: 'textarea',
rows: '2'
rows: '4'
}
}
]
......
......@@ -14,19 +14,16 @@
<dee-tab
ref="deetab"
class="dee-tab"
:tabs="tabs"
:tabs="tabOptions"
@tabClick="tabClick"
>
<div slot="1">
<div v-for="(item, index) in tabOptions" :key="index" :slot="item.id">
<dee-as-com
ref="deetab1"
:lay-config="tab1Options"
/>
</div>
<div slot="2">
<dee-as-com
ref="deetab2"
:lay-config="tab2Options"
:ref="item.id"
:lay-config="{
typeName: item.typeName,
layKey: item.layKey
}"
/>
</div>
</dee-tab>
......@@ -49,24 +46,10 @@ export default {
},
data() {
return {
tabs: [
{ id: '1', name: '' },
{ id: '2', name: '' }
],
serchOptions: {
typeName: '',
layKey: ''
},
tab1Options: {
typeName: '',
layKey: ''
},
tab2Options: {
typeName: '',
layKey: ''
},
serchOptions: {},
tabOptions: [],
searchItems: [],
currTab: 1
currTab: null
}
},
computed: {},
......@@ -75,14 +58,14 @@ export default {
immediate: true,
deep: true,
handler(v) {
this.tabs[0].name = v.attrTab1Name
this.tabs[1].name = v.attrTab2Name
this.serchOptions.typeName = v.searchAttrModel
this.serchOptions.layKey = v.searchAttrNumber
this.tab1Options.typeName = v.attrTab1Model
this.tab1Options.layKey = v.attrTab1Number
this.tab2Options.typeName = v.attrTab2Model
this.tab2Options.layKey = v.attrTab2Number
this.$nextTick(() => {
if (v.hasOwnProperty('searchParams')) {
this.serchOptions = JSON.parse(v.searchParams)
}
if (v.hasOwnProperty('tabParams')) {
this.tabOptions = JSON.parse(v.tabParams)
}
})
}
}
},
......@@ -99,11 +82,7 @@ export default {
this.searchFun()
},
searchFun() {
if (this.currTab === 1) {
this.$refs.deetab1.$refs.asCom.getData(this.searchItems)
} else {
this.$refs.deetab2.$refs.asCom.getData(this.searchItems)
}
this.$refs[this.currTab][0].$refs.asCom.getData(this.searchItems)
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment