custom/钱智

This commit is contained in:
黎永顺 2026-01-07 17:44:23 +08:00
parent 9f2d341a76
commit 1ad44f5006
5 changed files with 105 additions and 94 deletions

View File

@ -6,7 +6,7 @@
*/
import React, { Component } from "react";
import { inject, observer } from "mobx-react";
import { WeaLocaleProvider, WeaTools, WeaTop } from "ecCom";
import { WeaBrowser, WeaLocaleProvider, WeaTools, WeaTop } from "ecCom";
import { WeaForm } from "comsMobx";
import { Button, message, Modal } from "antd";
import moment from "moment";
@ -271,6 +271,14 @@ class Calculate extends Component {
queryParams, isRefresh, calcDaialog, progressModule, logDialogVisible, filterConditions, conditions, showAdvance,
selectedRowKeys, loading
} = this.state;
const itemRender = {
cityIds: (field, textAreaProps, form, formParams) => {
return (<WeaBrowser type={58} inputStyle={{ width: "100%" }} onChange={v => {
form.updateFields({ cityIds: { value: v } });
this.forceUpdate();
}}/>);
}
};
return (
<WeaTop title={getLabel(538011, "薪资核算")} icon={<i className="icon-coms-fa"/>} iconBgcolor="#F14A2D"
buttons={this.renderCalculateOpts()} className="calculate-main-layout" showDropIcon
@ -283,7 +291,7 @@ class Calculate extends Component {
]}>
<div className="calculate-body">
<div className={cs("advance-calc", { "show-advance-calc": showAdvance })}>
<FormInfo center={false} itemRender={{}} form={form} formFields={conditions} colCount={2}/>
<FormInfo center={false} itemRender={itemRender} form={form} formFields={conditions} colCount={2}/>
<div className="advance-calc-btns">
<Button type="primary"
onClick={() => this.setState({ isRefresh: !isRefresh })}>{getLabel(111, "搜索")}</Button>

View File

