diff --git a/pc4mobx/hrmSalary/config.js b/pc4mobx/hrmSalary/config.js index 47c437d6..3b93db1b 100644 --- a/pc4mobx/hrmSalary/config.js +++ b/pc4mobx/hrmSalary/config.js @@ -4,5 +4,10 @@ export const PAGE = { "salaryAcct": ["/hrmSalary/calculate", "/hrmSalary/calcView"], //薪资核算 "salaryBill": ["/hrmSalary/payroll", "/hrmSalary/payrollGrant", "/hrmSalary/payrollDetail"], //工资单 "taxDeclaration": ["/hrmSalary/declare", "/hrmSalary/generateDeclarationDetail"], //个税 - "addUpDeduction": ["/dataAcquisition/cumDeduct"] //累计专项附加扣除 + "addUpDeduction": ["/dataAcquisition/cumDeduct"], //累计专项附加扣除 + "specialAddDeduction": ["/dataAcquisition/specialAddDeduction"], //专项附加扣除 + "otherDeduction": ["/dataAcquisition/otherDeduct"], //其他免税扣除 + "addUpSituation": ["/dataAcquisition/cumSituation"], //往期累计情况 + "attendQuote": ["/dataAcquisition/attendance"], //考勤引用 + "myBill": ["/hrmSalary/mySalary", "/hrmSalary/mySalaryMobile"] //薪资福利 }; diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataComp.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataComp.js index dd103159..9869b50e 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataComp.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataComp.js @@ -11,7 +11,6 @@ import { deleteAttendance, getAttendanceFieldSettingList, getAttendanceList, - getLedgerList, getSalaryCycleAndAttendCycle, importAttendQuoteData, returnToAttendanceFieldSettingDefault, @@ -26,6 +25,7 @@ import moment from "moment"; import SelectItemsWrapper from "../../../../components/selectItemsModal/selectItemsWrapper"; import AttendanceRefrenceDataModal from "./attendanceRefrenceDataModal"; import AttendanceDataViewSlide from "./attendanceDataViewSlide"; +import { postFetch } from "../../../../util/request"; const getLabel = WeaLocaleProvider.getLabel; @@ -51,7 +51,7 @@ class AttendanceDataComp extends Component { }, fieldSetPayload: { visible: false, title: "", children: null }, attendanceReferencePayload: { visible: false, title: "" }, - attendanceViewPayload: { visible: false, attendQuoteId: "", salaryYearMonth: "" } + attendanceViewPayload: { visible: false, attendQuoteId: "", salaryYearMonth: "", showOperateBtn: false } }; } @@ -85,25 +85,26 @@ class AttendanceDataComp extends Component { }; getLedgerList = (importData) => { const { importFormPayload } = this.state; - getLedgerList().then(({ status, data }) => { - if (status) { - this.setState({ - importFormPayload: { - ...importFormPayload, salarySobId: _.head(data).id, - salarySobList: _.map(data, it => ({ key: it.id, showname: it.content })) - } - }, async () => { - const { importFormPayload } = this.state; - const { salaryYearMonth, salarySobId } = importFormPayload; - const payload = { salaryYearMonthStr: salaryYearMonth, salarySobId }; - const { data } = await getSalaryCycleAndAttendCycle(payload); + postFetch("/api/bs/hrmsalary/salarysob/listAuth", { filterType: "ADMIN_DATA" }) + .then(({ status, data }) => { + if (status) { this.setState({ - importData: { ...importData, params: { salaryYearMonth, salarySobId } }, - importFormPayload: { ...importFormPayload, ...data } + importFormPayload: { + ...importFormPayload, salarySobId: String(_.head(data).id), + salarySobList: _.map(data, it => ({ key: String(it.id), showname: it.name })) + } + }, async () => { + const { importFormPayload } = this.state; + const { salaryYearMonth, salarySobId } = importFormPayload; + const payload = { salaryYearMonthStr: salaryYearMonth, salarySobId }; + const { data } = await getSalaryCycleAndAttendCycle(payload); + this.setState({ + importData: { ...importData, params: { salaryYearMonth, salarySobId } }, + importFormPayload: { ...importFormPayload, ...data } + }); }); - }); - } - }); + } + }); }; handleChangeImportPayload = (key, value) => { const { importFormPayload, importData } = this.state; @@ -149,11 +150,11 @@ class AttendanceDataComp extends Component { } }); }; - handleViewAttendanceData = ({ id, attendCycle }) => { + handleViewAttendanceData = ({ id, attendCycle, opts = [] }) => { const { attendanceViewPayload } = this.state; this.setState({ attendanceViewPayload: { - ...attendanceViewPayload, + ...attendanceViewPayload, showOperateBtn: opts.includes("admin"), visible: true, attendQuoteId: id, salaryYearMonth: attendCycle } @@ -287,7 +288,7 @@ class AttendanceDataComp extends Component { dataSource, columns, pageInfo, loading, importData, importFormPayload, fieldSetPayload, attendanceReferencePayload, attendanceViewPayload } = this.state; - const { showOperateBtn, salaryYearMonth } = this.props; + const { salaryYearMonth } = this.props; const pagination = { ...pageInfo, showTotal: total => `共 ${total} 条`, @@ -315,10 +316,11 @@ class AttendanceDataComp extends Component { width: 120, dataIndex: "operate", render: (_, record) => { + const { opts = [] } = record; return (
this.handleViewAttendanceData(record)}>查看 - {showOperateBtn && + {opts.includes("admin") && this.handleDeleteAttendanceData(record)}>删除 @@ -336,9 +338,18 @@ class AttendanceDataComp extends Component { } { - !showOperateBtn && - this.props.onFilterLog("log", record.id)}>{getLabel(545781, "操作日志")} + !opts.includes("admin") && + + + this.props.onFilterLog("log", record.id)}>{getLabel(545781, "操作日志")} + + + }> + + }
); @@ -361,14 +372,13 @@ class AttendanceDataComp extends Component { {/* 考勤数据引用 */} {/* 考勤数据查看 */} - this.setState({ - attendanceViewPayload: { - ...attendanceViewPayload, - visible: false, - attendQuoteId: "" - } - })}/> + this.setState({ + attendanceViewPayload: { + ...attendanceViewPayload, + visible: false, + attendQuoteId: "" + } + })}/> ); } diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceRefrenceDataModal.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceRefrenceDataModal.js index c8fdb4b9..87f06a11 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceRefrenceDataModal.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceRefrenceDataModal.js @@ -13,7 +13,6 @@ import { getSearchs } from "../../../../util"; import { checkOperation, getAttendanceFieldSettingList, - getLedgerList, returnToAttendanceFieldSettingDefault, saveAttendanceFieldSetting, saveAttendanceFieldSettingAsDefault, @@ -21,6 +20,7 @@ import { } from "../../../../apis/attendance"; import SelectItemModal from "../../../../components/selectItemsModal"; import SelectItemsWrapper from "../../../../components/selectItemsModal/selectItemsWrapper"; +import { postFetch } from "../../../../util/request"; import "./index.less"; @inject("attendanceStore") @@ -46,25 +46,26 @@ class AttendanceRefrenceDataModal extends Component { getLedgerList = () => { const { attendanceStore: { refenceform } } = this.props; - getLedgerList().then(({ status, data }) => { - if (status) { - this.setState({ - condition: _.map(reFrenceConditions, (item) => { - const { items } = item; - return { - ...item, - items: _.map(items, child => { - const { domkey } = child; - if (domkey[0] === "salarySobIds") { - return { ...child, options: _.map(data, it => ({ key: it.id, showname: it.content })) }; - } - return { ...child }; - }) - }; - }) - }, () => refenceform.initFormFields(this.state.condition)); - } - }); + postFetch("/api/bs/hrmsalary/salarysob/listAuth", { filterType: "ADMIN_DATA" }) + .then(({ status, data }) => { + if (status) { + this.setState({ + condition: _.map(reFrenceConditions, (item) => { + const { items } = item; + return { + ...item, + items: _.map(items, child => { + const { domkey } = child; + if (domkey[0] === "salarySobIds") { + return { ...child, options: _.map(data, it => ({ key: String(it.id), showname: it.name })) }; + } + return { ...child }; + }) + }; + }) + }, () => refenceform.initFormFields(this.state.condition)); + } + }); }; /* * Author: 黎永顺 diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.js index e27fc31e..1a2de172 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.js @@ -78,7 +78,8 @@ class Index extends Component { render() { const { selectedKey, salaryMonth, fieldName, logDialogVisible, filterConditions } = this.state; - const { taxAgentStore: { showOperateBtn } } = this.props; + const { taxAgentStore: { PageAndOptAuth } } = this.props; + const showOperateBtn = PageAndOptAuth.opts.includes("admin"); const topTab = [ { title: "考勤数据", key: "DATA" }, { title: "字段管理", key: "FIELD" } @@ -115,7 +116,6 @@ class Index extends Component { selectedKey === "DATA" ? this.attendanceTableRef = dom} - showOperateBtn={showOperateBtn} salaryYearMonth={salaryMonth} onFilterLog={(type, targetid) => this.onDropMenuClick(type, targetid)} /> : diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js index dcc6f052..37be1131 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js @@ -241,7 +241,8 @@ class Index extends Component { } }; handleSaveData = () => { - const { cumDeductStore: { addForm } } = this.props, { taxAgentOption } = this.state; + const { cumDeductStore: { addForm } } = this.props, { slidePayload } = this.state; + const taxAgentOption = slidePayload.children.props.taxAgentOption; addForm.validateForm().then(f => { if (f.isValid) { const payload = { diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/index.js index dd32ab7c..3fd8637b 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/index.js @@ -27,6 +27,7 @@ import { dataCollectCondition, taxOptions } from "./columns"; import AddItems from "../addItems"; import TableRecord from "../components/tableRecord"; import { convertToUrlString } from "../../../util/url"; +import { postFetch } from "../../../util/request"; const getKey = WeaTools.getKey; const getLabel = WeaLocaleProvider.getLabel; @@ -62,7 +63,8 @@ class Index extends Component { exportPayloadUrl: "", exportPayloadType: false, advanceCondition: null, - targetid: "" + targetid: "", + taxAgentOption: [] }; this.tableRef = null; this.addItemRef = null; @@ -79,11 +81,15 @@ class Index extends Component { * Params: * Date: 2023/2/20 */ - getAdvanceCondition = () => { + getAdvanceCondition = async () => { + const { data: authTaxAgent } = await postFetch("/api/bs/hrmsalary/taxAgent/listAuth", { filterType: "QUERY_DATA" }); const { cumSituationStore: { form } } = this.props; getCumSituationSaCondition().then(({ status, data }) => { if (status) { - this.setState({ advanceCondition: removePropertyCondition(data.condition) }); + this.setState({ + advanceCondition: removePropertyCondition(data.condition), + taxAgentOption: _.map(authTaxAgent, g => ({ key: String(g.id), showname: g.name })) + }); form.initFormFields(removePropertyCondition(data.condition)); } }); @@ -141,10 +147,11 @@ class Index extends Component { * Params: screenParams规则:日期必须放在数组最后一位,人员信息必须第一位 * Date: 2023/2/20 */ - handleAddData = (title = "新建", editId = {}) => { - const { taxAgentStore, cumSituationStore: { addForm } } = this.props; + handleAddData = async (title = "新建", editId = {}) => { + const { data } = await postFetch("/api/bs/hrmsalary/taxAgent/listAuth", { filterType: "ADMIN_DATA" }); + const taxAgentOption = _.map(data, o => ({ key: String(o.id), showname: o.name })); + const { cumSituationStore: { addForm } } = this.props; const { slidePayload } = this.state; - const { taxAgentOption } = taxAgentStore; const conditions = _.map(dataCollectCondition, (it, idx) => { if (idx === 0) { return { @@ -323,8 +330,7 @@ class Index extends Component { * Date: 2023/2/17 */ getScreen = () => { - const { taxAgentStore: { taxAgentOption } } = this.props; - const { declareMonth, year, taxAgentId, innerWidth } = this.state; + const { declareMonth, year, taxAgentId, innerWidth, taxAgentOption } = this.state; const items = [ { com: DataCollectionDatePicker({ @@ -388,7 +394,8 @@ class Index extends Component { this.props.cumSituationStore.initAddForm(); }; handleSaveData = () => { - const { cumSituationStore: { addForm }, taxAgentStore: { taxAgentOption } } = this.props; + const { cumSituationStore: { addForm } } = this.props, { slidePayload } = this.state; + const taxAgentOption = slidePayload.children.props.taxAgentOption; addForm.validateForm().then(f => { if (f.isValid) { const payload = { diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/index.js index e9e61438..b5f3b024 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/index.js @@ -29,6 +29,7 @@ import { dataCollectCondition } from "./columns"; import AddItems from "../addItems"; import TableRecord from "../components/tableRecord"; import { convertToUrlString } from "../../../util/url"; +import { postFetch } from "../../../util/request"; const getKey = WeaTools.getKey; const getLabel = WeaLocaleProvider.getLabel; @@ -63,7 +64,8 @@ class Index extends Component { exportPayloadUrl: "", exportPayloadType: false, advanceCondition: null, - targetid: "" + targetid: "", + taxAgentOption: [] }; this.tableRef = null; this.addItemRef = null; @@ -80,11 +82,15 @@ class Index extends Component { * Params: * Date: 2023/2/20 */ - getAdvanceCondition = () => { + getAdvanceCondition = async () => { + const { data: authTaxAgent } = await postFetch("/api/bs/hrmsalary/taxAgent/listAuth", { filterType: "QUERY_DATA" }); const { otherDeductStore: { form } } = this.props; getOtherDeductSaCondition().then(({ status, data }) => { if (status) { - this.setState({ advanceCondition: removePropertyCondition(data.condition) }); + this.setState({ + advanceCondition: removePropertyCondition(data.condition), + taxAgentOption: _.map(authTaxAgent, g => ({ key: String(g.id), showname: g.name })) + }); form.initFormFields(removePropertyCondition(data.condition)); } }); @@ -269,10 +275,11 @@ class Index extends Component { * Params: screenParams规则:日期必须放在数组最后一位,人员信息必须第一位 * Date: 2023/2/20 */ - handleAddData = (title = "新建", editId = {}) => { - const { taxAgentStore, otherDeductStore: { addForm } } = this.props; + handleAddData = async (title = "新建", editId = {}) => { + const { data } = await postFetch("/api/bs/hrmsalary/taxAgent/listAuth", { filterType: "ADMIN_DATA" }); + const taxAgentOption = _.map(data, o => ({ key: String(o.id), showname: o.name })); + const { otherDeductStore: { addForm } } = this.props; const { slidePayload } = this.state; - const { taxAgentOption } = taxAgentStore; const conditions = _.map(dataCollectCondition, (it, idx) => { if (idx === 0) { return { @@ -358,8 +365,7 @@ class Index extends Component { * Date: 2023/2/17 */ getScreen = () => { - const { taxAgentStore: { taxAgentOption } } = this.props; - const { declareMonth, taxAgentId, innerWidth } = this.state; + const { declareMonth, taxAgentId, innerWidth, taxAgentOption } = this.state; const items = [ { com: DataCollectionDatePicker({ @@ -403,7 +409,8 @@ class Index extends Component { this.props.otherDeductStore.initAddForm(); }; handleSaveData = () => { - const { otherDeductStore: { addForm }, taxAgentStore: { taxAgentOption } } = this.props; + const { otherDeductStore: { addForm } } = this.props, { slidePayload } = this.state; + const taxAgentOption = slidePayload.children.props.taxAgentOption; addForm.validateForm().then(f => { if (f.isValid) { const payload = { diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/specialAddDeduction/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/specialAddDeduction/index.js index fe79d45f..be738854 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/specialAddDeduction/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/specialAddDeduction/index.js @@ -20,6 +20,7 @@ import { condition } from "./components/condition"; import AddItems from "../addItems"; import TableRecord from "../components/tableRecord"; import { convertToUrlString } from "../../../util/url"; +import { postFetch } from "../../../util/request"; const getKey = WeaTools.getKey; const getLabel = WeaLocaleProvider.getLabel; @@ -52,7 +53,8 @@ class Index extends Component { exportPayloadUrl: "", exportPayloadType: false, advanceCondition: null, - targetid: "" + targetid: "", + taxAgentOption: [] }; this.tableRef = null; this.addItemRef = null; @@ -104,11 +106,15 @@ class Index extends Component { * Params: * Date: 2023/2/20 */ - getAdvanceCondition = () => { + getAdvanceCondition = async () => { + const { data: authTaxAgent } = await postFetch("/api/bs/hrmsalary/taxAgent/listAuth", { filterType: "QUERY_DATA" }); const { specialAddStore: { advanceForm } } = this.props; getSearchCondition().then(({ status, data }) => { if (status) { - this.setState({ advanceCondition: removePropertyCondition(data.condition) }); + this.setState({ + advanceCondition: removePropertyCondition(data.condition), + taxAgentOption: _.map(authTaxAgent, g => ({ key: String(g.id), showname: g.name })) + }); advanceForm.initFormFields(removePropertyCondition(data.condition)); } }); @@ -207,8 +213,7 @@ class Index extends Component { * Date: 2023/2/17 */ getScreen = () => { - const { taxAgentStore: { taxAgentOption } } = this.props; - const { taxAgentId } = this.state; + const { taxAgentId, taxAgentOption } = this.state; const items = [ { com: DataCollectionSelect({ @@ -257,10 +262,11 @@ class Index extends Component { * Params: screenParams规则:日期必须放在数组最后一位,人员信息必须第一位 * Date: 2023/2/20 */ - handleAddData = (title = "新建", editId = {}) => { - const { taxAgentStore, specialAddStore: { addForm } } = this.props; + handleAddData = async (title = "新建", editId = {}) => { + const { data } = await postFetch("/api/bs/hrmsalary/taxAgent/listAuth", { filterType: "ADMIN_DATA" }); + const taxAgentOption = _.map(data, o => ({ key: String(o.id), showname: o.name })); + const { specialAddStore: { addForm } } = this.props; const { slidePayload } = this.state; - const { taxAgentOption } = taxAgentStore; const conditions = _.map(condition, (it, idx) => { if (idx === 0) { return { @@ -341,7 +347,8 @@ class Index extends Component { this.props.specialAddStore.initAddForm(); }; handleSaveData = () => { - const { specialAddStore: { addForm }, taxAgentStore: { taxAgentOption } } = this.props; + const { specialAddStore: { addForm } } = this.props, { slidePayload } = this.state; + const taxAgentOption = slidePayload.children.props.taxAgentOption; addForm.validateForm().then(f => { if (f.isValid) { const payload = { @@ -369,10 +376,11 @@ class Index extends Component { * Params: * Date: 2023/2/20 */ - handleOpenImport = () => { + handleOpenImport = async () => { + const { data } = await postFetch("/api/bs/hrmsalary/taxAgent/listAuth", { filterType: "ADMIN_DATA" }); + const taxAgentOption = _.map(data, o => ({ key: String(o.id), showname: o.name })); const { importPayload } = this.state; const { importOpts } = importPayload; - const { taxAgentStore: { taxAgentOption } } = this.props; this.setState({ importPayload: { ...importPayload, @@ -403,7 +411,7 @@ class Index extends Component { }; render() { - const { taxAgentStore: { showOperateBtn }, specialAddStore: { advanceForm } } = this.props; + const { specialAddStore: { advanceForm } } = this.props; const { taxAgentId, slidePayload, saveLoading, exportPayloadUrl, advanceCondition, importPayload, exportPayloadType, targetid @@ -425,7 +433,6 @@ class Index extends Component { url="/api/bs/hrmsalary/specialAddDeduction/list" payload={tablePayload} isSpecial - showOperateBtn={showOperateBtn} onTableOperate={this.handleTableOperate} onViewDetails={(record) => this.handleAddData("专项附加扣除记录", record)} form={advanceForm}