custom/领悦业务线

This commit is contained in:
lys 2025-02-14 11:41:49 +08:00
parent 33d4126847
commit e34dbca6f7
4 changed files with 184 additions and 8 deletions

View File

@ -0,0 +1,98 @@
import React, { Component } from "react";
import { WeaCheckbox, WeaFormItem, WeaLocaleProvider, WeaSearchGroup } from "ecCom";
import { observer } from "mobx-react";
import { WeaSwitch } from "comsMobx";
const getLabel = WeaLocaleProvider.getLabel;
@observer
export default class FormInfo extends Component {
renderForm = () => {
const {
formFields, form, colCount, itemRender, onSelectedChangeHandle, showLabel, multiColumn, custLabelCol,
childrenComponents
} = this.props;
let groupArr = [];
const formParams = form.getFormParams();
const labelVisible = showLabel == null || showLabel == true;
const col = colCount ? colCount : 1;
const labelCol = labelVisible ? (custLabelCol || 6) : 0;
const itemProps = {
// ratio1to2: labelVisible && custLabelCol == null,
style: { marginLeft: 0 },
tipPosition: "bottom",
labelCol: { span: labelCol },
wrapperCol: { span: 22 - labelCol }
};
const textAreaProps = { minRows: 4, maxRows: 4 };
formFields.map((fields, i) => {
let formItems = [];
fields.items.map((field, j) => {
const customerRender = itemRender != null ? itemRender[field.domkey[0]] : null;
const showCheckbox = field.checkbox || false;
let label = getLabel(field.lanId, field.label);
if (showCheckbox)
label = <WeaCheckbox content={label} value={field.checkboxValue} onChange={(v) => {
field.checkboxValue = v === "1";
onSelectedChangeHandle && onSelectedChangeHandle(field, v);
}}/>;
let coms;
if (customerRender == null) {
coms = <WeaSwitch fieldConfig={{
...field, helpfulTip: getLabel(field.helpfulTipLanId || "", field.helpfulTip || ""), ...textAreaProps,
hasBorder: false
}} form={form} formParams={formParams}/>;
} else {
coms = customerRender({
...field, helpfulTip: getLabel(field.helpfulTipLanId || "", field.helpfulTip || "")
}, textAreaProps, form, formParams);
}
Object.assign(itemProps, { label, error: form.getError(field) });
let col = colCount ? colCount : 1;
if (multiColumn != null) {//检查有哪些字段需要一行显示多个
const idx = _.findIndex(multiColumn, item => item.key === field.domkey[0]);
if (idx > -1) {
col = field.colSpan || 1;
if (multiColumn[idx].labelCol != null)//检查字段是否有配置标题宽度
Object.assign(itemProps, {
labelCol: { span: multiColumn[idx].labelCol },
wrapperCol: { span: 24 - multiColumn[idx].labelCol }
});
} else {
Object.assign(itemProps, {
labelCol: { span: labelCol },
wrapperCol: { span: 24 - labelCol }
});
}
}
coms != null && formItems.push({
com: (<WeaFormItem {...itemProps}>{coms}</WeaFormItem>),
col
});
if (childrenComponents && childrenComponents[field.domkey[0]]) {
childrenComponents[field.domkey[0]]().map(child => formItems.push(child));
}
});
groupArr.push(<WeaSearchGroup
center={this.props.center != null ? this.props.center : true}
needTigger={true}
title={formFields.length < 2 ? null : fields.title}
showGroup={true}
items={formItems}
col={col}
fontSize={14}/>);
});
return groupArr;
};
render() {
const { formFields, className, form } = this.props;
if (formFields == null || !form.isFormInit) return (<div></div>);
return (
<div className={className}>{this.renderForm()}</div>
);
}
}

View File

