提交 bf441cd5 authored 作者: pengxiaohui's avatar pengxiaohui

修改bug

上级 02f0514f
......@@ -166,10 +166,10 @@ export function publishImgText(id, data) {
/**
* 获取广告/文章/图文新建时所选项目对应的类型
* @param {number} content_type 类型 1文章 2广告 3图文
* @param {string} project_id 项目id
* @param {string} params.project_id 项目id
*/
export function getProjectContentTypeList(type, id) {
return httpRequest.get(`/api/cms/admin/v1/type/${type}/project`, { project_id: id })
export function getProjectContentTypeList(type, params) {
return httpRequest.get(`/api/cms/admin/v1/type/${type}/project`, { params })
}
/**
* 置顶图文
......
......@@ -297,7 +297,7 @@ export default {
},
fetchContentTypeList() {
if (this.form.project_id) {
getProjectContentTypeList(this.pageType, this.form.project_id).then((res) => {
getProjectContentTypeList(this.pageType, { project_id: this.form.project_id }).then((res) => {
if (res.code === 0 && Array.isArray(res.data)) {
this.typeList = res.data
}
......
......@@ -130,6 +130,10 @@ const defaultForm = {
articleType: [],
imageTextType: []
}
const checkboxStatus = {
isIndeterminate: false,
checkAll: false
}
export default {
components: { TableList },
data() {
......@@ -153,18 +157,9 @@ export default {
adTypeList: [],
articleTypeList: [],
imageTextTypeList: [],
adType: {
isIndeterminate: false,
checkAll: false
},
articleType: {
isIndeterminate: false,
checkAll: false
},
imageTextType: {
isIndeterminate: false,
checkAll: false
},
adType: Object.assign({}, checkboxStatus),
articleType: Object.assign({}, checkboxStatus),
imageTextType: Object.assign({}, checkboxStatus),
multipleSelection: []
}
},
......@@ -237,7 +232,6 @@ export default {
}
},
created() {
console.log(this.userProjectIds)
this.fetchProjectTypeList()
this.fetchContentTypeList()
},
......@@ -276,6 +270,10 @@ export default {
handleDrawerClose() {
this.drawerVisible = false
this.form = Object.assign({}, defaultForm)
const arr = ['adType', 'articleType', 'imageTextType']
arr.forEach(key => {
this[key] = Object.assign({}, checkboxStatus)
})
},
handleDrawerSubmit() {
this.$refs.drawerForm.validate(valid => {
......
......@@ -312,13 +312,15 @@ export default {
role_id: this.selectedTableItem.id,
permission_tags: permissionArr
}
updateRole(data).then((res) => {
updateRole(data).then(async (res) => {
if (res.code === 0 && res.data && res.data.status) {
this.fetchRoleList()
this.$message.success('权限配置成功')
// 刷新用户user_detail
if (this.userRoleId === data.role_id) {
this.$store.dispatch('checkRolesPermissions')
await this.$store.dispatch('checkRolesPermissions')
// updateRoutes
await this.$store.dispatch('updateRoutes')
}
} else {
this.$message.error('权限配置失败')
......
......@@ -37,7 +37,7 @@
>
</template>
</table-list>
<el-drawer :title="drawerTitle" :visible.sync="drawerVisible" size="440px" :destroy-on-close="true">
<el-drawer :title="drawerTitle" :visible.sync="drawerVisible" size="440px" @close="handleDrawerClose">
<div class="drawer__content">
<el-form :model="form" ref="drawerForm" :rules="rules" label-width="70px" class="drawer-form">
<el-form-item label="账户" prop="userid" v-if="dialogType === 'edit'">
......@@ -80,7 +80,7 @@
</el-form-item>
</el-form>
<div class="drawer__footer">
<el-button @click="drawerVisible = false" size="mini">取 消</el-button>
<el-button @click="handleDrawerClose" size="mini">取 消</el-button>
<el-button type="primary" @click="handleDrawerSubmit" size="mini">提 交</el-button>
</div>
</div>
......@@ -279,10 +279,13 @@ export default {
handleCreate() {
this.drawerVisible = true
this.drawerType = 'create'
this.$refs.drawerForm.resetFields();
},
handleDrawerClose() {
this.drawerVisible = false
this.form = Object.assign({}, drawerForm)
this.checkAll = false
this.isIndeterminate = false
},
handleDialogClose() {
this.drawerVisible = false
......@@ -351,6 +354,7 @@ export default {
this.userList = [val.sso_user]
this.drawerVisible = true
this.drawerType = 'details'
this.$refs.drawerForm.resetFields();
}
},
statusChange(val) {
......
import { getUser, logout } from '@/api/account'
import { getUserRolesPermissions } from '@/api/system'
import { resetRouter } from '@/router'
import router, { resetRouter } from '@/router'
const user = {
state: {
user: {},
......@@ -98,6 +98,16 @@ const user = {
return {}
})
return obj
},
// 刷新路由与菜单
async updateRoutes({ state, dispatch }) {
const permissions = state.permissions
// 基于权限获取可接入的路由
const accessRoutes = await dispatch('permission/routesByPermissions', permissions)
// 重新设置路由
resetRouter()
// 动态添加路由
router.addRoutes(accessRoutes)
}
}
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论