From 5f478dcbfd9de8bd0092c767e99ea5794fc5f55d Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Tue, 24 May 2022 19:00:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=AC=E5=8F=B8/=E5=88=86=E9=83=A8=E5=88=86?= =?UTF-8?q?=E9=A1=B5=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../organization/components/NewWeaTable.js | 61 +++++++++++++++++++ .../components/company/company.js | 38 ++++++++---- pc4mobx/organization/stores/company.js | 13 ++-- pc4mobx/organization/stores/joblevel.js | 6 +- pc4mobx/organization/style/common.less | 9 ++- 5 files changed, 104 insertions(+), 23 deletions(-) create mode 100644 pc4mobx/organization/components/NewWeaTable.js diff --git a/pc4mobx/organization/components/NewWeaTable.js b/pc4mobx/organization/components/NewWeaTable.js new file mode 100644 index 0000000..c6934c8 --- /dev/null +++ b/pc4mobx/organization/components/NewWeaTable.js @@ -0,0 +1,61 @@ +import { + WeaNewScroll, + WeaSearchGroup, + WeaMoreButton, + WeaTable +} from 'ecCom' + +import { + Spin, + Button, + Pagination +} from 'antd' + +import { + WeaSwitch +} from 'comsMobx' + +import { + i18n +} from '../public/i18n'; + +import '../style/common.less'; + + +export default class NewWeaTable extends React.Component { + constructor(props) { + super(props); + } + + + + render() { + const { + dataSource, + columns, + rowSelection, + pagination, + loading, + indentSize + } = this.props + + + return ( + loading ?
+ +
: + record.id} + dataSource={dataSource} childrenColumnName="children" + columns={columns} + rowSelection={rowSelection} + pagination={false} + loading={loading} + // onChange={(pagination, filters, sorter) => { + // debugger + // company.getTableInfo(); + // }} + indentSize={indentSize} + /> + ) + } +} \ No newline at end of file diff --git a/pc4mobx/organization/components/company/company.js b/pc4mobx/organization/components/company/company.js index 076708b..fd68a08 100644 --- a/pc4mobx/organization/components/company/company.js +++ b/pc4mobx/organization/components/company/company.js @@ -1,7 +1,7 @@ /** * @Author: 程亮 * @Date: 2022-05-18 16:23:32 - * @LastEditTime: 2022-05-23 18:54:44 + * @LastEditTime: 2022-05-24 14:29:44 * @Description: * @FilePath: /trunk/src4js/pc4mobx/organization/components/company/company.js */ @@ -39,6 +39,7 @@ import '../../style/common.less'; import NewTableDialog from '../NewTableDialog'; import NewAndEditDialog from '../NewAndEditDialog'; +import NewWeaTable from '../NewWeaTable'; import { renderLoading } from '../../util'; // 从util文件引入公共的方法 @@ -134,7 +135,7 @@ export default class Company extends React.Component { company.setNeDialogTitle(i18n.label.companyName()); company.setVisible(true); company.getDeptTable(id); - company.setDialogLoadingStatus(false); + company.setDialogLoadingStatus(true); } batchDelete() { @@ -359,7 +360,7 @@ export default class Company extends React.Component { const { isPanelShow, companyName, conditionNum, visible, condition, form, tableStore, dataSource, columns, loading, date, nEdialogTitle, dialogLoading, - form1, isEdit, newVisible, deptDataSource, deptColumns, selectedRowKeys, total + form1, isEdit, newVisible, deptDataSource, deptColumns, selectedRowKeys, total,current,pageSize,init } = company; @@ -370,16 +371,18 @@ export default class Company extends React.Component { }; const pagination = { + current:current, + pageSize:pageSize, total: total, showSizeChanger: true, showQuickJumper: true, onShowSizeChange(current, pageSize) { - company.setCurrent(current); - company.setPageSize(pageSize); }, onChange(current) { - company.setCurrent(current); }, + showTotal(total){ + return `共 ${total} 条` + } }; @@ -413,21 +416,30 @@ export default class Company extends React.Component { onSearchChange={val => this.onSearchChange(val)} /> { - loading ?
- + init ?
+
: record.id} + loading={loading} dataSource={dataSource} childrenColumnName="children" columns={this.reRenderColumns(columns)} rowSelection={rowSelection} pagination={pagination} - loading={loading} - // onChange={(pagination, filters, sorter) => { - // debugger - // company.getTableInfo(); - // }} + onChange={(pagination, filters, sorter) => { + company.setCurrent(pagination.current); + company.setPageSize(pagination.pageSize); + company.getTableInfo(); + }} indentSize={15} /> + // } diff --git a/pc4mobx/organization/stores/company.js b/pc4mobx/organization/stores/company.js index d5dd07f..4baecc8 100644 --- a/pc4mobx/organization/stores/company.js +++ b/pc4mobx/organization/stores/company.js @@ -51,6 +51,7 @@ export class CompanyStore { @observable companyId = ''; @observable selectedRowKeys = ''; @observable date = ''; + @observable init = true; //是否首次加载 @observable total = 0; @observable current = 1; @observable pageSize = 10; @@ -81,10 +82,11 @@ export class CompanyStore { return response.json() }).then(res => { if (res.code === 200) { - res.data.pageInfo.list && this.setDataSource(res.data.pageInfo.list); - res.data.pageInfo.columns && this.setColumns(res.data.pageInfo.columns); - res.data.pageInfo.total && this.setTotal(res.data.pageInfo.total ) - this.setLoading(false); + res.data.pageInfo.list && this.setDataSource(res.data.pageInfo.list); + res.data.pageInfo.columns && this.setColumns(res.data.pageInfo.columns); + res.data.pageInfo.total && this.setTotal(res.data.pageInfo.total); + this.setLoading(false); + this.init = false } else { message.warning(res.msg); } @@ -103,14 +105,13 @@ export class CompanyStore { let params = { parentComp:id } - this.setLoading(true); Api.getDeptListByPid(params).then(response => { return response.json() }).then(res => { if (res.code === 200) { res.data.list && this.setDeptDataSource(res.data.list); res.data.columns && this.setDeptColumns(res.data.columns); - this.setLoading(false); + this.setDialogLoadingStatus(false); } else { message.warning(res.msg); } diff --git a/pc4mobx/organization/stores/joblevel.js b/pc4mobx/organization/stores/joblevel.js index 99c2deb..65ad030 100644 --- a/pc4mobx/organization/stores/joblevel.js +++ b/pc4mobx/organization/stores/joblevel.js @@ -53,6 +53,8 @@ export class JobLevelStore { @action getTableInfo() { let params; + //获取tab信息 + this.getTabInfo(); this.tableStore = new TableStore(); if (this.isEmptyObject(this.form2.getFormParams())) { params = { @@ -75,9 +77,7 @@ export class JobLevelStore { }, error => { message.warning(error.msg); }) - //获取tab信息 - this.getTabInfo(); - + } //删除 diff --git a/pc4mobx/organization/style/common.less b/pc4mobx/organization/style/common.less index 5c3fad6..7ebbd2b 100644 --- a/pc4mobx/organization/style/common.less +++ b/pc4mobx/organization/style/common.less @@ -18,7 +18,12 @@ width: 400px !important; line-height: 30px; } - } + } +} + +.hrm-new-weatable-spin { + text-align: center; + margin-top: 10px; } @@ -47,4 +52,6 @@ padding-left: 25%; } } + + } \ No newline at end of file