1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273 |
- import React from 'react';
- import ReactDom from 'react-dom';
- import ajax from 'jquery/src/ajax/xhr.js';
- import $ from 'jquery/src/ajax';
- import {
- Form, Icon, Button, Input, Select, AutoComplete, Spin, Table,
- message, DatePicker, Modal, TreeSelect, Popconfirm, Tabs
- } from 'antd';
- import Newuser from "./newUser.jsx"
- import './userMangagement.less'
- import { techAuditStatusList, station, post } from '../../../dataDic.js';
- import { getPost, getStation, getRole } from '../../../tools.js';
- import { ChooseList } from "../../order/orderNew/chooseList";
- const { TabPane } = Tabs
- const User = Form.create()(React.createClass({
- loadData(pageNo) {
- this.state.data = [];
- this.setState({
- userDetaile: false,
- loading: true,
- page: pageNo
- });
- var admin = window.adminData.isSuperAdmin || '';
- var departmentId = window.adminData.departmentId || '';
- $.ajax({
- method: "get",
- dataType: "json",
- crossDomain: false,
- url: globalConfig.context + '/api/admin/superviser/adminList',
- data: {
- pageNo: pageNo || 1,
- pageSize: this.state.pagination.pageSize,
- name: this.state.userNameSearch,
- departmentId: admin ? this.state.organizationSearch : departmentId,
- rid: this.state.rolesSearch,
- duty: this.state.postSearch,
- position: this.state.stationSearch,
- status: this.state.statusSeach,
- mobile: this.state.signNameSearch,
- superiorId: this.state.theTypes,
- ambManage: this.state.ambManage,
- ambId: this.state.amb == 1 ? this.state.ambId : undefined,
- ancestors: this.state.amb == 2 ? this.state.ambId : undefined,
- seniorStaff: this.state.seniorStaff,
- publicPurview: this.state.publicPurview,
- teamId: this.state.teamId,
- },
- success: function (data) {
- let theArr = [];
- if (!data.data || !data.data.list) {
- if (data.error && data.error.length) {
- message.warning(data.error[0].message);
- };
- } else {
- for (let i = 0; i < data.data.list.length; i++) {
- let thisdata = data.data.list[i];
- theArr.push({
- key: i,
- id: thisdata.id,
- mobile: thisdata.mobile,
- name: thisdata.name,
- email: thisdata.email,
- createTime: thisdata.createTime,
- province: thisdata.province,
- position: thisdata.position,
- seniorStaff: thisdata.seniorStaff,
- publicPurview: thisdata.publicPurview,
- superior: thisdata.superior, //上级名称
- superiorId: thisdata.superiorId, //上级Id
- duty: thisdata.duty, //职务
- status: thisdata.status,
- userNo: thisdata.userNo,
- departmentName: thisdata.departmentName, //部门名称
- departmentId: thisdata.departmentId, //部门id
- roles: thisdata.roles,
- rolesId: thisdata.rolesId,
- lastLoginTime: thisdata.lastLoginTime,
- rolesName: thisdata.rolesName,
- ancestorsNames: thisdata.ancestorsNames, //分巴
- ambName: thisdata.ambName,
- ambRole: thisdata.ambRole,
- teamName: thisdata.teamName,
- });
- };
- this.state.pagination.current = data.data.pageNo ? data.data.pageNo : '0';
- this.state.pagination.total = data.data.totalCount ? data.data.totalCount : '0';
- };
- if (!data.data.list.length) {
- this.state.pagination.current = 0
- this.state.pagination.total = 0
- }
- this.setState({
- dataSource: theArr,
- pagination: this.state.pagination,
- selectedRowKeys: []
- });
- }.bind(this),
- }).always(function () {
- this.setState({
- loading: false
- });
- }.bind(this));
- },
- loadDatas(pageNo) {
- this.state.data = [];
- this.setState({
- userDetaile: false,
- loading: true,
- });
- var admin = window.adminData.isSuperAdmin || '';
- var departmentId = window.adminData.departmentId || '';
- $.ajax({
- method: "get",
- dataType: "json",
- crossDomain: false,
- url: globalConfig.context + '/api/admin/superviser/adminList',
- data: {
- pageNo: pageNo || 1,
- pageSize: this.state.paginations.pageSize,
- name: this.state.userNameSearchs,
- status: 0
- // departmentId: admin?this.state.organizationSearch:departmentId,
- // rid: this.state.rolesSearch,
- // duty: this.state.postSearch,
- // position: this.state.stationSearch,
- // status: this.state.statusSeach,
- // mobile: this.state.signNameSearch,
- // superiorId: this.state.theTypes
- },
- success: function (data) {
- let theArr = [];
- if (!data.data || !data.data.list) {
- if (data.error && data.error.length) {
- message.warning(data.error[0].message);
- };
- } else {
- for (let i = 0; i < data.data.list.length; i++) {
- let thisdata = data.data.list[i];
- theArr.push({
- key: i,
- id: thisdata.id,
- mobile: thisdata.mobile,
- name: thisdata.name,
- email: thisdata.email,
- createTime: thisdata.createTime,
- province: thisdata.province,
- position: thisdata.position,
- superior: thisdata.superior, //上级名称
- superiorId: thisdata.superiorId, //上级Id
- duty: thisdata.duty, //职务
- status: thisdata.status,
- userNo: thisdata.userNo,
- departmentName: thisdata.departmentName, //部门名称
- departmentId: thisdata.departmentId, //部门id
- roles: thisdata.roles,
- rolesId: thisdata.rolesId,
- lastLoginTime: thisdata.lastLoginTime,
- rolesName: thisdata.rolesName,
- ancestorsNames: thisdata.ancestorsNames, //分巴
- ambName: thisdata.ambName,
- ambRole: thisdata.ambRole,
- });
- };
- this.state.paginations.current = data.data.pageNo ? data.data.pageNo : '0';
- this.state.paginations.total = data.data.totalCount ? data.data.totalCount : '0';
- };
- if (!data.data.list.length) {
- this.state.paginations.current = 0
- this.state.paginations.total = 0
- }
- this.setState({
- dataSourceData: theArr,
- paginations: this.state.paginations,
- });
- }.bind(this),
- }).always(function () {
- this.setState({
- loading: false
- });
- }.bind(this));
- },
- getInitialState() {
- return {
- amb: 1,
- datauser: {},
- searchMore: true,
- selectedRowKeys: [],
- selectedRows: [],
- userDetaile: false,
- departmentArr: [],
- loading: false,
- roleArr: [],
- teamList: [],
- pagination: {
- defaultCurrent: 1,
- defaultPageSize: 10,
- showQuickJumper: true,
- pageSize: 10,
- onChange: function (page) {
- this.loadData(page);
- }.bind(this),
- showTotal: function (total) {
- return '共' + total + '条数据';
- }
- },
- paginations: {
- defaultCurrent: 1,
- defaultPageSize: 10,
- showQuickJumper: true,
- pageSize: 10,
- onChange: function (page) {
- this.loadDatas(page);
- }.bind(this),
- showTotal: function (total) {
- return '共' + total + '条数据';
- }
- },
- columns: [{
- title: '用户编号',
- dataIndex: 'userNo',
- key: 'userNo',
- isNoD: true,
- },
- {
- title: '登录用户名',
- dataIndex: 'mobile',
- key: 'mobile',
- width: "140px",
- },
- {
- title: '角色',
- dataIndex: 'rolesName',
- key: 'rolesName',
- render: (text, record) =>
- <span>
- {text + (getRole(record.ambRole) ? ("(" + getRole(record.ambRole) + ")") : "")}
- </span>
- },
- {
- title: '用户姓名',
- dataIndex: 'name',
- key: 'name',
- width: "140px",
- },
- {
- title: '部门',
- dataIndex: 'departmentName',
- key: 'departmentName',
- },
- {
- title: '团队',
- dataIndex: 'teamName',
- key: 'teamName',
- },
- // {
- // title: '分巴',
- // dataIndex: 'ancestorsNames',
- // key: 'ancestorsNames',
- // render: (text, record) =>
- // <span>
- // {!!text && text.replace(/,/g, "-")}
- // {!!record.ambName && "-" + record.ambName}
- // </span>
- // },
- {
- title: '职务',
- dataIndex: 'duty',
- key: 'duty',
- isNoD: true,
- render: text => { return getPost(text) }
- },
- {
- title: '岗位',
- dataIndex: 'position',
- key: 'position',
- isNoD: true,
- render: text => { return getStation(text) }
- },
- {
- title: '员工',
- dataIndex: 'seniorStaff',
- key: 'seniorStaff',
- render: text => <span style={{ fontWeight: text == 1 && "bold" }}>{["新员工", "老员工"][text]}</span>
- },
- {
- title: '上级主管姓名',
- dataIndex: 'superior',
- key: 'superior',
- width: "140px",
- },
- {
- title: '状态',
- dataIndex: 'status',
- key: 'status',
- render: (text) =>
- <span style={{ color: ["green", "red"][text] }}>
- {text == 0
- ? "正常" : text == 1
- ? "停用" : "-"}
- </span>
- },
- {
- title: '最后登录时间',
- dataIndex: 'lastLoginTime',
- key: 'lastLoginTime',
- }
- ],
- column: [{
- title: '用户编号',
- dataIndex: 'userNo',
- key: 'userNo',
- }, {
- title: '登录用户名',
- dataIndex: 'mobile',
- key: 'mobile',
- }, {
- title: '角色',
- dataIndex: 'rolesName',
- key: 'rolesName',
- render: (text, record) =>
- <span>
- {text + (getRole(record.ambRole) ? ("(" + getRole(record.ambRole) + ")") : "")}
- </span>
- }, {
- title: '用户姓名',
- dataIndex: 'name',
- key: 'name',
- }, {
- title: '转交',
- dataIndex: 'ee',
- key: 'ee',
- render: (text, record, index) => {
- return <div>
- <Popconfirm title={'请确认转交【' + record.name + '】'} onConfirm={(e) => { this.examineOK(record) }} okText="确认" cancelText="取消">
- <Button style={{ marginRight: '5px' }} onClick={(e) => { e.stopPropagation() }} type="primary">转交</Button>
- </Popconfirm>
- </div>
- }
- },
- ],
- dataSourceData: [],
- };
- },
- //点击离职一键转交
- resources() {
- this.loadDatas();
- let deletedIds;
- let rowItem;
- for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
- rowItem = this.state.selectedRows[idx];
- // console.log(rowItem.id);
- if (rowItem.id) {
- deletedIds = rowItem.id;
- };
- };
- this.setState({
- visible: true,
- aid: deletedIds
- });
- },
- //关闭离职一键转交
- handleCancel() {
- this.setState({
- visible: false,
- selectedRowKeys: []
- }, () => {
- this.loadData(this.state.page);
- });
- },
- //一键离职
- examineOK(record) {
- // console.log(record);
- this.setState({
- loading: true
- });
- $.ajax({
- method: "POST",
- dataType: "json",
- crossDomain: false,
- url: globalConfig.context + "/api/admin/role/dimission",
- data: {
- aid: this.state.aid,
- transferId: record.id,
- }
- }).done(function (data) {
- if (!data.error.length) {
- message.success('转交成功!');
- this.handleCancel()
- } else {
- message.warning(data.error[0].message);
- };
- this.setState({
- loading: false,
- visible2: false
- });
- }.bind(this));
- },
- // 设置默认table(用来默认不显示某列数据 isNoD:true)
- defaultcolumns() {
- const newArr = [];
- this.state.columns.forEach((item) => {
- if (item.isNoD) {
- return
- } else {
- newArr.push(item);
- }
- });
- this.setState({
- changeList: newArr,
- }, () => {
- this.loadData();
- });
- },
- componentWillMount() {
- this.defaultcolumns();
- this.loadData();
- this.departmentList();
- this.rolesList();
- this.getList();
- this.salesTeam();
- },
- tableRowClick(record, index) {
- this.rolesArrS(record)
- },
- //新建获取id
- addIdS() {
- $.ajax({
- method: "get",
- dataType: "json",
- crossDomain: false,
- url: globalConfig.context + '/api/admin/superviser/newId',
- data: {},
- success: function (data) {
- this.setState({
- addId: data.data
- });
- }.bind(this),
- }).always(function () {
- this.setState({
- loading: false
- });
- }.bind(this));
- },
- //部门
- departmentList() {
- this.setState({
- loading: true
- });
- $.ajax({
- method: "get",
- dataType: "json",
- crossDomain: false,
- url: globalConfig.context + "/api/admin/organization/selectSuperId",
- data: {
- },
- success: function (data) {
- let thedata = data.data;
- let theArr = [];
- if (!thedata) {
- if (data.error && data.error.length) {
- message.warning(data.error[0].message);
- };
- thedata = {};
- } else {
- thedata.map(function (item, index) {
- theArr.push({
- key: index,
- name: item.name,
- id: item.id,
- depNo: item.depNo
- })
- })
- }
- this.setState({
- departmentArr: theArr,
- })
- }.bind(this),
- }).always(function () {
- this.setState({
- loading: false
- });
- }.bind(this));
- },
- //修改时获取角色数组
- rolesArrS(e) {
- $.ajax({
- method: "get",
- dataType: "json",
- crossDomain: false,
- url: globalConfig.context + "/api/admin/role",
- data: {
- uid: e.id
- },
- success: function (data) {
- let thedata = data.data;
- let theArr = [];
- let theId = []
- if (!thedata) {
- if (data.error && data.error.length) {
- message.warning(data.error[0].message);
- };
- thedata = {};
- } else {
- }
- this.setState({
- role: thedata,
- userDetaile: true,
- showDesc: true,
- datauser: e
- })
- }.bind(this),
- }).always(function () {
- }.bind(this));
- },
- //角色
- rolesList() {
- this.setState({
- loading: true
- });
- $.ajax({
- method: "get",
- dataType: "json",
- crossDomain: false,
- url: globalConfig.context + "/api/roles",
- data: {
- },
- success: function (data) {
- let thedata = data.data;
- let theArr = [];
- if (!thedata) {
- if (data.error && data.error.length) {
- message.warning(data.error[0].message);
- };
- thedata = {};
- } else {
- thedata.map(function (item, index) {
- theArr.push({
- key: index,
- roleName: item.roleName,
- id: item.id,
- })
- })
- }
- this.setState({
- roleArr: theArr,
- })
- }.bind(this),
- }).always(function () {
- this.setState({
- loading: false
- });
- }.bind(this));
- },
- //锁定
- locking() {
- let deletedIds;
- let statust;
- let mobiles;
- let names;
- let rolesId = [];
- for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
- let rowItem = this.state.selectedRows[idx];
- if (rowItem.id) {
- deletedIds = rowItem.id;
- statust = rowItem.status;
- names = rowItem.name;
- mobiles = rowItem.mobile;
- rolesId = rowItem.rolesId
- };
- };
- this.setState({
- selectedRowKeys: [],
- loading: true
- });
- $.ajax({
- method: "POST",
- dataType: "json",
- crossDomain: false,
- url: globalConfig.context + "/api/admin/superviser/updateAdmin",
- data: {
- roles: rolesId,
- data: JSON.stringify({
- id: deletedIds,
- status: '锁定',
- name: names,
- mobile: mobiles,
- }),
- }
- }).done(function (data) {
- if (!data.error.length) {
- message.success('锁定成功!');
- this.setState({
- loading: false,
- });
- } else {
- message.warning(data.error[0].message);
- };
- this.loadData();
- }.bind(this));
- },
- //激活
- activation() {
- let deletedIds;
- let statust;
- let mobiles;
- let names;
- let rolesId = []
- for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
- let rowItem = this.state.selectedRows[idx];
- if (rowItem.id) {
- deletedIds = rowItem.id;
- statust = rowItem.status;
- names = rowItem.name;
- mobiles = rowItem.mobile;
- rolesId = rowItem.rolesId
- };
- };
- this.setState({
- selectedRowKeys: [],
- loading: true
- });
- $.ajax({
- method: "POST",
- dataType: "json",
- crossDomain: false,
- url: globalConfig.context + "/api/admin/superviser/updateAdmin",
- data: {
- roles: rolesId,
- data: JSON.stringify({
- id: deletedIds,
- status: 0,
- name: names,
- mobile: mobiles,
- })
- }
- }).done(function (data) {
- if (!data.error.length) {
- message.success('激活成功!');
- this.setState({
- loading: false,
- });
- } else {
- message.warning(data.error[0].message);
- };
- this.loadData();
- }.bind(this));
- },
- //删除
- delectRow() {
- let deletedIds;
- for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
- let rowItem = this.state.selectedRows[idx];
- if (rowItem.id) {
- deletedIds = rowItem.id;
- };
- };
- this.setState({
- selectedRowKeys: [],
- loading: true
- });
- $.ajax({
- method: "POST",
- dataType: "json",
- crossDomain: false,
- url: globalConfig.context + "/api/admin/superviser/deleteById",
- data: {
- id: deletedIds,
- }
- }).done(function (data) {
- if (!data.error.length) {
- message.success('删除成功!');
- this.setState({
- loading: false,
- });
- } else {
- message.warning(data.error[0].message);
- };
- this.loadData(this.state.page);
- }.bind(this));
- },
- addClick() {
- this.addIdS()
- this.setState({
- datauser: {},
- showDesc: true,
- userDetaile: false,
- });
- },
- closeDesc(e, s) {
- this.setState({
- userDetaile: false,
- showDesc: e
- })
- if (s) {
- this.loadData(this.state.page);
- };
- },
- search() {
- this.state.userDetaile = false
- this.loadData();
- },
- searchs() {
- this.state.userDetaile = false
- this.loadDatas();
- },
- reset() {
- this.state.teamId = undefined;
- this.state.ambManage = undefined;
- this.state.ambId = undefined;
- this.state.amb = 1;
- this.state.userNameSearch = undefined;
- this.state.organizationSearch = undefined;
- this.state.rolesSearch = undefined;
- this.state.postSearch = undefined;
- this.state.stationSearch = undefined;
- this.state.statusSeach = undefined;
- this.state.signNameSearch = undefined;
- this.state.mobileSearch = undefined;
- this.state.auto = undefined;
- this.state.theTypes = undefined;
- this.state.seniorStaff = undefined;
- this.state.publicPurview = undefined;
- this.loadData();
- },
- resets() {
- this.state.userNameSearchs = '';
- this.state.organizationSearch = undefined;
- this.state.rolesSearch = undefined;
- this.state.postSearch = undefined;
- this.state.stationSearch = undefined;
- this.state.statusSeach = undefined;
- this.state.signNameSearch = '';
- this.state.mobileSearch = '';
- this.state.auto = '';
- this.state.theTypes = '';
- this.loadDatas();
- },
- searchSwitch() {
- this.setState({
- searchMore: !this.state.searchMore
- });
- },
- //主管初始加载(自动补全)
- supervisor(e) {
- $.ajax({
- method: "post",
- dataType: "json",
- crossDomain: false,
- url: globalConfig.context + "/api/admin/organization/selectName",
- data: {
- name: e
- },
- success: function (data) {
- let thedata = data.data;
- if (!thedata) {
- if (data.error && data.error.length) {
- message.warning(data.error[0].message);
- };
- thedata = {};
- };
- this.setState({
- customerArr: thedata,
- });
- }.bind(this),
- }).always(function () {
- this.setState({
- loading: false
- });
- }.bind(this));
- },
- //上级主管输入框失去焦点是判断客户是否存在
- selectAuto(value, options) {
- this.setState({
- auto: value
- })
- },
- blurChange(e) {
- let theType = '';
- let contactLists = this.state.customerArr || [];
- if (e) {
- contactLists.map(function (item) {
- if (item.name == e.toString()) {
- theType = item.id;
- }
- });
- }
- this.setState({
- theTypes: theType
- })
- },
- //值改变时请求客户名称
- httpChange(e) {
- if (e.length >= 1) {
- this.supervisor(e);
- }
- this.setState({
- auto: e
- })
- },
- changeList(arr) {
- const newArr = [];
- this.state.columns.forEach(item => {
- arr.forEach(val => {
- if (val === item.title) {
- newArr.push(item);
- }
- });
- });
- this.setState({
- changeList: newArr
- });
- },
- // 筛选数据
- getList() {
- this.setState({
- loading: true,
- });
- $.ajax({
- method: "get",
- dataType: "json",
- crossDomain: false,
- url: globalConfig.context + "/api/admin/amb/selectAll",
- success: function (data) {
- this.setState({
- loading: false,
- });
- if (data.error && data.error.length === 0) {
- let menuList = data.data
- this.setState({
- level1Data: menuList ? this.handleTreeData(menuList) : []
- });
- } else {
- message.warning(data.error[0].message);
- }
- }.bind(this),
- }).always(
- function () {
- this.setState({
- loading: false,
- });
- }.bind(this)
- );
- },
- // 团队
- salesTeam() {
- this.setState({
- loading: true
- });
- $.ajax({
- method: "get",
- dataType: "json",
- crossDomain: false,
- url: globalConfig.context + "/api/admin/salesTeam/lvlList",
- data: {},
- success: function (data) {
- this.setState({
- loading: false,
- });
- if (data.error && data.error.length === 0) {
- let list = data.data
- this.setState({
- teamList: list ? this.handleTreeData(list) : []
- });
- } else {
- message.warning(data.error[0].message);
- }
- }.bind(this),
- }).always(function () {
- this.setState({
- loading: false
- });
- }.bind(this));
- },
- // 树状默认数据处理
- handleTreeData(treeData) {
- let nodeDta = [];
- treeData.map(item => {
- let treeObj = {};
- treeObj.key = item.id
- treeObj.id = item.id
- treeObj.value = item.id
- treeObj.label = item.name
- treeObj.title = item.name
- treeObj.lvl = item.lvl
- treeObj.parentId = item.parentId
- item.list ? treeObj.children = this.handleTreeData(item.list) : null;
- nodeDta.push(treeObj)
- })
- return nodeDta
- },
- render() {
- const rowSelection = {
- selectedRowKeys: this.state.selectedRowKeys,
- onChange: (selectedRowKeys, selectedRows) => {
- this.setState({
- selectedRows: selectedRows.slice(-1),
- selectedRowKeys: selectedRowKeys.slice(-1)
- });
- },
- onSelectAll: (selected, selectedRows, changeRows) => {
- this.setState({
- selectedRowKeys: []
- })
- },
- };
- const dataSources = this.state.customerArr || [];
- const options = dataSources.map((group, index) =>
- <Select.Option key={index} value={group.name}>{group.name}</Select.Option>
- )
- const hasSelected = this.state.selectedRowKeys.length > 0;
- const { RangePicker } = DatePicker;
- let departmentArr = this.state.departmentArr || [];
- let roleArr = this.state.roleArr || [];
- return (
- <div className="user-content">
- <div className="content-title">
- <Tabs defaultActiveKey="1" onChange={this.callback} className="test">
- <TabPane tab="搜索" key="1">
- <div className="user-search" style={{ paddingBottom: 10 }}>
- <Input
- placeholder="用户姓名"
- style={{ width: "180px" }}
- value={this.state.userNameSearch}
- onChange={e => {
- this.setState({ userNameSearch: e.target.value });
- }}
- />
- {window.adminData.isSuperAdmin ? (
- <Select
- placeholder="部门"
- style={{ width: 180 }}
- value={this.state.organizationSearch}
- onChange={e => {
- this.setState({ organizationSearch: e });
- }}
- >
- {departmentArr.map(function (item) {
- return (
- <Select.Option key={item.id}>{item.name}</Select.Option>
- );
- })}
- </Select>
- ) : (
- ""
- )}
- <Select
- placeholder="角色"
- style={{ width: 180 }}
- value={this.state.rolesSearch}
- onChange={e => {
- this.setState({ rolesSearch: e });
- }}
- >
- {roleArr.map(function (item) {
- return (
- <Select.Option key={item.id}>
- {item.roleName}
- </Select.Option>
- );
- })}
- </Select>
- <Select
- placeholder="职务"
- style={{ width: 100 }}
- value={this.state.postSearch}
- onChange={e => {
- this.setState({ postSearch: e });
- }}
- >
- {post.map(function (item) {
- return (
- <Select.Option key={item.value}>
- {item.key}
- </Select.Option>
- );
- })}
- </Select>
- <Select
- placeholder="员工"
- style={{ width: 100 }}
- value={this.state.seniorStaff}
- onChange={e => {
- this.setState({ seniorStaff: e });
- }}
- >
- <Select.Option value={0}>新员工</Select.Option>
- <Select.Option value={1}>老员工</Select.Option>
- </Select>
- <Select
- placeholder="业务员"
- style={{ width: 100 }}
- value={this.state.publicPurview}
- onChange={e => {
- this.setState({ publicPurview: e });
- }}
- >
- <Select.Option value={0}>否</Select.Option>
- <Select.Option value={1}>是</Select.Option>
- </Select>
- <Select
- placeholder="岗位"
- style={{ width: 100 }}
- value={this.state.stationSearch}
- onChange={e => {
- this.setState({ stationSearch: e });
- }}
- >
- {station.map(function (item) {
- return (
- <Select.Option key={item.value}>
- {item.key}
- </Select.Option>
- );
- })}
- </Select>
- <Select
- placeholder="状态"
- style={{ width: 100 }}
- value={this.state.statusSeach}
- onChange={e => {
- this.setState({ statusSeach: e });
- }}
- >
- <Select.Option value={0}>正常</Select.Option>
- <Select.Option value={1}>锁定</Select.Option>
- </Select>
- <Input
- placeholder="登录用户名"
- style={{ width: "180px" }}
- value={this.state.signNameSearch}
- onChange={e => {
- this.setState({ signNameSearch: e.target.value });
- }}
- />
- <AutoComplete
- className="certain-category-search"
- dropdownClassName="certain-category-search-dropdown"
- dropdownMatchSelectWidth={false}
- style={{ width: 180 }}
- dataSource={options}
- placeholder="输入上级主管名字"
- value={this.state.auto}
- onChange={this.httpChange}
- filterOption={true}
- onBlur={this.blurChange}
- onSelect={this.selectAuto}
- >
- <Input />
- </AutoComplete>
- <div style={{ marginTop: 10 }}>
- <TreeSelect
- style={{ width: 200 }}
- value={this.state.teamId}
- dropdownStyle={{ maxHeight: 300, overflow: 'auto' }}
- treeData={this.state.teamList}
- placeholder="请选择团队"
- showSearch
- treeNodeFilterProp="title"
- onChange={(e) => {
- this.setState({
- teamId: e,
- });
- }}
- />
- {/* <Select
- placeholder="巴主"
- style={{ width: 180 }}
- value={this.state.ambManage}
- onChange={e => {
- this.setState({ ambManage: e });
- }}
- >
- <Select.Option value={0}>非巴主</Select.Option>
- <Select.Option value={1}>巴主</Select.Option>
- </Select>
- <TreeSelect
- style={{ width: 300 }}
- value={this.state.ambId}
- dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
- treeData={this.state.level1Data}
- placeholder="请选择分巴"
- showSearch
- treeNodeFilterProp="title"
- onChange={(e) => {
- this.setState({
- ambId: e,
- });
- }}
- />
- {
- !!this.state.ambId &&
- <Select
- placeholder=""
- style={{ width: 180 }}
- value={this.state.amb}
- onChange={e => {
- this.setState({ amb: e });
- }}
- >
- <Select.Option value={1}>本巴</Select.Option>
- <Select.Option value={2}>全部</Select.Option>
- </Select>
- } */}
- <Button style={{ marginRight: 10 }} type="primary" onClick={this.search}>搜索</Button>
- <Button style={{ marginRight: 10 }} onClick={this.reset}>重置</Button>
- <Button
- style={{ background: "red", border: "none", color: "#fff", display: "none" }}
- disabled={!hasSelected}
- onClick={this.delectRow}
- >
- 删除
- <Icon type="minus" />
- </Button>
- </div>
- {/* <span>更多搜索<Switch defaultChecked={false} onChange={this.searchSwitch} /></span> */}
- </div>
- </TabPane>
- <TabPane tab="操作" key="2">
- <Button
- style={{
- background: "#333333",
- border: "none",
- color: "#fff",
- marginBottom: 10,
- marginTop: 12,
- marginRight: 10
- }}
- disabled={!hasSelected}
- onClick={this.locking}
- >
- 锁定
- <Icon type="lock" />
- </Button>
- <Button
- style={{ background: "green", border: "none", color: "#fff", marginTop: 12 }}
- disabled={!hasSelected}
- onClick={this.activation}
- >
- 激活
- <Icon type="unlock" />
- </Button>
- {/* </TabPane>
- <TabPane tab="新增" key="3"> */}
- <Button
- type="primary"
- className="addButton"
- style={{ float: "left", marginBottom: 10, marginTop: 12 }}
- onClick={this.addClick}
- >
- 新增用户
- <Icon type="user" />
- </Button>
- {/* </TabPane>
- <TabPane tab="离职转交" key="4"> */}
- <Button
- type="primary"
- className="addButton"
- style={{ float: "left", marginBottom: 10, marginTop: 12 }}
- onClick={this.resources}
- disabled={!hasSelected}
- >
- 离职一键转交
- <Icon type="user" />
- </Button>
- </TabPane>
- <TabPane tab="更改表格显示数据" key="3">
- <div style={{ marginLeft: 10 }}>
- <ChooseList
- columns={this.state.columns}
- changeFn={this.changeList}
- changeList={this.state.changeList}
- top={55}
- margin={11}
- />
- </div>
- </TabPane>
- </Tabs>
- <div className="patent-table">
- <Spin spinning={this.state.loading}>
- <Table
- bordered
- columns={
- this.state.changeList
- ? this.state.changeList
- : this.state.columns
- }
- style={{
- cursor: 'pointer',
- }}
- dataSource={this.state.dataSource}
- rowSelection={rowSelection}
- pagination={this.state.pagination}
- onRowClick={this.tableRowClick}
- />
- </Spin>
- </div>
- {this.state.showDesc &&
- <Newuser
- role={this.state.role}
- addId={this.state.addId}
- roleArr={this.state.roleArr}
- departmentArr={this.state.departmentArr}
- userDetaile={this.state.userDetaile}
- datauser={this.state.datauser}
- showDesc={this.state.showDesc}
- closeDesc={this.closeDesc}
- level1Data={this.state.level1Data}
- teamList={this.state.teamList}
- />}
- <div className="patent-desc">
- <Modal
- maskClosable={false}
- visible={this.state.visible}
- onOk={this.checkResources}
- onCancel={this.handleCancel}
- width="800px"
- title="离职一键转交"
- footer=""
- className="admin-desc-content"
- >
- <Input
- placeholder="用户姓名"
- style={{
- width: "180px",
- marginRight: "10px",
- marginBottom: "10px"
- }}
- value={this.state.userNameSearchs}
- onChange={e => {
- this.setState({ userNameSearchs: e.target.value });
- }}
- />
- <Button type="primary" onClick={this.searchs}>
- 搜索
- </Button>
- <Button onClick={this.resets}>重置</Button>
- <div className="patent-table">
- <Spin spinning={this.state.loading}>
- <Table
- columns={this.state.column}
- dataSource={this.state.dataSourceData}
- pagination={this.state.paginations}
- style={{
- cursor: 'pointer',
- }}
- // onRowClick={this.tableRowClick}
- />
- </Spin>
- </div>
- </Modal>
- </div>
- </div>
- </div>
- );
- }
- }));
- export default User;
|