Commit 1f1c3ab1 by xue_wengang

用户管理

parent e7a7a49f
import { post, postform } from "@/utils/http.js";
import base from "@/api/base";
//角色树状图
export const tree = params =>
post(`${base.alyIP}/sysrole/tree`, params);
//分配用户角色
export const insertUserRoles = params =>
post(`${base.alyIP}/sysuser/insertUserRoles`, params);
//新增(修改)用户角色
export const submit = params =>
postform(`${base.alyIP}/system/role/submit`, params);
//用户角色详情
export const detail = params =>
postform(`${base.alyIP}/system/role/detail`, params);
\ No newline at end of file
...@@ -339,7 +339,10 @@ ...@@ -339,7 +339,10 @@
width="100%" width="100%"
size="small" size="small"
v-if="listMode != 2" v-if="listMode != 2"
@selection-change="handleSelectionChange"
> >
<el-table-column type="selection" width="55" v-if="pageBs == 'queryUser'">
</el-table-column>
<el-table-column <el-table-column
align="center" align="center"
:min-width=" :min-width="
...@@ -519,7 +522,8 @@ ...@@ -519,7 +522,8 @@
style="font-size: 13px !important" style="font-size: 13px !important"
> >
<span <span
style="border: 1px solid rgb(64, 158, 255); padding: 0px 4px" v-if="columnTitle['gradeLev']" style="border: 1px solid rgb(64, 158, 255); padding: 0px 4px"
v-if="columnTitle['gradeLev']"
>{{ >{{
columnTitle["gradeLev"] == 10 columnTitle["gradeLev"] == 10
? "一般" ? "一般"
...@@ -530,6 +534,9 @@ ...@@ -530,6 +534,9 @@
> >
{{ scope.row[columnTitle.prop] }} {{ scope.row[columnTitle.prop] }}
</div> </div>
<div v-else-if="columnTitle.prop == 'openFlag'">
{{ scope.row[columnTitle.prop] == "1" ? "已开启" : "未开启" }}
</div>
<div v-else v-html="scope.row[columnTitle.prop]"> <div v-else v-html="scope.row[columnTitle.prop]">
{{ columnTitle.prop }} {{ columnTitle.prop }}
</div> </div>
...@@ -566,6 +573,15 @@ ...@@ -566,6 +573,15 @@
>修改</span >修改</span
> >
<span <span
@click="editRole(scope)"
class="edit"
style="margin-right: 16px"
v-if="
pageBs == 'queryUser'
"
>角色配置</span
>
<span
@click="gz(scope)" @click="gz(scope)"
class="dele" class="dele"
v-if="pageBs == 'zdryGl' || pageBs == 'dytj'" v-if="pageBs == 'zdryGl' || pageBs == 'dytj'"
...@@ -881,6 +897,9 @@ export default { ...@@ -881,6 +897,9 @@ export default {
}; };
}, },
methods: { methods: {
handleSelectionChange(row){
this.$emit('selectionChange',row)
},
EditCode() { EditCode() {
var self = this; var self = this;
if (this.zdyCodeEdit.length > 0) { if (this.zdyCodeEdit.length > 0) {
...@@ -1088,6 +1107,9 @@ export default { ...@@ -1088,6 +1107,9 @@ export default {
dele(scope) { dele(scope) {
this.$emit("dele", scope); this.$emit("dele", scope);
}, },
editRole(scope) {
this.$emit("editRole", scope);
},
add() { add() {
this.$emit("add"); this.$emit("add");
}, },
......
...@@ -8,7 +8,7 @@ const menuLayouts = [ ...@@ -8,7 +8,7 @@ const menuLayouts = [
isAdd: false, isAdd: false,
title: '用户管理' title: '用户管理'
}, },
component: () => import("@/views/userAuth/queryUser.vue") component: () => import("@/views/userAuth/user/queryUser.vue")
}, },
{ {
path: "/addUser", path: "/addUser",
...@@ -17,7 +17,7 @@ const menuLayouts = [ ...@@ -17,7 +17,7 @@ const menuLayouts = [
isAdd: true, isAdd: true,
title: '用户' title: '用户'
}, },
component: () => import("@/views/userAuth/addUser.vue") component: () => import("@/views/userAuth/user/addUser.vue")
}, },
{ {
path: "/userDetail", path: "/userDetail",
...@@ -26,7 +26,34 @@ const menuLayouts = [ ...@@ -26,7 +26,34 @@ const menuLayouts = [
isAdd: true, isAdd: true,
title: '用户详情' title: '用户详情'
}, },
component: () => import("@/views/userAuth/userDetail.vue") component: () => import("@/views/userAuth/user/userDetail.vue")
},
{
path: "/queryRole",
name: "queryRole",
meta: {
isAdd: false,
title: '角色管理'
},
component: () => import("@/views/userAuth/role/queryRole.vue")
},
{
path: "/addRole",
name: "addRole",
meta: {
isAdd: true,
title: '角色'
},
component: () => import("@/views/userAuth/role/addRole.vue")
},
{
path: "/roleDetail",
name: "roleDetail",
meta: {
isAdd: true,
title: '角色详情'
},
component: () => import("@/views/userAuth/role/roleDetail.vue")
} }
]; ];
export default { export default {
......
<template>
<div>
<form-compontent
:formField="propFormField"
:formLabelAligns="formLabelAlign"
@submit="submit"
:propTitle="title"
>
</form-compontent>
</div>
</template>
<script>
import formCompontent from "@c/form.vue";
import {
submit,
detail
} from "@/api/userAuth/role.js";
export default {
name: "addRole",
components: {
formCompontent,
},
data() {
return {
title: "角色新增",
propFormField: [
//基本信息
{
title: "新增角色",
id: 1,
objStr: "",
index: 0,
data: [
{
name: "角色单位:",
id: "unitcode",
type: "codeTree",
prop: "checkEmpty",
value: "",
placeholder: "请选择",
col: "2",
codeOptions: [],
codeTree: "QGCODE_UNIT",
},
{
name: "角色姓名:",
id: "username",
type: "text",
prop: "checkEmpty",
value: "",
placeholder: "请输入",
col: "2",
},
{
name: "密码:",
id: "password",
type: "text",
prop: "checkEmpty",
value: "",
placeholder: "请输入",
col: "2",
},
{
name: "真实姓名:",
id: "trueName",
type: "text",
prop: "checkEmpty",
value: "",
placeholder: "请输入",
col: "2",
},
{
name: "身份证:",
id: "identitycard",
type: "text",
prop: "checkEmpty",
value: "",
placeholder: "请输入",
col: "2",
},
{
name: "性别:",
id: "sex",
type: "codeTree",
prop: "checkEmpty",
value: "",
placeholder: "请选择",
col: "2",
codeOptions: [],
codeTree: "CODE_XB",
},
{
name: "生日:",
id: "birthday",
type: "dates",
disabled: false,
prop: "checkEmpty",
value: "",
placeholder: "请输入",
col: "2",
},
{
name: "电话:",
id: "telephone",
type: "text",
prop: "checkEmpty",
value: "",
placeholder: "请输入",
col: "2",
},
{
name: "警号:",
id: "policemanid",
type: "text",
prop: "checkEmpty",
value: "",
placeholder: "请输入",
col: "2",
},
{
name: "是否开启:",
id: "openFlag",
type: "radio",
value: "0",
placeholder: "请输入",
col: "2",
radioData: [
{ name: "是", value: "1" },
{ name: "否", value: "0" },
],
},
],
},
],
formLabelAlign: {},
stepList: [
{
title: "基本信息",
active: true,
},
{
title: "人员信息",
active: false,
},
{
title: "社会信息",
active: false,
},
],
Breadcrumb: [
{
name: "号码线索管理",
to: "/hmxsGl",
isActive: false,
},
{
name: "新增号码线索",
to: "/addHmxs",
isActive: true,
},
],
Loading: null,
};
},
methods: {
submit(params) {
let loading = this.$loading({
lock: true,
text: "正在保存...",
spinner: "el-icon-loading",
background: "rgba(255, 255, 255, 0.7)",
});
if (!this.xxzjbh) {
this.addSubmit(params, loading);
} else {
this.editSubmit(params, loading);
}
},
addSubmit(params, loading) {
insertUserNew(params).then((res) => {
if (res.success && res.code == 200) {
this.$alert("保存成功!", "提示", {
confirmButtonText: "确定",
type: "success",
callback: () => {
loading.close();
this.$router.push("queryUser");
},
});
} else {
this.$message.error("添加失败,请检查数据格式是否正确");
}
});
},
editSubmit(params, loading) {
params.append("id", this.xxzjbh);
updateUserXx(params).then((res) => {
if (res.success && res.code == 200) {
this.$alert("保存成功!", "提示", {
confirmButtonText: "确定",
type: "success",
callback: () => {
loading.close();
this.$router.push("queryUser");
},
});
} else {
this.$message.error("添加失败,请检查数据格式是否正确");
}
});
},
getshuju() {
var self = this;
getUserXxByxxzjbh({
id: this.xxzjbh,
}).then((res) => {
if (res.success && res.code == 200) {
var result = res.data.rows;
self.propFormField.forEach((fieldItem) => {
if (fieldItem.data && fieldItem.data.length > 0) {
fieldItem.data.forEach((i) => {
this.$set(this.formLabelAlign, i.id, result[i.id]);
});
}
this.$forceUpdate();
});
self.$forceUpdate();
}
setTimeout(() => {
self.Loading.close();
}, 500);
});
},
},
created() {
this.$store.commit("user/SET_Breadcrumb", this.breadcrumbList);
if (this.$route.query.xxzjbh) {
this.Loading = this.$loading({
lock: true,
text: "正在获取数据...",
spinner: "el-icon-loading",
background: "rgba(255, 255, 255, 0.7)",
});
this.title = "角色信息修改";
this.xxzjbh = this.$route.query.xxzjbh;
this.getshuju();
}
},
};
</script>
<style scoped lang="scss">
</style>
\ No newline at end of file
...@@ -19,33 +19,34 @@ ...@@ -19,33 +19,34 @@
<script> <script>
import rightContent from "@c/ptCxForm_components.vue"; import rightContent from "@c/ptCxForm_components.vue";
import { deleteUserNew } from "@/api/userAuth/addUser.js"; import { deleteUserNew } from "@/api/userAuth/addUser.js";
import { tree, insertUserRoles } from "@/api/userAuth/role.js";
export default { export default {
name: "jdcxsGl", name: "queryUser",
components: { components: {
rightContent rightContent,
}, },
data() { data() {
return { return {
header: "用户管理", header: "角色管理",
pageBs: "queryUser", pageBs: "queryRole",
cxFormData: { cxFormData: {
username: "", username: "",
limit: 10, limit: 10,
page: 1, page: 1,
policemanid:"" policemanid: "",
}, },
cxQueryField: [ cxQueryField: [
{ {
name: "用户名", name: "角色别名",
id: "username", id: "roleAlias",
type: "text", type: "text",
value: "", value: "",
placeholder: "", placeholder: "",
col: "3", col: "3",
}, },
{ {
name: "警号", name: "角色名称",
id: "policemanid", id: "roleName",
type: "text", type: "text",
value: "", value: "",
placeholder: "", placeholder: "",
...@@ -53,33 +54,25 @@ export default { ...@@ -53,33 +54,25 @@ export default {
}, },
], ],
cxDefaultFormThead: [ cxDefaultFormThead: [
{
label: "登录名",
prop: "username",
},
{
label: "用户姓名",
prop: "trueName",
},
{ {
label: "用户单位", label: "菜单权限",
prop: "unitname" prop: "menuString",
}, },
{ {
label: "警号", label: "ID",
prop: "policemanid", prop: "id",
}, },
{ {
label: "用户状态", label: "角色名称",
prop: "openFlag", prop: "roleName",
}, },
], ],
cxUrl: "/sysuser/selectUserNewList", cxUrl: "/sysrole/selectRoleList",
Menu: [ Menu: [
{ {
id: "queryUser", id: "queryRole",
label: "用户管理", label: "角色管理",
index: "queryUser", index: "queryRole",
auth: "M0101", auth: "M0101",
className: "iconfont iconrizhi", className: "iconfont iconrizhi",
disabled: false, disabled: false,
...@@ -91,10 +84,18 @@ export default { ...@@ -91,10 +84,18 @@ export default {
this.$store.commit("user/SET_Menu", this.Menu); this.$store.commit("user/SET_Menu", this.Menu);
}, },
methods: { methods: {
handleCheckChange(data, checked) {
if (checked === true) {
this.selectedTree.push(data.id);
} else {
let index = this.selectedTree.findIndex((item) => item == data.id);
this.selectedTree.splice(index, 1);
}
},
add() { add() {
this.$router.pushToTab("addUser"); this.$router.pushToTab("addRole");
}, },
toInfor(obj) { toInfor(obj) {
this.$router.push({ this.$router.push({
path: "/detailSwtz", path: "/detailSwtz",
query: { query: {
......
<template>
<div class="Content">
<right-content
:pageBs="pageBs"
:header="header"
:cxFormData="cxFormData"
:cxQueryField="cxQueryField"
:cxDefaultFormThead="cxDefaultFormThead"
:cxUrl="cxUrl"
ref="rightContent"
@add="add"
@dele="dele"
@toInfor="toInfor"
@edit="edit"
@editRole="editRole"
@selectionChange="selectionChange"
></right-content>
<el-dialog
title="角色管理"
:visible.sync="dialogVisible"
width="30%"
:before-close="handleClose"
>
<el-tree
:data="treeData"
show-checkbox
node-key="id"
ref="tree"
highlight-current
:props="defaultProps"
@check-change="handleCheckChange"
>
</el-tree>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false">取 消</el-button>
<el-button type="primary" @click="submitRole">确 定</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import rightContent from "@c/ptCxForm_components.vue";
import { deleteUserNew } from "@/api/userAuth/addUser.js";
import { tree, insertUserRoles } from "@/api/userAuth/role.js";
export default {
name: "queryUser",
components: {
rightContent,
},
data() {
return {
header: "用户管理",
pageBs: "queryUser",
cxFormData: {
username: "",
limit: 10,
page: 1,
policemanid: "",
},
cxQueryField: [
{
name: "用户名",
id: "username",
type: "text",
value: "",
placeholder: "",
col: "3",
},
{
name: "警号",
id: "policemanid",
type: "text",
value: "",
placeholder: "",
col: "3",
},
],
cxDefaultFormThead: [
{
label: "登录名",
prop: "username",
},
{
label: "用户姓名",
prop: "trueName",
},
{
label: "用户单位",
prop: "unitname",
},
{
label: "警号",
prop: "policemanid",
},
{
label: "用户状态",
prop: "openFlag",
},
],
cxUrl: "/sysuser/selectUserNewList",
Menu: [
{
id: "queryUser",
label: "用户管理",
index: "queryUser",
auth: "M0101",
className: "iconfont iconrizhi",
disabled: false,
},
],
dialogVisible: false,
treeData: [],
defaultProps: {
children: "children",
label: "title",
},
selectedId: [],
selectedTree: [],
leftMenus: [
//左侧导航(模块第一个页面需要)
{
id: "queryUser",
label: "用户信息管理",
newAuth: "M01",
index: "queryUser",
className: "iconfont icongongnengfuwu",
hasChildren: false,
},
{
id: "queryRole",
label: "角色信息管理",
newAuth: "M01",
index: "queryRole",
className: "iconfont icongongnengfuwu",
hasChildren: false,
},
],
};
},
created() {
this.$store.commit("user/SET_Menu", this.Menu);
this.$store.commit("user/SET_LeftMenu", this.leftMenus);
this.$store.commit("user/SET_Header", this.header);
this.getTree();
},
methods: {
submitRole() {
if (this.selectedTree.length > 0) {
insertUserRoles({
roleIds: this.selectedTree.toString(),
userIds: this.selectedId.toString(),
}).then((res) => {
this.$message.success("权限新增成功");
this.dialogVisible = false;
});
} else {
this.$message.error("请选择用户权限");
}
},
editRole() {
if (this.selectedId.length > 0) {
this.dialogVisible = true;
} else {
this.$message.error("请选择用户");
}
},
getTree() {
tree().then((res) => {
this.treeData = res.data.rows;
});
},
selectionChange(row) {
this.selectedId = [];
row.forEach((item) => {
this.selectedId.push(item.id);
});
},
handleCheckChange(data, checked) {
if (checked === true) {
this.selectedTree.push(data.id);
} else {
let index = this.selectedTree.findIndex((item) => item == data.id);
this.selectedTree.splice(index, 1);
}
},
handleClose() {},
add() {
this.$router.pushToTab("addUser");
},
toInfor(obj) {
this.$router.push({
path: "/detailSwtz",
query: {
id: obj.xxzjbh,
},
});
},
edit(obj) {
this.$router.push({
path: "/addUser",
query: {
xxzjbh: obj.row.id,
},
});
},
dele(obj) {
this.$confirm("此操作将永久删除该用户, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
deleteUserNew({
id: obj.row.id,
}).then((res) => {
if (res.success && res.code == 200) {
this.$message({
type: "success",
message: "删除成功",
});
this.$refs.rightContent.doQuery("yes");
}
});
})
.catch(() => {
this.$message({
type: "info",
message: "已取消删除",
});
});
},
},
};
</script>
<style>
.el-dialog__body {
padding: 10px 15px !important;
}
.rightContent .el-input__inner,
#formCommonPage .el-input__inner {
height: 32px;
line-height: 32px;
font-family: inherit;
}
.el-table__header-wrapper th,
.el-table__header-wrapper tr {
background: #f4f6f7;
}
.rightContent .el-input__icon,
#formCommonPage .el-input__icon,
.el-input__suffix-inner {
line-height: 36px;
}
.rightContent .el-range-separator {
position: relative;
top: -4px;
}
.rightContent .el-textarea__inner,
#formCommonPage .el-textarea__inner {
width: 100%;
font-family: inherit;
}
.rightContent .el-range-input,
#formCommonPage .el-range-input {
vertical-align: top;
}
.rightContent .el-date-editor .el-range__close-icon {
margin-top: -4px;
}
.rightContent .el-form-item__error {
left: calc(66% - 27px);
top: 12px;
}
.success-row {
background-color: #fbf9f4 !important;
}
.Content .el-input,
.Content .el-date-editor--daterange.el-input__inner {
width: 100% !important;
}
</style>
<style scoped lang="scss">
@import "@/assets/styles/rightContent.scss";
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment