🎨 优化代码

master
linhaojun 3 years ago
parent 1e20707b1a
commit aec658c442

@ -20,7 +20,17 @@ export default new Vuex.Store({
online: 1,
role: 1,
quartz: 1,
friendLinks: 1
friendLink: 1,
operationLog: 1,
exceptionLog: 1,
quartzLog: {
jobId: -1,
current: 1
},
photo: {
albumId: -1,
current: 1
}
}
},
mutations: {
@ -87,11 +97,23 @@ export default new Vuex.Store({
state.pageState.quartz = current
},
updateFriendLinkPageState(state, current) {
state.pageState.current = current
state.pageState.friendLink = current
},
updateOperationLogPageState(state, current) {
state.pageState.operationLog = current
},
updateExceptionLogPageState(state, current) {
state.pageState.exceptionLog = current
},
updateQuartzLogPageState(state, quartzLog) {
state.pageState.quartzLog.jobId = quartzLog.jobId
state.pageState.quartzLog.current = quartzLog.current
},
updatePhotoPageState(state, photo) {
state.pageState.photo.albumId = photo.albumId
state.pageState.photo.current = photo.current
}
},
actions: {},
modules: {},
plugins: [
createPersistedState({
storage: window.sessionStorage

@ -68,7 +68,6 @@
<el-pagination
:hide-on-single-page="true"
class="pagination-container"
@size-change="sizeChange"
@current-change="currentChange"
:current-page="current"
:page-size="size"
@ -167,6 +166,16 @@
import * as imageConversion from 'image-conversion'
export default {
created() {
this.albumId = this.$route.params.albumId
if (this.albumId == this.$store.state.pageState.photo.albumId) {
this.current = this.$store.state.pageState.photo.current
} else {
this.current = 1
this.$store.commit('updatePhotoPageState', {
albumId: this.$route.params.albumId,
current: this.current
})
}
this.getAlbumInfo()
this.listAlbums()
this.listPhotos()
@ -213,7 +222,6 @@ export default {
listAlbums() {
this.axios.get('/api/admin/photos/albums/info').then(({ data }) => {
this.albumList = data.data
console.log(this.albumList)
})
},
listPhotos() {
@ -232,12 +240,12 @@ export default {
this.loading = false
})
},
sizeChange(size) {
this.size = size
this.listPhotos()
},
currentChange(current) {
this.current = current
this.$store.commit('updatePhotoPageState', {
albumId: this.$route.params.albumId,
current: this.current
})
this.listPhotos()
},
savePhotos() {

@ -94,6 +94,7 @@
<script>
export default {
created() {
this.current = this.$store.state.pageState.friendLink
this.listLinks()
},
data: function () {
@ -133,6 +134,7 @@ export default {
},
currentChange(current) {
this.current = current
this.$store.commit('updateFriendLinkPageState', current)
this.listLinks()
},
deleteLink(id) {

@ -101,6 +101,7 @@
<script>
export default {
created() {
this.current = this.$store.state.pageState.exceptionLog
this.listLogs()
},
data() {
@ -131,10 +132,12 @@ export default {
},
currentChange(current) {
this.current = current
this.$store.commit('updateExceptionLogPageState', current)
this.listLogs()
},
searchLogs() {
this.current = 1
this.$store.commit('updateExceptionLogPageState', this.current)
this.listLogs()
},
listLogs() {

@ -107,6 +107,7 @@
<script>
export default {
created() {
this.current = this.$store.state.pageState.operationLog
this.listLogs()
},
data() {
@ -132,6 +133,7 @@ export default {
},
searchLogs() {
this.current = 1
this.$store.commit('updateOperationLogPageState', this.current)
this.listLogs()
},
sizeChange(size) {
@ -140,6 +142,7 @@ export default {
},
currentChange(current) {
this.current = current
this.$store.commit('updateOperationLogPageState', current)
this.listLogs()
},
listLogs() {

@ -44,8 +44,8 @@
</el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="small" @click="listJobLogs"></el-button>
<el-button icon="el-icon-refresh" size="small" @click="">重置</el-button>
<el-button type="primary" icon="el-icon-search" size="small" @click="searchLogs"></el-button>
<el-button icon="el-icon-refresh" size="small" @click="clearSearch"></el-button>
</el-form-item>
</el-row>
</el-form>
@ -56,7 +56,7 @@
</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="danger" icon="el-icon-delete" size="small" @click="clean"> </el-button>
<el-button type="danger" icon="el-icon-delete" size="small" @click="clean"></el-button>
</el-col>
</el-row>
@ -95,7 +95,7 @@
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-view" @click="changeOpen(scope.row)"> </el-button>
<el-button size="mini" type="text" icon="el-icon-view" @click="changeOpen(scope.row)"></el-button>
</template>
</el-table-column>
</el-table>
@ -147,7 +147,7 @@
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="open = false"> </el-button>
<el-button @click="open = false"></el-button>
</div>
</el-dialog>
</el-card>
@ -161,6 +161,15 @@ export default {
} else if (this.$route.params.quartzId !== null) {
this.jobId = this.$route.params.quartzId
}
if (this.jobId == this.$store.state.pageState.quartzLog.jobId) {
this.current = this.$store.state.pageState.quartzLog.current
} else {
this.current = 1
this.$store.commit('updateQuartzLogPageState', {
jobId: this.jobId,
current: this.current
})
}
this.listJobLogs()
this.listJobGroups()
},
@ -212,12 +221,29 @@ export default {
this.loading = false
})
},
searchLogs() {
this.current = 1
this.$store.commit('updateQuartzLogPageState', {
jobId: this.jobId,
current: this.current
})
this.listJobLogs()
},
clearSearch() {
this.searchParams = {}
this.dateRange = []
this.listJobLogs()
},
sizeChange(size) {
this.size = size
this.listJobLogs()
},
currentChange(current) {
this.current = current
this.$store.commit('updateQuartzLogPageState', {
jobId: this.jobId,
current: this.current
})
this.listJobLogs()
},
deleteJobLogs() {

@ -265,6 +265,7 @@ import router from '@/router'
export default {
components: { Crontab },
created() {
this.current = this.$store.state.pageState.quartz
this.listJobGroups()
this.listJobs()
},
@ -301,6 +302,7 @@ export default {
},
currentChange(current) {
this.current = current
this.$store.commit('updateQuartzPageState', current)
this.listJobs()
},
listJobGroups() {

@ -113,6 +113,7 @@
<script>
export default {
created() {
this.current = this.$store.state.pageState.role
this.listRoles()
},
data: function () {
@ -148,6 +149,7 @@ export default {
},
currentChange(current) {
this.current = current
this.$store.commit('updateRolePageState', current)
this.listRoles()
},
selectionChange(roles) {

@ -59,6 +59,7 @@ import router from '@/router'
export default {
created() {
this.current = this.$store.state.pageState.online
this.listOnlineUsers()
},
data() {
@ -95,6 +96,7 @@ export default {
},
currentChange(current) {
this.current = current
this.$store.commit('updateOnlinePageState', current)
this.listOnlineUsers()
},
removeOnlineUser(user) {

Loading…
Cancel
Save