Compare commits

..

8 Commits

Author SHA1 Message Date
Pan
093475ee50 [release] 3.4.1 2017-12-22 11:10:46 +08:00
Pan
cb3578e5c3 perf[drag-table]:refine the effect && fixed row-key bug 2017-12-22 11:09:54 +08:00
tlx6550
fe25c4d96b fix[tags-view]: fixed bug in DEL_OTHERS_VIEWS (#368) 2017-12-22 10:29:47 +08:00
Pan
7fef8568c2 perf: use import replace require.ensure 2017-12-21 13:25:29 +08:00
Pan
0dfa56c73e perf: element-ui css 2017-12-18 18:47:06 +08:00
Pan
642d48e372 fix :fixed typo 2017-12-18 10:25:53 +08:00
Pan
021c147b31 perf:code 2017-12-18 10:19:35 +08:00
Pan
04d9b849dd rm eventsource-polyfill 2017-12-15 14:25:36 +08:00
10 changed files with 54 additions and 39 deletions

View File

@@ -49,7 +49,7 @@ module.exports = {
{
test: /\.js$/,
loader: 'babel-loader?cacheDirectory',
include: [resolve('src'), resolve('test')]
include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client')]
},
{
test: /\.svg$/,

View File

@@ -1,6 +1,6 @@
{
"name": "vue-element-admin",
"version": "3.4.0",
"version": "3.4.1",
"description": "A magical vue admin. Typical templates for enterprise applications. Newest development stack of vue. Lots of awesome features",
"author": "Pan <panfree23@gmail.com>",
"license": "MIT",
@@ -60,7 +60,6 @@
"eslint-friendly-formatter": "3.0.0",
"eslint-loader": "1.9.0",
"eslint-plugin-html": "4.0.1",
"eventsource-polyfill": "0.9.6",
"extract-text-webpack-plugin": "3.0.2",
"file-loader": "1.1.5",
"friendly-errors-webpack-plugin": "1.6.1",

View File

@@ -25,7 +25,7 @@ const tagsView = {
for (const i of state.cachedViews) {
if (i === view.name) {
const index = state.cachedViews.indexOf(i)
state.cachedViews.splice(index, 1)
state.cachedViews.splice(index, index + 1)
break
}
}

View File

@@ -1,5 +1,9 @@
//覆盖一些element-ui样式
.el-breadcrumb__inner, .el-breadcrumb__inner a{
font-weight: 400!important;
}
.el-upload {
input[type="file"] {
display: none !important;

View File

@@ -17,7 +17,7 @@
</el-select>
<el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">搜索</el-button>
<el-button class="filter-item" style="margin-left: 10px;" @click="handleCreate" type="primary" icon="el-icon-edit">添加</el-button>
<el-button class="filter-item" type="primary" v-waves icon="el-icon-download" @click="handleDownload">导出</el-button>
<el-button class="filter-item" type="primary" :loading="downloadLoading" v-waves icon="el-icon-download" @click="handleDownload">导出</el-button>
<el-checkbox class="filter-item" style='margin-left:15px;' @change='tableKey=tableKey+1' v-model="showAuditor">显示审核人</el-checkbox>
</div>
@@ -196,7 +196,8 @@ export default {
type: [{ required: true, message: 'type is required', trigger: 'change' }],
timestamp: [{ type: 'date', required: true, message: 'timestamp is required', trigger: 'change' }],
title: [{ required: true, message: 'title is required', trigger: 'blur' }]
}
},
downloadLoading: false
}
},
filters: {
@@ -330,12 +331,13 @@ export default {
})
},
handleDownload() {
require.ensure([], () => {
const { export_json_to_excel } = require('@/vendor/Export2Excel')
this.downloadLoading = true
import('@/vendor/Export2Excel').then(excel => {
const tHeader = ['时间', '地区', '类型', '标题', '重要性']
const filterVal = ['timestamp', 'province', 'type', 'title', 'importance']
const data = this.formatJson(filterVal, this.list)
export_json_to_excel(tHeader, data, 'table数据')
excel.export_json_to_excel(tHeader, data, 'table数据')
this.downloadLoading = false
})
},
formatJson(filterVal, jsonData) {

View File

@@ -1,7 +1,7 @@
<template>
<div class="app-container calendar-list-container">
<el-table :data="list" v-loading.body="listLoading" border fit highlight-current-row style="width: 100%">
<!-- Note that row-key is necessary to get a correct row order. -->
<el-table :data="list" row-key="id" v-loading.body="listLoading" border fit highlight-current-row style="width: 100%">
<el-table-column align="center" label="序号" width="65">
<template slot-scope="scope">
@@ -27,9 +27,9 @@
</template>
</el-table-column>
<el-table-column width="80px" label="重要性">
<el-table-column width="100px" label="重要性">
<template slot-scope="scope">
<svg-icon v-for="n in +scope.row.importance" icon-class="star" class="meta-item__icon" :key="n"></svg-icon>
<svg-icon v-for="n in +scope.row.importance" icon-class="star" class="icon-star" :key="n"></svg-icon>
</template>
</el-table-column>
@@ -45,7 +45,7 @@
</template>
</el-table-column>
<el-table-column align="center" label="拖拽" width="95">
<el-table-column align="center" label="拖拽" width="80">
<template slot-scope="scope">
<svg-icon class='drag-handler' icon-class="drag"></svg-icon>
</template>
@@ -53,7 +53,7 @@
</el-table>
<div class='show-d'>默认顺序 &nbsp; {{ olderList}}</div>
<div class='show-d'>默认顺序 &nbsp; {{ oldList}}</div>
<div class='show-d'>拖拽后顺序{{newList}}</div>
</div>
@@ -75,7 +75,7 @@ export default {
limit: 10
},
sortable: null,
olderList: [],
oldList: [],
newList: []
}
},
@@ -99,8 +99,8 @@ export default {
this.list = response.data.items
this.total = response.data.total
this.listLoading = false
this.olderList = this.list.map(v => v.id)
this.newList = this.olderList.slice()
this.oldList = this.list.map(v => v.id)
this.newList = this.oldList.slice()
this.$nextTick(() => {
this.setSort()
})
@@ -109,7 +109,12 @@ export default {
setSort() {
const el = document.querySelectorAll('.el-table__body-wrapper > table > tbody')[0]
this.sortable = Sortable.create(el, {
ghostClass: 'sortable-ghost', // Class name for the drop placeholder,
onEnd: evt => {
const targetRow = this.list.splice(evt.oldIndex, 1)[0]
this.list.splice(evt.newIndex, 0, targetRow)
// for show the changes, you can delete in you code
const tempIndex = this.newList.splice(evt.oldIndex, 1)[0]
this.newList.splice(evt.newIndex, 0, tempIndex)
}
@@ -119,10 +124,21 @@ export default {
}
</script>
<style>
.sortable-ghost{
opacity: .8;
color: #fff!important;
background: #42b983!important;
}
</style>
<style scoped>
.icon-star{
margin-right:2px;
}
.drag-handler{
width: 30px;
height: 30px;
width: 20px;
height: 20px;
cursor: pointer;
}
.show-d{

View File

@@ -60,13 +60,12 @@ export default {
},
handleDownload() {
this.downloadLoading = true
require.ensure([], () => {
const { export_json_to_excel } = require('@/vendor/Export2Excel')
import('@/vendor/Export2Excel').then(excel => {
const tHeader = ['序号', '文章标题', '作者', '阅读数', '发布时间']
const filterVal = ['id', 'title', 'author', 'pageviews', 'display_time']
const list = this.list
const data = this.formatJson(filterVal, list)
export_json_to_excel(tHeader, data, this.filename)
excel.export_json_to_excel(tHeader, data, this.filename)
this.downloadLoading = false
})
},

View File

@@ -66,16 +66,15 @@ export default {
handleDownload() {
if (this.multipleSelection.length) {
this.downloadLoading = true
require.ensure([], () => {
const { export_json_to_excel } = require('@/vendor/Export2Excel')
const tHeader = ['序号', '文章标题', '作者', '阅读数', '发布时间']
const filterVal = ['id', 'title', 'author', 'pageviews', 'display_time']
const list = this.multipleSelection
const data = this.formatJson(filterVal, list)
export_json_to_excel(tHeader, data, this.filename)
this.$refs.multipleTable.clearSelection()
this.downloadLoading = false
})
import('@/vendor/Export2Excel').then(excel => {
const tHeader = ['序号', '文章标题', '作者', '阅读数', '发布时间']
const filterVal = ['id', 'title', 'author', 'pageviews', 'display_time']
const list = this.multipleSelection
const data = this.formatJson(filterVal, list)
excel.export_json_to_excel(tHeader, data, this.filename)
this.$refs.multipleTable.clearSelection()
this.downloadLoading = false
})
} else {
this.$message({
message: '请至少选择一条记录',

View File

@@ -161,6 +161,3 @@ export default {
}
}
</style>

View File

@@ -59,13 +59,12 @@ export default {
},
handleDownload() {
this.downloadLoading = true
require.ensure([], () => {
const { export_txt_to_zip } = require('@/vendor/Export2Zip')
import('@/vendor/Export2Zip').then(zip => {
const tHeader = ['序号', '文章标题', '作者', '阅读数', '发布时间']
const filterVal = ['id', 'title', 'author', 'pageviews', 'display_time']
const list = this.list
const data = this.formatJson(filterVal, list)
export_txt_to_zip(tHeader, data, this.filename, this.filename)
zip.export_txt_to_zip(tHeader, data, this.filename, this.filename)
this.downloadLoading = false
})
},