Commit ba289245 authored by 胡小根's avatar 胡小根

实现了三张表的demo

parent 85945f80
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
<div class="app-container calendar-list-container"> <div class="app-container calendar-list-container">
<!-- 过滤 --> <!-- 过滤 -->
<div class="filter-container"> <div class="filter-container">
<el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">{{$t('table.search')}}</el-button> <el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">搜索</el-button>
<el-button class="filter-item" type="primary" :loading="downloadLoading" v-waves icon="el-icon-download" @click="handleDownload">{{$t('table.export')}}</el-button> <el-button class="filter-item" type="primary" :loading="downloadLoading" v-waves icon="el-icon-download" @click="handleDownload">导出</el-button>
</div> </div>
<!-- end 过滤 --> <!-- end 过滤 -->
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
import _ from 'lodash' import _ from 'lodash'
import request from '@/utils/request' import request from '@/utils/request'
import waves from '@/directive/waves' // 水波纹指令 import waves from '@/directive/waves' // 水波纹指令
import { parseTime } from '@/utils'
export default { export default {
name: 'HmComplexTable', name: 'HmComplexTable',
...@@ -171,12 +172,22 @@ ...@@ -171,12 +172,22 @@
handleDownload() { handleDownload() {
this.downloadLoading = true this.downloadLoading = true
import('@/vendor/Export2Excel').then(excel => { import('@/vendor/Export2Excel').then(excel => {
// @TODO 修改下载excel的功能,请求所有的数据
const tHeader = ['timestamp', 'title', 'type', 'importance', 'status'] const tHeader = ['timestamp', 'title', 'type', 'importance', 'status']
const filterVal = ['timestamp', 'title', 'type', 'importance', 'status'] const filterVal = ['timestamp', 'title', 'type', 'importance', 'status']
const data = this.formatJson(filterVal, this.list) const data = this.formatJson(filterVal, this.list)
excel.export_json_to_excel(tHeader, data, 'table-list') excel.export_json_to_excel(tHeader, data, 'table-list')
this.downloadLoading = false this.downloadLoading = false
}) })
},
formatJson(filterVal, jsonData) {
return jsonData.map(v => filterVal.map(j => {
if (j === 'timestamp') {
return parseTime(v[j])
} else {
return v[j]
}
}))
} }
} }
} }
......
<template> <template>
<div class="app-container calendar-list-container"> <div class="app-container calendar-list-container">
<hm-complex-table :schema="schema"> <hm-complex-table :schema="schema['HmUser']"></hm-complex-table>
</hm-complex-table> <hm-complex-table :schema="schema['Department']"></hm-complex-table>
<hm-complex-table :schema="schema['Role']"></hm-complex-table>
</div> </div>
</template> </template>
...@@ -23,7 +24,7 @@ ...@@ -23,7 +24,7 @@
filters: { filters: {
}, },
created() { created() {
this.schema = schema['HmUser'] this.schema = schema
}, },
methods: {} methods: {}
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment