薪资项目问题处理

This commit is contained in:
MustangDeng 2022-04-19 10:11:40 +08:00
parent 829bda2c1f
commit d9ae14068a
11 changed files with 251 additions and 24 deletions

View File

@ -147,4 +147,27 @@ export const getSalaryAcctList = params => {
},
body: JSON.stringify(params)
}).then(res => res.json())
}
}
// 薪资记录--保存薪资核算的基本信息
export const saveBasic = params => {
return fetch('/api/bs/hrmsalary/salaryacct/basic/save', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
}).then(res => res.json())
}
// 薪资记录--薪资核算详情
export const salaryacctGetForm = params => {
return WeaTools.callApi('/api/bs/hrmsalary/salaryacct/getForm', 'GET', params);
}
//
// export const acctemployeeList = params = {
// return
// }

View File

@ -0,0 +1,116 @@
import React from 'react'
import { Modal, Row, Col, Select, message, Button } from 'antd'
import RequiredLabelTip from '../../components/requiredLabelTip'
import { inject, observer } from 'mobx-react';
import { WeaDatePicker, WeaInput } from 'ecCom'
import { notNull } from '../../util/validate';
const { Option } = Select;
@inject('calculateStore')
@observer
export default class baseFormModal extends React.Component {
constructor(props) {
super(props)
this.state = {
salaryMonthStr: "",
inited: false,
selectOptions: [],
salarySob: '',
description: ""
}
}
componentWillMount() {
const { calculateStore } = this.props;
const { salaryacctGetForm } = calculateStore
salaryacctGetForm().then(data => {
this.setState({
inited: true,
selectOptions: data.salarySobs
})
})
}
handleSelectChange(value) {
this.setState({
salarySob: value
})
}
// 保存回调
handleSave() {
if(!this.validate()) {
return
}
let params = {
salaryMonthStr: this.state.salaryMonthStr,
salarySobId: this.state.salarySob,
description: this.state.description
}
const { calculateStore: { saveBasic }} = this.props;
saveBasic(params).then((id) => {
this.props.onCancel()
window.open("/spa/hrmSalary/static/index.html#/main/hrmSalary/calculateDetail?id=" + id)
})
}
validate() {
if(!notNull(this.state.salaryMonthStr)) {
message.warning("薪酬所属月不能为空")
return false;
} else if(!notNull(this.state.salarySob)) {
message.warning("核算账套不能为空")
return false;
}
return true;
}
render() {
const { salaryMonthStr, salarySobId, description } = this.state;
return (
<Modal title="核算" visible={this.props.visible} width={600} onCancel={() => {this.props.onCancel()}}
footer={<Button type="primary" onClick={() => {
this.handleSave()
}}>保存</Button>}
>
<Row style={{lineHeight: '40px'}}>
<Col span={8}>薪酬所属月<RequiredLabelTip /></Col>
<Col span={16}>
<WeaDatePicker
style={{width: "200px"}}
format="yyyy-MM"
value={this.state.salaryMonthStr}
onChange={value => {this.setState({
salaryMonthStr: value
})}}
/>
</Col>
</Row>
<Row style={{lineHeight: "40px"}}>
<Col span={8}>核算账套<RequiredLabelTip /></Col>
<Col span={16}>
{
this.state.inited && <Select
defaultValue={this.state.salarySob} value={this.state.salarySob} style={{ width: "200px" }} onChange={(value) => this.handleSelectChange(value)}>
{this.state.selectOptions.map(item => (
<Option value={item.id} key={item.id}>{item.name}</Option>
))}
</Select>
}
</Col>
</Row>
<Row style={{lineHeight: '40px'}}>
<Col span={8}>备注</Col>
<Col span={16}>
<WeaInput value={description} onChange={(value) => this.setState({description: value})}/>
</Col>
</Row>
</Modal>
)
}
}

View File

