54 lines
1.8 KiB
JavaScript
54 lines
1.8 KiB
JavaScript
import { WeaSwitch } from "comsMobx";
|
||
import { WeaFormItem, WeaLocaleProvider, WeaSearchGroup, WeaTools } from "ecCom";
|
||
|
||
const getLabel = WeaLocaleProvider.getLabel;
|
||
const getKey = WeaTools.getKey;
|
||
export const payrollTempNormalSetForm = (form, condition, col, isCenter, onChange = () => void (0), insertVar = () => void (0)) => {
|
||
const { isFormInit } = form;
|
||
const formParams = form.getFormParams();
|
||
let group = [];
|
||
isFormInit && condition && condition.map(c => {
|
||
let items = [];
|
||
c.items.map(fields => {
|
||
items.push({
|
||
com: (
|
||
<WeaFormItem
|
||
label={`${fields.label}`}
|
||
labelCol={{ span: `${fields.labelcol}` }}
|
||
wrapperCol={{ span: `${fields.fieldcol}` }}
|
||
error={form.getError(fields)}
|
||
tipPosition="bottom"
|
||
>
|
||
<WeaSwitch
|
||
fieldConfig={fields}
|
||
form={form}
|
||
formParams={formParams}
|
||
onChange={onChange}
|
||
/>
|
||
{
|
||
getKey(fields) === "theme" &&
|
||
<div className="sft-variables">
|
||
<span className="sftv-tip">{getLabel(500143, "插入变量")}:</span>
|
||
<a className="sftv-item" onClick={() => insertVar("${companyName}")}>{getLabel(1976, "公司名称")}</a>
|
||
<a className="sftv-item"
|
||
onClick={() => insertVar("${salaryMonth}")}>{getLabel(542604, "薪资所属月")}</a>
|
||
</div>
|
||
}
|
||
</WeaFormItem>),
|
||
colSpan: 1,
|
||
hide: fields.hide
|
||
});
|
||
});
|
||
group.push(
|
||
<WeaSearchGroup
|
||
col={col || 1}
|
||
needTigger={true}
|
||
title={c.title}
|
||
showGroup={c.defaultshow}
|
||
items={items}
|
||
center={isCenter || false}
|
||
/>);
|
||
});
|
||
return group;
|
||
};
|