Merge pull request #1 from PanJiaChen/master

3.6.4
This commit is contained in:
Hank 2018-03-27 11:38:44 +08:00 committed by GitHub
commit 891e3a1d65
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 891 additions and 855 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "vue-element-admin", "name": "vue-element-admin",
"version": "3.6.3", "version": "3.6.4",
"description": "A magical vue admin. Typical templates for enterprise applications. Newest development stack of vue. Lots of awesome features", "description": "A magical vue admin. Typical templates for enterprise applications. Newest development stack of vue. Lots of awesome features",
"author": "Pan <panfree23@gmail.com>", "author": "Pan <panfree23@gmail.com>",
"license": "MIT", "license": "MIT",

View File

@ -395,6 +395,7 @@ export default {
off() { off() {
setTimeout(() => { setTimeout(() => {
this.$emit('input', false) this.$emit('input', false)
this.$emit('close')
if (this.step == 3 && this.loading == 2) { if (this.step == 3 && this.loading == 2) {
this.setStep(1) this.setStep(1)
} }

View File

@ -19,7 +19,7 @@ export default {
}, },
zIndex: { zIndex: {
type: Number, type: Number,
default: 100 default: 1
}, },
width: { width: {
type: String, type: String,

View File

@ -153,7 +153,10 @@ export default {
<style scoped> <style scoped>
.tinymce-container { .tinymce-container {
position: relative position: relative;
}
.tinymce-container>>>.mce-fullscreen {
z-index: 10000;
} }
.tinymce-textarea { .tinymce-textarea {
visibility: hidden; visibility: hidden;

View File

@ -28,7 +28,7 @@
import { getToken } from '@/api/qiniu' import { getToken } from '@/api/qiniu'
export default { export default {
name: 'singleImageUpload', name: 'singleImageUpload3',
props: { props: {
value: String value: String
}, },

View File

@ -131,16 +131,14 @@ export function objectMerge(target, source) {
if (Array.isArray(source)) { if (Array.isArray(source)) {
return source.slice() return source.slice()
} }
for (const property in source) { Object.keys(source).forEach((property) => {
if (source.hasOwnProperty(property)) {
const sourceProperty = source[property] const sourceProperty = source[property]
if (typeof sourceProperty === 'object') { if (typeof sourceProperty === 'object') {
target[property] = objectMerge(target[property], sourceProperty) target[property] = objectMerge(target[property], sourceProperty)
continue } else {
}
target[property] = sourceProperty target[property] = sourceProperty
} }
} })
return target return target
} }
@ -253,15 +251,13 @@ export function deepClone(source) {
throw new Error('error arguments', 'shallowClone') throw new Error('error arguments', 'shallowClone')
} }
const targetObj = source.constructor === Array ? [] : {} const targetObj = source.constructor === Array ? [] : {}
for (const keys in source) { Object.keys(source).forEach((keys) => {
if (source.hasOwnProperty(keys)) {
if (source[keys] && typeof source[keys] === 'object') { if (source[keys] && typeof source[keys] === 'object') {
targetObj[keys] = source[keys].constructor === Array ? [] : {} targetObj[keys] = source[keys].constructor === Array ? [] : {}
targetObj[keys] = deepClone(source[keys]) targetObj[keys] = deepClone(source[keys])
} else { } else {
targetObj[keys] = source[keys] targetObj[keys] = source[keys]
} }
} })
}
return targetObj return targetObj
} }

View File

@ -116,16 +116,14 @@ export function export_table_to_excel(id) {
saveAs(new Blob([s2ab(wbout)], {type: "application/octet-stream"}), "test.xlsx") saveAs(new Blob([s2ab(wbout)], {type: "application/octet-stream"}), "test.xlsx")
} }
export function export_json_to_excel(th, jsonData, defaultTitle) { export function export_json_to_excel({header, data, filename='excel-list', autoWidth=true}={}) {
/* original data */ /* original data */
data=[...data]
var data = jsonData; data.unshift(header);
data.unshift(th);
var ws_name = "SheetJS"; var ws_name = "SheetJS";
var wb = new Workbook(), ws = sheet_from_array_of_arrays(data); var wb = new Workbook(), ws = sheet_from_array_of_arrays(data);
if(autoWidth){
/*设置worksheet每列的最大宽度*/ /*设置worksheet每列的最大宽度*/
const colWidth = data.map(row => row.map(val => { const colWidth = data.map(row => row.map(val => {
/*先判断是否为null/undefined*/ /*先判断是否为null/undefined*/
@ -149,12 +147,12 @@ export function export_json_to_excel(th, jsonData, defaultTitle) {
} }
} }
ws['!cols'] = result; ws['!cols'] = result;
}
/* add worksheet to workbook */ /* add worksheet to workbook */
wb.SheetNames.push(ws_name); wb.SheetNames.push(ws_name);
wb.Sheets[ws_name] = ws; wb.Sheets[ws_name] = ws;
var wbout = XLSX.write(wb, {bookType: 'xlsx', bookSST: false, type: 'binary'}); var wbout = XLSX.write(wb, {bookType: 'xlsx', bookSST: false, type: 'binary'});
var title = defaultTitle || 'excel-list' saveAs(new Blob([s2ab(wbout)], {type: "application/octet-stream"}), filename + ".xlsx");
saveAs(new Blob([s2ab(wbout)], {type: "application/octet-stream"}), title + ".xlsx")
} }

View File

@ -231,7 +231,7 @@
right: 0; right: 0;
bottom: 0; bottom: 0;
left: 0; left: 0;
height: 50px; height: 40px;
overflow: hidden; overflow: hidden;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2), 0 8px 0 -3px #f6f6f6, 0 9px 1px -3px rgba(0, 0, 0, 0.2), 0 16px 0 -6px #f6f6f6, 0 17px 2px -6px rgba(0, 0, 0, 0.2); box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2), 0 8px 0 -3px #f6f6f6, 0 9px 1px -3px rgba(0, 0, 0, 0.2), 0 16px 0 -6px #f6f6f6, 0 17px 2px -6px rgba(0, 0, 0, 0.2);
} }
@ -245,6 +245,8 @@
.filters { .filters {
margin: 0; margin: 0;
padding: 0; padding: 0;
position: relative;
z-index: 1;
list-style: none; list-style: none;
} }
.filters li { .filters li {

View File

@ -49,8 +49,7 @@ export default {
.dashboard-editor-container { .dashboard-editor-container {
background-color: #e3e3e3; background-color: #e3e3e3;
min-height: 100vh; min-height: 100vh;
margin-top: -50px; padding: 50px 60px 0px;
padding: 100px 60px 0px;
.pan-info-roles { .pan-info-roles {
font-size: 12px; font-size: 12px;
font-weight: 700; font-weight: 700;

View File

@ -1,8 +1,16 @@
<template> <template>
<!-- $t is vue-i18n global function to translate lang --> <!-- $t is vue-i18n global function to translate lang -->
<div class="app-container"> <div class="app-container">
<label class="radio-label" style="padding-left:0;">Filename: </label>
<el-input style='width:340px;' :placeholder="$t('excel.placeholder')" prefix-icon="el-icon-document" v-model="filename"></el-input> <el-input style='width:340px;' :placeholder="$t('excel.placeholder')" prefix-icon="el-icon-document" v-model="filename"></el-input>
<el-button style='margin-bottom:20px;' type="primary" icon="document" @click="handleDownload" :loading="downloadLoading">{{$t('excel.export')}} excel</el-button> <label class="radio-label">Cell Auto Width: </label>
<el-radio-group v-model="autoWidth">
<el-radio :label="true" border>True</el-radio>
<el-radio :label="false" border>False</el-radio>
</el-radio-group>
<el-button style='margin:0 0 20px 20px;' type="primary" icon="document" @click="handleDownload" :loading="downloadLoading">{{$t('excel.export')}} excel</el-button>
<el-table :data="list" v-loading.body="listLoading" element-loading-text="拼命加载中" border fit highlight-current-row> <el-table :data="list" v-loading.body="listLoading" element-loading-text="拼命加载中" border fit highlight-current-row>
<el-table-column align="center" label='Id' width="95"> <el-table-column align="center" label='Id' width="95">
<template slot-scope="scope"> <template slot-scope="scope">
@ -45,7 +53,8 @@ export default {
list: null, list: null,
listLoading: true, listLoading: true,
downloadLoading: false, downloadLoading: false,
filename: '' filename: '',
autoWidth: true
} }
}, },
created() { created() {
@ -66,7 +75,12 @@ export default {
const filterVal = ['id', 'title', 'author', 'pageviews', 'display_time'] const filterVal = ['id', 'title', 'author', 'pageviews', 'display_time']
const list = this.list const list = this.list
const data = this.formatJson(filterVal, list) const data = this.formatJson(filterVal, list)
excel.export_json_to_excel(tHeader, data, this.filename) excel.export_json_to_excel({
header: tHeader,
data,
filename: this.filename,
autoWidth: this.autoWidth
})
this.downloadLoading = false this.downloadLoading = false
}) })
}, },
@ -82,3 +96,13 @@ export default {
} }
} }
</script> </script>
<style>
.radio-label {
font-size: 14px;
color: #606266;
line-height: 40px;
padding: 0 12px 0 30px;
}
</style>

View File

@ -72,7 +72,11 @@ export default {
const filterVal = ['id', 'title', 'author', 'pageviews', 'display_time'] const filterVal = ['id', 'title', 'author', 'pageviews', 'display_time']
const list = this.multipleSelection const list = this.multipleSelection
const data = this.formatJson(filterVal, list) const data = this.formatJson(filterVal, list)
excel.export_json_to_excel(tHeader, data, this.filename) excel.export_json_to_excel({
header: tHeader,
data,
filename: this.filename
})
this.$refs.multipleTable.clearSelection() this.$refs.multipleTable.clearSelection()
this.downloadLoading = false this.downloadLoading = false
}) })

View File

@ -2,7 +2,7 @@
<div class="menu-wrapper"> <div class="menu-wrapper">
<template v-for="item in routes" v-if="!item.hidden&&item.children"> <template v-for="item in routes" v-if="!item.hidden&&item.children">
<router-link v-if="item.children.length===1 && !item.children[0].children&&!item.alwaysShow" :to="item.path+'/'+item.children[0].path" :key="item.children[0].name"> <router-link v-if="hasOneShowingChildren(item.children) && !item.children[0].children&&!item.alwaysShow" :to="item.path+'/'+item.children[0].path" :key="item.children[0].name">
<el-menu-item :index="item.path+'/'+item.children[0].path" :class="{'submenu-title-noDropdown':!isNest}"> <el-menu-item :index="item.path+'/'+item.children[0].path" :class="{'submenu-title-noDropdown':!isNest}">
<svg-icon v-if="item.children[0].meta&&item.children[0].meta.icon" :icon-class="item.children[0].meta.icon"></svg-icon> <svg-icon v-if="item.children[0].meta&&item.children[0].meta.icon" :icon-class="item.children[0].meta.icon"></svg-icon>
<span v-if="item.children[0].meta&&item.children[0].meta.title">{{generateTitle(item.children[0].meta.title)}}</span> <span v-if="item.children[0].meta&&item.children[0].meta.title">{{generateTitle(item.children[0].meta.title)}}</span>
@ -46,6 +46,15 @@ export default {
} }
}, },
methods: { methods: {
hasOneShowingChildren(children) {
const showingChildren = children.filter(item => {
return !item.hidden
})
if (showingChildren.length === 1) {
return true
}
return false
},
generateTitle generateTitle
} }
} }