diff --git a/src/views/table/dynamicTable/fixedThead.vue b/src/views/table/dynamicTable/fixedThead.vue deleted file mode 100644 index ca1bac675514b925e404689df0336488dda750e2..0000000000000000000000000000000000000000 --- a/src/views/table/dynamicTable/fixedThead.vue +++ /dev/null @@ -1,58 +0,0 @@ -<template> - <div class="app-container"> - - <div class="filter-container"> - <el-checkbox-group v-model="checkboxVal"> - <el-checkbox label="apple">apple</el-checkbox> - <el-checkbox label="banana">banana</el-checkbox> - <el-checkbox label="orange">orange</el-checkbox> - </el-checkbox-group> - </div> - - <el-table :data="tableData" :key="key" border fit highlight-current-row style="width: 100%"> - <el-table-column prop="name" label="fruitName" width="180"/> - <el-table-column v-for="fruit in formThead" :key="fruit" :label="fruit"> - <template slot-scope="scope"> - {{ scope.row[fruit] }} - </template> - </el-table-column> - </el-table> - - </div> -</template> - -<script> -const defaultFormThead = ['apple', 'banana'] - -export default { - data: function() { - return { - tableData: [ - { - name: 'fruit-1', - apple: 'apple-10', - banana: 'banana-10', - orange: 'orange-10' - }, - { - name: 'fruit-2', - apple: 'apple-20', - banana: 'banana-20', - orange: 'orange-20' - } - ], - key: 1, // table key - formTheadOptions: ['apple', 'banana', 'orange'], - checkboxVal: defaultFormThead, // checkboxVal - formThead: defaultFormThead // 默认表头 Default header - } - }, - watch: { - checkboxVal(valArr) { - this.formThead = this.formTheadOptions.filter(i => valArr.indexOf(i) >= 0) - this.key = this.key + 1// 为了ä¿è¯table æ¯æ¬¡éƒ½ä¼šé‡æ¸² In order to ensure the table will be re-rendered each time - } - } -} -</script> - diff --git a/src/views/table/dynamicTable/index.vue b/src/views/table/dynamicTable/index.vue deleted file mode 100644 index 3c16bc4669d3c2989525544b3463a5b94aea7f8e..0000000000000000000000000000000000000000 --- a/src/views/table/dynamicTable/index.vue +++ /dev/null @@ -1,20 +0,0 @@ -<template> - <div class="app-container"> - <div style="margin:0 0 5px 20px">{{ $t('table.dynamicTips1') }}</div> - <fixed-thead/> - - <div style="margin:30px 0 5px 20px">{{ $t('table.dynamicTips2') }}</div> - <unfixed-thead/> - </div> -</template> - -<script> -import fixedThead from './fixedThead' -import unfixedThead from './unfixedThead' - -export default { - name: 'DynamicTable', - components: { fixedThead, unfixedThead } -} -</script> - diff --git a/src/views/table/dynamicTable/unfixedThead.vue b/src/views/table/dynamicTable/unfixedThead.vue deleted file mode 100644 index f49369d9b50dc68d373fb1e2a1907231dda1daf0..0000000000000000000000000000000000000000 --- a/src/views/table/dynamicTable/unfixedThead.vue +++ /dev/null @@ -1,46 +0,0 @@ -<template> - <div class="app-container"> - - <div class="filter-container"> - <el-checkbox-group v-model="formThead"> - <el-checkbox label="apple">apple</el-checkbox> - <el-checkbox label="banana">banana</el-checkbox> - <el-checkbox label="orange">orange</el-checkbox> - </el-checkbox-group> - </div> - - <el-table :data="tableData" border fit highlight-current-row style="width: 100%"> - <el-table-column prop="name" label="fruitName" width="180"/> - <el-table-column v-for="fruit in formThead" :key="fruit" :label="fruit"> - <template slot-scope="scope"> - {{ scope.row[fruit] }} - </template> - </el-table-column> - </el-table> - - </div> -</template> - -<script> -export default { - data: function() { - return { - tableData: [ - { - name: 'fruit-1', - apple: 'apple-10', - banana: 'banana-10', - orange: 'orange-10' - }, - { - name: 'fruit-2', - apple: 'apple-20', - banana: 'banana-20', - orange: 'orange-20' - } - ], - formThead: ['apple', 'banana'] - } - } -} -</script> diff --git a/src/views/table/treeTable/customEval.js b/src/views/table/treeTable/customEval.js deleted file mode 100644 index 73badb681091a3348cd85223248bad60692ace4c..0000000000000000000000000000000000000000 --- a/src/views/table/treeTable/customEval.js +++ /dev/null @@ -1,48 +0,0 @@ -/** -* @Author: jianglei -* @Date: 2017-10-12 12:06:49 -*/ -'use strict' -import Vue from 'vue' -export default function treeToArray(data, expandAll, parent, level, item) { - const marLTemp = [] - let tmp = [] - Array.from(data).forEach(function(record) { - if (record._expanded === undefined) { - Vue.set(record, '_expanded', expandAll) - } - let _level = 1 - if (level !== undefined && level !== null) { - _level = level + 1 - } - Vue.set(record, '_level', _level) - // å¦‚æžœæœ‰çˆ¶å…ƒç´ - if (parent) { - Vue.set(record, 'parent', parent) - // å¦‚æžœçˆ¶å…ƒç´ æœ‰å移é‡ï¼Œéœ€è¦è®¡ç®—在thisçš„å移é‡ä¸ - // å移é‡è¿˜ä¸Žå‰é¢åŒçº§å…ƒç´ 有关,需è¦åŠ 上å‰é¢æ‰€æœ‰å…ƒç´ 的长度和 - if (!marLTemp[_level]) { - marLTemp[_level] = 0 - } - Vue.set(record, '_marginLeft', marLTemp[_level] + parent._marginLeft) - Vue.set(record, '_width', record[item] / parent[item] * parent._width) - // 在本次计算过å移é‡åŽåŠ ä¸Šè‡ªå·±é•¿åº¦ï¼Œä»¥ä¾›ä¸‹ä¸€ä¸ªå…ƒç´ ä½¿ç”¨ - marLTemp[_level] += record._width - } else { - // å¦‚æžœä¸ºæ ¹ - // åˆå§‹åŒ–å移é‡å˜å‚¨map - marLTemp[record.id] = [] - // mapä¸æ˜¯ä¸€ä¸ªæ•°ç»„,å˜å‚¨çš„是æ¯çº§çš„长度和 - // åˆå§‹æƒ…况下为0 - marLTemp[record.id][_level] = 0 - Vue.set(record, '_marginLeft', 0) - Vue.set(record, '_width', 1) - } - tmp.push(record) - if (record.children && record.children.length > 0) { - const children = treeToArray(record.children, expandAll, record, _level, item) - tmp = tmp.concat(children) - } - }) - return tmp -} diff --git a/src/views/table/treeTable/customTreeTable.vue b/src/views/table/treeTable/customTreeTable.vue deleted file mode 100644 index ae447b2d3f5cde756c55f039d24c9605c6f27f57..0000000000000000000000000000000000000000 --- a/src/views/table/treeTable/customTreeTable.vue +++ /dev/null @@ -1,138 +0,0 @@ -<template> - <div class="app-container"> - - <el-tag style="margin-bottom:20px;"> - <a href="https://github.com/PanJiaChen/vue-element-admin/tree/master/src/components/TreeTable" target="_blank">Documentation</a> - </el-tag> - - <tree-table :data="data" :eval-func="func" :eval-args="args" :expand-all="expandAll" border> - <el-table-column label="事件"> - <template slot-scope="scope"> - <span style="color:sandybrown">{{ scope.row.event }}</span> - <el-tag>{{ scope.row.timeLine+'ms' }}</el-tag> - </template> - </el-table-column> - <el-table-column label="时间线"> - <template slot-scope="scope"> - <el-tooltip :content="scope.row.timeLine+'ms'" effect="dark" placement="left"> - <div class="processContainer"> - <div - :style="{ width:scope.row._width * 500+'px', - background:scope.row._width>0.5?'rgba(233,0,0,.5)':'rgba(0,0,233,0.5)', - marginLeft:scope.row._marginLeft * 500+'px' }" - class="process"> - <span style="display:inline-block"/> - </div> - </div> - </el-tooltip> - </template> - </el-table-column> - <el-table-column label="æ“作" width="200"> - <template slot-scope="scope"> - <el-button type="text" @click="message(scope.row)">点击</el-button> - </template> - </el-table-column> - </tree-table> - </div> -</template> - -<script> -/** - Auth: Lei.j1ang - Created: 2018/1/19-14:54 -*/ -import treeTable from '@/components/TreeTable' -import treeToArray from './customEval' - -export default { - name: 'CustomTreeTableDemo', - components: { treeTable }, - data: function() { - return { - func: treeToArray, - expandAll: false, - data: - { - id: 1, - event: '事件1', - timeLine: 100, - comment: 'æ— ', - children: [ - { - id: 2, - event: '事件2', - timeLine: 10, - comment: 'æ— ' - }, - { - id: 3, - event: '事件3', - timeLine: 90, - comment: 'æ— ', - children: [ - { - id: 4, - event: '事件4', - timeLine: 5, - comment: 'æ— ' - }, - { - id: 5, - event: '事件5', - timeLine: 10, - comment: 'æ— ' - }, - { - id: 6, - event: '事件6', - timeLine: 75, - comment: 'æ— ', - children: [ - { - id: 7, - event: '事件7', - timeLine: 50, - comment: 'æ— ', - children: [ - { - id: 71, - event: '事件71', - timeLine: 25, - comment: 'xx' - }, - { - id: 72, - event: '事件72', - timeLine: 5, - comment: 'xx' - }, - { - id: 73, - event: '事件73', - timeLine: 20, - comment: 'xx' - } - ] - }, - { - id: 8, - event: '事件8', - timeLine: 25, - comment: 'æ— ' - } - ] - } - ] - } - ] - }, - args: [null, null, 'timeLine'] - } - }, - methods: { - message(row) { - this.$message.info(row.event) - } - } -} -</script> diff --git a/src/views/table/treeTable/treeTable.vue b/src/views/table/treeTable/treeTable.vue deleted file mode 100644 index e9e2e32b8d5635260f808731e23afbe9a1d12184..0000000000000000000000000000000000000000 --- a/src/views/table/treeTable/treeTable.vue +++ /dev/null @@ -1,129 +0,0 @@ -<template> - <div class="app-container"> - - <el-tag style="margin-bottom:20px;"> - <a href="https://github.com/PanJiaChen/vue-element-admin/tree/master/src/components/TreeTable" target="_blank">Documentation</a> - </el-tag> - - <tree-table :data="data" :columns="columns" border/> - - </div> -</template> - -<script> -/** - Auth: Lei.j1ang - Created: 2018/1/19-14:54 -*/ -import treeTable from '@/components/TreeTable' - -export default { - name: 'TreeTableDemo', - components: { treeTable }, - data: function() { - return { - columns: [ - { - text: '事件', - value: 'event', - width: 200 - }, - { - text: 'ID', - value: 'id' - }, - { - text: '时间线', - value: 'timeLine' - }, - { - text: '备注', - value: 'comment' - } - ], - data: [ - { - id: 0, - event: '事件1', - timeLine: 50, - comment: 'æ— ' - }, - { - id: 1, - event: '事件1', - timeLine: 100, - comment: 'æ— ', - children: [ - { - id: 2, - event: '事件2', - timeLine: 10, - comment: 'æ— ' - }, - { - id: 3, - event: '事件3', - timeLine: 90, - comment: 'æ— ', - children: [ - { - id: 4, - event: '事件4', - timeLine: 5, - comment: 'æ— ' - }, - { - id: 5, - event: '事件5', - timeLine: 10, - comment: 'æ— ' - }, - { - id: 6, - event: '事件6', - timeLine: 75, - comment: 'æ— ', - children: [ - { - id: 7, - event: '事件7', - timeLine: 50, - comment: 'æ— ', - children: [ - { - id: 71, - event: '事件71', - timeLine: 25, - comment: 'xx' - }, - { - id: 72, - event: '事件72', - timeLine: 5, - comment: 'xx' - }, - { - id: 73, - event: '事件73', - timeLine: 20, - comment: 'xx' - } - ] - }, - { - id: 8, - event: '事件8', - timeLine: 25, - comment: 'æ— ' - } - ] - } - ] - } - ] - } - ] - } - } -} -</script>