@ -12,6 +12,7 @@ import ContentWrapper from '../../components/contentWrapper';
import { columns, dataSource } from './columns';
import moment from 'moment';
import BaseFormModal from './baseFormModal'
const { MonthPicker } = DatePicker;
@ -129,7 +130,10 @@ export default class Calculate extends React.Component {
const { startDate, endDate } = this.state;
return (
<div style={{display: "inline-block"}}>
<Button type="primary" style={{marginRight: "10px"}} onClick={() => window.open("/spa/hrmSalary/static/index.html#/main/hrmSalary/calculateDetail")}>核算</Button>
<Button type="primary" style={{marginRight: "10px"}}
// onClick={() => window.open("/spa/hrmSalary/static/index.html#/main/hrmSalary/calculateDetail")}
onClick={() => {this.setState({baseFormVisible: true})}}
>核算</Button>
<div style={{display: "inline-block"}}>
<WeaDatePicker
format="yyyy-MM"
@ -175,8 +179,17 @@ export default class Calculate extends React.Component {
onChange={(v) => {
}}
/>
<WeaTable columns={salaryListColumns} dataSource={salaryListDataSource}/>
<Table columns={salaryListColumns} dataSource={salaryListDataSource} pagination={null}/>
</WeaTop>
{
this.state.baseFormVisible && <BaseFormModal
visible={this.state.baseFormVisible}
onCancel={() => {
this.setState({baseFormVisible: false})
}}
/>
}
</WeaRightMenu>
</div>
)

View File

@ -5,9 +5,10 @@ import CustomTab from '../../components/customTab'
import SalaryDetail from './salaryDetail'
import { Button, Menu, Dropdown } from 'antd'
import { WeaInputSearch } from "ecCom"
import { getQueryString } from '../../util/url'
@inject('baseTableStore')
@inject('calculateStore')
@observer
export default class CalculateDetail extends React.Component {
constructor(props) {
@ -15,8 +16,10 @@ export default class CalculateDetail extends React.Component {
this.state = {
selectedKey: "0"
}
}
render() {
const { selectedKey } = this.state;

View File

@ -1,9 +1,13 @@
import React from 'react'
import { Row, Col, Icon, Table } from 'antd'
import { WeaHelpfulTip, WeaInputSearch } from 'ecCom'
import { inject, observer } from 'mobx-react';
import { dataSource , monthOnMonthColumns, userSureColumns} from './columns'
import "./index.less"
import { getQueryString } from '../../util/url'
@inject('calculateStore')
@observer
export default class UserSure extends React.Component {
constructor(props) {
super(props)
@ -11,7 +15,19 @@ export default class UserSure extends React.Component {
selectedKey: "0"
}
}
componentWillMount() {
let id = getQueryString("id")
console.log("id: " + id)
const { calculateStore } = this.props;
const { salaryacctGetForm } = calculateStore
salaryacctGetForm(id)
}
render() {
const { calculateStore } = this.props;
const { calculateBaseForm } = calculateStore
let salaryMonth = calculateBaseForm.formDTO && calculateBaseForm.formDTO.salaryMonth
return (
<div className="userSure">
<div className="baseInfo">基本信息</div>
@ -21,32 +37,32 @@ export default class UserSure extends React.Component {
<Row>
<Col span={6}>薪资所属月<WeaHelpfulTip
width={100}
title="薪资周期\n
2021-11-01至2021-11-30\n
title={`薪资周期\n
${salaryMonth}-01至${salaryMonth}-30\n
税款所属期\n
2021-12\n
${salaryMonth}\n
考勤取值周期\n
2021-11-01至2021-11-30\n
${salaryMonth}-01至${salaryMonth}-30\n
福利台账月份\n
引用2021-11的福利台账数据"
引用${salaryMonth}的福利台账数据`}
placement="topLeft"
/>
</Col>
<Col span={18}>2021-11</Col>
<Col span={18}>{calculateBaseForm.formDTO && calculateBaseForm.formDTO.salaryMonth}</Col>
</Row>
</Col>
<Col span={12}>
<Row>
<Col span={6}>核算账套
</Col>
<Col span={18}>薪资账套A</Col>
<Col span={18}>{calculateBaseForm.formDTO && calculateBaseForm.formDTO.salarySobName}</Col>
</Row>
</Col>
</Row>
<Row>
<Col span={6}>备注</Col>
<Col span={18}>这是个备注</Col>
<Col span={18}>{calculateBaseForm.formDTO && calculateBaseForm.formDTO.description}</Col>
</Row>
</div>
<div className="operateBarWrapper">

View File

@ -100,7 +100,7 @@ export default class SalaryFile extends React.Component {
// 定制列
getColumns() {
const { salaryFileStore: {tableStore}} = this.props;
return tableStore.columns.filter(item => item.hide == "false").map(item => {
return tableStore.columns.filter(item => item.display == "true").map(item => {
if(item.dataIndex == "operate") {
item.render = (text, record) => (
<a onClick={() => this.handleEdit(record)}>查看</a>
@ -184,7 +184,7 @@ export default class SalaryFile extends React.Component {
}
const handleMenuClick = (e) => {
this.setState({importType: e.key, modalVisiable: true})
this.setState({importType: e.key, modalVisiable: true, step: 0})
}
const handleMenuClick2 = () => {

View File

@ -33,13 +33,13 @@ export default class CustomSalaryItemSlide extends React.Component {
this.setState({
formula: data.formula
})
}
render() {
const { editable, request } = this.props;
const { name, useDefault, useInEmployeeSalary, roundingMode, pattern, valueType, description, dataType } = request;
const { formalModalVisible } = this.state;
console.log("valueType: " + valueType);
return (
<div className="customSalaryItemSlide">
<div>
@ -121,7 +121,7 @@ export default class CustomSalaryItemSlide extends React.Component {
valueType == 2 && <Row className="formItem">
<Col span={4}>公式</Col>
<Col span={20}>
<div style={{width: "100%", height: "30px", border: "1px solid rgb(217, 217, 217)"}}
<div style={{width: "100%", lineHeight: '30px', height: "30px", border: "1px solid rgb(217, 217, 217)"}}
onClick={() => this.handleShowFormal()}
>
{this.state.formula}

View File

@ -91,7 +91,7 @@ export default class SalaryItem extends React.Component {
title: "操作",
render: (text, record) => {
return (
<a onClick={() => {this.onEditItem(record, false)}}>编辑</a>
<a onClick={() => {this.onEditItem(record, true)}}>编辑</a>
)
}
})

View File

@ -17,6 +17,7 @@ export class calculateStore {
// ** 薪资核算列表 **
@observable salaryListDataSource = [];
@observable salaryListColumns = [];
@observable calculateBaseForm = {}
// 初始化操作
@action
@ -64,6 +65,7 @@ export class calculateStore {
this.showSearchAd = false;
}
// 薪资记录--薪资核算列表
@action
getSalaryAcctList = (params = {}) => {
API.getSalaryAcctList(params).then(res => {
@ -75,4 +77,44 @@ export class calculateStore {
}
})
}
// 薪资记录--保存薪资核算的基本信息
@action
saveBasic = (params = {}) => {
return new Promise((resolve, reject) => {
API.saveBasic(params).then(res => {
if(res.status) {
message.success("保存成功");
resolve(res.data)
} else {
message.error(res.errormsg || "保存失败")
reject()
}
})
})
}
// 薪资记录--薪资核算详情
@action
salaryacctGetForm = (id) => {
return new Promise((resolve, reject) => {
API.salaryacctGetForm({id}).then(res => {
if(res.status) {
this.calculateBaseForm = res.data
resolve(res.data)
} else {
message.error(res.errormsg || "获取失败")
reject()
}
})
})
}
//
// @action
// () => {
// A
// }
}

View File

@ -55,7 +55,7 @@ export class SalaryItemStore {
systemType:0,
roundingMode: 0,
pattern: 0,
valueType: 1,
valueType: "1",
dataType: "string",
description: ""
}

View File

@ -1,8 +1,22 @@
export const getQueryString = (name) => {
let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
let r = window.location.hash.split("?")[1].match(reg);
if (r != null) {
return decodeURIComponent(r[2]);
};
// export const getQueryString = (name) => {
// let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
// let r = window.location.hash.split("?")[1].match(reg);
// if (r != null) {
// return decodeURIComponent(r[2]);
// };
// return null;
// }
export const getQueryString = (variable) => {
let split = window.location.hash.split("?");
if(split.length <= 1) {
return null;
}
var query = split[1];
var vars = query.split("&");
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("=");
if(pair[0] == variable){return pair[1];}
}
return null;
}