123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- <template>
- <div>
- <el-table :data="commonData" header-row-class-name="custom-table-header" @expand-change="expandChange" @sort-change="sortChange">
- <el-table-column type="expand">
- <template slot-scope="props">
- <div style="padding: 10px;height: 340px;">
- <Table :column="column" :tableData="props.row.data" @option="handleOption" :row="{row:props.row,groupBy:groupBy,searchOption:searchOption,}" v-bind="$attrs" v-on="$listeners"/>
- </div>
- </template>
- </el-table-column>
- <el-table-column v-for="column in groupingOption.filter(item=> {return item.value == groupBy})" :key="column.value" :label="column.name" :prop="column.value" sortable="custom"
- show-overflow-tooltip>
- <template slot-scope="scope">
- <div>
- {{ scope.row.name?scope.row.name:'--' }}
- </div>
- </template>
- </el-table-column>
- </el-table>
- </div>
- </template>
-
- <script>
- import Table from "./table";
- export default {
- props: {
- // 检索条件
- searchOption: {
- type: Object,
- default: () => {
- return {}
- }
- },
- // 分组的栏位
- groupingOption: {
- type: Array,
- default: () => {
- return []
- }
- },
- // 分组的值
- groupBy:String,
- commonData: Array,
- column: {//显示栏位管理数组
- type: Array,
- default: () => {
- return [
- {
- ifGroup: false,
- ifSearch: true,
- name: "事件名称",
- type: "String",
- value: "name",
- },
- {
- name: "创建人",
- type: "String",
- value: "createName",
- ifSearch: true,
- ifGroup: false
- },
- {
- name: "创建时间",
- type: "DateTime",
- value: "createTime",
- ifSearch: true,
- ifGroup: true
- },
- {
- name: "发生时间",
- type: "DateTime",
- value: "eventDate",
- ifSearch: true,
- ifGroup: true
- },
- {
- name: "描述",
- type: "String",
- value: "description",
- ifSearch: true,
- ifGroup: false
- },
- {
- name: "应用场景",
- type: "Integer",
- value: "scenarioId",
- ifSearch: true,
- ifGroup: true
- }
- ]
- }
- }
- },
- mixins: [],
- components: {
- Table
- },
- data() {
- return {
- // columnList: [],
- tableData: [],
- showData: [],
- expandList: [],
- sort:[],
- }
- },
- watch: {
- },
- mounted() {
-
- },
- methods: {
- // 排序
- sortChange({ column, prop, order }) {
- let str='1'
- this.$emit('on-sort',{ column, prop, order ,str})
- },
- //操作列事件
- handleOption(data) {
- this.$emit('option', data)
- },
- //打开展开行获取数据并保存起来
- expandChange(row, expandedRows) {
- row.data = []
- }
- }
- }
- </script>
-
|