trunk/pc4mobx/organization/components/columnSetting/defineShowItems.js

51 lines
1.4 KiB
JavaScript
Raw Normal View History

2022-11-07 16:35:58 +08:00
import { inject, observer } from "mobx-react";
import React, { Component } from "react";
import { WeaTableEdit } from "ecCom";
import * as mobx from "mobx";
const toJS = mobx.toJS;
2022-11-10 18:50:45 +08:00
@inject("columnSetting")
2022-11-07 16:35:58 +08:00
@observer
export default class DefineShowItems extends Component {
constructor(props) {
super(props);
}
componentDidMount() {
this.init();
}
init = () => {
2022-11-10 18:50:45 +08:00
const { columnSetting } = this.props;
columnSetting.loadTabTwoRelatedData();
2022-11-07 16:35:58 +08:00
};
onRowSelect = (sRowKeys, rows, dataIndex, selectedDatas) => {
2022-11-10 18:50:45 +08:00
const { columnSetting } = this.props;
2022-11-07 16:35:58 +08:00
if (dataIndex === undefined || selectedDatas === undefined) {
return;
}
2022-11-10 18:50:45 +08:00
columnSetting.setEnableRows(selectedDatas.isused);
2022-11-07 16:35:58 +08:00
};
render() {
2022-11-10 18:50:45 +08:00
const { columnSetting } = this.props, { tabTwoRelatedData } = columnSetting;
2022-11-07 16:35:58 +08:00
const { datas, columns, selectedData, loading } = tabTwoRelatedData;
return (
<WeaTableEdit
ecId={`${this && this.props && this.props.ecId || ""}_WeaTableEdit@7rorir`}
draggable
deleteConfirm
title=""
columns={toJS(columns)}
datas={toJS(datas)}
copyFilterProps={["id"]}
selectedData={!loading && toJS(selectedData)}
2022-11-10 18:50:45 +08:00
onChange={e => columnSetting.setTableEditDatas(e)}
2022-11-07 16:35:58 +08:00
onRowSelect={(sRowKeys, rows, dataIndex, selectedDatas) => this.onRowSelect(sRowKeys, rows, dataIndex, selectedDatas)}
/>
);
}
}