From 87aa53955f1ba5218f9ec59c46bfbc60214f79fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Fri, 16 Aug 2024 15:05:51 +0800 Subject: [PATCH 01/18] =?UTF-8?q?feature/2.15.1.2407.01-=E8=96=AA=E8=B5=84?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E4=BB=A5=E5=8F=8A=E5=AD=97=E6=AE=B5=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E9=A1=B5=E9=9D=A2=E6=94=B9=E9=80=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/pages/salaryItem/columns.js | 52 ------------------- pc4mobx/hrmSalary/pages/salaryItem/options.js | 2 - 2 files changed, 54 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/salaryItem/columns.js b/pc4mobx/hrmSalary/pages/salaryItem/columns.js index b2cae4bd..7e868d31 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/columns.js +++ b/pc4mobx/hrmSalary/pages/salaryItem/columns.js @@ -2,58 +2,6 @@ import { WeaLocaleProvider } from "ecCom"; import { dataTypeOptions, patternOptions, roundingModeOptions } from "./options"; const getLabel = WeaLocaleProvider.getLabel; -export const columns = [ - { - title: "名称", - dataIndex: "title", - key: "title" - }, - { - title: "属性", - dataIndex: "title", - key: "title" - }, - { - title: "类型", - dataIndex: "title", - key: "title" - }, - { - title: "薪资档案引用", - dataIndex: "refere", - key: "refere" - }, - { - title: "默认使用", - dataIndex: "refere", - key: "refere" - }, - { - title: "进位规则", - dataIndex: "title", - key: "title" - }, - { - title: "保留小数位", - dataIndex: "title", - key: "title" - }, - { - title: "取值方式", - dataIndex: "title", - key: "title" - }, - { - title: "备注", - dataIndex: "title", - key: "title" - }, - { - title: "操作", - dataIndex: "cz", - key: "cz" - } -]; export const salaryItemFields = [ { key: "name", diff --git a/pc4mobx/hrmSalary/pages/salaryItem/options.js b/pc4mobx/hrmSalary/pages/salaryItem/options.js index 58e64e3e..e7ac5f78 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/options.js +++ b/pc4mobx/hrmSalary/pages/salaryItem/options.js @@ -25,7 +25,6 @@ export const roundingModeOptions = [ showname: "见分进角" } ]; - export const patternOptions = [ { key: "0", @@ -83,7 +82,6 @@ export const patternOptions = [ selected: false } ]; - export const dataTypeOptions = [ { key: "number", From fd3d8b5ec4155ab4833dc7a97f2a8a3c8f5b3c94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Fri, 16 Aug 2024 16:18:08 +0800 Subject: [PATCH 02/18] =?UTF-8?q?feature/2.15.1.2407.01-=E8=96=AA=E8=B5=84?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E4=BB=A5=E5=8F=8A=E5=AD=97=E6=AE=B5=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E9=A1=B5=E9=9D=A2=E6=94=B9=E9=80=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/pages/salaryItem/index.js | 190 ++++++------------ pc4mobx/hrmSalary/pages/salaryItem/index.less | 15 ++ .../pages/salaryItem/salaryItemsTable.js | 67 ++++++ 3 files changed, 147 insertions(+), 125 deletions(-) create mode 100644 pc4mobx/hrmSalary/pages/salaryItem/salaryItemsTable.js diff --git a/pc4mobx/hrmSalary/pages/salaryItem/index.js b/pc4mobx/hrmSalary/pages/salaryItem/index.js index 09875add..64863656 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/index.js +++ b/pc4mobx/hrmSalary/pages/salaryItem/index.js @@ -1,17 +1,16 @@ import React from "react"; import { inject, observer } from "mobx-react"; import { Button, Dropdown, Menu, message, Modal, Switch } from "antd"; -import { WeaInputSearch, WeaLocaleProvider, WeaNewScroll, WeaSlideModal, WeaTop } from "ecCom"; -import { renderLoading, toDecimal_n } from "../../util"; -import CustomTab from "../../components/customTab"; +import { WeaInputSearch, WeaLocaleProvider, WeaSlideModal, WeaTop } from "ecCom"; +import SalaryItemsTable from "./salaryItemsTable"; +import { toDecimal_n } from "../../util"; import SystemSalaryItemModal from "./systemSalaryItemModal"; -import { columns } from "./columns"; import SlideModalTitle from "../../components/slideModalTitle"; import CustomSalaryItemSlide from "./customSalaryItemSlide"; -import CustomPaginationTable from "../../components/customPaginationTable"; import SyncToSalaryAccountSetDialog from "./syncToSalaryAccountSetDialog"; import "../socialSecurityBenefits/programme/index.less"; import LogDialog from "../../components/logViewModal"; +import "./index.less"; const { getLabel } = WeaLocaleProvider; @inject("salaryItemStore", "taxAgentStore", "salaryFileStore") @@ -20,6 +19,9 @@ export default class SalaryItem extends React.Component { constructor(props) { super(props); this.state = { + name: "", isQuery: false, + + value: "", selectedKey: "0", editable: false, @@ -31,43 +33,25 @@ export default class SalaryItem extends React.Component { syncSalarySetDialog: { visible: false, title: "", id: "" }, logDialogVisible: false, filterConditions: "[]" }; - columns.map(item => { - if (item.dataIndex == "refere") { - item.render = () => { - return ( - - ); - }; - } else if (item.dataIndex == "cz") { - item.render = () => { - return (
- 编辑 - 删除 - {/* 操作日志 */} -
); - }; - - } - }); this.record = {}; } componentWillMount() { // 初始化渲染页面 - const { salaryItemStore: { getTableDatas }, salaryFileStore, taxAgentStore } = this.props; - const { commonEnumList } = salaryFileStore; - const { fetchTaxAgentOption } = taxAgentStore; - fetchTaxAgentOption(); - commonEnumList("user", { enumClass: "com.engine.salary.enums.sicategory.SharedTypeEnum" }); - getTableDatas({}).then(res => { - this.setState({ - searchParams: { - ...this.state.searchParams, - current: res.pageNum, - total: res.total - } - }); - }); + // const { salaryItemStore: { getTableDatas }, salaryFileStore, taxAgentStore } = this.props; + // const { commonEnumList } = salaryFileStore; + // const { fetchTaxAgentOption } = taxAgentStore; + // fetchTaxAgentOption(); + // commonEnumList("user", { enumClass: "com.engine.salary.enums.sicategory.SharedTypeEnum" }); + // getTableDatas({}).then(res => { + // this.setState({ + // searchParams: { + // ...this.state.searchParams, + // current: res.pageNum, + // total: res.total + // } + // }); + // }); } onEditItem = (record, isedit) => { @@ -225,7 +209,7 @@ export default class SalaryItem extends React.Component { taxAgentStore: { showOperateBtn, showSalaryItemBtn, taxAgentOption } } = this.props; const { userStatusList } = salaryFileStore; - const { selectedRowKeys, logDialogVisible, filterConditions } = this.state; + const { selectedRowKeys, logDialogVisible, filterConditions, name, isQuery } = this.state; const { loading, deleteItemRequest, getTableDatas } = salaryItemStore; const { tableDataSource, @@ -236,9 +220,6 @@ export default class SalaryItem extends React.Component { setEditSlideVisible, request } = salaryItemStore; - if (this.getColumns().length === 2) { // 无权限处理 - return renderLoading(); - } const handleMenuClick = (e) => { const { salaryItemStore: { setEditSlideVisible, initRequest } } = this.props; @@ -257,51 +238,16 @@ export default class SalaryItem extends React.Component { ); - const renderRightOperation = () => { - return (
- { - (showOperateBtn || showSalaryItemBtn) && - handleMenuClick({ key: "1" })} - style={{ marginRight: "10px" }}>{getLabel(111, "新增自定义薪资项")} - } - { - (showOperateBtn || showSalaryItemBtn) && - - } - { - this.setState({ searchValue: value }); - }} onSearch={(value) => { - this.handleSearch(value); - }}/> -
); - - }; - + let buttons = [ + handleMenuClick({ key: "1" })}>{getLabel(111, "新增自定义薪资项")}, + , + this.setState({ name: val })} + placeholder={getLabel(111, "请输入名称")} onSearch={() => this.setState({ isQuery: !isQuery })}/> + ]; + const dropMenuDatas = [ + { key: "log", icon: , content: getLabel(545781, "操作日志") } + ]; // 新建和修改保存的回调 const handleSlideSave = (continueFlag) => { const { salaryItemStore: { saveItem, request, getTableDatas } } = this.props; @@ -372,45 +318,39 @@ export default class SalaryItem extends React.Component { disabled: !record.canDelete // Column configuration not to be checked }) }; + !(showOperateBtn || showSalaryItemBtn) && (buttons = buttons.slice(-1)); return ( -
- } iconBgcolor="#F14A2D" - showDropIcon onDropMenuClick={this.onDropMenuClick} - dropMenuDatas={[ - { - key: "log", icon: , - content: getLabel(545781, "操作日志") - } - ]} - > - -
- - record.id} - loading={loading} - rowSelection={rowSelection} - dataSource={tableDataSource} - columns={this.getColumns(tableColumns)} - total={this.state.searchParams.total} - current={this.state.searchParams.current} - pageSize={this.state.searchParams.pageSize} - onPageChange={(value) => { - this.handlePageChange(value); - }} - onShowSizeChange={(current, pageSize) => { - this.setState({ - searchParams: { - ...this.state.searchParams, - current, - pageSize - } - }, () => { - this.handleShowSizeChange({ name: this.state.searchValue, ...this.state.searchParams }); - }); - }} - /> - + + } iconBgcolor="#F14A2D" + buttons={buttons} showDropIcon onDropMenuClick={this.onDropMenuClick} dropMenuDatas={dropMenuDatas} + className="salaryProjectManagement"> +
+ {/**/} + {/* record.id}*/} + {/* loading={loading}*/} + {/* rowSelection={rowSelection}*/} + {/* dataSource={tableDataSource}*/} + {/* columns={this.getColumns(tableColumns)}*/} + {/* total={this.state.searchParams.total}*/} + {/* current={this.state.searchParams.current}*/} + {/* pageSize={this.state.searchParams.pageSize}*/} + {/* onPageChange={(value) => {*/} + {/* this.handlePageChange(value);*/} + {/* }}*/} + {/* onShowSizeChange={(current, pageSize) => {*/} + {/* this.setState({*/} + {/* searchParams: {*/} + {/* ...this.state.searchParams,*/} + {/* current,*/} + {/* pageSize*/} + {/* }*/} + {/* }, () => {*/} + {/* this.handleShowSizeChange({ name: this.state.searchValue, ...this.state.searchParams });*/} + {/* });*/} + {/* }}*/} + {/* />*/} + {/**/}
setEditSlideVisible(false)} /> } -
+ ); } } diff --git a/pc4mobx/hrmSalary/pages/salaryItem/index.less b/pc4mobx/hrmSalary/pages/salaryItem/index.less index 1d28f1ca..ed8aff62 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/index.less +++ b/pc4mobx/hrmSalary/pages/salaryItem/index.less @@ -1,3 +1,18 @@ +//薪资项目重构项 +.salaryProjectManagement { + .wea-input-focus { + height: 31.36px; + line-height: 0; + } + + .salaryItems_content { + height: 100%; + padding: 16px 16px 0 16px; + //background: #e5e5e5; + } +} + + .customSalaryItemSlide { padding: 16px; diff --git a/pc4mobx/hrmSalary/pages/salaryItem/salaryItemsTable.js b/pc4mobx/hrmSalary/pages/salaryItem/salaryItemsTable.js new file mode 100644 index 00000000..ac384499 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/salaryItem/salaryItemsTable.js @@ -0,0 +1,67 @@ +/* + * 薪资项目管理 + * 表格 + * @Author: 黎永顺 + * @Date: 2024/8/16 + * @Wechat: + * @Email: 971387674@qq.com + * @description: +*/ +import React, { Component } from "react"; +import { WeaLocaleProvider, WeaTable } from "ecCom"; +import * as API from "../../apis/item"; + +const getLabel = WeaLocaleProvider.getLabel; + +class SalaryItemsTable extends Component { + constructor(props) { + super(props); + this.state = { + loading: false, columns: [], dataSource: [], + pageInfo: { current: 1, pageSize: 10, total: 10 } + }; + } + + componentWillReceiveProps(nextProps, nextContext) { + if (nextProps.isQuery !== this.props.isQuery) this.getItemList(nextProps); + } + + getItemList = (props) => { + const { name } = props; + const { pageInfo } = this.state; + const payload = { name, ...pageInfo }; + this.setState({ loading: true }); + API.getItemList(payload).then(({ status, data }) => { + this.setState({ loading: false }); + if (status) { + const { columns, list: dataSource, pageNum: current, pageSize, total } = data; + this.setState({ + dataSource, pageInfo: { ...pageInfo, current, pageSize, total }, + columns + }); + } + }); + }; + + render() { + const { dataSource, columns, pageInfo } = this.state; + const pagination = { + ...pageInfo, + showTotal: total => `${getLabel(111, "共")} ${total} ${getLabel(111, "条")}`, + showQuickJumper: true, + showSizeChanger: true, + pageSizeOptions: ["10", "20", "50", "100"], + onShowSizeChange: (current, pageSize) => { + this.setState({ + pageInfo: { ...pageInfo, current, pageSize } + }, () => this.getItemList(this.props)); + }, + onChange: current => { + this.setState({ pageInfo: { ...pageInfo, current } }, () => this.getItemList(this.props)); + } + }; + return (); + } +} + +export default SalaryItemsTable; From d1fc6e4ea0e8aad90991ae8c808391b9ac3be39e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Fri, 16 Aug 2024 16:19:00 +0800 Subject: [PATCH 03/18] =?UTF-8?q?feature/2.15.1.2407.01-=E8=96=AA=E8=B5=84?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E4=BB=A5=E5=8F=8A=E5=AD=97=E6=AE=B5=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E9=A1=B5=E9=9D=A2=E6=94=B9=E9=80=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/pages/salaryItem/salaryItemsTable.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pc4mobx/hrmSalary/pages/salaryItem/salaryItemsTable.js b/pc4mobx/hrmSalary/pages/salaryItem/salaryItemsTable.js index ac384499..00f53a98 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/salaryItemsTable.js +++ b/pc4mobx/hrmSalary/pages/salaryItem/salaryItemsTable.js @@ -22,6 +22,10 @@ class SalaryItemsTable extends Component { }; } + componentDidMount() { + this.getItemList(this.props); + } + componentWillReceiveProps(nextProps, nextContext) { if (nextProps.isQuery !== this.props.isQuery) this.getItemList(nextProps); } From b9e7b3743993d99a95de93808289de190a8fd2b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Fri, 16 Aug 2024 16:19:21 +0800 Subject: [PATCH 04/18] =?UTF-8?q?feature/2.15.1.2407.01-=E8=96=AA=E8=B5=84?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E4=BB=A5=E5=8F=8A=E5=AD=97=E6=AE=B5=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E9=A1=B5=E9=9D=A2=E6=94=B9=E9=80=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/pages/salaryItem/salaryItemsTable.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pc4mobx/hrmSalary/pages/salaryItem/salaryItemsTable.js b/pc4mobx/hrmSalary/pages/salaryItem/salaryItemsTable.js index 00f53a98..e37acfe9 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/salaryItemsTable.js +++ b/pc4mobx/hrmSalary/pages/salaryItem/salaryItemsTable.js @@ -18,7 +18,7 @@ class SalaryItemsTable extends Component { super(props); this.state = { loading: false, columns: [], dataSource: [], - pageInfo: { current: 1, pageSize: 10, total: 10 } + pageInfo: { current: 1, pageSize: 10, total: 0 } }; } From 6ec8cb76ce73b3f593b84868e67e98e177174e9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Fri, 16 Aug 2024 17:06:42 +0800 Subject: [PATCH 05/18] =?UTF-8?q?feature/2.15.1.2407.01-=E8=96=AA=E8=B5=84?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E4=BB=A5=E5=8F=8A=E5=AD=97=E6=AE=B5=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E9=A1=B5=E9=9D=A2=E6=94=B9=E9=80=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/pages/salaryItem/index.js | 4 ++- pc4mobx/hrmSalary/pages/salaryItem/index.less | 2 -- .../pages/salaryItem/salaryItemsTable.js | 27 +++++++++++++++---- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/salaryItem/index.js b/pc4mobx/hrmSalary/pages/salaryItem/index.js index 64863656..0bf9a81b 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/index.js +++ b/pc4mobx/hrmSalary/pages/salaryItem/index.js @@ -324,7 +324,9 @@ export default class SalaryItem extends React.Component { } iconBgcolor="#F14A2D" buttons={buttons} showDropIcon onDropMenuClick={this.onDropMenuClick} dropMenuDatas={dropMenuDatas} className="salaryProjectManagement"> -
+
this.setState({ selectedRowKeys: val })}/> {/**/} {/* record.id}*/} diff --git a/pc4mobx/hrmSalary/pages/salaryItem/index.less b/pc4mobx/hrmSalary/pages/salaryItem/index.less index ed8aff62..0ddab0d2 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/index.less +++ b/pc4mobx/hrmSalary/pages/salaryItem/index.less @@ -7,8 +7,6 @@ .salaryItems_content { height: 100%; - padding: 16px 16px 0 16px; - //background: #e5e5e5; } } diff --git a/pc4mobx/hrmSalary/pages/salaryItem/salaryItemsTable.js b/pc4mobx/hrmSalary/pages/salaryItem/salaryItemsTable.js index e37acfe9..93a18aea 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/salaryItemsTable.js +++ b/pc4mobx/hrmSalary/pages/salaryItem/salaryItemsTable.js @@ -8,7 +8,7 @@ * @description: */ import React, { Component } from "react"; -import { WeaLocaleProvider, WeaTable } from "ecCom"; +import { WeaCheckbox, WeaLocaleProvider, WeaTable } from "ecCom"; import * as API from "../../apis/item"; const getLabel = WeaLocaleProvider.getLabel; @@ -17,7 +17,7 @@ class SalaryItemsTable extends Component { constructor(props) { super(props); this.state = { - loading: false, columns: [], dataSource: [], + loading: false, columns: [], dataSource: [], selectedRowKeys: [], pageInfo: { current: 1, pageSize: 10, total: 0 } }; } @@ -41,14 +41,20 @@ class SalaryItemsTable extends Component { const { columns, list: dataSource, pageNum: current, pageSize, total } = data; this.setState({ dataSource, pageInfo: { ...pageInfo, current, pageSize, total }, - columns + columns: _.map(columns, o => { + if (o.dataIndex === "useDefault" || o.dataIndex === "hideDefault" || o.dataIndex === "useInEmployeeSalary") { + return { ...o, width: 80, render: text => }; + } + return { ...o }; + }) }); } }); }; render() { - const { dataSource, columns, pageInfo } = this.state; + const { dataSource, columns, pageInfo, selectedRowKeys } = this.state; + // const { selectedRowKeys, onChange } = this.props; const pagination = { ...pageInfo, showTotal: total => `${getLabel(111, "共")} ${total} ${getLabel(111, "条")}`, @@ -64,7 +70,18 @@ class SalaryItemsTable extends Component { this.setState({ pageInfo: { ...pageInfo, current } }, () => this.getItemList(this.props)); } }; - return (); + const rowSelection = { + selectedRowKeys, + onChange: (selectedRowKeys) => this.setState({ selectedRowKeys }), + getCheckboxProps: record => { + console.log(record) + return ({ + disabled: !record.canDelete + }) + } + }; + return (); } } From a101de8355d089862d3e9f7e92f5b8a17a87efd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Mon, 19 Aug 2024 09:10:47 +0800 Subject: [PATCH 06/18] =?UTF-8?q?feature/2.15.1.2407.01-=E8=96=AA=E8=B5=84?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E4=BB=A5=E5=8F=8A=E5=AD=97=E6=AE=B5=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E9=A1=B5=E9=9D=A2=E6=94=B9=E9=80=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/pages/salaryItem/index.js | 35 ++++----- .../pages/salaryItem/salaryItemsTable.js | 72 +++++++++++++++---- 2 files changed, 77 insertions(+), 30 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/salaryItem/index.js b/pc4mobx/hrmSalary/pages/salaryItem/index.js index 0bf9a81b..8f61de7b 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/index.js +++ b/pc4mobx/hrmSalary/pages/salaryItem/index.js @@ -2,6 +2,7 @@ import React from "react"; import { inject, observer } from "mobx-react"; import { Button, Dropdown, Menu, message, Modal, Switch } from "antd"; import { WeaInputSearch, WeaLocaleProvider, WeaSlideModal, WeaTop } from "ecCom"; +import * as API from "../../apis/item"; import SalaryItemsTable from "./salaryItemsTable"; import { toDecimal_n } from "../../util"; import SystemSalaryItemModal from "./systemSalaryItemModal"; @@ -68,28 +69,29 @@ export default class SalaryItem extends React.Component { }); }; - // 删除列表项 - handleDeleteItem(record) { - const { salaryItemStore: { deleteItemRequest, getTableDatas } } = this.props; + handleDeleteItem = () => { + const { selectedRowKeys, isQuery } = this.state; + if (_.isEmpty(selectedRowKeys)) { + message.warning(getLabel(111, "请勾选数据!")); + return; + } Modal.confirm({ - title: "信息确认", - content: "确认删除该条数据吗?", + title: getLabel(131329, "信息确认"), + content: getLabel(111, "确认删除吗?"), onOk: () => { - deleteItemRequest([record.id]).then(() => { - getTableDatas({ ...this.state.searchParams }).then(res => { - this.setState({ - searchParams: { - ...this.state.searchParams, - total: res.total - } - }); - }); + API.deleteItem(selectedRowKeys).then(({ status, errormsg }) => { + if (status) { + message.success(getLabel(111, "操作成功!")); + this.setState({ isQuery: !isQuery }); + } else { + message.error(errormsg); + } }); }, onCancel: () => { } }); - } + }; getColumns = () => { const { salaryItemStore, taxAgentStore: { showSalaryItemBtn, showOperateBtn } } = this.props; @@ -241,7 +243,7 @@ export default class SalaryItem extends React.Component { let buttons = [ handleMenuClick({ key: "1" })}>{getLabel(111, "新增自定义薪资项")}, - , + , this.setState({ name: val })} placeholder={getLabel(111, "请输入名称")} onSearch={() => this.setState({ isQuery: !isQuery })}/> ]; @@ -326,6 +328,7 @@ export default class SalaryItem extends React.Component { className="salaryProjectManagement">
this.setState({ selectedRowKeys: val })}/> {/**/} {/* this.getItemList(nextProps)); } getItemList = (props) => { @@ -51,10 +54,30 @@ class SalaryItemsTable extends Component { } }); }; + handleDeleteItem = (record) => { + Modal.confirm({ + title: getLabel(131329, "信息确认"), + content: getLabel(111, "确认删除吗?"), + onOk: () => { + API.deleteItem(selectedRowKeys).then(({ status, errormsg }) => { + if (status) { + message.success(getLabel(111, "操作成功!")); + this.getItemList(this.props); + } else { + message.error(errormsg); + } + }); + }, + onCancel: () => { + } + }); + }; render() { - const { dataSource, columns, pageInfo, selectedRowKeys } = this.state; - // const { selectedRowKeys, onChange } = this.props; + const { dataSource, columns, pageInfo, loading } = this.state; + const { + selectedRowKeys, onChange, onDropMenuClick, taxAgentStore: { showOperateBtn, showSalaryItemBtn } + } = this.props; const pagination = { ...pageInfo, showTotal: total => `${getLabel(111, "共")} ${total} ${getLabel(111, "条")}`, @@ -71,17 +94,38 @@ class SalaryItemsTable extends Component { } }; const rowSelection = { - selectedRowKeys, - onChange: (selectedRowKeys) => this.setState({ selectedRowKeys }), - getCheckboxProps: record => { - console.log(record) - return ({ - disabled: !record.canDelete - }) - } + selectedRowKeys, onChange, + getCheckboxProps: record => ({ + disabled: !record.canDelete + }) }; - return (); + return ( + ( + {(showOperateBtn || showSalaryItemBtn) ? getLabel(111, "编辑") : getLabel(111, "查看")} + { + (showOperateBtn || showSalaryItemBtn) && record.canDelete && + this.handleDeleteItem(record)}>{getLabel(111, "删除")} + } + + + onDropMenuClick("log", record.id)}>{getLabel(545781, "操作日志")} + + + }> + + + ) + } + ]}/>); } } From 3cff712ae950378e8c69a86e432c564245cfee75 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, 20 Aug 2024 10:35:32 +0800 Subject: [PATCH 07/18] =?UTF-8?q?feature/2.15.1.2407.01-=E8=96=AA=E8=B5=84?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E4=BB=A5=E5=8F=8A=E5=AD=97=E6=AE=B5=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E9=A1=B5=E9=9D=A2=E6=94=B9=E9=80=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/pages/salaryItem/index.js | 42 ++------------------- 1 file changed, 4 insertions(+), 38 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/salaryItem/index.js b/pc4mobx/hrmSalary/pages/salaryItem/index.js index 8f61de7b..c6729999 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/index.js +++ b/pc4mobx/hrmSalary/pages/salaryItem/index.js @@ -239,7 +239,6 @@ export default class SalaryItem extends React.Component { {getLabel(111, "新增系统薪资项")} ); - let buttons = [ handleMenuClick({ key: "1" })}>{getLabel(111, "新增自定义薪资项")}, @@ -313,49 +312,16 @@ export default class SalaryItem extends React.Component { const { salaryItemStore: { setRequest } } = this.props; setRequest(value); }; - const rowSelection = { - selectedRowKeys, - onChange: (selectedRowKeys) => this.setState({ selectedRowKeys }), - getCheckboxProps: record => ({ - disabled: !record.canDelete // Column configuration not to be checked - }) - }; !(showOperateBtn || showSalaryItemBtn) && (buttons = buttons.slice(-1)); return ( } iconBgcolor="#F14A2D" buttons={buttons} showDropIcon onDropMenuClick={this.onDropMenuClick} dropMenuDatas={dropMenuDatas} className="salaryProjectManagement"> -
this.setState({ selectedRowKeys: val })}/> - {/**/} - {/* record.id}*/} - {/* loading={loading}*/} - {/* rowSelection={rowSelection}*/} - {/* dataSource={tableDataSource}*/} - {/* columns={this.getColumns(tableColumns)}*/} - {/* total={this.state.searchParams.total}*/} - {/* current={this.state.searchParams.current}*/} - {/* pageSize={this.state.searchParams.pageSize}*/} - {/* onPageChange={(value) => {*/} - {/* this.handlePageChange(value);*/} - {/* }}*/} - {/* onShowSizeChange={(current, pageSize) => {*/} - {/* this.setState({*/} - {/* searchParams: {*/} - {/* ...this.state.searchParams,*/} - {/* current,*/} - {/* pageSize*/} - {/* }*/} - {/* }, () => {*/} - {/* this.handleShowSizeChange({ name: this.state.searchValue, ...this.state.searchParams });*/} - {/* });*/} - {/* }}*/} - {/* />*/} - {/**/} +
+ this.setState({ selectedRowKeys: val })}/>
Date: Tue, 20 Aug 2024 11:09:29 +0800 Subject: [PATCH 08/18] =?UTF-8?q?feature/2.15.1.2407.01-=E8=96=AA=E8=B5=84?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E4=BB=A5=E5=8F=8A=E5=AD=97=E6=AE=B5=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E9=A1=B5=E9=9D=A2=E6=94=B9=E9=80=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/salaryItem/customSalaryItemSlide.js | 54 +++++----- pc4mobx/hrmSalary/pages/salaryItem/index.js | 100 +++++++++++------- .../pages/salaryItem/salaryItemsTable.js | 2 +- 3 files changed, 92 insertions(+), 64 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/salaryItem/customSalaryItemSlide.js b/pc4mobx/hrmSalary/pages/salaryItem/customSalaryItemSlide.js index 9e407f56..0abbad77 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/customSalaryItemSlide.js +++ b/pc4mobx/hrmSalary/pages/salaryItem/customSalaryItemSlide.js @@ -1,8 +1,8 @@ import React from "react"; -import FormalFormModal from "./formalFormModal"; -import SalaryItemForm from "./salaryItemForm"; -import "./index.less"; - +import { WeaLocaleProvider, WeaSlideModal } from "ecCom"; +// import FormalFormModal from "./formalFormModal"; +// import SalaryItemForm from "./salaryItemForm"; +const getLabel = WeaLocaleProvider.getLabel; export default class CustomSalaryItemSlide extends React.Component { constructor(props) { super(props); @@ -37,26 +37,32 @@ export default class CustomSalaryItemSlide extends React.Component { const { request } = this.props; const { valueType, dataType, formulaId } = request; const { formalModalVisible, salaryItemName } = this.state; - return ( -
- - {formalModalVisible && - { - this.handleSaveFormal(data); - }} - onCancel={() => - this.setState({ - formalModalVisible: false, - salaryItemName: "" - })} - />} -
+ return ( +
}/> + + //
+ // + // {formalModalVisible && + // { + // this.handleSaveFormal(data); + // }} + // onCancel={() => + // this.setState({ + // formalModalVisible: false, + // salaryItemName: "" + // })} + // />} + //
); } } diff --git a/pc4mobx/hrmSalary/pages/salaryItem/index.js b/pc4mobx/hrmSalary/pages/salaryItem/index.js index c6729999..519e555a 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/index.js +++ b/pc4mobx/hrmSalary/pages/salaryItem/index.js @@ -1,12 +1,11 @@ import React from "react"; import { inject, observer } from "mobx-react"; import { Button, Dropdown, Menu, message, Modal, Switch } from "antd"; -import { WeaInputSearch, WeaLocaleProvider, WeaSlideModal, WeaTop } from "ecCom"; +import { WeaInputSearch, WeaLocaleProvider, WeaTop } from "ecCom"; import * as API from "../../apis/item"; import SalaryItemsTable from "./salaryItemsTable"; import { toDecimal_n } from "../../util"; import SystemSalaryItemModal from "./systemSalaryItemModal"; -import SlideModalTitle from "../../components/slideModalTitle"; import CustomSalaryItemSlide from "./customSalaryItemSlide"; import SyncToSalaryAccountSetDialog from "./syncToSalaryAccountSetDialog"; import "../socialSecurityBenefits/programme/index.less"; @@ -21,6 +20,7 @@ export default class SalaryItem extends React.Component { super(props); this.state = { name: "", isQuery: false, + customItemDialog: { visible: false, title: "", buttons: [] },// 自定义薪资项弹窗 value: "", @@ -199,6 +199,23 @@ export default class SalaryItem extends React.Component { filterConditions: targetid ? `[{\"connectCondition\":\"AND\",\"columIndex\":\"targetid\",\"type\":\"=\",\"value\":\"${targetid}\"}]` : "[]" }); break; + case "customAdd": + case "edit": + const { taxAgentStore: { showOperateBtn, showSalaryItemBtn } } = this.props; + const title = key === "edit" ? getLabel(111, "修改自定义薪资项目") : getLabel(111, "新建自定义薪资项目"); + const buttons = key === "edit" ? [ + , + + ] : [ + , + + ]; + this.setState({ + customItemDialog: { visible: true, title, buttons: (showSalaryItemBtn || showOperateBtn) ? buttons : [] } + }); + break; + case "sysAdd": + break; default: break; } @@ -211,7 +228,7 @@ export default class SalaryItem extends React.Component { taxAgentStore: { showOperateBtn, showSalaryItemBtn, taxAgentOption } } = this.props; const { userStatusList } = salaryFileStore; - const { selectedRowKeys, logDialogVisible, filterConditions, name, isQuery } = this.state; + const { selectedRowKeys, logDialogVisible, filterConditions, name, isQuery, customItemDialog } = this.state; const { loading, deleteItemRequest, getTableDatas } = salaryItemStore; const { tableDataSource, @@ -235,13 +252,13 @@ export default class SalaryItem extends React.Component { }; const menu = ( - - {getLabel(111, "新增系统薪资项")} + + {getLabel(111, "新增系统薪资项")} ); let buttons = [ handleMenuClick({ key: "1" })}>{getLabel(111, "新增自定义薪资项")}, + onClick={() => this.onDropMenuClick("customAdd")}>{getLabel(111, "新增自定义薪资项")}, , this.setState({ name: val })} placeholder={getLabel(111, "请输入名称")} onSearch={() => this.setState({ isQuery: !isQuery })}/> @@ -355,39 +372,44 @@ export default class SalaryItem extends React.Component { }} /> } - { - editSlideVisible && - - } - content={ - { - handleSaveSlideChange(value); - }}/> - } - onClose={() => setEditSlideVisible(false)} - /> - } + {/*新增编辑自定义薪资项目*/} + this.setState({ isQuery: !isQuery })} + onClose={callback => this.setState({ + customItemDialog: { ...customItemDialog, visible: false } + }, () => callback && callback())}/> + {/*{*/} + {/* editSlideVisible &&*/} + {/* */} + {/* }*/} + {/* content={*/} + {/* {*/} + {/* handleSaveSlideChange(value);*/} + {/* }}/>*/} + {/* }*/} + {/* onClose={() => setEditSlideVisible(false)}*/} + {/* />*/} + {/*}*/} ); } diff --git a/pc4mobx/hrmSalary/pages/salaryItem/salaryItemsTable.js b/pc4mobx/hrmSalary/pages/salaryItem/salaryItemsTable.js index e0639540..eee77555 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/salaryItemsTable.js +++ b/pc4mobx/hrmSalary/pages/salaryItem/salaryItemsTable.js @@ -106,7 +106,7 @@ class SalaryItemsTable extends Component { ...columns, { dataIndex: "opt", title: getLabel(111, "操作"), width: 140, render: (__, record) => ( - onDropMenuClick("edit", record)} href="javascript:void(0);">{(showOperateBtn || showSalaryItemBtn) ? getLabel(111, "编辑") : getLabel(111, "查看")} { (showOperateBtn || showSalaryItemBtn) && record.canDelete && From aaf2914e2002d003364cc35cb619d00d2401c5fc 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, 20 Aug 2024 11:25:09 +0800 Subject: [PATCH 09/18] =?UTF-8?q?feature/2.15.1.2407.01-=E8=96=AA=E8=B5=84?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E4=BB=A5=E5=8F=8A=E5=AD=97=E6=AE=B5=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E9=A1=B5=E9=9D=A2=E6=94=B9=E9=80=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/salaryItem/customSalaryItemSlide.js | 25 ++++++++++++++++--- pc4mobx/hrmSalary/pages/salaryItem/index.less | 3 +++ 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/salaryItem/customSalaryItemSlide.js b/pc4mobx/hrmSalary/pages/salaryItem/customSalaryItemSlide.js index 0abbad77..9baa49f9 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/customSalaryItemSlide.js +++ b/pc4mobx/hrmSalary/pages/salaryItem/customSalaryItemSlide.js @@ -2,11 +2,15 @@ import React from "react"; import { WeaLocaleProvider, WeaSlideModal } from "ecCom"; // import FormalFormModal from "./formalFormModal"; // import SalaryItemForm from "./salaryItemForm"; + const getLabel = WeaLocaleProvider.getLabel; + export default class CustomSalaryItemSlide extends React.Component { constructor(props) { super(props); this.state = { + loading: false, + showForm: false, formalModalVisible: false, salaryItemName: "" @@ -33,15 +37,30 @@ export default class CustomSalaryItemSlide extends React.Component { }); }; + renderTitle = () => { + const { loading } = this.state, { title, buttons } = this.props; + return
+
+
+
{title}
+
+
+ { + _.isEmpty(detail) && + + } +
+
; + }; + render() { const { request } = this.props; const { valueType, dataType, formulaId } = request; const { formalModalVisible, salaryItemName } = this.state; return ( + content={
}/> //
diff --git a/pc4mobx/hrmSalary/pages/salaryItem/index.less b/pc4mobx/hrmSalary/pages/salaryItem/index.less index 0ddab0d2..74da4b67 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/index.less +++ b/pc4mobx/hrmSalary/pages/salaryItem/index.less @@ -11,6 +11,9 @@ } + + + .customSalaryItemSlide { padding: 16px; From f03c187796e1e67d5ffe059b80c7b041273f1360 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, 20 Aug 2024 13:37:09 +0800 Subject: [PATCH 10/18] =?UTF-8?q?feature/2.15.1.2407.01-=E8=96=AA=E8=B5=84?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E4=BB=A5=E5=8F=8A=E5=AD=97=E6=AE=B5=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E9=A1=B5=E9=9D=A2=E6=94=B9=E9=80=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/pages/salaryItem/columns.js | 72 +++++++++++++++++++ .../pages/salaryItem/customSalaryItemSlide.js | 11 +-- pc4mobx/hrmSalary/pages/salaryItem/index.less | 50 ++++++++++++- 3 files changed, 121 insertions(+), 12 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/salaryItem/columns.js b/pc4mobx/hrmSalary/pages/salaryItem/columns.js index 7e868d31..f93b0b71 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/columns.js +++ b/pc4mobx/hrmSalary/pages/salaryItem/columns.js @@ -2,6 +2,78 @@ import { WeaLocaleProvider } from "ecCom"; import { dataTypeOptions, patternOptions, roundingModeOptions } from "./options"; const getLabel = WeaLocaleProvider.getLabel; + +export const salaryItemConditions = [ + { + items: [ + { + conditionType: "INPUT", + domkey: ["name"], + fieldcol: 14, + label: "名称", + lanId: 111, + labelcol: 8, + value: "", + rules: "required|string", + viewAttr: 3 + }, + { + conditionType: "SWITCH", + domkey: ["useDefault"], + fieldcol: 14, + label: "默认使用", + lanId: 111, + labelcol: 8, + value: "", + rules: "required|string", + tipLanId: 111, + tip: "提示:开启后,每个薪资方案都有该薪资项目,可在具体薪资方案中删除", + viewAttr: 3 + }, + { + conditionType: "SWITCH", + domkey: ["hideDefault"], + fieldcol: 14, + label: "核算时隐藏", + lanId: 111, + labelcol: 8, + value: "", + rules: "required|string", + tipLanId: 111, + tip: "提示:开启后,在薪资账套中添加该项目时,默认勾选隐藏且在核算时隐藏该薪资项目,可在具体薪资账套中设置是否隐藏", + viewAttr: 3 + }, + { + conditionType: "SELECT", + domkey: ["sharedType"], + fieldcol: 14, + label: "可见性", + lanId: 111, + labelcol: 8, + value: "", + options: [], + rules: "required|string", + viewAttr: 3 + }, + { + conditionType: "SELECT", + domkey: ["taxAgentIds"], + fieldcol: 14, + label: "可见性范围", + lanId: 111, + labelcol: 8, + value: "", + options: [], + multiple: true, + rules: "required|string", + viewAttr: 3, + hide: true + }, + ], + title: "", + defaultshow: true + } +]; export const salaryItemFields = [ { key: "name", diff --git a/pc4mobx/hrmSalary/pages/salaryItem/customSalaryItemSlide.js b/pc4mobx/hrmSalary/pages/salaryItem/customSalaryItemSlide.js index 9baa49f9..4ff97292 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/customSalaryItemSlide.js +++ b/pc4mobx/hrmSalary/pages/salaryItem/customSalaryItemSlide.js @@ -9,8 +9,6 @@ export default class CustomSalaryItemSlide extends React.Component { constructor(props) { super(props); this.state = { - loading: false, - showForm: false, formalModalVisible: false, salaryItemName: "" @@ -38,18 +36,13 @@ export default class CustomSalaryItemSlide extends React.Component { }; renderTitle = () => { - const { loading } = this.state, { title, buttons } = this.props; + const { title, buttons } = this.props; return
{title}
-
- { - _.isEmpty(detail) && - - } -
+
{buttons}
; }; diff --git a/pc4mobx/hrmSalary/pages/salaryItem/index.less b/pc4mobx/hrmSalary/pages/salaryItem/index.less index 74da4b67..e12fed2b 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/index.less +++ b/pc4mobx/hrmSalary/pages/salaryItem/index.less @@ -8,12 +8,56 @@ .salaryItems_content { height: 100%; } + + .wea-slide-modal-title { + border-bottom: 1px solid #e5e5e5 !important; + } + + .titleDialog { + display: flex; + justify-content: space-between; + align-items: center; + padding: 0 46px 0 16px; + + .titleCol { + flex: 1; + display: flex; + align-items: center; + } + + .titleLeftBox { + .titleIcon { + color: #fff; + margin: 0; + width: 40px; + height: 40px; + line-height: 40px; + font-size: 22px; + display: flex; + align-items: center; + justify-content: center; + background: #F14A2D; + border-radius: 50%; + } + + .title { + font-size: 14px; + color: #333; + padding-left: 6px; + } + } + + .titleRightBox { + justify-content: flex-end; + + button { + margin-left: 10px; + } + } + } } - - - .customSalaryItemSlide { padding: 16px; From 50b4426a75d60a415b73174250b4c3c953feeedf 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, 20 Aug 2024 14:02:33 +0800 Subject: [PATCH 11/18] =?UTF-8?q?feature/2.15.1.2407.01-=E8=96=AA=E8=B5=84?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E4=BB=A5=E5=8F=8A=E5=AD=97=E6=AE=B5=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E9=A1=B5=E9=9D=A2=E6=94=B9=E9=80=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/salaryItem/customSalaryItemSlide.js | 46 +++++++++++++++++-- pc4mobx/hrmSalary/stores/salaryItem.js | 3 ++ 2 files changed, 46 insertions(+), 3 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/salaryItem/customSalaryItemSlide.js b/pc4mobx/hrmSalary/pages/salaryItem/customSalaryItemSlide.js index 4ff97292..e3486a31 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/customSalaryItemSlide.js +++ b/pc4mobx/hrmSalary/pages/salaryItem/customSalaryItemSlide.js @@ -1,20 +1,37 @@ import React from "react"; -import { WeaLocaleProvider, WeaSlideModal } from "ecCom"; +import { inject, observer } from "mobx-react"; +import { WeaFormItem, WeaHelpfulTip, WeaLocaleProvider, WeaSearchGroup, WeaSlideModal } from "ecCom"; +import { WeaSwitch } from "comsMobx"; // import FormalFormModal from "./formalFormModal"; // import SalaryItemForm from "./salaryItemForm"; const getLabel = WeaLocaleProvider.getLabel; +const getKey = WeaTools.getKey; +@inject("salaryItemStore") +@observer export default class CustomSalaryItemSlide extends React.Component { constructor(props) { super(props); this.state = { + conditions: [], + showForm: false, formalModalVisible: false, salaryItemName: "" }; } + componentWillReceiveProps(nextProps, nextContext) { + if (nextProps.visible !== this.props.visible && nextProps.visible) { + document.querySelector(".custom_salaryItemSlide").classList.add("zIndex0-weaslide-title"); + this.initForm(nextProps); + } else if (nextProps.visible !== this.props.visible && !nextProps.visible) { + document.querySelector(".custom_salaryItemSlide").classList.remove("zIndex0-weaslide-title"); + this.props.salaryItemStore.initItemsForm(); + } + } + handleChange = (params) => { this.props.onChange({ ...this.props.request, ...params }); }; @@ -34,7 +51,29 @@ export default class CustomSalaryItemSlide extends React.Component { originSqlContent: data.referenceType === "sql" ? data.formula : "" }); }; - + renderForm = (form) => { + const { conditions } = this.state, { isFormInit } = form, formParams = form.getFormParams(); + let group = []; + isFormInit && conditions.map(c => { + let items = []; + c.items.map(fields => { + items.push({ + com: ( + + + { + fields.tip && + } + ), + hide: fields.hide + }); + }); + group.push(); + }); + return group; + }; renderTitle = () => { const { title, buttons } = this.props; return
@@ -51,7 +90,8 @@ export default class CustomSalaryItemSlide extends React.Component { const { valueType, dataType, formulaId } = request; const { formalModalVisible, salaryItemName } = this.state; return (
}/> diff --git a/pc4mobx/hrmSalary/stores/salaryItem.js b/pc4mobx/hrmSalary/stores/salaryItem.js index cc3a0214..45f30171 100644 --- a/pc4mobx/hrmSalary/stores/salaryItem.js +++ b/pc4mobx/hrmSalary/stores/salaryItem.js @@ -9,6 +9,9 @@ const { TableStore } = WeaTableNew; export class SalaryItemStore { @observable salarySetform = new WeaForm(); //同步薪资账套form + @observable itemsForm = new WeaForm(); //自定义薪资项目form + @action initItemsForm = () => this.itemsForm = new WeaForm(); + @observable tableStore = new TableStore(); // new table @observable sysListTableStore = new TableStore(); From fdf82d883d6247d34bfdd3ee6a02916607526cfb 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, 20 Aug 2024 14:10:27 +0800 Subject: [PATCH 12/18] =?UTF-8?q?feature/2.15.1.2407.01-=E8=96=AA=E8=B5=84?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E4=BB=A5=E5=8F=8A=E5=AD=97=E6=AE=B5=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E9=A1=B5=E9=9D=A2=E6=94=B9=E9=80=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/salaryItem/customSalaryItemSlide.js | 16 ++++++++++++++++ pc4mobx/hrmSalary/style/index.less | 7 +++++++ 2 files changed, 23 insertions(+) diff --git a/pc4mobx/hrmSalary/pages/salaryItem/customSalaryItemSlide.js b/pc4mobx/hrmSalary/pages/salaryItem/customSalaryItemSlide.js index e3486a31..f615f0e6 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/customSalaryItemSlide.js +++ b/pc4mobx/hrmSalary/pages/salaryItem/customSalaryItemSlide.js @@ -2,6 +2,7 @@ import React from "react"; import { inject, observer } from "mobx-react"; import { WeaFormItem, WeaHelpfulTip, WeaLocaleProvider, WeaSearchGroup, WeaSlideModal } from "ecCom"; import { WeaSwitch } from "comsMobx"; +import { salaryItemConditions } from "./columns"; // import FormalFormModal from "./formalFormModal"; // import SalaryItemForm from "./salaryItemForm"; @@ -51,6 +52,21 @@ export default class CustomSalaryItemSlide extends React.Component { originSqlContent: data.referenceType === "sql" ? data.formula : "" }); }; + initForm = (props) => { + this.setState({ + conditions: _.map(salaryItemConditions, c => { + return { + ...c, items: _.map(c.items, fields => { + return { + ...fields, label: getLabel(fields.lanId, fields.label) + }; + }) + }; + }) + }, () => { + props.salaryItemStore.itemsForm.initFormFields(this.state.conditions); + }); + }; renderForm = (form) => { const { conditions } = this.state, { isFormInit } = form, formParams = form.getFormParams(); let group = []; diff --git a/pc4mobx/hrmSalary/style/index.less b/pc4mobx/hrmSalary/style/index.less index 8e65be90..5f2c76d6 100644 --- a/pc4mobx/hrmSalary/style/index.less +++ b/pc4mobx/hrmSalary/style/index.less @@ -117,3 +117,10 @@ } +//公共slide框标题样式 +.zIndex0-weaslide-title { + .wea-new-top-req { + z-index: 0 !important; + } +} + From 673c2ba908323ece7a9b35799b37f84415fb6870 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, 20 Aug 2024 15:27:03 +0800 Subject: [PATCH 13/18] =?UTF-8?q?feature/2.15.1.2407.01-=E8=96=AA=E8=B5=84?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E4=BB=A5=E5=8F=8A=E5=AD=97=E6=AE=B5=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E9=A1=B5=E9=9D=A2=E6=94=B9=E9=80=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/pages/salaryItem/columns.js | 130 +++++++++++++++++- .../pages/salaryItem/customSalaryItemSlide.js | 35 +++-- pc4mobx/hrmSalary/pages/salaryItem/index.less | 8 ++ 3 files changed, 159 insertions(+), 14 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/salaryItem/columns.js b/pc4mobx/hrmSalary/pages/salaryItem/columns.js index f93b0b71..a478b454 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/columns.js +++ b/pc4mobx/hrmSalary/pages/salaryItem/columns.js @@ -3,6 +3,7 @@ import { dataTypeOptions, patternOptions, roundingModeOptions } from "./options" const getLabel = WeaLocaleProvider.getLabel; + export const salaryItemConditions = [ { items: [ @@ -24,7 +25,7 @@ export const salaryItemConditions = [ label: "默认使用", lanId: 111, labelcol: 8, - value: "", + value: "0", rules: "required|string", tipLanId: 111, tip: "提示:开启后,每个薪资方案都有该薪资项目,可在具体薪资方案中删除", @@ -37,7 +38,7 @@ export const salaryItemConditions = [ label: "核算时隐藏", lanId: 111, labelcol: 8, - value: "", + value: "0", rules: "required|string", tipLanId: 111, tip: "提示:开启后,在薪资账套中添加该项目时,默认勾选隐藏且在核算时隐藏该薪资项目,可在具体薪资账套中设置是否隐藏", @@ -69,6 +70,131 @@ export const salaryItemConditions = [ viewAttr: 3, hide: true }, + { + conditionType: "SELECT", + domkey: ["dataType"], + fieldcol: 14, + label: "字段类型", + lanId: 111, + labelcol: 8, + value: "", + options: [ + { key: "number", showname: "数值", lanId: 111, selected: true }, + { key: "string", showname: "字符", lanId: 111, selected: false } + ], + rules: "required|string", + viewAttr: 3 + }, + { + conditionType: "SELECT", + domkey: ["roundingMode"], + fieldcol: 14, + label: "舍入规则", + lanId: 111, + labelcol: 8, + value: "", + options: [ + { key: "1", selected: true, showname: "原始数据", lanId: 111 }, + { key: "2", selected: false, showname: "四舍五入", lanId: 111 }, + { key: "3", selected: false, showname: "向上舍入", lanId: 111 }, + { key: "4", selected: false, showname: "向下舍入", lanId: 111 }, + { key: "5", selected: false, showname: "见分进角", lanId: 111 } + ], + rules: "required|string", + viewAttr: 3 + }, + { + conditionType: "SELECT", + domkey: ["pattern"], + fieldcol: 14, + label: "保留小数位", + lanId: 111, + labelcol: 8, + value: "", + options: [ + { key: "0", selected: false, showname: "0" }, + { key: "1", selected: false, showname: "1" }, + { key: "2", selected: true, showname: "2" }, + { 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: "7", selected: false, showname: "7" }, + { key: "8", selected: false, showname: "8" }, + { key: "9", selected: false, showname: "9" }, + { key: "10", selected: false, showname: "10" } + ], + rules: "required|string", + viewAttr: 3 + }, + { + conditionType: "SELECT", + domkey: ["valueType"], + fieldcol: 14, + label: "取值方式", + lanId: 111, + labelcol: 8, + value: "", + detailType: 3, + options: [ + { key: "1", showname: "输入", selected: true, lanId: 111 }, + { key: "2", showname: "公式", selected: false, lanId: 111 }, + { key: "3", showname: "SQL", selected: false, lanId: 111 } + ], + rules: "required|string", + viewAttr: 3 + }, + { + conditionType: "INPUT", + domkey: ["defaultValue"], + fieldcol: 14, + label: "默认值", + lanId: 111, + labelcol: 8, + value: "", + viewAttr: 2 + }, + { + conditionType: "INPUT", + domkey: ["formulaContent"], + fieldcol: 14, + label: "公式", + lanId: 111, + labelcol: 8, + value: "", + viewAttr: 2 + }, + { + conditionType: "INPUTNUMBER", + domkey: ["sortedIndex"], + fieldcol: 14, + label: "显示顺序", + lanId: 111, + labelcol: 8, + value: "", + viewAttr: 2 + }, + { + conditionType: "INPUTNUMBER", + domkey: ["width"], + fieldcol: 14, + label: "显示宽度", + lanId: 111, + labelcol: 8, + value: "", + viewAttr: 2 + }, + { + conditionType: "TEXTAREA", + domkey: ["description"], + fieldcol: 14, + label: "备注", + lanId: 111, + labelcol: 8, + value: "", + viewAttr: 2, + otherParams: { minRows: 3 } + } ], title: "", defaultshow: true diff --git a/pc4mobx/hrmSalary/pages/salaryItem/customSalaryItemSlide.js b/pc4mobx/hrmSalary/pages/salaryItem/customSalaryItemSlide.js index f615f0e6..dc2a1e81 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/customSalaryItemSlide.js +++ b/pc4mobx/hrmSalary/pages/salaryItem/customSalaryItemSlide.js @@ -1,6 +1,6 @@ import React from "react"; import { inject, observer } from "mobx-react"; -import { WeaFormItem, WeaHelpfulTip, WeaLocaleProvider, WeaSearchGroup, WeaSlideModal } from "ecCom"; +import { WeaFormItem, WeaHelpfulTip, WeaLocaleProvider, WeaSearchGroup, WeaSlideModal, WeaTools } from "ecCom"; import { WeaSwitch } from "comsMobx"; import { salaryItemConditions } from "./columns"; // import FormalFormModal from "./formalFormModal"; @@ -57,9 +57,19 @@ export default class CustomSalaryItemSlide extends React.Component { conditions: _.map(salaryItemConditions, c => { return { ...c, items: _.map(c.items, fields => { - return { - ...fields, label: getLabel(fields.lanId, fields.label) - }; + fields = { ...fields, label: getLabel(fields.lanId, fields.label) }; + switch (getKey(fields)) { + case "dataType": + case "valueType": + case "roundingMode": + fields = { + ...fields, options: _.map(fields.options, o => ({ ...o, showname: getLabel(o.lanId, o.showname) })) + }; + break; + default: + break; + } + return fields; }) }; }) @@ -67,7 +77,8 @@ export default class CustomSalaryItemSlide extends React.Component { props.salaryItemStore.itemsForm.initFormFields(this.state.conditions); }); }; - renderForm = (form) => { + renderForm = () => { + const { salaryItemStore: { itemsForm: form } } = this.props; const { conditions } = this.state, { isFormInit } = form, formParams = form.getFormParams(); let group = []; isFormInit && conditions.map(c => { @@ -80,7 +91,8 @@ export default class CustomSalaryItemSlide extends React.Component { { fields.tip && + style={{ marginLeft: 16 }} width={350} title={getLabel(fields.tipLanId, fields.tip)} + placement="topLeft"/> } ), hide: fields.hide @@ -102,15 +114,14 @@ export default class CustomSalaryItemSlide extends React.Component { }; render() { - const { request } = this.props; - const { valueType, dataType, formulaId } = request; - const { formalModalVisible, salaryItemName } = this.state; + const { request, onClose } = this.props; + // const { valueType, dataType, formulaId } = request; + // const { formalModalVisible, salaryItemName } = this.state; return ( -
}/> + direction="right" title={this.renderTitle()} onClose={() => onClose()} + content={
{this.renderForm()}
}/> //
// diff --git a/pc4mobx/hrmSalary/pages/salaryItem/index.less b/pc4mobx/hrmSalary/pages/salaryItem/index.less index e12fed2b..b80727e6 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/index.less +++ b/pc4mobx/hrmSalary/pages/salaryItem/index.less @@ -9,10 +9,18 @@ height: 100%; } +} + +.custom_salaryItemSlide { .wea-slide-modal-title { border-bottom: 1px solid #e5e5e5 !important; } + .wea-slide-modal-content { + height: 100%; + background: #f6f6f6; + } + .titleDialog { display: flex; justify-content: space-between; From 848282cfc895dd389c0e4d929220234324f7c218 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, 20 Aug 2024 15:35:33 +0800 Subject: [PATCH 14/18] =?UTF-8?q?feature/2.15.1.2407.01-=E8=96=AA=E8=B5=84?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E4=BB=A5=E5=8F=8A=E5=AD=97=E6=AE=B5=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E9=A1=B5=E9=9D=A2=E6=94=B9=E9=80=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/pages/salaryItem/columns.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/salaryItem/columns.js b/pc4mobx/hrmSalary/pages/salaryItem/columns.js index a478b454..5db2fdf3 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/columns.js +++ b/pc4mobx/hrmSalary/pages/salaryItem/columns.js @@ -110,7 +110,7 @@ export const salaryItemConditions = [ label: "保留小数位", lanId: 111, labelcol: 8, - value: "", + value: "2", options: [ { key: "0", selected: false, showname: "0" }, { key: "1", selected: false, showname: "1" }, @@ -135,7 +135,7 @@ export const salaryItemConditions = [ lanId: 111, labelcol: 8, value: "", - detailType: 3, + otherParams: { detailtype: 3 }, options: [ { key: "1", showname: "输入", selected: true, lanId: 111 }, { key: "2", showname: "公式", selected: false, lanId: 111 }, @@ -162,7 +162,7 @@ export const salaryItemConditions = [ lanId: 111, labelcol: 8, value: "", - viewAttr: 2 + viewAttr: 1 }, { conditionType: "INPUTNUMBER", From efa75925ad27f3e52aafad0465950b8eddb8f5af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Mon, 23 Sep 2024 16:15:22 +0800 Subject: [PATCH 15/18] =?UTF-8?q?=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/pages/salaryItem/columns.js | 6 +-- .../pages/salaryItem/customSalaryItemSlide.js | 54 +++++++++++++++---- pc4mobx/hrmSalary/pages/salaryItem/index.js | 27 +++++++--- pc4mobx/hrmSalary/pages/salaryItem/index.less | 10 ++++ .../pages/salaryItem/salaryItemsTable.js | 4 +- 5 files changed, 79 insertions(+), 22 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/salaryItem/columns.js b/pc4mobx/hrmSalary/pages/salaryItem/columns.js index 5db2fdf3..e5942fb2 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/columns.js +++ b/pc4mobx/hrmSalary/pages/salaryItem/columns.js @@ -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" }, diff --git a/pc4mobx/hrmSalary/pages/salaryItem/customSalaryItemSlide.js b/pc4mobx/hrmSalary/pages/salaryItem/customSalaryItemSlide.js index dc2a1e81..37248849 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/customSalaryItemSlide.js +++ b/pc4mobx/hrmSalary/pages/salaryItem/customSalaryItemSlide.js @@ -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: ( - + { fields.tip && { + 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" ? [ , - + ] : [ - , - + , + ]; this.setState({ - customItemDialog: { visible: true, title, buttons: (showSalaryItemBtn || showOperateBtn) ? buttons : [] } + customItemDialog: { + visible: true, title, buttons: (showSalaryItemBtn || showOperateBtn) ? buttons : [], id: targetid + } }); break; case "sysAdd": diff --git a/pc4mobx/hrmSalary/pages/salaryItem/index.less b/pc4mobx/hrmSalary/pages/salaryItem/index.less index b80727e6..9fcd0e95 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/index.less +++ b/pc4mobx/hrmSalary/pages/salaryItem/index.less @@ -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 { diff --git a/pc4mobx/hrmSalary/pages/salaryItem/salaryItemsTable.js b/pc4mobx/hrmSalary/pages/salaryItem/salaryItemsTable.js index eee77555..83445529 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/salaryItemsTable.js +++ b/pc4mobx/hrmSalary/pages/salaryItem/salaryItemsTable.js @@ -101,12 +101,12 @@ class SalaryItemsTable extends Component { }; return ( ( - onDropMenuClick("edit", record)} + onDropMenuClick("edit", record.id)} href="javascript:void(0);">{(showOperateBtn || showSalaryItemBtn) ? getLabel(111, "编辑") : getLabel(111, "查看")} { (showOperateBtn || showSalaryItemBtn) && record.canDelete && From fd067b653f9e3d2eca48a6d75053b209445e57d1 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, 24 Sep 2024 10:53:41 +0800 Subject: [PATCH 16/18] =?UTF-8?q?feature/2.15.1.2407.01-=E8=96=AA=E8=B5=84?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E4=BB=A5=E5=8F=8A=E5=AD=97=E6=AE=B5=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E9=A1=B5=E9=9D=A2=E6=94=B9=E9=80=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/pages/salaryItem/columns.js | 42 ++++- .../pages/salaryItem/customSalaryItemSlide.js | 114 +++++++----- pc4mobx/hrmSalary/pages/salaryItem/index.js | 162 ++++++------------ pc4mobx/hrmSalary/pages/salaryItem/index.less | 10 ++ .../pages/salaryItem/salaryItemsTable.js | 22 +-- 5 files changed, 179 insertions(+), 171 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/salaryItem/columns.js b/pc4mobx/hrmSalary/pages/salaryItem/columns.js index e5942fb2..4cc0d47a 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/columns.js +++ b/pc4mobx/hrmSalary/pages/salaryItem/columns.js @@ -145,13 +145,14 @@ export const salaryItemConditions = [ viewAttr: 3 }, { - conditionType: "INPUT", + conditionType: "INPUTNUMBER", domkey: ["defaultValue"], fieldcol: 14, label: "默认值", lanId: 111, labelcol: 8, value: "", + otherParams: { precision: 2 }, viewAttr: 2 }, { @@ -162,7 +163,19 @@ export const salaryItemConditions = [ lanId: 111, labelcol: 8, value: "", - viewAttr: 1 + viewAttr: 3, + hide: true + }, + { + conditionType: "INPUT", + domkey: ["formulaId"], + fieldcol: 14, + label: "公式", + lanId: 111, + labelcol: 8, + value: "", + viewAttr: 3, + hide: true }, { conditionType: "INPUTNUMBER", @@ -194,6 +207,31 @@ export const salaryItemConditions = [ value: "", viewAttr: 2, otherParams: { minRows: 3 } + }, + { + conditionType: "SWITCH", + domkey: ["useInEmployeeSalary"], + fieldcol: 14, + label: "薪资档案引用", + lanId: 111, + labelcol: 8, + value: "0", + viewAttr: 2, + tipLanId: 111, + tip: "提示:开启后,该薪资项目不可删除或设为无效,取值方式会默认置为输入", + hide: true + }, + { + + conditionType: "SWITCH", + domkey: ["systemType"], + fieldcol: 14, + label: "是否系统默认", + lanId: 111, + labelcol: 8, + value: "0", + viewAttr: 2, + hide: true } ], title: "", diff --git a/pc4mobx/hrmSalary/pages/salaryItem/customSalaryItemSlide.js b/pc4mobx/hrmSalary/pages/salaryItem/customSalaryItemSlide.js index 37248849..4021c714 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/customSalaryItemSlide.js +++ b/pc4mobx/hrmSalary/pages/salaryItem/customSalaryItemSlide.js @@ -2,12 +2,12 @@ import React from "react"; import { inject, observer } from "mobx-react"; import { WeaFormItem, WeaHelpfulTip, WeaLocaleProvider, WeaSearchGroup, WeaSlideModal, WeaTools } from "ecCom"; import { WeaSwitch } from "comsMobx"; +import FormalFormModal from "./formalFormModal"; 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"; const getLabel = WeaLocaleProvider.getLabel; @@ -19,11 +19,7 @@ export default class CustomSalaryItemSlide extends React.Component { constructor(props) { super(props); this.state = { - conditions: [], - - showForm: false, - formalModalVisible: false, - salaryItemName: "" + conditions: [], visible: false }; } @@ -37,20 +33,16 @@ export default class CustomSalaryItemSlide extends React.Component { } } - handleChange = (params) => { - this.props.onChange({ ...this.props.request, ...params }); + handleChange = (data) => { + const { salaryItemStore: { itemsForm: form } } = this.props; + form.updateFields({ formulaContent: { value: data["formula"] }, formulaId: { value: data["id"] } }); }; - - handleShowFormal = (salaryItemName) => { - this.setState({ - formalModalVisible: true, - salaryItemName - }); - }; - initForm = async (props) => { const { data: salaryItemForm } = props.id ? - await getItemForm({ id: props.id }) : { data: { sharedType: "0", useDefault: "0", hideDefault: "0" } }; + await getItemForm({ id: props.id }) : + { + data: { sharedType: "0", useDefault: "0", hideDefault: "0", pattern: 2, dataType: "number", valueType: "1" } + }; 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" }) @@ -71,16 +63,41 @@ export default class CustomSalaryItemSlide extends React.Component { break; case "taxAgentIds": fields = { - ...fields, options: _.map(taxAgentList, o => ({ key: String(o.id), showname: o.name })) + ...fields, options: _.map(taxAgentList, o => ({ key: String(o.id), showname: o.name })), + hide: String(salaryItemForm["sharedType"]) === "0" || !_.isNil(salaryItemForm["sharedType"]) }; break; case "dataType": case "valueType": - case "roundingMode": fields = { ...fields, options: _.map(fields.options, o => ({ ...o, showname: getLabel(o.lanId, o.showname) })) }; break; + case "roundingMode": + fields = { + ...fields, options: _.map(fields.options, o => ({ ...o, showname: getLabel(o.lanId, o.showname) })), + hide: String(salaryItemForm["dataType"]) === "string" + }; + break; + case "pattern": + fields = { + ...fields, hide: String(salaryItemForm["dataType"]) === "string" + }; + break; + case "defaultValue": + const otherParams = String(salaryItemForm["dataType"]) === "number" ? { precision: Number(salaryItemForm["pattern"]) } : {}; + fields = { + ...fields, otherParams, + conditionType: String(salaryItemForm["dataType"]) === "string" ? "INPUT" : "INPUTNUMBER", + hide: String(salaryItemForm["valueType"]) !== "1" + }; + break; + case "formulaContent": + fields = { + ...fields, hide: String(salaryItemForm["valueType"]) === "1", + label: String(salaryItemForm["valueType"]) === "2" ? getLabel(111, "公式") : getLabel(111, "SQL") + }; + break; default: break; } @@ -93,20 +110,38 @@ export default class CustomSalaryItemSlide extends React.Component { }); }; handleChangeFormItem = (res) => { + const { salaryItemStore: { itemsForm: form } } = this.props; 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" }; + } else if (key === "dataType" && (getKey(fields) === "roundingMode" || getKey(fields) === "pattern")) { + fields = { ...fields, hide: value === "string" }; + } else if ((key === "dataType" || key === "pattern") && getKey(fields) === "defaultValue") { + const otherParams = form.getFormParams().dataType === "number" ? { precision: Number(form.getFormParams().pattern) } : {}; fields = { - ...fields, viewAttr: value === "0" ? 2 : 3, hide: value === "0" + ...fields, otherParams, conditionType: value === "string" ? "INPUT" : "INPUTNUMBER", + hide: form.getFormParams().valueType !== "1" + }; + } else if (key === "valueType" && (getKey(fields) === "formulaContent" || getKey(fields) === "defaultValue")) { + fields = { + ...fields, + label: getKey(fields) === "defaultValue" ? fields.label : form.getFormDatas().valueType.valueSpan, + hide: (getKey(fields) === "formulaContent" && value === "1") || (getKey(fields) === "defaultValue" && value !== "1") }; } return fields; }) }; }) + }, () => { + form.getFormParams().valueType === "1" && + form.updateFields({ formulaContent: { value: "" }, formulaId: { value: "" } }); + (form.getFormParams().valueType === "2" || form.getFormParams().valueType === "3") && + form.updateFields({ defaultValue: { value: "" } }); }); }; renderForm = () => { @@ -121,6 +156,10 @@ export default class CustomSalaryItemSlide extends React.Component { + { + getKey(fields) === "formulaContent" && form.getFormParams().valueType !== "1" && +
this.setState({ visible: true })}/> + } { fields.tip && onClose()} - content={
{this.renderForm()}
}/> + content={
+ {this.renderForm()} + {visible && + this.setState({ visible: false })} + /> + } +
}/> //
// - // {formalModalVisible && - // { - // this.handleSaveFormal(data); - // }} - // onCancel={() => - // this.setState({ - // formalModalVisible: false, - // salaryItemName: "" - // })} - // />} //
); } diff --git a/pc4mobx/hrmSalary/pages/salaryItem/index.js b/pc4mobx/hrmSalary/pages/salaryItem/index.js index 3fa15372..24aaaaea 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/index.js +++ b/pc4mobx/hrmSalary/pages/salaryItem/index.js @@ -1,6 +1,6 @@ import React from "react"; import { inject, observer } from "mobx-react"; -import { Button, Dropdown, Menu, message, Modal, Switch } from "antd"; +import { Button, Dropdown, Menu, message, Modal } from "antd"; import { WeaInputSearch, WeaLocaleProvider, WeaTop } from "ecCom"; import * as API from "../../apis/item"; import SalaryItemsTable from "./salaryItemsTable"; @@ -69,9 +69,10 @@ export default class SalaryItem extends React.Component { }); }; - handleDeleteItem = () => { + handleDeleteItem = (recordId) => { const { selectedRowKeys, isQuery } = this.state; - if (_.isEmpty(selectedRowKeys)) { + const params = recordId ? [recordId] : selectedRowKeys; + if (_.isEmpty(params)) { message.warning(getLabel(111, "请勾选数据!")); return; } @@ -79,7 +80,7 @@ export default class SalaryItem extends React.Component { title: getLabel(131329, "信息确认"), content: getLabel(111, "确认删除吗?"), onOk: () => { - API.deleteItem(selectedRowKeys).then(({ status, errormsg }) => { + API.deleteItem(params).then(({ status, errormsg }) => { if (status) { message.success(getLabel(111, "操作成功!")); this.setState({ isQuery: !isQuery }); @@ -87,118 +88,56 @@ export default class SalaryItem extends React.Component { message.error(errormsg); } }); - }, - onCancel: () => { } }); }; - getColumns = () => { - const { salaryItemStore, taxAgentStore: { showSalaryItemBtn, showOperateBtn } } = this.props; - const { tableColumns } = salaryItemStore; - let columns = tableColumns.map(column => { - let newColumn = column; - newColumn.render = (text, record, index) => { //前端元素转义 - let valueSpan = record[newColumn.dataIndex + "span"] !== undefined ? record[newColumn.dataIndex + "span"] : record[newColumn.dataIndex]; - switch (newColumn.dataIndex) { - case "name": - return { - this.onEditItem(record, false); - }}>{text}; - case "useDefault": - case "hideDefault": - case "useInEmployeeSalary": - return ; - default: - return
; - } - }; - return newColumn; + handleValidateForm = () => { + return new Promise((resolve) => { + const { salaryItemStore: { itemsForm: form } } = this.props; + const { formulaId, valueType, sharedType, taxAgentIds } = form.getFormParams(); + let taxAgentValidate = true, formulaValidate = true; + if (sharedType === "1" && !taxAgentIds) taxAgentValidate = false; + if (valueType !== "1" && !formulaId) formulaValidate = false; + resolve({ taxAgentValidate, formulaValidate }); }); - columns.push({ - key: "operate", - title: "操作", - width: 185, - render: (text, record) => { - return ( - - this.onEditItem(record, true)}>{(showSalaryItemBtn || showOperateBtn) ? "编辑" : "查看"} - { - (record.canDelete && (showSalaryItemBtn || showOperateBtn)) && - this.handleDeleteItem(record)} - >{getLabel(535052, "删除")} - } - - - this.onDropMenuClick("log", record.id)}>{getLabel(545781, "操作日志")} - -
- }> - - -
- ); - } - }); - return [ - // { - // title: "序号", - // dataIndex: "index", - // align: "left", - // width: 60, - // render: (text, record, index) => { - // const { current, pageSize } = this.state.searchParams; - // return (current - 1) * pageSize + index + 1; - // } - // }, - ...columns]; }; - - handleSearch(value) { - const { salaryItemStore: { getTableDatas } } = this.props; - getTableDatas({ ...this.state.searchParams, current: 1, name: value }).then(res => { - this.setState({ - searchParams: { - ...this.state.searchParams, - current: 1, - total: res.total - } - }); - }); - } - - handlePageChange(value) { - const { salaryItemStore: { getTableDatas } } = this.props; - getTableDatas({ ...this.state.searchParams, name: this.state.searchValue, current: value }).then(res => { - this.setState({ - searchParams: { - ...this.state.searchParams, - current: value, - total: res.total - } - }); - }); - } - - handleShowSizeChange(searchParams) { - const { salaryItemStore: { getTableDatas } } = this.props; - getTableDatas({ ...searchParams }); - } - handleSalaryItem = (type) => { + const { customItemDialog: { id }, isQuery } = this.state; const { salaryItemStore: { itemsForm: form } } = this.props; - form.validateForm().then(f => { - if (f.isValid) { - console.log(form.getFormParams()); - } else { - f.showErrors(); - } - }); + Promise.all([form.validateForm(), this.handleValidateForm()]) + .then(([f1, f2]) => { + if (f1.isValid && f2.taxAgentValidate && f2.formulaValidate) { + const { formulaContent, valueType, dataType, defaultValue, pattern, ...formData } = form.getFormParams(); + const key = valueType === "2" ? "originFormulaContent" : valueType === "3" ? "originSqlContent" : "formulaContent"; + this.setState({ loading: true }); + API.saveItem({ + ...formData, valueType, dataType, pattern, [key]: formulaContent, id, + defaultValue: dataType === "number" ? toDecimal_n(defaultValue, parseInt(pattern)) : defaultValue + }).then(({ status, errormsg }) => { + this.setState({ loading: false }); + if (status) { + this.setState({ isQuery: !isQuery }, () => { + message.success(getLabel(111, "操作成功")); + type === "SAVECREATE" && form.updateFields({ + name: { value: "" }, formulaContent: { value: "" }, formulaId: { value: "" } + }); + type !== "SAVECREATE" && this.setState({ + customItemDialog: { ...this.state.customItemDialog, visible: false, id: "" } + }); + }); + + } else { + message.error(errormsg); + } + }); + } else { + !f1.isValid && f1.showErrors(); + !f2.taxAgentValidate && f1.showError("taxAgentIds", getLabel(111, "\"可见性范围\"未填写")); + !f2.formulaValidate && f1.showError("formulaId", getLabel(111, `\"${form.getFormDatas().valueType.valueSpan}\"未填写`)); + this.forceUpdate(); + } + }); }; onDropMenuClick = (key, targetid = "") => { switch (key) { @@ -229,6 +168,9 @@ export default class SalaryItem extends React.Component { } }); break; + case "delete": + this.handleDeleteItem(targetid); + break; case "sysAdd": break; default: @@ -274,7 +216,7 @@ export default class SalaryItem extends React.Component { let buttons = [ this.onDropMenuClick("customAdd")}>{getLabel(111, "新增自定义薪资项")}, - , + , this.setState({ name: val })} placeholder={getLabel(111, "请输入名称")} onSearch={() => this.setState({ isQuery: !isQuery })}/> ]; @@ -390,7 +332,7 @@ export default class SalaryItem extends React.Component { {/*新增编辑自定义薪资项目*/} this.setState({ isQuery: !isQuery })} onClose={callback => this.setState({ - customItemDialog: { ...customItemDialog, visible: false } + customItemDialog: { ...customItemDialog, visible: false, id: "" } }, () => callback && callback())}/> {/*{*/} {/* editSlideVisible &&*/} diff --git a/pc4mobx/hrmSalary/pages/salaryItem/index.less b/pc4mobx/hrmSalary/pages/salaryItem/index.less index 9fcd0e95..40b4e186 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/index.less +++ b/pc4mobx/hrmSalary/pages/salaryItem/index.less @@ -28,6 +28,16 @@ .wea-form-item-wrapper { display: block !important; + + .formula_input_div { + cursor: pointer; + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + z-index: 2; + } } } diff --git a/pc4mobx/hrmSalary/pages/salaryItem/salaryItemsTable.js b/pc4mobx/hrmSalary/pages/salaryItem/salaryItemsTable.js index 83445529..7d1525be 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/salaryItemsTable.js +++ b/pc4mobx/hrmSalary/pages/salaryItem/salaryItemsTable.js @@ -9,7 +9,7 @@ */ import React, { Component } from "react"; import { WeaCheckbox, WeaLocaleProvider, WeaTable } from "ecCom"; -import { Dropdown, Menu, message, Modal } from "antd"; +import { Dropdown, Menu } from "antd"; import * as API from "../../apis/item"; const getLabel = WeaLocaleProvider.getLabel; @@ -54,24 +54,6 @@ class SalaryItemsTable extends Component { } }); }; - handleDeleteItem = (record) => { - Modal.confirm({ - title: getLabel(131329, "信息确认"), - content: getLabel(111, "确认删除吗?"), - onOk: () => { - API.deleteItem(selectedRowKeys).then(({ status, errormsg }) => { - if (status) { - message.success(getLabel(111, "操作成功!")); - this.getItemList(this.props); - } else { - message.error(errormsg); - } - }); - }, - onCancel: () => { - } - }); - }; render() { const { dataSource, columns, pageInfo, loading } = this.state; @@ -111,7 +93,7 @@ class SalaryItemsTable extends Component { { (showOperateBtn || showSalaryItemBtn) && record.canDelete && this.handleDeleteItem(record)}>{getLabel(111, "删除")} + onClick={() => onDropMenuClick("delete", record.id)}>{getLabel(111, "删除")} } From a4fffbcbd44e863bf2ed141ec4fb99aa7f670015 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, 25 Sep 2024 14:11:46 +0800 Subject: [PATCH 17/18] release/2.15.2.2409.01 --- .../pages/salaryItem/customSalaryItemSlide.js | 13 +- pc4mobx/hrmSalary/pages/salaryItem/index.js | 201 ++---------------- pc4mobx/hrmSalary/pages/salaryItem/index.less | 4 +- .../pages/salaryItem/salaryItemsTable.js | 7 +- 4 files changed, 29 insertions(+), 196 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/salaryItem/customSalaryItemSlide.js b/pc4mobx/hrmSalary/pages/salaryItem/customSalaryItemSlide.js index 4021c714..28e46ef5 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/customSalaryItemSlide.js +++ b/pc4mobx/hrmSalary/pages/salaryItem/customSalaryItemSlide.js @@ -8,8 +8,6 @@ import { commonEnumList } from "../../apis/archive"; import { postFetch } from "../../util/request"; import { getItemForm } from "../../apis/item"; -// import SalaryItemForm from "./salaryItemForm"; - const getLabel = WeaLocaleProvider.getLabel; const getKey = WeaTools.getKey; @@ -52,7 +50,8 @@ export default class CustomSalaryItemSlide extends React.Component { return { ...c, items: _.map(c.items, fields => { fields = { - ...fields, label: getLabel(fields.lanId, fields.label), + ...fields, viewAttr: props.showOperateBtn ? fields.viewAttr : 1, + label: getLabel(fields.lanId, fields.label), value: !_.isNil(salaryItemForm[getKey(fields)]) ? String(salaryItemForm[getKey(fields)]) : fields.value }; switch (getKey(fields)) { @@ -158,6 +157,7 @@ export default class CustomSalaryItemSlide extends React.Component { { getKey(fields) === "formulaContent" && form.getFormParams().valueType !== "1" && + this.props.showOperateBtn &&
this.setState({ visible: true })}/> } { @@ -186,8 +186,7 @@ export default class CustomSalaryItemSlide extends React.Component { render() { const { onClose, salaryItemStore: { itemsForm: form } } = this.props; - // const { valueType, dataType, formulaId } = request; - const { visible, salaryItemName } = this.state; + const { visible } = this.state; return ( }
}/> - - //
- // - //
); } } diff --git a/pc4mobx/hrmSalary/pages/salaryItem/index.js b/pc4mobx/hrmSalary/pages/salaryItem/index.js index 24aaaaea..7cd6da90 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/index.js +++ b/pc4mobx/hrmSalary/pages/salaryItem/index.js @@ -8,7 +8,6 @@ import { toDecimal_n } from "../../util"; import SystemSalaryItemModal from "./systemSalaryItemModal"; import CustomSalaryItemSlide from "./customSalaryItemSlide"; import SyncToSalaryAccountSetDialog from "./syncToSalaryAccountSetDialog"; -import "../socialSecurityBenefits/programme/index.less"; import LogDialog from "../../components/logViewModal"; import "./index.less"; @@ -21,54 +20,11 @@ export default class SalaryItem extends React.Component { this.state = { name: "", isQuery: false, loading: false, customItemDialog: { visible: false, title: "", buttons: [] },// 自定义薪资项弹窗 - - - value: "", - selectedKey: "0", - editable: false, - isAdd: false, - searchValue: "", - formalModalVisible: false, - searchParams: { current: 1, pageSize: 10, total: 0 }, - selectedRowKeys: [], - syncSalarySetDialog: { visible: false, title: "", id: "" }, + syncSalarySetDialog: { visible: false, title: "", id: "" }, // 同步到薪资账套弹窗 logDialogVisible: false, filterConditions: "[]" }; - this.record = {}; } - - componentWillMount() { // 初始化渲染页面 - // const { salaryItemStore: { getTableDatas }, salaryFileStore, taxAgentStore } = this.props; - // const { commonEnumList } = salaryFileStore; - // const { fetchTaxAgentOption } = taxAgentStore; - // fetchTaxAgentOption(); - // commonEnumList("user", { enumClass: "com.engine.salary.enums.sicategory.SharedTypeEnum" }); - // getTableDatas({}).then(res => { - // this.setState({ - // searchParams: { - // ...this.state.searchParams, - // current: res.pageNum, - // total: res.total - // } - // }); - // }); - } - - onEditItem = (record, isedit) => { - this.record = record; - const { salaryItemStore: { getItemForm, setEditSlideVisible } } = this.props; - this.setState({ - editable: isedit, isAdd: false, - syncSalarySetDialog: { ...this.state.syncSalarySetDialog, id: record.id } - }); - getItemForm(record.id).then(() => { - setEditSlideVisible(true); - }).catch(({ errormsg }) => { - message.error(errormsg || ""); - }); - }; - handleDeleteItem = (recordId) => { const { selectedRowKeys, isQuery } = this.state; const params = recordId ? [recordId] : selectedRowKeys; @@ -91,7 +47,6 @@ export default class SalaryItem extends React.Component { } }); }; - handleValidateForm = () => { return new Promise((resolve) => { const { salaryItemStore: { itemsForm: form } } = this.props; @@ -134,7 +89,7 @@ export default class SalaryItem extends React.Component { } else { !f1.isValid && f1.showErrors(); !f2.taxAgentValidate && f1.showError("taxAgentIds", getLabel(111, "\"可见性范围\"未填写")); - !f2.formulaValidate && f1.showError("formulaId", getLabel(111, `\"${form.getFormDatas().valueType.valueSpan}\"未填写`)); + !f2.formulaValidate && f1.showError("formulaContent", getLabel(111, `\"${form.getFormDatas().valueType.valueSpan}\"未填写`)); this.forceUpdate(); } }); @@ -153,7 +108,11 @@ export default class SalaryItem extends React.Component { const { loading } = this.state; const title = key === "edit" ? getLabel(111, "修改自定义薪资项目") : getLabel(111, "新建自定义薪资项目"); const buttons = key === "edit" ? [ - , + , ] : [ @@ -179,34 +138,10 @@ export default class SalaryItem extends React.Component { }; render() { - const { - salaryItemStore, - salaryFileStore, - taxAgentStore: { showOperateBtn, showSalaryItemBtn, taxAgentOption } - } = this.props; - const { userStatusList } = salaryFileStore; + const { salaryItemStore, taxAgentStore: { showOperateBtn, showSalaryItemBtn } } = this.props; const { selectedRowKeys, logDialogVisible, filterConditions, name, isQuery, customItemDialog } = this.state; const { loading, deleteItemRequest, getTableDatas } = salaryItemStore; - const { - tableDataSource, - tableColumns, - systemItemVisible, - setSystemItemVisible, - editSlideVisible, - setEditSlideVisible, - request - } = salaryItemStore; - - const handleMenuClick = (e) => { - const { salaryItemStore: { setEditSlideVisible, initRequest } } = this.props; - if (e.key === "1") { - this.setState({ editable: true, isAdd: true }); - initRequest(); - setEditSlideVisible(true); - } else if (e.key === "2") { - setSystemItemVisible(true); - } - }; + const { systemItemVisible, setSystemItemVisible } = salaryItemStore; const menu = ( @@ -223,69 +158,6 @@ export default class SalaryItem extends React.Component { const dropMenuDatas = [ { key: "log", icon: , content: getLabel(545781, "操作日志") } ]; - // 新建和修改保存的回调 - const handleSlideSave = (continueFlag) => { - const { salaryItemStore: { saveItem, request, getTableDatas } } = this.props; - const payload = _.cloneDeep(request); - const { name, sharedType, taxAgentIds } = request; - if (!name || (sharedType === "1" && !taxAgentIds)) { - Modal.warning({ - title: "信息确认", - content: "必要信息不完整,红色*为必填项!" - }); - return; - } - const { pattern, defaultValue, dataType, ...extra } = payload; - saveItem({ - ...extra, pattern, dataType, - defaultValue: dataType === "number" ? toDecimal_n(defaultValue, parseInt(pattern)) : defaultValue - }, continueFlag) - .then(() => { - getTableDatas({ ...this.state.searchParams }).then(res => { - this.setState({ - searchParams: { - ...this.state.searchParams, - total: res.total - } - }); - }); - }); - }; - - const renderCustomOperate = () => { - let arrList = []; - if (this.state.isAdd) { - arrList = [ - , - - ]; - } else if (this.state.editable) { - arrList = [ - , - - ]; - } - return arrList; - }; - - const handleSaveSlideChange = (value) => { - const { salaryItemStore: { setRequest } } = this.props; - setRequest(value); - }; !(showOperateBtn || showSalaryItemBtn) && (buttons = buttons.slice(-1)); return ( @@ -298,18 +170,6 @@ export default class SalaryItem extends React.Component { onChange={val => this.setState({ selectedRowKeys: val })}/>
- this.setState({ - syncSalarySetDialog: { - ...this.state.syncSalarySetDialog, - visible: false, title: "" - } - })} - /> - {/*操作日志*/} - this.setState({ logDialogVisible: false })}/> { systemItemVisible && } + {/*同步薪资账套*/} + this.setState({ + syncSalarySetDialog: { ...this.state.syncSalarySetDialog, visible: false, title: "" } + })}/> + {/*操作日志*/} + this.setState({ logDialogVisible: false })}/> {/*新增编辑自定义薪资项目*/} this.setState({ isQuery: !isQuery })} + showOperateBtn={showOperateBtn || showSalaryItemBtn} onClose={callback => this.setState({ customItemDialog: { ...customItemDialog, visible: false, id: "" } }, () => callback && callback())}/> - {/*{*/} - {/* editSlideVisible &&*/} - {/* */} - {/* }*/} - {/* content={*/} - {/* {*/} - {/* handleSaveSlideChange(value);*/} - {/* }}/>*/} - {/* }*/} - {/* onClose={() => setEditSlideVisible(false)}*/} - {/* />*/} - {/*}*/} ); } diff --git a/pc4mobx/hrmSalary/pages/salaryItem/index.less b/pc4mobx/hrmSalary/pages/salaryItem/index.less index 40b4e186..496d01fd 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/index.less +++ b/pc4mobx/hrmSalary/pages/salaryItem/index.less @@ -10,7 +10,7 @@ padding: 8px 16px; background: #f6f6f6; - & > .wea-new-table { + .wea-new-table { background: #FFFFFF; } } @@ -27,7 +27,7 @@ background: #f6f6f6; .wea-form-item-wrapper { - display: block !important; + //display: block !important; .formula_input_div { cursor: pointer; diff --git a/pc4mobx/hrmSalary/pages/salaryItem/salaryItemsTable.js b/pc4mobx/hrmSalary/pages/salaryItem/salaryItemsTable.js index 7d1525be..2b5a5d79 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/salaryItemsTable.js +++ b/pc4mobx/hrmSalary/pages/salaryItem/salaryItemsTable.js @@ -9,7 +9,7 @@ */ import React, { Component } from "react"; import { WeaCheckbox, WeaLocaleProvider, WeaTable } from "ecCom"; -import { Dropdown, Menu } from "antd"; +import { Dropdown, Menu, Spin } from "antd"; import * as API from "../../apis/item"; const getLabel = WeaLocaleProvider.getLabel; @@ -81,7 +81,7 @@ class SalaryItemsTable extends Component { disabled: !record.canDelete }) }; - return ( + return ( ) } - ]}/>); + ]}/> + ); } } From 5ec07d20e0c275487e1860e7ee45c91ffa1569b2 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, 25 Sep 2024 15:37:02 +0800 Subject: [PATCH 18/18] =?UTF-8?q?feature/2.15.1.2407.01-=E8=96=AA=E8=B5=84?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E4=BB=A5=E5=8F=8A=E5=AD=97=E6=AE=B5=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E9=A1=B5=E9=9D=A2=E6=94=B9=E9=80=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/pages/salaryItem/index.js | 41 +++----- pc4mobx/hrmSalary/pages/salaryItem/index.less | 24 ++--- .../syncToSalaryAccountSetDialog.js | 3 +- .../pages/salaryItem/systemSalaryItemModal.js | 94 +++++++------------ 4 files changed, 59 insertions(+), 103 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/salaryItem/index.js b/pc4mobx/hrmSalary/pages/salaryItem/index.js index 7cd6da90..6e8073d4 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/index.js +++ b/pc4mobx/hrmSalary/pages/salaryItem/index.js @@ -18,9 +18,9 @@ export default class SalaryItem extends React.Component { constructor(props) { super(props); this.state = { - name: "", isQuery: false, loading: false, + name: "", isQuery: false, loading: false, sysVisible: false, customItemDialog: { visible: false, title: "", buttons: [] },// 自定义薪资项弹窗 - syncSalarySetDialog: { visible: false, title: "", id: "" }, // 同步到薪资账套弹窗 + syncSalarySetDialog: { visible: false, id: "" }, // 同步到薪资账套弹窗 logDialogVisible: false, filterConditions: "[]" }; } @@ -109,9 +109,7 @@ export default class SalaryItem extends React.Component { const title = key === "edit" ? getLabel(111, "修改自定义薪资项目") : getLabel(111, "新建自定义薪资项目"); const buttons = key === "edit" ? [ , @@ -131,6 +129,7 @@ export default class SalaryItem extends React.Component { this.handleDeleteItem(targetid); break; case "sysAdd": + this.setState({ sysVisible: true }); break; default: break; @@ -139,12 +138,14 @@ export default class SalaryItem extends React.Component { render() { const { salaryItemStore, taxAgentStore: { showOperateBtn, showSalaryItemBtn } } = this.props; - const { selectedRowKeys, logDialogVisible, filterConditions, name, isQuery, customItemDialog } = this.state; + const { + selectedRowKeys, logDialogVisible, filterConditions, name, isQuery, customItemDialog, sysVisible + } = this.state; const { loading, deleteItemRequest, getTableDatas } = salaryItemStore; const { systemItemVisible, setSystemItemVisible } = salaryItemStore; const menu = ( - + this.onDropMenuClick(key)}> {getLabel(111, "新增系统薪资项")} ); @@ -170,31 +171,13 @@ export default class SalaryItem extends React.Component { onChange={val => this.setState({ selectedRowKeys: val })}/>
- { - systemItemVisible && - { - setSystemItemVisible(false); - }} - onInitTableList={() => { - getTableDatas({ ...this.state.searchParams, name: this.state.searchValue }).then(res => { - this.setState({ - searchParams: { - ...this.state.searchParams, - total: res.total - } - }); - }); - }} - /> - } + {/*添加系统薪资项目*/} + this.setState({ isQuery: !isQuery })} + onCancel={(callback) => this.setState({ sysVisible: false }, () => callback && callback())}/> {/*同步薪资账套*/} this.setState({ - syncSalarySetDialog: { ...this.state.syncSalarySetDialog, visible: false, title: "" } - })}/> + onCancel={() => this.setState({ syncSalarySetDialog: { visible: false, id: "" } })}/> {/*操作日志*/} this.setState({ logDialogVisible: false })}/> diff --git a/pc4mobx/hrmSalary/pages/salaryItem/index.less b/pc4mobx/hrmSalary/pages/salaryItem/index.less index 496d01fd..cf539484 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/index.less +++ b/pc4mobx/hrmSalary/pages/salaryItem/index.less @@ -150,20 +150,20 @@ //系统薪资项添加modal .sys-salary-wrapper { - .wea-dialog-body { - height: 50vh; - overflow: hidden auto; + .sys-item-title { + display: flex; + align-items: center; + justify-content: space-between; + } - .headerSearchWrapper { - display: flex; - justify-content: flex-end; - align-items: center; - padding: 16px 20px; + .sys-item-table-box { + width: 100%; + height: 100%; + background: #F6F6F6; + padding: 8px 16px; - .wea-tab { - width: 100%; - border-bottom: none; - } + .wea-new-table { + background: #FFFFFF; } } } diff --git a/pc4mobx/hrmSalary/pages/salaryItem/syncToSalaryAccountSetDialog.js b/pc4mobx/hrmSalary/pages/salaryItem/syncToSalaryAccountSetDialog.js index 797a6466..f97ef453 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/syncToSalaryAccountSetDialog.js +++ b/pc4mobx/hrmSalary/pages/salaryItem/syncToSalaryAccountSetDialog.js @@ -51,7 +51,6 @@ class SyncToSalaryAccountSetDialog extends Component { } }); }; - save = () => { const { salaryItemStore: { salarySetform }, id: salaryItemId } = this.props; salarySetform.validateForm().then(f => { @@ -80,7 +79,7 @@ class SyncToSalaryAccountSetDialog extends Component { return ( {getLabel(537558, "确定")}]} > diff --git a/pc4mobx/hrmSalary/pages/salaryItem/systemSalaryItemModal.js b/pc4mobx/hrmSalary/pages/salaryItem/systemSalaryItemModal.js index 2e7d169f..b1c3a1f8 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/systemSalaryItemModal.js +++ b/pc4mobx/hrmSalary/pages/salaryItem/systemSalaryItemModal.js @@ -1,8 +1,7 @@ import React from "react"; -import { WeaDialog, WeaLocaleProvider, WeaTab } from "ecCom"; -import { Button, message } from "antd"; +import { WeaDialog, WeaInputSearch, WeaLocaleProvider, WeaTable } from "ecCom"; +import { Button, message, Spin } from "antd"; import { getSysItemList, saveSysItem } from "../../apis/item"; -import UnifiedTable from "../../components/UnifiedTable"; import "./index.less"; const { getLabel } = WeaLocaleProvider; @@ -10,20 +9,16 @@ export default class SystemSalaryItemModal extends React.Component { constructor(props) { super(props); this.state = { - dataSource: [], - columns: [], - name: "", - loading: false, - saveLoading: false, - selectedRowKeys: [], - pageInfo: { - current: 1, pageSize: 10, total: 0 - } + dataSource: [], columns: [], name: "", loading: false, saveLoading: false, + selectedRowKeys: [], pageInfo: { current: 1, pageSize: 10, total: 0 } }; } - componentDidMount() { - this.getSysItemList(); + componentWillReceiveProps(nextProps, nextContext) { + if (nextProps.visible !== this.props.visible && nextProps.visible) this.getSysItemList(); + if (nextProps.visible !== this.props.visible && !nextProps.visible) this.setState({ + selectedRowKeys: [], name: "" + }); } getSysItemList = () => { @@ -33,41 +28,33 @@ export default class SystemSalaryItemModal extends React.Component { this.setState({ loading: false }); if (status) { const { columns, list: dataSource, pageNum: current, pageSize, total } = data; - this.setState({ - columns: _.map(columns, item => { - return { - ...item, - render: (text) => { - return {text}; - } - }; - }), - dataSource, - pageInfo: { ...pageInfo, current, pageSize, total } - }); + this.setState({ columns, dataSource, pageInfo: { ...pageInfo, current, pageSize, total } }); } }).catch(() => this.setState({ loading: false })); }; handleAdd = () => { const { selectedRowKeys } = this.state; - if (_.isEmpty(selectedRowKeys)) { - message.info(getLabel(111, "未选择任何条目")); - return; - } this.setState({ saveLoading: true }); saveSysItem(selectedRowKeys).then(({ status, errormsg }) => { this.setState({ saveLoading: false }); if (status) { message.success(getLabel(111, "添加成功")); - this.setState({ selectedRowKeys: [] }, () => { - this.props.onInitTableList(); - this.props.onCancel(); - }); + this.setState({ selectedRowKeys: [] }, () => this.props.onCancel(this.props.onSearch())); } else { message.error(errormsg); } }).catch(() => this.setState({ saveLoading: false })); }; + renderTitle = () => { + const { name, pageInfo } = this.state; + return
+ {getLabel(111, "添加系统薪资项目")} + this.setState({ name: val })} style={{ width: 200 }} + placeholder={getLabel(111, "请输入薪资项目名称")} a onSearch={() => this.setState({ + pageInfo: { ...pageInfo, current: 1 } + }, () => this.getSysItemList())}/> +
; + }; render() { const { selectedRowKeys, pageInfo, loading, columns, dataSource, saveLoading } = this.state; @@ -95,33 +82,20 @@ export default class SystemSalaryItemModal extends React.Component { onChange: (selectedRowKeys) => this.setState({ selectedRowKeys }) }; return ( - { - this.setState({ selectedRowKeys: [] }, () => { - this.props.onCancel(); - }); - }} style={{ width: "60vw" }} scalable - buttons={[ - - ]} - > -
- this.setState({ name })} - onSearch={this.getSysItemList} - /> + this.sysItemRef = dom} + style={{ + width: "60vw", height: 600, minHeight: 200, minWidth: 380, + maxHeight: "90%", maxWidth: "90%", overflow: "hidden", transform: "translate(0px, 0px)" + }} title={this.renderTitle()} + buttons={[]}> +
+ + +
-
); }