Commit 334f552d authored by renjintao's avatar renjintao

user

parent 4b8c76f6
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
:conditions="easySearch" :conditions="easySearch"
placeholder="请输入姓名或者员工编号进行搜索" placeholder="请输入姓名或者员工编号进行搜索"
:high="true" :high="true"
:height="tdHeight"
> >
<template slot="searchForm"> <template slot="searchForm">
<Search /> <Search />
...@@ -119,14 +120,14 @@ ...@@ -119,14 +120,14 @@
</Layout> </Layout>
</template> </template>
<script> <script>
import Api from './api' import Api from "./api";
import Add from './add' import Add from "./add";
import Edit from './edit' import Edit from "./edit";
import Detail from './detail' import Detail from "./detail";
import Search from './search' import Search from "./search";
import service from '@/plugins/request' import service from "@/plugins/request";
export default { export default {
name: 'list', name: "list",
components: { components: {
Add, Add,
Edit, Edit,
...@@ -139,16 +140,17 @@ export default { ...@@ -139,16 +140,17 @@ export default {
easySearch: { easySearch: {
keys: { keys: {
op: op:
'userName,cardNo,national,phone,email,enableEquip,jobNo,remark,departmentTitle,roleTitles', "userName,cardNo,national,phone,email,enableEquip,jobNo,remark,departmentTitle,roleTitles",
value: null, value: null,
default: true default: true
}, },
departmentId: { op: 'In', value: '' } departmentId: { op: "In", value: "" }
}, },
treeData: [], treeData: [],
treeInputSearch: '', tdHeight: "",
treeHeight: '', treeInputSearch: "",
tableHeight: '', treeHeight: "",
tableHeight: "",
show7: false, //重置密码 show7: false, //重置密码
show3: false, //授权角色 show3: false, //授权角色
authList: [], authList: [],
...@@ -168,24 +170,24 @@ export default { ...@@ -168,24 +170,24 @@ export default {
// width: 80, // width: 80,
// align: 'center' // align: 'center'
// }, // },
{ key: 'id', title: this.l('id'), hide: true, align: 'left' }, { key: "id", title: this.l("id"), hide: true, align: "left" },
{ {
key: 'userName', key: "userName",
title: this.l('userName'), title: this.l("userName"),
align: 'left', align: "left",
easy: true, easy: true,
high: true, high: true,
render: (h, params) => { render: (h, params) => {
return h('div', { class: 'action' }, [ return h("div", { class: "action" }, [
h( h(
'op', "op",
{ {
attrs: { oprate: 'detail' }, attrs: { oprate: "detail" },
on: { click: () => this.detail(params.row.id) } on: { click: () => this.detail(params.row.id) }
}, },
params.row.userName params.row.userName
) )
]) ]);
} }
}, },
// { // {
...@@ -196,106 +198,106 @@ export default { ...@@ -196,106 +198,106 @@ export default {
// hide: true // hide: true
// }, // },
{ {
key: 'cardNo', key: "cardNo",
title: this.l('cardNo'), title: this.l("cardNo"),
align: 'left', align: "left",
easy: true, easy: true,
high: true high: true
}, },
{ {
key: 'gender', key: "gender",
title: this.l('gender'), title: this.l("gender"),
align: 'center', align: "center",
high: true, high: true,
code: 'User.base.gender' code: "User.base.gender"
}, },
{ {
key: 'birthday', key: "birthday",
title: this.l('birthday'), title: this.l("birthday"),
align: 'center', align: "center",
high: true, high: true,
hide: true, hide: true,
type: 'date' type: "date"
}, },
{ {
key: 'degreeId', key: "degreeId",
title: this.l('degreeId'), title: this.l("degreeId"),
align: 'left', align: "left",
high: true, high: true,
code: 'User.base.degree', code: "User.base.degree",
hide: true hide: true
}, },
{ {
key: 'status', key: "status",
title: this.l('status'), title: this.l("status"),
align: 'center', align: "center",
high: true, high: true,
code: 'User.base.status' code: "User.base.status"
}, },
{ {
key: 'departmentTitle', key: "departmentTitle",
title: this.l('departmentTitle'), title: this.l("departmentTitle"),
align: 'left', align: "left",
easy: true, easy: true,
high: true high: true
}, },
{ {
key: 'roleTitles', key: "roleTitles",
title: this.l('roleTitles'), title: this.l("roleTitles"),
align: 'left', align: "left",
easy: true, easy: true,
high: true, high: true,
render: (h, params) => { render: (h, params) => {
return h('div', { class: 'action' }, [ return h("div", { class: "action" }, [
h( h(
'op', "op",
{ {
attrs: { attrs: {
oprate: 'detail', oprate: "detail",
class: class:
params.row.roleTitles == null || params.row.roleTitles == null ||
params.row.roleTitles == '' params.row.roleTitles == ""
? 'empower' ? "empower"
: 'detail' : "detail"
}, },
on: { click: () => this.authorize(params.row.id) } on: { click: () => this.authorize(params.row.id) }
}, },
params.row.roleTitles == null || params.row.roleTitles == '' params.row.roleTitles == null || params.row.roleTitles == ""
? '授权' ? "授权"
: params.row.roleTitles : params.row.roleTitles
) )
]) ]);
} }
}, },
{ {
key: 'creatorUserId', key: "creatorUserId",
title: this.l('creatorUserId'), title: this.l("creatorUserId"),
hide: true, hide: true,
align: 'left' align: "left"
}, },
{ {
key: 'creationTime', key: "creationTime",
title: this.l('creationTime'), title: this.l("creationTime"),
hide: true, hide: true,
align: 'left' align: "left"
}, },
{ {
key: 'lastModifierUserId', key: "lastModifierUserId",
title: this.l('lastModifierUserId'), title: this.l("lastModifierUserId"),
hide: true, hide: true,
align: 'left' align: "left"
}, },
{ {
key: 'lastModificationTime', key: "lastModificationTime",
title: this.l('lastModificationTime'), title: this.l("lastModificationTime"),
hide: true, hide: true,
align: 'left' align: "left"
}, },
{ {
key: 'accountId', key: "accountId",
title: this.l('accountId'), title: this.l("accountId"),
hide: true, hide: true,
align: 'left' align: "left"
}, },
// { // {
// key: 'userType', // key: 'userType',
...@@ -304,137 +306,146 @@ export default { ...@@ -304,137 +306,146 @@ export default {
// align: 'left' // align: 'left'
// }, // },
{ {
key: 'phone', key: "phone",
title: this.l('phone'), title: this.l("phone"),
align: 'left', align: "left",
easy: true, easy: true,
high: true high: true
}, },
{ {
key: 'email', key: "email",
title: this.l('email'), title: this.l("email"),
align: 'left', align: "left",
easy: true, easy: true,
high: true, high: true,
hide: true hide: true
}, },
{ {
key: 'licensedToWork', key: "licensedToWork",
title: this.l('licensedToWork'), title: this.l("licensedToWork"),
align: 'left', align: "left",
hide: true hide: true
}, },
{ {
key: 'positionId', key: "positionId",
title: this.l('positionId'), title: this.l("positionId"),
align: 'left', align: "left",
high: true, high: true,
code: 'User.base.position', code: "User.base.position",
hide: true hide: true
}, },
{ {
key: 'titleId', key: "titleId",
title: this.l('titleId'), title: this.l("titleId"),
align: 'left', align: "left",
high: true, high: true,
code: 'User.base.jobtitle', code: "User.base.jobtitle",
hide: true hide: true
}, },
{ {
title: '操作', title: "操作",
key: 'action', key: "action",
width: 180, width: 180,
align: 'right', align: "right",
render: (h, params) => { render: (h, params) => {
return h('div', { class: 'action' }, [ return h("div", { class: "action" }, [
h( h(
'op', "op",
{ {
attrs: { attrs: {
oprate: 'detail', oprate: "detail",
class: 'empower' class: "empower"
}, },
on: { click: () => this.syncAccount(params.row) } on: { click: () => this.syncAccount(params.row) }
}, },
params.row.accountId == 0 ? '同步' : '' params.row.accountId == 0 ? "同步" : ""
), ),
h( h(
'op', "op",
{ {
attrs: { oprate: 'edit' }, attrs: { oprate: "edit" },
on: { click: () => this.edit(params.row.id) } on: { click: () => this.edit(params.row.id) }
}, },
'编辑' "编辑"
), ),
h( h(
'op', "op",
{ {
attrs: { oprate: 'remove' }, attrs: { oprate: "remove" },
on: { click: () => this.remove(params.row) } on: { click: () => this.remove(params.row) }
}, },
'删除' "删除"
), ),
h( h(
'op', "op",
{ {
attrs: { attrs: {
oprate: 'detail' oprate: "detail"
}, },
on: { click: () => this.openReset(params.row) } on: { click: () => this.openReset(params.row) }
}, },
'重置密码' "重置密码"
) )
]) ]);
} }
} }
], ],
selectRow: {} //删除时选中的行数据 selectRow: {} //删除时选中的行数据
} };
}, },
created() { created() {
this.treeHeight = window.innerHeight - 100 this.treeHeight = window.innerHeight - 150
this.tdHeight = window.innerHeight - 240
}, },
mounted() { mounted() {
window.onresize = () => {
///浏览器窗口大小变化
return (() => {
window.screenHeight = window.innerHeight
this.treeHeight = window.screenHeight - 150
this.tdHeight = window.screenHeight - 240
})();
}
this.initTree() this.initTree()
this.loadrole(0) this.loadrole(0)
this.loadrole(1) this.loadrole(1)
}, },
async fetch({ store, params }) { async fetch({ store, params }) {
await store.dispatch('loadDictionary') // 加载数据字典 await store.dispatch("loadDictionary"); // 加载数据字典
}, },
methods: { methods: {
addOk() { addOk() {
this.$refs.grid.load() this.$refs.grid.load();
// this.$refs.grid.reload(this.easySearch) // this.$refs.grid.reload(this.easySearch)
this.addModal = false this.addModal = false;
this.detailModal = false this.detailModal = false;
this.editModal = false this.editModal = false;
this.curId = 0 this.curId = 0;
//this.$refs.grid.easySearch() //this.$refs.grid.easySearch()
}, },
search() { search() {
this.$refs.grid.reload(this.easySearch) this.$refs.grid.reload(this.easySearch);
}, },
detail(id) { detail(id) {
this.detailModal = true this.detailModal = true;
this.curId = id this.curId = id;
}, },
edit(id) { edit(id) {
this.editModal = true this.editModal = true;
this.curId = id this.curId = id;
}, },
remove(row) { remove(row) {
this.deletelModal = true this.deletelModal = true;
this.curId = row.id this.curId = row.id;
this.selectRow = row this.selectRow = row;
}, },
removeOk() { removeOk() {
Api.delete({ id: this.curId }).then((r) => { Api.delete({ id: this.curId }).then(r => {
if (r.success) { if (r.success) {
this.$refs.grid.load() this.$refs.grid.load();
this.deletelModal = false this.deletelModal = false;
if (this.selectRow.accountId > 0) { if (this.selectRow.accountId > 0) {
//删除成功后更新auth start //删除成功后更新auth start
let parms = { let parms = {
...@@ -442,153 +453,151 @@ export default { ...@@ -442,153 +453,151 @@ export default {
accountId: this.selectRow.accountId, accountId: this.selectRow.accountId,
tanantCode: this.$store.state.userInfo.tanantCode, tanantCode: this.$store.state.userInfo.tanantCode,
isDeleted: true isDeleted: true
} };
Api.authAccount(parms).then((res) => { Api.authAccount(parms).then(res => {
if (res.success) { if (res.success) {
this.$Message.success('账户同步成功') this.$Message.success("账户同步成功");
} }
}) });
} }
//删除成功后更新auth end //删除成功后更新auth end
this.$Message.success('删除成功') this.$Message.success("删除成功");
} }
}) });
}, },
removeCancel() { removeCancel() {
this.deletelModal = false this.deletelModal = false;
}, },
cancel() { cancel() {
this.curId = 0 this.curId = 0;
this.addModal = false this.addModal = false;
this.detailModal = false this.detailModal = false;
this.editModal = false this.editModal = false;
this.deletedlModal = false this.deletedlModal = false;
this.syncAccountModal = false this.syncAccountModal = false;
}, },
l(key) { l(key) {
let vkey = 'user' + '.' + key let vkey = "user" + "." + key;
return this.$t(vkey) || key return this.$t(vkey) || key;
}, },
initTree() { initTree() {
this.$http.department.getDepartmentTree(this.treeData) this.$http.department.getDepartmentTree(this.treeData);
}, },
selectTreeNode1(value) { selectTreeNode1(value) {
if (value != '') { if (value != "") {
this.searchObj.departmentId = null this.searchObj.departmentId = null;
this.searchObj.level_Desc = value[0].value this.searchObj.level_Desc = value[0].value;
this.mDatas.splice(0) this.mDatas.splice(0);
this.$http.sysUser.getSearchTable2(this.mDatas, this.searchObj) this.$http.sysUser.getSearchTable2(this.mDatas, this.searchObj);
} }
}, },
selectTreeNode(value) { selectTreeNode(value) {
if (value.length > 0) { if (value.length > 0) {
this.ids = [] this.ids = [];
this.getAllIds(value) this.getAllIds(value);
if (this.ids.length > 0) { if (this.ids.length > 0) {
this.easySearch.departmentId.value = this.ids this.easySearch.departmentId.value = this.ids;
} else { } else {
this.easySearch.departmentId.value = [-1] this.easySearch.departmentId.value = [-1];
} }
this.$refs.grid.easySearch() this.$refs.grid.easySearch();
} }
}, },
getAllIds(trees) { getAllIds(trees) {
trees.forEach((data, index) => { trees.forEach((data, index) => {
var that = this var that = this;
this.ids.push(data.value) this.ids.push(data.value);
if (data.children.length > 0) { if (data.children.length > 0) {
this.getAllIds(data.children) this.getAllIds(data.children);
} }
}) });
}, },
//重置密碼 //重置密碼
openReset(row) { openReset(row) {
this.show7 = true this.show7 = true;
this.curId = row.id this.curId = row.id;
this.selectRow = row this.selectRow = row;
}, },
reset() { reset() {
let parms = { let parms = {
userId: this.curId, userId: this.curId,
accountId: this.selectRow.accountId accountId: this.selectRow.accountId
} };
Api.authResetpassword(parms).then((res) => { Api.authResetpassword(parms).then(res => {
if (res.success) { if (res.success) {
this.$Message.success('重置成功!') this.$Message.success("重置成功!");
} else { } else {
this.$Message.error('重置失败!') this.$Message.error("重置失败!");
} }
}) });
}, },
//授权角色 //授权角色
loadrole(type) { loadrole(type) {
var url = `${systemUrl}/MyRole/GetRolesAsync` var url = `${systemUrl}/MyRole/GetRolesAsync`;
var data = [] var data = [];
service service.get(`${url}`, { params: { role_type: type } }).then(response => {
.get(`${url}`, { params: { role_type: type } }) data = response.data.result.items;
.then((response) => {
data = response.data.result.items
if (type == 1) { if (type == 1) {
this.authList = data this.authList = data;
} }
if (type == 0) { if (type == 0) {
this.authList1 = data this.authList1 = data;
} }
}) });
}, },
authorize(id) { authorize(id) {
//授权 //授权
this.authModel.default = [] this.authModel.default = [];
this.authModel.extra = [] this.authModel.extra = [];
this.curId = id this.curId = id;
this.show3 = true this.show3 = true;
var url = `${systemUrl}/MyUserRole/GetPaged` var url = `${systemUrl}/MyUserRole/GetPaged`;
service.get(`${url}`, { params: { userId: id } }).then((response) => { service.get(`${url}`, { params: { userId: id } }).then(response => {
var data = response.data.result.items var data = response.data.result.items;
var dt1 = data.filter(function(ite) { var dt1 = data.filter(function(ite) {
return ite.role_type == 0 return ite.role_type == 0;
}) });
var dt2 = data.filter(function(ite) { var dt2 = data.filter(function(ite) {
return ite.role_type == 1 return ite.role_type == 1;
}) });
dt1.forEach((item, i) => { dt1.forEach((item, i) => {
this.authModel.default.push(item.roleId) this.authModel.default.push(item.roleId);
}) });
dt2.forEach((item, i) => { dt2.forEach((item, i) => {
this.authModel.extra.push(item.roleId) this.authModel.extra.push(item.roleId);
}) });
}) });
}, },
authOk() { authOk() {
var url = `${systemUrl}/MyUserRole/CreateOrUpdate` var url = `${systemUrl}/MyUserRole/CreateOrUpdate`;
service service
.post( .post(
`${url}`, `${url}`,
JSON.stringify({ JSON.stringify({
myUserRole: { myUserRole: {
userId: this.curId, userId: this.curId,
RoleIds: this.allChecked.join(',') RoleIds: this.allChecked.join(",")
} }
}) })
) )
.then((response) => { .then(response => {
if (response.data.success) { if (response.data.success) {
this.$Message.success('保存成功') this.$Message.success("保存成功");
this.authModel.extra = [] this.authModel.extra = [];
this.authModel.default = [] this.authModel.default = [];
this.$refs.grid.easySearch() this.$refs.grid.easySearch();
} }
}) })
.catch((error) => { .catch(error => {
this.$Message.error('保存失败') this.$Message.error("保存失败");
}) });
}, },
authCancle() {}, authCancle() {},
//同步账户start //同步账户start
syncAccount(row) { syncAccount(row) {
this.syncAccountModal = true this.syncAccountModal = true;
this.selectRow = row this.selectRow = row;
}, },
syncAccountOk() { syncAccountOk() {
let parms = { let parms = {
...@@ -596,57 +605,57 @@ export default { ...@@ -596,57 +605,57 @@ export default {
loginName: this.selectRow.phone, loginName: this.selectRow.phone,
status: this.selectRow.status, status: this.selectRow.status,
tanantCode: this.$store.state.userInfo.tanantCode tanantCode: this.$store.state.userInfo.tanantCode
} };
if (this.selectRow.phone&&this.selectRow.phone != '') { if (this.selectRow.phone && this.selectRow.phone != "") {
Api.authAccount(parms).then((res) => { Api.authAccount(parms).then(res => {
if (res.success) { if (res.success) {
this.$Message.success('账户同步成功') this.$Message.success("账户同步成功");
let parms1 = { let parms1 = {
userId: parms.userId, userId: parms.userId,
accountId: res.result accountId: res.result
} };
Api.updateAccount(parms1).then((res1) => { Api.updateAccount(parms1).then(res1 => {
if (res1.success) { if (res1.success) {
this.$Message.success('操作成功') this.$Message.success("操作成功");
this.$refs.grid.easySearch() this.$refs.grid.easySearch();
} else { } else {
this.$Message.error('同步失败') this.$Message.error("同步失败");
} }
}) });
} }
}) });
} else { } else {
this.$Message.error('请完善个人电话信息') this.$Message.error("请完善个人电话信息");
} }
} }
//同步账户end //同步账户end
}, },
computed: { computed: {
searchList() { searchList() {
let nodeList = this.treeData let nodeList = this.treeData;
var text = this.treeInputSearch var text = this.treeInputSearch;
var newNodeList = [] var newNodeList = [];
function searchTree(nodeLists, value) { function searchTree(nodeLists, value) {
for (let i = 0; i < nodeLists.length; i++) { for (let i = 0; i < nodeLists.length; i++) {
if (nodeLists[i].title.indexOf(value) != -1) { if (nodeLists[i].title.indexOf(value) != -1) {
newNodeList.push(nodeLists[i]) newNodeList.push(nodeLists[i]);
} else if (nodeLists[i].children.length > 0) { } else if (nodeLists[i].children.length > 0) {
searchTree(nodeLists[i].children, value) searchTree(nodeLists[i].children, value);
} }
} }
} }
if (text != '') { if (text != "") {
searchTree(nodeList, text) searchTree(nodeList, text);
} else { } else {
return nodeList return nodeList;
} }
return newNodeList return newNodeList;
}, },
allChecked: function() { allChecked: function() {
return [...this.authModel.extra, ...this.authModel.default] return [...this.authModel.extra, ...this.authModel.default];
} }
} }
} };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.full { .full {
......
...@@ -145,7 +145,7 @@ import PhotosensitiveDetails from "./components/photosensitiveDetails.vue"; // ...@@ -145,7 +145,7 @@ import PhotosensitiveDetails from "./components/photosensitiveDetails.vue"; //
import MetalQuotationGeneration from "./components/metalQuotationGeneration.vue"; //生成报价单弹框 import MetalQuotationGeneration from "./components/metalQuotationGeneration.vue"; //生成报价单弹框
import PhotosensitiveGeneration from "./components/photosensitiveGeneration.vue"; //生成报价单弹框 import PhotosensitiveGeneration from "./components/photosensitiveGeneration.vue"; //生成报价单弹框
var userId = this.$store.state.userInfo.userId; var userId = this.$store.state.userInfo.userId
export default { export default {
components: { components: {
DrawerSet, DrawerSet,
......
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