From 8071a62ec88106d0cc656d240d9fe0352decfa09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Thu, 27 Jul 2023 14:58:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=A7=E5=93=81-=E7=A4=BE=E4=BF=9D=E7=A6=8F?= =?UTF-8?q?=E5=88=A9=E6=96=B9=E6=A1=88=E8=87=AA=E5=AE=9A=E4=B9=89=E6=96=B9?= =?UTF-8?q?=E6=A1=88=E6=B7=BB=E5=8A=A0=E5=88=A0=E9=99=A4=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/apis/welfareScheme.js | 159 +++++++++--------- .../hrmSalary/components/customForm/index.js | 2 +- .../socialSecurityBenefits/archives/index.js | 6 +- .../programme/customBenefitsTable.js | 44 ++++- pc4mobx/hrmSalary/stores/archives.js | 8 +- pc4mobx/hrmSalary/stores/programme.js | 5 +- 6 files changed, 133 insertions(+), 91 deletions(-) diff --git a/pc4mobx/hrmSalary/apis/welfareScheme.js b/pc4mobx/hrmSalary/apis/welfareScheme.js index e7d1f3e7..cd5aab94 100644 --- a/pc4mobx/hrmSalary/apis/welfareScheme.js +++ b/pc4mobx/hrmSalary/apis/welfareScheme.js @@ -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()); }; diff --git a/pc4mobx/hrmSalary/components/customForm/index.js b/pc4mobx/hrmSalary/components/customForm/index.js index 5041a53d..4348762d 100644 --- a/pc4mobx/hrmSalary/components/customForm/index.js +++ b/pc4mobx/hrmSalary/components/customForm/index.js @@ -45,7 +45,7 @@ export default class CustomForm extends React.Component { item.options && ({ showname: o.showname, key: o.key }))} diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/index.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/index.js index c0111c45..8b078187 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/index.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/index.js @@ -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(); }); } diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/customBenefitsTable.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/customBenefitsTable.js index ab5cb070..fe4bc74c 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/customBenefitsTable.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/customBenefitsTable.js @@ -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 (
{showOperateBtn && - onCustomEdit(record)}>编辑 + + onCustomEdit(record)} style={{ marginRight: 10 }}>编辑 + this.deleteCustomCategory(record.id)}>{getLabel(535052, "删除")} + }
); @@ -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()); } }); }; diff --git a/pc4mobx/hrmSalary/stores/archives.js b/pc4mobx/hrmSalary/stores/archives.js index 7ba4e492..56bd3b12 100644 --- a/pc4mobx/hrmSalary/stores/archives.js +++ b/pc4mobx/hrmSalary/stores/archives.js @@ -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; diff --git a/pc4mobx/hrmSalary/stores/programme.js b/pc4mobx/hrmSalary/stores/programme.js index b6d994d0..3cbc9c91 100644 --- a/pc4mobx/hrmSalary/stores/programme.js +++ b/pc4mobx/hrmSalary/stores/programme.js @@ -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();