diff --git a/pc4mobx/hrmSalary/apis/welfareScheme.js b/pc4mobx/hrmSalary/apis/welfareScheme.js index d7adb154..11ce1976 100644 --- a/pc4mobx/hrmSalary/apis/welfareScheme.js +++ b/pc4mobx/hrmSalary/apis/welfareScheme.js @@ -4,7 +4,15 @@ export const getForm = params => { return WeaTools.callApi('/api/bs/hrmsalary/scheme/getForm', 'get', params); }; export const getTable = params => { - return WeaTools.callApi('/api/bs/hrmsalary/scheme/getTable', 'get', params); + // return WeaTools.callApi('/api/bs/hrmsalary/scheme/getTable', 'get', params); + return fetch('/api/bs/hrmsalary/scheme/getTable', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }).then(res => res.json()) }; export const createScheme = params => { return fetch('/api/bs/hrmsalary/scheme/insert', { diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.js index a490b830..f5c2c8f8 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.js @@ -5,7 +5,7 @@ import { WeaTableNew } from "comsMobx" import { Button, Table, DatePicker, Row, Col, Menu, Dropdown, Switch } from 'antd'; -import { WeaInputSearch, WeaSlideModal, WeaHelpfulTip, WeaCheckbox, WeaDatePicker, WeaTop, WeaTab, WeaRightMenu, WeaRangePicker, WeaSelect } from 'ecCom'; +import { WeaInputSearch, WeaSlideModal, WeaHelpfulTip, WeaCheckbox, WeaDatePicker, WeaTop, WeaTab, WeaRightMenu, WeaRangePicker, WeaSelect, WeaTable } from 'ecCom'; import { renderNoright, getSearchs } from '../../../util'; // 渲染form数据的方法:因为多个页面都会使用,所以抽的公共方法在util中 import CustomTab from '../../../components/customTab'; @@ -26,7 +26,6 @@ import ItemMangeFormModal from './itemMangeFormModal' const { MonthPicker } = DatePicker; -const WeaTable = WeaTableNew.WeaTable; @inject('attendanceStore') @observer @@ -56,8 +55,10 @@ export default class Attendance extends React.Component { itemMangeVisible: false, itemMangeValue: {}, fieldName: "", - fieldSettingSearchValue: "" + fieldSettingSearchValue: "", + fieldCurrent: 1 } + this.fieldSearch = {} } componentWillMount() { @@ -88,18 +89,28 @@ export default class Attendance extends React.Component { setCurrentItem(record) } + // 字段列表分页 + handleFieldPageChange(value) { + this.setState({fieldCurrent: value}) + const { attendanceStore: {getAttendanceFieldList} } = this.props; + this.fieldSearch.current = value + getAttendanceFieldList(this.fieldSearch) + } + render() { const { attendanceStore } = this.props; const { loading, hasRight, form, condition, tableStore, showSearchAd, getTableDatas, doSearch, setShowSearchAd } = attendanceStore; const { step, setStep, setSlideVisiable, slideVisiable, doBatchDelete, attendTableStore, fieldSettingAttendList, fieldSettingCustomList, setFieldSettingAttendList, setFieldSettingCustomList, searchFieldSettingList } = attendanceStore; - const { getAttendanceFieldSettingList, saveAttendanceFieldSetting } = attendanceStore + const { getAttendanceFieldSettingList, saveAttendanceFieldSetting, fieldDataSource, fieldTableStore, fieldPageInfo} = attendanceStore const selectedRowKeys = toJS(tableStore.selectedRowKeys) || []; // tableStore 右侧选中数组 + if (!hasRight && !loading) { // 无权限处理 return renderNoright(); } const batchDelete = () => { doBatchDelete() + this.fieldSearch = {fieldName: this.state.fieldName} getAttendanceFieldList({fieldName: this.state.fieldName}) } @@ -229,7 +240,8 @@ export default class Attendance extends React.Component { const handleItemSearch = (value) => { const { attendanceStore: {getAttendanceFieldList}} = this.props; - getAttendanceFieldList({fieldName: value}) + this.fieldSearch = {fieldName: value} + getAttendanceFieldList(this.fieldSearch) } const handleNewClick = () => { @@ -263,7 +275,8 @@ export default class Attendance extends React.Component { }) if(v == "1") { - getAttendanceFieldList({fieldName: this.state.fieldName}) + this.fieldSearch = {fieldName: this.state.fieldName} + getAttendanceFieldList(this.fieldSearch) } else if(v == "0") { getAttendanceList({}) } @@ -276,32 +289,40 @@ export default class Attendance extends React.Component { enableStatus: value } updateAttendanceFieldStatus(request).then(result => { - getAttendanceFieldList({fieldName: this.state.fieldName}) + this.fieldSearch = {fieldName: this.state.fieldName} + getAttendanceFieldList(this.fieldSearch) }) } // 字段Columns const getFieldColumns = (columns) => { - let newColumns = ''; - newColumns = columns.map(column => { + let newColumns = columns.filter(item => item.hide == "false") + newColumns = newColumns.map(column => { let newColumn = column; newColumn.render = (text, record, index) => { //前端元素转义 let valueSpan = record[newColumn.dataIndex + "span"] !== undefined ? record[newColumn.dataIndex + "span"] : record[newColumn.dataIndex]; switch(newColumn.dataIndex) { case "username": - return {this.onEdit(record)}} + return {this.onItemEdit(record)}} dangerouslySetInnerHTML={{ __html: valueSpan }} /> case "enableStatus": return {handleSwitchItemChange(record, value)}}/> - case "operate": - return {this.onEdit(record)}}>查看明细 default: return
} } return newColumn; }); + newColumns.push({ + title: "操作", + dataIndex: "operate", + render: (text, record) => { + return ( + {this.onItemEdit(record)}}>查看明细 + ) + } + }) return newColumns; } @@ -310,7 +331,8 @@ export default class Attendance extends React.Component { const { attendanceStore: { saveAttendanceField, getAttendanceFieldList }} = this.props; value.fieldType = value.fieldType == "1" ? "NUMBER" : "TEXT" saveAttendanceField(value) - getAttendanceFieldList({fieldName: this.state.fieldName}) + this.fieldSearch = {fieldName: this.state.fieldName} + getAttendanceFieldList(this.fieldSearch) this.setState({itemMangeVisible: false}) } @@ -319,7 +341,8 @@ export default class Attendance extends React.Component { // alert(JSON.stringify(value)); value.fieldType = value.fieldType == "1" ? "NUMBER" : "TEXT" updateAttendanceField(value) - getAttendanceFieldList({fieldName: this.state.fieldName}) + this.fieldSearch = {fieldName: this.state.fieldName} + getAttendanceFieldList(this.fieldSearch) this.setState({itemMangeVisible: false}) } @@ -384,13 +407,13 @@ export default class Attendance extends React.Component { }} /> - + /> */}
:
@@ -406,13 +429,23 @@ export default class Attendance extends React.Component { /> + + {this.handleFieldPageChange(value)}, + total: fieldPageInfo.total, + current: this.state.fieldCurrent + }} /> } rightContent={ diff --git a/pc4mobx/hrmSalary/pages/payroll/index.js b/pc4mobx/hrmSalary/pages/payroll/index.js index bcc5aaa4..f9dcc14d 100644 --- a/pc4mobx/hrmSalary/pages/payroll/index.js +++ b/pc4mobx/hrmSalary/pages/payroll/index.js @@ -360,7 +360,6 @@ export default class Payroll extends React.Component { onDelete={(record)=> this.handleTemplateListDelete(record)} /> } - diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/index.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/index.js index a7097026..6b3645ea 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/index.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/index.js @@ -2,14 +2,14 @@ import React from 'react'; import { inject, observer } from 'mobx-react'; import { toJS } from 'mobx'; -import { Button, Table, DatePicker, Row, Col, Switch, Modal } from 'antd'; +import { Button, Table, DatePicker, Row, Col, Switch, Modal, Dropdown, Menu } from 'antd'; -import { WeaTop, WeaTab, WeaRightMenu, WeaRangePicker, WeaInputSearch, WeaSlideModal, WeaSelect } from 'ecCom'; +import { WeaTop, WeaTab, WeaRightMenu, WeaRangePicker, WeaInputSearch, WeaSlideModal, WeaSelect, WeaTable } from 'ecCom'; import { WeaTableNew } from "comsMobx" import "./index.less"; -const WeaTable = WeaTableNew.WeaTable; +const WeaMobxTable = WeaTableNew.WeaTable; import { renderNoright, getSearchs } from '../../../util'; // 渲染form数据的方法:因为多个页面都会使用,所以抽的公共方法在util中 import CustomTab from '../../../components/customTab'; @@ -58,11 +58,14 @@ export default class Programme extends React.Component { // 增加编辑功能,重写columns绑定事件 getColumns = (columns) => { - let newColumns = ''; - newColumns = columns.map(column => { + let newColumns = columns.filter(item => item.dataIndex !== "id" && item.dataIndex !== "paymentArea") + newColumns = newColumns.map(column => { let newColumn = column; newColumn.render = (text, record, index) => { //前端元素转义 let valueSpan = record[newColumn.dataIndex + "span"] !== undefined ? record[newColumn.dataIndex + "span"] : record[newColumn.dataIndex]; + if(newColumn.dataIndex == "id") { + newColumn.display = false + } switch(newColumn.dataIndex) { case "operate": return {this.onEdit(record)}}>编辑 @@ -72,6 +75,34 @@ export default class Programme extends React.Component { } return newColumn; }); + + newColumns.push({ + title: "操作", + dataIndex: "operate", + render: (text, record) => { + return {this.onEdit(record)}}>编辑 + } + }) + newColumns.push( + { + title : '', + key: "moreOperate", + dataIndex: "moreOperate", + render: (text, record) => { + return ( + + + { + this.onCopy(record); + }}>复制 + + }> + + + + ); + } + }) return newColumns; } @@ -127,17 +158,6 @@ export default class Programme extends React.Component { }) } - onOperatesClick(record, index, operate, flag) { - switch(operate.text.toString()){ - case '编辑': // 编辑 - this.onEdit(record); - break; - case "复制": // 复制 - this.onCopy(record); - break; - } - } - onCustomOperatesClick(record, index, operate, flag) { switch(operate.text.toString()){ case '编辑': // 编辑 @@ -167,7 +187,7 @@ export default class Programme extends React.Component { const { loading, hasRight, form, condition, tableStore, showSearchAd, getTableDatas, doSearch, setShowSearchAd } = programmeStore; const { selectedKey, setSelectedKey, getCustomCategoryList, customTableStore, customSelectkey, setCustomSelectkey, requestParams, setRequestParams, formCondition, - setCustomNewVisible, customNewVisible } = programmeStore; + setCustomNewVisible, customNewVisible, tableDataSource, tableColumns } = programmeStore; if (!hasRight && !loading) { // 无权限处理 return renderNoright(); } @@ -349,7 +369,7 @@ export default class Programme extends React.Component { selectedKey == "custom" ? : + // + + } diff --git a/pc4mobx/hrmSalary/stores/attendanceStore.js b/pc4mobx/hrmSalary/stores/attendanceStore.js index 6f7e2a8f..13ddfdf7 100644 --- a/pc4mobx/hrmSalary/stores/attendanceStore.js +++ b/pc4mobx/hrmSalary/stores/attendanceStore.js @@ -25,6 +25,10 @@ export class AttendanceStore { requestFeildAttendList = []; // 请求数据 requestFeildCustomList = []; // 请求数据 + // 考勤字段 + @observable fieldDataSource = []; // 字段列表 + @observable fieldTableStore = new TableStore(); // new Table + @observable fieldPageInfo = {}; @action searchFieldSettingList = (value) => { @@ -138,7 +142,9 @@ export class AttendanceStore { this.loading = true; API.getAttendanceFieldList(params).then(res => { if (res.status) { // 接口请求成功/失败处理 - this.tableStore.getDatas(res.data.datas); // table 请求数据 + this.fieldTableStore.getDatas(res.data.dataKey.datas); // table 请求数据 + this.fieldDataSource = res.data.pageInfo.list + this.fieldPageInfo = res.data.pageInfo } else { message.error(res.errormsg || '接口调用失败!') } diff --git a/pc4mobx/hrmSalary/stores/programme.js b/pc4mobx/hrmSalary/stores/programme.js index 35ddd247..a6e48ba9 100644 --- a/pc4mobx/hrmSalary/stores/programme.js +++ b/pc4mobx/hrmSalary/stores/programme.js @@ -25,9 +25,13 @@ export class ProgrammeStore { } @observable form = new WeaForm(); @observable formCondition = []; // 存储后台得到的form数据 - @observable customNewVisible = false; +@observable customNewVisible = false; @observable customRequest = {} + // 福利方案列表 + @observable tableDataSource = []; + @observable tableColumns = []; + @action setCustomRequest = customRequest => this.customRequest = customRequest @@ -89,7 +93,11 @@ export class ProgrammeStore { params.welfareTypeEnum = selectKey API.getTable(params).then(action(res => { if (res.status) { // 接口请求成功/失败处理 - this.tableStore.getDatas(res.data.datas); // table 请求数据 + // this.tableStore.getDatas(res.data.datas); // table 请求数据 + this.tableDataSource = res.data.list ? res.data.list : []; + this.tableColumns = res.data.columns; + console.log("this.tableColumns", this.tableColumns); + console.log("this.tableDataSource", this.tableDataSource); } else { message.error(res.errormsg || '接口调用失败!') }