Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Fedex
/
EcomWeb
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
zhengquan.bai
2024-12-19 18:04:09 +0800
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
1ad688bf3b69c889acba85b661080421688905b8
1ad688bf
2 parents
9325b199
dc344cb3
Merge branch 'dev-ver1.0.0' of
http://118.178.128.178/Fedex/EcomWeb
into dev-ver1.0.0
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
600 additions
and
5 deletions
src/api/menu.js
src/api/system/user.js
src/views/exportTransportBillQuery/index.vue
src/views/roleConfig/dialog.vue
src/views/roleConfig/index.vue
src/api/menu.js
View file @
1ad688b
...
...
@@ -3,7 +3,8 @@ import request from '@/utils/request'
// 获取路由
export
const
getRouters
=
()
=>
{
return
request
({
url
:
'/
manager-server/menu/list
'
,
url
:
'/
bus-customer/menu/selectMenu
'
,
method
:
'get'
})
}
\ No newline at end of file
}
...
...
src/api/system/user.js
View file @
1ad688b
...
...
@@ -6,4 +6,56 @@ export function getInfo() {
url
:
'/manager-server/sysUser/getCurrentUser'
,
method
:
'get'
})
}
// 获取角色列表
/**
* @param roleName 角色名
* @param pageNum *
* @param pageSize *
*/
export
function
getRoleList
(
data
)
{
return
request
({
url
:
'/bus-customer/role/getRoleList'
,
method
:
'get'
,
params
:
data
})
}
// 新增角色
/**
* @param roleName 角色名
*/
export
function
addRoleData
(
data
)
{
return
request
({
url
:
'/bus-customer/role/addRole'
,
method
:
'post'
,
data
:
data
})
}
// 更新角色
/**
* @param roleName * 角色名
* @param roleId * 角色id
*/
export
function
updateRoleData
(
data
)
{
return
request
({
url
:
'/bus-customer/role/updateRole'
,
method
:
'put'
,
data
:
data
})
}
// 更新角色
/**
* @param menuId * 权限菜单
* @param roleId * 角色id
*/
export
function
updateRoleMenuData
(
data
)
{
return
request
({
url
:
'/bus-customer/role/roleBindingMenus'
,
method
:
'post'
,
data
:
data
})
}
\ No newline at end of file
...
...
src/views/exportTransportBillQuery/index.vue
View file @
1ad688b
...
...
@@ -234,19 +234,19 @@ export default {
},
{
name: "创建时间",
value: "",
value: "
createTime
",
width: "",
align: "left",
},
{
name: "申报企业",
value: "",
value: "
agentName
",
width: "",
align: "left",
},
{
name: "申报类型",
value: "",
value: "
appType
",
width: "",
align: "left",
},
...
...
src/views/roleConfig/dialog.vue
0 → 100644
View file @
1ad688b
<template>
<el-dialog
class="entryDialog classCUploadDialog"
:title="title"
:visible.sync="outerVisible"
:show-close="false"
width="25%"
:close-on-click-modal="false"
v-loading="loadings.dialogLoading"
@close="close"
>
<div class="modelItem">
<el-form
v-if="type != 'menuChange'"
class="fedexFormStyle"
ref="formData"
:model="formData"
:rules="rules"
label-position="top"
size="small"
>
<Formitem label="角色名称" prop="roleName" type="edit">
<el-input
type="text"
class="inputShadow"
id="inputInner-edit-roleName"
resize="none"
v-model="formData.roleName"
clearable
placeholder=""
></el-input>
</Formitem>
</el-form>
<el-tree
class="menuTree"
v-else
:data="treeData"
show-checkbox
default-expand-all
node-key="id"
:default-expanded-keys="expandedKeys"
:default-checked-keys="checkedKeys"
:props="defaultProps"
@check="treeCheckChange"
>
</el-tree>
</div>
<div class="dialogOption entrySave">
<el-button
class="entrySaveButton"
:disabled="loadings.submitLoading"
@click="submit"
>确 定</el-button
>
<el-button
class="entrySaveButton"
:disabled="loadings.uploadLoading"
@click="close"
>关 闭</el-button
>
</div>
</el-dialog>
</template>
<script>
import {
addRoleData,
updateRoleData,
updateRoleMenuData,
} from "@/api/system/user.js";
import { getRouters } from "@/api/menu";
export default {
props: {
outerVisible: {
type: Boolean,
default: false,
},
title: {
type: String,
default: "新增角色",
},
type: {
type: String,
default: "",
},
active: {
type: Object,
default: null,
},
},
watch: {
outerVisible(val) {
if (val) {
}
},
},
data() {
return {
formData: {
roleName: "",
},
treeData: [],
treeCheckData: [],
expandedKeys: [],
checkedKeys: [],
rules: {
roleName: [
{
required: true,
trigger: "blur",
message: "角色名称不能为空!",
},
],
},
defaultProps: {
children: "children",
label: "label",
},
searchForm: {},
loadings: {
dialogLoading: false,
uploadLoading: false,
submitLoading: false,
},
loadingText: "",
};
},
watch: {
outerVisible(val) {
if (val) {
this.loadings.dialogLoading = false;
if (this.type == "update") {
this.formData = this.active;
} else if (this.type == "menuChange") {
this.formData = this.active;
this.searchTreeData();
}
}
},
},
methods: {
//查询菜单数据
searchTreeData() {
this.loadings.dialogLoading = true;
getRouters()
.then((res) => {
if (res.code === "200") {
let arr = [];
res.data.forEach((item) => {
let status = true;
if (item.parentMenuId == 0) {
let obj = {
id: item.menuId,
label: item.menuName,
children: [],
};
arr.forEach((menuItem) => {
if (menuItem.id == item.menuId) {
status = false;
menuItem.label = item.menuName;
}
});
if (status) {
arr.push(obj);
}
} else {
let obj = {
id: item.menuId,
label: item.menuName,
};
arr.forEach((menuItem) => {
if (menuItem.id == item.parentMenuId) {
status = false;
menuItem.children.push(obj);
}
});
if (status) {
arr.push({
id: item.parentMenuId,
label: "",
children: [obj],
});
}
}
});
this.treeData = arr;
} else {
this.alertWarningMsg(res.message);
}
this.loadings.dialogLoading = false;
})
.catch((err) => {
console.log(err);
this.loadings.dialogLoading = false;
});
},
//数据保存
submit() {
this.loadings.dialogLoading = true;
let obj = {};
if (this.type == "add") {
this.$refs.formData.validate((valid) => {
if (valid) {
obj.roleName = this.formData.roleName;
this.addapi(obj);
} else {
this.loadings.dialogLoading = false;
}
});
} else if (this.type == "update") {
this.$refs.formData.validate((valid) => {
if (valid) {
obj.roleId = this.formData.roleId;
obj.roleName = this.formData.roleName;
this.updateapi(obj);
} else {
this.loadings.dialogLoading = false;
}
});
} else if (this.type == "menuChange") {
obj.menuId = this.treeCheckData;
obj.roleId = this.formData.roleId;
this.menuChangeapi(obj);
}
},
//新增
addapi(val) {
addRoleData(val)
.then((res) => {
if (res.code === "200") {
this.msgSuccess(res.message);
this.close();
} else {
this.alertWarningMsg(res.message);
this.loadings.dialogLoading = false;
}
})
.catch((err) => {
console.log(err);
this.loadings.dialogLoading = false;
});
},
//修改
updateapi(val) {
updateRoleData(val)
.then((res) => {
if (res.code === "200") {
this.msgSuccess(res.message);
this.close();
} else {
this.alertWarningMsg(res.message);
this.loadings.dialogLoading = false;
}
})
.catch((err) => {
console.log(err);
this.loadings.dialogLoading = false;
});
},
//菜单权限修改
menuChangeapi(val) {
updateRoleMenuData(val)
.then((res) => {
if (res.code === "200") {
this.msgSuccess(res.message);
this.close();
} else {
this.alertWarningMsg(res.message);
this.loadings.dialogLoading = false;
}
})
.catch((err) => {
console.log(err);
this.loadings.dialogLoading = false;
});
},
treeCheckChange(data, checked) {
console.log(data, checked);
this.treeCheckData = checked.checkedKeys;
},
close() {
this.formData = {
roleName: "",
};
this.$emit("close");
},
},
};
</script>
<style lang="scss" scoped>
@import "@/assets/styles/variables.scss";
.menuTree {
max-width: 350px;
max-height: 300px;
overflow: auto;
margin: 0 auto;
border: 1px solid #999;
padding: 10px;
}
</style>
src/views/roleConfig/index.vue
View file @
1ad688b
<template>
<div class="entrySreach">
<el-form
class="fedexFormStyle fedexformSreach fedexformSreachBottomBorder"
ref="sreachForm"
:model="sreachFormData"
label-position="top"
size="small"
>
<el-row class="row-border">
<!-- 角色名称 -->
<el-col :span="5">
<Formitem label="角色名称" prop="roleName">
<el-input
type="text"
class="inputShadow"
id="inputInner--roleName"
resize="none"
v-model="sreachFormData.roleName"
clearable
placeholder=""
></el-input>
</Formitem>
</el-col>
<el-col :span="2">
<el-form-item class="textCenter">
<el-button
class="entrySreachButton"
type="text"
icon="el-icon-search"
:loading="loadings.searchLoading"
@click="search(0)"
></el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div class="optionButton">
<el-button
class="entrySaveButton"
icon="el-icon-plus"
size="small"
@click="addRole"
>
新增角色
</el-button>
</div>
<Table
class="fedexDetialTable fedexSreachTable"
ref="entryTable"
:data="tableData"
:headerData="headerData"
:maxHeight="tableMaxheight"
:border="true"
:pagination="true"
:order="false"
:loading="loadings.searchLoading"
:page="page.pageIndex"
:pageSizes="[20, 30, 50, 100]"
:totalCount="page.total"
@sizeChange="sizeChange"
@currentChange="currentChange"
:selection="false"
:selectFixed="false"
:rowSelectDataType="false"
>
<template slot="optionColumn">
<el-table-column align="left" label="操作">
<template slot-scope="scope">
<el-button type="text" @click="update(scope.row)">
角色修改
</el-button>
<el-button type="text" @click="muenChange(scope.row)">
权限绑定
</el-button>
</template>
</el-table-column>
</template>
</Table>
<DialogVue
:outerVisible="outerVisible"
:title="dialogTitle"
:type="editType"
:active="activeData"
@close="dialogClose"
/>
</div>
</template>
<script>
import { getRoleList, addRoleDataf } from "@/api/system/user.js";
import DialogVue from "./dialog.vue";
export default {
name: "RoleConfig",
components: {
DialogVue,
},
data() {
return {
sreachFormData: {
roleName: "",
},
page: {
pageIndex: 1,
pageSize: 20,
total: 0,
},
activeData: null,
tableData: [],
headerData: [
{
name: "角色名",
value: "roleName",
width: "",
align: "left",
},
],
loadings: {
searchLoading: false,
},
tableMaxheight: null,
outerVisible: false,
dialogTitle: "",
editType: "",
};
},
created() {
this.search(0);
},
mounted() {
this.tableMaxheight = window.innerHeight - 300;
},
methods: {
//查询
search(val) {
this.loadings.searchLoading = true;
if (val == 0) {
this.page.pageIndex = 1;
}
let obj = this.sreachFormData;
obj.pageIndex = this.page.pageIndex;
obj.pageSize = this.page.pageSize;
getRoleList(obj)
.then((res) => {
if (res.code === "200") {
this.tableData = res.data.value;
this.page.total = res.data.totalItems;
this.tableData.forEach((item, idx) => {
item.index = idx;
});
} else {
this.alertWarningMsg(res.message);
}
this.loadings.searchLoading = false;
})
.catch((err) => {
console.log(err);
this.loadings.searchLoading = false;
});
},
addRole() {
this.dialogTitle = "新增角色";
this.editType = "add";
this.outerVisible = true;
},
update(val) {
this.dialogTitle = "修改角色";
this.editType = "update";
this.outerVisible = true;
this.activeData = val;
},
muenChange(val) {
this.dialogTitle = "绑定权限";
this.editType = "menuChange";
this.outerVisible = true;
this.activeData = val;
},
dialogClose() {
this.outerVisible = false;
this.activeData = null;
},
//分页
currentChange(val) {
this.page.pageNum = val.page;
this.search(1);
},
sizeChange(val) {
this.page.pageSize = val;
this.search(1);
},
input() {
this.$forceUpdate();
},
},
};
</script>
<style scoped lang="scss">
@import "@/assets/styles/variables.scss";
.entrySreach {
height: 100%;
background-color: $menuLightBg;
.entrySreachButton {
display: inline-block;
font-size: 20px;
color: $fedexButton !important;
}
.optionButton {
padding: 10px;
text-align: left;
.el-button {
color: $fedexButton;
border-color: $fedexButton !important;
svg {
display: inline-block;
margin-right: 5px;
fill: $fedexButton;
}
}
.entrySaveButton:hover,
.entrySaveButton:focus {
color: $menuLightBg !important;
background-color: $fedexButton !important;
}
}
}
.texttareaTip {
position: absolute;
top: 52%;
right: 20px;
transform: translate(0, -50%);
z-index: 10;
}
</style>
...
...
Please
register
or
login
to post a comment