Commit 09b618ca by cwq0219

新增菜单接口

1 parent cc0d14bd
......@@ -7,9 +7,9 @@ const roleCreateStructure = {
departId: '',
departName: '',
departPath: '',
rights: Array,
state: 1,
createTime: ''
rights: [],
state: 1
// createTime: ''
}
const roleDataColumn = [{
......
......@@ -68,10 +68,10 @@ export default {
for (const key in this.value.form) {
this.value.form[key] = null
}
if (this.value.form.createTime !== undefined) {
this.value.form.createTime = timeTip
this.value.form.updateTime = timeTip
}
// if (this.value.form.createTime !== undefined) {
// this.value.form.createTime = timeTip
// this.value.form.updateTime = timeTip
// }
}
}
}
......
......@@ -131,7 +131,7 @@ export default {
const treeData = this.value.allNode
if (this.value.form[this.form[0].value] !== '' && this.value.form[this.form[0].value] !== null) {
const obj = this.getMenuObj()
obj.updateTime = new Date().getTime()
// obj.updateTime = new Date().getTime()
obj.isHidden = this.value.form.isHidden === true ? 0 : 1
console.log(obj)
// 添加同级
......@@ -148,7 +148,7 @@ export default {
this.addData(obj)
// 修改
} else {
obj.createTime = this.unix(this.value.form.createTime)
// obj.createTime = this.unix(this.value.form.createTime)
editMenu.req(obj).then(res => {
console.log(res)
this.Tip(true)
......@@ -167,7 +167,11 @@ export default {
return new Date(time).getTime()
},
addData(obj) {
obj.createTime = new Date().getTime()
// obj.createTime = new Date().getTime()
// const objPackge = { menu: obj }
// console.log(objPackge)
// delete obj.createTime
// delete obj.updateTime
if (!this.isDepart) {
addMenu.req(obj).then(res => {
console.log(res)
......
......@@ -15,9 +15,9 @@
<gl-form-item label="所属部门:" prop="departName">
<gl-select placeholder="请选择" v-model="createRuleForm.departName">
<gl-option style="height:160px">
<!-- <gl-input-tree :data=''></gl-input-tree> -->
<tree ref='tree' :isDepart="isDepart" v-model="createRuleForm.departName" :defaultExpandAll="defaultExpandAll" @node-click='clickDepart' style="height:160px"></tree>
</gl-option>
<!-- <gl-option label="运营平台" value="运营平台"></gl-option> -->
</gl-select>
</gl-form-item>
<gl-form-item label="菜单选项:" prop="rights">
......
......@@ -20,6 +20,9 @@ export default {
detailVisible: Boolean,
roleParam: Object
},
mounted() {
console.log(this.roleParam)
},
data() {
return {
}
......
......@@ -38,26 +38,34 @@ export default {
},
isDepart: Boolean
},
watch: {
defaultCheckedKeys(val) {
this.loadingTree()
}
},
methods: {
nodeClick(data, treeData, vue) {
this.$emit('node-click', data, treeData, vue, this.props)
},
check(data, treeData) {
this.$emit('input', { data, treeData })
},
loadingTree() {
!this.isDepart
? findMenuTree.req().then(res => {
this.data = fn(res, '#')
}).catch(err => {
console.log(err)
})
: findDepartTree.req().then(res => {
this.data = fn(res, '#')
}).catch(err => {
console.log(err)
})
}
},
mounted() {
!this.isDepart
? findMenuTree.req().then(res => {
this.data = fn(res, '#')
}).catch(err => {
console.log(err)
})
: findDepartTree.req().then(res => {
this.data = fn(res, '#')
}).catch(err => {
console.log(err)
})
this.loadingTree()
}
}
function fn(data, pid) {
......
export default {
axios: {
// baseURL: 'http://cas.dev.glsx.net/admin-operating-auth/',
baseURL: 'http://192.168.3.171:7300/mock/5b91805391b67469b43e2921/subsystem/',
baseURL: 'http://cas.dev.glsx.net/admin-operating-auth/',
// baseURL: 'http://192.168.3.171:7300/mock/5b91805391b67469b43e2921/subsystem/',
whiteList: ['role/deleteRoleById', 'role/deleteUserRoleById', 'role/getRoleDetail', 'role/getRoleDetail', 'role/getRoleList', 'role/isRoleNameExit', 'role/saveRoleList', 'role/selectMenuTreeRoleId', 'role/selectUserRoleByRoleId', 'role/updateRole', 'user/batcheDel', 'user/findAll', 'user/get', 'user/getWithRoles', 'user/operatUser', 'user/updateUser', 'department/del', 'department/findTree', 'department/getPName', 'department/getTreeNode', 'department/updateDepartment', 'menu/add', 'menu/del', 'menu/edit', 'menu/findById', 'menu/findTree', 'menu/getByUserId', 'menu/getPName'],
timeout: 15000,
result: {
......
......@@ -29,7 +29,7 @@ export default {
data: [],
form: {
id: 0,
urlName: '',
urlName: 'ttt',
hostName: '',
openStyle: '新系统',
menuType: '',
......@@ -39,8 +39,8 @@ export default {
baseUrl: '',
iorder: null,
isHidden: 0,
createTime: null,
updateTime: null,
// createTime: null,
// updateTime: null,
grade: 0,
iconUrl: '',
lastOperatorId: 0,
......@@ -119,11 +119,14 @@ export default {
// console.log(res[key], typeof res[key], key)
// }
// console.log(this.menuMG.allNode, this.menuMG.node)
console.log(res)
for (const key in this.menuMG.form) {
if (key === 'isHidden') {
this.menuMG.form[key] = res[key] === 0
} else if (key === 'createTime' || key === 'updateTime') {
this.menuMG.form[key] = new Date(res[key]).format('yyyy-MM-dd HH:mm:ss')
console.log(res[key])
this.menuMG.form[key] = res[key]
// this.menuMG.form[key] = new Date(res[key]).format('yyyy-MM-dd HH:mm:ss')
} else if (key === 'name') {
this.menuMG.form[key] = node.level === 1 ? '顶级菜单' : node.parent.data[props.label]
} else {
......
......@@ -49,6 +49,7 @@ export default {
apiParam: Number,
flagRoleOrUser: true,
flagCOrE: Boolean,
editOrDetail: Boolean,
roleMenuTree: [],
createOrEditTitle: '新增角色',
userDetailTitle: '用户列表',
......@@ -76,7 +77,8 @@ export default {
label: '详细',
type: 'text',
callback: (index, rows) => {
this.handleGetRoleDetail(rows[index])
this.roleParam = this.$deep_clone(rows[index])
this.handleGetRoleDetail()
}
}, {
label: '删除',
......@@ -143,6 +145,7 @@ export default {
// console.log(res)
this.total = res.total
this.roleData.data = res.list
// this.$set(this.roleData, 'data', res.list)
// console.log(this.roleData.data)
}).catch(err => {
console.log(err)
......@@ -159,11 +162,14 @@ export default {
},
// 获得角色的相关权限详细信息,并返回树形数据
getMenuTree(params) {
console.log(typeof (this.roleParam.rights))
selectMenuTreeRoleId.req({ id: params }).then(res => {
res.forEach(item => {
this.roleMenuTree.push(item.id)
this.roleParam.rights.push(item.id)
})
this.createDialogVisible()
this.editOrDetail && this.createDialogVisible()
!this.editOrDetail && this.deleteDialogVisible()
}).catch(err => {
console.log(err)
})
......@@ -223,9 +229,8 @@ export default {
handleSearchRoleName() {
this.getList()
},
handleGetRoleDetail(params) {
this.roleParam = params
this.deleteDialogVisible()
handleGetRoleDetail() {
this.getMenuTree(this.roleParam.id, this.editOrDetail = false)
},
handleDetailClose() {
this.deleteDialogVisible()
......@@ -246,7 +251,7 @@ export default {
handleCreateOrEdit() {
this.roleParam = this.flagCOrE ? roleCreateStructure : this.roleParam
this.flagCOrE && this.createDialogVisible()
!this.flagCOrE && this.getMenuTree(this.roleParam.id)
!this.flagCOrE && this.getMenuTree(this.roleParam.id, this.editOrDetail = true)
},
// 关闭新增用户组件
handleCreateClose(data) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!