This commit is contained in:
Jerry
2020-04-20 20:51:17 +08:00
parent 9472a84ba1
commit 7d87893112
7 changed files with 44 additions and 16 deletions

View File

@@ -5,12 +5,7 @@
</template> </template>
<script> <script>
import { mapMutations } from 'vuex';
export default { export default {
methods: {
...mapMutations(['setUserRules'])
},
watch: { watch: {
$route: { $route: {
handler (newValue) { handler (newValue) {

View File

@@ -1,14 +1,17 @@
<template> <template>
<div class="date-range"> <div class="date-range">
<!--<year-range-panel />--> <!--<year-range-panel />-->
<el-select v-model="dateType" :size="size" style="max-width: 100px; min-width: 100px; margin-right: 10px;" v-if="!hideTypeOnlyOne || validTypeList.length > 1"> <el-select v-model="dateType" :size="size"
style="max-width: 100px; min-width: 100px; margin-right: 10px;"
v-if="!hideTypeOnlyOne || validTypeList.length > 1">
<el-option v-for="type in validTypeList" :key="type.value" :value="type.value" :label="type.label" /> <el-option v-for="type in validTypeList" :key="type.value" :value="type.value" :label="type.label" />
</el-select> </el-select>
<el-date-picker style="flex-grow: 1;" v-model="currentDates" :size="size" :placeholder="placeholder" :type="innerDateType" <el-date-picker style="flex-grow: 1;" v-model="currentDates"
:size="size" :placeholder="placeholder" :type="innerDateType"
:disabled="disabled" :format="innerDateFormat" :readonly="readonly" :editable="editable" :disabled="disabled" :format="innerDateFormat" :readonly="readonly" :editable="editable"
:clearable="clearable" :start-placeholder="startPlaceholder" :end-placeholder="endPlaceholder" :clearable="clearable" :start-placeholder="startPlaceholder" :end-placeholder="endPlaceholder"
:align="align" :range-separator="rangeSeparator" :value-format="valueFormat" :align="align" :range-separator="rangeSeparator" :value-format="valueFormat"
:prefix-icon="prefixIcon" :clear-icon="clearIcon" @change="onValueChange"></el-date-picker> :prefix-icon="prefixIcon" :clear-icon="clearIcon" @change="onValueChange" />
</div> </div>
</template> </template>

View File

@@ -81,7 +81,7 @@ export default {
this.rowJustify = 'space-between'; this.rowJustify = 'space-between';
let tempCount = residueCount === 0 ? 0 : (lineCount - residueCount); let tempCount = residueCount === 0 ? 0 : (lineCount - residueCount);
if (hasOperator) { if (hasOperator) {
let residueWidth = width - ((lineCount - residueCount) * this.itemWidth) - 20; let residueWidth = width - ((lineCount - residueCount) * this.itemWidth) - ((tempCount >= 1) ? 20 : 0);
// 判断剩余的空间是否够放下操作按钮 // 判断剩余的空间是否够放下操作按钮
if (residueWidth >= this.minMenuWidth && residueCount === 0) { if (residueWidth >= this.minMenuWidth && residueCount === 0) {
this.rowJustify = 'start'; this.rowJustify = 'start';

View File

@@ -137,7 +137,18 @@ const statsDateRangeMixin = {
if (date == null) return []; if (date == null) return [];
statsType = allowStatsType.indexOf(statsType) === -1 ? 'day' : statsType; statsType = allowStatsType.indexOf(statsType) === -1 ? 'day' : statsType;
let tempDate = new Date(date); date = date.substr(0, date.indexOf(' '));
let tempList = date.split('-');
let year = Number.parseInt(tempList[0]);
let month = Number.parseInt(tempList[1]);
let day = Number.parseInt(tempList[2]);
if (isNaN(year) || isNaN(month) || isNaN(day)) {
return [];
}
let tempDate = new Date(year, month - 1, day);
// 判断是否正确的日期
if (isNaN(tempDate.getTime())) return [];
tempDate.setHours(0, 0, 0, 0); tempDate.setHours(0, 0, 0, 0);
let retDate; let retDate;
switch (statsType) { switch (statsType) {

View File

@@ -120,11 +120,17 @@ export default {
for (let i = 0; i < state.menuList.length; i++) { for (let i = 0; i < state.menuList.length; i++) {
menuItem = findMenuItem(state.menuList[i], menuId, 'menuId'); menuItem = findMenuItem(state.menuList[i], menuId, 'menuId');
if (menuItem != null) { if (menuItem != null) {
// 添加新的tag
let tagItem = findItemFromList(state.tagList, menuId, 'menuId'); let tagItem = findItemFromList(state.tagList, menuId, 'menuId');
if (tagItem == null) { if (tagItem == null) {
state.tagList = [...state.tagList, menuItem]; state.tagList = [...state.tagList, menuItem];
setObjectToSessionStorage('tagList', state.tagList); setObjectToSessionStorage('tagList', state.tagList);
} }
// 添加新缓存
if (Array.isArray(state.cachePages) && state.cachePages.indexOf(menuItem.formRouterName) === -1) {
state.cachePages = [...state.cachePages, menuItem.formRouterName];
setObjectToSessionStorage('cachePages', state.cachePages);
}
break; break;
} }
} }

View File

@@ -23,6 +23,12 @@ import { mapGetters, mapMutations } from 'vuex';
import projectConfig from '@/core/config'; import projectConfig from '@/core/config';
export default { export default {
props: {
multiTag: {
type: Boolean,
default: false
}
},
data () { data () {
return { return {
isCollapse: false, isCollapse: false,
@@ -60,9 +66,13 @@ export default {
}, },
selectMenu (index, path) { selectMenu (index, path) {
if (this.getCurrentMenuId === index) return; if (this.getCurrentMenuId === index) return;
// <20><>ҳ<EFBFBD><D2B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>tags<67><73>cachePage
if (!this.multiTag) {
this.clearAllTags();
}
this.setCurrentMenuId(index); this.setCurrentMenuId(index);
}, },
...mapMutations(['setCollapse', 'clearCachePage', 'setCurrentMenuId']) ...mapMutations(['setCollapse', 'clearAllTags', 'setCurrentMenuId'])
} }
}; };
</script> </script>

View File

@@ -1,7 +1,7 @@
<template> <template>
<el-container :style="getMainStyle"> <el-container :style="getMainStyle">
<el-aside width='200px' class="sidebar"> <el-aside width='200px' class="sidebar">
<side-bar style="overflow: hidden"></side-bar> <side-bar style="overflow: hidden" :multi-tag="false"></side-bar>
</el-aside> </el-aside>
<el-container style="background-color: rgb(235,235,235)"> <el-container style="background-color: rgb(235,235,235)">
<el-header class="header"> <el-header class="header">
@@ -76,11 +76,12 @@ export default {
} }
SystemController.logout(this, {}, options).catch(e => {}); SystemController.logout(this, {}, options).catch(e => {});
this.clearAllTags();
this.$router.replace({name: 'login'}); this.$router.replace({name: 'login'});
}).catch(e => {}); }).catch(e => {});
} }
}, },
...mapMutations(['setClientHeight']) ...mapMutations(['setClientHeight', 'clearAllTags'])
}, },
computed: { computed: {
getMainStyle () { getMainStyle () {
@@ -112,9 +113,11 @@ export default {
getMenuItem: { getMenuItem: {
handler (newValue) { handler (newValue) {
if (newValue == null) { if (newValue == null) {
this.$router.replace({ if (this.$route.name !== 'welcome') {
name: 'welcome' this.$router.replace({
}); name: 'welcome'
});
}
} else { } else {
this.$router.replace({ this.$router.replace({
name: newValue.formRouterName name: newValue.formRouterName