优化返回按钮

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> </span>
<template v-slot:overlay> <template v-slot:overlay>
<a-menu class="ant-pro-drop-down menu" :selected-keys="[]"> <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-icon type="user" />
个人中心 个人中心
</a-menu-item> </a-menu-item>
@ -14,7 +14,7 @@
<a-icon type="setting" /> <a-icon type="setting" />
个人设置 个人设置
</a-menu-item> </a-menu-item>
<a-menu-divider v-if="menu" /> <a-menu-divider v-if="menu" />-->
<a-menu-item key="logout" @click="handleLogout"> <a-menu-item key="logout" @click="handleLogout">
<a-icon type="logout" /> <a-icon type="logout" />
退出登录 退出登录

View File

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

View File

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

View File

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

View File

@ -1,6 +1,9 @@
<template> <template>
<div> <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-row type="flex" justify="center" align="top">
<a-col :span="4" id="tree"> <a-col :span="4" id="tree">
<a-page-header title="项目列表" sub-title="" /> <a-page-header title="项目列表" sub-title="" />
@ -120,6 +123,15 @@ export default {
}, },
// //
methods: { methods: {
//
goback () {
this.$router.push({
path: '/personList',
query: {
orgType: 2
}
})
},
async getPerson () { async getPerson () {
await personPage({ pageSize: 9999, pageNum: 1 }).then((res) => { await personPage({ pageSize: 9999, pageNum: 1 }).then((res) => {
if (res.code === 200 && res.rows.length > 0) { if (res.code === 200 && res.rows.length > 0) {

View File

@ -1,8 +1,11 @@
<template> <template>
<div> <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"> <div class="table-page-search-wrapper">
<h3>新增人员</h3>
<h3>单位邀请码{{ invitationCode }}</h3> <h3>单位邀请码{{ invitationCode }}</h3>
<h3>邀请链接 www.anquanpeixun.com</h3> <h3>邀请链接 www.anquanpeixun.com</h3>
</div> </div>
@ -94,6 +97,15 @@
created () { created () {
}, },
methods: { methods: {
//
goback () {
this.$router.push({
path: '/personList',
query: {
orgType: 1
}
})
},
handleOk () { handleOk () {
this.$refs.table.refresh() this.$refs.table.refresh()
} }