考勤引用页面重构

This commit is contained in:
黎永顺 2023-03-01 11:15:28 +08:00
parent c60ed4da78
commit 36e0e40bdd
2 changed files with 6 additions and 7 deletions

View File

@ -32,7 +32,7 @@ class FieldMangComp extends Component {
this.getAttendanceFieldList();
}
getAttendanceFieldList = (extraPayload) => {
getAttendanceFieldList = (extraPayload = {}) => {
const { fieldTableStore } = this.props;
const { loading, pageInfo } = this.state;
const module = { ...pageInfo, ...extraPayload };
@ -40,9 +40,9 @@ class FieldMangComp extends Component {
getAttendanceFieldList(module).then(({ status, data }) => {
this.setState({ loading: { ...loading, query: false } });
if (status) {
const { dataKey, pageInfo } = data;
const { dataKey, pageInfo: pageInfoData } = data;
const { datas } = dataKey;
const { list: dataSource, pageNum: current, pageSize, total } = pageInfo;
const { list: dataSource, pageNum: current, pageSize, total } = pageInfoData;
fieldTableStore.getDatas(datas);
this.setState({
pageInfo: { ...pageInfo, current, pageSize, total },
@ -53,8 +53,7 @@ class FieldMangComp extends Component {
};
getColumns = () => {
const { showOperateBtn } = this.props;
console.log(this.props.fieldTableStore, toJS(this.props.fieldTableStore.columns));
return _.map(_.filter([], item => !!item.hide), child => ({
return _.map(_.filter(toJS(this.props.fieldTableStore.columns), item => !!item.hide), child => ({
...child,
render: (text, record) => {
switch (child.dataIndex) {

View File

@ -66,7 +66,7 @@ class Index extends Component {
const buttons = selectedKey === "DATA" ? [
<Button type="primary">引用</Button>,
<Button type="ghost">导入</Button>
] : [<Button type="primary">新建</Button>];
] : [<Button type="primary" onClick={() => console.log(this.fieldMangRef)}>新建</Button>];
return (
<div className="attendanceRefWrapper">
<WeaTab
@ -74,7 +74,7 @@ class Index extends Component {
searchType={selectedKey === "FIELD" ? ["base"] : []} searchsBasePlaceHolder="请输入字段名称"
onChange={v => this.setState({ selectedKey: v })}
searchsBaseValue={fieldName} onSearchChange={fieldName => this.setState({ fieldName })}
onSearch={() => this.fieldMangRef.getAttendanceFieldList({ fieldName })}
onSearch={() => this.fieldMangRef.getAttendanceFieldList({ fieldName, current: 1 })}
/>
{
selectedKey === "DATA" && this.getAttendanceDataScreen()