From 570493267e21de1f95cbb43e625de0537ec159ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Tue, 14 Feb 2023 15:38:04 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E8=96=AA=E8=B5=84=E8=B4=A6=E5=A5=97?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/ledgerBaseSetting.js | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerBaseSetting.js b/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerBaseSetting.js index e861b31d..5ef37ea5 100644 --- a/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerBaseSetting.js +++ b/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerBaseSetting.js @@ -21,7 +21,7 @@ class LedgerBaseSetting extends Component { constructor(props) { super(props); this.state = { - baseForm: baseSettingFormItem, + baseForm: [], settingBaseInfo: { name: "", taxAgentId: "", @@ -38,13 +38,16 @@ class LedgerBaseSetting extends Component { }; } - componentDidMount() { + componentWillMount() { this.getTaxAgentSelectListAsAdmin(); - this.commonEenumList(); + } + + componentDidMount() { + // this.getTaxAgentSelectListAsAdmin(); + // this.commonEenumList(); if (this.props.visible && this.props.editId) { this.getLedgerBasicForm(this.props.editId); } - } componentWillReceiveProps(nextProps, nextContext) { @@ -98,9 +101,8 @@ class LedgerBaseSetting extends Component { const { getTaxAgentSelectListAsAdmin } = taxAgentStore; getTaxAgentSelectListAsAdmin().then(({ status, data }) => { if (status) { - const { baseForm } = this.state; this.setState({ - baseForm: _.map(baseForm, it => { + baseForm: _.map(baseSettingFormItem, it => { if (it.key === "taxAgentId") { return { ...it, @@ -109,11 +111,11 @@ class LedgerBaseSetting extends Component { } return { ...it }; }) - }); + }, () => this.commonEenumList()); } }); }; - commonEenumList= ()=>{ + commonEenumList = () => { const payload = { enumClass: "com.engine.salary.enums.salarysob.IncomeCategoryEnum" }; @@ -133,7 +135,7 @@ class LedgerBaseSetting extends Component { }); } }); - } + }; handleChangeField = (key, value) => { const { onSaveParams } = this.props; const { settingBaseInfo } = this.state; From 4e6f7277271ff4b622bb0b9074b53e04dba6c739 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Wed, 15 Feb 2023 14:18:20 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E8=96=AA=E8=B5=84=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=93=8D=E4=BD=9C=E6=9D=83=E9=99=90=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hrmSalary/pages/mobilePayroll/index.js | 64 +++++++++++++------ pc4mobx/hrmSalary/pages/salaryItem/index.js | 4 +- .../socialSecurityBenefits/programme/index.js | 6 +- pc4mobx/hrmSalary/stores/mySalary.js | 28 ++++---- 4 files changed, 66 insertions(+), 36 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/mobilePayroll/index.js b/pc4mobx/hrmSalary/pages/mobilePayroll/index.js index 5ea4e38e..dc79d451 100644 --- a/pc4mobx/hrmSalary/pages/mobilePayroll/index.js +++ b/pc4mobx/hrmSalary/pages/mobilePayroll/index.js @@ -21,21 +21,39 @@ export default class MobilePayroll extends React.Component { } componentWillMount() { + const type = getQueryString("type"); this.id = getQueryString("id"); const { mySalaryStore: { init } } = this.props; - init(); + type !== "phone" && init(false); this.getMySalaryBill(this.id); } - getMySalaryBill = (id) => { + getMySalaryBill = (salaryInfoId) => { const { mySalaryStore: { getMySalaryBill } } = this.props; - getMySalaryBill(id).then(result => { + const params = this.getUrlkey(); + const payload = { + salaryInfoId, + ..._.omit(params, ["id", "_key", "type"]) + }; + getMySalaryBill(payload).then(result => { this.setState({ mySalaryBillData: result }); }); }; - + getUrlkey = () => { + let url = window.location.href; + let params = {}, + arr = url.split("?"); + if (arr.length <= 1) + return params; + arr = arr[1].split("&"); + for (var i = 0, l = arr.length; i < l; i++) { + var a = arr[i].split("="); + params[a[0]] = a[1]; + } + return params; + }; render() { const { mySalaryBillData } = this.state; @@ -48,29 +66,33 @@ export default class MobilePayroll extends React.Component { overflowY: "hidden", paddingBottom: "20px" }}> - - -
-
- { - type === "phone" ? - : + { + type === "phone" ? +
+
+ +
+
+ : + +
+
- } -
-
-
+
+
+
+ } ); } diff --git a/pc4mobx/hrmSalary/pages/salaryItem/index.js b/pc4mobx/hrmSalary/pages/salaryItem/index.js index ed2c9722..d09d92ab 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/index.js +++ b/pc4mobx/hrmSalary/pages/salaryItem/index.js @@ -2,7 +2,7 @@ import React from "react"; import { inject, observer } from "mobx-react"; import { Button, Dropdown, Menu, message, Modal, Switch } from "antd"; import { WeaInputSearch, WeaSlideModal, WeaTop } from "ecCom"; -import { renderLoading } from "../../util"; // 渲染form数据的方法:因为多个页面都会使用,所以抽的公共方法在util中 +import { renderLoading } from "../../util"; import CustomTab from "../../components/customTab"; import SystemSalaryItemModal from "./systemSalaryItemModal"; import { columns } from "./columns"; @@ -132,7 +132,7 @@ export default class SalaryItem extends React.Component { } }); { - showOperateBtn && + // showOperateBtn && columns.push({ title: "", key: "moreOperate", diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/index.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/index.js index c134a812..4505e71e 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/index.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/index.js @@ -47,6 +47,7 @@ export default class Programme extends React.Component { // 增加编辑功能,重写columns绑定事件 getColumns = columns => { + const { taxAgentStore: { showOperateBtn } } = this.props; let newColumns = columns.filter( item => item.dataIndex !== "id" && item.dataIndex !== "paymentArea" ); @@ -85,15 +86,16 @@ export default class Programme extends React.Component { render: (text, record) => { return ( { this.onEdit(record); }}> - 编辑 + {showOperateBtn ? "编辑" : "查看"} ); } }); - newColumns.push({ + showOperateBtn && newColumns.push({ key: "moreOperate", dataIndex: "moreOperate", render: (text, record) => { diff --git a/pc4mobx/hrmSalary/stores/mySalary.js b/pc4mobx/hrmSalary/stores/mySalary.js index f9ce5acf..d7a05f1b 100644 --- a/pc4mobx/hrmSalary/stores/mySalary.js +++ b/pc4mobx/hrmSalary/stores/mySalary.js @@ -37,27 +37,32 @@ export class MySalaryStore { this.loading = true; this.hasRight = false; }; - @action setMySalaryBill= (mySalaryBill)=> {this.mySalaryBill= mySalaryBill}; - @action init = async props => { + @action setMySalaryBill = (mySalaryBill) => { + this.mySalaryBill = mySalaryBill; + }; + @action init = async (isRoot = true) => { this.clear(); //1.check is need second verify if (window.doCheckSecondaryVerify4ec) { - window.doCheckSecondaryVerify4ec({ mouldCode: "HRM", itemCode: "SALARY" }, this.getData); + window.doCheckSecondaryVerify4ec({ mouldCode: "HRM", itemCode: "SALARY" }, (data) => this.getData({ + ...data, + isRoot + })); } else { //4.loaddata - this.getData({ status: "1", token: "" }); + this.getData({ status: "1", token: "", isRoot }); } }; @action getData = async (params = {}) => { if (_.isEmpty(params)) return; - const { status, token } = params; + const { status, isRoot, token } = params; if (status == "1") { // Object.assign(this._reqParams, { token }); // this.getFormData({ viewAttr: 1 }); this.hasRight = true; - this.mySalaryBillList() + isRoot && this.mySalaryBillList(); } else { this.hasRight = false; } @@ -148,17 +153,18 @@ export class MySalaryStore { // 我的工资单详情 @action getMySalaryBill = (salaryInfoId) => { - return new Promise((resolve, reject)=>{ - API.mySalaryBill({ salaryInfoId }).then(res => { + const payload = Object.prototype.toString.call(salaryInfoId) === "[object Number]" ? { salaryInfoId } : { ...salaryInfoId }; + return new Promise((resolve, reject) => { + API.mySalaryBill(payload).then(res => { if (res.status) { this.mySalaryBill = res.data; - resolve(res.data) + resolve(res.data); } else { message.error(res.errormsg || "获取失败"); - reject("获取失败") + reject("获取失败"); } }); - }) + }); }; @action From ff692d515783c126514209475e6b787156998e6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Wed, 15 Feb 2023 16:54:23 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E8=96=AA=E8=B5=84=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/fieldManagement/components/fieldSlide.js | 10 +++++----- .../pages/fieldManagement/components/fieldTable.js | 12 ++++++------ pc4mobx/hrmSalary/pages/fieldManagement/index.js | 5 +++-- .../ledgerPage/components/ledgerSalaryItemNormal.js | 4 ++-- pc4mobx/hrmSalary/pages/salaryItem/index.js | 12 ++++++------ 5 files changed, 22 insertions(+), 21 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/fieldManagement/components/fieldSlide.js b/pc4mobx/hrmSalary/pages/fieldManagement/components/fieldSlide.js index 9712d156..584d0880 100644 --- a/pc4mobx/hrmSalary/pages/fieldManagement/components/fieldSlide.js +++ b/pc4mobx/hrmSalary/pages/fieldManagement/components/fieldSlide.js @@ -35,8 +35,8 @@ class FieldSlide extends Component { componentDidMount() { const { taxAgentStore } = this.props; this.commonEnumList(); - const { getTaxAgentSelectListAsAdmin } = taxAgentStore; - getTaxAgentSelectListAsAdmin(); + const { fetchTaxAgentOption } = taxAgentStore; + fetchTaxAgentOption(); } componentWillReceiveProps(nextProps, nextContext) { @@ -150,7 +150,7 @@ class FieldSlide extends Component { }; render() { - const { title, visible, taxAgentStore: { showOperateBtn, taxAgentAdminOption }, onCancel } = this.props; + const { title, visible, taxAgentStore: { taxAgentOption }, onCancel } = this.props; const { loading, name, @@ -177,7 +177,7 @@ class FieldSlide extends Component { subtitle={title} tabs={[]} loading={loading} - showOperateBtn={showOperateBtn} + showOperateBtn={true} editable={true} onSave={this.saveFieldInfo} /> @@ -213,7 +213,7 @@ class FieldSlide extends Component { multiple viewAttr={3} value={taxAgentIds} - options={taxAgentAdminOption} + options={taxAgentOption} onChange={value => this.handleChangeFields("taxAgentIds", value)} /> diff --git a/pc4mobx/hrmSalary/pages/fieldManagement/components/fieldTable.js b/pc4mobx/hrmSalary/pages/fieldManagement/components/fieldTable.js index 47ec7569..42dd5199 100644 --- a/pc4mobx/hrmSalary/pages/fieldManagement/components/fieldTable.js +++ b/pc4mobx/hrmSalary/pages/fieldManagement/components/fieldTable.js @@ -7,7 +7,7 @@ import React, { Component } from "react"; import { WeaTable } from "ecCom"; import { inject, observer } from "mobx-react"; -import { message, Modal, Switch } from "antd"; +import { Switch } from "antd"; import { salaryFieldList } from "../../../apis/fieldManage"; @inject("taxAgentStore") @@ -70,11 +70,11 @@ class FieldTable extends Component { item.render = (text, record) => { return
onEditLedger(record)}>{showOperateBtn ? "编辑" : "查看"} - {/*{*/} - {/* showOperateBtn &&*/} - {/* onDeleteLedger(record)}>删除*/} - {/*}*/} + onClick={() => onEditLedger(record)}>编辑 + { + // showOperateBtn && + onDeleteLedger(record)}>删除 + }
; }; } else { diff --git a/pc4mobx/hrmSalary/pages/fieldManagement/index.js b/pc4mobx/hrmSalary/pages/fieldManagement/index.js index be149e71..04b177b1 100644 --- a/pc4mobx/hrmSalary/pages/fieldManagement/index.js +++ b/pc4mobx/hrmSalary/pages/fieldManagement/index.js @@ -42,7 +42,7 @@ class FieldManagement extends Component { deleteSalaryField(filedIds).then(({ status, errormsg }) => { if (status) { message.success("删除成功"); - this.setState({ doSearch: !this.state.doSearch }) + this.setState({ doSearch: !this.state.doSearch }); } else { message.error(errormsg || "删除失败"); } @@ -83,7 +83,8 @@ class FieldManagement extends Component { icon={} iconBgcolor="#F14A2D" showDropIcon={false} - buttons={showOperateBtn ? btns : btns.slice(-1)} + // buttons={showOperateBtn ? btns : btns.slice(-1)} + buttons={btns} >
{ name, onEditCategory, onDeleteCategory, sortedIndex, dataSourceLen, id, onUpgo, onDowngo, selectedRowKeys = [], onDeleteCategoryItems, - onAddCategoryItems + onAddCategoryItems, items } = props; return
@@ -225,7 +225,7 @@ const TitleNormalComp = (props) => { onEditCategory(name, id)}/> } { - name !== "未分类" && + name !== "未分类" && _.isEmpty(items) && onDeleteCategory(id)}/> } { diff --git a/pc4mobx/hrmSalary/pages/salaryItem/index.js b/pc4mobx/hrmSalary/pages/salaryItem/index.js index d09d92ab..9e467b93 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/index.js +++ b/pc4mobx/hrmSalary/pages/salaryItem/index.js @@ -51,8 +51,8 @@ export default class SalaryItem extends React.Component { componentWillMount() { // 初始化渲染页面 const { salaryItemStore: { getTableDatas }, salaryFileStore, taxAgentStore } = this.props; const { commonEnumList } = salaryFileStore; - const { getTaxAgentSelectListAsAdmin } = taxAgentStore; - getTaxAgentSelectListAsAdmin(); + const { fetchTaxAgentOption } = taxAgentStore; + fetchTaxAgentOption(); commonEnumList("user", { enumClass: "com.engine.salary.enums.sicategory.SharedTypeEnum" }); getTableDatas({}).then(res => { this.setState({ @@ -142,7 +142,7 @@ export default class SalaryItem extends React.Component { return ( - { + { this.handleDeleteItem(record); }}>删除 @@ -206,11 +206,11 @@ export default class SalaryItem extends React.Component { const { salaryItemStore, salaryFileStore, - taxAgentStore: { showOperateBtn, showSalaryItemBtn, taxAgentAdminOption } + taxAgentStore: { showOperateBtn, showSalaryItemBtn, taxAgentOption } } = this.props; const { userStatusList } = salaryFileStore; const { selectedRowKeys } = this.state; - const { loading, deleteItemRequest, getTableDatas, initRequest } = salaryItemStore; + const { loading, deleteItemRequest, getTableDatas } = salaryItemStore; const { tableDataSource, tableColumns, @@ -414,7 +414,7 @@ export default class SalaryItem extends React.Component { record={this.record} editable={this.state.editable} isAdd={this.state.isAdd} request={request} userStatusList={userStatusList} - taxAgentAdminOption={taxAgentAdminOption} + taxAgentAdminOption={taxAgentOption} onChange={(value) => { handleSaveSlideChange(value); }}/> From efe05c530bfa7029e9addfe5baaa2b83d2be98cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Wed, 15 Feb 2023 17:21:49 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E8=96=AA=E8=B5=84=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/pages/salaryItem/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pc4mobx/hrmSalary/pages/salaryItem/index.js b/pc4mobx/hrmSalary/pages/salaryItem/index.js index 9e467b93..4345674e 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/index.js +++ b/pc4mobx/hrmSalary/pages/salaryItem/index.js @@ -252,7 +252,7 @@ export default class SalaryItem extends React.Component { 新增 } { - showOperateBtn && + (showOperateBtn || showSalaryItemBtn) &&