From 42bc94e720e8d4a87542484bc9d86b1ec3e4b354 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, 5 Aug 2024 15:06:07 +0800 Subject: [PATCH 01/78] =?UTF-8?q?feature/2.15.1.2407.01-=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../taxAgent/components/roleSetting/index.js | 33 +++++++++++++++++++ pc4mobx/hrmSalary/pages/taxAgent/index.js | 6 ++++ 2 files changed, 39 insertions(+) create mode 100644 pc4mobx/hrmSalary/pages/taxAgent/components/roleSetting/index.js diff --git a/pc4mobx/hrmSalary/pages/taxAgent/components/roleSetting/index.js b/pc4mobx/hrmSalary/pages/taxAgent/components/roleSetting/index.js new file mode 100644 index 00000000..4dad8b6b --- /dev/null +++ b/pc4mobx/hrmSalary/pages/taxAgent/components/roleSetting/index.js @@ -0,0 +1,33 @@ +/* + * 个税扣缴义务人-角色设置 + * + * @Author: 黎永顺 + * @Date: 2024/8/5 + * @Wechat: + * @Email: 971387674@qq.com + * @description: +*/ +import React, { Component } from "react"; +import { WeaBrowser, WeaLocaleProvider } from "ecCom"; + +const getLabel = WeaLocaleProvider.getLabel; + +class Index extends Component { + componentDidMount() { + console.log(this.props); + } + + render() { + + return ( + console.log("自定义btn 点击的回调", values)} + inputStyle={{ width: "100%" }} + onChange={(ids, names, datas) => + console.log("单人力", ids, names, datas) + }/> + ); + } +} + +export default Index; diff --git a/pc4mobx/hrmSalary/pages/taxAgent/index.js b/pc4mobx/hrmSalary/pages/taxAgent/index.js index 39ceeec2..82120cc3 100644 --- a/pc4mobx/hrmSalary/pages/taxAgent/index.js +++ b/pc4mobx/hrmSalary/pages/taxAgent/index.js @@ -7,6 +7,7 @@ import EditModal from "./editModal"; import TipLabel from "../../components/TipLabel"; import { decentralizationConditions, editConditions } from "./editConditions"; import LogDialog from "../../components/logViewModal"; +import RoleSetting from "./components/roleSetting"; import "./index.less"; const getLabel = WeaLocaleProvider.getLabel; @@ -411,6 +412,11 @@ export default class TaxAgent extends React.Component { ); } }; + }else if(item.dataIndex === "role"){ + return { + ...item, + render: (text, record) => () + } } else { return { ...item }; } From b0ac071035d123afee2f251dd249d22a2c11f41f 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, 5 Aug 2024 15:32:23 +0800 Subject: [PATCH 02/78] =?UTF-8?q?feature/2.15.1.2407.01-=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/taxAgent/components/roleSetting/index.js | 5 +++-- .../taxAgent/components/roleSetting/index.less | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 pc4mobx/hrmSalary/pages/taxAgent/components/roleSetting/index.less diff --git a/pc4mobx/hrmSalary/pages/taxAgent/components/roleSetting/index.js b/pc4mobx/hrmSalary/pages/taxAgent/components/roleSetting/index.js index 4dad8b6b..a2ce33b7 100644 --- a/pc4mobx/hrmSalary/pages/taxAgent/components/roleSetting/index.js +++ b/pc4mobx/hrmSalary/pages/taxAgent/components/roleSetting/index.js @@ -9,6 +9,7 @@ */ import React, { Component } from "react"; import { WeaBrowser, WeaLocaleProvider } from "ecCom"; +import "./index.less"; const getLabel = WeaLocaleProvider.getLabel; @@ -20,9 +21,9 @@ class Index extends Component { render() { return ( - console.log("自定义btn 点击的回调", values)} - inputStyle={{ width: "100%" }} + replaceDatas={[{ id: 1, name: 操作者 }]} onChange={(ids, names, datas) => console.log("单人力", ids, names, datas) }/> diff --git a/pc4mobx/hrmSalary/pages/taxAgent/components/roleSetting/index.less b/pc4mobx/hrmSalary/pages/taxAgent/components/roleSetting/index.less new file mode 100644 index 00000000..30d13b6e --- /dev/null +++ b/pc4mobx/hrmSalary/pages/taxAgent/components/roleSetting/index.less @@ -0,0 +1,14 @@ +.tax_role_setting_browser .wea-field-readonly { + width: 100%; + display: inline-block !important; + + .wea-field-readonly.border { + cursor: default !important; + } + + .only-operate { + white-space: normal !important; + display: inline !important; + color: #2db7f5; + } +} From 531e975820632a7f198988ccdb74269464381e0a 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, 5 Aug 2024 16:16:21 +0800 Subject: [PATCH 03/78] =?UTF-8?q?feature/2.15.1.2407.01-=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/addRoleDialog/index.js | 58 +++++++++++++++++++ .../pages/taxAgent/components/conditions.js | 29 ++++++++++ .../components/{roleSetting => }/index.less | 2 +- .../taxAgent/components/roleSetting/index.js | 31 +++++++--- pc4mobx/hrmSalary/stores/taxAgent.js | 5 ++ 5 files changed, 116 insertions(+), 9 deletions(-) create mode 100644 pc4mobx/hrmSalary/pages/taxAgent/components/addRoleDialog/index.js create mode 100644 pc4mobx/hrmSalary/pages/taxAgent/components/conditions.js rename pc4mobx/hrmSalary/pages/taxAgent/components/{roleSetting => }/index.less (82%) diff --git a/pc4mobx/hrmSalary/pages/taxAgent/components/addRoleDialog/index.js b/pc4mobx/hrmSalary/pages/taxAgent/components/addRoleDialog/index.js new file mode 100644 index 00000000..3bee7608 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/taxAgent/components/addRoleDialog/index.js @@ -0,0 +1,58 @@ +/* + * 角色新增 + * + * @Author: 黎永顺 + * @Date: 2024/8/5 + * @Wechat: + * @Email: 971387674@qq.com + * @description: +*/ +import React, { Component } from "react"; +import { inject, observer } from "mobx-react"; +import { WeaDialog, WeaLocaleProvider } from "ecCom"; +import { getSearchs } from "../../../../util"; +import { roleConditions } from "../conditions"; +import { Button } from "antd"; +import "../index.less"; + +const getLabel = WeaLocaleProvider.getLabel; + +@inject("taxAgentStore") +@observer +class Index extends Component { + constructor(props) { + super(props); + this.state = { + conditions: [], loading: false + }; + } + + componentWillReceiveProps(nextProps, nextContext) { + if (nextProps.visible !== this.props.visible && nextProps.visible) { + this.setState({ + conditions: _.map(roleConditions, item => ({ + ...item, items: _.map(item.items, o => ({ ...o, label: getLabel(o.lanId, o.label) })) + })) + }, () => this.props.taxAgentStore.roleForm(this.state.conditions)); + } + if (nextProps.visible !== this.props.visible && !nextProps.visible) this.props.taxAgentStore.initRoleForm(); + } + + render() { + const { conditions } = this.state; + const { taxAgentStore: { roleForm } } = this.props; + return ( + {getLabel(111, "保存")}, + + ]} + > +
{getSearchs(roleForm, conditions, 1, false)}
+
+ ); + } +} + +export default Index; diff --git a/pc4mobx/hrmSalary/pages/taxAgent/components/conditions.js b/pc4mobx/hrmSalary/pages/taxAgent/components/conditions.js new file mode 100644 index 00000000..cfad3e1d --- /dev/null +++ b/pc4mobx/hrmSalary/pages/taxAgent/components/conditions.js @@ -0,0 +1,29 @@ +export const roleConditions = [ + { + items: [ + { + conditionType: "INPUT", + domkey: ["name"], + fieldcol: 14, + label: "名称", + lanId: 111, + labelcol: 6, + value: "", + rules: "required|string", + viewAttr: 3 + }, + { + conditionType: "TEXTAREA", + domkey: ["description"], + fieldcol: 14, + label: "描述", + lanId: 111, + labelcol: 6, + value: "", + viewAttr: 2 + } + ], + defaultshow: true, + title: "" + } +]; diff --git a/pc4mobx/hrmSalary/pages/taxAgent/components/roleSetting/index.less b/pc4mobx/hrmSalary/pages/taxAgent/components/index.less similarity index 82% rename from pc4mobx/hrmSalary/pages/taxAgent/components/roleSetting/index.less rename to pc4mobx/hrmSalary/pages/taxAgent/components/index.less index 30d13b6e..7d064e3e 100644 --- a/pc4mobx/hrmSalary/pages/taxAgent/components/roleSetting/index.less +++ b/pc4mobx/hrmSalary/pages/taxAgent/components/index.less @@ -1,4 +1,4 @@ -.tax_role_setting_browser .wea-field-readonly { +.tax_role_setting_browser { width: 100%; display: inline-block !important; diff --git a/pc4mobx/hrmSalary/pages/taxAgent/components/roleSetting/index.js b/pc4mobx/hrmSalary/pages/taxAgent/components/roleSetting/index.js index a2ce33b7..df837e76 100644 --- a/pc4mobx/hrmSalary/pages/taxAgent/components/roleSetting/index.js +++ b/pc4mobx/hrmSalary/pages/taxAgent/components/roleSetting/index.js @@ -9,24 +9,39 @@ */ import React, { Component } from "react"; import { WeaBrowser, WeaLocaleProvider } from "ecCom"; -import "./index.less"; +import AddRoleDialog from "../addRoleDialog"; +import "../index.less"; const getLabel = WeaLocaleProvider.getLabel; class Index extends Component { + constructor(props) { + super(props); + this.state = { + addRoleDialog: { visible: false, taxAgentId: "" } + }; + } + componentDidMount() { console.log(this.props); } render() { - + const { addRoleDialog } = this.state; + const { taxAgent } = this.props; return ( - console.log("自定义btn 点击的回调", values)} - replaceDatas={[{ id: 1, name: 操作者 }]} - onChange={(ids, names, datas) => - console.log("单人力", ids, names, datas) - }/> + + this.setState({ addRoleDialog: { taxAgentId: taxAgent.id, visible: true } })} + replaceDatas={[{ id: 1, name: 操作者 }]} + onChange={(ids, names, datas) => + console.log("单人力", ids, names, datas) + }/> + this.setState({ + addRoleDialog: { ...addRoleDialog, visible: false } + }, () => callback && callback())}/> + ); } } diff --git a/pc4mobx/hrmSalary/stores/taxAgent.js b/pc4mobx/hrmSalary/stores/taxAgent.js index ef5cfe2d..5168078c 100644 --- a/pc4mobx/hrmSalary/stores/taxAgent.js +++ b/pc4mobx/hrmSalary/stores/taxAgent.js @@ -8,6 +8,11 @@ import { decentralizationConditions, editConditions } from "../pages/taxAgent/ed const { TableStore } = WeaTableNew; export class TaxAgentStore { + @observable roleForm = new WeaForm(); //权限-角色form表单 + @action initRoleForm = () => this.roleForm = new WeaForm(); + + + @observable tableStore = new TableStore(); // new table @observable form = new WeaForm(); //表单实体 @observable formDecentralization = new WeaForm(); //关闭分权表单 From 2dc1061fa2bae898cc03b74c0bd8e2a6011d1726 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, 7 Aug 2024 09:02:12 +0800 Subject: [PATCH 04/78] =?UTF-8?q?feature/2.15.1.2407.01-=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/apis/taxAgent.js | 11 ++ .../components/addRoleDialog/index.js | 38 +++++- .../pages/taxAgent/components/index.less | 74 ++++++++++- .../components/roleDetailSetDialog/index.js | 123 ++++++++++++++++++ .../taxAgent/components/roleSetting/index.js | 56 ++++++-- pc4mobx/hrmSalary/pages/taxAgent/index.js | 6 +- 6 files changed, 283 insertions(+), 25 deletions(-) create mode 100644 pc4mobx/hrmSalary/pages/taxAgent/components/roleDetailSetDialog/index.js diff --git a/pc4mobx/hrmSalary/apis/taxAgent.js b/pc4mobx/hrmSalary/apis/taxAgent.js index f3c527b1..fff90ce4 100644 --- a/pc4mobx/hrmSalary/apis/taxAgent.js +++ b/pc4mobx/hrmSalary/apis/taxAgent.js @@ -98,3 +98,14 @@ export const getTaxAgentSelectListAsAdmin = (params) => { export const hasIconInTax = (params) => { return WeaTools.callApi("/api/bs/hrmsalary/sys/conf/code?code=hideIconInTax", "GET", params); }; + +/**权限-角色相关*/ +//保存角色 +export const saveAuthRole = (params) => { + return postFetch("/api/bs/hrmsalary/auth/role/save", params); +}; +//删除角色 +export const deleteAuthRole = (params) => { + return postFetch("/api/bs/hrmsalary/auth/role/delete", params); +}; + diff --git a/pc4mobx/hrmSalary/pages/taxAgent/components/addRoleDialog/index.js b/pc4mobx/hrmSalary/pages/taxAgent/components/addRoleDialog/index.js index 3bee7608..e196b343 100644 --- a/pc4mobx/hrmSalary/pages/taxAgent/components/addRoleDialog/index.js +++ b/pc4mobx/hrmSalary/pages/taxAgent/components/addRoleDialog/index.js @@ -10,9 +10,10 @@ import React, { Component } from "react"; import { inject, observer } from "mobx-react"; import { WeaDialog, WeaLocaleProvider } from "ecCom"; +import { Button, message } from "antd"; import { getSearchs } from "../../../../util"; import { roleConditions } from "../conditions"; -import { Button } from "antd"; +import * as API from "../../../../apis/taxAgent"; import "../index.less"; const getLabel = WeaLocaleProvider.getLabel; @@ -33,20 +34,43 @@ class Index extends Component { conditions: _.map(roleConditions, item => ({ ...item, items: _.map(item.items, o => ({ ...o, label: getLabel(o.lanId, o.label) })) })) - }, () => this.props.taxAgentStore.roleForm(this.state.conditions)); + }, () => nextProps.taxAgentStore.roleForm.initFormFields(this.state.conditions)); } - if (nextProps.visible !== this.props.visible && !nextProps.visible) this.props.taxAgentStore.initRoleForm(); + if (nextProps.visible !== this.props.visible && !nextProps.visible) nextProps.taxAgentStore.initRoleForm(); } + save = (isSetting) => { + const { taxAgentStore: { roleForm }, taxAgentId } = this.props; + roleForm.validateForm().then(f => { + if (f.isValid) { + const payload = roleForm.getFormParams(); + this.setState({ loading: true }); + API.saveAuthRole({ ...payload, taxAgentId }).then(({ status, data, errormsg }) => { + this.setState({ loading: false }); + if (status) { + message.success(getLabel(111, "操作成功!")); + this.props.onCancel(() => this.props.onSearch()); + isSetting && this.props.showRoleSetDialog({ id: data, name: payload.name }); + } else { + message.error(errormsg); + } + }); + } else { + f.showErrors(); + } + }); + }; + render() { - const { conditions } = this.state; + const { conditions, loading, roleSetDialog } = this.state; const { taxAgentStore: { roleForm } } = this.props; return ( {getLabel(111, "保存")}, - + , + ]} >
{getSearchs(roleForm, conditions, 1, false)}
diff --git a/pc4mobx/hrmSalary/pages/taxAgent/components/index.less b/pc4mobx/hrmSalary/pages/taxAgent/components/index.less index 7d064e3e..aa53099d 100644 --- a/pc4mobx/hrmSalary/pages/taxAgent/components/index.less +++ b/pc4mobx/hrmSalary/pages/taxAgent/components/index.less @@ -6,9 +6,77 @@ cursor: default !important; } + .wea-field-readonly.border .child-item { + margin-bottom: 4px; + } + .only-operate { - white-space: normal !important; - display: inline !important; - color: #2db7f5; + position: relative; + + & > a { + white-space: normal !important; + display: inline !important; + color: #2db7f5; + } + + } + + .only-operate:hover { + .ant-select-selection__choice__remove { + visibility: visible; + } + } + + .ant-select-selection__choice__remove:before { + content: "\E62D"; + font-family: anticon !important; + } + + .ant-select-selection__choice__remove { + visibility: hidden; + right: -3px; + font-size: 12px !important; + top: 50%; + margin-top: -6px; + text-decoration: none; + position: static; + padding: 0; + cursor: pointer; + transform: scale(.66666667) rotate(0deg); + } +} + +.tax_role_set_dialog { + .tax_role_set_container { + padding: 10px 25px; + + .tax_role_row_groupname { + padding: 10px 0; + } + + .tax_role_form_item { + min-height: 190px; + border: 1px solid rgb(217, 217, 217); + + & > .wea-select { + margin: 10px 10px 0 20px; + line-height: 25px; + } + + .tax_role_operator_setting { + border-top: 1px solid rgb(217, 217, 217); + padding: 8px; + display: table; + width: 100%; + + & > div { + text-align: right; + } + } + + .tax_role_browser_form_item { + margin: 12px 14px; + } + } } } diff --git a/pc4mobx/hrmSalary/pages/taxAgent/components/roleDetailSetDialog/index.js b/pc4mobx/hrmSalary/pages/taxAgent/components/roleDetailSetDialog/index.js new file mode 100644 index 00000000..d39d5af8 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/taxAgent/components/roleDetailSetDialog/index.js @@ -0,0 +1,123 @@ +/* + * 角色详情设置弹窗 + * + * @Author: 黎永顺 + * @Date: 2024/8/5 + * @Wechat: + * @Email: 971387674@qq.com + * @description: +*/ +import React, { Component } from "react"; +import { WeaBrowser, WeaDialog, WeaFormItem, WeaInput, WeaLocaleProvider, WeaSelect, WeaTab, WeaTextarea } from "ecCom"; +import { commonEnumList } from "../../../../apis/archive"; +import { Button, Col, Row } from "antd"; +import "../index.less"; + +const getLabel = WeaLocaleProvider.getLabel; + +class Index extends Component { + constructor(props) { + super(props); + this.state = { + selectedKey: "auth.MemberTargetTypeEnum", name: "", options: [], enumType: "" + }; + } + + componentWillReceiveProps(nextProps, nextContext) { + if (nextProps.visible !== this.props.visible && nextProps.visible) { + this.setState({ name: nextProps.name, selectedKey: "auth.MemberTargetTypeEnum" }, () => this.getEnumList()); + } + } + + getEnumList = () => { + const payload = { enumClass: `com.engine.salary.enums.${this.state.selectedKey}` }; + commonEnumList(payload).then(({ status, data }) => { + if (status) this.setState({ + options: _.map(data, o => ({ key: o.enum, showname: o.defaultLabel })), + enumType: _.head(data).enum || "" + }); + if (!status) this.setState({ options: [], enumType: "" }); + }); + }; + getOperatorSetting = () => { + const { selectedKey, enumType } = this.state; + if (selectedKey !== "auth.AuthTargetTypeEnum") { + let browserType = {}; + switch (enumType) { + case "EMP": + browserType = { ...browserType, type: 17, title: getLabel(82246, "人员选择") }; + break; + case "DEPARTMENT": + browserType = { ...browserType, type: 57, title: getLabel(111, "部门选择") }; + break; + case "JOB": + browserType = { ...browserType, type: 278, title: getLabel(111, "岗位选择") }; + break; + case "SUB_COMPANY": + browserType = { ...browserType, type: 164, title: getLabel(111, "分部选择") }; + break; + case "ROLE": + browserType = { ...browserType, type: 65, title: getLabel(111, "角色选择") }; + break; + case "SQL": + return ( + + ); + default: + break; + } + return ( + + ); + } else { + return (权限); + } + }; + + render() { + const { selectedKey, name, options, enumType } = this.state; + const tabs = [ + { title: getLabel(111, "成员"), viewcondition: "auth.MemberTargetTypeEnum" }, + { title: getLabel(111, "权限"), viewcondition: "auth.AuthTargetTypeEnum" }, + { title: getLabel(111, "数据"), viewcondition: "auth.DataTargetTypeEnum" } + ]; + return ( + +
+ + + + this.setState({ name: val })}/> + + + + +
+ this.setState({ + selectedKey: v, name: !name ? null : name + }, () => this.state.selectedKey !== "auth.AuthTargetTypeEnum" && this.getEnumList())}/> + this.setState({ enumType: v })}/> + {this.getOperatorSetting()} + + + +
+
+ +
+
+ ); + } +} + +export default Index; diff --git a/pc4mobx/hrmSalary/pages/taxAgent/components/roleSetting/index.js b/pc4mobx/hrmSalary/pages/taxAgent/components/roleSetting/index.js index df837e76..31e392d8 100644 --- a/pc4mobx/hrmSalary/pages/taxAgent/components/roleSetting/index.js +++ b/pc4mobx/hrmSalary/pages/taxAgent/components/roleSetting/index.js @@ -9,7 +9,10 @@ */ import React, { Component } from "react"; import { WeaBrowser, WeaLocaleProvider } from "ecCom"; +import { message, Modal } from "antd"; import AddRoleDialog from "../addRoleDialog"; +import RoleDetailSetDialog from "../roleDetailSetDialog"; +import * as API from "../../../../apis/taxAgent"; import "../index.less"; const getLabel = WeaLocaleProvider.getLabel; @@ -18,29 +21,58 @@ class Index extends Component { constructor(props) { super(props); this.state = { - addRoleDialog: { visible: false, taxAgentId: "" } + addRoleDialog: { visible: false, taxAgentId: "" }, + roleSetDialog: { visible: false, roleId: "", name: "" } }; } - componentDidMount() { - console.log(this.props); - } + showRoleSetDialog = (role) => this.setState({ roleSetDialog: { visible: true, roleId: role.id, name: role.name } }); + deleteAuthRole = (role) => { + Modal.confirm({ + title: getLabel(111, "信息确认"), + content: getLabel(111, "确认要删除吗?"), + onOk: () => { + API.deleteAuthRole([role.id]).then(({ status, errormsg }) => { + if (status) { + message.success(getLabel(111, "操作成功!")); + this.props.onSearch(); + } else { + message.error(errormsg); + } + }); + } + }); + + }; render() { - const { addRoleDialog } = this.state; - const { taxAgent } = this.props; + const { addRoleDialog, roleSetDialog } = this.state; + const { taxAgent, onSearch } = this.props; + const { role } = taxAgent; return ( - this.setState({ addRoleDialog: { taxAgentId: taxAgent.id, visible: true } })} - replaceDatas={[{ id: 1, name: 操作者 }]} - onChange={(ids, names, datas) => - console.log("单人力", ids, names, datas) - }/> - ({ + id: o.id, + name: + this.showRoleSetDialog(o)}>{o.name} + this.deleteAuthRole(o)}/> + + }))}/> + {/*添加角色*/} + this.setState({ addRoleDialog: { ...addRoleDialog, visible: false } }, () => callback && callback())}/> + {/*角色详情设置*/} + this.setState({ + roleSetDialog: { ...roleSetDialog, visible: false } + }, () => callback && callback())}/> ); } diff --git a/pc4mobx/hrmSalary/pages/taxAgent/index.js b/pc4mobx/hrmSalary/pages/taxAgent/index.js index 82120cc3..3fd39f88 100644 --- a/pc4mobx/hrmSalary/pages/taxAgent/index.js +++ b/pc4mobx/hrmSalary/pages/taxAgent/index.js @@ -412,11 +412,11 @@ export default class TaxAgent extends React.Component { ); } }; - }else if(item.dataIndex === "role"){ + } else if (item.dataIndex === "role") { return { ...item, - render: (text, record) => () - } + render: (text, record) => ( getTaxAgentList({})}/>) + }; } else { return { ...item }; } From 6e7137b6b3007701fa034dc0dd12aac515e8beb2 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, 7 Aug 2024 14:02:27 +0800 Subject: [PATCH 05/78] =?UTF-8?q?feature/2.15.1.2407.01-=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/apis/taxAgent.js | 8 ++ .../pages/taxAgent/components/index.less | 6 ++ .../components/roleDetailSetDialog/index.js | 81 +++++++++++++++++-- 3 files changed, 88 insertions(+), 7 deletions(-) diff --git a/pc4mobx/hrmSalary/apis/taxAgent.js b/pc4mobx/hrmSalary/apis/taxAgent.js index fff90ce4..fb5d8945 100644 --- a/pc4mobx/hrmSalary/apis/taxAgent.js +++ b/pc4mobx/hrmSalary/apis/taxAgent.js @@ -108,4 +108,12 @@ export const saveAuthRole = (params) => { export const deleteAuthRole = (params) => { return postFetch("/api/bs/hrmsalary/auth/role/delete", params); }; +//成员列表 +export const authMemberList = (params) => { + return postFetch("/api/bs/hrmsalary/auth/member/list", params); +}; +//数据列表 +export const authDataList = (params) => { + return postFetch("/api/bs/hrmsalary/auth/data/list", params); +}; diff --git a/pc4mobx/hrmSalary/pages/taxAgent/components/index.less b/pc4mobx/hrmSalary/pages/taxAgent/components/index.less index aa53099d..f1e20c81 100644 --- a/pc4mobx/hrmSalary/pages/taxAgent/components/index.less +++ b/pc4mobx/hrmSalary/pages/taxAgent/components/index.less @@ -78,5 +78,11 @@ margin: 12px 14px; } } + + .tax_role_operator_setting_table { + .setting_table_title { + //line-height: 45px; + } + } } } diff --git a/pc4mobx/hrmSalary/pages/taxAgent/components/roleDetailSetDialog/index.js b/pc4mobx/hrmSalary/pages/taxAgent/components/roleDetailSetDialog/index.js index d39d5af8..3a7a1247 100644 --- a/pc4mobx/hrmSalary/pages/taxAgent/components/roleDetailSetDialog/index.js +++ b/pc4mobx/hrmSalary/pages/taxAgent/components/roleDetailSetDialog/index.js @@ -8,24 +8,43 @@ * @description: */ import React, { Component } from "react"; -import { WeaBrowser, WeaDialog, WeaFormItem, WeaInput, WeaLocaleProvider, WeaSelect, WeaTab, WeaTextarea } from "ecCom"; +import { + WeaBrowser, + WeaDialog, + WeaFormItem, + WeaInput, + WeaLocaleProvider, + WeaSelect, + WeaTab, + WeaTable, + WeaTextarea +} from "ecCom"; import { commonEnumList } from "../../../../apis/archive"; +import * as API from "../../../../apis/taxAgent"; import { Button, Col, Row } from "antd"; import "../index.less"; const getLabel = WeaLocaleProvider.getLabel; +const APIFOX = { + "auth.MemberTargetTypeEnum": API.authMemberList, + "auth.DataTargetTypeEnum": API.authDataList +}; class Index extends Component { constructor(props) { super(props); this.state = { - selectedKey: "auth.MemberTargetTypeEnum", name: "", options: [], enumType: "" + selectedKey: "auth.MemberTargetTypeEnum", name: "", options: [], enumType: "", + columns: [], dataSource: [], pageInfo: { current: 1, pageSize: 10, total: 0 } }; } componentWillReceiveProps(nextProps, nextContext) { if (nextProps.visible !== this.props.visible && nextProps.visible) { - this.setState({ name: nextProps.name, selectedKey: "auth.MemberTargetTypeEnum" }, () => this.getEnumList()); + this.setState({ name: nextProps.name, selectedKey: "auth.MemberTargetTypeEnum" }, () => { + this.getEnumList(); + this.getSettingRoler(nextProps.roleId); + }); } } @@ -39,6 +58,26 @@ class Index extends Component { if (!status) this.setState({ options: [], enumType: "" }); }); }; + getSettingRoler = (roleId) => { + const { selectedKey, pageInfo } = this.state; + APIFOX[selectedKey]({ roleId, ...pageInfo }).then(({ status, data }) => { + if (status) { + const { columns, list: dataSource, pageNum: current, pageSize, total } = data; + this.setState({ + dataSource, pageInfo: { ...pageInfo, current, pageSize, total }, + columns: _.map(columns, o => { + if (o.dataIndex === "targetType") { + return { + ...o, + render: (txt, record) => ({txt}) + }; + } + return { ...o }; + }) + }); + } + }); + }; getOperatorSetting = () => { const { selectedKey, enumType } = this.state; if (selectedKey !== "auth.AuthTargetTypeEnum") { @@ -61,7 +100,7 @@ class Index extends Component { break; case "SQL": return ( - + ); default: break; @@ -75,12 +114,30 @@ class Index extends Component { }; render() { - const { selectedKey, name, options, enumType } = this.state; + const { roleId } = this.props; + const { selectedKey, name, options, enumType, pageInfo, columns, dataSource } = this.state; const tabs = [ { title: getLabel(111, "成员"), viewcondition: "auth.MemberTargetTypeEnum" }, { title: getLabel(111, "权限"), viewcondition: "auth.AuthTargetTypeEnum" }, { title: getLabel(111, "数据"), viewcondition: "auth.DataTargetTypeEnum" } ]; + const pagination = { + ...pageInfo, + showTotal: total => `${getLabel(18609, "共")} ${total} ${getLabel(18256, "条")}`, + showQuickJumper: true, + showSizeChanger: true, + pageSizeOptions: ["10", "20", "50", "100"], + onShowSizeChange: (current, pageSize) => { + this.setState({ + pageInfo: { ...pageInfo, current, pageSize } + }, () => this.getSettingRoler(roleId)); + }, + onChange: current => { + this.setState({ + pageInfo: { ...pageInfo, current } + }, () => this.getSettingRoler(roleId)); + } + }; return ( this.setState({ selectedKey: v, name: !name ? null : name - }, () => this.state.selectedKey !== "auth.AuthTargetTypeEnum" && this.getEnumList())}/> + }, () => { + this.state.selectedKey !== "auth.AuthTargetTypeEnum" && this.getEnumList(); + this.state.selectedKey !== "auth.AuthTargetTypeEnum" && this.getSettingRoler(roleId); + })}/> this.setState({ enumType: v })}/> {this.getOperatorSetting()} @@ -113,7 +173,14 @@ class Index extends Component { - + {/*表格*/} + + +
{getLabel(111, "已设操作者")}
+ + +
); From 71b4e766af5e699d645874ae35093bc2a2007923 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Thu, 8 Aug 2024 11:10:24 +0800 Subject: [PATCH 06/78] =?UTF-8?q?feature/2.15.1.2407.01-=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/apis/taxAgent.js | 12 +++ .../pages/taxAgent/components/index.less | 4 +- .../components/roleDetailSetDialog/index.js | 86 +++++++++++++++---- 3 files changed, 82 insertions(+), 20 deletions(-) diff --git a/pc4mobx/hrmSalary/apis/taxAgent.js b/pc4mobx/hrmSalary/apis/taxAgent.js index fb5d8945..499d25c2 100644 --- a/pc4mobx/hrmSalary/apis/taxAgent.js +++ b/pc4mobx/hrmSalary/apis/taxAgent.js @@ -112,8 +112,20 @@ export const deleteAuthRole = (params) => { export const authMemberList = (params) => { return postFetch("/api/bs/hrmsalary/auth/member/list", params); }; +//保存成员 +export const saveAuthMember = (params) => { + return postFetch("/api/bs/hrmsalary/auth/member/save", params); +}; //数据列表 export const authDataList = (params) => { return postFetch("/api/bs/hrmsalary/auth/data/list", params); }; +//保存数据 +export const saveAuthData = (params) => { + return postFetch("/api/bs/hrmsalary/auth/data/save", params); +}; +//同步数据 +export const syncAuthData = (params) => { + return postFetch("/api/bs/hrmsalary/auth/data/sync", params); +}; diff --git a/pc4mobx/hrmSalary/pages/taxAgent/components/index.less b/pc4mobx/hrmSalary/pages/taxAgent/components/index.less index f1e20c81..85b34deb 100644 --- a/pc4mobx/hrmSalary/pages/taxAgent/components/index.less +++ b/pc4mobx/hrmSalary/pages/taxAgent/components/index.less @@ -81,7 +81,9 @@ .tax_role_operator_setting_table { .setting_table_title { - //line-height: 45px; + & > .operator { + line-height: 45px; + } } } } diff --git a/pc4mobx/hrmSalary/pages/taxAgent/components/roleDetailSetDialog/index.js b/pc4mobx/hrmSalary/pages/taxAgent/components/roleDetailSetDialog/index.js index 3a7a1247..a4d5dde9 100644 --- a/pc4mobx/hrmSalary/pages/taxAgent/components/roleDetailSetDialog/index.js +++ b/pc4mobx/hrmSalary/pages/taxAgent/components/roleDetailSetDialog/index.js @@ -14,6 +14,7 @@ import { WeaFormItem, WeaInput, WeaLocaleProvider, + WeaScope, WeaSelect, WeaTab, WeaTable, @@ -21,13 +22,15 @@ import { } from "ecCom"; import { commonEnumList } from "../../../../apis/archive"; import * as API from "../../../../apis/taxAgent"; -import { Button, Col, Row } from "antd"; +import { Button, Col, message, Modal, Row } from "antd"; import "../index.less"; const getLabel = WeaLocaleProvider.getLabel; const APIFOX = { "auth.MemberTargetTypeEnum": API.authMemberList, - "auth.DataTargetTypeEnum": API.authDataList + "save.auth.MemberTargetTypeEnum": API.saveAuthMember, + "auth.DataTargetTypeEnum": API.authDataList, + "save.auth.DataTargetTypeEnum": API.saveAuthData }; class Index extends Component { @@ -35,6 +38,7 @@ class Index extends Component { super(props); this.state = { selectedKey: "auth.MemberTargetTypeEnum", name: "", options: [], enumType: "", + replaceDatas: [], loading: { set: false, query: false, async: false }, columns: [], dataSource: [], pageInfo: { current: 1, pageSize: 10, total: 0 } }; } @@ -45,6 +49,8 @@ class Index extends Component { this.getEnumList(); this.getSettingRoler(nextProps.roleId); }); + } else { + this.setState({ replaceDatas: [], pageInfo: { current: 1, pageSize: 10, total: 0 } }); } } @@ -60,26 +66,56 @@ class Index extends Component { }; getSettingRoler = (roleId) => { const { selectedKey, pageInfo } = this.state; + this.setState({ loading: { ...this.state.loading, query: true } }); APIFOX[selectedKey]({ roleId, ...pageInfo }).then(({ status, data }) => { + this.setState({ loading: { ...this.state.loading, query: false } }); if (status) { const { columns, list: dataSource, pageNum: current, pageSize, total } = data; this.setState({ dataSource, pageInfo: { ...pageInfo, current, pageSize, total }, columns: _.map(columns, o => { - if (o.dataIndex === "targetType") { - return { - ...o, - render: (txt, record) => ({txt}) - }; - } return { ...o }; }) }); } }); }; + addOperatorSettings = () => { + const { roleId } = this.props; + const { selectedKey, enumType: targetType, replaceDatas } = this.state; + if (_.isEmpty(replaceDatas)) { + Modal.warning({ + title: getLabel(111, "系统提示"), + content: getLabel(111, "请先选择操作对象的值!") + }); + return; + } + const payload = _.map(replaceDatas, o => ({ roleId, targetType, target: o.id || "", targetName: o.name || "" })); + this.setState({ loading: { ...this.state.loading, set: true } }); + APIFOX[`save.${selectedKey}`](payload).then(({ status, errormsg }) => { + this.setState({ loading: { ...this.state.loading, set: false } }); + if (status) { + message.success(getLabel(111, "操作成功!")); + this.getSettingRoler(roleId); + } else { + message.error(errormsg); + } + }); + }; + syncAuthData = () => { + const { roleId } = this.props; + this.setState({ async: true }); + API.syncAuthData({ roleId }).then(({ status, errormsg }) => { + this.setState({ async: false }); + if (status) { + message.success(getLabel(111, "操作成功!")); + } else { + message.error(errormsg); + } + }); + }; getOperatorSetting = () => { - const { selectedKey, enumType } = this.state; + const { selectedKey, enumType, replaceDatas } = this.state; if (selectedKey !== "auth.AuthTargetTypeEnum") { let browserType = {}; switch (enumType) { @@ -100,13 +136,21 @@ class Index extends Component { break; case "SQL": return ( - + this.setState({ replaceDatas: [{ id: v, name: v }] })}/> ); + case "LEVEL": + return ( + + ); default: - break; + return (); } return ( - + this.setState({ replaceDatas })}/> ); } else { return (权限); @@ -115,7 +159,7 @@ class Index extends Component { render() { const { roleId } = this.props; - const { selectedKey, name, options, enumType, pageInfo, columns, dataSource } = this.state; + const { selectedKey, name, options, enumType, pageInfo, columns, dataSource, loading } = this.state; const tabs = [ { title: getLabel(111, "成员"), viewcondition: "auth.MemberTargetTypeEnum" }, { title: getLabel(111, "权限"), viewcondition: "auth.AuthTargetTypeEnum" }, @@ -141,6 +185,9 @@ class Index extends Component { return ( {getLabel(111, "同步")} + ]} style={{ width: 960, height: 606.6, minHeight: 200, minWidth: 380, maxHeight: "90%", maxWidth: "90%", overflow: "hidden", transform: "translate(0px, 0px)" @@ -160,25 +207,26 @@ class Index extends Component {
this.setState({ - selectedKey: v, name: !name ? null : name + selectedKey: v, name: !name ? null : name, replaceDatas: [] }, () => { this.state.selectedKey !== "auth.AuthTargetTypeEnum" && this.getEnumList(); this.state.selectedKey !== "auth.AuthTargetTypeEnum" && this.getSettingRoler(roleId); })}/> this.setState({ enumType: v })}/> + onChange={v => this.setState({ enumType: v, replaceDatas: [] })}/> {this.getOperatorSetting()} - +
{/*表格*/} -
{getLabel(111, "已设操作者")}
- +
{getLabel(111, "已设操作者")}
+
From 36d90b35a628297ce7646278550e416762ed7907 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Thu, 8 Aug 2024 14:36:11 +0800 Subject: [PATCH 07/78] =?UTF-8?q?feature/2.15.1.2407.01-=E6=B5=AE=E5=8A=A8?= =?UTF-8?q?=E8=96=AA=E9=85=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/apis/variableSalary.js | 10 +++ pc4mobx/hrmSalary/index.js | 11 ++- .../components/advanceInputBtn/index.js | 35 ++++++++ .../components/advanceInputBtn/index.less | 29 +++++++ .../components/salaryItemDialog/index.js | 79 +++++++++++++++++++ .../components/searchPannel/index.js | 70 ++++++++++++++++ .../pages/variableSalary/conditions.js | 52 ++++++++++++ .../hrmSalary/pages/variableSalary/index.js | 71 +++++++++++++++++ .../hrmSalary/pages/variableSalary/index.less | 45 +++++++++++ pc4mobx/hrmSalary/stores/baseTable.js | 26 +++--- 10 files changed, 413 insertions(+), 15 deletions(-) create mode 100644 pc4mobx/hrmSalary/apis/variableSalary.js create mode 100644 pc4mobx/hrmSalary/pages/variableSalary/components/advanceInputBtn/index.js create mode 100644 pc4mobx/hrmSalary/pages/variableSalary/components/advanceInputBtn/index.less create mode 100644 pc4mobx/hrmSalary/pages/variableSalary/components/salaryItemDialog/index.js create mode 100644 pc4mobx/hrmSalary/pages/variableSalary/components/searchPannel/index.js create mode 100644 pc4mobx/hrmSalary/pages/variableSalary/conditions.js create mode 100644 pc4mobx/hrmSalary/pages/variableSalary/index.js create mode 100644 pc4mobx/hrmSalary/pages/variableSalary/index.less diff --git a/pc4mobx/hrmSalary/apis/variableSalary.js b/pc4mobx/hrmSalary/apis/variableSalary.js new file mode 100644 index 00000000..cdfdde70 --- /dev/null +++ b/pc4mobx/hrmSalary/apis/variableSalary.js @@ -0,0 +1,10 @@ +import { postFetch } from "../util/request"; + +//浮动薪酬项目列表 +export const getVariableSalaryItemList = params => { + return postFetch("/api/bs/hrmsalary/variableSalaryItem/listPage", params); +}; +//保存/更新 浮动薪酬项目 +export const saveVariableSalaryItem = params => { + return postFetch("/api/bs/hrmsalary/variableSalaryItem/save", params); +}; diff --git a/pc4mobx/hrmSalary/index.js b/pc4mobx/hrmSalary/index.js index fff7a3d1..c11b384c 100644 --- a/pc4mobx/hrmSalary/index.js +++ b/pc4mobx/hrmSalary/index.js @@ -52,6 +52,7 @@ import ExternalPersonManage from "./pages/externalPersonManage"; import AdjustSalaryManage from "./pages/adjustSalaryManage"; import TopologyMap from "./pages/topologyMap"; import SupplementaryCalc from "./pages/supplementaryCalc"; +import VariableSalary from "./pages/variableSalary"; import stores from "./stores"; import "./style/index"; @@ -112,9 +113,10 @@ const DataAcquisition = (props) => props.children; // externalPersonManage 非系统人员管理 // adjustSalaryManage 档案管理 // supplementaryCalc 补算 +// variableSalary 浮动薪酬 const Routes = ( - + @@ -124,8 +126,8 @@ const Routes = ( - - + + @@ -152,7 +154,7 @@ const Routes = ( - + @@ -166,6 +168,7 @@ const Routes = ( + ); diff --git a/pc4mobx/hrmSalary/pages/variableSalary/components/advanceInputBtn/index.js b/pc4mobx/hrmSalary/pages/variableSalary/components/advanceInputBtn/index.js new file mode 100644 index 00000000..7e981704 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/variableSalary/components/advanceInputBtn/index.js @@ -0,0 +1,35 @@ +/* + * Author: 黎永顺 + * name:薪酬统计报表-高级搜索 + * Description: + * Date: 2024/3/26 + */ +import React, { Component } from "react"; +import { inject, observer } from "mobx-react"; +import { Button } from "antd"; +import { WeaInputSearch, WeaLocaleProvider } from "ecCom"; +import "./index.less"; + +const getLabel = WeaLocaleProvider.getLabel; + +@inject("baseTableStore") +@observer +class Index extends Component { + render() { + const { baseTableStore: { VSalryForm }, searchType } = this.props; + return ( +
+ VSalryForm.updateFields({ keyword: v })} + onSearch={this.props.onAdvanceSearch} + /> + { + searchType === "advance" && + } +
+ ); + } +} + +export default Index; diff --git a/pc4mobx/hrmSalary/pages/variableSalary/components/advanceInputBtn/index.less b/pc4mobx/hrmSalary/pages/variableSalary/components/advanceInputBtn/index.less new file mode 100644 index 00000000..9081d39f --- /dev/null +++ b/pc4mobx/hrmSalary/pages/variableSalary/components/advanceInputBtn/index.less @@ -0,0 +1,29 @@ +.achrive-advance-search { + display: flex; + align-items: center; + position: relative; + top: -1.5px; + + .wea-advanced-search { + top: 2px; + left: -1px; + height: 28px; + line-height: 1; + border-radius: 0; + position: relative; + color: #474747; + padding: 4px 15px; + } + + .wea-advanced-search:hover { + border: 1px solid #dadada; + color: #474747; + } + + .text-elli { + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + top: 1px; + } +} diff --git a/pc4mobx/hrmSalary/pages/variableSalary/components/salaryItemDialog/index.js b/pc4mobx/hrmSalary/pages/variableSalary/components/salaryItemDialog/index.js new file mode 100644 index 00000000..71eba98b --- /dev/null +++ b/pc4mobx/hrmSalary/pages/variableSalary/components/salaryItemDialog/index.js @@ -0,0 +1,79 @@ +import React, { Component } from "react"; +import { inject, observer } from "mobx-react"; +import { WeaDialog, WeaLocaleProvider, WeaTools } from "ecCom"; +import { Button, message } from "antd"; +import { getSearchs } from "../../../../util"; +import { salaryItemsConditions } from "../../conditions"; +import * as API from "../../../../apis/variableSalary"; + +const getKey = WeaTools.getKey; +const getLabel = WeaLocaleProvider.getLabel; + +@inject("baseTableStore") +@observer +class Index extends Component { + constructor(props) { + super(props); + this.state = { + conditions: [], loading: false + }; + } + + componentWillReceiveProps(nextProps, nextContext) { + if (nextProps.visible !== this.props.visible && nextProps.visible) this.initForm(nextProps); + if (nextProps.visible !== this.props.visible && !nextProps.visible) this.props.baseTableStore.initVSSalaryItemForm(); + } + + initForm = (props) => { + const { baseTableStore: { VSSalaryItemForm } } = props; + this.setState({ + conditions: _.map(salaryItemsConditions, item => ({ + ...item, + items: _.map(item.items, o => { + if (getKey(o) === "dataType") { + return { ...o, options: _.map(o.options, g => ({ ...g, showname: getLabel(g.lanId, g.showname) })) }; + } + return { ...o, label: getLabel(o.lanId, o.label) }; + }) + })) + }, () => VSSalaryItemForm.initFormFields(this.state.conditions)); + }; + save = () => { + const { baseTableStore: { VSSalaryItemForm }, onSearch } = this.props; + VSSalaryItemForm.validateForm().then(f => { + if (f.isValid) { + const payload = VSSalaryItemForm.getFormParams(); + this.setState({ loading: true }); + API.saveVariableSalaryItem({ ...payload }).then(({ status, errormsg }) => { + this.setState({ loading: false }); + if (status) { + message.success(getLabel(30700, "操作成功")); + this.props.onCancel(onSearch()); + } else { + message.error(errormsg); + } + }).catch(() => this.setState({ loading: false })); + } else { + f.showErrors(); + } + }); + }; + + render() { + const { conditions, loading } = this.state; + const { baseTableStore: { calculateForm } } = this.props; + return ( + {getLabel(111, "取消")}, + + ]} + > +
{getSearchs(calculateForm, conditions, 1, false)}
+
+ ); + } +} + +export default Index; diff --git a/pc4mobx/hrmSalary/pages/variableSalary/components/searchPannel/index.js b/pc4mobx/hrmSalary/pages/variableSalary/components/searchPannel/index.js new file mode 100644 index 00000000..d5b274a9 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/variableSalary/components/searchPannel/index.js @@ -0,0 +1,70 @@ +/* + * Author: 黎永顺 + * name:薪酬统计报薪资明细-高级查询 + * Description: + * Date: 2024/3/26 + */ +import React, { Component } from "react"; +import { WeaLocaleProvider, WeaTools } from "ecCom"; +import { Button } from "antd"; +import { inject, observer } from "mobx-react"; +import { getSearchs } from "../../../../util"; +import { conditions } from "../../conditions"; + +const getLabel = WeaLocaleProvider.getLabel; +const getKey = WeaTools.getKey; + +@inject("baseTableStore") +@observer +class VariableSalarySearchPannel extends Component { + constructor(props) { + super(props); + this.state = { + searchConditions: [] + }; + } + + componentDidMount() { + this.setState({ + searchConditions: _.map(conditions, item => { + return { + ...item, + items: _.map(item.items, child => { + return { ...child, label: getLabel(child.lanId, child.label) }; + }) + }; + }) + }, () => { + const { baseTableStore: { VSalryForm } } = this.props; + VSalryForm.initFormFields(this.state.searchConditions); + }); + } + + render() { + const { searchConditions } = this.state; + const { baseTableStore: { VSalryForm } } = this.props; + return ( + +
+ {getSearchs(VSalryForm, searchConditions, 2, false)} +
+
+
+ + + + + + + + + +
+
+
+ ); + } +} + +export default VariableSalarySearchPannel; + diff --git a/pc4mobx/hrmSalary/pages/variableSalary/conditions.js b/pc4mobx/hrmSalary/pages/variableSalary/conditions.js new file mode 100644 index 00000000..ae943a2d --- /dev/null +++ b/pc4mobx/hrmSalary/pages/variableSalary/conditions.js @@ -0,0 +1,52 @@ +export const conditions = [ + { + items: [ + { + conditionType: "INPUT", + domkey: ["dimName"], + fieldcol: 14, + label: "测试", + labelcol: 6, + value: "", + rules: "required|string", + viewAttr: 3 + } + ], + title: "", + defaultshow: true + } +]; +export const salaryItemsConditions = [ + { + items: [ + { + conditionType: "INPUT", + domkey: ["name"], + fieldcol: 14, + label: "名称", + lanId: 111, + labelcol: 6, + value: "", + rules: "required|string", + viewAttr: 3 + }, + { + conditionType: "SELECT", + domkey: ["dataType"], + fieldcol: 14, + label: "字段类型", + lanId: 111, + labelcol: 6, + value: "", + options: [ + { key: "number", showname: "数值", lanId: 111, selected: true }, + { key: "string", showname: "字符", lanId: 111, selected: false } + ], + rules: "required|string", + viewAttr: 3 + } + ], + title: "", + defaultshow: true + } +]; diff --git a/pc4mobx/hrmSalary/pages/variableSalary/index.js b/pc4mobx/hrmSalary/pages/variableSalary/index.js new file mode 100644 index 00000000..abf682d3 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/variableSalary/index.js @@ -0,0 +1,71 @@ +/* + * 浮动薪酬 + * + * @Author: 黎永顺 + * @Date: 2024/8/8 + * @Wechat: + * @Email: 971387674@qq.com + * @description: +*/ +import React, { Component } from "react"; +import { inject, observer } from "mobx-react"; +import { WeaLocaleProvider, WeaReqTop } from "ecCom"; +import AdvanceInputBtn from "./components/advanceInputBtn"; +import SearchPannel from "./components/searchPannel"; +import SalaryItemDialog from "./components/salaryItemDialog"; +import { Button } from "antd"; +import cs from "classnames"; + +const getLabel = WeaLocaleProvider.getLabel; + +@inject("taxAgentStore", "baseTableStore") +@observer +class Index extends Component { + constructor(props) { + super(props); + this.state = { + selectedKey: "salaryFile", isQuery: false, + SIDialog: { visible: false, title: "" } //薪资项目薪资编辑弹框 + }; + } + + handleAdvanceSearch = () => this.setState({ isQuery: !this.state.isQuery }); + + render() { + const { selectedKey, SIDialog } = this.state; + const { taxAgentStore: { showOperateBtn } } = this.props; + const tabs = [ + { + title: getLabel(111, "薪资档案"), key: "salaryFile", + buttons: showOperateBtn ? [] : [] + }, + { + title: getLabel(111, "薪资项目"), key: "salaryItem", + buttons: showOperateBtn ? [ + , + + ] : [] + } + ]; + return ( + } selectedKey={selectedKey} + iconBgcolor="#F14A2D" tabDatas={tabs} className="variable_salary_wrapper" + buttons={_.find(tabs, o => selectedKey === o.key).buttons} buttonSpace={10} + onChange={selectedKey => this.setState({ selectedKey })} + showDropIcon={false} + > +
+ this.setState({ showSearchAd: false })} onAdSearch={this.onAdSearch}/> +
+ this.setState({ + SIDialog: { ...SIDialog, visible: false } + }, () => callback && callback())}/> +
+ ); + } +} + +export default Index; diff --git a/pc4mobx/hrmSalary/pages/variableSalary/index.less b/pc4mobx/hrmSalary/pages/variableSalary/index.less new file mode 100644 index 00000000..a487afd7 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/variableSalary/index.less @@ -0,0 +1,45 @@ +.variable_salary_wrapper { + .searchAdvanced-condition-hide { + display: none; + } + + .searchAdvanced-condition-container { + background: #FFF; + margin-bottom: 10px; + border: 1px solid #e5e5e5; + + .wea-search-buttons { + border-top: 1px solid #dadada; + padding: 15px 0; + } + + .wea-advanced-searchsAd { + height: 155px; + overflow: hidden auto; + + .formItem-delete { + position: absolute; + top: 0; + right: -40px; + } + + .searchAdvanced-commonSelect { + border-top: 1px solid #ebebeb; + margin: 0 25px; + padding: 10px 0; + } + + .custom-advance-largeSpacing { + padding-left: 26px; + + .link { + border: none; + border-radius: 0; + padding: 12px 10px 12px 26px; + color: #2db7f5 + } + } + + } + } +} diff --git a/pc4mobx/hrmSalary/stores/baseTable.js b/pc4mobx/hrmSalary/stores/baseTable.js index cc639b54..75106e3a 100644 --- a/pc4mobx/hrmSalary/stores/baseTable.js +++ b/pc4mobx/hrmSalary/stores/baseTable.js @@ -1,8 +1,8 @@ -import { observable, action, toJS } from 'mobx'; -import { message } from 'antd'; -import { WeaForm, WeaTableNew } from 'comsMobx'; +import { action, observable } from "mobx"; +import { message } from "antd"; +import { WeaForm, WeaTableNew } from "comsMobx"; -import * as API from '../apis'; // 引入API接口文件 +import * as API from "../apis"; // 引入API接口文件 const { TableStore } = WeaTableNew; @@ -14,12 +14,16 @@ export class BaseTableStore { @observable showSearchAd = false; // 高级搜索面板显示 @observable loading = true; // 数据加载状态 + // 浮动薪酬相关 + @observable VSalryForm = new WeaForm(); // 浮动薪酬查询form + @observable VSSalaryItemForm = new WeaForm(); // 新增浮动薪酬项目form + @action initVSSalaryItemForm = () => this.VSSalaryItemForm = new WeaForm(); // 初始化操作 @action doInit = () => { this.getCondition(); this.getTableDatas(); - } + }; // 获得高级搜索表单数据 @action @@ -29,10 +33,10 @@ export class BaseTableStore { this.condition = res.condition; this.form.initFormFields(res.condition); // 渲染高级搜索form表单 } else { - message.error(res.msg || '接口调用失败!') + message.error(res.msg || "接口调用失败!"); } })); - } + }; // 渲染table数据 @action @@ -45,11 +49,11 @@ export class BaseTableStore { this.tableStore.getDatas(res.datas); // table 请求数据 this.hasRight = res.hasRight; } else { - message.error(res.msg || '接口调用失败!') + message.error(res.msg || "接口调用失败!"); } this.loading = false; })); - } + }; @action setShowSearchAd = bool => this.showSearchAd = bool; @@ -58,6 +62,6 @@ export class BaseTableStore { @action doSearch = () => { this.getTableDatas(); this.showSearchAd = false; - } + }; -} \ No newline at end of file +} From 70fe54efb74cf1a6a206e0580db144b278d091c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Thu, 8 Aug 2024 17:32:54 +0800 Subject: [PATCH 08/78] =?UTF-8?q?feature/2.15.1.2407.01-=E6=B5=AE=E5=8A=A8?= =?UTF-8?q?=E8=96=AA=E9=85=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/apis/variableSalary.js | 13 ++ .../components/advanceInputBtn/index.js | 6 +- .../components/advanceInputBtn/index.less | 3 +- .../components/salaryFileDialog/index.js | 112 ++++++++++++++++ .../components/salaryItemDialog/index.js | 31 ++--- .../components/salaryItemList/index.js | 113 ++++++++++++++++ .../pages/variableSalary/conditions.js | 121 +++++++++++++++++- .../hrmSalary/pages/variableSalary/index.js | 49 ++++++- .../hrmSalary/pages/variableSalary/index.less | 64 ++++++++- pc4mobx/hrmSalary/stores/baseTable.js | 5 +- pc4mobx/hrmSalary/style/index.less | 7 + 11 files changed, 491 insertions(+), 33 deletions(-) create mode 100644 pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileDialog/index.js create mode 100644 pc4mobx/hrmSalary/pages/variableSalary/components/salaryItemList/index.js diff --git a/pc4mobx/hrmSalary/apis/variableSalary.js b/pc4mobx/hrmSalary/apis/variableSalary.js index cdfdde70..2f214881 100644 --- a/pc4mobx/hrmSalary/apis/variableSalary.js +++ b/pc4mobx/hrmSalary/apis/variableSalary.js @@ -4,7 +4,20 @@ import { postFetch } from "../util/request"; export const getVariableSalaryItemList = params => { return postFetch("/api/bs/hrmsalary/variableSalaryItem/listPage", params); }; +//删除浮动薪酬项目 +export const deleteVariableSalaryItem = params => { + return postFetch("/api/bs/hrmsalary/variableSalaryItem/delete", params); +}; +//获取浮动薪酬项目详情 +export const getVariableSalaryItemDetail = params => { + return postFetch("/api/bs/hrmsalary/variableSalaryItem/getDetail", params); +}; //保存/更新 浮动薪酬项目 export const saveVariableSalaryItem = params => { return postFetch("/api/bs/hrmsalary/variableSalaryItem/save", params); }; + +//创建浮动薪酬档案时获取项目信息 +export const getCreateForm = params => { + return postFetch("/api/bs/hrmsalary/variableSalary/getCreateForm", params); +}; diff --git a/pc4mobx/hrmSalary/pages/variableSalary/components/advanceInputBtn/index.js b/pc4mobx/hrmSalary/pages/variableSalary/components/advanceInputBtn/index.js index 7e981704..9ef6b2d2 100644 --- a/pc4mobx/hrmSalary/pages/variableSalary/components/advanceInputBtn/index.js +++ b/pc4mobx/hrmSalary/pages/variableSalary/components/advanceInputBtn/index.js @@ -18,9 +18,9 @@ class Index extends Component { render() { const { baseTableStore: { VSalryForm }, searchType } = this.props; return ( -
- VSalryForm.updateFields({ keyword: v })} +
+ VSalryForm.updateFields({ username: v })} onSearch={this.props.onAdvanceSearch} /> { diff --git a/pc4mobx/hrmSalary/pages/variableSalary/components/advanceInputBtn/index.less b/pc4mobx/hrmSalary/pages/variableSalary/components/advanceInputBtn/index.less index 9081d39f..ba4f56fc 100644 --- a/pc4mobx/hrmSalary/pages/variableSalary/components/advanceInputBtn/index.less +++ b/pc4mobx/hrmSalary/pages/variableSalary/components/advanceInputBtn/index.less @@ -1,4 +1,4 @@ -.achrive-advance-search { +.salaryItem-advance-search { display: flex; align-items: center; position: relative; @@ -24,6 +24,5 @@ overflow: hidden; white-space: nowrap; text-overflow: ellipsis; - top: 1px; } } diff --git a/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileDialog/index.js b/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileDialog/index.js new file mode 100644 index 00000000..f29cae1a --- /dev/null +++ b/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileDialog/index.js @@ -0,0 +1,112 @@ +/* + * 浮动薪酬 + * 新建编辑薪资档案 + * @Author: 黎永顺 + * @Date: 2024/8/8 + * @Wechat: + * @Email: 971387674@qq.com + * @description: +*/ +import React, { Component } from "react"; +import { inject, observer } from "mobx-react"; +import { WeaLocaleProvider, WeaSlideModal, WeaTools } from "ecCom"; +import { Button, message } from "antd"; +import { getSearchs } from "../../../../util"; +import { salaryFileConditions } from "../../conditions"; +import * as API from "../../../../apis/variableSalary"; + +const getKey = WeaTools.getKey; +const getLabel = WeaLocaleProvider.getLabel; + +@inject("baseTableStore") +@observer +class Index extends Component { + constructor(props) { + super(props); + this.state = { + conditions: [], loading: false + }; + } + + componentWillReceiveProps(nextProps, nextContext) { + if (nextProps.visible !== this.props.visible && nextProps.visible) { + document.querySelector(".variable_salary_wrapper").classList.add("zIndex0-weaslide-title"); + this.initForm(nextProps); + } else if (nextProps.visible !== this.props.visible && !nextProps.visible) { + document.querySelector(".variable_salary_wrapper").classList.remove("zIndex0-weaslide-title"); + this.props.baseTableStore.initVSSalaryFileForm(); + } + } + + initForm = (props) => { + const { baseTableStore: { VSSalaryFileForm } } = props; + API.getCreateForm().then(({ status, data }) => { + this.setState({ + conditions: [ + ..._.map(salaryFileConditions, item => ({ + ...item, + items: _.map(item.items, o => ({ ...o, label: getLabel(o.lanId, o.label) })) + })), + { + items: _.map(data, o => ({ + conditionType: "INPUT", + domkey: [String(o.id)], + fieldcol: 14, + label: o.name, + labelcol: 6, + value: "", + viewAttr: 2 + })), + title: "", col: 2, + defaultshow: true + } + ] + }, () => VSSalaryFileForm.initFormFields(this.state.conditions)); + }); + }; + save = () => { + const { baseTableStore: { VSSalaryFileForm }, onSearch, id } = this.props; + VSSalaryFileForm.validateForm().then(f => { + if (f.isValid) { + const payload = VSSalaryFileForm.getFormParams(); + this.setState({ loading: true }); + API.saveVariableSalaryItem({ ...payload, id }) + .then(({ status, errormsg }) => { + this.setState({ loading: false }); + if (status) { + message.success(getLabel(30700, "操作成功")); + this.props.onCancel(onSearch()); + } else { + message.error(errormsg); + } + }).catch(() => this.setState({ loading: false })); + } else { + f.showErrors(); + } + }); + }; + renderTitle = () => { + const { loading } = this.state, { title } = this.props; + return
+
+
+
{title}
+
+
+ +
+
; + }; + + render() { + const { conditions, loading } = this.state; + const { baseTableStore: { VSSalaryFileForm }, onClose } = this.props; + return ( onClose()} + top={0} width={800} height={100} measureT="%" measureX="px" measureY="%" title={this.renderTitle()} + content={
{getSearchs(VSSalaryFileForm, conditions)}
} + />); + } +} + +export default Index; diff --git a/pc4mobx/hrmSalary/pages/variableSalary/components/salaryItemDialog/index.js b/pc4mobx/hrmSalary/pages/variableSalary/components/salaryItemDialog/index.js index 71eba98b..cc4d456d 100644 --- a/pc4mobx/hrmSalary/pages/variableSalary/components/salaryItemDialog/index.js +++ b/pc4mobx/hrmSalary/pages/variableSalary/components/salaryItemDialog/index.js @@ -39,20 +39,21 @@ class Index extends Component { }, () => VSSalaryItemForm.initFormFields(this.state.conditions)); }; save = () => { - const { baseTableStore: { VSSalaryItemForm }, onSearch } = this.props; + const { baseTableStore: { VSSalaryItemForm }, onSearch, id } = this.props; VSSalaryItemForm.validateForm().then(f => { if (f.isValid) { const payload = VSSalaryItemForm.getFormParams(); this.setState({ loading: true }); - API.saveVariableSalaryItem({ ...payload }).then(({ status, errormsg }) => { - this.setState({ loading: false }); - if (status) { - message.success(getLabel(30700, "操作成功")); - this.props.onCancel(onSearch()); - } else { - message.error(errormsg); - } - }).catch(() => this.setState({ loading: false })); + API.saveVariableSalaryItem({ ...payload, id }) + .then(({ status, errormsg }) => { + this.setState({ loading: false }); + if (status) { + message.success(getLabel(30700, "操作成功")); + this.props.onCancel(onSearch()); + } else { + message.error(errormsg); + } + }).catch(() => this.setState({ loading: false })); } else { f.showErrors(); } @@ -61,16 +62,16 @@ class Index extends Component { render() { const { conditions, loading } = this.state; - const { baseTableStore: { calculateForm } } = this.props; + const { baseTableStore: { VSSalaryItemForm } } = this.props; return ( {getLabel(111, "取消")}, - + , + ]} > -
{getSearchs(calculateForm, conditions, 1, false)}
+
{getSearchs(VSSalaryItemForm, conditions, 1, false)}
); } diff --git a/pc4mobx/hrmSalary/pages/variableSalary/components/salaryItemList/index.js b/pc4mobx/hrmSalary/pages/variableSalary/components/salaryItemList/index.js new file mode 100644 index 00000000..210df203 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/variableSalary/components/salaryItemList/index.js @@ -0,0 +1,113 @@ +/* + * 浮动薪酬 + * 薪资项目列表 + * @Author: 黎永顺 + * @Date: 2024/8/8 + * @Wechat: + * @Email: 971387674@qq.com + * @description: +*/ +import React, { Component } from "react"; +import { WeaLocaleProvider, WeaTable } from "ecCom"; +import { message, Modal } from "antd"; +import * as API from "../../../../apis/variableSalary"; + +const getLabel = WeaLocaleProvider.getLabel; + +class Index extends Component { + constructor(props) { + super(props); + this.state = { + pageInfo: { current: 1, pageSize: 10, total: 0 }, loading: false, dataSource: [], columns: [] + }; + } + + componentDidMount() { + this.getVariableSalaryItemList(); + } + + componentWillReceiveProps(nextProps, nextContext) { + if (nextProps.isQuery !== this.props.isQuery) this.setState({ + pageInfo: { ...this.state.pageInfo, current: 1 } + }, () => this.getVariableSalaryItemList()); + } + + getVariableSalaryItemList = () => { + const { baseTableStore: { VSalryForm } } = this.props; + const { pageInfo } = this.state; + const { username: itemName } = VSalryForm.getFormParams(); + this.setState({ loading: true }); + API.getVariableSalaryItemList({ ...pageInfo, itemName }).then(({ status, data }) => { + this.setState({ loading: false }); + if (status) { + const { list: dataSource, columns, pageNum: current, pageSize, total } = data; + this.setState({ + pageInfo: { ...pageInfo, current, pageSize, total }, dataSource, + columns: [ + ..._.filter(columns, o => o.dataIndex !== "id"), + { + title: getLabel(111, "操作"), dataIndex: "oprate", + render: (__, record) => ( + this.handleEdit(record.id)}>{getLabel(111, "编辑")} + { + record.canDelete && this.handleDelete([record.id])}>{getLabel(111, "删除")} + } + ) + } + ] + } + ); + } + }); + }; + handleEdit = (id) => { + API.getVariableSalaryItemDetail({ id }).then(({ status, data }) => { + if (status) this.props.onEditSalaryItem(data); + }); + }; + handleDelete = (itemIds) => { + Modal.confirm({ + title: getLabel(111, "信息确认"), + content: getLabel(111, "确认删除吗?"), + onOk: () => { + API.deleteVariableSalaryItem({ itemIds }).then(({ status, errormsg }) => { + if (status) { + message.success(getLabel(111, "删除成功")); + this.getVariableSalaryItemList(); + } else { + message.error(errormsg); + } + }); + } + }); + }; + + render() { + const { columns, dataSource, loading, pageInfo } = this.state; + const pagination = { + ...pageInfo, + showTotal: total => `${getLabel(18609, "共")} ${total} ${getLabel(18256, "条")}`, + showQuickJumper: true, + showSizeChanger: true, + pageSizeOptions: ["10", "20", "50", "100"], + onShowSizeChange: (current, pageSize) => { + this.setState({ + pageInfo: { ...pageInfo, current, pageSize } + }, () => this.getVariableSalaryItemList()); + }, + onChange: current => { + this.setState({ + pageInfo: { ...pageInfo, current } + }, () => this.getVariableSalaryItemList()); + } + }; + return ( + + ); + } +} + +export default Index; diff --git a/pc4mobx/hrmSalary/pages/variableSalary/conditions.js b/pc4mobx/hrmSalary/pages/variableSalary/conditions.js index ae943a2d..49ca43de 100644 --- a/pc4mobx/hrmSalary/pages/variableSalary/conditions.js +++ b/pc4mobx/hrmSalary/pages/variableSalary/conditions.js @@ -3,13 +3,75 @@ export const conditions = [ items: [ { conditionType: "INPUT", - domkey: ["dimName"], + domkey: ["itemName"], fieldcol: 14, - label: "测试", + label: "项目名称", + lanId: 111, labelcol: 6, value: "", - rules: "required|string", - viewAttr: 3 + hide: true, + viewAttr: 2 + }, + { + conditionType: "INPUT", + domkey: ["username"], + fieldcol: 14, + label: "名称", + lanId: 111, + labelcol: 6, + value: "", + viewAttr: 2 + }, + { + conditionType: "MONTHPICKER", + domkey: ["salaryMonth"], + fieldcol: 14, + label: "薪资所属月", + lanId: 111, + labelcol: 6, + value: "", + viewAttr: 2 + }, + { + browserConditionParam: { + completeParams: {}, + conditionDataParams: {}, + dataParams: {}, + destDataParams: {}, + hasAddBtn: false, + hasAdvanceSerach: false, + idSeparator: ",", + isAutoComplete: 1, + isDetail: 0, + isMultCheckbox: false, + isSingle: false, + icon: "icon-coms-hrm", + linkUrl: "", + pageSize: 10, + quickSearchName: "", + replaceDatas: [], + title: "", + type: "57", + viewAttr: 2 + }, + conditionType: "BROWSER", + domkey: ["departmentIds"], + fieldcol: 14, + label: "部门", + lanId: 111, + labelcol: 6, + value: "", + viewAttr: 2 + }, + { + conditionType: "INPUT", + domkey: ["workcode"], + fieldcol: 14, + label: "工号", + lanId: 111, + labelcol: 6, + value: "", + viewAttr: 2 } ], title: "", @@ -50,3 +112,54 @@ export const salaryItemsConditions = [ defaultshow: true } ]; +export const salaryFileConditions = [ + { + items: [ + { + conditionType: "MONTHPICKER", + domkey: ["salaryMonth"], + fieldcol: 14, + label: "薪资所属月", + lanId: 111, + labelcol: 6, + value: "", + rules: "required|string", + viewAttr: 3 + }, + { + browserConditionParam: { + completeParams: {}, + conditionDataParams: {}, + dataParams: {}, + destDataParams: {}, + hasAddBtn: false, + hasAdvanceSerach: false, + idSeparator: ",", + isAutoComplete: 1, + isDetail: 0, + isMultCheckbox: false, + isSingle: true, + icon: "icon-coms-hrm", + linkUrl: "", + pageSize: 10, + quickSearchName: "", + replaceDatas: [], + title: "", + type: "1", + viewAttr: 2 + }, + conditionType: "BROWSER", + domkey: ["employeeId"], + fieldcol: 14, + label: "人员", + lanId: 111, + labelcol: 6, + value: "", + rules: "required|string", + viewAttr: 3 + } + ], + title: "", col: 1, + defaultshow: true + } +]; diff --git a/pc4mobx/hrmSalary/pages/variableSalary/index.js b/pc4mobx/hrmSalary/pages/variableSalary/index.js index abf682d3..bc73021f 100644 --- a/pc4mobx/hrmSalary/pages/variableSalary/index.js +++ b/pc4mobx/hrmSalary/pages/variableSalary/index.js @@ -13,8 +13,11 @@ import { WeaLocaleProvider, WeaReqTop } from "ecCom"; import AdvanceInputBtn from "./components/advanceInputBtn"; import SearchPannel from "./components/searchPannel"; import SalaryItemDialog from "./components/salaryItemDialog"; +import SalaryFileDialog from "./components/salaryFileDialog"; +import SalaryItemList from "./components/salaryItemList"; import { Button } from "antd"; import cs from "classnames"; +import "./index.less"; const getLabel = WeaLocaleProvider.getLabel; @@ -24,29 +27,55 @@ class Index extends Component { constructor(props) { super(props); this.state = { - selectedKey: "salaryFile", isQuery: false, - SIDialog: { visible: false, title: "" } //薪资项目薪资编辑弹框 + selectedKey: "salaryFile", isQuery: false, showSearchAd: false, + SIDialog: { visible: false, title: "", id: "" }, //薪资项目薪资编辑弹框 + SFDialog: { visible: false, title: "", id: "" } //薪资档案编辑弹框 }; } handleAdvanceSearch = () => this.setState({ isQuery: !this.state.isQuery }); + openAdvanceSearch = () => this.setState({ showSearchAd: !this.state.showSearchAd }); + handleOperate = (type) => { + switch (type) { + case "create": + this.setState({ + SFDialog: { visible: true, id: "", title: getLabel(111, "新增薪资档案") } + }); + break; + default: + break; + } + }; render() { - const { selectedKey, SIDialog } = this.state; - const { taxAgentStore: { showOperateBtn } } = this.props; + const { selectedKey, SIDialog, SFDialog, showSearchAd, isQuery } = this.state; + const { taxAgentStore: { showOperateBtn }, baseTableStore: { VSSalaryItemForm } } = this.props; const tabs = [ { title: getLabel(111, "薪资档案"), key: "salaryFile", - buttons: showOperateBtn ? [] : [] + buttons: showOperateBtn ? [ + , + , + , + this.openAdvanceSearch()} + onAdvanceSearch={this.handleAdvanceSearch}/> + ] : [ this.openAdvanceSearch()} + onAdvanceSearch={this.handleAdvanceSearch}/>], + children: null }, { title: getLabel(111, "薪资项目"), key: "salaryItem", buttons: showOperateBtn ? [ , - ] : [] + ] : [], + children: this.setState({ + SIDialog: { visible: true, id: data.id, title: getLabel(111, "编辑薪资项目") } + }, () => VSSalaryItemForm.updateFields({ + name: data.name, dataType: data.dataType + }))}/> } ]; return ( @@ -60,9 +89,15 @@ class Index extends Component {
this.setState({ showSearchAd: false })} onAdSearch={this.onAdSearch}/>
+ {_.find(tabs, o => selectedKey === o.key).children} + {/*薪资项目*/} this.setState({ SIDialog: { ...SIDialog, visible: false } }, () => callback && callback())}/> + {/*薪资档案*/} + this.setState({ + SFDialog: { ...SFDialog, visible: false } + }, () => callback && callback())}/> ); } diff --git a/pc4mobx/hrmSalary/pages/variableSalary/index.less b/pc4mobx/hrmSalary/pages/variableSalary/index.less index a487afd7..1c1dd906 100644 --- a/pc4mobx/hrmSalary/pages/variableSalary/index.less +++ b/pc4mobx/hrmSalary/pages/variableSalary/index.less @@ -1,4 +1,17 @@ .variable_salary_wrapper { + .wea-new-top-req-title > div:last-child { + right: 16px !important; + } + + .wea-new-top-req-content { + padding: 16px; + + .wea-new-table { + background: #FFF; + } + + } + .searchAdvanced-condition-hide { display: none; } @@ -14,7 +27,7 @@ } .wea-advanced-searchsAd { - height: 155px; + height: 108px; overflow: hidden auto; .formItem-delete { @@ -42,4 +55,53 @@ } } + + .variable_salary_file_dialog { + .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:last-child { + margin-left: 10px; + } + } + } + } } diff --git a/pc4mobx/hrmSalary/stores/baseTable.js b/pc4mobx/hrmSalary/stores/baseTable.js index 75106e3a..8598d0cb 100644 --- a/pc4mobx/hrmSalary/stores/baseTable.js +++ b/pc4mobx/hrmSalary/stores/baseTable.js @@ -16,8 +16,11 @@ export class BaseTableStore { // 浮动薪酬相关 @observable VSalryForm = new WeaForm(); // 浮动薪酬查询form - @observable VSSalaryItemForm = new WeaForm(); // 新增浮动薪酬项目form + @observable VSSalaryItemForm = new WeaForm(); // 新增编辑浮动薪酬项目form @action initVSSalaryItemForm = () => this.VSSalaryItemForm = new WeaForm(); + @observable VSSalaryFileForm = new WeaForm(); // 新增编辑薪资档案form + @action initVSSalaryFileForm = () => this.VSSalaryFileForm = new WeaForm(); + // 初始化操作 @action doInit = () => { diff --git a/pc4mobx/hrmSalary/style/index.less b/pc4mobx/hrmSalary/style/index.less index 4ce6ef7a..ea74c23c 100644 --- a/pc4mobx/hrmSalary/style/index.less +++ b/pc4mobx/hrmSalary/style/index.less @@ -83,3 +83,10 @@ } +//公共slide框标题样式 +.zIndex0-weaslide-title { + .wea-new-top-req { + z-index: 0 !important; + } +} + From 86de787ed4512759de1355401275a9c823a9e4ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Thu, 8 Aug 2024 18:24:45 +0800 Subject: [PATCH 09/78] =?UTF-8?q?feature/2.15.1.2407.01-=E6=B5=AE=E5=8A=A8?= =?UTF-8?q?=E8=96=AA=E9=85=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/apis/variableSalary.js | 8 ++ .../components/salaryFileDialog/index.js | 12 +- .../components/salaryFileList/index.js | 118 ++++++++++++++++++ .../pages/variableSalary/conditions.js | 12 +- .../hrmSalary/pages/variableSalary/index.js | 17 ++- .../hrmSalary/pages/variableSalary/index.less | 4 + 6 files changed, 154 insertions(+), 17 deletions(-) create mode 100644 pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileList/index.js diff --git a/pc4mobx/hrmSalary/apis/variableSalary.js b/pc4mobx/hrmSalary/apis/variableSalary.js index 2f214881..04bbeb02 100644 --- a/pc4mobx/hrmSalary/apis/variableSalary.js +++ b/pc4mobx/hrmSalary/apis/variableSalary.js @@ -21,3 +21,11 @@ export const saveVariableSalaryItem = params => { export const getCreateForm = params => { return postFetch("/api/bs/hrmsalary/variableSalary/getCreateForm", params); }; +//创建浮动薪酬档案 +export const createVariableSalary = params => { + return postFetch("/api/bs/hrmsalary/variableSalary/createData", params); +}; +//创建浮动薪酬档案 +export const getVariableSalaryList = params => { + return postFetch("/api/bs/hrmsalary/variableSalary/list", params); +}; diff --git a/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileDialog/index.js b/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileDialog/index.js index f29cae1a..6297a558 100644 --- a/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileDialog/index.js +++ b/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileDialog/index.js @@ -64,13 +64,23 @@ class Index extends Component { }, () => VSSalaryFileForm.initFormFields(this.state.conditions)); }); }; + convertPayload = (payload) => { + return _.reduce(_.keys(payload), (pre, cur) => { + if (!_.isNaN(parseInt(cur))) { + return { ...pre, itemValueList: [{ variableItemId: cur, itemValue: payload[cur] }] }; + } + return { ...pre, [cur]: payload[cur] }; + }, {}); + }; save = () => { const { baseTableStore: { VSSalaryFileForm }, onSearch, id } = this.props; VSSalaryFileForm.validateForm().then(f => { if (f.isValid) { const payload = VSSalaryFileForm.getFormParams(); + console.log(payload); + return; this.setState({ loading: true }); - API.saveVariableSalaryItem({ ...payload, id }) + API.createVariableSalary({ ...payload, id }) .then(({ status, errormsg }) => { this.setState({ loading: false }); if (status) { diff --git a/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileList/index.js b/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileList/index.js new file mode 100644 index 00000000..6ec040bb --- /dev/null +++ b/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileList/index.js @@ -0,0 +1,118 @@ +/* + * 浮动薪酬 + * 薪资档案列表 + * @Author: 黎永顺 + * @Date: 2024/8/8 + * @Wechat: + * @Email: 971387674@qq.com + * @description: +*/ +import React, { Component } from "react"; +import { WeaLocaleProvider, WeaTable } from "ecCom"; +import { message, Modal } from "antd"; +import * as API from "../../../../apis/variableSalary"; + +const getLabel = WeaLocaleProvider.getLabel; + +class Index extends Component { + constructor(props) { + super(props); + this.state = { + pageInfo: { current: 1, pageSize: 10, total: 0 }, loading: false, dataSource: [], columns: [] + }; + } + + componentDidMount() { + this.getVariableSalaryList(); + } + + componentWillReceiveProps(nextProps, nextContext) { + if (nextProps.isQuery !== this.props.isQuery) this.setState({ + pageInfo: { ...this.state.pageInfo, current: 1 } + }, () => this.getVariableSalaryList()); + } + + getVariableSalaryList = () => { + const { baseTableStore: { VSalryForm }, salaryMonth } = this.props; + const { pageInfo } = this.state; + const { departmentIds } = VSalryForm.getFormParams(); + console.log(VSalryForm.getFormParams()); + this.setState({ loading: true }); + API.getVariableSalaryList({ + ...pageInfo, salaryMonth, ...VSalryForm.getFormParams(), + departmentIds: !_.isEmpty(departmentIds) ? departmentIds.split(",") : [] + }) + .then(({ status, data }) => { + this.setState({ loading: false }); + if (status) { + const { list: dataSource, columns, pageNum: current, pageSize, total } = data; + this.setState({ + pageInfo: { ...pageInfo, current, pageSize, total }, dataSource, + columns: [ + ..._.filter(columns, o => o.dataIndex !== "id"), + { + title: getLabel(111, "操作"), dataIndex: "oprate", + render: (__, record) => ( + this.handleEdit(record.id)}>{getLabel(111, "编辑")} + { + record.canDelete && this.handleDelete([record.id])}>{getLabel(111, "删除")} + } + ) + } + ] + } + ); + } + }); + }; + handleEdit = (id) => { + API.getVariableSalaryItemDetail({ id }).then(({ status, data }) => { + if (status) this.props.onEditSalaryItem(data); + }); + }; + handleDelete = (itemIds) => { + Modal.confirm({ + title: getLabel(111, "信息确认"), + content: getLabel(111, "确认删除吗?"), + onOk: () => { + API.deleteVariableSalaryItem({ itemIds }).then(({ status, errormsg }) => { + if (status) { + message.success(getLabel(111, "删除成功")); + this.getVariableSalaryItemList(); + } else { + message.error(errormsg); + } + }); + } + }); + }; + + render() { + const { columns, dataSource, loading, pageInfo } = this.state; + const pagination = { + ...pageInfo, + showTotal: total => `${getLabel(18609, "共")} ${total} ${getLabel(18256, "条")}`, + showQuickJumper: true, + showSizeChanger: true, + pageSizeOptions: ["10", "20", "50", "100"], + onShowSizeChange: (current, pageSize) => { + this.setState({ + pageInfo: { ...pageInfo, current, pageSize } + }, () => this.getVariableSalaryList()); + }, + onChange: current => { + this.setState({ + pageInfo: { ...pageInfo, current } + }, () => this.getVariableSalaryList()); + } + }; + return ( + + ); + } +} + +export default Index; diff --git a/pc4mobx/hrmSalary/pages/variableSalary/conditions.js b/pc4mobx/hrmSalary/pages/variableSalary/conditions.js index 49ca43de..98ecd684 100644 --- a/pc4mobx/hrmSalary/pages/variableSalary/conditions.js +++ b/pc4mobx/hrmSalary/pages/variableSalary/conditions.js @@ -22,16 +22,6 @@ export const conditions = [ value: "", viewAttr: 2 }, - { - conditionType: "MONTHPICKER", - domkey: ["salaryMonth"], - fieldcol: 14, - label: "薪资所属月", - lanId: 111, - labelcol: 6, - value: "", - viewAttr: 2 - }, { browserConditionParam: { completeParams: {}, @@ -145,7 +135,7 @@ export const salaryFileConditions = [ quickSearchName: "", replaceDatas: [], title: "", - type: "1", + type: "17", viewAttr: 2 }, conditionType: "BROWSER", diff --git a/pc4mobx/hrmSalary/pages/variableSalary/index.js b/pc4mobx/hrmSalary/pages/variableSalary/index.js index bc73021f..5035381c 100644 --- a/pc4mobx/hrmSalary/pages/variableSalary/index.js +++ b/pc4mobx/hrmSalary/pages/variableSalary/index.js @@ -9,12 +9,14 @@ */ import React, { Component } from "react"; import { inject, observer } from "mobx-react"; -import { WeaLocaleProvider, WeaReqTop } from "ecCom"; +import { WeaDatePicker, WeaLocaleProvider, WeaReqTop } from "ecCom"; import AdvanceInputBtn from "./components/advanceInputBtn"; import SearchPannel from "./components/searchPannel"; import SalaryItemDialog from "./components/salaryItemDialog"; import SalaryFileDialog from "./components/salaryFileDialog"; import SalaryItemList from "./components/salaryItemList"; +import SalaryFileList from "./components/salaryFileList"; +import moment from "moment"; import { Button } from "antd"; import cs from "classnames"; import "./index.less"; @@ -28,6 +30,7 @@ class Index extends Component { super(props); this.state = { selectedKey: "salaryFile", isQuery: false, showSearchAd: false, + salaryMonth: moment(new Date()).format("YYYY-MM"), SIDialog: { visible: false, title: "", id: "" }, //薪资项目薪资编辑弹框 SFDialog: { visible: false, title: "", id: "" } //薪资档案编辑弹框 }; @@ -48,7 +51,7 @@ class Index extends Component { }; render() { - const { selectedKey, SIDialog, SFDialog, showSearchAd, isQuery } = this.state; + const { selectedKey, SIDialog, SFDialog, showSearchAd, isQuery, salaryMonth } = this.state; const { taxAgentStore: { showOperateBtn }, baseTableStore: { VSSalaryItemForm } } = this.props; const tabs = [ { @@ -57,11 +60,15 @@ class Index extends Component { , , , + this.setState({ salaryMonth: val })}/>, this.openAdvanceSearch()} onAdvanceSearch={this.handleAdvanceSearch}/> - ] : [ this.openAdvanceSearch()} - onAdvanceSearch={this.handleAdvanceSearch}/>], - children: null + ] : [ + this.setState({ salaryMonth: val })}/>, + this.openAdvanceSearch()} + onAdvanceSearch={this.handleAdvanceSearch}/> + ], + children: }, { title: getLabel(111, "薪资项目"), key: "salaryItem", diff --git a/pc4mobx/hrmSalary/pages/variableSalary/index.less b/pc4mobx/hrmSalary/pages/variableSalary/index.less index 1c1dd906..26e8d09d 100644 --- a/pc4mobx/hrmSalary/pages/variableSalary/index.less +++ b/pc4mobx/hrmSalary/pages/variableSalary/index.less @@ -57,6 +57,10 @@ } .variable_salary_file_dialog { + .scroller { + background: #f6f6f6 !important; + } + .wea-slide-modal-title { border-bottom: 1px solid #e5e5e5 !important; } From 9d99557f4b65f04a5e82ef01dfa414c00836e5a0 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, 12 Aug 2024 09:24:11 +0800 Subject: [PATCH 10/78] =?UTF-8?q?feature/2.15.1.2407.01-=E6=B5=AE=E5=8A=A8?= =?UTF-8?q?=E8=96=AA=E9=85=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/apis/variableSalary.js | 13 ++ .../components/salaryFileDialog/index.js | 31 +++- .../salaryFileImportDialog/index.js | 94 +++++++++++ .../components/salaryFileList/index.js | 159 +++++++++++------- .../hrmSalary/pages/variableSalary/index.js | 40 ++++- .../hrmSalary/pages/variableSalary/index.less | 4 + pc4mobx/hrmSalary/stores/baseTable.js | 20 +++ 7 files changed, 288 insertions(+), 73 deletions(-) create mode 100644 pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileImportDialog/index.js diff --git a/pc4mobx/hrmSalary/apis/variableSalary.js b/pc4mobx/hrmSalary/apis/variableSalary.js index 04bbeb02..c3e3f20a 100644 --- a/pc4mobx/hrmSalary/apis/variableSalary.js +++ b/pc4mobx/hrmSalary/apis/variableSalary.js @@ -29,3 +29,16 @@ export const createVariableSalary = params => { export const getVariableSalaryList = params => { return postFetch("/api/bs/hrmsalary/variableSalary/list", params); }; +//导入浮动薪酬档案 +export const importVariableSalary = params => { + return postFetch("/api/bs/hrmsalary/variableSalary/importData", params); +}; +//删除浮动薪酬档案 +export const deleteVariableSalary = params => { + return postFetch("/api/bs/hrmsalary/variableSalary/deleteSelectData", params); +}; +//获取浮动薪酬档案明细 +export const getVariableSalaryDetail = params => { + return postFetch("/api/bs/hrmsalary/variableSalary/getDetail", params); +}; + diff --git a/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileDialog/index.js b/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileDialog/index.js index 6297a558..f38f45a4 100644 --- a/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileDialog/index.js +++ b/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileDialog/index.js @@ -39,13 +39,16 @@ class Index extends Component { } initForm = (props) => { - const { baseTableStore: { VSSalaryFileForm } } = props; + const { baseTableStore: { VSSalaryFileForm }, detail } = props; API.getCreateForm().then(({ status, data }) => { this.setState({ conditions: [ ..._.map(salaryFileConditions, item => ({ ...item, - items: _.map(item.items, o => ({ ...o, label: getLabel(o.lanId, o.label) })) + items: _.map(item.items, o => ({ + ...o, viewAttr: !_.isEmpty(detail) ? 1 : 2, label: getLabel(o.lanId, o.label), + value: detail[getKey(o)] || "" + })) })), { items: _.map(data, o => ({ @@ -54,14 +57,25 @@ class Index extends Component { fieldcol: 14, label: o.name, labelcol: 6, - value: "", - viewAttr: 2 + value: detail[`${String(o.id)}_variableItem`] || "", + viewAttr: !_.isEmpty(detail) ? 1 : 2 })), title: "", col: 2, defaultshow: true } ] - }, () => VSSalaryFileForm.initFormFields(this.state.conditions)); + }, () => { + VSSalaryFileForm.initFormFields(this.state.conditions); + if (!_.isEmpty(detail)) { + VSSalaryFileForm.updateFields({ + employeeId: { + value: detail["employeeId"], + valueSpan: detail["username"], + valueObj: [{ id: detail["employeeId"], name: detail["username"] }] + } + }); + } + }); }); }; convertPayload = (payload) => { @@ -96,14 +110,17 @@ class Index extends Component { }); }; renderTitle = () => { - const { loading } = this.state, { title } = this.props; + const { loading } = this.state, { title, detail } = this.props; return
{title}
- + { + _.isEmpty(detail) && + + }
; }; diff --git a/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileImportDialog/index.js b/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileImportDialog/index.js new file mode 100644 index 00000000..5b8f023d --- /dev/null +++ b/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileImportDialog/index.js @@ -0,0 +1,94 @@ +/* + * 浮动薪酬 + * 薪资档案导入 + * @Author: 黎永顺 + * @Date: 2024/8/8 + * @Wechat: + * @Email: 971387674@qq.com + * @description: +*/ +import React, { Component } from "react"; +import { WeaCheckbox, WeaLocaleProvider } from "ecCom"; +import ImportDialog from "../../../../components/importDialog"; +import * as API from "../../../../apis/variableSalary"; +import { convertToUrlString } from "../../../../util/url"; + +const getLabel = WeaLocaleProvider.getLabel; + +class Index extends Component { + constructor(props) { + super(props); + this.state = { + importDialog: { + nextloading: false, link: "/api/bs/hrmsalary/variableSalary/downloadTemplate", + importResult: {}, imageId: "", hasData: false, + previewUrl: "/api/bs/hrmsalary/variableSalary/preview" + } + }; + } + + componentWillReceiveProps(nextProps, nextContext) { + const { importDialog } = this.state; + if (nextProps.visible !== this.props.visible && nextProps.visible) { + const { baseTableStore: { VSalryForm }, salaryMonth } = nextProps; + const payload = { + salaryMonth, ...VSalryForm.getFormParams(), hasData: importDialog.hasData + }; + this.setState({ importDialog: { ...importDialog, link: `${importDialog.link}?${convertToUrlString(payload)}` } }); + } else { + this.setState({ + importDialog: { + nextloading: false, link: "/api/bs/hrmsalary/variableSalary/downloadTemplate", hasData: false, + importResult: {}, imageId: "", previewUrl: "/api/bs/hrmsalary/variableSalary/preview" + } + }); + } + } + + handleImport = (payload) => { + const { salaryMonth } = this.props; + const { importDialog } = this.state; + this.setState({ importDialog: { ...importDialog, nextloading: true } }); + API.importVariableSalary({ ...payload, salaryMonth }).then(({ data, status }) => { + this.setState({ importDialog: { ...importDialog, nextloading: false } }); + if (status) { + this.setState({ + importDialog: { ...importDialog, ...payload, importResult: data } + }); + } + }).catch(() => this.setState({ importDialog: { ...importDialog, nextloading: false } })); + }; + + render() { + const { importDialog } = this.state; + return ( + this.setState({ + importDialog: { ...importDialog, importResult: {}, imageId: "", link: null } + })} + exportDataDom={ + { + const { baseTableStore: { VSalryForm }, salaryMonth } = this.props; + const payload = { salaryMonth, ...VSalryForm.getFormParams(), hasData: val === "1" }; + this.setState({ + importDialog: { + ...importDialog, hasData: val === "1", + link: `/api/bs/hrmsalary/variableSalary/downloadTemplate?${convertToUrlString(payload)}` + } + }); + }} + /> + } + nextCallback={imageId => this.setState({ importDialog: { ...importDialog, imageId } })} + nextUplaodCallback={imageId => this.handleImport({ imageId })} + /> + ); + } +} + +export default Index; diff --git a/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileList/index.js b/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileList/index.js index 6ec040bb..0756b644 100644 --- a/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileList/index.js +++ b/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileList/index.js @@ -8,10 +8,13 @@ * @description: */ import React, { Component } from "react"; -import { WeaLocaleProvider, WeaTable } from "ecCom"; -import { message, Modal } from "antd"; +import { WeaLocaleProvider } from "ecCom"; +import { WeaTableNew } from "comsMobx"; +import { message, Modal, Spin } from "antd"; import * as API from "../../../../apis/variableSalary"; +import { toJS } from "mobx"; +const WeaTableComx = WeaTableNew.WeaTable; const getLabel = WeaLocaleProvider.getLabel; class Index extends Component { @@ -23,64 +26,78 @@ class Index extends Component { } componentDidMount() { + window.addEventListener("message", this.handleReceive, false); + window.addEventListener("resize", this.handleResize, false); this.getVariableSalaryList(); } + componentWillUnmount() { + window.removeEventListener("message", this.handleReceive, false); + window.removeEventListener("resize", this.handleResize, false); + } + componentWillReceiveProps(nextProps, nextContext) { if (nextProps.isQuery !== this.props.isQuery) this.setState({ pageInfo: { ...this.state.pageInfo, current: 1 } }, () => this.getVariableSalaryList()); } + handleReceive = async ({ data }) => { + const { type, payload: { id, params } = {} } = data; + if (type === "init") { + this.getColumns(); + } else if (type === "turn") { + switch (id) { + case "PAGEINFO": + this.setState({ + pageInfo: { ...this.state.pageInfo, ...params } + }, () => this.getVariableSalaryList()); + break; + case "DEL": + this.handleDelete([params.id]); + break; + case "VIEW": + this.handleView(params.id); + break; + default: + break; + } + } + }; getVariableSalaryList = () => { - const { baseTableStore: { VSalryForm }, salaryMonth } = this.props; + const { baseTableStore: { VSalryForm, getVariableSalaryList }, salaryMonth } = this.props; const { pageInfo } = this.state; const { departmentIds } = VSalryForm.getFormParams(); - console.log(VSalryForm.getFormParams()); this.setState({ loading: true }); - API.getVariableSalaryList({ + getVariableSalaryList({ ...pageInfo, salaryMonth, ...VSalryForm.getFormParams(), departmentIds: !_.isEmpty(departmentIds) ? departmentIds.split(",") : [] - }) - .then(({ status, data }) => { - this.setState({ loading: false }); - if (status) { - const { list: dataSource, columns, pageNum: current, pageSize, total } = data; - this.setState({ - pageInfo: { ...pageInfo, current, pageSize, total }, dataSource, - columns: [ - ..._.filter(columns, o => o.dataIndex !== "id"), - { - title: getLabel(111, "操作"), dataIndex: "oprate", - render: (__, record) => ( - this.handleEdit(record.id)}>{getLabel(111, "编辑")} - { - record.canDelete && this.handleDelete([record.id])}>{getLabel(111, "删除")} - } - ) - } - ] - } - ); - } - }); - }; - handleEdit = (id) => { - API.getVariableSalaryItemDetail({ id }).then(({ status, data }) => { - if (status) this.props.onEditSalaryItem(data); + }).then(({ status, data }) => { + this.setState({ loading: false }); + if (status) { + const { pageInfo: result } = data; + const { list: dataSource, pageNum: current, pageSize, total } = result; + this.setState({ + pageInfo: { ...pageInfo, current, pageSize, total }, dataSource + } + ); + } }); }; - handleDelete = (itemIds) => { + handleView = (id) => { + API.getVariableSalaryDetail({ id }).then(({ status, data }) => { + if (status) this.props.onViewSalaryFile(data.data); + }); + }; + handleDelete = (ids) => { Modal.confirm({ title: getLabel(111, "信息确认"), content: getLabel(111, "确认删除吗?"), onOk: () => { - API.deleteVariableSalaryItem({ itemIds }).then(({ status, errormsg }) => { + API.deleteVariableSalary({ ids }).then(({ status, errormsg }) => { if (status) { message.success(getLabel(111, "删除成功")); - this.getVariableSalaryItemList(); + this.getVariableSalaryList(); } else { message.error(errormsg); } @@ -88,29 +105,57 @@ class Index extends Component { } }); }; + getColumns = () => { + const { baseTableStore: { SFTableStore }, showOperateBtn } = this.props; + const columns = _.map(_.filter(toJS(SFTableStore.columns), (item) => item.display === "true"), (it, idx) => ({ + dataIndex: it.dataIndex, title: it.title, align: "left", + width: 150, ellipsis: true + })); + if (!_.isEmpty(columns)) { + this.postMessageToChild({ + columns, showOperateBtn, dataSource: this.state.dataSource, scrollHeight: 100, + pageInfo: this.state.pageInfo, unitTableType: "variableSalary" + }); + } + return columns; + }; + postMessageToChild = (payload = {}) => { + const i18n = { + "操作": getLabel(30585, "操作"), "查看详情": getLabel(111, "查看详情"), + "共": getLabel(18609, "共"), "条": getLabel(18256, "条"), + "删除": getLabel(111, "删除") + }; + const childFrameObj = document.getElementById("unitTable"); + childFrameObj && childFrameObj.contentWindow.postMessage(JSON.stringify({ ...payload, i18n }), "*"); + }; render() { - const { columns, dataSource, loading, pageInfo } = this.state; - const pagination = { - ...pageInfo, - showTotal: total => `${getLabel(18609, "共")} ${total} ${getLabel(18256, "条")}`, - showQuickJumper: true, - showSizeChanger: true, - pageSizeOptions: ["10", "20", "50", "100"], - onShowSizeChange: (current, pageSize) => { - this.setState({ - pageInfo: { ...pageInfo, current, pageSize } - }, () => this.getVariableSalaryList()); - }, - onChange: current => { - this.setState({ - pageInfo: { ...pageInfo, current } - }, () => this.getVariableSalaryList()); - } - }; + const { loading, dataSource } = this.state; + const { baseTableStore: { SFTableStore } } = this.props; + const dom = document.querySelector(".wea-new-top-req-content"); + let height = 280; + if (dom && dataSource.length > 0) { + height = (parseFloat(dom.style.height) > 620 && dataSource.length === 10) ? dataSource.length * 39 + 113 : dataSource.length < 10 ? dataSource.length * 39 + 113 : parseFloat(dom.style.height) - 16; + } return ( - + +
+ +