优化返回按钮

This commit is contained in:
aoli.qu 2021-12-23 20:12:38 +08:00
parent 531551249e
commit 86b6e55fb4
6 changed files with 58 additions and 31 deletions

View File

@ -6,7 +6,7 @@
</span>
<template v-slot:overlay>
<a-menu class="ant-pro-drop-down menu" :selected-keys="[]">
<a-menu-item v-if="menu" key="center" @click="handleToCenter">
<!-- <a-menu-item v-if="menu" key="center" @click="handleToCenter">
<a-icon type="user" />
个人中心
</a-menu-item>
@ -14,7 +14,7 @@
<a-icon type="setting" />
个人设置
</a-menu-item>
<a-menu-divider v-if="menu" />
<a-menu-divider v-if="menu" />-->
<a-menu-item key="logout" @click="handleLogout">
<a-icon type="logout" />
退出登录
@ -43,13 +43,13 @@ export default {
}
},
methods: {
handleToCenter() {
handleToCenter () {
this.$router.push({ path: '/account/center' })
},
handleToSettings() {
handleToSettings () {
this.$router.push({ path: '/account/settings' })
},
handleLogout(e) {
handleLogout (e) {
Modal.confirm({
title: this.$t('layouts.usermenu.dialog.title'),
content: this.$t('layouts.usermenu.dialog.content'),
@ -61,7 +61,7 @@ export default {
this.$router.push({ name: 'login' })
})
},
onCancel() { }
onCancel () { }
})
}
}

View File

@ -65,7 +65,7 @@ const user = {
}
resolve(data)
} else {
reject(new Error(data.msg))
reject(new Error(response.msg))
}
}).catch(error => {
reject(error)

View File

@ -1,8 +1,8 @@
<template>
<a-card :bordered="false">
<a-card :bordered="false" title="新增公告">
<template slot="extra">
<a-button size="small" @click="save" type="primary">保存</a-button>
<a-button size="small" @click="close">返回</a-button>
<a-button type="primary" @click="goback">返回</a-button>
<a-button type="primary" @click="save">保存</a-button>
</template>
<a-form-model ref="ruleForm" :model="form" :rules="rules" :label-col="labelCol" :wrapper-col="wrapperCol">
@ -149,21 +149,17 @@
}
},
created () {
console.log(!this.$route.query.id)
if (!this.$route.query.id) return
this.edit(this.$route.query.id)
},
methods: {
//
close () {
goback () {
this.$router.push({ path: '/notice/list', query: {} })
},
edit (id) {
this.modalTitle = '修改'
this.visible = true
noticeGet({ id: id }).then(res => {
console.log(res)
const form = res.data
form.isNowPublish = form.isNowPublish === 1
// form.publishTime = moment(form.publishTime)
@ -183,11 +179,10 @@
form.isNowPublish = 0
}
form.file = JSON.stringify(this.fileList)
console.log(form)
noticeAdd(form).then((res) => {
if (res.code === 200) {
this.$message.success('操作成功')
this.close()
this.goback()
} else {
this.$message.error('操作失败:' + res.msg)
}
@ -205,7 +200,6 @@
this.form.rangeName = orgData.name
},
onChangeNow (checked) {
console.log(`a-switch to ${checked}`)
this.timeShow = !checked
}
}

View File

@ -47,13 +47,15 @@
</a-card>
<a-card :bordered="false">
<div class="table-operator">
<a-button @click="personRegister" icon="plus" type="primary" v-if="hasPerm('person:add')">新增人员</a-button>
<a-button @click="addPerson" icon="plus" type="primary" v-if="hasPerm('person:add')">新增人员</a-button>
<a-button @click="transfer" type="primary" v-if="hasPerm('person:transfer')">转移部门</a-button>
<a-button @click="quit" type="primary" v-if="hasPerm('person:quit')">离职</a-button>
<!-- <a-button @click="export" type="primary" >导出</a-button> -->
<a-button @click="setAdmin" type="primary" v-if="hasPerm('person:setAdmin')">设置管理员</a-button>
<!-- <a-button @click="import" type="primary" v-if="hasPerm('person:import')">批量导入</a-button> -->
<template v-if="orgType === 1">
<a-button @click="transfer" type="primary" v-if="hasPerm('person:transfer')">转移部门</a-button>
<a-button @click="quit" type="primary" v-if="hasPerm('person:quit')">离职</a-button>
<!-- <a-button @click="export" type="primary" >导出</a-button> -->
<a-button @click="setAdmin" type="primary" v-if="hasPerm('person:setAdmin')">设置管理员</a-button>
<!-- <a-button @click="import" type="primary" v-if="hasPerm('person:import')">批量导入</a-button> -->
</template>
</div>
@ -115,7 +117,6 @@ import { Empty } from 'ant-design-vue'
import { orgList } from '@/api/org/org'
import { listToTree } from '@/utils/util'
import { personPage, personDel, personQuit, personTransferOrg, personSetAdmin, personResetPwd } from '@/api/person/person'
import PersonRegister from './PersonRegister'
import PersonForm from './PersonForm'
import PersonDetail from './PersonDetail'
import OrgTree from '../org/OrgTree'
@ -124,7 +125,6 @@ const rootParentId = 0
export default {
components: {
STable,
PersonRegister,
PersonForm,
PersonDetail,
OrgTree
@ -183,8 +183,18 @@ export default {
orgId: '',
orgType: 1
}
},
mounted () {
},
created () {
const orgType = this.$route.query.orgType
if (!orgType) {
this.orgType = 1
} else {
this.orgType = parseInt(orgType)
}
this.getOrgTree()
if (this.hasPerm('person:edit') || this.hasPerm('person:resetPwd') || this.hasPerm('person:del')) {
@ -216,7 +226,6 @@ export default {
this.defaultExpandedKeys.push(item.id)
}
}
console.log(this.defaultExpandedKeys)
})
},
async changeOrgType () {
@ -345,7 +354,7 @@ export default {
}
})
},
personRegister () {
addPerson () {
if (this.orgType === 1) {
this.$router.push({
path: '/person/personRegister',

View File

@ -1,6 +1,9 @@
<template>
<div>
<a-card :bordered="false">
<a-card :bordered="false" title="新增人员">
<template slot="extra">
<a-button type="primary" @click="goback">返回</a-button>
</template>
<a-row type="flex" justify="center" align="top">
<a-col :span="4" id="tree">
<a-page-header title="项目列表" sub-title="" />
@ -120,6 +123,15 @@ export default {
},
//
methods: {
//
goback () {
this.$router.push({
path: '/personList',
query: {
orgType: 2
}
})
},
async getPerson () {
await personPage({ pageSize: 9999, pageNum: 1 }).then((res) => {
if (res.code === 200 && res.rows.length > 0) {

View File

@ -1,8 +1,11 @@
<template>
<div>
<a-card :bordered="false" style="padding-bottom: 0px; margin-bottom: 10px ">
<a-card :bordered="false" style="padding-bottom: 0px; margin-bottom: 10px " title="新增人员">
<template slot="extra">
<a-button type="primary" @click="goback">返回</a-button>
</template>
<div class="table-page-search-wrapper">
<h3>新增人员</h3>
<h3>单位邀请码{{ invitationCode }}</h3>
<h3>邀请链接 www.anquanpeixun.com</h3>
</div>
@ -94,6 +97,15 @@
created () {
},
methods: {
//
goback () {
this.$router.push({
path: '/personList',
query: {
orgType: 1
}
})
},
handleOk () {
this.$refs.table.refresh()
}