salary-management-front/pc4mobx/hrmSalary/pages/salaryItem/systemSalaryItemModal.js

84 lines
2.2 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import React from "react";
import { WeaDialog, WeaInputSearch } from "ecCom";
import { Button } from "antd";
import { inject, observer } from "mobx-react";
import { WeaTableNew } from "comsMobx";
import "./index.less";
const WeaTable = WeaTableNew.WeaTable;
@inject("salaryItemStore")
@observer
export default class SystemSalaryItemModal extends React.Component {
constructor(props) {
super(props);
this.state = {
searchValue: ""
};
}
// 搜索改变事件
handleSearchChange(value) {
this.setState({ searchValue: value });
}
// 搜索
handleSearch(value) {
const { salaryItemStore } = this.props;
const { getSysItemList } = salaryItemStore;
getSysItemList({ name: value });
}
render() {
const { salaryItemStore } = this.props;
const { sysListTableStore, saveLoading } = salaryItemStore;
const { searchValue } = this.state;
const handleAdd = () => {
const { salaryItemStore: { saveSysItem } } = this.props;
saveSysItem();
};
return (
<WeaDialog
title="添加系统薪资项目"
initLoadCss
className="sys-salary-wrapper"
visible={this.props.visible}
onCancel={() => {
this.props.onCancel();
}}
style={{ width: "60vw" }}
buttons={[
<Button
type="primary"
loading={saveLoading}
onClick={() => {
handleAdd();
}}
>添加</Button>
]}
>
<div className="headerSearchWrapper">
<WeaInputSearch
value={searchValue}
placeholder="请输入名称"
onChange={(value) => {
this.handleSearchChange(value);
}}
onSearch={(value) => {
this.handleSearch(value);
}}/>
</div>
<WeaTable // table内部做了loading加载处理页面就不需要再加了
comsWeaTableStore={sysListTableStore} // table store
hasOrder={true} // 是否启用排序
needScroll={false} // 是否启用table内部列表滚动将自适应到父级高度
// getColumns={this.getColumns}
// onOperatesClick={this.onOperatesClick.bind(this)}
/>
</WeaDialog>
);
}
}