Commit ccdfb96d authored by xioln's avatar xioln

TAB切换组件

parent 47cf50cc
...@@ -9,7 +9,7 @@ export default { ...@@ -9,7 +9,7 @@ export default {
title: '搜索参数配置', title: '搜索参数配置',
width: 1, width: 1,
component: { component: {
defaultValue: '{"layKey":"JobResponseInExpermentQuery","typeName":"JobResponseInExperment"}', defaultValue: '{"typeName":"JobResponseInExperment","layKey":"JobResponseInExpermentQuery"}',
name: 'el-input', name: 'el-input',
type: 'textarea', type: 'textarea',
rows: '4' rows: '4'
...@@ -20,7 +20,7 @@ export default { ...@@ -20,7 +20,7 @@ export default {
title: 'TAB参数配置', title: 'TAB参数配置',
width: 1, width: 1,
component: { component: {
defaultValue: '[{"id":1,"name":"不合格品","typeName":"JobResponseInTest","layKey":"unqualified_Table"},{"id":2,"name":"试验","typeName":"JobResponseInExperment","layKey":"unqualified_Table"}]', defaultValue: '[{"name":"不合格品","typeName":"JobResponseInTest","layKey":"unqualified_Table"},{"name":"试验","typeName":"JobResponseInExperment","layKey":"unqualified_Table"}]',
name: 'el-input', name: 'el-input',
type: 'textarea', type: 'textarea',
rows: '4' rows: '4'
......
/** /**
* @Description: TAB切换 * @Description: TAB切换
* @author xioln * @author xioln
* @date 2023-10-25 * @date 2023-10-25
* @FilePath: applications/dee-mes/src/privateComponents/components/UnqualifiedSearch/index.vue * @FilePath: applications/dee-mes/src/privateComponents/components/UnqualifiedSearch/index.vue
*/ */
<template> <template>
<div class="unqualifie-search"> <div class="unqualifie-search">
<dee-as-com <dee-as-com ref="deeSearch" :lay-config="serchOptions" @searchEvent="searchEvent" />
ref="deeSearch" <el-tabs ref="tabRef" v-model="activeTab" class="dee-tab" type="card" @tab-click="tabClick">
:lay-config="serchOptions" <el-tab-pane v-for="(tab, index) in tabOptions" :key="index" :label="tab.name" :name="index.toString()">
@searchEvent="searchEvent" <dee-as-com :ref="'tab' + index" :lay-config="getLayConfig(tab)" />
/> </el-tab-pane>
<dee-tab </el-tabs>
ref="deetab"
class="dee-tab"
:tabs="tabOptions"
@tabClick="tabClick"
>
<div v-for="(item, index) in tabOptions" :key="index" :slot="item.id">
<dee-as-com
:ref="item.id"
:lay-config="{
typeName: item.typeName,
layKey: item.layKey
}"
/>
</div>
</dee-tab>
</div> </div>
</template> </template>
<script> <script>
...@@ -49,7 +34,8 @@ export default { ...@@ -49,7 +34,8 @@ export default {
serchOptions: {}, serchOptions: {},
tabOptions: [], tabOptions: [],
searchItems: [], searchItems: [],
currTab: null activeTab: '0',
tableRef: null
} }
}, },
computed: {}, computed: {},
...@@ -72,20 +58,48 @@ export default { ...@@ -72,20 +58,48 @@ export default {
created() { created() {
// 初始化数据 // 初始化数据
}, },
mounted() {
// 初始化数据
},
methods: { methods: {
getLayConfig(item) {
// 根据 item 的属性创建 lay-config 对象
return {
typeName: item.typeName,
layKey: item.layKey
}
},
searchEvent(v) { searchEvent(v) {
this.searchItems = v.items this.searchItems = v.items
this.searchFun() this.searchFun()
}, },
tabClick(val) { tabClick(val) {
this.currTab = val.name this.tableRef = val.$children[0]
this.searchFun() this.searchFun()
}, },
searchFun() { searchFun() {
this.$refs[this.currTab][0].$refs.asCom.getData(this.searchItems) if (this.tableRef) {
this.tableRef.$refs.asCom.getData(this.searchItems)
} else {
this.$refs.tab0[0].$refs.asCom.getData(this.searchItems)
}
} }
} }
} }
</script> </script>
<style lang='scss'> <style lang='scss'>
.unqualifie-search {
height: 100%;
.dee-tab {
height: 100%;
}
.is-active {
background-color: #f2f2f2;
}
.dee-table {
height: 60vh !important;
}
}
</style> </style>
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