@ -30,12 +30,12 @@ class Index extends Component {
getSalaryAcctList = (props) => {
const { pageInfo } = this.state, { queryParams, form } = props;
const { taxAgentIds } = form.getFormParams();
const { taxAgentIds, ...extraFormparams } = form.getFormParams();
const { dateRange, ...extra } = queryParams;
const [startMonthStr, endMonthStr] = dateRange || [];
const params = { startMonthStr, endMonthStr, ...extra };
const payload = {
...pageInfo, ...params, taxAgentIds: taxAgentIds ? taxAgentIds.split(",") : []
...pageInfo, ...params, ...extraFormparams, taxAgentIds: taxAgentIds ? taxAgentIds.split(",") : []
};
this.setState({ loading: true });
getSalaryAcctList(payload).then(({ status, data }) => {

View File

@ -6,7 +6,7 @@ export const queryConditions = [
domkey: ["taxAgentIds"],
fieldcol: 14,
label: "个税扣缴义务人",
lanI: 111,
lanId: 111,
otherParams: {
showSearch: true, optionFilterProp: "children"
},
@ -15,8 +15,18 @@ export const queryConditions = [
labelcol: 6,
value: "",
viewAttr: 2
},
{
conditionType: "BROWSER",
domkey: ["cityIds"],
fieldcol: 14,
label: "所属城市",
lanId: 111,
labelcol: 6,
value: "",
viewAttr: 2
}
],
defaultshow: true
}
];
];

View File

@ -5,7 +5,16 @@
* Date: 2022/12/9
*/
import React, { Component } from "react";
import { WeaCheckbox, WeaFormItem, WeaHelpfulTip, WeaInput, WeaLocaleProvider, WeaSelect, WeaTextarea } from "ecCom";
import {
WeaBrowser,
WeaCheckbox,
WeaFormItem,
WeaHelpfulTip,
WeaInput,
WeaLocaleProvider,
WeaSelect,
WeaTextarea
} from "ecCom";
import { Col, Row } from "antd";
import { inject, observer } from "mobx-react";
import { baseSettingFormItem } from "../config";
@ -18,7 +27,6 @@ import {
getSubtractMonthYearMonth,
prefixAddZero
} from "../../../util/date";
import { commonEnumList } from "../../../apis/ruleconfig";
import { postFetch } from "../../../util/request";
import moment from "moment";
import cs from "classnames";
@ -26,14 +34,12 @@ import "./index.less";
const getLabel = WeaLocaleProvider.getLabel;
@inject("taxAgentStore")
@observer
@inject("taxAgentStore") @observer
class LedgerBaseSetting extends Component {
constructor(props) {
super(props);
this.state = {
baseForm: [],
settingBaseInfo: {
baseForm: [], settingBaseInfo: {
name: "",
taxAgentId: "",
taxableItems: "1",
@ -44,6 +50,8 @@ class LedgerBaseSetting extends Component {
attendCycleFromDay: "1",
socialSecurityCycleType: "3",
description: "",
city: "",
cityData: [],
canEdit: false
}
};
@ -83,6 +91,8 @@ class LedgerBaseSetting extends Component {
attendCycleFromDay: "1",
socialSecurityCycleType: "3",
description: "",
city: "",
cityData: [],
canEdit: "true"
}
}, () => this.props.onTaxableItemsChange(this.state.settingBaseInfo.taxableItems));
@ -102,8 +112,7 @@ class LedgerBaseSetting extends Component {
});
this.setState({
settingBaseInfo: {
...settingBaseInfo,
...tmpV
...settingBaseInfo, ...tmpV, cityData: basicForm["cityData"] || []
}
}, () => {
this.props.onSaveParams(this.state.settingBaseInfo);
@ -137,10 +146,8 @@ class LedgerBaseSetting extends Component {
baseForm: _.map(baseForm, it => {
if (it.key === "taxableItems") {
return {
...it,
options: _.map(data, it => ({
key: it.value.toString(),
showname: <div className="reportTypeName-box">
...it, options: _.map(data, it => ({
key: it.value.toString(), showname: <div className="reportTypeName-box">
<span>{it.defaultLabel}</span>
<span
className={cs("reportTypeName", { "danger": it.reportTypeName === getLabel(111, "非居民所得") })}>
@ -161,8 +168,7 @@ class LedgerBaseSetting extends Component {
const { settingBaseInfo } = this.state;
this.setState({
settingBaseInfo: {
...settingBaseInfo,
[key]: value
...settingBaseInfo, [key]: value
}
}, () => {
onSaveParams(this.state.settingBaseInfo);
@ -176,49 +182,43 @@ class LedgerBaseSetting extends Component {
const { canEdit, taxAgentId } = settingBaseInfo;
let taxAgentIdDisabled = false, taxableItemsDisabled = false;
const admin = editId ? record.opts.includes("admin") : true;
return (
<div className="baseSettingWrapper">
<Row gutter={20}>
<Col span={18} className="baseSettingLeft">
{
_.map(baseForm, item => {
const { key, label, type, options = [], children = [], multiple = false } = item;
taxAgentIdDisabled = key === "taxAgentId" && editId && !PageAndOptAuth.isChief;
taxableItemsDisabled = key === "taxableItems" && editId;
return <WeaFormItem
key={key} label={label}
labelCol={{ span: 6 }} wrapperCol={{ span: 12 }}
>
{
type === "INPUT" ?
<WeaInput value={settingBaseInfo[key]} viewAttr={3} disabled={!admin}
onChange={(v) => this.handleChangeField(key, v)}/> :
type === "TEXTAREA" ?
<WeaTextarea value={settingBaseInfo[key]} disabled={!admin}
onChange={(v) => this.handleChangeField(key, v)}/> :
type === "CHECKBOX" ?
<React.Fragment>
<WeaCheckbox value={true} viewAttr={1}
content="【起薪日期≤薪资周期止】且【最后发薪日期≥薪资周期起】"/>
<WeaHelpfulTip width={200} title="提示:最后发薪日期为空,默认为无穷大" placement="topLeft"/>
</React.Fragment> :
type === "SELECT" ?
<WeaSelect value={settingBaseInfo[key]} showSearch optionFilterProp="children"
options={options} viewAttr={taxAgentIdDisabled ? 1 : 3} multiple={multiple}
disabled={!admin || taxableItemsDisabled}
onChange={(v) => this.handleChangeField(key, v)}/> :
type === "CUSTOM" ?
<CustomSelect list={children} baseInfo={settingBaseInfo} inputStr={key} admin={admin}
onChange={(key, v) => this.handleChangeField(key, v)}/> : null
}
</WeaFormItem>;
})
}
</Col>
<Col span={6}><MonthCycleDesc {...settingBaseInfo}/></Col>
</Row>
</div>
);
return (<div className="baseSettingWrapper">
<Row gutter={20}>
<Col span={18} className="baseSettingLeft">
{_.map(baseForm, item => {
const {
key, label, type, options = [], children = [], multiple = false, browserType
} = item;
taxAgentIdDisabled = key === "taxAgentId" && editId && !PageAndOptAuth.isChief;
taxableItemsDisabled = key === "taxableItems" && editId;
return <WeaFormItem
key={key} label={label}
labelCol={{ span: 6 }} wrapperCol={{ span: 12 }}
>
{type === "INPUT" ? <WeaInput value={settingBaseInfo[key]} viewAttr={3} disabled={!admin}
onChange={(v) => this.handleChangeField(key, v)}/> : type === "TEXTAREA" ?
<WeaTextarea value={settingBaseInfo[key]} disabled={!admin}
onChange={(v) => this.handleChangeField(key, v)}/> : type === "CHECKBOX" ?
<React.Fragment>
<WeaCheckbox value={true} viewAttr={1}
content="【起薪日期≤薪资周期止】且【最后发薪日期≥薪资周期起】"/>
<WeaHelpfulTip width={200} title="提示:最后发薪日期为空,默认为无穷大" placement="topLeft"/>
</React.Fragment> : type === "SELECT" ?
<WeaSelect value={settingBaseInfo[key]} showSearch optionFilterProp="children"
options={options} viewAttr={taxAgentIdDisabled ? 1 : 3} multiple={multiple}
disabled={!admin || taxableItemsDisabled}
onChange={(v) => this.handleChangeField(key, v)}/> : type === "CUSTOM" ?
<CustomSelect list={children} baseInfo={settingBaseInfo} inputStr={key} admin={admin}
onChange={(key, v) => this.handleChangeField(key, v)}/> : type === "BROWSER" ?
<WeaBrowser type={browserType} inputStyle={{ width: "100%" }}
replaceDatas={settingBaseInfo["cityData"]}
onChange={v => this.handleChangeField(key, v)}/> : null}
</WeaFormItem>;
})}
</Col>
<Col span={6}><MonthCycleDesc {...settingBaseInfo}/></Col>
</Row>
</div>);
}
}
@ -228,15 +228,13 @@ const CustomSelect = (props) => {
const { list, baseInfo, onChange, inputStr, admin } = props;
const selectInfo = buildEditBasicInfo(baseInfo);
return <Row gutter={10} key={inputStr}>
{
_.map(list, item => {
const { key, options = [] } = item;
return <Col span={6}>
<WeaSelect value={baseInfo[key]} options={options} viewAttr={3}
disabled={!admin} onChange={(v) => onChange(key, v)}/>
</Col>;
})
}
{_.map(list, item => {
const { key, options = [] } = item;
return <Col span={6}>
<WeaSelect value={baseInfo[key]} options={options} viewAttr={3}
disabled={!admin} onChange={(v) => onChange(key, v)}/>
</Col>;
})}
<Col span={12}
className="desc">{inputStr === "salaryCycleStrObj" ? selectInfo.salaryCycleInfo.salaryPeriodTip : selectInfo.attendCycleInfo.attendancePeriodTip}</Col>
</Row>;
@ -323,15 +321,11 @@ const buildSalaryInfo = (editBasicInfo, monthCal, nowYear, nowMonth) => {
if (salaryCycleFromDayNum === 1) {
customInfo.salaryPeriodTip = "至" + nowMonthStr + "最后一天";
customInfo.salaryPeriodStart = customInfo.salaryYear + "-"
+ prefixAddZero(customInfo.salaryMonth, 2) + "-01";
customInfo.salaryPeriodEnd = customInfo.salaryYear + "-"
+ prefixAddZero(customInfo.salaryMonth, 2) + "-"
+ prefixAddZero(getMonthDays(customInfo.salaryYear, customInfo.salaryMonth), 2);
customInfo.salaryPeriodStart = customInfo.salaryYear + "-" + prefixAddZero(customInfo.salaryMonth, 2) + "-01";
customInfo.salaryPeriodEnd = customInfo.salaryYear + "-" + prefixAddZero(customInfo.salaryMonth, 2) + "-" + prefixAddZero(getMonthDays(customInfo.salaryYear, customInfo.salaryMonth), 2);
} else {
customInfo.salaryPeriodTip = "至" + nextMonthStr + (salaryCycleFromDayNum - 1) + "号";
customInfo.salaryPeriodStart = customInfo.salaryYear + "-"
+ prefixAddZero(customInfo.salaryMonth, 2) + "-" + prefixAddZero(salaryCycleFromDayNum, 2);
customInfo.salaryPeriodStart = customInfo.salaryYear + "-" + prefixAddZero(customInfo.salaryMonth, 2) + "-" + prefixAddZero(salaryCycleFromDayNum, 2);
let year = customInfo.salaryYear;
let month = customInfo.salaryMonth;
if (month === "12") {
@ -340,9 +334,7 @@ const buildSalaryInfo = (editBasicInfo, monthCal, nowYear, nowMonth) => {
} else {
month = Number(month) + 1;
}
customInfo.salaryPeriodEnd = year + "-"
+ prefixAddZero(month, 2) + "-"
+ prefixAddZero(salaryCycleFromDayNum - 1, 2);
customInfo.salaryPeriodEnd = year + "-" + prefixAddZero(month, 2) + "-" + prefixAddZero(salaryCycleFromDayNum - 1, 2);
}
return customInfo;
};
@ -358,24 +350,18 @@ const buildAttendanceInfo = (editBasicInfo, monthCal, nowYear, nowMonth) => {
if (attendCycleFromDayNum === 1) {
customInfo.attendancePeriodTip = "至" + nowMonthStr + "最后一天";
customInfo.attendancePeriodStart = year + "-"
+ prefixAddZero(month, 2) + "-01";
customInfo.attendancePeriodEnd = year + "-"
+ prefixAddZero(month, 2) + "-"
+ prefixAddZero(getMonthDays(year, month), 2);
customInfo.attendancePeriodStart = year + "-" + prefixAddZero(month, 2) + "-01";
customInfo.attendancePeriodEnd = year + "-" + prefixAddZero(month, 2) + "-" + prefixAddZero(getMonthDays(year, month), 2);
} else {
customInfo.attendancePeriodTip = "至" + nextMonthStr + (attendCycleFromDayNum - 1) + "号";
customInfo.attendancePeriodStart = year + "-"
+ prefixAddZero(month, 2) + "-" + prefixAddZero(attendCycleFromDayNum, 2);
customInfo.attendancePeriodStart = year + "-" + prefixAddZero(month, 2) + "-" + prefixAddZero(attendCycleFromDayNum, 2);
if (month === "12") {
year = (Number(year) + 1).toString();
month = "1";
} else {
month = (Number(month) + 1).toString();
}
customInfo.attendancePeriodEnd = year + "-"
+ prefixAddZero(month, 2) + "-"
+ prefixAddZero(attendCycleFromDayNum - 1, 2);
customInfo.attendancePeriodEnd = year + "-" + prefixAddZero(month, 2) + "-" + prefixAddZero(attendCycleFromDayNum - 1, 2);
}
return customInfo;
};
@ -390,4 +376,4 @@ const getMonth = (salaryCycleType) => {
case "4": // 下月
return getAddMonthYearMonth(1);
}
};
};

View File

@ -554,6 +554,13 @@ export const baseSettingFormItem = [
label: "核算人员范围",
type: "CHECKBOX"
},
{
key: "city",
label: "所属城市",
type: "BROWSER",
browserType: 58,
multiple: false
},
{
key: "description",
label: "备注",
@ -931,4 +938,4 @@ export const ruleConditions = [//调薪计薪规则项表单
],
defaultshow: true
}
];
];