<template>
<div class="common-project-container">
<div class="tools-line">
<div class="tools-line-left" v-if="showListAndCard">
<a-select
label-in-value
:default-value="{ key: 'list' }"
style="width: 80px"
@change="handleChange"
>
<a-select-option value="list">列表</a-select-option>
<a-select-option value="card">卡片</a-select-option>
</a-select>
</div>
<div class="tools-line-left">
<slot name="toolLeft"></slot>
</div>
<a-space>
<search-content
v-if="isSearch"
ref="searchContentRef"
style="margin: 0 10px"
v-bind="searchContentObj"
@searchdata="handleToolSearch"
:UNTASK="UNTASK"
:simpleModel="simpleModel"
:timeInputDefault="timeInputDefault"
></search-content>
<select-content
v-if="isSelectContent"
v-bind="selectContentObj"
@getSelectData="getSelectData"
></select-content>
<a-button
v-if="buttonInfo.isButton"
@click="buttonInfo.btnClick"
type="primary"
>新建</a-button
>
</a-space>
</div>
<slot name="alert"></slot>
<a-table ref="innerTable" v-bind="$props" v-on="$listeners">
<template
slot-scope="text, record, index"
:slot="slot"
v-for="slot in Object.keys($scopedSlots).filter(
item => item != 'alert'
)"
>
<!-- v-for="slot in Object.keys($scopedSlots).filter(key => key !== 'expandedRowRender')" -->
<slot :name="slot" v-bind="{ text, record, index }"></slot>
</template>
</a-table>
<card-table v-bind="$props" v-if="showListAndCard"></card-table>
</div>
</template>
<script>
//这里包含了三个部分,search,table主体,列设置,将三者包装成为了一个组件,可分开使用。
import { Table } from 'ant-design-vue'
import SelectContent from '@/common/SelectContent'
import SearchContent from '@/common/searchcontent/index'
import CardTable from '@/common/cardtable'
export default {
inheritAttrs: false,
components: {
SelectContent,
SearchContent,
CardTable
},
props: {
...Table.props,
selectContentObj: Object,
searchContentObj: Object,
buttonInfo: {
type: Object,
default() {
return {
isButton: false,
btnClick() {}
}
}
},
isSelectContent: {
type: Boolean,
default() {
return true
}
},
isSearch: {
type: Boolean,
default() {
return true
}
},
showListAndCard: {
type: Boolean,
default() {
return false
}
},
UNTASK: {
type: Boolean,
default: true
},
simpleModel: {
type: Boolean,
default: false
},
timeInputDefault:{
type: Array,
default: function () {
return []
}
}
},
data() {
return {
slotNode: null,
scopedSlots: this.$scopedSlots,
viewFlag: false
}
},
methods: {
handleToolSearch(value, complexSearch) {
this.searchContentObj.handleToolSearch(value, complexSearch)
},
getSelectData(value) {
this.selectContentObj.getSelectData(value)
},
resetFilterSearchContent() {
this.$refs.searchContentRef.resetSearch()
},
/**
* 改变展示视图 卡片/列表
*/
handleChange(value) {}
},
beforeCreate() {},
created() {},
mounted() {}
}
</script>
<style lang="scss" scoped>
.common-project-container {
padding: 0 16px;
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
// align-items: flex-end;
overflow-y: auto;
.tools-line-left {
flex: 1;
}
.tools-line {
// width: 100%;
display: flex;
justify-content: flex-end;
align-items: center;
margin-bottom: 8px;
button {
margin-right: 16px;
}
}
::v-deep .ant-table-wrapper {
width: 100%;
height: 100%;
/* .ant-table-fixed-left {
.ant-table-header.ant-table-hide-scrollbar {
// width: 582px !important;
}
} */
}
.type-container {
span {
margin-right: 5px;
}
}
.tags-container {
line-height: 24px;
span {
margin-right: 4px;
padding: 4px;
white-space: nowrap;
}
}
.action-container {
i {
margin: 0 4px;
}
}
}
</style>