123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- <template>
- <div id="app">
- <div class="content">
- <div class="data-container" style="width:98%;margin:0 auto;">
- <h3>各牧场设备统计表:</h3>
- <el-table ref="interfaceTable" :data="dataList" border :row-style="rowStyle" :cell-style="cellStyle" style="width: 100%" :span-method="colspanMethod" :show-header="showHeader">
- <el-table-column label="一级分类" prop="pasture" align="center" width="160" />
- <el-table-column label="二级分类" prop="pasture1" align="center" />
- <el-table-column label="三级分类" prop="pasture2" align="center" width="160" />
- <el-table-column label="类型" prop="type" align="center" />
- <el-table-column label="宝鸡1" prop="pastureName1" align="center" />
- <el-table-column label="宝鸡2" prop="pastureName2" align="center" width="160" />
-
- {{ item.msg }}
- </el-table>
- </div>
- </div>
- </div>
- </template>
- <script>
- import datas from '../../data.js'
- import { handleTableSpan, handleObjectSpanMethod } from '../../util.js'
- export default {
- components: {},
- mixins: [],
- data() {
- return {
- border: false,
- showHeader: false,
- dataList: [],
-
- rowspanObj: {},
-
- mergekeys: ['pasture', 'pasture1', 'pasture2', 'logisticsNo', 'arr', 'materialsCode'],
- rowStyle: { maxHeight: 30 + 'px', height: 30 + 'px' },
- cellStyle: { padding: 0 + 'px' }
- }
- },
- computed: {},
- watch: {
- dataList: function() {
- this.$nextTick(function() {
- this.$refs.interfaceTable.$el.background = 'red !important'
- console.log(this.$refs.interfaceTable.$el)
- console.log(this.$refs.interfaceTable)
- })
- }
- },
- created() {},
- mounted() {
- this.getDataList()
- },
- methods: {
- getDataList() {
- this.dataList = datas
- console.log()
-
- this.rowspanObj = handleTableSpan(this.mergekeys, this.dataList)
- console.log(this.rowspanObj)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- },
- colspanMethod(tableObj) {
- return handleObjectSpanMethod(tableObj, this.mergekeys, this.rowspanObj, true)
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- </style>
|