|
|
@ -10,6 +10,7 @@ const props = withDefaults(defineProps<TableProp>(), { |
|
|
|
columns: () => [], |
|
|
|
mustInit: true, |
|
|
|
hasHeader: true, |
|
|
|
getDataFn: () => Promise.resolve([]), |
|
|
|
}) |
|
|
|
const emits = defineEmits([]) |
|
|
|
enum ColumnType { |
|
|
@ -79,49 +80,47 @@ defineExpose({ |
|
|
|
</script> |
|
|
|
|
|
|
|
<template> |
|
|
|
<el-main> |
|
|
|
<div v-if="hasHeader" class="header"> |
|
|
|
<div v-for="btn in btnList" :key="btn.serverUrl"> |
|
|
|
<el-button :icon="btn.icon" :type="btn.type" @click="methodParent(btn.serverUrl)"> |
|
|
|
{{ btn.name }} |
|
|
|
</el-button> |
|
|
|
</div> |
|
|
|
<div class="search"> |
|
|
|
<el-input> |
|
|
|
<template #suffix> |
|
|
|
<el-icon class="el-input__icon"> |
|
|
|
<search /> |
|
|
|
</el-icon> |
|
|
|
</template> |
|
|
|
</el-input> |
|
|
|
</div> |
|
|
|
<div v-if="hasHeader" class="header"> |
|
|
|
<div v-for="btn in btnList" :key="btn.serverUrl"> |
|
|
|
<el-button :icon="btn.icon" :type="btn.type" @click="methodParent(btn.serverUrl)"> |
|
|
|
{{ btn.name }} |
|
|
|
</el-button> |
|
|
|
</div> |
|
|
|
<el-table |
|
|
|
v-loading="state.loading" |
|
|
|
:="$attrs" |
|
|
|
:data="state.tableData" |
|
|
|
style="width: 100%" |
|
|
|
height="calc(100% - 100px)" |
|
|
|
:highlight-current-row="true" |
|
|
|
class="container-table" |
|
|
|
header-row-class-name="header-row-class" |
|
|
|
> |
|
|
|
<template v-for="(column, index) in columns" :key="column.key"> |
|
|
|
<el-table-column |
|
|
|
show-overflow-tooltip |
|
|
|
:prop="column.key" |
|
|
|
:label="column.title" |
|
|
|
:width="column.width" |
|
|
|
:type="column.type" |
|
|
|
:fixed="column.fixed" |
|
|
|
> |
|
|
|
<template v-if="column.render" #default="scope"> |
|
|
|
<Expand :column="column" :row="scope.row" :render="column.render" :index="index" /> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</template> |
|
|
|
</el-table> |
|
|
|
</el-main> |
|
|
|
<div class="search"> |
|
|
|
<el-input> |
|
|
|
<template #suffix> |
|
|
|
<el-icon class="el-input__icon"> |
|
|
|
<search /> |
|
|
|
</el-icon> |
|
|
|
</template> |
|
|
|
</el-input> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<el-table |
|
|
|
v-loading="state.loading" |
|
|
|
:="$attrs" |
|
|
|
:data="state.tableData" |
|
|
|
style="width: 100%" |
|
|
|
height="100%" |
|
|
|
:highlight-current-row="true" |
|
|
|
class="container-table" |
|
|
|
header-row-class-name="header-row-class" |
|
|
|
> |
|
|
|
<template v-for="(column, index) in columns" :key="column.key"> |
|
|
|
<el-table-column |
|
|
|
show-overflow-tooltip |
|
|
|
:prop="column.key" |
|
|
|
:label="column.title" |
|
|
|
:width="column.width" |
|
|
|
:type="column.type" |
|
|
|
:fixed="column.fixed" |
|
|
|
> |
|
|
|
<template v-if="column.render" #default="scope"> |
|
|
|
<Expand :column="column" :row="scope.row" :render="column.render" :index="index" /> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</template> |
|
|
|
</el-table> |
|
|
|
</template> |
|
|
|
|
|
|
|
<style lang="scss" scoped> |
|
|
@ -129,17 +128,17 @@ defineExpose({ |
|
|
|
display: flex; |
|
|
|
justify-content: space-between; |
|
|
|
align-items: center; |
|
|
|
height: 100px; |
|
|
|
height: 40px; |
|
|
|
.search { |
|
|
|
width: 200px; |
|
|
|
} |
|
|
|
} |
|
|
|
:deep(.header-row-class) { |
|
|
|
th { |
|
|
|
background: #f7f8fa; |
|
|
|
font-weight: 900; |
|
|
|
background-color: rgba(0,0,0,0.02 ) !important; |
|
|
|
//font-weight: 500; |
|
|
|
//border-bottom: none; |
|
|
|
color: #000; |
|
|
|
color: rgba(0, 0, 0, 0.85) |
|
|
|
} |
|
|
|
} |
|
|
|
</style> |