bug修复
This commit is contained in:
parent
df7c8b943f
commit
c60ed4da78
|
|
@ -5,8 +5,9 @@
|
|||
* Date: 2023/2/24
|
||||
*/
|
||||
import React, { Component } from "react";
|
||||
import { toJS } from "mobx";
|
||||
import { WeaCheckbox, WeaTable } from "ecCom";
|
||||
import { Col, Row } from "antd";
|
||||
import { WeaTable } from "ecCom";
|
||||
import { getAttendanceFieldList } from "../../../../apis/attendance";
|
||||
import TipLabel from "../../../../components/TipLabel";
|
||||
|
||||
|
|
@ -32,24 +33,49 @@ class FieldMangComp extends Component {
|
|||
}
|
||||
|
||||
getAttendanceFieldList = (extraPayload) => {
|
||||
const { fieldTableStore } = this.props;
|
||||
const { loading, pageInfo } = this.state;
|
||||
const module = { ...pageInfo, ...extraPayload };
|
||||
this.setState({ loading: { ...loading, query: true } });
|
||||
getAttendanceFieldList(module).then(({ status, data }) => {
|
||||
this.setState({ loading: { ...loading, query: false } });
|
||||
if (status) {
|
||||
const { columns, list: dataSource, pageNum: current, pageSize, total } = data;
|
||||
const { dataKey, pageInfo } = data;
|
||||
const { datas } = dataKey;
|
||||
const { list: dataSource, pageNum: current, pageSize, total } = pageInfo;
|
||||
fieldTableStore.getDatas(datas);
|
||||
this.setState({
|
||||
pageInfo: { ...pageInfo, current, pageSize, total },
|
||||
dataSource,
|
||||
columns
|
||||
dataSource
|
||||
});
|
||||
}
|
||||
}).catch(() => this.setState({ loading: { ...loading, query: false } }));
|
||||
};
|
||||
getColumns = () => {
|
||||
const { showOperateBtn } = this.props;
|
||||
console.log(this.props.fieldTableStore, toJS(this.props.fieldTableStore.columns));
|
||||
return _.map(_.filter([], item => !!item.hide), child => ({
|
||||
...child,
|
||||
render: (text, record) => {
|
||||
switch (child.dataIndex) {
|
||||
case "enableStatus":
|
||||
return (
|
||||
<WeaCheckbox
|
||||
value={text} display="switch" disabled={!showOperateBtn}
|
||||
onChange={value => {
|
||||
console.log(record, value);
|
||||
}}
|
||||
/>
|
||||
);
|
||||
default:
|
||||
return <div dangerouslySetInnerHTML={{ __html: text }}/>;
|
||||
}
|
||||
}
|
||||
}));
|
||||
};
|
||||
|
||||
render() {
|
||||
const { dataSource, columns, pageInfo, loading } = this.state;
|
||||
const { dataSource, pageInfo, loading } = this.state;
|
||||
const { fieldName } = this.props;
|
||||
const pagination = {
|
||||
...pageInfo,
|
||||
|
|
@ -71,7 +97,7 @@ class FieldMangComp extends Component {
|
|||
<Row gutter={20}>
|
||||
<Col xs={24} sm={24} md={16} lg={18}>
|
||||
<WeaTable
|
||||
columns={columns}
|
||||
columns={this.getColumns()}
|
||||
dataSource={dataSource}
|
||||
pagination={pagination}
|
||||
loading={loading.query}
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ class Index extends Component {
|
|||
|
||||
render() {
|
||||
const { selectedKey, salaryMonth, fieldName } = this.state;
|
||||
const { taxAgentStore: { showOperateBtn } } = this.props;
|
||||
const { taxAgentStore: { showOperateBtn }, attendanceStore: { fieldTableStore } } = this.props;
|
||||
const topTab = [
|
||||
{ title: "考勤数据", viewcondition: "DATA" },
|
||||
{ title: "字段管理", viewcondition: "FIELD" }
|
||||
|
|
@ -90,6 +90,8 @@ class Index extends Component {
|
|||
/> :
|
||||
<FieldMangComp
|
||||
ref={dom => this.fieldMangRef = dom}
|
||||
fieldTableStore={fieldTableStore}
|
||||
showOperateBtn={showOperateBtn}
|
||||
fieldName={fieldName}
|
||||
/>
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue