产品-社保福利方案自定义方案添加删除功能
This commit is contained in:
parent
6fd55967bd
commit
8071a62ec8
|
|
@ -1,107 +1,108 @@
|
|||
import { WeaTools } from 'ecCom';
|
||||
import { WeaTools } from "ecCom";
|
||||
import { postFetch } from "../util/request";
|
||||
|
||||
export const getForm = params => {
|
||||
return WeaTools.callApi('/api/bs/hrmsalary/scheme/getForm', 'get', params);
|
||||
return WeaTools.callApi("/api/bs/hrmsalary/scheme/getForm", "get", params);
|
||||
};
|
||||
export const getTable = params => {
|
||||
// return WeaTools.callApi('/api/bs/hrmsalary/scheme/getTable', 'get', params);
|
||||
return fetch('/api/bs/hrmsalary/scheme/getTable', {
|
||||
method: 'POST',
|
||||
mode: 'cors',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(params)
|
||||
}).then(res => res.json())
|
||||
// return WeaTools.callApi('/api/bs/hrmsalary/scheme/getTable', 'get', params);
|
||||
return fetch("/api/bs/hrmsalary/scheme/getTable", {
|
||||
method: "POST",
|
||||
mode: "cors",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify(params)
|
||||
}).then(res => res.json());
|
||||
};
|
||||
export const createScheme = params => {
|
||||
return fetch('/api/bs/hrmsalary/scheme/insert', {
|
||||
method: 'POST',
|
||||
mode: 'cors',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(params)
|
||||
}).then(res => res.json())
|
||||
return fetch("/api/bs/hrmsalary/scheme/insert", {
|
||||
method: "POST",
|
||||
mode: "cors",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify(params)
|
||||
}).then(res => res.json());
|
||||
};
|
||||
export const updateScheme = params => {
|
||||
return fetch('/api/bs/hrmsalary/scheme/update', {
|
||||
method: 'POST',
|
||||
mode: 'cors',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(params)
|
||||
}).then(res => res.json())
|
||||
return fetch("/api/bs/hrmsalary/scheme/update", {
|
||||
method: "POST",
|
||||
mode: "cors",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify(params)
|
||||
}).then(res => res.json());
|
||||
};
|
||||
export const getCopyForm = params => {
|
||||
return WeaTools.callApi('/api/bs/hrmsalary/scheme/copyForm', 'get', params);
|
||||
return WeaTools.callApi("/api/bs/hrmsalary/scheme/copyForm", "get", params);
|
||||
};
|
||||
export const copyScheme = params => {
|
||||
return fetch(`/api/bs/hrmsalary/scheme/copyScheme?id=${params.id}&schemeName=${params.schemeName}`, {
|
||||
method: 'GET',
|
||||
mode: 'cors',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
}).then(res => res.json())
|
||||
return fetch(`/api/bs/hrmsalary/scheme/copyScheme?id=${params.id}&schemeName=${params.schemeName}`, {
|
||||
method: "GET",
|
||||
mode: "cors",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
}).then(res => res.json());
|
||||
};
|
||||
export const deleteScheme = params => {
|
||||
return fetch('/api/bs/hrmsalary/scheme/delete', {
|
||||
method: 'POST',
|
||||
mode: 'cors',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(params)
|
||||
}).then(res => res.json())
|
||||
return fetch("/api/bs/hrmsalary/scheme/delete", {
|
||||
method: "POST",
|
||||
mode: "cors",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify(params)
|
||||
}).then(res => res.json());
|
||||
};
|
||||
|
||||
|
||||
export const getCustomCategoryForm = params => {
|
||||
return WeaTools.callApi('/api/bs/hrmsalary/sicategory/customCategoryForm', 'get', params);
|
||||
return WeaTools.callApi("/api/bs/hrmsalary/sicategory/customCategoryForm", "get", params);
|
||||
};
|
||||
export const getCustomCategoryList = params => {
|
||||
// return WeaTools.callApi('/api/bs/hrmsalary/sicategory/customCategoryList', 'get', params);
|
||||
return fetch('/api/bs/hrmsalary/sicategory/customCategoryList', {
|
||||
method: 'POST',
|
||||
mode: 'cors',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(params)
|
||||
}).then(res => res.json())
|
||||
// return WeaTools.callApi('/api/bs/hrmsalary/sicategory/customCategoryList', 'get', params);
|
||||
return fetch("/api/bs/hrmsalary/sicategory/customCategoryList", {
|
||||
method: "POST",
|
||||
mode: "cors",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify(params)
|
||||
}).then(res => res.json());
|
||||
};
|
||||
export const createSICategory = params => {
|
||||
return fetch('/api/bs/hrmsalary/sicategory/createSICategory', {
|
||||
method: 'POST',
|
||||
mode: 'cors',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(params)
|
||||
}).then(res => res.json())
|
||||
return fetch("/api/bs/hrmsalary/sicategory/createSICategory", {
|
||||
method: "POST",
|
||||
mode: "cors",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify(params)
|
||||
}).then(res => res.json());
|
||||
};
|
||||
export const updateCustomCategory = params => {
|
||||
return fetch('/api/bs/hrmsalary/sicategory/updateCustomCategoryName', {
|
||||
method: 'POST',
|
||||
mode: 'cors',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(params)
|
||||
}).then(res => res.json())
|
||||
return fetch("/api/bs/hrmsalary/sicategory/updateCustomCategoryName", {
|
||||
method: "POST",
|
||||
mode: "cors",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify(params)
|
||||
}).then(res => res.json());
|
||||
};
|
||||
export const deleteCustomCategory = params => {
|
||||
return WeaTools.callApi('/api/bs/hrmsalary/sicategory/deleteCustomCategory', 'post', params);
|
||||
export const deleteCustomCategory = (params) => {
|
||||
return postFetch("/api/bs/hrmsalary/sicategory/deleteCustomCategory", params);
|
||||
};
|
||||
export const updateCustomCategoryStatus = params => {
|
||||
return fetch('/api/bs/hrmsalary/sicategory/updateCustomCategoryStatus', {
|
||||
method: 'POST',
|
||||
mode: 'cors',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(params)
|
||||
}).then(res => res.json())
|
||||
return fetch("/api/bs/hrmsalary/sicategory/updateCustomCategoryStatus", {
|
||||
method: "POST",
|
||||
mode: "cors",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify(params)
|
||||
}).then(res => res.json());
|
||||
};
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ export default class CustomForm extends React.Component {
|
|||
item.options &&
|
||||
<WeaSelect
|
||||
detailtype={2}
|
||||
disabled={disabledValue}
|
||||
// disabled={disabledValue}
|
||||
viewAttr={item.rules === "required" ? 3 : 2}
|
||||
value={request[item.domkey[0]]}
|
||||
options={item.options.map(o => ({ showname: o.showname, key: o.key }))}
|
||||
|
|
|
|||
|
|
@ -251,7 +251,7 @@ export default class Archives extends React.Component {
|
|||
});
|
||||
return;
|
||||
}
|
||||
save("SOCIAL_SECURITY").then(() => {
|
||||
save("SOCIAL_SECURITY", this.record.paymentOrganization).then(() => {
|
||||
this.query();
|
||||
});
|
||||
} else if (selectedTab == 2) {
|
||||
|
|
@ -264,7 +264,7 @@ export default class Archives extends React.Component {
|
|||
});
|
||||
return;
|
||||
}
|
||||
save("ACCUMULATION_FUND").then(() => {
|
||||
save("ACCUMULATION_FUND", this.record.paymentOrganization).then(() => {
|
||||
this.query();
|
||||
});
|
||||
} else if (selectedTab == 3) {
|
||||
|
|
@ -277,7 +277,7 @@ export default class Archives extends React.Component {
|
|||
});
|
||||
return;
|
||||
}
|
||||
save("OTHER").then(() => {
|
||||
save("OTHER", this.record.paymentOrganization).then(() => {
|
||||
this.query();
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,9 +5,11 @@
|
|||
* Date: 2023/3/2
|
||||
*/
|
||||
import React, { Component } from "react";
|
||||
import { WeaCheckbox, WeaTable } from "ecCom";
|
||||
import { WeaCheckbox, WeaLocaleProvider, WeaTable } from "ecCom";
|
||||
import { message, Modal } from "antd";
|
||||
import { getCustomCategoryList, updateCustomCategoryStatus } from "../../../apis/welfareScheme";
|
||||
import { deleteCustomCategory, getCustomCategoryList, updateCustomCategoryStatus } from "../../../apis/welfareScheme";
|
||||
|
||||
const { getLabel } = WeaLocaleProvider;
|
||||
|
||||
class CustomBenefitsTable extends Component {
|
||||
constructor(props) {
|
||||
|
|
@ -77,7 +79,11 @@ class CustomBenefitsTable extends Component {
|
|||
return (
|
||||
<div className="linkWapper">
|
||||
{showOperateBtn &&
|
||||
<a href="javascript: void(0);" onClick={() => onCustomEdit(record)}>编辑</a>
|
||||
<React.Fragment>
|
||||
<a href="javascript: void(0);" onClick={() => onCustomEdit(record)} style={{ marginRight: 10 }}>编辑</a>
|
||||
<a href="javascript: void(0);"
|
||||
onClick={() => this.deleteCustomCategory(record.id)}>{getLabel(535052, "删除")}</a>
|
||||
</React.Fragment>
|
||||
}
|
||||
</div>
|
||||
);
|
||||
|
|
@ -98,6 +104,38 @@ class CustomBenefitsTable extends Component {
|
|||
message.error(errormsg || "操作失败");
|
||||
}
|
||||
});
|
||||
},
|
||||
onCancel: () => {
|
||||
this.setState({
|
||||
dataSource: _.map(this.state.dataSource, item => {
|
||||
if (item.id === id) {
|
||||
return {
|
||||
...item, isUse: item.isUse
|
||||
};
|
||||
}
|
||||
return { ...item };
|
||||
})
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
deleteCustomCategory = (id) => {
|
||||
Modal.confirm({
|
||||
title: getLabel(131329, "信息确认"),
|
||||
content: getLabel(543231, "确认删除本条数据吗?"),
|
||||
onOk: () => {
|
||||
message.destroy();
|
||||
message.loading("正在删除中...", 0);
|
||||
const payload = { id };
|
||||
deleteCustomCategory(payload).then(({ status, errormsg }) => {
|
||||
message.destroy();
|
||||
if (status) {
|
||||
message.success(getLabel(502230, "删除成功"));
|
||||
this.getCustomCategoryList();
|
||||
} else {
|
||||
message.error(errormsg || getLabel(30651, "操作失败"));
|
||||
}
|
||||
}).catch(() => message.destroy());
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -244,11 +244,11 @@ export class ArchivesStore {
|
|||
|
||||
// 保存表单
|
||||
@action
|
||||
save = (welfareType) => {
|
||||
save = (welfareType, paymentOrganization) => {
|
||||
let baseForm = "";
|
||||
let paymentForm = "";
|
||||
if (welfareType === "SOCIAL_SECURITY") {
|
||||
baseForm = JSON.stringify(this.socialSecurityForm.data);
|
||||
baseForm = JSON.stringify({ ...this.socialSecurityForm.data, paymentOrganization });
|
||||
if (this.socialSecurityForm.data.socialSchemeId) {
|
||||
const socialSecurityPaymentData = toJS(this.socialSecurityPaymentForm).data;
|
||||
const socialSecurityPaymentItems = toJS(this.socialSecurityPaymentForm).items[0].items;
|
||||
|
|
@ -259,7 +259,7 @@ export class ArchivesStore {
|
|||
paymentForm = JSON.stringify(payload);
|
||||
}
|
||||
} else if (welfareType === "ACCUMULATION_FUND") {
|
||||
baseForm = JSON.stringify(this.accumulationFundForm.data);
|
||||
baseForm = JSON.stringify({ ...this.accumulationFundForm.data, paymentOrganization });
|
||||
if (this.accumulationFundForm.data.fundSchemeId) {
|
||||
const accumulationFundPaymentData = toJS(this.accumulationFundPaymentForm).data;
|
||||
const accumulationFundPaymentItems = toJS(this.accumulationFundPaymentForm).items[0].items;
|
||||
|
|
@ -270,7 +270,7 @@ export class ArchivesStore {
|
|||
paymentForm = JSON.stringify(payload);
|
||||
}
|
||||
} else if (welfareType === "OTHER") {
|
||||
baseForm = JSON.stringify(this.otherForm.data);
|
||||
baseForm = JSON.stringify({ ...this.otherForm.data, paymentOrganization });
|
||||
if (this.otherForm.data.otherSchemeId) {
|
||||
const otherPaymentData = toJS(this.otherPaymentForm).data;
|
||||
const otherPaymentItems = toJS(this.otherPaymentForm).items[0].items;
|
||||
|
|
|
|||
|
|
@ -325,7 +325,10 @@ export class ProgrammeStore {
|
|||
@action
|
||||
updateCustomCategory = (params) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
API.updateCustomCategory(_.pick(params, ["id", "insuranceName"])).then(res => {
|
||||
API.updateCustomCategory({
|
||||
..._.pick(params, ["id", "insuranceName"]),
|
||||
paymentScope: _.pick(params, ["paymentScope"]).paymentScope.split(",")
|
||||
}).then(res => {
|
||||
if (res.status) {
|
||||
message.success("编辑成功");
|
||||
resolve();
|
||||
|
|
|
|||
Loading…
Reference in New Issue