diff --git a/pc4mobx/hrmSalary/apis/taxAgent.js b/pc4mobx/hrmSalary/apis/taxAgent.js index f3c527b1..4b3647ab 100644 --- a/pc4mobx/hrmSalary/apis/taxAgent.js +++ b/pc4mobx/hrmSalary/apis/taxAgent.js @@ -12,7 +12,7 @@ export const taxAgentRangeSync = (params) => { // 系统管理员权限 export const getPermission = (params) => { - return WeaTools.callApi("/api/bs/hrmsalary/taxAgent/permission", "GET", params); + return WeaTools.callApi("/api/bs/hrmsalary/auth/permission", "GET", params); }; //获取个税扣缴义务人表单 @@ -98,3 +98,61 @@ export const getTaxAgentSelectListAsAdmin = (params) => { export const hasIconInTax = (params) => { return WeaTools.callApi("/api/bs/hrmsalary/sys/conf/code?code=hideIconInTax", "GET", params); }; + +/**权限-角色相关*/ +//角色列表 +export const getRoleList = (params) => { + return postFetch("/api/bs/hrmsalary/auth/role/list", 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); +}; +//成员列表 +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 deleteAuthMember = (params) => { + return postFetch("/api/bs/hrmsalary/auth/member/delete", params); +}; +//删除数据 +export const deleteAuthData = (params) => { + return postFetch("/api/bs/hrmsalary/auth/data/delete", 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); +}; +//同步成员 +export const syncAuthMember = (params) => { + return postFetch("/api/bs/hrmsalary/auth/member/sync", params); +}; +//保存权限 +export const saveAuthOpt = (params) => { + return postFetch("/api/bs/hrmsalary/auth/opt/save", params); +}; +//权限项 +export const getAuthOptTree = (params) => { + return WeaTools.callApi("/api/bs/hrmsalary/auth/opt/tree", "GET", params); +}; +//业务线详情 +export const getRole = (params) => { + return WeaTools.callApi("/api/bs/hrmsalary/auth/role/getRole", "GET", params); +}; diff --git a/pc4mobx/hrmSalary/apis/variableSalary.js b/pc4mobx/hrmSalary/apis/variableSalary.js new file mode 100644 index 00000000..8cd818b5 --- /dev/null +++ b/pc4mobx/hrmSalary/apis/variableSalary.js @@ -0,0 +1,53 @@ +import { WeaTools } from "ecCom"; +import { postExportFetch, 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); +}; +//创建浮动薪酬档案 +export const createVariableSalary = params => { + return postFetch("/api/bs/hrmsalary/variableSalary/createData", 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); +}; +// 获取当前管理员下的所有的个税扣缴义务人 +export const getAdminTaxAgentList = () => { + return WeaTools.callApi("/api/bs/hrmsalary/siaccount/getAdminTaxAgentList", "get", {}); +}; +// 浮动薪酬档案导出 +export const exportVariableSalary = (params) => { + return postExportFetch("/api/bs/hrmsalary/variableSalary/export", params); +}; + diff --git a/pc4mobx/hrmSalary/components/CustomBrowser/components/associativeSearchMult.js b/pc4mobx/hrmSalary/components/CustomBrowser/components/associativeSearchMult.js index db895085..3f1dbc54 100644 --- a/pc4mobx/hrmSalary/components/CustomBrowser/components/associativeSearchMult.js +++ b/pc4mobx/hrmSalary/components/CustomBrowser/components/associativeSearchMult.js @@ -10,8 +10,8 @@ import React, { Component } from "react"; import { WeaLocaleProvider } from "ecCom"; import { Button, Icon, Select } from "antd"; -import classNames from "classnames"; import { postFetch } from "../../../util/request"; +import classNames from "classnames"; const getLabel = WeaLocaleProvider.getLabel; const Option = Select.Option; @@ -39,23 +39,28 @@ class AssociativeSearchMult extends Component { }; getData = (name = "") => { const { browserConditionParam } = this.props; - const { completeURL, searchParamsKey, convertDatasource, dataParams = {} } = browserConditionParam; + const { + completeURL, filterByName, searchParamsKey, convertDatasource, dataParams = {} + } = browserConditionParam; if (_.trim(name)) { - postFetch(completeURL, { ...dataParams, [searchParamsKey]: name, current: 1, pageSize: 9999 }) - .then(({ status, data }) => { - this.setState({ loading: false }); - if (status && data.list) { - this.setState({ - data: convertDatasource ? convertDatasource(data.list) : data.list, - activeKey: this.getActiveKey(convertDatasource ? convertDatasource(data.list) : data.list) - }); - } else { - this.setState({ - data: _.map(data, o => ({ ...o, id: String(o.id), name: o.name })), - activeKey: this.getActiveKey(data) - }); - } - }); + let payload = { ...dataParams }; + searchParamsKey && (payload = { ...payload, [searchParamsKey]: name, current: 1, pageSize: 9999 }); + postFetch(completeURL, payload).then(({ status, data }) => { + this.setState({ loading: false }); + if (status && data.list) { + this.setState({ + data: convertDatasource ? convertDatasource(data.list) : data.list, + activeKey: this.getActiveKey(convertDatasource ? convertDatasource(data.list) : data.list) + }); + } else { + this.setState({ + data: filterByName ? _.filter(_.map(data, o => ({ + ...o, id: String(o.id), name: o.name + })), k => k.name.indexOf(name) !== -1) : _.map(data, o => ({ ...o, id: String(o.id), name: o.name })), + activeKey: this.getActiveKey(data) + }); + } + }); } else { this.setState({ data: [], loading: false, activeKey: "" }); } diff --git a/pc4mobx/hrmSalary/components/CustomBrowser/components/associativeTreeMult.js b/pc4mobx/hrmSalary/components/CustomBrowser/components/associativeTreeMult.js new file mode 100644 index 00000000..f7e975c3 --- /dev/null +++ b/pc4mobx/hrmSalary/components/CustomBrowser/components/associativeTreeMult.js @@ -0,0 +1,84 @@ +/* + * 自定义组件 + * 下拉树选择框 + * @Author: 黎永顺 + * @Date: 2024/9/24 + * @Wechat: + * @Email: 971387674@qq.com + * @description: +*/ +import React, { Component } from "react"; +import { WeaLocaleProvider } from "ecCom"; +import { TreeSelect } from "antd"; +import classNames from "classnames"; + +const getLabel = WeaLocaleProvider.getLabel; + +class AssociativeTreeMult extends Component { + constructor(props) { + super(props); + this.state = { + data: [] + }; + this.selectedData = {}; + } + + componentDidMount() { + const { treeData } = this.props; + this.setState({ data: this.filterTree(treeData) }); + } + + handleChange = (values) => { + this.selectedData = {}; + values.forEach((v) => { + let item = this.getItemById(v); + if (item) this.selectedData[v] = item; + }); + this.props.onChange && this.props.onChange(values, this.selectedData); + }; + getItemById = (id) => { + const { data } = this.state, { datas } = this.props; + if (datas[id]) return datas[id]; + if (!_.isEmpty(data)) { + for (let i = 0; i < data.length; i++) { + if (id === data[i].id) return data[i]; + } + } + }; + filterTree = (nodes) => { + const selectableNodes = []; + const recurse = (nodes) => { + nodes.forEach((node) => { + if (node.selectable) selectableNodes.push(node); + if (node.children) recurse(node.children); + }); + }; + recurse(nodes); + return selectableNodes; + }; + + render() { + const { viewAttr, selectedValues, datas, isSingle, treeData } = this.props; + const clsname = classNames({ + "required": (viewAttr === 3 || viewAttr === "3") && _.isEmpty(selectedValues) + }); + const tProps = { + treeData, + multiple: true, + allowClear: false, + treeCheckable: true, + style: { width: "100%" }, + treeDefaultExpandAll: true, + value: selectedValues, + onChange: this.handleChange, + dropdownMatchSelectWidth: true, + dropdownStyle: { minWidth: 200, maxHeight: 280, overflowY: "auto" }, + getPopupContainer: (triggerNode) => triggerNode.parentNode + }; + return ( + + ); + } +} + +export default AssociativeTreeMult; diff --git a/pc4mobx/hrmSalary/components/CustomBrowser/components/customBrowserDialog.js b/pc4mobx/hrmSalary/components/CustomBrowser/components/customBrowserDialog.js index 4e3ac10c..9eabe37a 100644 --- a/pc4mobx/hrmSalary/components/CustomBrowser/components/customBrowserDialog.js +++ b/pc4mobx/hrmSalary/components/CustomBrowser/components/customBrowserDialog.js @@ -8,13 +8,14 @@ * @description: */ import React, { Component } from "react"; -import { WeaDialog, WeaInputSearch, WeaLocaleProvider, WeaNewScroll, WeaTable } from "ecCom"; +import { WeaDialog, WeaInputSearch, WeaLocaleProvider, WeaNewScroll, WeaTable, WeaTransfer } from "ecCom"; import { Button, Col, Row, Spin } from "antd"; import CustomBrowserMutiLeft from "./customBrowserMutiLeft"; import CustomBrowserMutiRight from "./customBrowserMutiRight"; import CustomBrowserOperation from "./customBrowserOperation"; import { postFetch } from "../../../util/request"; +const WeaTransferList = WeaTransfer.list; const getLabel = WeaLocaleProvider.getLabel; class CustomBrowserDialog extends Component { @@ -22,16 +23,27 @@ class CustomBrowserDialog extends Component { super(props); this.state = { loading: false, listDatas: [], pageInfo: { current: 1, pageSize: 10, total: 0 }, selectedRowKeys: [], - query: { [props.searchParamsKey]: "" } + query: { [props.searchParamsKey]: "" }, singleFilterVal: "", + leftListSelectedKeys: [], // 左侧table选择的keys + leftListSelectedData: [], // 左侧table选择的数据 + rightCheckedKeys: [], //右侧选择的keys + rightDatas: [] // 右侧展示的数据 }; this.selectedData = {}; } componentWillReceiveProps(nextProps, nextContext) { - if (nextProps.visible !== this.props.visible && nextProps.visible) this.getData(); - if (nextProps.visible !== this.props.visible && nextProps.visible) this.setState({ selectedRowKeys: nextProps.selectedValues }); - if (nextProps.visible !== this.props.visible && !nextProps.visible) { - this.setState({ pageInfo: { current: 1, pageSize: 10, total: 0 } }); + if (nextProps.visible !== this.props.visible && nextProps.visible) { + this.getData(); + this.setState({ + selectedRowKeys: nextProps.selectedValues, + leftListSelectedData: _.values(nextProps.datas), rightDatas: _.values(nextProps.datas) + }); + } else { + this.setState({ + pageInfo: { current: 1, pageSize: 10, total: 0 }, query: { [this.props.searchParamsKey]: "" }, + rightDatas: [], rightCheckedKeys: [], leftListSelectedData: [], leftListSelectedKeys: [] + }); this.selectedData = {}; } } @@ -39,7 +51,7 @@ class CustomBrowserDialog extends Component { getData = () => { const { pageInfo, query } = this.state; const { dialogType, completeURL, convertDatasource, dataParams = {} } = this.props; - let payload = { ...dataParams }; + let payload = { ...dataParams, ...query }; dialogType === "table" && (payload = { ...pageInfo, ...payload, ...query }); this.setState({ loading: true }); postFetch(completeURL, payload).then(({ status, data }) => { @@ -51,7 +63,7 @@ class CustomBrowserDialog extends Component { pageInfo: { ...pageInfo, current, pageSize, total } }); } else { - this.setState({ listDatas: data }); + this.setState({ listDatas: _.map(data, o => ({ ...o, id: String(o.id) })) }); } }); }; @@ -67,12 +79,13 @@ class CustomBrowserDialog extends Component { this.props.onChange && this.props.onChange([], {}); }; handleOk = () => { - const { selectedRowKeys } = this.state; - selectedRowKeys.forEach((v) => { + const { selectedRowKeys, rightDatas } = this.state, { dialogType } = this.props; + const convertSelectedRowKeys = dialogType !== "table" ? rightDatas.map((v) => v.id) : selectedRowKeys; + convertSelectedRowKeys.forEach((v) => { let item = this.getItemById(v); if (item) this.selectedData[v] = item; }); - this.props.onChange && this.props.onChange(selectedRowKeys, this.selectedData); + this.props.onChange && this.props.onChange(convertSelectedRowKeys, this.selectedData); this.props.onCancel && this.props.onCancel(); }; getItemById = (id) => { @@ -80,39 +93,136 @@ class CustomBrowserDialog extends Component { if (this.selectedData[id]) return this.selectedData[id]; if (!_.isEmpty(listDatas)) { for (let i = 0; i < listDatas.length; i++) { - if (id === listDatas[i].id) return listDatas[i]; + if (String(id) === String(listDatas[i].id)) return listDatas[i]; } } }; + onLeftListCheck = (keys, datas) => { + const { leftListSelectedData } = this.state; + let targets = leftListSelectedData.concat(datas); + targets = _.uniqBy(targets, "id"); + targets = targets.filter((t) => keys.indexOf(t["id"]) > -1); + this.setState({ leftListSelectedKeys: keys, leftListSelectedData: targets }); + }; + onleftDoubleClick = (data) => { + const { rightDatas } = this.state; + this.setState({ + rightDatas: rightDatas.concat(data), + rightCheckedKeys: [], + leftListSelectedData: [], + leftListSelectedKeys: [] + }); + }; + onRightDoubleClick = (key) => { + const { rightDatas } = this.state; + const newRightDatas = rightDatas.filter(item => String(item.id) !== key); + this.setState({ rightDatas: newRightDatas, rightCheckedKeys: [] }); + }; + moveTo = (direction) => { + const { rightDatas, rightCheckedKeys, listDatas, leftListSelectedData } = this.state; + if (direction === "right") { + this.setState({ + rightDatas: rightDatas.concat(leftListSelectedData), + leftListSelectedData: [], + leftListSelectedKeys: [] + }); + } else if (direction === "left") { + this.setState({ + rightDatas: rightDatas.filter(item => !rightCheckedKeys.some(checkedKey => String(item.id) === checkedKey)), + rightCheckedKeys: [] + }); + } else if (direction === "allToLeft") { + this.setState({ rightDatas: [], rightCheckedKeys: [] }); + } else if (direction === "allToRight") { + if (this.leftListAllActive()) { + this.setState({ + rightDatas: rightDatas.concat(listDatas), + rightCheckedKeys: [], + leftListSelectedData: [], + leftListSelectedKeys: [] + }); + } + } + }; + leftListAllActive = () => { + const { rightDatas, listDatas } = this.state; + let bool = true; + if (_.isEmpty(listDatas)) bool = false; + if (!_.isEmpty(listDatas) && !_.isEmpty(rightDatas)) { + bool = listDatas.filter((l) => !rightDatas.some(r => l.id === r.id)).length !== 0; + } + return bool; + }; + render() { - const { loading, listDatas, pageInfo, selectedRowKeys, query } = this.state; + const { + loading, listDatas, pageInfo, selectedRowKeys, query, leftListSelectedKeys, rightDatas, rightCheckedKeys, + singleFilterVal + } = this.state; const { dialogType, tableProps: { rowKey, columns }, isSingle, searchParamsKey } = this.props; const sheight = this.dialog ? this.dialog.state.height - 55 : 260; const buttons = [ - , + , , ]; + let rightActive = false, leftActive = false, rightAllActive = false; + if (leftListSelectedKeys && leftListSelectedKeys.length > 0) rightActive = true; + if (rightCheckedKeys && rightCheckedKeys.length > 0) leftActive = true; + if (rightDatas && rightDatas.length > 0) rightAllActive = true; let dom = -
-
- - - -
- - - -
-
-
- -
-
- -
+
+ { + !isSingle ? +
+ + + this.setState({ query: { ...query, [searchParamsKey]: value } })} + /> + + +
+ + + +
+
+
+ this.moveTo("right")} + moveToLeft={() => this.moveTo("left")} + moveAllToRight={() => this.moveTo("allToRight")} + moveAllToLeft={() => this.moveTo("allToLeft")} + /> +
+
+ this.setState({ rightCheckedKeys })} + onDoubleClick={this.onRightDoubleClick} + /> +
+
: + + this.setState({ singleFilterVal })}/> + this.handleRowClick(_.find(listDatas, item => item.id === id))} + data={listDatas.filter((item) => item.name.indexOf(_.trim(singleFilterVal)) > -1)}/> + + }
; if (dialogType === "table") { diff --git a/pc4mobx/hrmSalary/components/CustomBrowser/components/customBrowserMutiLeft.js b/pc4mobx/hrmSalary/components/CustomBrowser/components/customBrowserMutiLeft.js index a6b962af..94343950 100644 --- a/pc4mobx/hrmSalary/components/CustomBrowser/components/customBrowserMutiLeft.js +++ b/pc4mobx/hrmSalary/components/CustomBrowser/components/customBrowserMutiLeft.js @@ -12,11 +12,51 @@ import { WeaLocaleProvider } from "ecCom"; const getLabel = WeaLocaleProvider.getLabel; +let timeout = null; + class CustomBrowserMutiLeft extends Component { + constructor(props) { + super(props); + this.dataObj = {}; + } + + onClick = (data) => { + clearTimeout(timeout); + timeout = setTimeout(() => { + let { selectedKeys } = this.props; + let keys = selectedKeys ? [...selectedKeys] : []; + let datas = []; + if (keys.indexOf(data.id) > -1) { + keys = keys.filter((k) => k !== data.id); + } else { + keys.push(data.id); + } + keys.forEach((k) => this.dataObj[k] && datas.push(this.dataObj[k])); + this.props.onClick && this.props.onClick(keys, datas); + }, 200); + }; + onDoubleClick = (data) => { + clearTimeout(timeout); + this.props.onDoubleClick && this.props.onDoubleClick([data]); + }; + cls = (item) => { + const { selectedKeys, filterData } = this.props; + let cls = []; + if (selectedKeys && selectedKeys.indexOf(item.id) > -1) { + cls.push("selected"); + } + if (filterData && filterData.filter((d) => d.id === item.id).length > 0) { + cls.push("hide"); + } + return cls.join(" "); + }; + render() { - const { datas } = this.props; + const { datas, selectedKeys } = this.props; const list = datas.map(item => { - return
  • + this.dataObj[item.id] = item; + return
  • this.onClick(item)} + onDoubleClick={() => this.onDoubleClick(item)}>
    {item.name}
    diff --git a/pc4mobx/hrmSalary/components/CustomBrowser/components/customBrowserMutiRight.js b/pc4mobx/hrmSalary/components/CustomBrowser/components/customBrowserMutiRight.js index 5b4376d9..ed56dd09 100644 --- a/pc4mobx/hrmSalary/components/CustomBrowser/components/customBrowserMutiRight.js +++ b/pc4mobx/hrmSalary/components/CustomBrowser/components/customBrowserMutiRight.js @@ -14,25 +14,73 @@ import { Tree } from "antd"; const getLabel = WeaLocaleProvider.getLabel; const TreeNode = Tree.TreeNode; -class CustomBrowserMutiRight extends Component { - generateTreeNodes = () => { +let timeout = null; +class CustomBrowserMutiRight extends Component { + constructor(props) { + super(props); + this.state = { + key: "" + }; + this.nodeIds = []; + this.nodeObj = {}; + } + + generateTreeNodes = () => { + const { data } = this.props, { key } = this.state; + const treeNodes = []; + let showData = [...data]; + if (_.trim(key)) { + showData = showData.filter((item) => { + return item.name.indexOf(_.trim(key)) > -1; + }); + } + showData = _.uniqBy(showData, "id"); + this.nodeIds = []; + this.nodeObj = {}; + showData.map((item) => { + let title = ( +
    +
    +
    + {item.name} +
    +
    +
    +
    + ); + treeNodes.push(); + this.nodeIds.push(item["id"]); + this.nodeObj[item["id"]] = item; + }); + return treeNodes; + }; + handleSearchChange = (v) => this.setState({ key: v }); + checkHandler = (v) => { + clearTimeout(timeout); + timeout = setTimeout(() => { + this.props.checkedCb && this.props.checkedCb(v); + }, 200); + }; + onDoubleClick = (key) => { + clearTimeout(timeout); + this.props.onDoubleClick && this.props.onDoubleClick(key); }; render() { - const { height } = this.props; + const { height, checkedKeys } = this.props; return (
    - +
    - {/**/} - {/* {this.generateTreeNodes()}*/} - {/**/} + + {this.generateTreeNodes()} +
    diff --git a/pc4mobx/hrmSalary/components/CustomBrowser/components/customBrowserOperation.js b/pc4mobx/hrmSalary/components/CustomBrowser/components/customBrowserOperation.js index c6688f32..ab56ef02 100644 --- a/pc4mobx/hrmSalary/components/CustomBrowser/components/customBrowserOperation.js +++ b/pc4mobx/hrmSalary/components/CustomBrowser/components/customBrowserOperation.js @@ -42,12 +42,12 @@ class CustomBrowserOperation extends Component { const moveAllToLeftButton = ( ); const moveAllToRightButton = ( ); return ( diff --git a/pc4mobx/hrmSalary/components/CustomBrowser/index.js b/pc4mobx/hrmSalary/components/CustomBrowser/index.js index 3b9fb3ed..f77d566d 100644 --- a/pc4mobx/hrmSalary/components/CustomBrowser/index.js +++ b/pc4mobx/hrmSalary/components/CustomBrowser/index.js @@ -9,6 +9,7 @@ */ import React, { Component } from "react"; import { WeaLocaleProvider, WeaTools } from "ecCom"; +import AssociativeTreeMult from "./components/associativeTreeMult"; import AssociativeSearchMult from "./components/associativeSearchMult"; import AssociativeSearchSingle from "./components/AssociativeSearchSingle"; import CustomBrowserDialog from "./components/customBrowserDialog"; @@ -30,15 +31,24 @@ class Index extends Component { componentDidMount() { const { value, fieldConfig } = this.props; - const { browserConditionParam: { replaceDatas = [] } } = fieldConfig; - if (value && replaceDatas.length > 0) { + const { value: defaultValue, browserConditionParam: { replaceDatas = [] } } = fieldConfig; + if ((value || defaultValue) && replaceDatas.length > 0) { this.setState({ - searchKeys: value.split(","), + searchKeys: (value || defaultValue).split(","), selectedData: _.reduce(replaceDatas, (pre, cur) => ({ ...pre, [cur["id"]]: cur }), {}) }); } } + componentWillReceiveProps(nextProps, nextContext) { + if ( + (nextProps.value !== this.props.value && _.isEmpty(nextProps.value)) || + (nextProps.fieldConfig.value !== this.props.fieldConfig.value && _.isEmpty(nextProps.fieldConfig.value)) + ) { + this.setState({ searchKeys: [], selectedData: [] }); + } + } + renderSingle = () => { const { fieldConfig } = this.props; const { selectedData, searchKeys } = this.state; @@ -55,16 +65,27 @@ class Index extends Component { }; renderMult = () => { const { fieldConfig } = this.props; + const { browserConditionParam = {} } = fieldConfig || {}; const { selectedData, searchKeys } = this.state; return (
    - + { + browserConditionParam.treeSelect ? + : + + }
    ); }; onBrowerChangeHandler = (values, datas) => { @@ -75,6 +96,7 @@ class Index extends Component { selectedData: ((isSingle || browserConditionParam.isSingle) && !_.isEmpty(values)) ? { [_.last(values)]: datas[_.last(values)] } : datas }, () => { this.props.onChange && this.props.onChange(values.join(",")); + this.props.onCustomChange && this.props.onCustomChange(this.state.selectedData); if (form) { form.updateFields({ [getKey(fieldConfig)]: { value: this.state.searchKeys.join(",") } diff --git a/pc4mobx/hrmSalary/components/CustomBrowser/index.less b/pc4mobx/hrmSalary/components/CustomBrowser/index.less index e2d30e6e..8cf2ce40 100644 --- a/pc4mobx/hrmSalary/components/CustomBrowser/index.less +++ b/pc4mobx/hrmSalary/components/CustomBrowser/index.less @@ -11,12 +11,41 @@ height: 100%; } - .wea-input-focus { - height: 35px !important; - //width: 100% !important; + .wea-hr-muti-dialog { + .wea-input-focus { + height: 35px !important; + width: 100% !important; - input { - height: 100% !important; + input { + height: 100% !important; + } + } + + .wea-transfer-list-wrapper { + border: none !important; + + .transfer-tree { + padding: 0 !important; + + & > li { + margin: 0; + cursor: pointer; + width: 100%; + position: relative; + padding: 6px 0 6px 20px !important; + border-bottom: 1px solid #e9e9e9; + color: #333; + overflow: hidden; + + .ant-tree-switcher { + display: none !important; + } + + .tree-title { + line-height: 30px; + } + } + } } } } diff --git a/pc4mobx/hrmSalary/components/UnifiedTable/index.js b/pc4mobx/hrmSalary/components/UnifiedTable/index.js index f8cbff97..cff25bf6 100644 --- a/pc4mobx/hrmSalary/components/UnifiedTable/index.js +++ b/pc4mobx/hrmSalary/components/UnifiedTable/index.js @@ -12,7 +12,7 @@ class Index extends Component { } else if (index === 1) { return { ...item, fixed: "left", width: 176 }; } - if (item.dataIndex === "operate") { + if (item.dataIndex === "operate" || item.dataIndex === "opts") { return { ...item, fixed: "right", width: item.width || "120px" }; } return { ...item, width: "33%" }; diff --git a/pc4mobx/hrmSalary/config.js b/pc4mobx/hrmSalary/config.js new file mode 100644 index 00000000..ba422c79 --- /dev/null +++ b/pc4mobx/hrmSalary/config.js @@ -0,0 +1,22 @@ +export const PAGE = { + "salaryArchive": ["/hrmSalary/salaryFile"], //薪资档案 + "salarySob": ["/hrmSalary/ledger"], //薪资账套 + "salaryAcct": ["/hrmSalary/calculate", "/hrmSalary/calcView"], //薪资核算 + "salaryBill": ["/hrmSalary/payroll", "/hrmSalary/payrollGrant", "/hrmSalary/payrollDetail"], //工资单 + "taxDeclaration": ["/hrmSalary/declare", "/hrmSalary/generateDeclarationDetail"], //个税 + "addUpDeduction": ["/dataAcquisition/cumDeduct"], //累计专项附加扣除 + "specialAddDeduction": ["/dataAcquisition/specialAddDeduction"], //专项附加扣除 + "otherDeduction": ["/dataAcquisition/otherDeduct"], //其他免税扣除 + "addUpSituation": ["/dataAcquisition/cumSituation"], //往期累计情况 + "attendQuote": ["/dataAcquisition/attendance"], //考勤引用 + "myBill": ["/hrmSalary/mySalary", "/hrmSalary/mySalaryMobile"], //薪资福利 + "taxAgent": ["/hrmSalary/taxAgent"], //个税扣缴义务人 + "auth": ["/hrmSalary/roleManagement"], //业务管理线 + "variableArchive": ["/hrmSalary/variableSalary"], //浮动薪酬 + "siAccount": ["/socialSecurityBenefits/standingBook", "/socialSecurityBenefits/standingBookDetail", "/socialSecurityBenefits/sbofflineComparison"], //社保福利台账 + "siArchive": ["/socialSecurityBenefits/archives"], //社保档案 + "salaryField": ["/hrmSalary/fieldManagement"], //字段管理 + "salaryItem": ["/hrmSalary/salaryItem"], //薪资项目管理 + "siScheme": ["/socialSecurityBenefits/programme"], //社保福利方案 + "report": ["/hrmSalary/analysisOfSalaryStatistics", "/hrmSalary/reportView"] //报表 +}; diff --git a/pc4mobx/hrmSalary/index.js b/pc4mobx/hrmSalary/index.js index c2137579..b5d9221e 100644 --- a/pc4mobx/hrmSalary/index.js +++ b/pc4mobx/hrmSalary/index.js @@ -42,6 +42,7 @@ import MobilePayroll from "./pages/mobilePayroll"; import SysConfig from "./pages/sysConfig"; import RuleConfig from "./pages/ruleConfig/ruleConfig"; import Appconfig from "./pages/appConfig"; +import RoleManagement from "./pages/roleManagement"; import FieldManagement from "./pages/fieldManagement"; import AnalysisOfSalaryStatistics from "./pages/analysisOfSalaryStatistics"; import EmployeeList from "./pages/employeeView"; @@ -52,6 +53,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 Layout from "./layout"; import CustomRoutes from "./pages/custom-pages"; @@ -65,56 +67,9 @@ let getLocaleLabel = WeaLocaleProvider.getLocaleLabel.bind(this, "hrmSalary"); getLocaleLabel = function (nextState, replace, callback) { callback(); }; - -const Home = (props) => props.children; - const SocialSecurityBenefits = (props) => props.children; const DataAcquisition = (props) => props.children; -// historicalPayroll 历史工资单查看 -// salaryAdjustmentRecords 调薪记录查看 - -// mySalaryMobile 我的薪资福利-移动端 -// mySalaryMobile 我的薪资福利-移动端 -// mySalary 我的薪资福利 -// mySalaryView 我的薪资福利-查看工资单 -// socialSecurityBenefits 社保福利 -// programme 社保福利方案 -// archives 社保福利档案 -// standingBook 社保福利台账 -// sbofflineComparison 社保福利台账线下对比 -// salaryItem 薪资项目管理 -// salaryFile 薪资档案 -// dataAcquisition 数据采集 -// CumDeduct 累计专项附加扣除 -// otherDeduct 其他免税扣除 -// cumSituation 往期累计情况 -// attendance 考勤引用 -// specialAddDeduction 专项附件扣除 -// ledger 薪资账套 -// calculate 薪资核算 -// calculateDetail 核算详情 -// DoCalcDetail 核算详情页面-新 -// CalcView 核算查看页面-新 -// OfflineCompare 薪资核算线下对比-新 -// placeOnFileDetail 核算归档详情 -// compareDetail 线下线上对比 -// payroll 工资单发放 -// declare 个税申报表 -// generateDeclarationDetail 个税单详情 -// taxRate 个税税率表 -// taxAgent 个税扣缴义务人 -// mobilepayroll 移动端工资单 -// sysconfig 系統配置 -// sysconfig-1 规则配置 -// appconfig 应用配置 -// fieldManagement 字段管理 -// analysisOfSalaryStatistics 薪酬统计分析 -// reportView 薪酬报表查看 -// externalPersonManage 非系统人员管理 -// adjustSalaryManage 档案管理 -// supplementaryCalc 补算 - const Routes = ( @@ -161,6 +116,7 @@ const Routes = ( + @@ -168,6 +124,7 @@ const Routes = ( + {CustomRoutes} ); diff --git a/pc4mobx/hrmSalary/layout.js b/pc4mobx/hrmSalary/layout.js index f1ad9a67..73fc3cca 100644 --- a/pc4mobx/hrmSalary/layout.js +++ b/pc4mobx/hrmSalary/layout.js @@ -8,12 +8,16 @@ * @description: */ import React, { Component } from "react"; +import { inject, observer } from "mobx-react"; import { WeaLocaleProvider, WeaTools } from "ecCom"; +import Authority from "./pages/mySalary/authority"; import stores from "./stores"; const { ls } = WeaTools; const { getLabel } = WeaLocaleProvider; +@inject("taxAgentStore") +@observer class Layout extends Component { constructor(props) { super(props); @@ -40,13 +44,15 @@ class Layout extends Component { header.appendChild(link); top.$(".ant-message").remove(); window.location.hash.indexOf("mobilepayroll") === -1 && stores.taxAgentStore.getPermission(); + window.location.hash.indexOf("mobilepayroll") !== -1 && stores.taxAgentStore.initPageAndOptAuth(); } } render() { - return ( - {this.props.children} - ); + const { taxAgentStore: { PageAndOptAuth, loading } } = this.props; + return ( + {this.props.children} + ); } } diff --git a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/index.js b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/index.js index 121e334a..77f2921a 100644 --- a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/index.js +++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/index.js @@ -275,7 +275,7 @@ class Index extends Component { render() { const { - taxAgentStore: { statisticsReportBtn }, + taxAgentStore: { PageAndOptAuth }, attendanceStore: { statisticsForm, reportForm, tableStore } } = this.props; const { @@ -283,6 +283,7 @@ class Index extends Component { reportName, keyword, year, logDialogVisible, filterConditions, dateRange, showSearchAd, isQuery } = this.state; + const statisticsReportBtn = PageAndOptAuth.opts.includes("admin"); const buttons = selectedKey === "statistics" ? [ , , - , - + // , + // ]; const items = [ { diff --git a/pc4mobx/hrmSalary/pages/calculate/calculate.js b/pc4mobx/hrmSalary/pages/calculate/calculate.js index e6207394..5d7b516d 100644 --- a/pc4mobx/hrmSalary/pages/calculate/calculate.js +++ b/pc4mobx/hrmSalary/pages/calculate/calculate.js @@ -40,8 +40,9 @@ class Calculate extends Component { } renderCalculateOpts = () => { - const { taxAgentStore: { showOperateBtn } } = this.props; + const { taxAgentStore: { PageAndOptAuth } } = this.props; const { queryParams, isRefresh } = this.state; + const admin = PageAndOptAuth.opts.includes("admin"); let calculateOpts = [ , ]; const queryBtns = [ @@ -74,10 +75,10 @@ class Index extends Component { break; case "watermark": const { baseSetSaveLoading } = this.state; - reqBtns = [ + reqBtns = showOperateBtn ? [ - ]; + ] : []; break; default: break; @@ -91,7 +92,7 @@ class Index extends Component { case "grant": dom = this.setState({ selectedKey: "template" }, () => { - this.templateRef.wrappedInstance.handleOpts({ key: "edit" }, { id }); + this.templateRef.handleOpts({ key: "edit" }, { id }); })} onFilterLog={(type, targetid) => this.onDropMenuClick(type, targetid)} />; diff --git a/pc4mobx/hrmSalary/pages/reportView/components/condition.js b/pc4mobx/hrmSalary/pages/reportView/components/condition.js index d6668459..0cda350a 100644 --- a/pc4mobx/hrmSalary/pages/reportView/components/condition.js +++ b/pc4mobx/hrmSalary/pages/reportView/components/condition.js @@ -91,36 +91,36 @@ export const condition = [ labelcol: 6, viewAttr: 2 }, - // { - // browserConditionParam: { - // completeParams: {}, - // conditionDataParams: {}, - // dataParams: {}, - // destDataParams: {}, - // hasAddBtn: false, - // hasAdvanceSerach: true, - // idSeparator: ",", - // isAutoComplete: 1, - // isDetail: 0, - // isMultCheckbox: false, - // isSingle: false, - // linkUrl: "", - // pageSize: 10, - // quickSearchName: "", - // replaceDatas: [], - // title: getLabel(111, "岗位"), - // type: "278", - // viewAttr: 2 - // }, - // colSpan: 2, - // conditionType: "BROWSER", - // domkey: ["position"], - // fieldcol: 18, - // isQuickSearch: false, - // label: getLabel(111, "岗位"), - // labelcol: 6, - // viewAttr: 2 - // }, + { + browserConditionParam: { + completeParams: {}, + conditionDataParams: {}, + dataParams: {}, + destDataParams: {}, + hasAddBtn: false, + hasAdvanceSerach: true, + idSeparator: ",", + isAutoComplete: 1, + isDetail: 0, + isMultCheckbox: false, + isSingle: false, + linkUrl: "", + pageSize: 10, + quickSearchName: "", + replaceDatas: [], + title: getLabel(111, "岗位"), + type: "278", + viewAttr: 2 + }, + colSpan: 2, + conditionType: "BROWSER", + domkey: ["position"], + fieldcol: 18, + isQuickSearch: false, + label: getLabel(111, "岗位"), + labelcol: 6, + viewAttr: 2 + }, { browserConditionParam: { completeParams: {}, diff --git a/pc4mobx/hrmSalary/pages/reportView/components/customStatisticsItemsModal.js b/pc4mobx/hrmSalary/pages/reportView/components/customStatisticsItemsModal.js index a94d2a07..f9955249 100644 --- a/pc4mobx/hrmSalary/pages/reportView/components/customStatisticsItemsModal.js +++ b/pc4mobx/hrmSalary/pages/reportView/components/customStatisticsItemsModal.js @@ -7,7 +7,6 @@ import React, { Component } from "react"; import { Button, message, Modal } from "antd"; import { - WeaBrowser, WeaCheckbox, WeaDialog, WeaError, @@ -19,6 +18,7 @@ import { WeaTable } from "ecCom"; import { reportStatisticsItemSave, statisticsItemChangetab, statisticsItemGetform } from "../../../apis/statistics"; +import CustomBrowser from "../../../components/CustomBrowser"; import "../index.less"; const { getLabel } = WeaLocaleProvider; @@ -263,23 +263,22 @@ class CustomStatisticsItemsModal extends Component { }) }); }; - handleChangeStatisticalItems = (itemValue, _names, datas) => { + handleChangeStatisticalItems = (data) => { + const itemValue = _.keys(data)[0], datas = _.values(data); const { formData } = this.state; this.setState({ formData: { ...formData, itemValue, itemValueSpan: _.map(datas, it => it.name).join(","), - itemName: datas.length === 1 ? _.map(datas, it => it.names).join(",") : "" + itemName: datas.length === 1 ? _.map(datas, it => it.name).join(",") : "" } }, () => { statisticsItemChangetab({ itemId: itemValue }).then(({ status, data }) => { if (status) { const { ruleData } = data; const { columns, data: dataSource } = ruleData; - this.setState({ - columns, dataSource - }); + this.setState({ columns, dataSource }); } }); }); @@ -368,52 +367,37 @@ class CustomStatisticsItemsModal extends Component { className="statisticItemsWrapper" >
    - - - ({ - id: it, - name: itemValueSpan.split(",")[idx] - })) : []} - completeParams={{ - type: 162, - fielddbtype: "browser.salaryItemBrowser", - f_weaver_belongto_usertype: "0" - }} - conditionDataParams={{ - type: "browser.salaryItemBrowser", - fielddbtype: "browser.salaryItemBrowser", - f_weaver_belongto_usertype: "0" - }} - dataParams={{ - type: "browser.salaryItemBrowser", - f_weaver_belongto_usertype: "0" - }} - destDataParams={{ - type: "browser.salaryItemBrowser", - f_weaver_belongto_usertype: "0" - }} - // isMultCheckbox - inputStyle={{ width: "100%" }} - onChange={this.handleChangeStatisticalItems} - /> - - - - - this.setState({ formData: { ...formData, itemName } })}/> - - -
    - -
    + { + !_.isEmpty(columns) && + + + ({ + id: it, name: itemValueSpan.split(",")[idx] + })) : [], dataParams: { filterType: "QUERY_DATA" }, searchParamsKey: "", filterByName: true + } + }} value={itemValue} onCustomChange={this.handleChangeStatisticalItems}/> + + + + + this.setState({ formData: { ...formData, itemName } })}/> + + +
    + +
    +
    + }
    ); diff --git a/pc4mobx/hrmSalary/pages/reportView/components/povitpivotChartModal.js b/pc4mobx/hrmSalary/pages/reportView/components/povitpivotChartModal.js index 6a80e8fb..aa5f1bed 100644 --- a/pc4mobx/hrmSalary/pages/reportView/components/povitpivotChartModal.js +++ b/pc4mobx/hrmSalary/pages/reportView/components/povitpivotChartModal.js @@ -36,8 +36,8 @@ class PovitpivotChartModal extends Component { componentWillReceiveProps(nextProps, nextContext) { if (nextProps.visible !== this.props.visible && nextProps.visible) { - const { id, dimensionId, dimensionValue, isShare } = nextProps; - this.getDataPerspective({ id, dimensionId, dimensionValue, isShare }); + const { id, dimensionId, dimensionValue, isShare, salaryStartMonth, salaryEndMonth } = nextProps; + this.getDataPerspective({ id, dimensionId, dimensionValue, isShare, salaryStartMonth, salaryEndMonth }); } else { this.setState({ dataSource: [], @@ -64,11 +64,11 @@ class PovitpivotChartModal extends Component { }); } else if (type === "turn") { if (id === "PAGEINFO") { - const { id, dimensionId, dimensionValue, isShare } = this.props; + const { id, dimensionId, dimensionValue, isShare, salaryStartMonth, salaryEndMonth } = this.props; const { pageNum: current, size: pageSize } = params; this.setState({ pageInfo: { ...pageInfo, current, pageSize } }, () => this.getDataPerspective({ - id, dimensionId, dimensionValue, isShare + id, dimensionId, dimensionValue, isShare, salaryStartMonth, salaryEndMonth })); } } diff --git a/pc4mobx/hrmSalary/pages/reportView/components/reportContent.js b/pc4mobx/hrmSalary/pages/reportView/components/reportContent.js index 7509d3df..9716234a 100644 --- a/pc4mobx/hrmSalary/pages/reportView/components/reportContent.js +++ b/pc4mobx/hrmSalary/pages/reportView/components/reportContent.js @@ -29,8 +29,8 @@ class ReportContent extends Component { chartsType: "0", chartsInfo: {}, povitView: { - visible: false, id: "", isShare: false, - dimensionId: "", dimensionValue: "" + visible: false, id: "", isShare: false, dimensionId: "", dimensionValue: "", salaryStartMonth: "", + salaryEndMonth: "" }, rangSet: { visible: false, reportId: "", @@ -69,10 +69,15 @@ class ReportContent extends Component { if (id === "PIVOTCHART") { const { record } = params; const { dimension: dimensionValue } = record; - const { id: pivotId, dimensionId, isShare } = this.props.report; + const { + id: pivotId, dimensionId, isShare, timeType, salaryEndMonth: end, salaryStartMonth: start + } = this.props.report; + const [salaryStartMonth, salaryEndMonth] = getSalaryMonthValue(timeType); + this.setState({ povitView: { - visible: true, id: pivotId, dimensionId, dimensionValue, isShare + visible: true, id: pivotId, dimensionId, dimensionValue, isShare, + salaryStartMonth: (salaryStartMonth || start) + "-01", salaryEndMonth: (salaryEndMonth || end) + "-01" } }); } else if (id === "PAGEINFO_REPORT") { @@ -282,7 +287,7 @@ class ReportContent extends Component { onCancel={() => this.setState({ povitView: { visible: false, id: "", dimensionId: "", dimensionValue: "", - isShare: false + isShare: false, salaryStartMonth: "", salaryEndMonth: "" } })} /> diff --git a/pc4mobx/hrmSalary/pages/reportView/components/statisticalMicroSettingsSlide.js b/pc4mobx/hrmSalary/pages/reportView/components/statisticalMicroSettingsSlide.js index e82f2eaa..9d1f5d7c 100644 --- a/pc4mobx/hrmSalary/pages/reportView/components/statisticalMicroSettingsSlide.js +++ b/pc4mobx/hrmSalary/pages/reportView/components/statisticalMicroSettingsSlide.js @@ -30,8 +30,7 @@ import { statisticsItemList } from "../../../apis/statistics"; import { commonEnumList } from "../../../apis/ruleconfig"; -import { getTaxAgentSelectList } from "../../../apis/taxAgent"; -import { getSalarysobListAll } from "../../../apis"; +import { postFetch } from "../../../util/request"; import { condition } from "./condition"; import cs from "classnames"; import "../index.less"; @@ -70,40 +69,44 @@ class StatisticalMicroSettingsSlide extends Component { } getTaxAgentSelectList = async (props) => { - const [salarySobList, empStatusList] = await Promise.all([getSalarysobListAll(), commonEnumList({ enumClass: "com.engine.salary.enums.salarysob.SalaryEmployeeStatusEnum" })]); - getTaxAgentSelectList(props.isShare).then(({ status, data }) => { - if (status) { - const conditions = _.map(condition, item => { - return { - ...item, - items: _.map(item.items, child => { - if (getKey(child) === "taxAgent") { - return { - ...child, viewAttr: props.isShare ? 1 : child.viewAttr, - options: _.map(data, o => ({ key: o.id, showname: o.content })) - }; - } else if (getKey(child) === "salarySob") { - return { - ...child, viewAttr: props.isShare ? 1 : child.viewAttr, - options: _.map(salarySobList.data, o => ({ key: String(o.id), showname: o.name })) - }; - } else if (getKey(child) === "status") { - return { - ...child, viewAttr: props.isShare ? 1 : child.viewAttr, - options: _.map(empStatusList.data, o => ({ key: o.value.toString(), showname: o.defaultLabel })) - }; - } - return { ...child, viewAttr: props.isShare ? 1 : child.viewAttr }; - }) - }; - }); - this.setState({ conditions }, () => { - props.form.initFormFields(this.state.conditions); - props.id && this.reportStatisticsGetSearchCondition(props.id); - }); + const [salarySobList, empStatusList] = await Promise.all([ + postFetch("/api/bs/hrmsalary/salarysob/listAuth", { filterType: "QUERY_DATA" }), + commonEnumList({ enumClass: "com.engine.salary.enums.salarysob.SalaryEmployeeStatusEnum" }) + ]); + postFetch("/api/bs/hrmsalary/taxAgent/listAuth", { filterType: "QUERY_DATA" }) + .then(({ status, data }) => { + if (status) { + const conditions = _.map(condition, item => { + return { + ...item, + items: _.map(item.items, child => { + if (getKey(child) === "taxAgent") { + return { + ...child, viewAttr: props.isShare ? 1 : child.viewAttr, + options: _.map(data, o => ({ key: String(o.id), showname: o.name })) + }; + } else if (getKey(child) === "salarySob") { + return { + ...child, viewAttr: props.isShare ? 1 : child.viewAttr, + options: _.map(salarySobList.data, o => ({ key: String(o.id), showname: o.name })) + }; + } else if (getKey(child) === "status") { + return { + ...child, viewAttr: props.isShare ? 1 : child.viewAttr, + options: _.map(empStatusList.data, o => ({ key: o.value.toString(), showname: o.defaultLabel })) + }; + } + return { ...child, viewAttr: props.isShare ? 1 : child.viewAttr }; + }) + }; + }); + this.setState({ conditions }, () => { + props.form.initFormFields(this.state.conditions); + props.id && this.reportStatisticsGetSearchCondition(props.id); + }); - } - }); + } + }); }; reportStatisticsGetSearchCondition = (id) => { const { conditions } = this.state; @@ -149,7 +152,7 @@ class StatisticalMicroSettingsSlide extends Component { hiredate: extra["hiredate1__hiredate2"].value || [], department: _.map(department.valueObj, it => ({ id: it.id, name: it.name })), employee: _.map(employee.valueObj, it => ({ id: it.id, name: it.name })), - // position: _.map(position.valueObj, it => ({ id: it.id, name: it.name })), + position: _.map(position.valueObj, it => ({ id: it.id, name: it.name })), subCompany: _.map(subCompany.valueObj, it => ({ id: it.id, name: it.name })), taxAgent: value ? _.map(value.split(","), (it, idx) => ({ id: it, name: valueSpan.split(",")[idx] })) : [], status: statusVal ? _.map(statusVal.split(","), (it, idx) => ({ diff --git a/pc4mobx/hrmSalary/pages/reportView/index.js b/pc4mobx/hrmSalary/pages/reportView/index.js index 4d01e7c0..5756ae21 100644 --- a/pc4mobx/hrmSalary/pages/reportView/index.js +++ b/pc4mobx/hrmSalary/pages/reportView/index.js @@ -109,7 +109,8 @@ class Index extends Component { render() { const { report, dimensionList, statisticalPayload } = this.state; const { isShare } = report; - const { attendanceStore: { settingForm }, taxAgentStore: { taxAgentOption, showOperateBtn } } = this.props; + const { attendanceStore: { settingForm }, taxAgentStore: { PageAndOptAuth } } = this.props; + const showOperateBtn = PageAndOptAuth.opts.includes("admin"); return ( } @@ -158,8 +159,7 @@ class Index extends Component {
    {/*统计数据范围及规则设置弹框*/} this.setState({ statisticalPayload: { visible: false, id: "", dimension: "" } }, () => isRefresh && this.leftTabRef.reportStatisticsReportList())} diff --git a/pc4mobx/hrmSalary/pages/reportView/index.less b/pc4mobx/hrmSalary/pages/reportView/index.less index e1e94313..4fc5e700 100644 --- a/pc4mobx/hrmSalary/pages/reportView/index.less +++ b/pc4mobx/hrmSalary/pages/reportView/index.less @@ -214,6 +214,7 @@ .wea-form-item .wea-form-item-wrapper .wea-field-readonly { white-space: pre-wrap !important; + line-height: 28px; } .wea-slide-modal-title { diff --git a/pc4mobx/hrmSalary/pages/roleManagement/components/addRoleDialog/index.js b/pc4mobx/hrmSalary/pages/roleManagement/components/addRoleDialog/index.js new file mode 100644 index 00000000..83c24cd1 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/roleManagement/components/addRoleDialog/index.js @@ -0,0 +1,91 @@ +/* + * 角色新增 + * + * @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 { Button, message } from "antd"; +import { getSearchs } from "../../../../util"; +import { roleConditions } from "../conditions"; +import * as API from "../../../../apis/taxAgent"; +import "../index.less"; + +const getLabel = WeaLocaleProvider.getLabel; + +@inject("taxAgentStore") +@observer +class Index extends Component { + constructor(props) { + super(props); + this.state = { + conditions: [], loading: false, formData: { taxAgentIds: [], sobIds: [] } + }; + } + + 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) })) + })) + }, () => nextProps.taxAgentStore.roleForm.initFormFields(this.state.conditions)); + } + if (nextProps.visible !== this.props.visible && !nextProps.visible) nextProps.taxAgentStore.initRoleForm(); + } + + save = (isSetting) => { + const { taxAgentStore: { roleForm } } = this.props; + const { formData } = this.state; + roleForm.validateForm().then(f => { + if (f.isValid) { + const payload = roleForm.getFormParams(); + this.setState({ loading: true }); + API.saveAuthRole({ ...payload, ...formData }).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, selectedKey: "auth.MemberTargetTypeEnum" + }); + } else { + message.error(errormsg); + } + }); + } else { + f.showErrors(); + } + }); + }; + handleFormChange = (val) => { + const key = _.keys(val)[0]; + if (key === "taxAgentIds" || key === "sobIds") { + this.setState({ formData: { ...this.state.formData, ...val } }); + } + }; + + render() { + const { conditions, loading, roleSetDialog } = this.state; + const { taxAgentStore: { roleForm } } = this.props; + return ( + this.save()}>{getLabel(111, "保存")}, + + ]} + > +
    {getSearchs(roleForm, conditions, 1, false, this.handleFormChange)}
    +
    + ); + } +} + +export default Index; diff --git a/pc4mobx/hrmSalary/pages/roleManagement/components/advanceInputBtn/index.js b/pc4mobx/hrmSalary/pages/roleManagement/components/advanceInputBtn/index.js new file mode 100644 index 00000000..77d46acc --- /dev/null +++ b/pc4mobx/hrmSalary/pages/roleManagement/components/advanceInputBtn/index.js @@ -0,0 +1,36 @@ +/* + * 业务线管理 + * 高级搜索 + * @Author: 黎永顺 + * @Date: 2024/9/24 + * @Wechat: + * @Email: 971387674@qq.com + * @description: +*/ +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("taxAgentStore") +@observer +class Index extends Component { + render() { + const { taxAgentStore: { advanceForm } } = this.props; + return ( +
    + advanceForm.updateFields({ name: v })} + onSearch={this.props.onAdvanceSearch} + /> + +
    + ); + } +} + +export default Index; diff --git a/pc4mobx/hrmSalary/pages/roleManagement/components/advanceInputBtn/index.less b/pc4mobx/hrmSalary/pages/roleManagement/components/advanceInputBtn/index.less new file mode 100644 index 00000000..556cfd69 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/roleManagement/components/advanceInputBtn/index.less @@ -0,0 +1,27 @@ +.role-advance-search { + display: flex; + align-items: center; + position: relative; + + .wea-advanced-search { + top: 0; + 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; + } +} diff --git a/pc4mobx/hrmSalary/pages/roleManagement/components/advanceSearchPannel/index.js b/pc4mobx/hrmSalary/pages/roleManagement/components/advanceSearchPannel/index.js new file mode 100644 index 00000000..72f0970d --- /dev/null +++ b/pc4mobx/hrmSalary/pages/roleManagement/components/advanceSearchPannel/index.js @@ -0,0 +1,115 @@ +/* + * 业务线管理 + * 高级搜索面板 + * @Author: 黎永顺 + * @Date: 2024/9/24 + * @Wechat: + * @Email: 971387674@qq.com + * @description: +*/ +import React, { Component } from "react"; +import { inject, observer } from "mobx-react"; +import { WeaLocaleProvider, WeaTools } from "ecCom"; +import { roleSearchConditions } from "../conditions"; +import { getAuthOptTree } from "../../../../apis/taxAgent"; +import { getSearchs } from "../../../../util"; +import { Button } from "antd"; + +const getKey = WeaTools.getKey; +const getLabel = WeaLocaleProvider.getLabel; + +@inject("taxAgentStore") +@observer +class AdvanceSearchPannel extends Component { + constructor(props) { + super(props); + this.state = { conditions: [] }; + } + + async componentDidMount() { + const { taxAgentStore: { advanceForm } } = this.props; + const { data } = await getAuthOptTree(); + this.setState({ + conditions: _.map(roleSearchConditions, item => ({ + ...item, title: getLabel(item.lanId, item.title), + items: _.map(item.items, o => { + if (getKey(o) === "opts") { + return { + ...o, label: getLabel(o.lanId, o.label), + options: _.map(o.options, k => ({ ...k, showname: getLabel(k.lanId, k.showname) })) + }; + } else if (getKey(o) === "pages") { + return { + ...o, label: getLabel(o.lanId, o.label), + treeData: [{ + label: data.name, value: data.key, key: data.key, id: data.key, name: data.name, + children: _.map(data.modules, i => ({ + label: i.name, value: `${data.key}-${i.key}`, key: `${data.key}-${i.key}`, + id: `${data.key}-${i.key}`, name: i.name, + children: _.map(i.pages, k => ({ + label: k.name, value: k.key, key: k.key, selectable: true, + id: k.key, name: k.name + })) + })) + }] + }; + } + return { ...o, label: getLabel(o.lanId, o.label) }; + }) + })) + }, () => advanceForm.initFormFields(this.state.conditions)); + } + + handleReset = () => { + const { taxAgentStore: { advanceForm } } = this.props; + this.setState({ + conditions: _.map(this.state.conditions, item => ({ + ...item, items: _.map(item.items, o => ({ ...o, value: "" })) + })) + }, () => advanceForm.resetForm()); + }; + handleFormChange = (val) => { + const key = _.keys(val)[0]; + const { taxAgentStore: { advanceForm } } = this.props; + if (key === "taxAgentIds" || key === "sobIds" || key === "pages") { + this.setState({ + conditions: _.map(this.state.conditions, item => ({ + ...item, items: _.map(item.items, o => { + if (key === getKey(o)) { + return { ...o, value: _.map(val[key], o => o.id).join(",") }; + } + return { ...o, value: advanceForm.getFormParams()[getKey(o)] }; + }) + })) + }); + } + }; + + render() { + const { taxAgentStore: { advanceForm } } = this.props; + const { conditions } = this.state; + return ( + +
    + {getSearchs(advanceForm, conditions, 2, false, this.handleFormChange)} +
    +
    +
    + + + + + + + + + +
    +
    +
    + ); + } +} + +export default AdvanceSearchPannel; + diff --git a/pc4mobx/hrmSalary/pages/roleManagement/components/conditions.js b/pc4mobx/hrmSalary/pages/roleManagement/components/conditions.js new file mode 100644 index 00000000..6a32be00 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/roleManagement/components/conditions.js @@ -0,0 +1,261 @@ +export const roleConditions = [ + { + items: [ + { + conditionType: "INPUT", + domkey: ["name"], + fieldcol: 16, + label: "名称", + lanId: 111, + labelcol: 6, + value: "", + rules: "required|string", + viewAttr: 3 + }, + { + browserConditionParam: { + completeURL: "/api/bs/hrmsalary/taxAgent/listAuth", + dataParams: { filterType: "QUERY_DATA" }, + filterByName: true, + tableProps: {}, + isSingle: false, + searchParamsKey: "name" + }, + conditionType: "CUSTOMBROWSER", + domkey: ["taxAgentIds"], + fieldcol: 16, + label: "个税扣缴义务人", + lanId: 111, + labelcol: 6, + rules: "required|string", + viewAttr: 3 + }, + { + browserConditionParam: { + completeURL: "/api/bs/hrmsalary/salarysob/listAuth", + dataParams: { filterType: "QUERY_DATA" }, + filterByName: true, + tableProps: {}, + isSingle: false, + searchParamsKey: "name" + }, + conditionType: "CUSTOMBROWSER", + domkey: ["sobIds"], + fieldcol: 16, + label: "薪资账套", + lanId: 111, + labelcol: 6, + rules: "required|string", + viewAttr: 3 + }, + { + conditionType: "TEXTAREA", + domkey: ["description"], + fieldcol: 16, + label: "描述", + lanId: 111, + labelcol: 6, + value: "", + viewAttr: 2 + } + ], + defaultshow: true, + title: "" + } +]; +export const roleOperatorConditions = [ + { + items: [ + { + conditionType: "INPUT", + domkey: ["targetTypeName"], + fieldcol: 18, + label: "对象类型", + lanId: 111, + labelcol: 6, + value: "", + viewAttr: 1 + }, + { + conditionType: "BROWSER", + domkey: ["targetName"], + fieldcol: 18, + label: "对象", + lanId: 111, + labelcol: 6, + value: "", + rules: "required", + viewAttr: 3 + }, + { + conditionType: "SELECT", + domkey: ["link"], + fieldcol: 18, + label: "连接符", + lanId: 111, + labelcol: 6, + value: "", + rules: "required|string", + viewAttr: 3 + }, + { + conditionType: "INPUTNUMBER", + domkey: ["sortedIndex"], + fieldcol: 18, + label: "批次", + lanId: 111, + labelcol: 6, + value: "", + rules: "required", + viewAttr: 3 + } + ], + defaultshow: true, + title: "" + } +]; +export const roleSearchConditions = [ + { + items: [ + { + conditionType: "INPUT", + domkey: ["name"], + fieldcol: 16, + label: "名称", + lanId: 111, + labelcol: 8, + value: "", + viewAttr: 2 + }, + { + browserConditionParam: { + completeURL: "/api/bs/hrmsalary/taxAgent/listAuth", + dataParams: { filterType: "QUERY_DATA" }, + filterByName: true, + tableProps: {}, + isSingle: false, + searchParamsKey: "name" + }, + conditionType: "CUSTOMBROWSER", + domkey: ["taxAgentIds"], + fieldcol: 16, + label: "个税扣缴义务人", + lanId: 111, + labelcol: 8, + viewAttr: 2 + }, + { + browserConditionParam: { + completeParams: {}, + conditionDataParams: {}, + dataParams: {}, + destDataParams: {}, + hasAddBtn: false, + hasAdvanceSerach: true, + idSeparator: ",", + isAutoComplete: 1, + isDetail: 0, + isMultCheckbox: false, + isSingle: false, + linkUrl: "", + pageSize: 10, + quickSearchName: "", + replaceDatas: [], + type: "17" + }, + conditionType: "BROWSER", + domkey: ["roleEmpIds"], + fieldcol: 16, + isQuickSearch: false, + label: "成员", + lanId: 111, + labelcol: 8, + viewAttr: 2 + }, + { + browserConditionParam: { + completeURL: "/api/bs/hrmsalary/salarysob/listAuth", + dataParams: { filterType: "QUERY_DATA" }, + filterByName: true, + tableProps: {}, + isSingle: false, + searchParamsKey: "name" + }, + conditionType: "CUSTOMBROWSER", + domkey: ["sobIds"], + fieldcol: 16, + label: "薪资账套", + lanId: 111, + labelcol: 8, + viewAttr: 2 + }, + { + browserConditionParam: { + completeParams: {}, + conditionDataParams: {}, + dataParams: {}, + destDataParams: {}, + hasAddBtn: false, + hasAdvanceSerach: true, + idSeparator: ",", + isAutoComplete: 1, + isDetail: 0, + isMultCheckbox: false, + isSingle: false, + linkUrl: "", + pageSize: 10, + quickSearchName: "", + replaceDatas: [], + type: "17" + }, + conditionType: "BROWSER", + domkey: ["employeeIds"], + fieldcol: 16, + isQuickSearch: false, + label: "数据", + lanId: 111, + labelcol: 8, + viewAttr: 2 + }, + { + conditionType: "SELECT", + domkey: ["opts"], + fieldcol: 16, + label: "权限项", + lanId: 111, + labelcol: 8, + multiple: true, + options: [ + { key: "query", showname: "查询", lanId: 111 }, + { key: "admin", showname: "管理", lanId: 111 } + ], + value: "", + viewAttr: 2 + }, + { + browserConditionParam: { + completeURL: "", + dataParams: { filterType: "" }, + filterByName: true, + tableProps: {}, + isSingle: false, + treeSelect: true, + searchParamsKey: "name" + }, + conditionType: "CUSTOMBROWSER", + domkey: ["pages"], + fieldcol: 16, + label: "页面", + lanId: 111, + labelcol: 8, + treeData: [], + value: "", + viewAttr: 2 + } + ], + defaultshow: true, + title: "基本信息", + lanId: 111, + col: 2 + } +]; diff --git a/pc4mobx/hrmSalary/pages/roleManagement/components/index.less b/pc4mobx/hrmSalary/pages/roleManagement/components/index.less new file mode 100644 index 00000000..aaac5a7e --- /dev/null +++ b/pc4mobx/hrmSalary/pages/roleManagement/components/index.less @@ -0,0 +1,101 @@ +.tax_role_setting_browser { + width: 100%; + display: inline-block !important; + + .wea-field-readonly.border { + cursor: default !important; + } + + .wea-field-readonly.border .child-item { + margin-bottom: 4px; + } + + .only-operate { + 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_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:last-child { + text-align: right; + } + } + + .tax_role_browser_form_item { + margin: 12px 14px; + } + + .tax_role_auth_tree { + padding: 10px 20px; + } + } + + .tax_role_operator_setting_table { + .setting_table_title { + & > .operator { + line-height: 45px; + display: flex; + justify-content: space-between; + align-items: center; + } + } + } + } +} + +.role-dialog { + .form-dialog-layout { + .ant-select-selection { + height: auto !important; + } + } +} diff --git a/pc4mobx/hrmSalary/pages/roleManagement/components/roleDetailSetDialog/authTree.js b/pc4mobx/hrmSalary/pages/roleManagement/components/roleDetailSetDialog/authTree.js new file mode 100644 index 00000000..d9d972ac --- /dev/null +++ b/pc4mobx/hrmSalary/pages/roleManagement/components/roleDetailSetDialog/authTree.js @@ -0,0 +1,90 @@ +/* + * 角色权限设置 + * + * @Author: 黎永顺 + * @Date: 2024/8/21 + * @Wechat: + * @Email: 971387674@qq.com + * @description: +*/ +import React, { Component } from "react"; +import * as API from "../../../../apis/taxAgent"; +import { Row } from "antd"; +import { WeaLocaleProvider, WeaTree } from "ecCom"; + +const getLabel = WeaLocaleProvider.getLabel; + +class AuthTree extends Component { + constructor(props) { + super(props); + this.state = { + checkedKeys: [], expandedKeys: [], datas: {} + }; + } + + componentDidMount() { + const { roleId } = this.props; + API.getAuthOptTree({ roleId }).then(({ status, data }) => { + if (status) { + this.setState({ + datas: { + canClick: true, id: data.key, nodeid: data.key, isParent: true, name: data.name, + subs: _.map(data.modules, item => ({ + ...item, canClick: true, id: item.key, nodeid: item.key, pid: data.key, isParent: !_.isEmpty(item.pages), + subs: _.map(item.pages, o => ({ + ...o, canClick: true, id: `${item.key}-${o.key}`, nodeid: `${item.key}-${o.key}`, + pid: item.key, isParent: !_.isEmpty(o.opts), + subs: _.map(o.opts, k => ({ + canClick: true, id: `${o.key}-${k.key}`, name: k.name, nodeid: `${o.key}-${k.key}`, + pid: `${item.key}-${o.key}`, isParent: false, able: k.able + })) + })) + })) + } + }, () => this.setState({ expandedKeys: this.initExpandKeys(), checkedKeys: this.initCheckedKeys() })); + } + }); + } + + initExpandKeys = () => { + const { datas } = this.state; + const parentIds = []; + const findParent = (node) => { + if (node.subs && node.subs.length > 0) { + parentIds.push(node.id); + node.subs.forEach(child => findParent(child)); + } + }; + findParent(datas); + return parentIds; + }; + initCheckedKeys = () => { + const { datas } = this.state; + const checkedIds = []; + const findCheckedId = (node) => { + if (node.subs && node.subs.length > 0) { + node.subs.forEach(child => { + if (!!child.able) checkedIds.push(child.id); + findCheckedId(child); + }); + } + }; + findCheckedId(datas); + return checkedIds; + }; + + render() { + const { checkedKeys, expandedKeys, datas } = this.state; + return ( + + this.setState({ checkedKeys })} checkedKeys={checkedKeys} + expandedKeys={expandedKeys} onExpand={expandedKeys => this.setState({ expandedKeys })} + datas={datas} + /> + + ); + } +} + +export default AuthTree; diff --git a/pc4mobx/hrmSalary/pages/roleManagement/components/roleDetailSetDialog/editRoleDialog.js b/pc4mobx/hrmSalary/pages/roleManagement/components/roleDetailSetDialog/editRoleDialog.js new file mode 100644 index 00000000..d8fe3e0e --- /dev/null +++ b/pc4mobx/hrmSalary/pages/roleManagement/components/roleDetailSetDialog/editRoleDialog.js @@ -0,0 +1,155 @@ +/* + * 编辑角色操作者 + * + * @Author: 黎永顺 + * @Date: 2024/8/20 + * @Wechat: + * @Email: 971387674@qq.com + * @description: +*/ +import React, { Component } from "react"; +import { inject, observer } from "mobx-react"; +import { WeaDialog, WeaLocaleProvider, WeaTools } from "ecCom"; +import { Button } from "antd"; +import { roleOperatorConditions } from "../conditions"; +import { getSearchs } from "../../../../util"; + +const getLabel = WeaLocaleProvider.getLabel; +const getKey = WeaTools.getKey; + +@inject("taxAgentStore") +@observer +class EditRoleDialog extends Component { + constructor(props) { + super(props); + this.state = { + conditions: [], loading: false, targetSob: {} + }; + } + + componentWillReceiveProps(nextProps, nextContext) { + if (nextProps.visible !== this.props.visible && nextProps.visible) { + this.setState({ + conditions: _.map(roleOperatorConditions, item => ({ + ...item, items: _.map(item.items, o => { + o = { ...o, label: getLabel(o.lanId, o.label), value: String(nextProps.record[getKey(o)]) }; + switch (getKey(o)) { + case "link": + o = { ...o, options: nextProps.linkOptions, hide: _.isEmpty(nextProps.linkOptions) }; + break; + case "sortedIndex": + o = { ...o, hide: _.isEmpty(nextProps.linkOptions) }; + break; + case "targetName": + o = ["EMP", "DEPARTMENT", "JOB", "SUB_COMPANY", "ROLE"].includes(nextProps.record.targetType) ? + { + ...o, value: "", browserConditionParam: { + ...this.renderBrowserType(nextProps.record.targetType), + replaceDatas: [{ id: nextProps.record["target"], name: nextProps.record[getKey(o)] }] + } + } : + nextProps.record.targetType === "SQL" ? { + ...o, conditionType: "TEXTAREA", otherParams: { minRows: 3 } + } : nextProps.record.targetType === "LEVEL" ? + { + ...o, startValue: nextProps.record[getKey(o)].split("-")[0], + endValue: nextProps.record[getKey(o)].split("-")[1], + conditionType: "SCOPE", precision: 0 + } : (nextProps.record.targetType === "SOB" || + nextProps.record.targetType === "TAX") ? { + ...o, value: nextProps.record["target"], + conditionType: "CUSTOMBROWSER", browserConditionParam: { + completeURL: nextProps.record.targetType === "SOB" ? + "/api/bs/hrmsalary/salarysob/listAuth" : "/api/bs/hrmsalary/taxAgent/listAuth", + dataParams: { filterType: "QUERY_DATA" }, + filterByName: true, isSingle: true, + tableProps: {}, searchParamsKey: "name", + replaceDatas: [{ id: nextProps.record["target"], name: nextProps.record["targetName"] }] + } + } : { ...o }; + break; + default: + break; + } + return o; + }) + })), + targetSob: { id: nextProps.record["target"], name: nextProps.record["targetName"] } + }, () => nextProps.taxAgentStore.roleOperatorForm.initFormFields(this.state.conditions)); + } + if (nextProps.visible !== this.props.visible && !nextProps.visible) { + this.setState({ targetSob: {} }); + nextProps.taxAgentStore.initRoleOperatorForm(); + } + if (nextProps.loading !== this.props.loading && !nextProps.loading) this.props.onCancel(); + } + + renderBrowserType = (enumType) => { + let browserType = {}; + switch (enumType) { + case "EMP": + browserType = { ...browserType, type: 17, isSingle: true, title: getLabel(82246, "人员选择") }; + break; + case "DEPARTMENT": + browserType = { ...browserType, type: 57, isSingle: true, title: getLabel(111, "部门选择") }; + break; + case "JOB": + browserType = { ...browserType, type: 278, isSingle: true, title: getLabel(111, "岗位选择") }; + break; + case "SUB_COMPANY": + browserType = { ...browserType, type: 164, isSingle: true, title: getLabel(111, "分部选择") }; + break; + case "ROLE": + browserType = { ...browserType, type: 65, isSingle: true, title: getLabel(111, "角色选择") }; + break; + default: + break; + } + return browserType; + }; + save = () => { + const { targetSob } = this.state; + const { taxAgentStore: { roleOperatorForm }, record, onChange } = this.props; + roleOperatorForm.validateForm().then(f => { + if (f.isValid) { + const { targetName: __, link, sortedIndex } = roleOperatorForm.getFormParams(); + const targetName = roleOperatorForm.getFormDatas().targetName; + onChange([_.assign(record, { + editId: record.id, sortedIndex, + id: record.targetType === "LEVEL" ? targetName.value.join("-") : targetName.value, + name: record.targetType === "SQL" ? __ : + record.targetType === "LEVEL" ? __.join("-") : (targetName.valueSpan || targetSob.name), + link: link === "undefined" ? "OR" : link + })]); + } else { + f.showErrors(); + } + }); + }; + handleFormChange = (val) => { + const { record } = this.props; + const key = _.keys(val)[0]; + if (key === "targetName" && (record.targetType === "SOB" || record.targetType === "TAX")) + this.setState({ targetSob: _.head(val[key]) }); + }; + + render() { + const { conditions } = this.state; + const { taxAgentStore: { roleOperatorForm }, linkOptions, loading } = this.props; + return ( + {getLabel(111, "保存")} + ]} + > +
    + {getSearchs(roleOperatorForm, conditions, 1, false, this.handleFormChange)} +
    +
    + ); + } +} + +export default EditRoleDialog; diff --git a/pc4mobx/hrmSalary/pages/roleManagement/components/roleDetailSetDialog/index.js b/pc4mobx/hrmSalary/pages/roleManagement/components/roleDetailSetDialog/index.js new file mode 100644 index 00000000..bcacf2ec --- /dev/null +++ b/pc4mobx/hrmSalary/pages/roleManagement/components/roleDetailSetDialog/index.js @@ -0,0 +1,476 @@ +/* + * 角色详情设置弹窗 + * + * @Author: 黎永顺 + * @Date: 2024/8/5 + * @Wechat: + * @Email: 971387674@qq.com + * @description: +*/ +import React, { Component } from "react"; +import { inject, observer } from "mobx-react"; +import { + WeaBrowser, + WeaDialog, + WeaFormItem, + WeaInputNumber, + WeaLocaleProvider, + WeaScope, + WeaSelect, + WeaTab, + WeaTable, + WeaTextarea, + WeaTools +} from "ecCom"; +import { commonEnumList } from "../../../../apis/archive"; +import EditRoleDialog from "./editRoleDialog"; +import AuthTree from "./authTree"; +import * as API from "../../../../apis/taxAgent"; +import { Button, Col, message, Modal, Row } from "antd"; +import "../index.less"; +import CustomBrowser from "../../../../components/CustomBrowser"; +import { roleConditions } from "../conditions"; +import { getSearchs } from "../../../../util"; + +const getLabel = WeaLocaleProvider.getLabel; +const getKey = WeaTools.getKey; +const APIFOX = { + "auth.MemberTargetTypeEnum": API.authMemberList, + "save.auth.MemberTargetTypeEnum": API.saveAuthMember, + "delete.auth.MemberTargetTypeEnum": API.deleteAuthMember, + "sync.auth.MemberTargetTypeEnum": API.syncAuthMember, + "auth.DataTargetTypeEnum": API.authDataList, + "save.auth.DataTargetTypeEnum": API.saveAuthData, + "delete.auth.DataTargetTypeEnum": API.deleteAuthData, + "sync.auth.DataTargetTypeEnum": API.syncAuthData +}; + +@inject("taxAgentStore") +@observer +class Index extends Component { + constructor(props) { + super(props); + this.state = { + selectedKey: "baseinfo", name: "", options: [], enumType: "", selectedRowKeys: [], + replaceDatas: [], loading: { set: false, query: false, async: false, delete: false }, + columns: [], dataSource: [], pageInfo: { current: 1, pageSize: 10, total: 0 }, + editOperatorDialog: { visible: false, linkOptions: [], record: {} }, + dataTargetSettings: { link: "OR", sortedIndex: null }, conditions: [], + formData: { taxAgentIds: [], sobIds: [] } + }; + } + + componentWillReceiveProps(nextProps, nextContext) { + if (nextProps.visible !== this.props.visible && nextProps.visible) { + this.setState({ + name: nextProps.name, selectedKey: nextProps.selectedKey || "baseinfo" + }, () => { + !["auth.AuthTargetTypeEnum", "baseinfo"].includes(this.state.selectedKey) && this.getEnumList(); + !["auth.AuthTargetTypeEnum", "baseinfo"].includes(this.state.selectedKey) && this.getSettingRoler(nextProps.roleId); + this.state.selectedKey === "baseinfo" && this.getRole(nextProps.roleId); + this.state.selectedKey === "auth.DataTargetTypeEnum" && this.getConnectSymbol(); + }); + } else { + this.setState({ + selectedRowKeys: [], replaceDatas: [], pageInfo: { current: 1, pageSize: 10, total: 0 }, + dataTargetSettings: { link: "OR", sortedIndex: "" } + }); + } + } + + getRole = (id) => { + API.getRole({ id }).then(({ status, data }) => { + if (status) { + this.setState({ + conditions: _.map(roleConditions, item => ({ + ...item, items: _.map(item.items, o => { + if (getKey(o) === "taxAgentIds" || getKey(o) === "sobIds") { + return { + ...o, label: getLabel(o.lanId, o.label), + value: _.map(data[getKey(o)], i => String(i.id)).join(","), + browserConditionParam: { + ...o.browserConditionParam, + replaceDatas: _.map(data[getKey(o)], i => ({ id: String(i.id), name: i.name })) + } + }; + } + return { ...o, label: getLabel(o.lanId, o.label) }; + }) + })), + formData: { + taxAgentIds: _.map(data["taxAgentIds"], i => ({ id: String(i.id), name: i.name })), + sobIds: _.map(data["sobIds"], i => ({ id: String(i.id), name: i.name })) + } + }, () => { + this.props.taxAgentStore.roleForm.initFormFields(this.state.conditions); + this.props.taxAgentStore.roleForm.updateFields({ + name: { value: data.name }, + description: { value: data.description } + }); + }); + } + }); + }; + 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: "" }); + }); + }; + 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: [ + ...columns, { + dataIndex: "opt", title: getLabel(111, "操作"), width: 120, + render: (__, record) => (
    this.handleEditOperator(record)}>{getLabel(111, "编辑")}) + } + ] + }); + } + }); + }; + handleEditOperator = (record) => { + this.setState({ editOperatorDialog: { ...this.state.editOperatorDialog, visible: true, record } }); + }; + getConnectSymbol = async () => { + const payload = { enumClass: `com.engine.salary.enums.auth.DataLinkEnum` }; + const { data } = await commonEnumList(payload); + const linkOptions = _.map(data, o => ({ key: o.enum, showname: o.defaultLabel })); + this.setState({ editOperatorDialog: { ...this.state.editOperatorDialog, linkOptions } }); + }; + addOperatorSettings = () => { + const { roleId } = this.props; + const { selectedKey, enumType: targetType, replaceDatas, dataTargetSettings } = this.state; + if (_.isEmpty(replaceDatas)) { + Modal.warning({ + title: getLabel(111, "系统提示"), + content: getLabel(111, "请先选择操作对象的值!") + }); + return; + } + const payload = _.map(replaceDatas, o => ({ + roleId, target: o.id || "", id: o.editId || "", + targetType: o.targetType || targetType, + targetName: o.name || "", + link: o.link || dataTargetSettings.link, + sortedIndex: o.sortedIndex || dataTargetSettings.sortedIndex + })); + 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.setState({ replaceDatas: [] }, () => this.getSettingRoler(roleId)); + } else { + message.error(errormsg); + } + }); + }; + deleteOperatorSettings = () => { + const { roleId } = this.props; + const { selectedKey, selectedRowKeys } = this.state; + if (_.isEmpty(selectedRowKeys)) { + Modal.warning({ + title: getLabel(111, "信息确认"), + content: getLabel(111, "确定要删除所选批次吗?") + }); + return; + } + this.setState({ loading: { ...this.state.loading, delete: true } }); + APIFOX[`delete.${selectedKey}`](selectedRowKeys).then(({ status, errormsg }) => { + this.setState({ loading: { ...this.state.loading, delete: false } }); + if (status) { + message.success(getLabel(111, "操作成功!")); + this.setState({ selectedRowKeys: [] }, () => this.getSettingRoler(roleId)); + } else { + message.error(errormsg); + } + }); + }; + saveAuthOpt = () => { + const { roleId } = this.props, { selectedKey } = this.state; + if (selectedKey === "baseinfo") { + this.saveBaseInfo(); + return; + } + const { state: { checkedKeys } } = this.authTreeRef; + const payload = { + roleId, opts: _.reduce(checkedKeys, (pre, cur) => { + if (cur.indexOf("query") !== -1 || cur.indexOf("admin") !== -1) { + const [page, opt] = cur.split("-"); + return [...pre, { page, opt }]; + } + return pre; + }, []) + }; + this.setState({ loading: { ...this.state.loading, set: true } }); + API.saveAuthOpt(payload).then(({ status, errormsg }) => { + this.setState({ loading: { ...this.state.loading, set: false } }); + if (status) { + message.success(getLabel(111, "操作成功!")); + } else { + message.error(errormsg); + } + }); + }; + saveBaseInfo = () => { + const { taxAgentStore: { roleForm }, roleId } = this.props; + const { formData } = this.state; + roleForm.validateForm().then(f => { + if (f.isValid) { + const payload = roleForm.getFormParams(); + this.setState({ loading: { ...this.state.loading, set: true } }); + API.saveAuthRole({ id: roleId, ...payload, ...formData }).then(({ status, errormsg }) => { + this.setState({ loading: { ...this.state.loading, set: false } }); + if (status) { + message.success(getLabel(111, "操作成功!")); + this.props.onSearch && this.props.onSearch(); + } else { + message.error(errormsg); + } + }); + } else { + f.showErrors(); + } + }); + }; + syncAuthData = () => { + const { roleId } = this.props, { selectedKey } = this.state; + this.setState({ async: true }); + APIFOX[`sync.${selectedKey}`]({ roleId }).then(({ status, errormsg }) => { + this.setState({ async: false }); + if (status) { + message.success(getLabel(111, "操作成功!")); + } else { + message.error(errormsg); + } + }); + }; + getOperatorSetting = () => { + const { roleId, taxAgentStore: { roleForm } } = this.props; + const { selectedKey, enumType, replaceDatas, conditions } = this.state; + if (!["auth.AuthTargetTypeEnum", "baseinfo"].includes(selectedKey)) { + 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 ( + this.setState({ replaceDatas: [{ id: v, name: v }] })}/> + ); + case "LEVEL": + return ( + cur.id.split("-"), [])} + onChange={v => this.setState({ replaceDatas: [{ id: v.join("-"), name: v.join("-") }] })}/> + ); + case "SOB": + return ( + (o.id))} + onCustomChange={replaceDatas => this.setState({ + replaceDatas: _.map(_.values(replaceDatas), o => ({ id: o.id, name: o.name })) + })} + /> + ); + case "TAX": + return ( + (o.id))} + onCustomChange={replaceDatas => this.setState({ + replaceDatas: _.map(_.values(replaceDatas), o => ({ id: o.id, name: o.name })) + })} + /> + ); + default: + return (); + } + return ( + this.setState({ replaceDatas })}/> + ); + } else if (selectedKey === "auth.AuthTargetTypeEnum") { + return ( this.authTreeRef = dom}/>); + } + return getSearchs(roleForm, conditions, 1, false, this.handleFormChange); + }; + handleFormChange = (val) => { + const key = _.keys(val)[0]; + if (key === "taxAgentIds" || key === "sobIds") { + this.setState({ formData: { ...this.state.formData, ...val } }); + } + }; + + render() { + const { roleId, taxAgentStore } = this.props; + const { + selectedKey, name, options, enumType, pageInfo, columns, dataSource, loading, selectedRowKeys, editOperatorDialog, + dataTargetSettings + } = this.state; + const { linkOptions } = editOperatorDialog; + const tabs = [ + { title: getLabel(111, "基础信息"), viewcondition: "baseinfo" }, + { 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)); + } + }; + const rowSelection = { + selectedRowKeys, onChange: (selectedRowKeys) => this.setState({ selectedRowKeys }) + }; + const buttons = [ + , + + ]; + ["auth.AuthTargetTypeEnum", "baseinfo"].includes(selectedKey) && buttons.shift(); + !["auth.AuthTargetTypeEnum", "baseinfo"].includes(selectedKey) && buttons.pop(); + return ( + +
    + +
    + this.setState({ + selectedKey: v, replaceDatas: [], selectedRowKeys: [] + }, () => { + taxAgentStore.roleForm.resetForm(); + const { selectedKey } = this.state; + !["auth.AuthTargetTypeEnum", "baseinfo"].includes(selectedKey) && this.getEnumList(); + !["auth.AuthTargetTypeEnum", "baseinfo"].includes(selectedKey) && this.getSettingRoler(roleId); + selectedKey === "auth.DataTargetTypeEnum" && this.getConnectSymbol(); + selectedKey === "baseinfo" && this.getRole(roleId); + })}/> + { + !["auth.AuthTargetTypeEnum", "baseinfo"].includes(selectedKey) && + this.setState({ enumType: v, replaceDatas: [] })}/> + } + {this.getOperatorSetting()} + { + !["auth.AuthTargetTypeEnum", "baseinfo"].includes(selectedKey) && + + { + this.state.selectedKey === "auth.DataTargetTypeEnum" && + + + + + this.setState({ + dataTargetSettings: { ...dataTargetSettings, link } + })}/> + + + + + this.setState({ + dataTargetSettings: { ...dataTargetSettings, sortedIndex } + })}/> + + + + + } + + + + + } +
    +
    + {/*表格*/} + { + !["auth.AuthTargetTypeEnum", "baseinfo"].includes(selectedKey) && + + +
    + {getLabel(111, "已设操作者")} + +
    + + {/* 编辑操作者*/} + this.setState({ replaceDatas }, () => this.addOperatorSettings())} + onCancel={callback => this.setState({ + editOperatorDialog: { ...editOperatorDialog, visible: false, record: {} } + }, () => callback && callback())}/> + +
    + } +
    +
    + ); + } +} + +export default Index; diff --git a/pc4mobx/hrmSalary/pages/roleManagement/components/roleSetting/index.js b/pc4mobx/hrmSalary/pages/roleManagement/components/roleSetting/index.js new file mode 100644 index 00000000..31e392d8 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/roleManagement/components/roleSetting/index.js @@ -0,0 +1,81 @@ +/* + * 个税扣缴义务人-角色设置 + * + * @Author: 黎永顺 + * @Date: 2024/8/5 + * @Wechat: + * @Email: 971387674@qq.com + * @description: +*/ +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; + +class Index extends Component { + constructor(props) { + super(props); + this.state = { + addRoleDialog: { visible: false, taxAgentId: "" }, + roleSetDialog: { visible: false, roleId: "", name: "" } + }; + } + + 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, roleSetDialog } = this.state; + const { taxAgent, onSearch } = this.props; + const { role } = taxAgent; + return ( + + this.setState({ addRoleDialog: { taxAgentId: taxAgent.id, visible: true } })} + replaceDatas={_.map(role, o => ({ + 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())}/> + + ); + } +} + +export default Index; diff --git a/pc4mobx/hrmSalary/pages/roleManagement/index.js b/pc4mobx/hrmSalary/pages/roleManagement/index.js new file mode 100644 index 00000000..f379e1de --- /dev/null +++ b/pc4mobx/hrmSalary/pages/roleManagement/index.js @@ -0,0 +1,209 @@ +/* + * 角色管理 + * + * @Author: 黎永顺 + * @Date: 2024/9/6 + * @Wechat: + * @Email: 971387674@qq.com + * @description: +*/ +import React, { Component } from "react"; +import { inject, observer } from "mobx-react"; +import { WeaLocaleProvider, WeaTable, WeaTop } from "ecCom"; +import { Button, Dropdown, Menu, message, Modal } from "antd"; +import * as API from "../../apis/taxAgent"; +import AddRoleDialog from "./components/addRoleDialog"; +import RoleDetailSetDialog from "./components/roleDetailSetDialog"; +import AdvanceInputBtn from "./components/advanceInputBtn"; +import AdvanceSearchPannel from "./components/advanceSearchPannel"; +import LogDialog from "../../components/logViewModal"; +import cs from "classnames"; +import "./index.less"; + +const getLabel = WeaLocaleProvider.getLabel; + +@inject("taxAgentStore") +@observer +class Index extends Component { + constructor(props) { + super(props); + this.state = { + dataSource: [], columns: [], pageInfo: { current: 1, pageSize: 10, total: 0 }, + loading: false, selectedRowKeys: [], addRoleDialog: { taxAgentId: "", visible: false }, + roleSetDialog: { visible: false, roleId: "", name: "", selectedKey: "" }, + logDialogVisible: false, filterConditions: "", showSearchAd: false + }; + } + + componentDidMount() { + this.getRoleList(); + } + + getRoleList = () => { + const { taxAgentStore: { advanceForm } } = this.props, { pageInfo } = this.state; + const paylaod = { + ...pageInfo, ...advanceForm.getFormParams(), + employeeIds: !_.isEmpty(advanceForm.getFormParams()["employeeIds"]) ? advanceForm.getFormParams()["employeeIds"].split(",") : [], + opts: !_.isEmpty(advanceForm.getFormParams()["opts"]) ? advanceForm.getFormParams()["opts"].split(",") : [], + roleEmpIds: !_.isEmpty(advanceForm.getFormParams()["roleEmpIds"]) ? advanceForm.getFormParams()["roleEmpIds"].split(",") : [], + sobIds: !_.isEmpty(advanceForm.getFormParams()["sobIds"]) ? advanceForm.getFormParams()["sobIds"].split(",") : [], + taxAgentIds: !_.isEmpty(advanceForm.getFormParams()["taxAgentIds"]) ? advanceForm.getFormParams()["taxAgentIds"].split(",") : [], + pages: !_.isEmpty(advanceForm.getFormParams()["pages"]) ? advanceForm.getFormParams()["pages"].split(",") : [] + }; + this.setState({ loading: true }); + API.getRoleList(paylaod).then(({ status, data }) => { + this.setState({ loading: false }); + if (status) { + const { list: dataSource, columns, pageNum: current, pageSize, total } = data; + this.setState({ + dataSource, pageInfo: { ...pageInfo, current, pageSize, total }, + columns: [..._.map(columns, o => { + if ( + o.dataIndex === "resources" || o.dataIndex === "members" || + o.dataIndex === "opts" || o.dataIndex === "datas" + ) { + const tabsKey = { + resources: "baseinfo", + members: "auth.MemberTargetTypeEnum", + opts: "auth.AuthTargetTypeEnum", + datas: "auth.DataTargetTypeEnum" + }; + return { + ...o, render: (text, record) => ( + this.showRoleSetDialog({ + ...record, selectedKey: tabsKey[o.dataIndex] + })}>{text}) + }; + } + return { ...o }; + }), { + title: getLabel(111, "操作"), width: 150, dataIndex: "action", + render: (__, record) => ( + + this.showRoleSetDialog(record)}>{getLabel(111, "编辑")} + this.deleteAuthRole([record.id])}>{getLabel(111, "删除")} + this.handleDropMenuClick(e.key, record.id)}> + {getLabel(545781, "操作日志")} + + }> + + + + ) + }] + }); + } + }); + }; + showRoleSetDialog = (role) => this.setState({ + roleSetDialog: { visible: true, roleId: role.id, name: role.name, selectedKey: role.selectedKey } + }); + deleteAuthRole = (payload) => { + Modal.confirm({ + title: getLabel(111, "信息确认"), + content: getLabel(111, "确认要删除吗?"), + onOk: () => { + API.deleteAuthRole(payload).then(({ status, errormsg }) => { + if (status) { + message.success(getLabel(111, "操作成功!")); + this.setState({ selectedRowKeys: [] }, () => this.getRoleList()); + } else { + message.error(errormsg); + } + }); + } + }); + }; + handleDropMenuClick = (key, targetid = "") => { + switch (key) { + case "log": + this.setState({ + logDialogVisible: true, + filterConditions: targetid ? `[{\"connectCondition\":\"AND\",\"columIndex\":\"targetid\",\"type\":\"=\",\"value\":\"${targetid}\"}]` : "[]" + }); + break; + default: + break; + } + }; + + render() { + const { + dataSource, columns, pageInfo, loading, selectedRowKeys, addRoleDialog, roleSetDialog, + logDialogVisible, filterConditions, showSearchAd + } = this.state; + const { taxAgentStore: { PageAndOptAuth } } = this.props; + const admin = PageAndOptAuth.opts.includes("admin"); + const dropMenuDatas = [{ + key: "log", icon: , + content: getLabel(545781, "操作日志") + }]; + const buttons = [ + , + , + this.setState({ showSearchAd: true })} + onAdvanceSearch={() => this.setState({ pageInfo: { ...pageInfo, current: 1 } }, + () => this.getRoleList())}/> + ]; + 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.getRoleList()); + }, + onChange: current => { + this.setState({ pageInfo: { ...pageInfo, current } }, () => this.getRoleList()); + } + }; + const rowSelection = { + selectedRowKeys, onChange: (selectedRowKeys) => this.setState({ selectedRowKeys }) + }; + !admin && buttons.shift(); + !admin && buttons.shift(); + return ( + } iconBgcolor="#F14A2D" + buttons={buttons} className="rolemanagement-index" showDropIcon dropMenuDatas={dropMenuDatas} + onDropMenuClick={this.handleDropMenuClick}> +
    +
    + this.setState({ showSearchAd: false })} + onAdSearch={() => this.setState({ + showSearchAd: false, pageInfo: { ...pageInfo, current: 1 } + }, () => this.getRoleList())}/> +
    + + {/*添加角色*/} + this.setState({ + addRoleDialog: { ...addRoleDialog, visible: false } + }, () => callback && callback())}/> + {/*角色详情设置*/} + this.setState({ + roleSetDialog: { ...roleSetDialog, visible: false } + }, () => { + this.props.taxAgentStore.initRoleForm(); + callback && callback(); + })}/> +
    + {/*操作日志*/} + this.setState({ logDialogVisible: false })}/> +
    + ); + } +} + +export default Index; diff --git a/pc4mobx/hrmSalary/pages/roleManagement/index.less b/pc4mobx/hrmSalary/pages/roleManagement/index.less new file mode 100644 index 00000000..e911681c --- /dev/null +++ b/pc4mobx/hrmSalary/pages/roleManagement/index.less @@ -0,0 +1,60 @@ +.rolemanagement-index { + .rolemanagement-content { + height: 100%; + overflow-y: auto; + padding: 16px 16px 0; + background: rgb(246, 246, 246); + + .wea-new-table { + background: #FFF; + } + + .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: 247px; + 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 + } + } + + } + } + } + + .wea-input-focus .ant-input { + vertical-align: baseline; + } +} diff --git a/pc4mobx/hrmSalary/pages/ruleConfig/conditions.js b/pc4mobx/hrmSalary/pages/ruleConfig/conditions.js index c04384b0..d7340658 100644 --- a/pc4mobx/hrmSalary/pages/ruleConfig/conditions.js +++ b/pc4mobx/hrmSalary/pages/ruleConfig/conditions.js @@ -144,20 +144,20 @@ export const conditions = [ title: getLabel(111, "薪资核算固定列头数"), defaultshow: true }, - { - items: [ - { - conditionType: "SWITCH", - domkey: ["extEmpsWitch"], - fieldcol: 10, - label: getLabel(111, "开启非系统人员"), - labelcol: 8, - viewAttr: 2 - } - ], - title: getLabel(111, "非系统人员"), - defaultshow: true - }, + // { + // items: [ + // { + // conditionType: "SWITCH", + // domkey: ["extEmpsWitch"], + // fieldcol: 10, + // label: getLabel(111, "开启非系统人员"), + // labelcol: 8, + // viewAttr: 2 + // } + // ], + // title: getLabel(111, "非系统人员"), + // defaultshow: true + // }, { items: [ { diff --git a/pc4mobx/hrmSalary/pages/ruleConfig/ruleConfig.js b/pc4mobx/hrmSalary/pages/ruleConfig/ruleConfig.js index 3f24a0d6..d1dcdc12 100644 --- a/pc4mobx/hrmSalary/pages/ruleConfig/ruleConfig.js +++ b/pc4mobx/hrmSalary/pages/ruleConfig/ruleConfig.js @@ -10,10 +10,10 @@ import { WeaLocaleProvider, WeaTools, WeaTop } from "ecCom"; import { message, Modal } from "antd"; import * as API from "../../apis/ruleconfig"; import { conditions, payloadList } from "./conditions"; +import ProgressModal from "../../components/progressModal"; import { renderRuleForm } from "./form"; import { getConditionDomkeys } from "../../util"; import "./index.less"; -import ProgressModal from "../../components/progressModal"; const getKey = WeaTools.getKey; const getLabel = WeaLocaleProvider.getLabel; diff --git a/pc4mobx/hrmSalary/pages/salaryItem/columns.js b/pc4mobx/hrmSalary/pages/salaryItem/columns.js index b2cae4bd..4cc0d47a 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/columns.js +++ b/pc4mobx/hrmSalary/pages/salaryItem/columns.js @@ -2,56 +2,240 @@ import { WeaLocaleProvider } from "ecCom"; import { dataTypeOptions, patternOptions, roundingModeOptions } from "./options"; const getLabel = WeaLocaleProvider.getLabel; -export const columns = [ + + +export const salaryItemConditions = [ { - 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" + 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: "0", + rules: "required|string", + tipLanId: 111, + tip: "提示:开启后,每个薪资方案都有该薪资项目,可在具体薪资方案中删除", + viewAttr: 3 + }, + { + conditionType: "SWITCH", + domkey: ["hideDefault"], + fieldcol: 14, + label: "核算时隐藏", + lanId: 111, + labelcol: 8, + value: "0", + 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: "", + viewAttr: 2, + 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: "2", + 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: false, 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: "", + otherParams: { 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: "INPUTNUMBER", + domkey: ["defaultValue"], + fieldcol: 14, + label: "默认值", + lanId: 111, + labelcol: 8, + value: "", + otherParams: { precision: 2 }, + viewAttr: 2 + }, + { + conditionType: "INPUT", + domkey: ["formulaContent"], + fieldcol: 14, + label: "公式", + lanId: 111, + labelcol: 8, + value: "", + viewAttr: 3, + hide: true + }, + { + conditionType: "INPUT", + domkey: ["formulaId"], + fieldcol: 14, + label: "公式", + lanId: 111, + labelcol: 8, + value: "", + viewAttr: 3, + hide: true + }, + { + 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 } + }, + { + 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: "", + defaultshow: true } ]; export const salaryItemFields = [ diff --git a/pc4mobx/hrmSalary/pages/salaryItem/customSalaryItemSlide.js b/pc4mobx/hrmSalary/pages/salaryItem/customSalaryItemSlide.js index 9e407f56..28e46ef5 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/customSalaryItemSlide.js +++ b/pc4mobx/hrmSalary/pages/salaryItem/customSalaryItemSlide.js @@ -1,62 +1,210 @@ 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 SalaryItemForm from "./salaryItemForm"; -import "./index.less"; +import { salaryItemConditions } from "./columns"; +import { commonEnumList } from "../../apis/archive"; +import { postFetch } from "../../util/request"; +import { getItemForm } from "../../apis/item"; +const getLabel = WeaLocaleProvider.getLabel; +const getKey = WeaTools.getKey; + +@inject("salaryItemStore") +@observer export default class CustomSalaryItemSlide extends React.Component { constructor(props) { super(props); this.state = { - showForm: false, - formalModalVisible: false, - salaryItemName: "" + conditions: [], visible: false }; } - handleChange = (params) => { - this.props.onChange({ ...this.props.request, ...params }); - }; + 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(); + } + } - handleShowFormal = (salaryItemName) => { + handleChange = (data) => { + const { salaryItemStore: { itemsForm: form } } = this.props; + form.updateFields({ formulaContent: { value: data["formula"] }, formulaId: { value: data["id"] } }); + }; + initForm = async (props) => { + const { data: salaryItemForm } = props.id ? + 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" }) + ]); this.setState({ - formalModalVisible: true, - salaryItemName + conditions: _.map(salaryItemConditions, c => { + return { + ...c, items: _.map(c.items, fields => { + fields = { + ...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)) { + 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 })), + hide: String(salaryItemForm["sharedType"]) === "0" || !_.isNil(salaryItemForm["sharedType"]) + }; + break; + case "dataType": + case "valueType": + 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; + } + return fields; + }) + }; + }) + }, () => { + props.salaryItemStore.itemsForm.initFormFields(this.state.conditions); }); }; - - // 保存公式成功回调 - handleSaveFormal = (data) => { - this.handleChange({ - formulaId: data.id, formulaContent: data.formula, - originFormulaContent: data.referenceType === "formula" ? data.formula : "", - originSqlContent: data.referenceType === "sql" ? data.formula : "" + 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, 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 = () => { + const { salaryItemStore: { itemsForm: form } } = this.props; + const { conditions } = this.state, { isFormInit } = form, formParams = form.getFormParams(); + let group = []; + isFormInit && conditions.map(c => { + let items = []; + c.items.map(fields => { + items.push({ + com: ( + + + { + getKey(fields) === "formulaContent" && form.getFormParams().valueType !== "1" && + this.props.showOperateBtn && +
    this.setState({ visible: true })}/> + } + { + fields.tip && + } + ), + hide: fields.hide + }); + }); + group.push(); + }); + return group; + }; + renderTitle = () => { + const { title, buttons } = this.props; + return
    +
    +
    +
    {title}
    +
    +
    {buttons}
    +
    ; + }; render() { - 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: "" - })} - />} -
    + const { onClose, salaryItemStore: { itemsForm: form } } = this.props; + const { visible } = this.state; + return ( onClose()} + content={
    + {this.renderForm()} + {visible && + this.setState({ visible: false })} + /> + } +
    }/> ); } } diff --git a/pc4mobx/hrmSalary/pages/salaryItem/index.js b/pc4mobx/hrmSalary/pages/salaryItem/index.js index f6898090..dbcba6cc 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/index.js +++ b/pc4mobx/hrmSalary/pages/salaryItem/index.js @@ -1,18 +1,16 @@ import React from "react"; import { inject, observer } from "mobx-react"; -import { Button, Dropdown, Menu, message, Modal, Switch } from "antd"; -import { WeaInputSearch, WeaLoadingGlobal, WeaLocaleProvider, WeaNewScroll, WeaSlideModal, WeaTop } from "ecCom"; -import { renderLoading, toDecimal_n } from "../../util"; +import { Button, Dropdown, Menu, message, Modal } from "antd"; +import { WeaInputSearch, WeaLoadingGlobal, WeaLocaleProvider, WeaTop } from "ecCom"; +import * as API from "../../apis/item"; +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 SalaryItemImportDialog from "./salaryItemImport"; -import * as API from "../../apis/item"; +import "./index.less"; const { getLabel } = WeaLocaleProvider; @inject("salaryItemStore", "taxAgentStore", "salaryFileStore") @@ -21,192 +19,83 @@ export default class SalaryItem extends React.Component { constructor(props) { super(props); this.state = { - value: "", - selectedKey: "0", - editable: false, - isAdd: false, - searchValue: "", - formalModalVisible: false, - searchParams: { current: 1, pageSize: 10, total: 0 }, - selectedRowKeys: [], - syncSalarySetDialog: { visible: false, title: "", id: "" }, + name: "", isQuery: false, loading: false, sysVisible: false, + customItemDialog: { visible: false, title: "", buttons: [] },// 自定义薪资项弹窗 + syncSalarySetDialog: { visible: false, id: "" }, // 同步到薪资账套弹窗 logDialogVisible: false, filterConditions: "[]", salaryItemImpDialog: { visible: false, title: getLabel(24023, "数据导入") } }; - 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 - } - }); - }); - } - - 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(record) { - const { salaryItemStore: { deleteItemRequest, getTableDatas } } = this.props; + handleDeleteItem = (recordId) => { + const { selectedRowKeys, isQuery } = this.state; + const params = recordId ? [recordId] : selectedRowKeys; + if (_.isEmpty(params)) { + 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(params).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; - 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; - }); - 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]; }; + 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 }); + }); + }; + handleSalaryItem = (type) => { + const { customItemDialog: { id }, isQuery } = this.state; + const { salaryItemStore: { itemsForm: form } } = this.props; + 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: "" } + }); + }); - 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 + } else { + message.error(errormsg); + } + }); + } else { + !f1.isValid && f1.showErrors(); + !f2.taxAgentValidate && f1.showError("taxAgentIds", getLabel(111, "\"可见性范围\"未填写")); + !f2.formulaValidate && f1.showError("formulaContent", getLabel(111, `\"${form.getFormDatas().valueType.valueSpan}\"未填写`)); + this.forceUpdate(); } }); - }); - } - - 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 }); - } - - + }; onDropMenuClick = (key, targetid = "") => { switch (key) { case "log": @@ -228,206 +117,85 @@ export default class SalaryItem extends React.Component { } }); break; + case "customAdd": + case "edit": + const { taxAgentStore: { PageAndOptAuth } } = this.props; + const { loading } = this.state, showOperateBtn = PageAndOptAuth.opts.includes("admin"); + const editTitle = !showOperateBtn ? getLabel(111, "查看自定义薪资项目") : getLabel(111, "修改自定义薪资项目"); + const title = key === "edit" ? editTitle : getLabel(111, "新建自定义薪资项目"); + const buttons = key === "edit" ? [ + , + + ] : [ + , + + ]; + this.setState({ + customItemDialog: { + visible: true, title, buttons: showOperateBtn ? buttons : [], id: targetid + } + }); + break; + case "delete": + this.handleDeleteItem(targetid); + break; + case "sysAdd": + this.setState({ sysVisible: true }); + break; default: break; } }; render() { + const { taxAgentStore: { PageAndOptAuth } } = this.props; const { - salaryItemStore, salaryFileStore, taxAgentStore: { showOperateBtn, showSalaryItemBtn, taxAgentOption } - } = this.props; - const { userStatusList } = salaryFileStore; - const { selectedRowKeys, logDialogVisible, filterConditions, salaryItemImpDialog } = this.state; - const { loading, deleteItemRequest, getTableDatas } = salaryItemStore; - const { - tableDataSource, - tableColumns, - systemItemVisible, - setSystemItemVisible, - editSlideVisible, - setEditSlideVisible, - request - } = salaryItemStore; - if (this.getColumns().length === 2) { // 无权限处理 - return renderLoading(); - } - - 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); - } - }; - + selectedRowKeys, logDialogVisible, filterConditions, name, isQuery, customItemDialog, sysVisible, + salaryItemImpDialog + } = this.state; + const showOperateBtn = PageAndOptAuth.opts.includes("admin"); const menu = ( - - {getLabel(111, "新增系统薪资项")} + this.onDropMenuClick(key)}> + {getLabel(111, "新增系统薪资项")} ); - - const buttons = [ + let buttons = [ handleMenuClick({ key: "1" })}>{getLabel(111, "新增自定义薪资项")}, - , - this.setState({ searchValue: value })} - onSearch={value => this.handleSearch(value)}/> + onClick={() => this.onDropMenuClick("customAdd")}>{getLabel(111, "新增自定义薪资项")}, + , + this.setState({ name: val })} + placeholder={getLabel(111, "请输入名称")} onSearch={() => this.setState({ isQuery: !isQuery })}/> ]; - // 新建和修改保存的回调 - 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); - }; - const rowSelection = { - selectedRowKeys, - onChange: (selectedRowKeys) => this.setState({ selectedRowKeys }) - // getCheckboxProps: record => ({ - // disabled: !record.canDelete // Column configuration not to be checked - // }) - }; + let dropMenuDatas = [ + { key: "import", icon: , content: getLabel(111, "导入") }, + { key: "export", icon: , content: getLabel(111, "导出") }, + { key: "log", icon: , content: getLabel(545781, "操作日志") } + ]; + !showOperateBtn && (buttons = buttons.slice(-1)); + !showOperateBtn && (dropMenuDatas = dropMenuDatas.slice(-1)); return ( -
    - } iconBgcolor="#F14A2D" - showDropIcon onDropMenuClick={this.onDropMenuClick} - dropMenuDatas={[ - { - key: "import", - icon: , - content: getLabel(111, "导入") - }, - { - key: "export", - icon: , - content: getLabel(111, "导出") - }, - { - key: "log", icon: , - content: getLabel(545781, "操作日志") - } - ]} buttons={(showOperateBtn || showSalaryItemBtn) ? buttons : buttons.slice(-1)}> -
    - - 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"> +
    + this.setState({ selectedRowKeys: val })}/>
    + {/*添加系统薪资项目*/} + 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 })}/> @@ -436,61 +204,15 @@ export default class SalaryItem extends React.Component { onCancel={callback => { this.setState({ salaryItemImpDialog: { ...salaryItemImpDialog, visible: false } - }, () => callback && this.handleSearch(this.state.searchValue)); + }, () => callback && this.setState({ isQuery: !isQuery })); }}/> - { - systemItemVisible && - { - setSystemItemVisible(false); - }} - onInitTableList={() => { - getTableDatas({ ...this.state.searchParams, name: this.state.searchValue }).then(res => { - this.setState({ - searchParams: { - ...this.state.searchParams, - total: res.total - } - }); - }); - }} - /> - } - { - editSlideVisible && - - } - content={ - { - handleSaveSlideChange(value); - }}/> - } - onClose={() => setEditSlideVisible(false)} - /> - } -
    + {/*新增编辑自定义薪资项目*/} + this.setState({ isQuery: !isQuery })} + showOperateBtn={showOperateBtn} + onClose={callback => this.setState({ + customItemDialog: { ...customItemDialog, visible: false, id: "" } + }, () => callback && callback())}/> + ); } } diff --git a/pc4mobx/hrmSalary/pages/salaryItem/index.less b/pc4mobx/hrmSalary/pages/salaryItem/index.less index 1d28f1ca..cf539484 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/index.less +++ b/pc4mobx/hrmSalary/pages/salaryItem/index.less @@ -1,3 +1,91 @@ +//薪资项目重构项 +.salaryProjectManagement { + .wea-input-focus { + height: 31.36px; + line-height: 0; + } + + .salaryItems_content { + height: 100%; + padding: 8px 16px; + background: #f6f6f6; + + .wea-new-table { + background: #FFFFFF; + } + } + +} + +.custom_salaryItemSlide { + .wea-slide-modal-title { + border-bottom: 1px solid #e5e5e5 !important; + } + + .wea-slide-modal-content { + height: 100%; + background: #f6f6f6; + + .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; + } + } + } + + .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; @@ -62,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/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", diff --git a/pc4mobx/hrmSalary/pages/salaryItem/salaryItemsTable.js b/pc4mobx/hrmSalary/pages/salaryItem/salaryItemsTable.js new file mode 100644 index 00000000..56de78a7 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/salaryItem/salaryItemsTable.js @@ -0,0 +1,111 @@ +/* + * 薪资项目管理 + * 表格 + * @Author: 黎永顺 + * @Date: 2024/8/16 + * @Wechat: + * @Email: 971387674@qq.com + * @description: +*/ +import React, { Component } from "react"; +import { WeaCheckbox, WeaLocaleProvider, WeaTable } from "ecCom"; +import { Dropdown, Menu, Spin } from "antd"; +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: 0 } + }; + } + + componentDidMount() { + this.getItemList(this.props); + } + + componentWillReceiveProps(nextProps, nextContext) { + if (nextProps.isQuery !== this.props.isQuery) this.setState({ + pageInfo: { ...this.state.pageInfo, current: 1 } + }, () => 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: _.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, loading } = this.state; + const { selectedRowKeys, onChange, onDropMenuClick, showOperateBtn } = this.props; + 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)); + } + }; + const rowSelection = { + selectedRowKeys, onChange, + getCheckboxProps: record => ({ disabled: !record.canDelete }) + }; + return ( + ( + onDropMenuClick("edit", record.id)} + href="javascript:void(0);">{showOperateBtn ? getLabel(111, "编辑") : getLabel(111, "查看")} + { + showOperateBtn && record.canDelete && + onDropMenuClick("delete", record.id)}>{getLabel(111, "删除")} + } + + + onDropMenuClick("log", record.id)}>{getLabel(545781, "操作日志")} + +
    + }> + + + ) + } + ]}/> + ); + } +} + +export default SalaryItemsTable; 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={[]}> +
    + + +
    -
    ); } diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBook/components/welfareRecordList.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBook/components/welfareRecordList.js index 27409fb5..cd9dd5c7 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBook/components/welfareRecordList.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBook/components/welfareRecordList.js @@ -5,7 +5,6 @@ * Date: 2024/1/23 */ import React, { Component } from "react"; -import { inject, observer } from "mobx-react"; import { message, Modal, Spin } from "antd"; import { WeaLocaleProvider } from "ecCom"; import { getIframeParentHeight } from "../../../../util"; @@ -14,8 +13,6 @@ import { convertToUrlString } from "../../../../util/url"; const getLabel = WeaLocaleProvider.getLabel; -@inject("taxAgentStore") -@observer class WelfareRecordList extends Component { constructor(props) { super(props); @@ -126,7 +123,7 @@ class WelfareRecordList extends Component { childFrameObj && childFrameObj.contentWindow.postMessage(JSON.stringify({ ...payload, i18n }), "*"); }; getWelfareRecordList = () => { - const { queryForm, taxAgentStore: { showOperateBtn } } = this.props; + const { queryForm } = this.props; const { pageInfo } = this.state; const payload = { ...pageInfo, ...queryForm, taxAgents: queryForm.taxAgents ? queryForm.taxAgents.split(",") : [] }; this.setState({ loading: true }); @@ -139,8 +136,7 @@ class WelfareRecordList extends Component { pageInfo: { ...pageInfo, current, pageSize, total }, dataSource, columns }, () => this.postMessageToChild({ - scrollHeight: 108, dataSource, columns, pageInfo: this.state.pageInfo, showOperateBtn, - unitTableType: "welfareRecord" + scrollHeight: 108, dataSource, columns, pageInfo: this.state.pageInfo, unitTableType: "welfareRecord" })); } }).catch(() => this.setState({ loading: false })); diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBook/components/welfareRecordQuery.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBook/components/welfareRecordQuery.js index 16dd0855..3db29a36 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBook/components/welfareRecordQuery.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBook/components/welfareRecordQuery.js @@ -8,8 +8,8 @@ import React, { Component } from "react"; import { inject, observer } from "mobx-react"; import { WeaFormItem, WeaLocaleProvider, WeaSearchGroup, WeaTools } from "ecCom"; import { WeaSwitch } from "comsMobx"; -import * as API from "../../../../apis/standingBook"; import { welfareRQConditions } from "../columns"; +import { postFetch } from "../../../../util/request"; import { MonthRangePicker } from "../../../reportView/components/statisticalMicroSettingsSlide"; import moment from "moment"; @@ -31,27 +31,28 @@ class WelfareRecordQuery extends Component { } componentDidMount() { - API.getAdminTaxAgentList().then(({ status, data }) => { - if (status) { - this.setState({ - conditions: _.map(welfareRQConditions, item => { - return { - ...item, - items: _.map(item.items, o => { - if (getKey(o) === "taxAgents") { - return { ...o, options: _.map(data, g => ({ key: g.id.toString(), showname: g.name })) }; - } - return o; - }) - }; - }) - }, () => { - const { standingBookStore: { welfareRQForm }, onPutAccountOptions } = this.props; - welfareRQForm.initFormFields(this.state.conditions); - onPutAccountOptions(_.map(data, g => ({ key: g.id.toString(), showname: g.name }))); - }); - } - }); + postFetch("/api/bs/hrmsalary/taxAgent/listAuth", { filterType: "QUERY_DATA" }) + .then(({ status, data }) => { + if (status) { + this.setState({ + conditions: _.map(welfareRQConditions, item => { + return { + ...item, + items: _.map(item.items, o => { + if (getKey(o) === "taxAgents") { + return { ...o, options: _.map(data, g => ({ key: String(g.id), showname: g.name })) }; + } + return o; + }) + }; + }) + }, () => { + const { standingBookStore: { welfareRQForm }, onPutAccountOptions } = this.props; + welfareRQForm.initFormFields(this.state.conditions); + onPutAccountOptions(_.map(data, g => ({ key: g.id.toString(), showname: g.name }))); + }); + } + }); } renderForm = (form, conditions) => { diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBook/index.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBook/index.js index 30ec27a6..9736415a 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBook/index.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBook/index.js @@ -24,7 +24,7 @@ export default class StandingBook extends React.Component { value: "", selectedKey: "0", tableParams: { - startTime: moment(new Date()).subtract(1, 'year').startOf("year").format("YYYY-MM"), + startTime: moment(new Date()).subtract(1, "year").startOf("year").format("YYYY-MM"), endTime: moment(new Date()).endOf("year").format("YYYY-MM"), paymentOrganization: "" }, @@ -68,49 +68,45 @@ export default class StandingBook extends React.Component { init = () => { const { current, dialogProps } = this.state; const { - taxAgentStore: { getPermission, fetchTaxAgentOption }, + taxAgentStore: { PageAndOptAuth, fetchTaxAgentOption }, standingBookStore: { getAdminTaxAgentList } } = this.props; - getPermission().then(({ status, data }) => { - if (status) { - this.setState({ adminData: data }); - if (data.isOpenDevolution) { - getAdminTaxAgentList().then((data) => { - let taxAgentList = data.map(item => { - let result = {}; - result.showname = item.name; - result.key = item.id + ""; - result.selected = false; - return result; - }); - this.setState({ - dialogProps: { - ...dialogProps, - options: taxAgentList, - isAdmin: true - } - }); - }); - } else { - fetchTaxAgentOption().then(({ data }) => { - let taxAgentList = data.map(item => { - let result = {}; - result.showname = item.content; - result.key = item.id + ""; - result.selected = false; - return result; - }); - this.setState({ - dialogProps: { - ...dialogProps, - options: taxAgentList - } - }); - }); - } - this.getCommonList({ ...this.state.tableParams, current }); - } - }); + this.setState({ adminData: PageAndOptAuth }); + if (data.isOpenDevolution) { + getAdminTaxAgentList().then((data) => { + let taxAgentList = data.map(item => { + let result = {}; + result.showname = item.name; + result.key = item.id + ""; + result.selected = false; + return result; + }); + this.setState({ + dialogProps: { + ...dialogProps, + options: taxAgentList, + isAdmin: true + } + }); + }); + } else { + fetchTaxAgentOption().then(({ data }) => { + let taxAgentList = data.map(item => { + let result = {}; + result.showname = item.content; + result.key = item.id + ""; + result.selected = false; + return result; + }); + this.setState({ + dialogProps: { + ...dialogProps, + options: taxAgentList + } + }); + }); + } + this.getCommonList({ ...this.state.tableParams, current }); }; getCommonList = (payload = {}) => { diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBook/standingBook.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBook/standingBook.js index f4089c44..88243286 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBook/standingBook.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBook/standingBook.js @@ -119,7 +119,8 @@ class StandingBook extends Component { render() { const { accountDialog, queryForm, logDialogVisible, filterConditions } = this.state; - const { taxAgentStore: { showOperateBtn } } = this.props; + const { taxAgentStore: { PageAndOptAuth } } = this.props; + const showOperateBtn = PageAndOptAuth.opts.includes("admin"); const rightBtns = []; diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/welfareArchive/components/welfareEditArchiveSlide/index.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/welfareArchive/components/welfareEditArchiveSlide/index.js index e2342e93..c4eb3b57 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/welfareArchive/components/welfareEditArchiveSlide/index.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/welfareArchive/components/welfareEditArchiveSlide/index.js @@ -8,10 +8,10 @@ import React, { Component } from "react"; import { inject, observer } from "mobx-react"; import { WeaDialog, WeaLocaleProvider, WeaSlideModal, WeaTools } from "ecCom"; import * as API from "../../../../../apis/welfareArchive"; -import { getTaxAgentSelectList } from "../../../../../apis/taxAgent"; import { sysinfo } from "../../../../../apis/ruleconfig"; import { getWelfareSearchsForm, welfareConditions } from "../../config"; import { getConditionDomkeys, toDecimal_n } from "../../../../../util"; +import { postFetch } from "../../../../../util/request"; import { Button, message, Modal } from "antd"; const getKey = WeaTools.getKey; @@ -39,7 +39,9 @@ class Index extends Component { } getBaseForm = async (props) => { - const [taxAgentListData, sysInfoData] = await Promise.all([getTaxAgentSelectList(), sysinfo()]); + const [taxAgentListData, sysInfoData] = await Promise.all([ + postFetch("/api/bs/hrmsalary/taxAgent/listAuth", { filterType: "ADMIN_DATA" }), sysinfo() + ]); const { archivesStore: { welfareProfileForm }, socialBase, fundBase, otherBase, runStatuses, employeeId, paymentOrganization, socialBaseData, fundBaseData, othersBaseData, @@ -97,7 +99,7 @@ class Index extends Component { items: _.map(o.items, g => { return { ...g, label: getLabel(g.lanId, g.label), - options: _.map(taxAgentListData.data, j => ({ key: j.id, showname: j.content })) + options: _.map(taxAgentListData.data, j => ({ key: String(j.id), showname: j.name })) }; }) }; diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/welfareArchive/components/welfareTableList/index.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/welfareArchive/components/welfareTableList/index.js index a9029a86..52bc2061 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/welfareArchive/components/welfareTableList/index.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/welfareArchive/components/welfareTableList/index.js @@ -70,8 +70,8 @@ class Index extends Component { if (type === "init") { this.getWelfareList(this.props, true); } else if (type === "turn") { - const { record: { baseInfo, employeeId, paymentOrganization } = {}, interfaceParams = {} } = params; - const { runStatuses, showOperateBtn } = this.props; + const { record: { baseInfoId, opts, employeeId, paymentOrganization } = {}, interfaceParams = {} } = params; + const { runStatuses } = this.props; switch (id) { case "PAGEINFO": this.setState({ @@ -114,6 +114,7 @@ class Index extends Component { this.getPaymentForm({ ...payload, welfareTypeEnum: welfareTypeEnum["fund"], schemeId: fundSchemeId }), this.getPaymentForm({ ...payload, welfareTypeEnum: welfareTypeEnum["other"], schemeId: otherSchemeId }) ]); + const showOperateBtn = opts.includes("admin"); this.setState({ welfareEditSlide: { ...this.state.welfareEditSlide, visible: true, showOperateBtn, @@ -128,18 +129,18 @@ class Index extends Component { case "DEL-TO-DO": case "DEL-TO-DO-STAY": const module = (id === "ADD-TO-PAY" || id === "STAY-DEL-TO-STOP" || id === "CANCEL-STOP") ? - [baseInfo] : { ids: [baseInfo], ...interfaceParams }; + [baseInfoId] : { ids: [baseInfoId], ...interfaceParams }; this.handleWelfareOpts(_.camelCase(id), module); break; case "DEL-ARCHIVE": Modal.confirm({ title: getLabel(131329, "信息确认"), content: getLabel(388758, "确认要删除吗?"), - onOk: () => this.handleWelfareOpts(_.camelCase(id), [baseInfo]) + onOk: () => this.handleWelfareOpts(_.camelCase(id), [baseInfoId]) }); break; case "log": - this.props.onFilterLog(id, baseInfo); + this.props.onFilterLog(id, baseInfoId); break; default: break; @@ -156,7 +157,7 @@ class Index extends Component { }; getWelfareList = (props, init = false) => { const { pageInfo } = this.state; - const { archivesStore: { welfareForm }, runStatuses, onChangeTopTabCount, showOperateBtn } = props; + const { archivesStore: { welfareForm }, runStatuses, onChangeTopTabCount } = props; const params = { ...pageInfo, ...welfareForm.getFormParams() }; const payload = runStatuses === "ext" ? { ...params, extWelArchiveList: true } : { ...params, @@ -183,10 +184,7 @@ class Index extends Component { }, () => { const { pageInfo, selectedRowKeys, columns, dataSource } = this.state; onChangeTopTabCount(runStatuses, total, init); - this.postMessageToChild({ - dataSource, pageInfo, selectedRowKeys, runStatuses, - columns, showOperateBtn - }); + this.postMessageToChild({ dataSource, pageInfo, selectedRowKeys, runStatuses, columns }); }); } }).catch(() => this.setState({ loading: false })); diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/welfareArchive/index.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/welfareArchive/index.js index 4da87e27..f64404e9 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/welfareArchive/index.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/welfareArchive/index.js @@ -151,7 +151,8 @@ class Index extends Component { selectedKey, topTabCount, showSearchAd, isQuery, recordDialogVisible, logDialogVisible, filterConditions, welfareImpDialog, showExtEmpsWitch } = this.state; - const { taxAgentStore: { showOperateBtn } } = this.props; + const { taxAgentStore: { PageAndOptAuth } } = this.props; + const showOperateBtn = PageAndOptAuth.opts.includes("admin"); const tipList = _.find(welfareTipList, o => o.viewcondition === selectedKey).list; const tabs = _.map(tabList, o => ({ ...o, title: getLabel(o.lanId, o.title) })); return ( diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/welfarePlan/components/welfarePlanEditSlide/baseValidateDialog.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/welfarePlan/components/welfarePlanEditSlide/baseValidateDialog.js new file mode 100644 index 00000000..631ef2ee --- /dev/null +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/welfarePlan/components/welfarePlanEditSlide/baseValidateDialog.js @@ -0,0 +1,76 @@ +/* + * 方案信息确认 + * 保存并自动修改基数,仅保存方案设置 + * @Author: 黎永顺 + * @Date: 2024/8/19 + * @Wechat: + * @Email: 971387674@qq.com + * @description: +*/ +import React, { Component } from "react"; +import { WeaDialog, WeaLocaleProvider, WeaTransfer } from "ecCom"; +import { Alert, Button } from "antd"; + +const getLabel = WeaLocaleProvider.getLabel; +const WeaTransferList = WeaTransfer.list; + +class BaseValidateDialog extends Component { + constructor(props) { + super(props); + this.state = { dataSource: [] }; + } + + componentWillReceiveProps(nextProps, nextContext) { + if (nextProps.visible !== this.props.visible && nextProps.visible) { + this.setState({ + dataSource: _.filter(_.map(nextProps.baseChangeInfo.split("\n"), (g, gi) => ({ + id: gi + 1, name: g + })), k => !!k.name) + }); + } + if (nextProps.visible !== this.props.visible && !nextProps.visible) this.setState({ + dataSource: [] + }); + } + + render() { + const { dataSource } = this.state, { onCancel } = this.props; + const scrollHeight = this.baseChangeRef ? this.baseChangeRef.state.height - 118 : 606.6; + const buttons = [ + , + + ]; + return ( + this.baseChangeRef = dom} + title={getLabel(131329, "信息确认")} buttons={buttons} + style={{ + width: 750, height: 606.6, minHeight: 200, minWidth: 380, + maxHeight: "90%", maxWidth: "90%", overflow: "hidden", transform: "translate(0px, 0px)" + }} + > +
    + + { + !_.isEmpty(dataSource) ? (
    +
    {it.id}
    +
    {it.name}
    +
    )} + height={scrollHeight} checkedCb={() => ({})} checkedKeys={[]} + /> :
    {getLabel(111, "无数据变更记录")}
    + } +
    +
    + ); + } +} + +export default BaseValidateDialog; diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/welfarePlan/components/welfarePlanEditSlide/index.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/welfarePlan/components/welfarePlanEditSlide/index.js index d97654e6..077d7bfc 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/welfarePlan/components/welfarePlanEditSlide/index.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/welfarePlan/components/welfarePlanEditSlide/index.js @@ -10,8 +10,9 @@ import { WeaLocaleProvider, WeaSearchGroup, WeaSlideModal, WeaTab, WeaTools } fr import PlanSetTable from "./planSetTable"; import { Button, message, Modal } from "antd"; import * as API from "../../../../../apis/welfareScheme"; -import { getTaxAgentSelectListAsAdmin } from "../../../../../apis/taxAgent"; +import { postFetch } from "../../../../../util/request"; import { getConditionDomkeys, getSearchs } from "../../../../../util"; +import BaseValidateDialog from "./baseValidateDialog"; import { planConditons } from "../../config"; import cs from "classnames"; @@ -24,7 +25,10 @@ class Index extends Component { constructor(props) { super(props); this.state = { - loading: false, conditions: [], selectedKey: "2", planDatas: [] + loading: false, conditions: [], selectedKey: "2", planDatas: [], + baseValidateDialog: { + visible: false, baseChangeInfo: [], validatePayload: { validate: true, changeData: false } + } }; } @@ -40,7 +44,7 @@ class Index extends Component { } getForm = async (props) => { - const { data: result } = await getTaxAgentSelectListAsAdmin(); + const { data: result } = await postFetch("/api/bs/hrmsalary/taxAgent/listAuth", { filterType: "ADMIN_DATA" }); const { id, welfareTypeEnum, programmeStore: { planForm }, showOperateBtn } = props; API.getForm(id ? _.assign({ welfareTypeEnum }, { id }) : { welfareTypeEnum }).then(({ status, data }) => { if (status) { @@ -54,7 +58,7 @@ class Index extends Component { return { ...o, hide: schemeBatch["sharedType"] === "0" || _.isNil(schemeBatch["sharedType"]), viewAttr: (schemeBatch["sharedType"] === "1" && showOperateBtn) ? 3 : showOperateBtn ? o.viewAttr : 1, - options: _.map(result, k => ({ key: k.id, showname: k.content })), + options: _.map(result, k => ({ key: String(k.id), showname: k.name })), label: getLabel(o.lanId, o.label) }; } else if (getKey(o) === "paymentType" || getKey(o) === "sharedType") { @@ -86,21 +90,37 @@ class Index extends Component { if (planForm.getFormParams().sharedType === "1" && _.isEmpty(planForm.getFormParams().taxAgentIds)) { planForm.showError("taxAgentIds", getLabel(111, "\"可见范围\"未填写")); } else { - const { planDatas } = this.state; - const payload = { + const { planDatas, baseValidateDialog } = this.state; + const { validatePayload } = baseValidateDialog; + let payload = { insuranceScheme: { ...planForm.getFormParams(), welfareType: welfareTypeEnum, id, paymentArea: planForm.getFormParams().paymentType }, insuranceSchemeDetailList: planDatas }; + id && (payload = { ...payload, ...validatePayload }); this.setState({ loading: true }); - API[id ? "updateScheme" : "createScheme"](payload).then(({ status, errormsg }) => { + API[id ? "updateScheme" : "createScheme"](payload).then(({ status, data, errormsg }) => { this.setState({ loading: false }); if (status) { - message.success(getLabel(30700, "操作成功!")); - setHasBeenModify(false); - this.props.onClose(true); + if (id && Object.prototype.toString.call(data) === "[object String]" && data.indexOf("\n") !== -1) { + this.setState({ + baseValidateDialog: { + visible: true, baseChangeInfo: data, + validatePayload: { ...baseValidateDialog.validatePayload, validate: false } + } + }); + } else { + message.success(getLabel(30700, "操作成功!")); + setHasBeenModify(false); + this.props.onClose(true); + this.setState({ + baseValidateDialog: { + ...baseValidateDialog, baseChangeInfo: [], validatePayload: { validate: true, changeData: false } + } + }); + } } else { message.error(errormsg); } @@ -194,7 +214,7 @@ class Index extends Component { render() { - const { conditions, planDatas, selectedKey } = this.state; + const { conditions, planDatas, selectedKey, baseValidateDialog } = this.state; const { programmeStore: { planForm }, showOperateBtn } = this.props; return ( + {/* */} + this.setState({ + baseValidateDialog: { + visible: false, baseChangeInfo: [], + validatePayload: { validate: true, changeData: false, ...validatePayload } + } + }, () => !_.isEmpty(validatePayload) && this.save())}/>
    } /> ); diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/welfarePlan/components/welfarePlanList/index.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/welfarePlan/components/welfarePlanList/index.js index 1035015a..c7ee09b6 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/welfarePlan/components/welfarePlanList/index.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/welfarePlan/components/welfarePlanList/index.js @@ -60,8 +60,9 @@ class Index extends Component { getList = (props) => { const { programmeStore: { planSearchForm }, selectedKey: welfareTypeEnum, customQuery, - taxAgentStore: { showOperateBtn } + taxAgentStore: { PageAndOptAuth } } = props; + const showOperateBtn = PageAndOptAuth.opts.includes("admin"); const { pageInfo } = this.state; const originPayload = { ...pageInfo, welfareTypeEnum }, customPayload = { welfareTypeEnum: customQuery }, welfarePayload = { ...planSearchForm.getFormParams() }; @@ -239,7 +240,8 @@ class Index extends Component { render() { const { dataSource, columns, pageInfo, loading, copyDialog, customDialog, welfarePlanEditSlide } = this.state; - const { selectedKey, taxAgentStore: { showOperateBtn } } = this.props; + const { selectedKey, taxAgentStore: { PageAndOptAuth } } = this.props; + const showOperateBtn = PageAndOptAuth.opts.includes("admin"); const pagination = { ...pageInfo, showTotal: total => `${getLabel(18609, "共")} ${total} ${getLabel(18256, "条")}`, diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/welfarePlan/index.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/welfarePlan/index.js index 20d50c88..69382697 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/welfarePlan/index.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/welfarePlan/index.js @@ -13,7 +13,6 @@ import WelfarePlanList from "./components/welfarePlanList"; import LogDialog from "../../../components/logViewModal"; import cs from "classnames"; import "./index.less"; -import { tabList } from "../welfareArchive/config"; const getLabel = WeaLocaleProvider.getLabel; @@ -63,7 +62,8 @@ class Index extends Component { }; render() { - const { taxAgentStore: { showOperateBtn } } = this.props; + const { taxAgentStore: { PageAndOptAuth } } = this.props; + const showOperateBtn = PageAndOptAuth.opts.includes("admin"); const { logDialogVisible, filterConditions, selectedKey, showSearchAd, isQuery, customQuery } = this.state; const tabs = _.map(tabWelfarePlanList, o => ({ ...o, title: getLabel(o.lanId, o.title) })); return ( diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/welfarePlan/index.less b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/welfarePlan/index.less index 5a057203..5566cc8e 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/welfarePlan/index.less +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/welfarePlan/index.less @@ -269,3 +269,91 @@ } } + +//方案基数变化 +.baseChangeDialog { + .wea-dialog-body { + overflow-y: hidden; + } + + .baseChangeContent { + background: #F6F6F6; + padding: 16px; + width: 100%; + height: 100%; + + .empty { + width: 100%; + display: flex; + height: 100%; + justify-content: center; + align-items: center; + background: #ffff; + } + + .wea-search-group { + padding: 0; + margin-bottom: 10px; + background: #FFF; + + .wea-form-cell { + padding: 0; + + .wea-form-item { + padding: 10px; + } + } + } + + .logTable { + background: #FFFFFF; + } + + .wea-transfer-list-wrapper { + border: none; + + .ant-tree-switcher { + display: none; + } + + .transfer-tree { + background: #FFF; + border: 1px solid #dadada; + padding: 0; + + & > li:not(:last-child) { + .detailBox .content { + border-bottom: 1px solid #dadada; + } + } + + & > li { + margin: 0 !important; + + .detailBox { + display: flex; + align-items: center; + + .order { + width: 35px; + color: #999; + text-align: center; + } + + .content { + position: relative; + flex: 1; + min-height: 40px; + line-height: 40px; + color: #000; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + } + } + } + } + } +} + diff --git a/pc4mobx/hrmSalary/pages/taxAgent/index.js b/pc4mobx/hrmSalary/pages/taxAgent/index.js index 39ceeec2..02bd0a71 100644 --- a/pc4mobx/hrmSalary/pages/taxAgent/index.js +++ b/pc4mobx/hrmSalary/pages/taxAgent/index.js @@ -48,13 +48,9 @@ export default class TaxAgent extends React.Component { } getPermission = () => { - const { getPermission } = this.props.taxAgentStore; - getPermission().then(({ status, data }) => { - if (status) { - this.setState({ permission: data }, () => { - this.getTaxAgentBaseForm(); - }); - } + const { PageAndOptAuth } = this.props.taxAgentStore; + this.setState({ permission: PageAndOptAuth }, () => { + this.getTaxAgentBaseForm(); }); }; @@ -323,9 +319,9 @@ export default class TaxAgent extends React.Component { doInit, hasRight, getTaxAgentList, - showOperateBtn + PageAndOptAuth } = taxAgentStore; - + const showOperateBtn = PageAndOptAuth.opts.includes("admin"); if (!hasRight && !loading) { // 无权限处理 return renderNoright(); 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..8c0983da --- /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({ username: 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..f301e571 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/variableSalary/components/advanceInputBtn/index.less @@ -0,0 +1,28 @@ +.variable-advance-search { + display: flex; + align-items: center; + position: relative; + top: -1.5px; + + .wea-advanced-search { + top: 1px; + 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; + } +} 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..1635c3a4 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileDialog/index.js @@ -0,0 +1,146 @@ +/* + * 浮动薪酬 + * 新建编辑薪资档案 + * @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 }, detail, taxAgentOption } = props; + API.getCreateForm().then(({ data }) => { + this.setState({ + conditions: [ + ..._.map(salaryFileConditions, item => ({ + ...item, items: _.map(item.items, o => { + if (getKey(o) === "taxAgentIds") { + return { + ...o, viewAttr: !_.isEmpty(detail) ? 1 : 3, label: getLabel(o.lanId, o.label), + options: taxAgentOption, value: detail[getKey(o)] || "" + }; + } + return { + ...o, viewAttr: !_.isEmpty(detail) ? 1 : 3, label: getLabel(o.lanId, o.label), + value: detail[getKey(o)] || "" + }; + }) + })), + { + items: _.map(data, o => ({ + conditionType: "INPUT", + domkey: [String(o.id)], + fieldcol: 14, + label: o.name, + labelcol: 6, + value: detail[`${String(o.id)}_variableItem`] || "", + viewAttr: !_.isEmpty(detail) ? 1 : 2 + })), + title: "", col: 2, + defaultshow: true + } + ] + }, () => { + 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) => { + const itemValueList = []; + return _.reduce(_.keys(payload), (pre, cur) => { + if (!_.isNaN(parseInt(cur))) { + itemValueList.push({ variableItemId: cur, itemValue: payload[cur] }); + return { ...pre, itemValueList }; + } + return { ...pre, [cur]: payload[cur] }; + }, {}); + }; + save = () => { + const { baseTableStore: { VSSalaryFileForm }, onSearch, id } = this.props; + VSSalaryFileForm.validateForm().then(f => { + if (f.isValid) { + const payload = VSSalaryFileForm.getFormParams(); + this.setState({ loading: true }); + API.createVariableSalary({ ...this.convertPayload(payload), id }) + .then(({ status, errormsg }) => { + this.setState({ loading: false }); + if (status) { + message.success(getLabel(30700, "操作成功")); + this.props.onClose(onSearch()); + } else { + message.error(errormsg); + } + }).catch(() => this.setState({ loading: false })); + } else { + f.showErrors(); + } + }); + }; + renderTitle = () => { + const { loading } = this.state, { title, detail } = this.props; + return
    +
    +
    +
    {title}
    +
    +
    + { + _.isEmpty(detail) && + + } +
    +
    ; + }; + + render() { + const { conditions } = 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/salaryFileImportDialog/index.js b/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileImportDialog/index.js new file mode 100644 index 00000000..c8917e45 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileImportDialog/index.js @@ -0,0 +1,120 @@ +/* + * 浮动薪酬 + * 薪资档案导入 + * @Author: 黎永顺 + * @Date: 2024/8/8 + * @Wechat: + * @Email: 971387674@qq.com + * @description: +*/ +import React, { Component } from "react"; +import { WeaCheckbox, WeaDatePicker, WeaFormItem, 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, salaryMonth: "", + 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, taxAgentIds } = nextProps; + const payload = { + salaryMonth, taxAgentIds, ...VSalryForm.getFormParams(), hasData: importDialog.hasData + }; + this.setState({ + importDialog: { ...importDialog, salaryMonth, 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", salaryMonth: "" + } + }); + } + } + + handleImport = (payload) => { + const { taxAgentIds } = this.props; + const { importDialog } = this.state; + const { salaryMonth } = importDialog; + this.setState({ importDialog: { ...importDialog, nextloading: true } }); + API.importVariableSalary({ + ...payload, salaryMonth, taxAgentIds: _.isEmpty(taxAgentIds) ? [] : taxAgentIds.split(",") + }).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 } })); + }; + renderFormComponent = () => { + const { baseTableStore: { VSalryForm }, taxAgentIds } = this.props; + const { importDialog } = this.state; + const { salaryMonth: month, hasData } = importDialog; + return
    + + { + const payload = { salaryMonth: val, hasData, taxAgentIds, ...VSalryForm.getFormParams() }; + this.setState({ + importDialog: { + ...importDialog, salaryMonth: val, + link: `/api/bs/hrmsalary/variableSalary/downloadTemplate?${convertToUrlString(payload)}` + } + }); + }}/> + +
    ; + }; + + render() { + const { importDialog } = this.state; + return ( + this.setState({ + importDialog: { ...importDialog, importResult: {}, imageId: "", link: null } + })} + importParams={this.renderFormComponent()} + exportDataDom={ + { + const { baseTableStore: { VSalryForm }, taxAgentIds } = this.props; + const { salaryMonth } = importDialog; + const payload = { salaryMonth, taxAgentIds, ...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 new file mode 100644 index 00000000..f3b0e52a --- /dev/null +++ b/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileList/index.js @@ -0,0 +1,162 @@ +/* + * 浮动薪酬 + * 薪资档案列表 + * @Author: 黎永顺 + * @Date: 2024/8/8 + * @Wechat: + * @Email: 971387674@qq.com + * @description: +*/ +import React, { Component } from "react"; +import { inject, observer } from "mobx-react"; +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; + +@inject("baseTableStore") +@observer +class Index extends Component { + constructor(props) { + super(props); + this.state = { + pageInfo: { current: 1, pageSize: 10, total: 0 }, loading: false, dataSource: [], columns: [] + }; + } + + 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, getVariableSalaryList }, salaryMonth, taxAgentIds } = this.props; + const { pageInfo } = this.state; + const { departmentIds } = VSalryForm.getFormParams(); + this.setState({ loading: true }); + getVariableSalaryList({ + ...pageInfo, salaryMonth, taxAgentIds: _.isEmpty(taxAgentIds) ? [] : taxAgentIds.split(","), + ...VSalryForm.getFormParams(), departmentIds: !_.isEmpty(departmentIds) ? departmentIds.split(",") : [] + }).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 + } + ); + } + }); + }; + 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.deleteVariableSalary({ ids }).then(({ status, errormsg }) => { + if (status) { + message.success(getLabel(111, "删除成功")); + this.getVariableSalaryList(); + } else { + message.error(errormsg); + } + }); + } + }); + }; + 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: 98, + 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 { 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 * 46 + 108 : dataSource.length < 10 ? dataSource.length * 46 + 108 : parseFloat(dom.style.height) - 16; + } + return ( + +
    + +