/** * 会议用户管理 */ import React, { Component } from "react"; import { connect } from "dva"; import { Form, Alert, Input, Button, Tabs, TreeSelect, Modal, Select } from "antd"; import PTable from "../../../components/Pro/PTable"; import $perModal from '../../../utils/modal/perModal'; import { addUser, systemComDepartGetTreeDepart, batchDeleteUser, getHuaweiManageResource, setRegulatorMeetCharge, cancelRegulatorMeetCharge, publicCommonDictGetDictByCodeTypes } from "../../../services/api"; import "../meeting.less"; const { TabPane } = Tabs; const { confirm } = Modal; @connect(state => ({ client: state.client.client })) @Form.create() export default class UserManage extends Component { constructor(props, context) { super(props, context); this.state = { forceUpdate: false, pageParm: { keyWord: "", departId: "", regulatorMeetChargeType: "", pageSize: 10, pageNumber: 1 }, regulatorMeetChargeTypeOptions: [], regulatorMeetChargeTypeCol: "", regulatorMeetChargeType: "", isRegulatorMeetCharge: '', keyWord: "", departId: "0", //过滤部门的时候默认是“全部” treeData: [ // 部门数据 //树 { title: "", key: "" } ], resourceData: null }; } componentDidMount() { // 获取部门 this.getDepart(); this._getHuaweiManageResource(); this.getRegulatorMeetChargeType() } //获取部门树数据 getDepart = cb => { systemComDepartGetTreeDepart().then( response => { let { data } = response; data = JSON.parse( JSON.stringify(data).replace(/\"children\":\[\]/g, '"isLeaf":true') ); data.unshift({ title: "全部", value: "0" }); this.setState( { treeData: data }, () => { cb && cb(); } ); }, err => { console.log(err, "getTreeDepart-选择部门-err"); } ); }; //获取监管会议角色列表 getRegulatorMeetChargeType = () => { publicCommonDictGetDictByCodeTypes({ codeTypes: "regulatorMeetChargeType" }).then(res => { this.setState({ regulatorMeetChargeTypeOptions: res.data.regulatorMeetChargeType }) }) } //获取资源数 _getHuaweiManageResource() { getHuaweiManageResource({}).then(res => { if (res.retType === "0" && res.data) { this.setState({ resourceData: res.data.teSoftCount }); } }); } //添加成员 _addUser(perId, close) { addUser({ perId }).then(res => { close && close(); if (res.retType === "0") { this.setState({ forceUpdate: true }); this._getHuaweiManageResource(); } }); } //删除人员 _deleteUser(perId) { batchDeleteUser({ perIds: perId }).then(res => { if (res.retType === "0") { this.setState({ forceUpdate: true }); this._getHuaweiManageResource(); } }); } _setResource(record) { if (record.regulatorMeetChargeType === "否") { setRegulatorMeetCharge({ perId: record.perId, regulatorMeetChargeType: this.state.regulatorMeetChargeTypeSelect }).then(res => { this.setState({ forceUpdate: true }, () => { this.setState({ forceUpdate: false }) }); }) } else { cancelRegulatorMeetCharge({ perId: record.perId }).then(res => { this.setState({ forceUpdate: true }, () => { this.setState({ forceUpdate: false }) }); }); } } render() { let options = ( ) const columns = [ { title: "序号", dataIndex: "key", key: "key", render: (text, record, index) => {index + 1} }, { title: "姓名", dataIndex: "name", key: "name" }, { title: "手机号码", dataIndex: "mobilePhone", key: "mobilePhone" }, { title: "部门", dataIndex: "departName", key: "departName" }, { title: "人员类别", dataIndex: "perType", key: "perType" }, { title: "是否监管会议角色", dataIndex: "regulatorMeetChargeType", key: "regulatorMeetChargeType" }, { title: "操作", key: "action", render: (text, record) => { let paramText = '取消监管会议角色' console.log(record.regulatorMeetChargeType) if (record.regulatorMeetChargeType === '否') { paramText = '设为监管会议角色'; } else { paramText = '取消监管会议角色'; } return ( { console.log(record.regulatorMeetChargeType) const _this = this confirm({ title: record.regulatorMeetChargeType !== "否" ? '确定“' + record.name + '”' + "取消监管会议角色?" : "请选择要设置的监管会议角色", content: record.regulatorMeetChargeType === "否" ? options : '', okText: '确定', cancelText: '取消', onOk() { _this._setResource(record) }, }); }} > {paramText} { const _this = this confirm({ title: '确定删除该人员?', content: '删除后,该人员无法使用会议功能', okText: '确定', cancelText: '取消', onOk() { _this._deleteUser(record.perId); }, onCancel() { console.log('Cancel'); }, }); }} > 删除 ) } } ]; return (