Commit 7eeeabad authored by smallwei's avatar smallwei

搞定bug

parent 0b641730
...@@ -44,6 +44,7 @@ export const tableOption = { ...@@ -44,6 +44,7 @@ export const tableOption = {
editDisabled: true, editDisabled: true,
addVisdiplay: false, addVisdiplay: false,
}, { }, {
width: 150,
fixed: true, fixed: true,
label: '用户名', label: '用户名',
prop: 'username', prop: 'username',
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
<span slot="title">{{child[labelKey]}}</span> <span slot="title">{{child[labelKey]}}</span>
</el-menu-item> </el-menu-item>
<sidebar-item v-else <sidebar-item v-else
:menu="child[childrenKey]" :menu="[child]"
:key="cindex" :key="cindex"
:props="props" :props="props"
:screen="screen" :screen="screen"
......
...@@ -59,6 +59,7 @@ axios.interceptors.response.use(res => { ...@@ -59,6 +59,7 @@ axios.interceptors.response.use(res => {
}) })
return Promise.reject(new Error(message)) return Promise.reject(new Error(message))
} }
if (status !== 200) return Promise.reject(res);
return res; return res;
}, error => { }, error => {
NProgress.done() NProgress.done()
......
...@@ -19,6 +19,17 @@ export default [{ ...@@ -19,6 +19,17 @@ export default [{
component: () => component: () =>
import ( /* webpackChunkName: "views" */ '@/views/crud/index') import ( /* webpackChunkName: "views" */ '@/views/crud/index')
}] }]
}, {
path: '/info',
component: Layout,
redirect: '/info/index',
children: [{
path: 'index',
name: '个人信息',
component: () =>
import ( /* webpackChunkName: "page" */ '@/views/admin/user/info'),
}]
}, { }, {
path: '/activti', path: '/activti',
component: Layout, component: Layout,
......
...@@ -101,7 +101,7 @@ const user = { ...@@ -101,7 +101,7 @@ const user = {
commit('SET_ROLES', data.roles || []); commit('SET_ROLES', data.roles || []);
commit('SET_PERMISSIONS', data.permissions || []) commit('SET_PERMISSIONS', data.permissions || [])
resolve(data); resolve(data);
}).catch(() => { }).catch((err) => {
reject(); reject();
}) })
}) })
......
...@@ -204,7 +204,9 @@ export default { ...@@ -204,7 +204,9 @@ export default {
} else { } else {
this.form = data; this.form = data;
} }
this.$refs.form.clearValidate(); setTimeout(() => {
this.$refs.form.clearValidate();
}, 0);
}) })
}, },
handlerEdit (data) { handlerEdit (data) {
...@@ -218,6 +220,9 @@ export default { ...@@ -218,6 +220,9 @@ export default {
if (validatenull(this.obj)) { if (validatenull(this.obj)) {
this.form.parentId = 0; this.form.parentId = 0;
this.form.parentName = ''; this.form.parentName = '';
setTimeout(() => {
this.$refs.form.clearValidate();
}, 0);
} else { } else {
this.show(this.obj); this.show(this.obj);
} }
...@@ -247,17 +252,14 @@ export default { ...@@ -247,17 +252,14 @@ export default {
}) })
}, },
update () { update () {
this.$refs.form.validate((valid) => { putObj(this.form).then(() => {
if (!valid) return this.onCancel();
putObj(this.form).then(() => { this.getList()
this.onCancel(); this.$notify({
this.getList() title: '成功',
this.$notify({ message: '更新成功',
title: '成功', type: 'success',
message: '更新成功', duration: 2000
type: 'success',
duration: 2000
})
}) })
}) })
...@@ -277,10 +279,10 @@ export default { ...@@ -277,10 +279,10 @@ export default {
onCancel () { onCancel () {
this.formStatus = '' this.formStatus = ''
this.editFlag = false; this.editFlag = false;
this.$refs.form.resetForm();
setTimeout(() => { setTimeout(() => {
this.$refs.form.resetForm();
this.$refs.form.clearValidate(); this.$refs.form.clearValidate();
}, 0) }, 0);
} }
} }
} }
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
--> -->
<template> <template>
<div class="app-container pull-auto"> <div class="log">
<basic-container> <basic-container>
<avue-crud ref="crud" <avue-crud ref="crud"
:page="page" :page="page"
...@@ -42,80 +42,80 @@ ...@@ -42,80 +42,80 @@
</template> </template>
<script> <script>
import { fetchList, delObj } from '@/api/log' import { fetchList, delObj } from '@/api/log'
import { tableOption } from '@/const/crud/log' import { tableOption } from '@/const/crud/log'
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
export default { export default {
name: 'log', name: 'log',
data() { data () {
return { return {
tableData: [], tableData: [],
page: { page: {
total: 0, // 总页数 total: 0, // 总页数
currentPage: 1, // 当前页数 currentPage: 1, // 当前页数
pageSize: 20 // 每页显示多少条 pageSize: 20 // 每页显示多少条
}, },
tableLoading: false, tableLoading: false,
tableOption: tableOption tableOption: tableOption
} }
}, },
created() { created () {
},
mounted: function () { },
computed: {
...mapGetters(['permissions'])
},
methods: {
getList (page, params) {
this.tableLoading = true
fetchList(Object.assign({
orderByField: 'create_time',
isAsc: false,
page: page.currentPage,
limit: page.pageSize
}, params)).then(response => {
this.tableData = response.data.data.records
this.page.total = response.data.data.total
this.tableLoading = false
})
}, },
mounted: function() { }, handleDel (row, index) {
computed: { this.$refs.crud.rowDel(row, index)
...mapGetters(['permissions'])
}, },
methods: { rowDel: function (row, index) {
getList(page,params) { var _this = this
this.tableLoading = true this.$confirm('是否确认删除ID为"' + row.id + '"的日志?', '警告', {
fetchList(Object.assign({ confirmButtonText: '确定',
orderByField: 'create_time', cancelButtonText: '取消',
isAsc: false, type: 'warning'
page: page.currentPage, })
limit: page.pageSize .then(function () {
}, params)).then(response => { return delObj(row.id)
this.tableData = response.data.data.records
this.page.total = response.data.data.total
this.tableLoading = false
})
},
handleDel(row, index) {
this.$refs.crud.rowDel(row, index)
},
rowDel: function(row, index) {
var _this = this
this.$confirm('是否确认删除ID为"' + row.id + '"的日志?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}) })
.then(function() { .then(data => {
return delObj(row.id) this.getList(this.page)
_this.$message({
showClose: true,
message: '删除成功',
type: 'success'
}) })
.then(data => { })
this.getList(this.page) .catch(function (err) { })
_this.$message({ },
showClose: true, /**
message: '删除成功', * 搜索回调
type: 'success' */
}) searchChange (form) {
}) this.getList(this.page, form)
.catch(function(err) { }) },
}, /**
/** * 刷新回调
* 搜索回调 */
*/ refreshChange () {
searchChange(form) { this.getList(this.page)
this.getList(this.page,form)
},
/**
* 刷新回调
*/
refreshChange() {
this.getList(this.page)
}
} }
} }
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
...@@ -136,11 +136,11 @@ export default { ...@@ -136,11 +136,11 @@ export default {
...mapGetters(['elements', 'permissions']) ...mapGetters(['elements', 'permissions'])
}, },
methods: { methods: {
getList (page,params) { getList (page, params) {
this.listLoading = true this.listLoading = true
fetchList(Object.assign({ fetchList(Object.assign({
page: page.currentPage, page: page.currentPage,
limit: page.pageSize limit: page.pageSize
}, params)).then(response => { }, params)).then(response => {
this.list = response.data.data.records this.list = response.data.data.records
this.page.total = response.data.data.total this.page.total = response.data.data.total
...@@ -152,7 +152,7 @@ export default { ...@@ -152,7 +152,7 @@ export default {
}, },
handleFilter (param) { handleFilter (param) {
this.page.page = 1; this.page.page = 1;
this.getList(this.page,param); this.getList(this.page, param);
}, },
handleCreate () { handleCreate () {
this.$refs.crud.rowAdd(); this.$refs.crud.rowAdd();
...@@ -170,7 +170,7 @@ export default { ...@@ -170,7 +170,7 @@ export default {
return fetchTree() return fetchTree()
}) })
.then(response => { .then(response => {
this.form = response.data.data this.treeData = response.data.data
// 解析出所有的太监节点 // 解析出所有的太监节点
this.checkedKeys = this.resolveAllEunuchNodeId(this.treeData, this.checkedKeys, []) this.checkedKeys = this.resolveAllEunuchNodeId(this.treeData, this.checkedKeys, [])
this.dialogStatus = 'permission' this.dialogStatus = 'permission'
......
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