archives
This commit is contained in:
parent
4ec71f11ce
commit
c517a80b87
|
|
@ -7,13 +7,20 @@ import { WeaTools } from 'ecCom';
|
|||
|
||||
//薪资档案-薪资档案列表
|
||||
export const getArchiveList = params => {
|
||||
return WeaTools.callApi('/api/bs/hrmsalary/salaryArchive/list', 'POST', params);
|
||||
return fetch('/api/bs/hrmsalary/archives/getTable', {
|
||||
method: 'POST',
|
||||
mode: 'cors',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(params)
|
||||
}).then(res => res.json())
|
||||
}
|
||||
|
||||
|
||||
//薪资档案的高级搜索
|
||||
export const getSaCondition = params => {
|
||||
return WeaTools.callApi('/api/bs/hrmsalary/salaryArchive/getSearchCondition', 'GET', params);
|
||||
return WeaTools.callApi('/api/bs/hrmsalary/archives/getSearchCondition', 'get', params);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -5,16 +5,17 @@ import { toJS } from 'mobx';
|
|||
import { Button, Table, DatePicker } from 'antd';
|
||||
|
||||
import { WeaTop, WeaTab, WeaRightMenu, WeaRangePicker, WeaTable } from 'ecCom';
|
||||
// import { WeaTableNew } from "comsMobx"
|
||||
// const WeaTable = WeaTableNew.WeaTable;
|
||||
|
||||
import { renderNoright, getSearchs } from '../../../util'; // 渲染form数据的方法:因为多个页面都会使用,所以抽的公共方法在util中
|
||||
import CustomTab from '../../../components/customTab';
|
||||
import ContentWrapper from '../../../components/contentWrapper';
|
||||
|
||||
import { columns, dataSource } from './columns';
|
||||
|
||||
const { MonthPicker } = DatePicker;
|
||||
|
||||
@inject('baseTableStore')
|
||||
@inject('archivesStore')
|
||||
@observer
|
||||
export default class Archives extends React.Component {
|
||||
constructor(props) {
|
||||
|
|
@ -24,10 +25,16 @@ export default class Archives extends React.Component {
|
|||
selectedKey: "0"
|
||||
}
|
||||
}
|
||||
render() {
|
||||
const { baseTableStore } = this.props;
|
||||
const { loading, hasRight, form, condition, tableStore, showSearchAd, getTableDatas, doSearch, setShowSearchAd } = baseTableStore;
|
||||
|
||||
componentWillMount() {
|
||||
const { archivesStore: {doInit}} = this.props;
|
||||
doInit()
|
||||
}
|
||||
|
||||
render() {
|
||||
const { archivesStore } = this.props;
|
||||
const { loading, hasRight, form, condition, tableStore, showSearchAd, getTableDatas, doSearch, setShowSearchAd } = archivesStore;
|
||||
const { dataSource } = archivesStore
|
||||
if (!hasRight && !loading) { // 无权限处理
|
||||
return renderNoright();
|
||||
}
|
||||
|
|
@ -75,16 +82,32 @@ export default class Archives extends React.Component {
|
|||
dropMenuDatas={rightMenu} // 下拉菜单(和页面的右键菜单相同)
|
||||
dropMenuProps={{ collectParams }} // 收藏功能: 配置之后显示 收藏、帮助、显示页面地址 这3个功能
|
||||
>
|
||||
<CustomTab topTab={topTab}
|
||||
searchOperationItem={
|
||||
renderSearchOperationItem()
|
||||
}
|
||||
onChange={(v) => {
|
||||
this.setState({selectedKey: v})
|
||||
}}
|
||||
/>
|
||||
<WeaTable columns={columns} dataSource={dataSource}/>
|
||||
|
||||
<WeaTab
|
||||
searchType={['base', 'advanced']} // base:基础搜索框 advanced:显示高级搜索按钮
|
||||
showSearchAd={showSearchAd} // 是否展开高级搜索面板
|
||||
setShowSearchAd={bool => setShowSearchAd(bool)} //高级搜索面板受控
|
||||
searchsAd={getSearchs(form, toJS(condition), 2)} // 高级搜索内部数据
|
||||
buttonsAd={adBtn} // 高级搜索内部按钮
|
||||
onSearch={getTableDatas} // 点搜索按钮时的回调
|
||||
onSearchChange={v => form.updateFields({ username: v })} // 在搜索框中输入的文字改变时的回调: 这里需要同步高级搜索和外部搜索框的值
|
||||
searchsBaseValue={form.getFormParams().username} // 外部input搜索值受控: 这里和高级搜索的requestname同步
|
||||
/>
|
||||
{/* <WeaTable // table内部做了loading加载处理,页面就不需要再加了
|
||||
comsWeaTableStore={tableStore} // table store
|
||||
hasOrder={true} // 是否启用排序
|
||||
needScroll={true} // 是否启用table内部列表滚动,将自适应到父级高度
|
||||
|
||||
// getColumns={this.getColumns}
|
||||
// onOperatesClick={this.onOperatesClick.bind(this)}
|
||||
/> */}
|
||||
|
||||
<WeaTable
|
||||
columns={tableStore.columns.filter(item => item.hide == "false")}
|
||||
dataSource={dataSource}
|
||||
|
||||
/>
|
||||
|
||||
</WeaTop>
|
||||
</WeaRightMenu>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,70 @@
|
|||
import { observable, action, toJS } from 'mobx';
|
||||
import { message } from 'antd';
|
||||
import { WeaForm, WeaTableNew } from 'comsMobx';
|
||||
|
||||
import * as API from '../apis/archive'; // 引入API接口文件
|
||||
|
||||
const { TableStore } = WeaTableNew;
|
||||
|
||||
export class ArchivesStore {
|
||||
@observable tableStore = new TableStore(
|
||||
// {dataHandle: (datas) => {
|
||||
// return dataSource;
|
||||
// }}
|
||||
);
|
||||
@observable form = new WeaForm(); // nrew 一个form
|
||||
@observable condition = []; // 存储后台得到的form数据
|
||||
@observable hasRight = true; // 判断用户是有权限查看当前页面: 没有权限渲染无权限页面,有权限渲染数据
|
||||
@observable showSearchAd = false; // 高级搜索面板显示
|
||||
@observable loading = true; // 数据加载状态
|
||||
|
||||
@observable dataSource = [];
|
||||
|
||||
// 初始化操作
|
||||
@action
|
||||
doInit = () => {
|
||||
this.getCondition();
|
||||
this.getTableDatas();
|
||||
}
|
||||
|
||||
// 获得高级搜索表单数据
|
||||
@action
|
||||
getCondition = () => {
|
||||
API.getSaCondition().then(action(res => {
|
||||
if (res.status) { // 接口请求成功/失败处理
|
||||
this.condition = res.data.condition;
|
||||
this.form.initFormFields(res.data.condition); // 渲染高级搜索form表单
|
||||
} else {
|
||||
message.error(res.msg || '接口调用失败!')
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
// 渲染table数据
|
||||
@action
|
||||
getTableDatas = (params) => {
|
||||
this.loading = true;
|
||||
const formParams = this.form.getFormParams() || {};
|
||||
params = params || formParams;
|
||||
API.getArchiveList(params).then(action(res => {
|
||||
if (res.status) { // 接口请求成功/失败处理
|
||||
this.dataSource = res.data.datas;
|
||||
// this.columns = res.data.columns;
|
||||
this.tableStore.getDatas(res.data.dataKey.datas)
|
||||
} else {
|
||||
message.error(res.msg || '接口调用失败!')
|
||||
}
|
||||
this.loading = false;
|
||||
}));
|
||||
}
|
||||
|
||||
@action
|
||||
setShowSearchAd = bool => this.showSearchAd = bool;
|
||||
|
||||
// 高级搜索 - 搜索
|
||||
@action doSearch = () => {
|
||||
this.getTableDatas();
|
||||
this.showSearchAd = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -11,6 +11,7 @@ import { ProgrammeStore } from './programme'
|
|||
import { AttendanceStore } from './attendanceStore';
|
||||
import { SalaryItemStore } from './salaryItem'
|
||||
import { LedgerStore } from './ledger'
|
||||
import { ArchivesStore } from './archives'
|
||||
|
||||
module.exports = {
|
||||
baseFormStore: new BaseFormStore(),
|
||||
|
|
@ -24,6 +25,7 @@ module.exports = {
|
|||
programmeStore: new ProgrammeStore(),
|
||||
attendanceStore: new AttendanceStore(),
|
||||
salaryItemStore: new SalaryItemStore(),
|
||||
ledgerStore: new LedgerStore()
|
||||
ledgerStore: new LedgerStore(),
|
||||
archivesStore: new ArchivesStore()
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue