diff --git a/pc4mobx/hrmSalary/apis/payroll.js b/pc4mobx/hrmSalary/apis/payroll.js index 22e7db7d..954050e9 100644 --- a/pc4mobx/hrmSalary/apis/payroll.js +++ b/pc4mobx/hrmSalary/apis/payroll.js @@ -1,265 +1,315 @@ -import { WeaTools } from 'ecCom'; +import { WeaTools } from "ecCom"; //工资单-工资单发放列表 export const getPayrollList = params => { - return fetch('/api/bs/hrmsalary/salaryBill/send/list', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} + return fetch("/api/bs/hrmsalary/salaryBill/send/list", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify(params) + }).then(res => res.json()); +}; //工资单-获取table提示信息 export const getPayrollInfo = params => { - return WeaTools.callApi('/api/bs/hrmsalary/salaryBill/send/getBaseInfo', 'get', params); -} - + return WeaTools.callApi( + "/api/bs/hrmsalary/salaryBill/send/getBaseInfo", + "get", + params + ); +}; //工资单-获取工资单发放高级搜索 export const getPaySa = params => { - return WeaTools.callApi('/api/bs/hrmsalary/salaryBill/send/getInfoSearchCondition', 'get', params); -} - + return WeaTools.callApi( + "/api/bs/hrmsalary/salaryBill/send/getInfoSearchCondition", + "get", + params + ); +}; //工资单-工资单发放 export const grantPayroll = params => { - return fetch('/api/bs/hrmsalary/salaryBill/send/grant', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} + return fetch("/api/bs/hrmsalary/salaryBill/send/grant", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify(params) + }).then(res => res.json()); +}; //工资单-工资单撤回 export const withdrawPayroll = params => { - return fetch('/api/bs/hrmsalary/salaryBill/send/withdraw', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} - + return fetch("/api/bs/hrmsalary/salaryBill/send/withdraw", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify(params) + }).then(res => res.json()); +}; //工资单-工资单发放详情列表 export const getPayrollDetailList = params => { - return fetch('/api/bs/hrmsalary/salaryBill/send/detailList', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} + return fetch("/api/bs/hrmsalary/salaryBill/send/detailList", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify(params) + }).then(res => res.json()); +}; //工资单-工资单发放详情列表的高级搜索 export const getPayrollDetailSa = params => { - return fetch('/api/bs/hrmsalary/salaryBill/send/getDetailSearchCondition', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} + return fetch("/api/bs/hrmsalary/salaryBill/send/getDetailSearchCondition", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify(params) + }).then(res => res.json()); +}; //工资单-导出-工资单发放信息列表 export const exportPayroll = params => { - return WeaTools.callApi('/api/bs/hrmsalary/salaryBill/send/exportInfoList', 'POST', params); -} + fetch("/api/bs/hrmsalary/salaryBill/send/exportInfoList", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify(params) + }).then(res => + res.blob().then(blob => { + var filename = `工资单发放.xlsx`; + var a = document.createElement("a"); + var url = window.URL.createObjectURL(blob); + a.href = url; + a.download = filename; + a.click(); + window.URL.revokeObjectURL(url); + }) + ); +}; //工资单-工资单模板列表 export const getPayrollTemplateList = params => { - return fetch('/api/bs/hrmsalary/salaryBill/template/list', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} + return fetch("/api/bs/hrmsalary/salaryBill/template/list", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify(params) + }).then(res => res.json()); +}; //工资单-获取薪资账套下拉列表 export const getPayrollTemplateLedgerList = params => { - return WeaTools.callApi('/api/bs/hrmsalary/salaryBill/template/selectSalarySobList', 'POST', params); -} - + return WeaTools.callApi( + "/api/bs/hrmsalary/salaryBill/template/selectSalarySobList", + "POST", + params + ); +}; //工资单-获取工资单基础设置表单 export const getPayrollBaseForm = params => { - return WeaTools.callApi('/api/bs/hrmsalary/salaryBill/template/getBaseForm', 'get', params); -} + return WeaTools.callApi( + "/api/bs/hrmsalary/salaryBill/template/getBaseForm", + "get", + params + ); +}; //工资单-获取工资单显示设置表单 export const getPayrollShowForm = params => { - return WeaTools.callApi('/api/bs/hrmsalary/salaryBill/template/getShowForm', 'get', params); -} + return WeaTools.callApi( + "/api/bs/hrmsalary/salaryBill/template/getShowForm", + "get", + params + ); +}; //工资单-获取工资单薪资项目设置 export const getPayrollItemList = params => { - return WeaTools.callApi('/api/bs/hrmsalary/salaryBill/template/getSalaryItemSet', 'get', params); -} + return WeaTools.callApi( + "/api/bs/hrmsalary/salaryBill/template/getSalaryItemSet", + "get", + params + ); +}; //工资单-更改默认使用 export const changePayrollDefaultUse = params => { - return fetch('/api/bs/hrmsalary/salaryBill/template/defaultUse', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} + return fetch("/api/bs/hrmsalary/salaryBill/template/defaultUse", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify(params) + }).then(res => res.json()); +}; //工资单-新建工资单 export const savePayroll = params => { - return fetch('/api/bs/hrmsalary/salaryBill/template/save', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} + return fetch("/api/bs/hrmsalary/salaryBill/template/save", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify(params) + }).then(res => res.json()); +}; //工资单-编辑工资单 export const updatePayroll = params => { - return fetch('/api/bs/hrmsalary/salaryBill/template/update', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} - + return fetch("/api/bs/hrmsalary/salaryBill/template/update", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify(params) + }).then(res => res.json()); +}; //工资单-编辑工资单-编辑基础设置 export const updatePayrollBase = params => { - return WeaTools.callApi('/api/bs/hrmsalary/salaryBill/template/updateBase', 'POST', params); -} + return WeaTools.callApi( + "/api/bs/hrmsalary/salaryBill/template/updateBase", + "POST", + params + ); +}; //工资单-编辑工资单-编辑显示设置 export const updatePayrollShow = params => { - return WeaTools.callApi('/api/bs/hrmsalary/salaryBill/template/updateShow', 'POST', params); -} + return WeaTools.callApi( + "/api/bs/hrmsalary/salaryBill/template/updateShow", + "POST", + params + ); +}; //工资单-复制工资单 export const duplicatePayroll = params => { - return fetch('/api/bs/hrmsalary/salaryBill/template/copy', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} - + return fetch("/api/bs/hrmsalary/salaryBill/template/copy", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify(params) + }).then(res => res.json()); +}; //工资单-删除工资单 export const deletePayroll = params => { - return fetch('/api/bs/hrmsalary/salaryBill/template/delete', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} + return fetch("/api/bs/hrmsalary/salaryBill/template/delete", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify(params) + }).then(res => res.json()); +}; //工资单-获取租户名 export const getTenantName = params => { - return WeaTools.callApi('/api/bs/hrmsalary/salaryBill/template/getTenantName', 'get', params); -} + return WeaTools.callApi( + "/api/bs/hrmsalary/salaryBill/template/getTenantName", + "get", + params + ); +}; // 工资单发放-工资单发放信息列表 export const getInfoList = params => { - return fetch('/api/bs/hrmsalary/salaryBill/send/infoList', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} + return fetch("/api/bs/hrmsalary/salaryBill/send/infoList", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify(params) + }).then(res => res.json()); +}; // 工资单发放-导出-工资单发放详情列表 export const exportDetailList = params => { - fetch('/api/bs/hrmsalary/salaryBill/send/exportDetailList', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.blob().then(blob => { - var filename=`工资单发放详情列表.xlsx` - var a = document.createElement('a'); - var url = window.URL.createObjectURL(blob); - a.href = url; - a.download = filename; - a.click(); - window.URL.revokeObjectURL(url); - })) -} + fetch("/api/bs/hrmsalary/salaryBill/send/exportDetailList", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify(params) + }).then(res => + res.blob().then(blob => { + var filename = `工资单发放详情列表.xlsx`; + var a = document.createElement("a"); + var url = window.URL.createObjectURL(blob); + a.href = url; + a.download = filename; + a.click(); + window.URL.revokeObjectURL(url); + }) + ); +}; // 工资单发放-工资单批量发放信息列表 export const batchSendInfoList = params => { - return fetch('/api/bs/hrmsalary/salaryBill/send/batchSendInfoList', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} + return fetch("/api/bs/hrmsalary/salaryBill/send/batchSendInfoList", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify(params) + }).then(res => res.json()); +}; // 工资单发放-工资单批量撤回信息列表 export const batchWithdrawInfoList = params => { - return fetch('/api/bs/hrmsalary/salaryBill/send/batchWithdrawInfoList', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} + return fetch("/api/bs/hrmsalary/salaryBill/send/batchWithdrawInfoList", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify(params) + }).then(res => res.json()); +}; // 工资单发放-按钮状态 export const getSendBtnStatus = params => { - return WeaTools.callApi('/api/bs/hrmsalary/salaryBill/send/getSendBtnStatus', 'get', params); -} + return WeaTools.callApi( + "/api/bs/hrmsalary/salaryBill/send/getSendBtnStatus", + "get", + params + ); +}; // 工资单发放-扩展按钮点击 export const grantProxy = params => { - return fetch('/api/bs/hrmsalary/salaryBill/grantProxy', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} - - - + return fetch("/api/bs/hrmsalary/salaryBill/grantProxy", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify(params) + }).then(res => res.json()); +}; diff --git a/pc4mobx/hrmSalary/apis/welfareArchive.js b/pc4mobx/hrmSalary/apis/welfareArchive.js index f5446fa6..c25281de 100644 --- a/pc4mobx/hrmSalary/apis/welfareArchive.js +++ b/pc4mobx/hrmSalary/apis/welfareArchive.js @@ -96,7 +96,7 @@ export const importBatch = (params) => { // 导出档案 export const exportArchives = (ids) => { fetch('/api/bs/hrmsalary/scheme/export?ids=' + ids).then(res => res.blob().then(blob => { - var filename=`员工档案.xlsx` + var filename=`社保福利档案.xlsx` var a = document.createElement('a'); var url = window.URL.createObjectURL(blob); a.href = url; diff --git a/pc4mobx/hrmSalary/pages/calculate/index.js b/pc4mobx/hrmSalary/pages/calculate/index.js index 6d6f5004..21209ff5 100644 --- a/pc4mobx/hrmSalary/pages/calculate/index.js +++ b/pc4mobx/hrmSalary/pages/calculate/index.js @@ -255,7 +255,7 @@ export default class Calculate extends React.Component { }; } }); - return columns; + return showOperateBtn ? columns : _.filter(columns, it => it.title != "操作"); } // 分页 diff --git a/pc4mobx/hrmSalary/pages/ledger/index.js b/pc4mobx/hrmSalary/pages/ledger/index.js index eb1a61b1..5a72e0ba 100644 --- a/pc4mobx/hrmSalary/pages/ledger/index.js +++ b/pc4mobx/hrmSalary/pages/ledger/index.js @@ -11,7 +11,7 @@ import { WeaRangePicker, WeaInputSearch, WeaSlideModal, - WeaTable, + WeaTable } from "ecCom"; import { renderNoright, getSearchs } from "../../util"; // 渲染form数据的方法:因为多个页面都会使用,所以抽的公共方法在util中 import CustomTab from "../../components/customTab"; @@ -45,55 +45,49 @@ export default class Ledger extends React.Component { selectedTab: 0, currentReocrd: {}, searchValue: "", - step1Request: {}, + step1Request: {} }; } handleSearch(value) { - const { - ledgerStore: { getTableDatas }, - } = this.props; + const { ledgerStore: { getTableDatas } } = this.props; getTableDatas({ name: value }); } refereUser() { this.setState({ editSlideVisible: true, - selectedTab: 1, + selectedTab: 1 }); } onEdit() { this.setState({ - editSlideVisible: true, + editSlideVisible: true }); } componentWillMount() { const { ledgerStore: { doInit }, - taxAgentStore: { fetchTaxAgentOption }, + taxAgentStore: { fetchTaxAgentOption } } = this.props; doInit(); fetchTaxAgentOption(); } handleItemStatusChange(value, record) { - const { - ledgerStore: { changeLedgerStatus }, - } = this.props; + const { ledgerStore: { changeLedgerStatus } } = this.props; changeLedgerStatus(record.id, value ? 0 : 1); } handleItemClick(record, selectedTab = 0) { - const { - ledgerStore: { setSalarySobId }, - } = this.props; + const { ledgerStore: { setSalarySobId } } = this.props; setSalarySobId(record.id); this.setState({ selectedTab, editSlideVisible: true, - request: record, + request: record }); } @@ -105,8 +99,8 @@ export default class Ledger extends React.Component { saveLedgerItem, saveAdjustmentRule, saveLedgerBasic, - baseInfoRequest, - }, + baseInfoRequest + } } = this.props; if (selectedTab == 0) { saveLedgerBasic(baseInfoRequest); @@ -118,9 +112,9 @@ export default class Ledger extends React.Component { } // 增加编辑功能,重写columns绑定事件 - getColumns = (columns) => { + getColumns = columns => { let newColumns = ""; - newColumns = columns.map((column) => { + newColumns = columns.map(column => { let newColumn = column; newColumn.render = (text, record, index) => { //前端元素转义 @@ -142,7 +136,7 @@ export default class Ledger extends React.Component { return ( { + onChange={value => { this.handleItemStatusChange(value, record); }} /> @@ -166,9 +160,7 @@ export default class Ledger extends React.Component { }; onOperatesClick = (record, type) => { - const { - ledgerStore: { deleteLedger }, - } = this.props; + const { ledgerStore: { deleteLedger } } = this.props; switch (type.toString()) { case "0": // 编辑 this.handleItemClick(record); @@ -176,7 +168,7 @@ export default class Ledger extends React.Component { case "1": // 复制 this.setState({ copyFormVisible: true, - currentReocrd: record, + currentReocrd: record }); break; case "3": // 关联人员 @@ -189,26 +181,22 @@ export default class Ledger extends React.Component { onOk: () => { deleteLedger([record.id]); }, - onCancel: () => {}, + onCancel: () => {} }); break; } }; - handleCopySave = (value) => { - const { - ledgerStore: { doCopy }, - } = this.props; - doCopy({id:this.state.currentReocrd.id, ...value}).then(() => { + handleCopySave = value => { + const { ledgerStore: { doCopy } } = this.props; + doCopy({ id: this.state.currentReocrd.id, ...value }).then(() => { this.setState({ copyFormVisible: false }); }); }; handleNew = () => { - const { - ledgerStore: { initSlideData }, - } = this.props; + const { ledgerStore: { initSlideData } } = this.props; initSlideData(); this.setState({ stepSlideVisible: true, currentStep: 0 }); }; @@ -229,9 +217,9 @@ export default class Ledger extends React.Component { getTableDatas, doSearch, setShowSearchAd, - baseInfoRequest, + baseInfoRequest } = ledgerStore; - const { showOperateBtn }= taxAgentStore; + const { showOperateBtn } = taxAgentStore; const { canEdit } = baseInfoRequest; const { currentStep, selectedTab } = this.state; if (!hasRight && !loading) { @@ -245,8 +233,8 @@ export default class Ledger extends React.Component { key: "BTN_COLUMN", icon: , content: "显示列定制", - onClick: this.showColumn, - }, + onClick: this.showColumn + } ]; const collectParams = { // 收藏功能配置 @@ -254,7 +242,7 @@ export default class Ledger extends React.Component { favouritetype: 1, objid: 0, link: "wui/index.html#/ns_demo03/index", - importantlevel: 1, + importantlevel: 1 }; const adBtn = [ // 高级搜索内部按钮 @@ -266,7 +254,7 @@ export default class Ledger extends React.Component { , , + ]; const topTab = []; @@ -274,21 +262,19 @@ export default class Ledger extends React.Component { const renderRightOperation = () => { return (
- { - showOperateBtn && + {showOperateBtn && - } + } { + onChange={value => { this.setState({ searchValue: value }); }} - onSearch={(value) => { + onSearch={value => { this.handleSearch(value); }} /> @@ -309,24 +295,20 @@ export default class Ledger extends React.Component { "基础设置", "关联人员", "薪资项目", - "调薪计薪规则", + "调薪计薪规则" // "校验规则", ]; const handleStep1Save = () => { const { step1Request } = this.state; - const { - ledgerStore: { saveLedgerBasic, baseInfoRequest }, - } = this.props; + const { ledgerStore: { saveLedgerBasic, baseInfoRequest } } = this.props; saveLedgerBasic(baseInfoRequest).then(() => { nextStep(); }); }; const handleStep3Save = () => { - const { - ledgerStore: { saveAdjustmentRule }, - } = this.props; + const { ledgerStore: { saveAdjustmentRule } } = this.props; saveAdjustmentRule().then(() => { nextStep(); }); @@ -339,8 +321,8 @@ export default class Ledger extends React.Component { saveLedgerBasic, saveLedgerItem, saveAdjustmentRule, - baseInfoRequest, - }, + baseInfoRequest + } } = this.props; if (currentStep == 0) { saveLedgerBasic(baseInfoRequest).then(() => { @@ -361,27 +343,27 @@ export default class Ledger extends React.Component { const pagination = { total: pageObj.total, - showTotal: (total) => `共 ${total} 条`, + showTotal: total => `共 ${total} 条`, showSizeChanger: true, pageSizeOptions: ["10", "20", "50", "100"], onShowSizeChange: (current, pageSize) => { setPageObj({ ...pageObj, current, pageSize }); getTableDatas({ current, pageSize, name: this.state.searchValue }); }, - onChange: (current) => { + onChange: current => { setPageObj({ ...pageObj, current, pageSize: pageObj.pageSize }); getTableDatas({ current, pageSize: pageObj.pageSize, - name: this.state.searchValue, + name: this.state.searchValue }); - }, + } }; - const newColumns = _.map([...columns], (item) => { + const newColumns = _.map([...columns], item => { if (item.dataIndex === "name") { return { ...item, - render: (text, record) => ( + render: (text, record) =>
- ), }; } else if (item.dataIndex === "disable") { return { ...item, - render: (text, record) => ( + render: (text, record) => { + onChange={value => { this.handleItemStatusChange(value, record); }} /> - ), }; } else if (item.dataIndex === "operate" && showOperateBtn) { return { ...item, - render: (text, record) => ( + render: (text, record) =>
{ @@ -420,7 +400,7 @@ export default class Ledger extends React.Component { this.onOperatesClick(record, item.key)}> + onClick={item => this.onOperatesClick(record, item.key)}> 编辑 复制 关联人员 @@ -432,7 +412,6 @@ export default class Ledger extends React.Component {
- ), }; } else { return { ...item }; @@ -443,29 +422,31 @@ export default class Ledger extends React.Component {
+ collectParams={collectParams}> } // 左侧图标 iconBgcolor="#F14A2D" // 左侧图标背景色 showDropIcon={true} // 是否显示下拉按钮 dropMenuDatas={rightMenu} // 下拉菜单(和页面的右键菜单相同) - dropMenuProps={{ collectParams }} // 收藏功能: 配置之后显示 收藏、帮助、显示页面地址 这3个功能 - > + dropMenuProps={{ collectParams }}> {}} + onChange={v => {}} /> it.dataIndex !== "operate") + } dataSource={dataSource} pagination={pagination} loading={loading} scroll={{ x: 1300 }} /> - {this.state.stepSlideVisible && ( + {this.state.stepSlideVisible && - {currentStep == 0 && ( + {currentStep == 0 && - )} - {currentStep == 1 && ( + } + {currentStep == 1 &&
-
- )} - {currentStep == 2 && ( +
} + {currentStep == 2 &&
-
- )} - {currentStep == 3 && ( +
} + {currentStep == 3 &&
-
- )} + } } title="新建账套" @@ -563,10 +540,8 @@ export default class Ledger extends React.Component { } */} } - /> - )} - - {this.state.editSlideVisible && ( + />} + {this.state.editSlideVisible && this.handleEditSlideSave()} - subItemChange={(item) => { + subItemChange={item => { this.setState({ selectedTab: item.key }); }} /> @@ -606,23 +581,20 @@ export default class Ledger extends React.Component { onClose={() => this.setState({ editSlideVisible: false })} showMask={true} closeMaskOnClick={() => - this.setState({ editSlideVisible: false }) - } - /> - )} + this.setState({ editSlideVisible: false })} + />} - {this.state.copyFormVisible && ( + {this.state.copyFormVisible && this.handleCopySave(value)} + onSave={value => this.handleCopySave(value)} onCancel={() => { this.setState({ copyFormVisible: false }); }} - /> - )} + />} ); } diff --git a/pc4mobx/hrmSalary/pages/payroll/payrollGrant/index.js b/pc4mobx/hrmSalary/pages/payroll/payrollGrant/index.js index ceab419b..3c5508a3 100644 --- a/pc4mobx/hrmSalary/pages/payroll/payrollGrant/index.js +++ b/pc4mobx/hrmSalary/pages/payroll/payrollGrant/index.js @@ -1,289 +1,423 @@ -import React from 'react' -import { inject, observer } from 'mobx-react'; -import { toJS } from 'mobx'; -import { WeaInputSearch, WeaHelpfulTip, WeaTable, WeaTop, WeaTab } from 'ecCom' -import { dataSource, payrollColumns } from '../columns'; -import { Menu, Button, Dropdown, Table } from 'antd' -import CustomTab from '../../../components/customTab' -import "./index.less" -import PayrollGrantModal from './payrollGrantModal' -import PayrollWithdrawModal from './payrollWithdrawModal' -import { getQueryString } from '../../../util/url' -import { renderNoright, getSearchs } from '../../../util'; -import CustomPaginationTable from '../../../components/customPaginationTable'; +import React from "react"; +import { inject, observer } from "mobx-react"; +import { toJS } from "mobx"; +import { WeaInputSearch, WeaHelpfulTip, WeaTable, WeaTop, WeaTab } from "ecCom"; +import { dataSource, payrollColumns } from "../columns"; +import { Menu, Button, Dropdown, message } from "antd"; +import CustomTab from "../../../components/customTab"; +import "./index.less"; +import PayrollGrantModal from "./payrollGrantModal"; +import PayrollWithdrawModal from "./payrollWithdrawModal"; +import { getQueryString } from "../../../util/url"; +import { renderNoright, getSearchs } from "../../../util"; +import CustomPaginationTable from "../../../components/customPaginationTable"; -@inject('payrollStore') +@inject("payrollStore") @observer export default class PayrollGrant extends React.Component { - constructor(props) { - super(props); - this.state = { - payrollGrantVisible: false, - payrollWithdrawVisible: false, - currentId: "", - btnStatus: { - can_send: true, - show_workflow_status: false - } - } - this.pageInfo = {current : 1, pageSize: 10} + constructor(props) { + super(props); + this.state = { + selectedRowKeys: [], + payrollGrantVisible: false, + payrollWithdrawVisible: false, + currentId: "", + btnStatus: { + can_send: true, + show_workflow_status: false + } + }; + this.pageInfo = { current: 1, pageSize: 10 }; + } + + componentWillMount() { + let id = getQueryString("id"); + this.setState({ currentId: id }); + const { + payrollStore: { getPayrollInfo, getInfoList, getPaySa } + } = this.props; + this.getSendBtnStatus(id); + getPayrollInfo(id); + getInfoList({ + salarySendId: id + }); + getPaySa(); + } + + getSendBtnStatus(id) { + const { payrollStore: { getSendBtnStatus } } = this.props; + getSendBtnStatus({ id }) + .then(data => { + this.setState({ + btnStatus: { + can_send: data.can_send, + show_workflow_status: data.show_workflow_status + } + }); + }) + .catch(() => {}); + } + + // 撤回 + handleWithdraw(record) { + const { payrollStore } = this.props; + const { withdrawPayroll, getInfoList } = payrollStore; + withdrawPayroll({ + ids: [record.id], + salarySendId: this.state.currentId + }).then(() => { + getInfoList({ + salarySendId: this.state.currentId + }); + }); + } + + // 发送 + handleGrant(record) { + const { payrollStore } = this.props; + const { grantPayroll, getInfoList } = payrollStore; + grantPayroll({ + ids: [record.id], + salarySendId: this.state.currentId + }).then(() => { + getInfoList({ + salarySendId: this.state.currentId + }); + }); + } + + // 全部发送 + handleGrantAll() { + const { payrollStore } = this.props; + const { grantPayroll, getInfoList } = payrollStore; + grantPayroll({ + ids: [], + salarySendId: this.state.currentId + }).then(() => { + getInfoList({ + salarySendId: this.state.currentId + }); + }); + } + + // 全部撤回 + handleWithdrawAll() { + const { payrollStore } = this.props; + const { withdrawPayroll, getInfoList } = payrollStore; + withdrawPayroll({ + ids: [], + salarySendId: this.state.currentId + }).then(() => { + getInfoList({ + salarySendId: this.state.currentId + }); + }); + } + + getColumns() { + const { payrollStore } = this.props; + const { salaryGrantTableStore: columns } = payrollStore; + + let result = [ + ...columns, + { title: "操作", key: "operation", dataIndex: "operation" } + ].map(item => { + item = { ...item }; + if (item.dataIndex == "operation") { + item.render = (text, record) => { + if (record.sendStatus == "已发放") { + return ( + { + this.handleWithdraw(record); + }}> + 撤回 + + ); + } else { + return ( + { + this.handleGrant(record); + }}> + 发送 + + ); + } + }; + } + return item; + }); + return result; + } + + getSearchsAdQuick() { + const handleMenuClick = e => { + switch (e.key) { + case "1": + this.setState({ payrollGrantVisible: true }); + break; + case "2": + this.setState({ payrollWithdrawVisible: true }); + break; + case "3": + this.handleExportAll(); + break; + case "4": + this.handleExportSelect(); + break; + default: + break; + } + }; + + const menu = ( + + 批量发放 + 批量撤回 + 全部导出 + 导出选中 + {/* 自定义列 */} + + ); + return ( +
+ + {this.state.btnStatus.show_workflow_status && + } + + + 更多 + +
+ ); + } + + handleExportAll = () => { + const { payrollStore: { exportPayroll } } = this.props; + exportPayroll({ + salarySendId: this.state.currentId + }); + }; + + handleExportSelect = () => { + const { selectedRowKeys, currentId } = this.state; + const { payrollStore: { exportPayroll } } = this.props; + if (selectedRowKeys.length == 0) { + message.warning("未选择条目"); + return; } + exportPayroll({ + ids: selectedRowKeys, + salarySendId: currentId + }); + }; - componentWillMount() { - let id = getQueryString("id") - this.setState({currentId: id}) - const { payrollStore: {getPayrollInfo, getInfoList, getPaySa, } } = this.props; - this.getSendBtnStatus(id) - getPayrollInfo(id) - getInfoList({ - salarySendId:id - }) - getPaySa() - } + // 分页 + handleDataPageChange(value) { + const { payrollStore: { getInfoList } } = this.props; + getInfoList({ + salarySendId: this.state.currentId, + ...this.pageInfo + }); + } - getSendBtnStatus(id) { - const { payrollStore : {getSendBtnStatus}} = this.props; - getSendBtnStatus({id}).then((data) => { - this.setState({ - btnStatus: { - can_send: data.can_send, - show_workflow_status: data.show_workflow_status - } - }) - }).catch(() => { - }) - } + handleShowSizeChange(pageInfo) { + const { payrollStore: { getInfoList } } = this.props; + getInfoList({ + salarySendId: this.state.currentId, + ...pageInfo + }); + } + handleSearch() { + const { payrollStore: { getInfoList } } = this.props; + getInfoList({ + salarySendId: this.state.currentId, + ...this.pageInfo + }); + } - // 撤回 - handleWithdraw(record) { - const { payrollStore } = this.props; - const { withdrawPayroll, getInfoList } = payrollStore; - withdrawPayroll({ - ids: [record.id], - salarySendId: this.state.currentId - }).then(() => { - getInfoList({ - salarySendId:this.state.currentId - }) - }) - } + handleGrantProxy() { + const { payrollStore: { grantProxy } } = this.props; + grantProxy({ + salarySendId: this.state.currentId + }).then(data => { + this.getSendBtnStatus(this.state.currentId); + console.log( + `/spa/workflow/static4form/index.html#/main/workflow/req?requestid=` + + data.requestId + ); + window.open( + `/spa/workflow/static4form/index.html#/main/workflow/req?requestid=` + + data.requestId, + "_blank" + ); + }); + } - // 发送 - handleGrant(record) { - const { payrollStore } = this.props; - const { grantPayroll, getInfoList } = payrollStore; - grantPayroll({ - ids: [record.id], - salarySendId: this.state.currentId - }).then(() => { - getInfoList({ - salarySendId:this.state.currentId - }) - }) - } + onSelectChange = value => { + this.setState({ + selectedRowKeys: value + }); + }; - // 全部发送 - handleGrantAll() { - const { payrollStore } = this.props; - const { grantPayroll, getInfoList } = payrollStore; - grantPayroll({ - ids: [], - salarySendId: this.state.currentId - }).then(() => { - getInfoList({ - salarySendId:this.state.currentId - }) - }) - } + render() { + const { payrollStore } = this.props; + const { + salarySendDetailBaseInfo, + salaryGrantDataSource, + getInfoList, + grantListShowSearchAd, + grantListConditionForm, + grantListCondition, + setGrantListShowSearchAd, + salaryGrantPageInfo + } = payrollStore; + const { selectedRowKeys } = this.state; + const rowSelection = { + selectedRowKeys, + onChange: this.onSelectChange + }; + return ( +
+ } // 左侧图标 + iconBgcolor="#F14A2D" // 左侧图标背景色 + showDropIcon={true} // 是否显示下拉按钮 + buttons={[this.getSearchsAdQuick()]} + /> - // 全部撤回 - handleWithdrawAll() { - const { payrollStore } = this.props; - const { withdrawPayroll, getInfoList } = payrollStore; - withdrawPayroll({ - ids: [], - salarySendId: this.state.currentId - }).then(() => { - getInfoList({ - salarySendId:this.state.currentId - }) - }) - } - - getColumns() { - const { payrollStore } = this.props; - const { salaryGrantTableStore: columns } = payrollStore - - let result = [...columns, {title: "操作",key: "operation",dataIndex: "operation"}].map(item => { - item = {...item} - if(item.dataIndex == "operation") { - item.render = (text,record) => { - if(record.sendStatus == '已发放') { - return ( - {this.handleWithdraw(record)}}>撤回 - ) - } else { - return ( - {this.handleGrant(record)}}>发送 - ) - } - } - } - return item; - }) - return result; - } - - getSearchsAdQuick() { - const handleMenuClick = (e) => { - switch(e.key) { - case "1": - this.setState({payrollGrantVisible: true}) - break; - case "2": - this.setState({payrollWithdrawVisible: true}) - break; - } - } - - const menu = ( - - 批量发放 - 批量撤回 - {/* 全部导出 - 导出选中 */} - {/* 自定义列 */} - - ); - return ( -
- - { - this.state.btnStatus.show_workflow_status && - } - - 更多 -
- ) - } - - // 分页 - handleDataPageChange(value) { - const { payrollStore: { getInfoList } } = this.props; - getInfoList({ - salarySendId:this.state.currentId, - ...this.pageInfo - }) - } - - handleShowSizeChange(pageInfo) { - const { payrollStore: { getInfoList } } = this.props; - getInfoList({ - salarySendId:this.state.currentId, - ...pageInfo - }) - } - - handleSearch() { - const { payrollStore: { getInfoList } } = this.props; - getInfoList({ - salarySendId:this.state.currentId, - ...this.pageInfo - }) - } - - handleGrantProxy() { - const { payrollStore: {grantProxy} } = this.props; - grantProxy({ - salarySendId: this.state.currentId - }).then((data) => { - this.getSendBtnStatus(this.state.currentId) - console.log(`/spa/workflow/static4form/index.html#/main/workflow/req?requestid=` + data.requestId) - window.open(`/spa/workflow/static4form/index.html#/main/workflow/req?requestid=` + data.requestId, "_blank"); - }) - } - - render() { - const {payrollStore} = this.props; - const { salarySendDetailBaseInfo, salaryGrantDataSource, getInfoList, grantListShowSearchAd, grantListConditionForm, grantListCondition, setGrantListShowSearchAd, salaryGrantPageInfo } = payrollStore; - - return ( -
- } // 左侧图标 - iconBgcolor='#F14A2D' // 左侧图标背景色 - showDropIcon={true} // 是否显示下拉按钮 - buttons={[this.getSearchsAdQuick()]} - > - - setGrantListShowSearchAd(bool)} //高级搜索面板受控 - searchsAd={getSearchs(grantListConditionForm, toJS(grantListCondition), 2)} // 高级搜索内部数据 - // buttonsAd={adBtn} // 高级搜索内部按钮 - onSearch={() => this.handleSearch()} // 点搜索按钮时的回调 - // searchsAdQuick={this.getSearchsAdQuick()} - onSearchChange={v => grantListConditionForm.updateFields({ username: v })} // 在搜索框中输入的文字改变时的回调: 这里需要同步高级搜索和外部搜索框的值 - searchsBaseValue={grantListConditionForm.getFormParams().username} // 外部input搜索值受控: 这里和高级搜索的requestname同步 - /> -
-
- 薪资所属月:{salarySendDetailBaseInfo.salaryMonth && salarySendDetailBaseInfo.salaryMonth.year}-{salarySendDetailBaseInfo.salaryMonth && salarySendDetailBaseInfo.salaryMonth.monthValue} - setGrantListShowSearchAd(bool)} //高级搜索面板受控 + searchsAd={getSearchs( + grantListConditionForm, + toJS(grantListCondition), + 2 + )} // 高级搜索内部数据 + // buttonsAd={adBtn} // 高级搜索内部按钮 + onSearch={() => this.handleSearch()} // 点搜索按钮时的回调 + // searchsAdQuick={this.getSearchsAdQuick()} + onSearchChange={v => + grantListConditionForm.updateFields({ username: v })} // 在搜索框中输入的文字改变时的回调: 这里需要同步高级搜索和外部搜索框的值 + searchsBaseValue={grantListConditionForm.getFormParams().username} // 外部input搜索值受控: 这里和高级搜索的requestname同步 + /> +
+
+ + 薪资所属月:{salarySendDetailBaseInfo.salaryMonth && + salarySendDetailBaseInfo.salaryMonth + .year}-{salarySendDetailBaseInfo.salaryMonth && + salarySendDetailBaseInfo.salaryMonth.monthValue} + + - 工资单模板:{salarySendDetailBaseInfo.template} -
+ 引用${salarySendDetailBaseInfo.salarySobCycle && + salarySendDetailBaseInfo.salarySobCycle + .socialSecurityCycle}的福利台账数据`} + placement="topLeft" + /> + + 工资单模板:{salarySendDetailBaseInfo.template} + +
-
- 已发放:{salarySendDetailBaseInfo.sendNum}/{salarySendDetailBaseInfo.sendTotal} -
-
+
+ + 已发放:{salarySendDetailBaseInfo.sendNum}/ + {salarySendDetailBaseInfo.sendTotal} + + +
+
-
- { - this.pageInfo.current = value - this.handleDataPageChange(value) - }} - onShowSizeChange={(current, pageSize) => { - this.pageInfo = {current, pageSize} - this.handleShowSizeChange(this.pageInfo) - }} - /> -
- { - this.state.payrollGrantVisible && {this.setState({payrollGrantVisible: false})}}/> - } +
+ { + this.pageInfo.current = value; + this.handleDataPageChange(value); + }} + onShowSizeChange={(current, pageSize) => { + this.pageInfo = { current, pageSize }; + this.handleShowSizeChange(this.pageInfo); + }} + /> +
+ {this.state.payrollGrantVisible && + { + this.setState({ payrollGrantVisible: false }); + }} + />} - { - this.state.payrollWithdrawVisible && {this.setState({payrollWithdrawVisible: false})}} - /> - } -
- ) - } -} \ No newline at end of file + {this.state.payrollWithdrawVisible && + { + this.setState({ payrollWithdrawVisible: false }); + }} + />} +
+ ); + } +} diff --git a/pc4mobx/hrmSalary/pages/payroll/payrollGrant/index.less b/pc4mobx/hrmSalary/pages/payroll/payrollGrant/index.less index fc750e58..285a43e7 100644 --- a/pc4mobx/hrmSalary/pages/payroll/payrollGrant/index.less +++ b/pc4mobx/hrmSalary/pages/payroll/payrollGrant/index.less @@ -1,13 +1,17 @@ .payrollGrant { - padding: 20px; - .titleBar { - height: 47px; - line-height: 47px; - .titleBarLeft { - float: left; - } - .titleBarRight { - float: right; - } + padding: 20px; + .titleBar { + height: 47px; + line-height: 47px; + .titleBarLeft { + float: left; } -} \ No newline at end of file + .titleBarRight { + float: right; + } + } + .tableWrapper { + height: calc(100vh - 180.22px); + overflow: auto; + } +} diff --git a/pc4mobx/hrmSalary/pages/payroll/payrollGrant/payrollGrantModal.js b/pc4mobx/hrmSalary/pages/payroll/payrollGrant/payrollGrantModal.js index 0184797c..78709e23 100644 --- a/pc4mobx/hrmSalary/pages/payroll/payrollGrant/payrollGrantModal.js +++ b/pc4mobx/hrmSalary/pages/payroll/payrollGrant/payrollGrantModal.js @@ -228,6 +228,7 @@ export default class payrollGrantModal extends React.Component {
{ API.exportDetailList(params); }; + // 工资单发放-导出-工资单发放列表 + + @action + exportPayroll = (params = {}) => { + API.exportPayroll(params); + }; // 工资单-获取工资单发放高级搜索 @action