/**
* 云会议列表
*/
import React, { Component } from "react";
import { connect } from "dva";
import PTable from "../../../components/Pro/PTable";
import {
recycleFromMember,
assignToMember,
getHuaweiAccesstoken
} from "../../../services/api";
import SelectPersonnelPop from "../../../components/SelectPersonnelPop";
import $perModal from '../../../utils/modal/perModal';
import {
Form,
Input,
Button,
message,
Tabs,
Modal,
Popconfirm,
Select
} from "antd";
import Modify from "./Modify";
const { TabPane } = Tabs;
const { Option } = Select;
const { confirm } = Modal;
const statusList = [
{
value: null,
label: "所有"
},
{
value: 0,
label: "正常"
},
{
value: 1,
label: "停用"
},
{
value: 2,
label: "未分配"
}
];
import "../meeting.less";
@connect(state => ({
meetingAcount: state.client.meetingAcount
}))
@Form.create()
export default class CloudConference extends Component {
constructor(props, context) {
super(props, context);
this.state = {
forceUpdate: false,
pageParm: {
keyWord: "",
status: null,
pageSize: 10,
pageNumber: 1
},
keyWord: "",
status: null,
modifyStatus: false, //修改的状态
distributionItemValue: null //当前分配选中的列表
};
}
componentDidMount() {
this._getMeetingToken();
}
//获取华为云会议的token
_getMeetingToken() {
const _this = this;
getHuaweiAccesstoken({})
.then(res => {
if (res.retType === "0") {
_this.props.dispatch({
type: `client/setMeetingToken`,
payload: {
meetingAcc: res.data
}
});
}
})
.catch(err => {
if (err.retType !== "0") {
const value = {
accessToken: null,
huaweiUserName: null,
huaweiPassWord: null,
huaweiSipName: null
};
_this.props.dispatch({
type: `client/setMeetingToken`,
payload: {
meetingAcc: value
}
});
}
});
}
//回收
_recover(value) {
return (
回收后原会议将会失效,
确定回收?
}
onConfirm={() => {
const param = {
account: value.member.id,
vmrIdList: JSON.stringify([value.id])
};
const _this = this;
recycleFromMember(param).then(res => {
if (res.retType === "0") {
_this.setState(
{
forceUpdate: true
},
() => {
_this.setState({
forceUpdate: false
});
}
);
}
});
}}
okText="确定"
cancelText="取消"
>
回收
);
}
//分配
_distribution(value) {
return (
{
this.setState({
distributionItemValue: value
},() => {
const { distributionItemValue } = this.state;
$perModal({
fetchType: 'huawei',
type: 'radio',
onOk: (values, close) => {
confirm({
title:
"确定将“" +
distributionItemValue.vmrName +
"”分配给" +
values[0].name +
"?",
okText: "确定",
cancelText: "取消",
onOk: () => {
close();
const value = {
account: values[0].huaweiUserName,
vmrIdList: JSON.stringify([distributionItemValue.id])
};
assignToMember(value).then(res => {
if (res.retType === "0") {
this.setState(
{
forceUpdate: true
},
() => {
this.setState({
forceUpdate: false
});
}
);
}
});
}
});
}
});
});
}}
>
分配
);
}
//修改
_modify(value) {
return (
{
this.setState({
distributionItemValue: value,
modifyStatus: !this.state.modifyStatus
});
}}
>
修改
);
}
render() {
const columns = [
{
title: "会议ID",
dataIndex: "vmrId",
key: "vmrId"
},
{
title: "状态",
dataIndex: "status",
key: "status",
render: (text, record) => {
return (
{statusList.map(item => {
if (item.value === text) {
return item.label;
}
})}
);
}
},
// {
// title: "类型",
// dataIndex: "startTime",
// key: "startTime",
// render: (text, record) => {
// // return {this.addUTC(text)};
// }
// },
// {
// title: "所有者",
// dataIndex: "scheduserName",
// key: "scheduserName"
// },
{
title: "云会议室名称",
dataIndex: "vmrName",
key: "vmrName"
},
{
title: "套餐名称",
dataIndex: "vmrPkgName",
key: "vmrPkgName"
},
{
title: "并发数",
dataIndex: "vmrPkgParties",
key: "vmrPkgParties"
},
{
title: "绑定的用户",
dataIndex: "member",
key: "member",
render: (text, record) => {
return (
{text.mark && text.mark.indexOf("(") > -1
? text.mark.match(/(\S*)\(/)[1]
: record.status === 2
? "未绑定"
: text.mark}
{/* {text.mark} */}
);
}
},
{
title: "绑定的硬终端",
dataIndex: "device",
key: "device",
render: (text, record) => {
return {text ? text : "---"};
}
},
{
title: "操作",
dataIndex: "action",
key: "action",
render: (text, record) => (
{record.status === 0 ? (
{/* 回收 */}
{this._recover(record)}
{/* 分配 */}
{this._distribution(record)}
) : record.status === 1 ? (
""
) : record.status === 2 ? (
{/* 分配 */}
{this._distribution(record)}
) : (
""
)}
{/* 修改 */}
{record.member.id === this.props.meetingAcount &&
this._modify(record)}
)
}
];
const {
forceUpdate,
keyWord,
status,
modifyStatus,
distributionItemValue
} = this.state;
return (
{modifyStatus && (
{
this.setState(
{
forceUpdate: true,
modifyStatus: !this.state.modifyStatus
},
() => {
this.setState({
forceUpdate: false
});
}
);
}}
modifyCancel={() => {
this.setState({
modifyStatus: !this.state.modifyStatus
});
}}
/>
)}
);
}
}