Commit 4688b7a8 by 胡悦

提交菜单和组织部分接口,未完

1 parent 56b98c01
...@@ -150,7 +150,7 @@ export default { ...@@ -150,7 +150,7 @@ export default {
}, },
radioChange(event, prop) { radioChange(event, prop) {
// console.log(event,prop,'radioChange') // console.log(event,prop,'radioChange')
this.$emit('radio-change', event, prop) this.$emit('radioChange', event, prop)
} }
} }
} }
......
...@@ -41,10 +41,11 @@ const MENU_API = { ...@@ -41,10 +41,11 @@ const MENU_API = {
MENU_ADD: BASE_URL + '/usercenter/menu/add', MENU_ADD: BASE_URL + '/usercenter/menu/add',
MENU_EDIT: BASE_URL + '/usercenter/menu/edit', MENU_EDIT: BASE_URL + '/usercenter/menu/edit',
MENU_DELETE: BASE_URL + '/usercenter/menu/delete', MENU_DELETE: BASE_URL + '/usercenter/menu/delete',
MENU_INFO: BASE_URL + '/usercenter/menu/info' MENU_INFO: BASE_URL + '/usercenter/menu/info',
MENU_PERMTREE: BASE_URL + '/usercenter/menu/permtree'
} }
const ORGINIZA_API = { const ORGINIZA_API = {
ORGINIZA_SEARCH: BASE_URL + '/usercenter/organization/rootList', ORGINIZA_SEARCH: BASE_URL + '/usercenter/organization/search',
ORGINIZA_CHILDREN: BASE_URL + '/usercenter/organization/children', ORGINIZA_CHILDREN: BASE_URL + '/usercenter/organization/children',
ORGINIZA_SIMPLElIST: BASE_URL + '/usercenter/organization/simplelist', ORGINIZA_SIMPLElIST: BASE_URL + '/usercenter/organization/simplelist',
ORGINIZA_TREEORY: BASE_URL + '/usercenter/organization/orgtree', ORGINIZA_TREEORY: BASE_URL + '/usercenter/organization/orgtree',
......
...@@ -33,4 +33,10 @@ function menuInfo (params) { ...@@ -33,4 +33,10 @@ function menuInfo (params) {
return request(params, url) return request(params, url)
} }
export { getMenuList, getMenuChildren, addMenu, editMenu, menuInfo, deleteMenu } // 获取上级菜单
function getPermtree (params) {
const url = MENU_API.MENU_PERMTREE
return request(params, url)
}
export { getMenuList, getMenuChildren, addMenu, editMenu, menuInfo, deleteMenu, getPermtree }
...@@ -93,9 +93,8 @@ const Constants = { ...@@ -93,9 +93,8 @@ const Constants = {
// 组织管理状态 // 组织管理状态
ORGINIZASTATUS: { ORGINIZASTATUS: {
'0': '正常,green', '1': '正常,green',
'1': '停用,gray', '2': '停用,gray'
'2': '注销,red'
}, },
ORGINIZATYPE: { ORGINIZATYPE: {
'1': '层级', '1': '层级',
......
...@@ -80,17 +80,17 @@ ...@@ -80,17 +80,17 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<!-- <el-pagination <el-pagination
background background
@size-change="handleSizeChange" @size-change="handleSizeChange"
@current-change="handleCurrentChange" @current-change="handleCurrentChange"
:current-page="page.pageNum" :current-page="page.pageNum"
:page-sizes="[10,20,30,40]" :page-sizes="[10,20,30,40]"
:page-size="page.pageSize" :page-size="page.pageSize"
:total="getListApi ? total : tableTotal" :total="total"
layout="sizes,total,->,prev,pager,next,jumper" layout="sizes,total,->,prev,pager,next,jumper"
> >
</el-pagination> --> </el-pagination>
<basic-dialog <basic-dialog
:title="menuDialogTitle" :title="menuDialogTitle"
:isVisible="menuVisible" :isVisible="menuVisible"
...@@ -102,6 +102,7 @@ ...@@ -102,6 +102,7 @@
:ruleForm="menuForm" :ruleForm="menuForm"
:rules="menuRules" :rules="menuRules"
:ruleData="menuData" :ruleData="menuData"
@radioChange="radioChange"
ref='menuForm' ref='menuForm'
></rule-form> ></rule-form>
</slot> </slot>
...@@ -135,7 +136,7 @@ ...@@ -135,7 +136,7 @@
</div> </div>
</template> </template>
<script> <script>
import { getMenuList, getMenuChildren, addMenu, editMenu, menuInfo, deleteMenu } from 'services/menu'; import { getMenuList, getMenuChildren, addMenu, editMenu, menuInfo, deleteMenu, getPermtree } from 'services/menu';
export default { export default {
data() { data() {
return { return {
...@@ -145,7 +146,7 @@ export default { ...@@ -145,7 +146,7 @@ export default {
{ {
type: 'input', type: 'input',
inputType: 'text', inputType: 'text',
prop: 'organizationName', prop: 'name',
placeholder: '请输入菜单名称' placeholder: '请输入菜单名称'
}, },
{ {
...@@ -154,7 +155,7 @@ export default { ...@@ -154,7 +155,7 @@ export default {
placeholder: '请选择菜单状态', placeholder: '请选择菜单状态',
options: [{ options: [{
value: '1', value: '1',
label: '正常' label: '显示'
}, { }, {
value: '2', value: '2',
label: '不显示' label: '不显示'
...@@ -167,12 +168,13 @@ export default { ...@@ -167,12 +168,13 @@ export default {
{ prop: 'menuName', label: '菜单名称' }, { prop: 'menuName', label: '菜单名称' },
{ prop: 'orderNum', label: '排序' }, { prop: 'orderNum', label: '排序' },
{ prop: 'frontRoute', label: '请求地址' }, { prop: 'frontRoute', label: '请求地址' },
{ prop: 'type', label: '菜单类型' },
{ prop: 'enableStatus', label: '状态' }, { prop: 'enableStatus', label: '状态' },
{ prop: 'permissionTag', label: '权限标识' } { prop: 'permissionTag', label: '权限标识' }
], ],
page: { page: {
pageNum: 10, pageSize: 10,
pageSize: 1 pageNumber: 1
}, },
total: 10, total: 10,
tableParams: { tableParams: {
...@@ -205,7 +207,7 @@ export default { ...@@ -205,7 +207,7 @@ export default {
}, },
menuData: [ menuData: [
{ label: '菜单类型', prop: 'type', type: 'radio', children: this.$Constants.MENU_TYPE }, { label: '菜单类型', prop: 'type', type: 'radio', children: this.$Constants.MENU_TYPE },
{ label: '上级菜单', prop: 'parentName', type: 'input', readonly: true, clickFunc: this.selectSuperior }, { label: '上级菜单', prop: 'parentName', type: 'input', readonly: true, clickFunc: this.selectSuperior, hidden: true },
{ label: '菜单名称', prop: 'menuName', type: 'input' }, { label: '菜单名称', prop: 'menuName', type: 'input' },
{ label: '权限标识', prop: 'permissionTag', type: 'input' }, { label: '权限标识', prop: 'permissionTag', type: 'input' },
{ label: '前端路由', prop: 'frontRoute', type: 'input' }, { label: '前端路由', prop: 'frontRoute', type: 'input' },
...@@ -223,69 +225,7 @@ export default { ...@@ -223,69 +225,7 @@ export default {
filterDialogTitle: '选择上级', filterDialogTitle: '选择上级',
filterVisible: false, filterVisible: false,
filterText: '', filterText: '',
filterTextData: [ filterTextData: [],
{
id: 1,
label: '广汇集团',
children: [
{
id: 10,
label: '东北大区'
}, {
id: 11,
label: '华南大区'
}, {
id: 12,
label: '西北大区',
children: [
{
id: 100,
label: '新疆',
children: [
{
id: 1000,
label: '新疆克拉玛依华威4S店'
}, {
id: 1001,
label: '新疆克拉玛依华威4S店'
}
]
}, {
id: 101,
label: '陕西'
}
]
}
]
}, {
id: 2,
label: '成都轱辘汽车服务公司',
children: [
{
id: 20,
label: '新疆克拉玛依华威4S店'
}, {
id: 21,
label: '深圳市',
children: [
{
id: 200,
label: '南山区',
children: [
{
id: 2000,
label: '南山科技园片区'
}
]
}, {
id: 201,
label: '福田竹子林金融产业园区'
}
]
}
]
}
],
defaultProps: { defaultProps: {
children: 'children', children: 'children',
label: 'label' label: 'label'
...@@ -301,16 +241,27 @@ export default { ...@@ -301,16 +241,27 @@ export default {
} }
}, },
mounted() { mounted() {
this.getList() this.search()
}, },
methods: { methods: {
search() { search() {
this.getList(this.searchForm) let params = Object.assign({}, this.searchForm, this.page)
console.log(params)
this.getList(params)
}, },
// 重置搜索条件 // 重置搜索条件
refresh() { refresh() {
this.searchForm = {} this.searchForm = {}
}, },
emptyData(params) {
let arr = params
for (let key in arr) {
if (params[key] == null || params[key] == '' || params[key] == []) {
delete params[key]
}
}
return arr
},
// 确定,新增、编辑 // 确定,新增、编辑
handleConfirm() { handleConfirm() {
console.log(this.menuForm) console.log(this.menuForm)
...@@ -318,10 +269,20 @@ export default { ...@@ -318,10 +269,20 @@ export default {
if (valid) { if (valid) {
let params = JSON.parse(JSON.stringify(this.menuForm)) let params = JSON.parse(JSON.stringify(this.menuForm))
params.enableStatus = this.menuForm.enableStatus ? 1 : 2 params.enableStatus = this.menuForm.enableStatus ? 1 : 2
this.emptyData(params)
let api = addMenu let api = addMenu
if (params.id) api = editMenu if (params.id) api = editMenu
api(params).then(res => { api(params).then(res => {
if (res.code == 200) {
this.$message({
type: 'success',
message: '操作成功!'
})
this.handleClose() this.handleClose()
this.search()
} else {
this.$message(res.message)
}
}) })
} else { } else {
console.log('error') console.log('error')
...@@ -353,10 +314,11 @@ export default { ...@@ -353,10 +314,11 @@ export default {
// 编辑触发事件 // 编辑触发事件
editEvent(row) { editEvent(row) {
console.log(row) console.log(row)
menuInfo({ id: row.id }).then(res => { menuInfo({ menuId: row.id }).then(res => {
this.menuDialogTitle = '编辑菜单' this.menuDialogTitle = '编辑菜单'
this.menuForm = JSON.parse(JSON.stringify(res.data)) this.menuForm = JSON.parse(JSON.stringify(res.data))
this.menuForm.enableStatus = res.data.enableStatus == 1 ? true : false this.menuForm.enableStatus = res.data.enableStatus == 1 ? true : false
this.menuForm.type = res.data.type + ''
this.handleClose(res.data) this.handleClose(res.data)
}) })
}, },
...@@ -392,6 +354,7 @@ export default { ...@@ -392,6 +354,7 @@ export default {
}, },
// 上级弹窗 // 上级弹窗
selectSuperior() { selectSuperior() {
this.getPermtree()
this.closeFilter() this.closeFilter()
}, },
closeFilter() { closeFilter() {
...@@ -410,8 +373,39 @@ export default { ...@@ -410,8 +373,39 @@ export default {
}, },
getList(params) { getList(params) {
getMenuList(params).then((res) => { getMenuList(params).then((res) => {
if (res.code == 200) {
this.total = res.data.totalElements
this.menuTableData = res.data.list this.menuTableData = res.data.list
} else {
this.menuTableData = []
}
})
},
// 获取上级菜单
getPermtree() {
getPermtree().then(res => {
if (res.code = 200) {
this.filterTextData = res.data
}
}) })
},
// 页码
handleSizeChange(value) {
this.page.pageSize = value
this.search()
},
handleCurrentChange(value) {
this.page.pageNumber = value
this.search()
},
radioChange(event, prop) {
console.log(event, prop)
if (event != 1) {
this.menuData[1].hidden = false
} else {
this.menuData[1].hidden = true
}
} }
} }
} }
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
>新增根组织</el-button> >新增根组织</el-button>
</div> </div>
<el-table <el-table
ref="table"
:data="orginTableData" :data="orginTableData"
style="width: 100%" style="width: 100%"
row-key="id" row-key="id"
...@@ -80,6 +81,17 @@ ...@@ -80,6 +81,17 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="page.pageNum"
:page-sizes="[10,20,30,40]"
:page-size="page.pageSize"
:total="total"
layout="sizes,total,->,prev,pager,next,jumper"
>
</el-pagination>
<basic-dialog <basic-dialog
:title="orginizaDialogTitle" :title="orginizaDialogTitle"
:isVisible="orginizaVisible" :isVisible="orginizaVisible"
...@@ -117,10 +129,10 @@ export default { ...@@ -117,10 +129,10 @@ export default {
prop: 'enableStatus', prop: 'enableStatus',
placeholder: '请选择组织状态', placeholder: '请选择组织状态',
options: [{ options: [{
value: '0', value: '1',
label: '正常' label: '正常'
}, { }, {
value: '1', value: '2',
label: '停用' label: '停用'
}] }]
} }
...@@ -132,6 +144,11 @@ export default { ...@@ -132,6 +144,11 @@ export default {
{ prop: 'enableStatus', label: '状态' }, { prop: 'enableStatus', label: '状态' },
{ prop: 'createDate', label: '创建时间' } { prop: 'createDate', label: '创建时间' }
], ],
page: {
pageSize: 10,
pageNumber: 1
},
total: 10,
tableParams: { tableParams: {
tableOption: { tableOption: {
btnList: [ btnList: [
...@@ -180,11 +197,12 @@ export default { ...@@ -180,11 +197,12 @@ export default {
} }
}, },
mounted() { mounted() {
this.getList() this.search()
}, },
methods: { methods: {
search() { search() {
this.getList(this.searchForm) let params = Object.assign({}, this.searchForm, this.page)
this.getList(params)
}, },
// 重置搜索条件 // 重置搜索条件
refresh() { refresh() {
...@@ -196,11 +214,19 @@ export default { ...@@ -196,11 +214,19 @@ export default {
this.$refs.orginizaForm.$children[0].validate((valid) => { this.$refs.orginizaForm.$children[0].validate((valid) => {
if (valid) { if (valid) {
let params = JSON.parse(JSON.stringify(this.orginizaForm)) let params = JSON.parse(JSON.stringify(this.orginizaForm))
params.enableStatus = this.orginizaForm.enableStatus ? 0 : 1 params.enableStatus = this.orginizaForm.enableStatus ? 1 : 2
if (params.departmentName) delete params.departmentName
let api = addOrganiza let api = addOrganiza
if (params.id) api = editOrganiza if (params.id) api = editOrganiza
api(params).then(res => { api(params).then(res => {
if (res.code = 200) {
this.$set(this.$refs.table.store.states.lazyTreeNodeMap, params.id, res.data)
this.$message({
type: 'success',
message: '操作成功'
})
this.handleClose() this.handleClose()
}
}) })
} else { } else {
console.log('error') console.log('error')
...@@ -226,6 +252,8 @@ export default { ...@@ -226,6 +252,8 @@ export default {
case 'create': case 'create':
this.orginizaData[0].hidden = false this.orginizaData[0].hidden = false
this.orginizaDialogTitle = '新增组织' this.orginizaDialogTitle = '新增组织'
this.orginizaForm.departmentName = scope.departmentName
this.orginizaForm.superiorId = scope.id
this.handleClose() this.handleClose()
break break
case 'edit': case 'edit':
...@@ -241,7 +269,7 @@ export default { ...@@ -241,7 +269,7 @@ export default {
editEvent(row) { editEvent(row) {
console.log(row) console.log(row)
this.orginizaForm = JSON.parse(JSON.stringify(row)) this.orginizaForm = JSON.parse(JSON.stringify(row))
this.orginizaForm.enableStatus = row.enableStatus == 0 ? true : false this.orginizaForm.enableStatus = row.enableStatus == 1 ? true : false
this.handleClose() this.handleClose()
}, },
// 删除触发事件 // 删除触发事件
...@@ -266,20 +294,42 @@ export default { ...@@ -266,20 +294,42 @@ export default {
// 树形table懒加载 // 树形table懒加载
load(tree, treeNode, resolve) { load(tree, treeNode, resolve) {
console.log(tree, treeNode, resolve) console.log(tree, treeNode, resolve)
getChildren({ id: tree.id }).then(res => { getChildren({ rootId: tree.id }).then(res => {
let nodes = res.data.list let nodes = res.data
nodes.map(item => {
const aa = this.num++
item.id = aa + '' + item.id
})
resolve(nodes) resolve(nodes)
}) })
}, },
// 获取根节点列表
getList(params) { getList(params) {
getTableList(params).then((res) => { getTableList(params).then((res) => {
this.orginTableData = res.data.list if (res.code == 200) {
}) this.total = res.data.totalElements
this.orginTableData = res.data
} else {
this.orginTableData = []
} }
})
},
// 子节点列表
getChildren(id) {
getChildren({ rootId: id }).then(res => {
let nodes = res.data
// nodes.map(item => {
// const aa = this.num++
// item.id = aa + '' + item.id
// })
return nodes
})
},
// 页码
handleSizeChange(value) {
this.page.pageSize = value
this.search()
},
handleCurrentChange(value) {
this.page.pageNumber = value
this.search()
},
} }
} }
</script> </script>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!