This commit is contained in:
parent
848282cfc8
commit
efa75925ad
|
|
@ -66,8 +66,8 @@ export const salaryItemConditions = [
|
|||
value: "",
|
||||
options: [],
|
||||
multiple: true,
|
||||
rules: "required|string",
|
||||
viewAttr: 3,
|
||||
rules: "",
|
||||
viewAttr: 2,
|
||||
hide: true
|
||||
},
|
||||
{
|
||||
|
|
@ -118,7 +118,7 @@ export const salaryItemConditions = [
|
|||
{ key: "3", selected: false, showname: "3" },
|
||||
{ key: "4", selected: false, showname: "4" },
|
||||
{ key: "5", selected: false, showname: "5" },
|
||||
{ key: "6", selected: true, showname: "6" },
|
||||
{ key: "6", selected: false, showname: "6" },
|
||||
{ key: "7", selected: false, showname: "7" },
|
||||
{ key: "8", selected: false, showname: "8" },
|
||||
{ key: "9", selected: false, showname: "9" },
|
||||
|
|
|
|||
|
|
@ -3,6 +3,10 @@ import { inject, observer } from "mobx-react";
|
|||
import { WeaFormItem, WeaHelpfulTip, WeaLocaleProvider, WeaSearchGroup, WeaSlideModal, WeaTools } from "ecCom";
|
||||
import { WeaSwitch } from "comsMobx";
|
||||
import { salaryItemConditions } from "./columns";
|
||||
import { commonEnumList } from "../../apis/archive";
|
||||
import { postFetch } from "../../util/request";
|
||||
import { getItemForm } from "../../apis/item";
|
||||
|
||||
// import FormalFormModal from "./formalFormModal";
|
||||
// import SalaryItemForm from "./salaryItemForm";
|
||||
|
||||
|
|
@ -44,21 +48,32 @@ export default class CustomSalaryItemSlide extends React.Component {
|
|||
});
|
||||
};
|
||||
|
||||
// 保存公式成功回调
|
||||
handleSaveFormal = (data) => {
|
||||
this.handleChange({
|
||||
formulaId: data.id, formulaContent: data.formula,
|
||||
originFormulaContent: data.referenceType === "formula" ? data.formula : "",
|
||||
originSqlContent: data.referenceType === "sql" ? data.formula : ""
|
||||
});
|
||||
};
|
||||
initForm = (props) => {
|
||||
initForm = async (props) => {
|
||||
const { data: salaryItemForm } = props.id ?
|
||||
await getItemForm({ id: props.id }) : { data: { sharedType: "0", useDefault: "0", hideDefault: "0" } };
|
||||
const [{ data: sharedTypeList }, { data: taxAgentList }] = await Promise.all([
|
||||
commonEnumList({ enumClass: "com.engine.salary.enums.sicategory.SharedTypeEnum" }),
|
||||
postFetch("/api/bs/hrmsalary/taxAgent/listAuth", { filterType: "ADMIN_DATA" })
|
||||
]);
|
||||
this.setState({
|
||||
conditions: _.map(salaryItemConditions, c => {
|
||||
return {
|
||||
...c, items: _.map(c.items, fields => {
|
||||
fields = { ...fields, label: getLabel(fields.lanId, fields.label) };
|
||||
fields = {
|
||||
...fields, label: getLabel(fields.lanId, fields.label),
|
||||
value: !_.isNil(salaryItemForm[getKey(fields)]) ? String(salaryItemForm[getKey(fields)]) : fields.value
|
||||
};
|
||||
switch (getKey(fields)) {
|
||||
case "sharedType":
|
||||
fields = {
|
||||
...fields, options: _.map(sharedTypeList, o => ({ key: o.value, showname: o.defaultLabel }))
|
||||
};
|
||||
break;
|
||||
case "taxAgentIds":
|
||||
fields = {
|
||||
...fields, options: _.map(taxAgentList, o => ({ key: String(o.id), showname: o.name }))
|
||||
};
|
||||
break;
|
||||
case "dataType":
|
||||
case "valueType":
|
||||
case "roundingMode":
|
||||
|
|
@ -77,6 +92,23 @@ export default class CustomSalaryItemSlide extends React.Component {
|
|||
props.salaryItemStore.itemsForm.initFormFields(this.state.conditions);
|
||||
});
|
||||
};
|
||||
handleChangeFormItem = (res) => {
|
||||
const { conditions } = this.state, [key] = _.keys(res), value = res[key].value;
|
||||
this.setState({
|
||||
conditions: _.map(conditions, c => {
|
||||
return {
|
||||
...c, items: _.map(c.items, fields => {
|
||||
if (key === "sharedType" && getKey(fields) === "taxAgentIds") {
|
||||
fields = {
|
||||
...fields, viewAttr: value === "0" ? 2 : 3, hide: value === "0"
|
||||
};
|
||||
}
|
||||
return fields;
|
||||
})
|
||||
};
|
||||
})
|
||||
});
|
||||
};
|
||||
renderForm = () => {
|
||||
const { salaryItemStore: { itemsForm: form } } = this.props;
|
||||
const { conditions } = this.state, { isFormInit } = form, formParams = form.getFormParams();
|
||||
|
|
@ -88,7 +120,7 @@ export default class CustomSalaryItemSlide extends React.Component {
|
|||
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}/>
|
||||
<WeaSwitch fieldConfig={fields} form={form} formParams={formParams} onChange={this.handleChangeFormItem}/>
|
||||
{
|
||||
fields.tip && <WeaHelpfulTip
|
||||
style={{ marginLeft: 16 }} width={350} title={getLabel(fields.tipLanId, fields.tip)}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ export default class SalaryItem extends React.Component {
|
|||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
name: "", isQuery: false,
|
||||
name: "", isQuery: false, loading: false,
|
||||
customItemDialog: { visible: false, title: "", buttons: [] },// 自定义薪资项弹窗
|
||||
|
||||
|
||||
|
|
@ -190,7 +190,16 @@ export default class SalaryItem extends React.Component {
|
|||
getTableDatas({ ...searchParams });
|
||||
}
|
||||
|
||||
|
||||
handleSalaryItem = (type) => {
|
||||
const { salaryItemStore: { itemsForm: form } } = this.props;
|
||||
form.validateForm().then(f => {
|
||||
if (f.isValid) {
|
||||
console.log(form.getFormParams());
|
||||
} else {
|
||||
f.showErrors();
|
||||
}
|
||||
});
|
||||
};
|
||||
onDropMenuClick = (key, targetid = "") => {
|
||||
switch (key) {
|
||||
case "log":
|
||||
|
|
@ -202,16 +211,22 @@ export default class SalaryItem extends React.Component {
|
|||
case "customAdd":
|
||||
case "edit":
|
||||
const { taxAgentStore: { showOperateBtn, showSalaryItemBtn } } = this.props;
|
||||
const { loading } = this.state;
|
||||
const title = key === "edit" ? getLabel(111, "修改自定义薪资项目") : getLabel(111, "新建自定义薪资项目");
|
||||
const buttons = key === "edit" ? [
|
||||
<Button type="ghost">{getLabel(111, "同步到薪资账套")}</Button>,
|
||||
<Button type="primary">{getLabel(111, "保存")}</Button>
|
||||
<Button type="primary" loading={loading}
|
||||
onClick={() => this.handleSalaryItem("SAVE")}>{getLabel(111, "保存")}</Button>
|
||||
] : [
|
||||
<Button type="primary">{getLabel(111, "保存")}</Button>,
|
||||
<Button type="ghost">{getLabel(111, "保存并继续创建")}</Button>
|
||||
<Button type="primary" loading={loading}
|
||||
onClick={() => this.handleSalaryItem("SAVE")}>{getLabel(111, "保存")}</Button>,
|
||||
<Button type="ghost" loading={loading}
|
||||
onClick={() => this.handleSalaryItem("SAVECREATE")}>{getLabel(111, "保存并继续创建")}</Button>
|
||||
];
|
||||
this.setState({
|
||||
customItemDialog: { visible: true, title, buttons: (showSalaryItemBtn || showOperateBtn) ? buttons : [] }
|
||||
customItemDialog: {
|
||||
visible: true, title, buttons: (showSalaryItemBtn || showOperateBtn) ? buttons : [], id: targetid
|
||||
}
|
||||
});
|
||||
break;
|
||||
case "sysAdd":
|
||||
|
|
|
|||
|
|
@ -7,6 +7,12 @@
|
|||
|
||||
.salaryItems_content {
|
||||
height: 100%;
|
||||
padding: 8px 16px;
|
||||
background: #f6f6f6;
|
||||
|
||||
& > .wea-new-table {
|
||||
background: #FFFFFF;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -19,6 +25,10 @@
|
|||
.wea-slide-modal-content {
|
||||
height: 100%;
|
||||
background: #f6f6f6;
|
||||
|
||||
.wea-form-item-wrapper {
|
||||
display: block !important;
|
||||
}
|
||||
}
|
||||
|
||||
.titleDialog {
|
||||
|
|
|
|||
|
|
@ -101,12 +101,12 @@ class SalaryItemsTable extends Component {
|
|||
};
|
||||
return (
|
||||
<WeaTable rowKey="id" dataSource={dataSource} rowSelection={rowSelection} pagination={pagination}
|
||||
loading={loading} scroll={{ y: `calc(100vh - 155px)` }}
|
||||
loading={loading} scroll={{ y: `calc(100vh - 180px)` }}
|
||||
columns={[
|
||||
...columns, {
|
||||
dataIndex: "opt", title: getLabel(111, "操作"), width: 140,
|
||||
render: (__, record) => (<React.Fragment>
|
||||
<a style={{ marginRight: 8 }} onClick={() => onDropMenuClick("edit", record)}
|
||||
<a style={{ marginRight: 8 }} onClick={() => onDropMenuClick("edit", record.id)}
|
||||
href="javascript:void(0);">{(showOperateBtn || showSalaryItemBtn) ? getLabel(111, "编辑") : getLabel(111, "查看")}</a>
|
||||
{
|
||||
(showOperateBtn || showSalaryItemBtn) && record.canDelete &&
|
||||
|
|
|
|||
Loading…
Reference in New Issue