@ -8,18 +8,93 @@
* @description:
*/
import React, { Component } from "react";
import { WeaLocaleProvider } from "ecCom";
import { inject, observer } from "mobx-react";
import { WeaDialog, WeaLocaleProvider } from "ecCom";
import { Button, message } from "antd";
import { vouchersConditions } from "./conditions";
import { commonEnumList } from "../../../../apis/ruleconfig";
import { convertToUrlString } from "../../../../util/url";
import { getSearchs } from "../../../../util";
import "../index.less";
const getLabel = WeaLocaleProvider.getLabel;
@inject("LYStore")
@observer
class LyCheckSecondaryVerifyDialog extends Component {
render() {
return (
<div>
constructor(props) {
super(props);
this.state = {
loading: false, conditions: []
};
}
</div>
componentWillReceiveProps(nextProps, nextContext) {
if (nextProps.visible !== this.props.visible && nextProps.visible) this.initLYForm();
if (nextProps.visible !== this.props.visible && !nextProps.visible) nextProps.LYStore.initSecVerifyform();
}
initLYForm = () => {
const { type } = this.props;
commonEnumList({ enumClass: "com.engine.salary.enums.ly.LyPZTypeEnum" })
.then(({ status, data }) => {
type === "salarySum" && (data = data.filter(item => !["SBJTPZ", "SBFFPZ", "GJJJTPZ", "GJJFFPZ"].includes(item.enum)));
type === "socialFundSum" && (data = data.filter(item => !["XZJTPZ", "XZFFPZ", "GJJJTPZ", "GJJFFPZ"].includes(item.enum)));
type === "fundSum" && (data = data.filter(item => !["XZJTPZ", "XZFFPZ", "SBJTPZ", "SBFFPZ"].includes(item.enum)));
if (status) {
this.setState({
conditions: _.map(vouchersConditions, item => ({
...item, items: _.map(item.items, o => ({
...o, label: getLabel(o.lanId, o.label),
options: _.map(data, item => ({ key: String(item.value), showname: item.defaultLabel }))
}))
}))
}, () => {
const { LYStore: { form } } = this.props;
form.initFormFields(this.state.conditions);
});
}
});
};
save = () => {
const { LYStore: { form }, ffgsqc, salaryMonth, ffgsqcLabel } = this.props;
let payload = { ...form.getFormParams(), salaryMonth, ffgsqc };
if (!salaryMonth) {
message.warning(getLabel(111, "薪资所属月参数不能为空"));
return;
}
if (!ffgsqc) {
message.warning(getLabel(111, `${ffgsqcLabel}参数不能为空`));
return;
}
form.validateForm().then(f => {
if (f.isValid) {
const { ffgsqc } = payload;
_.forEach(ffgsqc.split(","), item => {
payload = { ...payload, ffgsqc: item };
window.open(`/spa/hrmSalary/static/index.html#/main/hrmSalary/customPage_vouchers_lingyue?${convertToUrlString(payload)}`, "_blank");
});
} else {
f.showErrors();
}
}).catch(() => this.setState({ loading: false }));
};
render() {
const { conditions, loading } = this.state;
const { LYStore: { form } } = this.props;
return (
<WeaDialog
{...this.props} style={{ width: 480, height: 80 }} initLoadCss title={getLabel(111, "身份验证")}
buttons={[
<Button type="primary" onClick={this.save} loading={loading}>{getLabel(111, "确定")}</Button>
]}
>
<div className="form-dialog-layout">{getSearchs(form, conditions, 1, false)}</div>
</WeaDialog>
);
}
}
export default LyCheckSecondaryVerifyDialog;

View File

@ -49,9 +49,9 @@ export default class MobilePayroll extends React.Component {
if (type !== "phone") {
const { data, status } = await payrollCheckType();
if (status && data === "PWD") {
// init(false, () => this.getMySalaryBill(this.id));
init(false, () => this.getMySalaryBill(this.id));
//领悦二开
await this.initLY();
// await this.initLY();
} else {
this.setState({ captchaVisible: true });
}
@ -228,7 +228,8 @@ export default class MobilePayroll extends React.Component {
</WeaDialog>
<PassSetDialog form={pwdForm} visible={pwdSetVisible} onCancel={() => this.setState({ pwdSetVisible: false })}/>
{/*领悦二开*/}
<LyCheckSecondaryVerifyDialog visible={LYCheckSecVerify} salaryBillToken={salaryBillToken}/>
<LyCheckSecondaryVerifyDialog visible={LYCheckSecVerify} salaryBillToken={salaryBillToken}
onCancel={() => this.setState({ LYCheckSecVerify: false })}/>
</div>;
const {
salaryTemplate, salaryGroups, employeeInformation,

View File

@ -8,4 +8,6 @@ export class LYStore {
@action initDataForm = () => this.dataForm = new WeaForm();
@observable acctBookForm = new WeaForm(); //推送核算账簿form
@action initAcctBookForm = () => this.acctBookForm = new WeaForm();//重置推送核算账簿form
@observable secVerifyform = new WeaForm();//工资单查看启用二次验证弹框form
@action initSecVerifyform = () => this.secVerifyform = new WeaForm();
}