4 changed files with 542 additions and 387 deletions
@ -1,129 +1,216 @@ |
|||||
<template> |
<template> |
||||
<el-card shadow="never" |
<el-card shadow="never" class="aui-card--fill"> |
||||
class="aui-card--fill"> |
|
||||
<div class="mod-sys__menu"> |
<div class="mod-sys__menu"> |
||||
<el-form :inline="true" |
<el-form :inline="true" @keyup.enter.native="search()"> |
||||
:model="dataForm" |
<el-form-item><el-input v-model="menuName" placeholder="请输入菜单名称" :clearable="true"></el-input></el-form-item> |
||||
@keyup.enter.native="getDataList()"> |
<el-form-item><el-button type="primary" @click="search()">查询</el-button></el-form-item> |
||||
|
</el-form> |
||||
|
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()"> |
||||
<el-form-item> |
<el-form-item> |
||||
<el-button type="primary" |
<el-button type="primary" @click="addOrUpdateHandle()">{{ $t('add') }}</el-button> |
||||
@click="addOrUpdateHandle()">{{ $t('add') }}</el-button> |
<el-button type="primary" @click="open('')">开启</el-button> |
||||
|
<el-button type="primary" @click="close('')">关闭</el-button> |
||||
</el-form-item> |
</el-form-item> |
||||
</el-form> |
</el-form> |
||||
<el-table v-loading="dataListLoading" |
<el-table |
||||
|
@selection-change="handleSelectionChange" |
||||
|
v-loading="dataListLoading" |
||||
|
ref="form" |
||||
:data="dataList" |
:data="dataList" |
||||
row-key="id" |
row-key="id" |
||||
border |
border |
||||
:height="tableHeight" |
:height="tableHeight" |
||||
style="width: 100%;"> |
style="width: 100%;" |
||||
<el-table-column prop="name" |
> |
||||
:label="$t('menu.name')" |
<el-table-column label="" fixed="left" type="selection" align="center" width="50" /> |
||||
header-align="center" |
<el-table-column label="序号" fixed="left" type="index" align="center" width="50" /> |
||||
min-width="150"></el-table-column> |
<el-table-column prop="name" :label="$t('menu.name')" header-align="center" min-width="150"></el-table-column> |
||||
<el-table-column prop="icon" |
<el-table-column prop="icon" :label="$t('menu.icon')" header-align="center" align="center"> |
||||
:label="$t('menu.icon')" |
|
||||
header-align="center" |
|
||||
align="center"> |
|
||||
<template slot-scope="scope"> |
<template slot-scope="scope"> |
||||
<svg class="icon-svg" |
<svg class="icon-svg" aria-hidden="true"><use :xlink:href="`#${scope.row.icon}`"></use></svg> |
||||
aria-hidden="true"> |
|
||||
<use :xlink:href="`#${scope.row.icon}`"></use> |
|
||||
</svg> |
|
||||
</template> |
</template> |
||||
</el-table-column> |
</el-table-column> |
||||
<el-table-column prop="type" |
<el-table-column prop="type" :label="$t('menu.type')" header-align="center" align="center"> |
||||
:label="$t('menu.type')" |
|
||||
header-align="center" |
|
||||
align="center"> |
|
||||
<template slot-scope="scope"> |
<template slot-scope="scope"> |
||||
<el-tag v-if="scope.row.type === 0" |
<el-tag v-if="scope.row.type === 0" size="small">{{ $t('menu.type0') }}</el-tag> |
||||
size="small">{{ $t('menu.type0') }}</el-tag> |
<el-tag v-else size="small" type="info">{{ $t('menu.type1') }}</el-tag> |
||||
<el-tag v-else |
|
||||
size="small" |
|
||||
type="info">{{ $t('menu.type1') }}</el-tag> |
|
||||
</template> |
</template> |
||||
</el-table-column> |
</el-table-column> |
||||
<el-table-column prop="sort" |
<el-table-column prop="sort" :label="$t('menu.sort')" header-align="center" align="center"></el-table-column> |
||||
:label="$t('menu.sort')" |
<el-table-column prop="url" :label="$t('menu.url')" header-align="center" align="center" width="150" :show-overflow-tooltip="true"></el-table-column> |
||||
header-align="center" |
<el-table-column |
||||
align="center"></el-table-column> |
prop="permissions" |
||||
<el-table-column prop="url" |
|
||||
:label="$t('menu.url')" |
|
||||
header-align="center" |
|
||||
align="center" |
|
||||
width="150" |
|
||||
:show-overflow-tooltip="true"></el-table-column> |
|
||||
<el-table-column prop="permissions" |
|
||||
:label="$t('menu.permissions')" |
:label="$t('menu.permissions')" |
||||
header-align="center" |
header-align="center" |
||||
align="center" |
align="center" |
||||
width="150" |
width="150" |
||||
:show-overflow-tooltip="true"></el-table-column> |
:show-overflow-tooltip="true" |
||||
<el-table-column :label="$t('handle')" |
></el-table-column> |
||||
fixed="right" |
<el-table-column prop="showFlag" label="菜单类型" header-align="center" align="center"> |
||||
header-align="center" |
|
||||
align="center" |
|
||||
width="150"> |
|
||||
<template slot-scope="scope"> |
<template slot-scope="scope"> |
||||
<el-button type="text" |
基础应用 |
||||
size="small" |
</template> |
||||
@click="addOrUpdateHandle(scope.row.id)">{{ $t('update') }}</el-button> |
</el-table-column> |
||||
<el-button type="text" |
<el-table-column prop="type" :label="$t('状态')" header-align="center" align="center"> |
||||
size="small" |
<template slot-scope="scope"> |
||||
@click="deleteHandle(scope.row.id)">{{ $t('delete') }}</el-button> |
<el-tag v-if="scope.row.showFlag === 0" size="small" type="info">{{ $t('menu.status0') }}</el-tag> |
||||
<el-button type="text" |
<el-tag v-else size="small">{{ $t('menu.status1') }}</el-tag> |
||||
size="small" |
</template> |
||||
@click="showCustomerMenu(scope.row)">{{ '客户配置' }}</el-button> |
</el-table-column> |
||||
|
<el-table-column :label="$t('handle')" fixed="right" header-align="center" align="center" width="150"> |
||||
|
<template slot-scope="scope"> |
||||
|
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">{{ $t('update') }}</el-button> |
||||
|
<el-button type="text" size="small" @click="deleteHandle(scope.row.id)">{{ $t('delete') }}</el-button> |
||||
|
<!-- <el-button type="text" size="small" @click="showCustomerMenu(scope.row)">{{ '客户配置' }}</el-button> --> |
||||
|
<el-button type="text" size="small" v-if="scope.row.showFlag == 0" @click="open(scope.row.id)">{{ '开启' }}</el-button> |
||||
|
<el-button type="text" size="small" v-if="scope.row.showFlag == 1" @click="close(scope.row.id)">{{ '关闭' }}</el-button> |
||||
</template> |
</template> |
||||
</el-table-column> |
</el-table-column> |
||||
</el-table> |
</el-table> |
||||
<!-- 弹窗, 新增 / 修改 --> |
<!-- 弹窗, 新增 / 修改 --> |
||||
<add-or-update v-if="addOrUpdateVisible" |
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" :tableName="'data_menu'" @refreshDataList="getDataList"></add-or-update> |
||||
ref="addOrUpdate" |
|
||||
:tableName="'data_menu'" |
|
||||
@refreshDataList="getDataList"></add-or-update> |
|
||||
<!-- 客户菜单配置 --> |
<!-- 客户菜单配置 --> |
||||
<customer-add-or-update ref="customerForm" |
<customer-add-or-update ref="customerForm" :menuName="selMenuName" @refreshDataList="getDataList"></customer-add-or-update> |
||||
:menuName="selMenuName" |
|
||||
@refreshDataList="getDataList"></customer-add-or-update> |
|
||||
</div> |
</div> |
||||
</el-card> |
</el-card> |
||||
</template> |
</template> |
||||
|
|
||||
<script> |
<script> |
||||
import mixinViewModule from '@/mixins/view-module' |
import mixinViewModule from '@/mixins/view-module'; |
||||
import AddOrUpdate from './menu-add-or-update' |
import AddOrUpdate from './menu-add-or-update'; |
||||
import { mapGetters } from 'vuex' |
import { mapGetters } from 'vuex'; |
||||
import CustomerAddOrUpdate from './customer-add-or-update' |
import CustomerAddOrUpdate from './customer-add-or-update'; |
||||
export default { |
export default { |
||||
mixins: [mixinViewModule], |
mixins: [mixinViewModule], |
||||
data () { |
data() { |
||||
return { |
return { |
||||
|
menuName: '', |
||||
|
multipleSelection: [], |
||||
mixinViewModuleOptions: { |
mixinViewModuleOptions: { |
||||
getDataListURL: '/gov/access/menu/list', |
getDataListURL: '/gov/access/menu/list', |
||||
deleteURL: '/gov/access/menu' |
deleteURL: '/gov/access/menu' |
||||
}, |
}, |
||||
customerFormVisible: false, |
customerFormVisible: false, |
||||
dataForm: { "tableName": 'data_menu' }, |
dataForm: { tableName: 'data_menu' }, |
||||
selMenuName: '' |
selMenuName: '' |
||||
} |
}; |
||||
}, |
}, |
||||
components: { |
components: { |
||||
AddOrUpdate, CustomerAddOrUpdate |
AddOrUpdate, |
||||
|
CustomerAddOrUpdate |
||||
}, |
}, |
||||
computed: { |
computed: { |
||||
tableHeight () { |
tableHeight() { |
||||
// return this.resolution === 'small' ? this.clientHeight - 210 : this.clientHeight - 220 |
// return this.resolution === 'small' ? this.clientHeight - 210 : this.clientHeight - 220 |
||||
return this.clientHeight - 210 |
return this.clientHeight - 210; |
||||
}, |
}, |
||||
...mapGetters(['clientHeight', 'resolution']), |
...mapGetters(['clientHeight', 'resolution']) |
||||
}, |
}, |
||||
methods: { |
methods: { |
||||
showCustomerMenu (row) { |
search() { |
||||
|
if (this.menuName != '') { |
||||
|
let saveList = []; |
||||
|
this.onFuzzyTreeList('name', this.menuName, this.dataList, saveList); |
||||
|
this.$refs.form.data = saveList; |
||||
|
} else { |
||||
|
this.$refs.form.data = this.dataList; |
||||
|
} |
||||
|
}, |
||||
|
|
||||
this.selMenuName = row.name |
onFuzzyTreeList(key, value, treeList, saveList = []) { |
||||
this.$refs['customerForm'].init(row.id) |
return new Promise((resolve, reject) => { |
||||
|
treeList.forEach(item => { |
||||
|
if (item[key].indexOf(value) > -1) { |
||||
|
saveList.push(item); |
||||
|
} else { |
||||
|
if (item.children && item.children.length > 0) { |
||||
|
const _reData = this.onFuzzyTreeList(key, value, item.children, saveList); |
||||
|
if (_reData && _reData.length > 0) { |
||||
|
saveList.push({ |
||||
|
...item, |
||||
|
children: _reData |
||||
|
}); |
||||
} |
} |
||||
} |
} |
||||
} |
} |
||||
|
}); |
||||
|
resolve(saveList); |
||||
|
}); |
||||
|
}, |
||||
|
// search() { |
||||
|
// if (this.menuName == '') { |
||||
|
// this.getDataList(); |
||||
|
// } else { |
||||
|
// this.dataList = this.dataList.filter(item => { |
||||
|
// if (item.name.indexOf(this.menuName) !== -1) return item; |
||||
|
// }); |
||||
|
// } |
||||
|
// }, |
||||
|
handleSelectionChange(val) { |
||||
|
this.multipleSelection = []; |
||||
|
val.forEach(element => { |
||||
|
this.multipleSelection.push(element.id); |
||||
|
}); |
||||
|
console.log(this.multipleSelection); |
||||
|
}, |
||||
|
showCustomerMenu(row) { |
||||
|
this.selMenuName = row.name; |
||||
|
this.$refs['customerForm'].init(row.id); |
||||
|
}, |
||||
|
open(id) { |
||||
|
console.log('Aa'); |
||||
|
let menuIds = []; |
||||
|
if (id != '') { |
||||
|
menuIds = [id]; |
||||
|
} else { |
||||
|
if (this.multipleSelection.length > 0) { |
||||
|
menuIds = this.multipleSelection; |
||||
|
} else { |
||||
|
return this.$message.error('请选择菜单'); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
let params = { |
||||
|
menuIds: menuIds, |
||||
|
flagShow: 1 |
||||
|
}; |
||||
|
this.$http.post('/gov/access/menu/updateShow/', params).then(({ data: res }) => { |
||||
|
console.log(res); |
||||
|
if (res.code === 0) { |
||||
|
this.getDataList(); |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
close(id) { |
||||
|
let menuIds = []; |
||||
|
|
||||
|
if (id != '') { |
||||
|
menuIds = [id]; |
||||
|
} else { |
||||
|
if (this.multipleSelection.length > 0) { |
||||
|
menuIds = this.multipleSelection; |
||||
|
} else { |
||||
|
return this.$message.error('请选择菜单'); |
||||
|
} |
||||
|
} |
||||
|
let params = { |
||||
|
menuIds: menuIds, |
||||
|
flagShow: 0 |
||||
|
}; |
||||
|
this.$http.post('/gov/access/menu/updateShow/', params).then(({ data: res }) => { |
||||
|
console.log(res); |
||||
|
if (res.code === 0) { |
||||
|
this.getDataList(); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
}; |
||||
</script> |
</script> |
||||
|
<style> |
||||
|
.little-head { |
||||
|
border-bottom: dashed 1px #ccc; |
||||
|
line-height: 50px; |
||||
|
margin-bottom: 20px; |
||||
|
} |
||||
|
</style> |
||||
|
Loading…
Reference in new issue