4 changed files with 542 additions and 387 deletions
@ -1,129 +1,216 @@ |
|||
<template> |
|||
<el-card shadow="never" |
|||
class="aui-card--fill"> |
|||
<el-card shadow="never" class="aui-card--fill"> |
|||
<div class="mod-sys__menu"> |
|||
<el-form :inline="true" |
|||
:model="dataForm" |
|||
@keyup.enter.native="getDataList()"> |
|||
<el-form :inline="true" @keyup.enter.native="search()"> |
|||
<el-form-item><el-input v-model="menuName" placeholder="请输入菜单名称" :clearable="true"></el-input></el-form-item> |
|||
<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-button type="primary" |
|||
@click="addOrUpdateHandle()">{{ $t('add') }}</el-button> |
|||
<el-button type="primary" @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> |
|||
<el-table v-loading="dataListLoading" |
|||
<el-table |
|||
@selection-change="handleSelectionChange" |
|||
v-loading="dataListLoading" |
|||
ref="form" |
|||
:data="dataList" |
|||
row-key="id" |
|||
border |
|||
:height="tableHeight" |
|||
style="width: 100%;"> |
|||
<el-table-column prop="name" |
|||
:label="$t('menu.name')" |
|||
header-align="center" |
|||
min-width="150"></el-table-column> |
|||
<el-table-column prop="icon" |
|||
:label="$t('menu.icon')" |
|||
header-align="center" |
|||
align="center"> |
|||
style="width: 100%;" |
|||
> |
|||
<el-table-column label="" fixed="left" type="selection" align="center" width="50" /> |
|||
<el-table-column label="序号" fixed="left" type="index" align="center" width="50" /> |
|||
<el-table-column prop="name" :label="$t('menu.name')" header-align="center" min-width="150"></el-table-column> |
|||
<el-table-column prop="icon" :label="$t('menu.icon')" header-align="center" align="center"> |
|||
<template slot-scope="scope"> |
|||
<svg class="icon-svg" |
|||
aria-hidden="true"> |
|||
<use :xlink:href="`#${scope.row.icon}`"></use> |
|||
</svg> |
|||
<svg class="icon-svg" aria-hidden="true"><use :xlink:href="`#${scope.row.icon}`"></use></svg> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column prop="type" |
|||
:label="$t('menu.type')" |
|||
header-align="center" |
|||
align="center"> |
|||
<el-table-column prop="type" :label="$t('menu.type')" header-align="center" align="center"> |
|||
<template slot-scope="scope"> |
|||
<el-tag v-if="scope.row.type === 0" |
|||
size="small">{{ $t('menu.type0') }}</el-tag> |
|||
<el-tag v-else |
|||
size="small" |
|||
type="info">{{ $t('menu.type1') }}</el-tag> |
|||
<el-tag v-if="scope.row.type === 0" size="small">{{ $t('menu.type0') }}</el-tag> |
|||
<el-tag v-else size="small" type="info">{{ $t('menu.type1') }}</el-tag> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column prop="sort" |
|||
:label="$t('menu.sort')" |
|||
header-align="center" |
|||
align="center"></el-table-column> |
|||
<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" |
|||
<el-table-column prop="sort" :label="$t('menu.sort')" header-align="center" align="center"></el-table-column> |
|||
<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')" |
|||
header-align="center" |
|||
align="center" |
|||
width="150" |
|||
:show-overflow-tooltip="true"></el-table-column> |
|||
<el-table-column :label="$t('handle')" |
|||
fixed="right" |
|||
header-align="center" |
|||
align="center" |
|||
width="150"> |
|||
:show-overflow-tooltip="true" |
|||
></el-table-column> |
|||
<el-table-column prop="showFlag" label="菜单类型" header-align="center" align="center"> |
|||
<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> |
|||
基础应用 |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column prop="type" :label="$t('状态')" header-align="center" align="center"> |
|||
<template slot-scope="scope"> |
|||
<el-tag v-if="scope.row.showFlag === 0" size="small" type="info">{{ $t('menu.status0') }}</el-tag> |
|||
<el-tag v-else size="small">{{ $t('menu.status1') }}</el-tag> |
|||
</template> |
|||
</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> |
|||
</el-table-column> |
|||
</el-table> |
|||
<!-- 弹窗, 新增 / 修改 --> |
|||
<add-or-update v-if="addOrUpdateVisible" |
|||
ref="addOrUpdate" |
|||
:tableName="'data_menu'" |
|||
@refreshDataList="getDataList"></add-or-update> |
|||
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" :tableName="'data_menu'" @refreshDataList="getDataList"></add-or-update> |
|||
<!-- 客户菜单配置 --> |
|||
<customer-add-or-update ref="customerForm" |
|||
:menuName="selMenuName" |
|||
@refreshDataList="getDataList"></customer-add-or-update> |
|||
<customer-add-or-update ref="customerForm" :menuName="selMenuName" @refreshDataList="getDataList"></customer-add-or-update> |
|||
</div> |
|||
</el-card> |
|||
</template> |
|||
|
|||
<script> |
|||
import mixinViewModule from '@/mixins/view-module' |
|||
import AddOrUpdate from './menu-add-or-update' |
|||
import { mapGetters } from 'vuex' |
|||
import CustomerAddOrUpdate from './customer-add-or-update' |
|||
import mixinViewModule from '@/mixins/view-module'; |
|||
import AddOrUpdate from './menu-add-or-update'; |
|||
import { mapGetters } from 'vuex'; |
|||
import CustomerAddOrUpdate from './customer-add-or-update'; |
|||
export default { |
|||
mixins: [mixinViewModule], |
|||
data () { |
|||
data() { |
|||
return { |
|||
menuName: '', |
|||
multipleSelection: [], |
|||
mixinViewModuleOptions: { |
|||
getDataListURL: '/gov/access/menu/list', |
|||
deleteURL: '/gov/access/menu' |
|||
}, |
|||
customerFormVisible: false, |
|||
dataForm: { "tableName": 'data_menu' }, |
|||
dataForm: { tableName: 'data_menu' }, |
|||
selMenuName: '' |
|||
} |
|||
}; |
|||
}, |
|||
components: { |
|||
AddOrUpdate, CustomerAddOrUpdate |
|||
AddOrUpdate, |
|||
CustomerAddOrUpdate |
|||
}, |
|||
computed: { |
|||
tableHeight () { |
|||
tableHeight() { |
|||
// 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: { |
|||
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 |
|||
this.$refs['customerForm'].init(row.id) |
|||
onFuzzyTreeList(key, value, treeList, saveList = []) { |
|||
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> |
|||
<style> |
|||
.little-head { |
|||
border-bottom: dashed 1px #ccc; |
|||
line-height: 50px; |
|||
margin-bottom: 20px; |
|||
} |
|||
</style> |
|||
|
Loading…
Reference in new issue