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

修改bug

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