2022-10-31 13:52:22 +08:00
|
|
|
import React, { Component } from "react";
|
2024-06-13 11:40:45 +08:00
|
|
|
import { WeaRightMenu, WeaTab, WeaTop,WeaLocaleProvider } from "ecCom";
|
2022-11-07 16:35:58 +08:00
|
|
|
import { inject, observer } from "mobx-react";
|
2022-10-31 13:52:22 +08:00
|
|
|
import { Button } from "antd";
|
2022-11-10 18:50:45 +08:00
|
|
|
import PermissionItem from "./permissionItem";
|
|
|
|
|
import DefineShowItems from "./defineShowItems";
|
|
|
|
|
import CustomItem from "./customItem";
|
2022-10-31 13:52:22 +08:00
|
|
|
import { i18n } from "../../public/i18n";
|
2022-11-08 15:56:34 +08:00
|
|
|
import { renderNoright } from "../../util";
|
2022-10-31 13:52:22 +08:00
|
|
|
|
2024-06-13 11:40:45 +08:00
|
|
|
const getLabel = WeaLocaleProvider.getLabel;
|
|
|
|
|
|
|
|
|
|
|
2022-11-10 18:50:45 +08:00
|
|
|
@inject("columnSetting")
|
2022-11-07 16:35:58 +08:00
|
|
|
@observer
|
2022-11-10 18:50:45 +08:00
|
|
|
class ColumnSetting extends Component {
|
2022-11-08 15:56:34 +08:00
|
|
|
componentDidMount() {
|
|
|
|
|
this.init();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
init = () => {
|
2022-11-10 18:50:45 +08:00
|
|
|
const { columnSetting } = this.props;
|
|
|
|
|
columnSetting.getRight();
|
2022-11-08 15:56:34 +08:00
|
|
|
};
|
|
|
|
|
|
2022-10-31 13:52:22 +08:00
|
|
|
getTopMenuBtns = () => {
|
|
|
|
|
return [
|
2024-06-13 11:40:45 +08:00
|
|
|
<Button type="primary" onClick={this.save}>{getLabel('547360', "保存")}</Button>
|
2022-10-31 13:52:22 +08:00
|
|
|
];
|
|
|
|
|
};
|
|
|
|
|
getDropMenuDatas = () => {
|
|
|
|
|
return [
|
|
|
|
|
{
|
2022-11-07 16:35:58 +08:00
|
|
|
key: "save",
|
|
|
|
|
icon: <i className="icon-coms-Preservation"/>,
|
2024-06-13 11:40:45 +08:00
|
|
|
content: getLabel('547360', "保存")
|
2022-10-31 13:52:22 +08:00
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
};
|
2022-11-07 16:35:58 +08:00
|
|
|
getTabName = () => {
|
|
|
|
|
return [{
|
|
|
|
|
key: "0",
|
2022-11-10 16:10:21 +08:00
|
|
|
title: i18n.label.defineShowItems()
|
2022-11-07 16:35:58 +08:00
|
|
|
}, {
|
|
|
|
|
key: "1",
|
2022-11-10 18:50:45 +08:00
|
|
|
title: i18n.label.columnPermission()
|
2022-11-10 16:10:21 +08:00
|
|
|
}, {
|
|
|
|
|
key: "2",
|
2022-11-10 18:50:45 +08:00
|
|
|
title: i18n.label.columnCustom()
|
2022-11-07 16:35:58 +08:00
|
|
|
}];
|
|
|
|
|
};
|
|
|
|
|
save = () => {
|
2022-11-10 18:50:45 +08:00
|
|
|
const { columnSetting } = this.props;
|
|
|
|
|
const { selectedKey } = columnSetting;
|
2022-11-10 16:10:21 +08:00
|
|
|
selectedKey === "0" ?
|
2022-11-10 18:50:45 +08:00
|
|
|
columnSetting.userDefineCardItemSave() :
|
2022-11-10 16:10:21 +08:00
|
|
|
selectedKey === "1" ?
|
2022-11-11 17:09:18 +08:00
|
|
|
columnSetting.columnPermissionSave() : columnSetting.customItemSave();
|
2022-11-07 16:35:58 +08:00
|
|
|
};
|
2022-10-31 13:52:22 +08:00
|
|
|
|
|
|
|
|
render() {
|
2022-11-10 18:50:45 +08:00
|
|
|
const { columnSetting } = this.props;
|
|
|
|
|
const { selectedKey, authorized } = columnSetting;
|
2022-12-06 17:56:09 +08:00
|
|
|
if (authorized === false) {
|
2022-11-08 17:43:26 +08:00
|
|
|
return renderNoright();
|
|
|
|
|
}
|
2022-10-31 13:52:22 +08:00
|
|
|
return (
|
2022-11-17 11:34:05 +08:00
|
|
|
authorized && <div style={{ height: "100%" }}>
|
2022-10-31 13:52:22 +08:00
|
|
|
<WeaRightMenu
|
|
|
|
|
ecId={`${this && this.props && this.props.ecId || ""}_WeaRightMenu@k6oc4u`}
|
2022-11-10 16:10:21 +08:00
|
|
|
datas={[{
|
|
|
|
|
key: "save",
|
|
|
|
|
icon: <i className="icon-coms-Preservation"/>,
|
2024-06-13 11:40:45 +08:00
|
|
|
content: getLabel('547360', "保存")
|
2022-11-10 16:10:21 +08:00
|
|
|
}]}
|
|
|
|
|
onClick={key => (key && this[key]())}
|
2022-10-31 13:52:22 +08:00
|
|
|
>
|
|
|
|
|
<WeaTop
|
|
|
|
|
ecId={`${this && this.props && this.props.ecId || ""}_WeaTop@bj98s7`}
|
2022-11-10 18:50:45 +08:00
|
|
|
title={i18n.label.cardColumnSet()}
|
2022-10-31 13:52:22 +08:00
|
|
|
icon={<i className="icon-coms-hrm"/>}
|
|
|
|
|
iconBgcolor="#217346"
|
|
|
|
|
loading={true}
|
|
|
|
|
buttons={this.getTopMenuBtns()}
|
|
|
|
|
showDropIcon={true}
|
|
|
|
|
dropMenuDatas={this.getDropMenuDatas()}
|
2022-11-07 16:35:58 +08:00
|
|
|
onDropMenuClick={(e) => (e && this[e]())}
|
2022-10-31 13:52:22 +08:00
|
|
|
/>
|
2022-11-07 16:35:58 +08:00
|
|
|
<WeaTab
|
|
|
|
|
ecId={`${this && this.props && this.props.ecId || ""}_WeaTab@8mmoen`}
|
|
|
|
|
selectedKey={selectedKey}
|
|
|
|
|
datas={this.getTabName()}
|
|
|
|
|
keyParam="key"
|
2022-11-10 18:50:45 +08:00
|
|
|
onChange={(key) => columnSetting.setSelectedKey(key)}
|
2022-10-31 13:52:22 +08:00
|
|
|
/>
|
2022-11-07 16:35:58 +08:00
|
|
|
{
|
|
|
|
|
selectedKey === "0" ?
|
2022-11-10 16:10:21 +08:00
|
|
|
<DefineShowItems ecId={`${this && this.props && this.props.ecId || ""}_DefineShowItems@q1hmoj`}/> :
|
|
|
|
|
selectedKey === "1" ?
|
|
|
|
|
<PermissionItem ecId={`${this && this.props && this.props.ecId || ""}_SysShowItems@0wqtjk`}/> :
|
|
|
|
|
<CustomItem ecId={`${this && this.props && this.props.ecId || ""}_CustomItems@0wqtjk`}/>
|
2022-11-07 16:35:58 +08:00
|
|
|
}
|
2022-10-31 13:52:22 +08:00
|
|
|
</WeaRightMenu>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
2022-11-11 17:09:18 +08:00
|
|
|
}
|
2022-10-31 13:52:22 +08:00
|
|
|
}
|
|
|
|
|
|
2022-11-10 18:50:45 +08:00
|
|
|
export default ColumnSetting;
|