diff --git a/pc4mobx/hrmSalary/apis/calculate.js b/pc4mobx/hrmSalary/apis/calculate.js index 85805d5c..009a9bd8 100644 --- a/pc4mobx/hrmSalary/apis/calculate.js +++ b/pc4mobx/hrmSalary/apis/calculate.js @@ -95,7 +95,10 @@ export const comparisonresultList = (params) => { export const refreshTaxAgent = (params) => { return postFetch("/api/bs/hrmsalary/salaryacct/acctemployee/refreshTaxAgent", params); }; - +// 核算人员--刷新薪资核算人员的 +export const refreshAcctemployee = (params) => { + return postFetch("/api/bs/hrmsalary/salaryacct/acctemployee/refresh", params); +}; // 薪资核算-编辑表单 export const acctresultDetail = (params) => { return WeaTools.callApi("/api/bs/hrmsalary/salaryacct/acctresult/detail", "GET", params); @@ -215,8 +218,9 @@ export const exportComparisonResult = (salaryAcctRecordId) => { }; // 核算进度条 -export const getCalculateProgress = (id) => { - return WeaTools.callApi("/api/bs/hrmsalary/progress/getRate?cacheKey=ACCT_PROGRESS_" + id, "get", {}); +export const getCalculateProgress = (id = "", paymentOrganization = "") => { + const extra= paymentOrganization ? `_${paymentOrganization}` : paymentOrganization + return WeaTools.callApi(`/api/bs/hrmsalary/progress/getRate?cacheKey=ACCT_PROGRESS_${id}${extra}`, "get", {}); }; // 核算进度条 @@ -232,6 +236,10 @@ export const updateLockStatus = (params) => { export const updateLockEmpStatus = (params) => { return postFetch("/api/bs/hrmsalary/salaryacct/acctresult/lockEmp", params); }; +// 单元格锁定 +export const updateLockEmpCellStatus = (params) => { + return postFetch("/api/bs/hrmsalary/salaryacct/acctresult/lock", params); +}; // 导入薪资核算添加表头字段缓存 export const cacheImportField = (params) => { return postFetch("/api/bs/hrmsalary/salaryacct/acctresult/cacheImportField", params); @@ -270,6 +278,10 @@ export const deleteExportTemplate = (params) => { export const getExportTemplateForm = (params) => { return postFetch("/api/bs/hrmsalary/salaryacct/acctresult/getExportTemplateForm", params); }; +//薪资审批-薪资核算页面获取审批信息 +export const getApprovalInfoByRecordId = params => { + return WeaTools.callApi("/api/bs/hrmsalary/salarysob/salaryApproval/getApprovalInfoByRecordId", "GET", params); +}; //薪资核算-薪资项目改变否 export const getCompareSobConfig = params => { return WeaTools.callApi("/api/bs/hrmsalary/salaryacct/compareSobConfig", "GET", params); diff --git a/pc4mobx/hrmSalary/apis/ledger.js b/pc4mobx/hrmSalary/apis/ledger.js index 487181bc..1f529d09 100644 --- a/pc4mobx/hrmSalary/apis/ledger.js +++ b/pc4mobx/hrmSalary/apis/ledger.js @@ -57,6 +57,10 @@ export const deleteLedgerPersonExtRange = params => { export const saveLedgerPersonRange = params => { return postFetch("/api/bs/hrmsalary/salarysob/range/save", params); }; +//编辑薪资帐套人员范围 +export const editLedgerPersonRange = params => { + return postFetch("/api/bs/hrmsalary/salarysob/range/edit", params); +}; //删除薪资帐套人员范围 export const deleteLedgerPersonRange = params => { @@ -155,3 +159,15 @@ export const salarysobRangeImportData = params => { export const getSalaryItemForm = params => { return postFetch("/api/bs/hrmsalary/salarysob/item/getSalaryItemForm", params); }; +//薪资核算规则配置-获取薪资审批规则表单 +export const getSalaryApprovalForm = params => { + return postFetch("/api/bs/hrmsalary/salarysob/salaryApproval/getForm", params); +}; +//薪资核算规则配置-保存薪资审批规则表单 +export const salaryApprovalSaveForm = params => { + return postFetch("/api/bs/hrmsalary/salarysob/salaryApproval/saveForm", params); +}; +//薪资核算规则配置-获取能够添加的项目 +export const getListSalaryItem = params => { + return postFetch("/api/bs/hrmsalary/salarysob/salaryApproval/listSalaryItem", params); +}; diff --git a/pc4mobx/hrmSalary/apis/mySalaryBenefits.js b/pc4mobx/hrmSalary/apis/mySalaryBenefits.js index b79a6718..f197ba27 100644 --- a/pc4mobx/hrmSalary/apis/mySalaryBenefits.js +++ b/pc4mobx/hrmSalary/apis/mySalaryBenefits.js @@ -52,5 +52,5 @@ export const saveSecondaryPwd = params => { return WeaTools.callApi("/api/hrm/secondarypwd/saveSecondaryPwd", "POST", params); }; export const salaryBillGetToken = params => { - return WeaTools.callApi("/api/bs/hrmsalary/salaryBill/getToken", "GET", params); + return postFetch("/api/bs/hrmsalary/salaryBill/getToken", params); }; diff --git a/pc4mobx/hrmSalary/apis/payroll.js b/pc4mobx/hrmSalary/apis/payroll.js index b42d0a7a..01932e6a 100644 --- a/pc4mobx/hrmSalary/apis/payroll.js +++ b/pc4mobx/hrmSalary/apis/payroll.js @@ -206,22 +206,23 @@ export const sendMobileCode = (params) => { return postFetch("/api/bs/hrmsalary/salaryBill/sendMobileCode", params); }; //工资单-验证方式 -export const payrollCheckType = (params, header) => { - return fetch(`/api/bs/hrmsalary/salaryBill/payrollCheckType`, { +export const payrollCheckType = async header => { + const res = await fetch(`/api/bs/hrmsalary/salaryBill/payrollCheckType`, { method: "GET", mode: "cors", headers: { "Content-Type": "application/json", ...header } - }).then(res => res.json()); - // return WeaTools.callApi("/api/bs/hrmsalary/salaryBill/payrollCheckType", "GET", params); + }); + return await res.json(); }; //工资单-反馈验证 -export const feedBackSalaryBill = params => { +export const feedBackSalaryBill = async params => { const { header, ...payload } = params; - return fetch(`/api/bs/hrmsalary/salaryBill/feedBackSalaryBill?${convertToUrlString(payload)}`, { + const res = await fetch(`/api/bs/hrmsalary/salaryBill/feedBackSalaryBill?${convertToUrlString(payload)}`, { method: "GET", mode: "cors", headers: { "Content-Type": "application/json", ...header } - }).then(res => res.json()); + }); + return await res.json(); // return WeaTools.callApi("/api/bs/hrmsalary/salaryBill/feedBackSalaryBill", "GET", params); }; //工资单-确认 diff --git a/pc4mobx/hrmSalary/apis/statistics.js b/pc4mobx/hrmSalary/apis/statistics.js index 76056002..9f2aa6d4 100644 --- a/pc4mobx/hrmSalary/apis/statistics.js +++ b/pc4mobx/hrmSalary/apis/statistics.js @@ -134,3 +134,27 @@ export const getSalaryListSum = (params) => { export const exportSalaryList = (params) => { return postExportFetch("/api/bs/hrmsalary/report/statistics/employee/exportSalaryList", params); }; +//薪酬统计报表-保存全局自定义列配置 +export const savePageListSetting = (params) => { + return postFetch("/api/bs/hrmsalary/common/pageList/save/setting", params); +}; +//薪酬统计报表-保存页面模板 +export const savePageListTemplate = (params) => { + return postFetch("/api/bs/hrmsalary/common/pageList/template/save", params); +}; +// 薪酬统计报表-导出模板示例下载 +export const downloadPageListTemplate = (params) => { + return postExportFetch("/api/bs/hrmsalary/common/pageList/template/file/download", params); +}; +//薪酬统计报表-获取页面模板 +export const getPageListTemplatelist = (params) => { + return postFetch("/api/bs/hrmsalary/common/pageList/template/list", params); +}; +//薪酬统计报表-切换个体页面模板 +export const changePageListTemplate = (params) => { + return postFetch("/api/bs/hrmsalary/common/pageList/template/change", params); +}; +//薪酬统计报表-删除模板 +export const deleteTemplatePageList = (params) => { + return postFetch("/api/bs/hrmsalary/common/pageList/template/delete", params); +}; diff --git a/pc4mobx/hrmSalary/apis/taxAgent.js b/pc4mobx/hrmSalary/apis/taxAgent.js index f3c527b1..4e38cf8d 100644 --- a/pc4mobx/hrmSalary/apis/taxAgent.js +++ b/pc4mobx/hrmSalary/apis/taxAgent.js @@ -48,6 +48,10 @@ export const deleteTaxAgent = (params) => { export const taxAgentRangeSave = (params) => { return postFetch("/api/bs/hrmsalary/taxAgent/range/save", params); }; +//编辑人员范围 +export const taxAgentRangeEdit = (params) => { + return postFetch("/api/bs/hrmsalary/taxAgent/range/edit", params); +}; //非系统人员范围查询 export const taxAgentRangelistExt = (params) => { return postFetch("/api/bs/hrmsalary/taxAgent/range/listExt", params); diff --git a/pc4mobx/hrmSalary/apis/variableSalary.js b/pc4mobx/hrmSalary/apis/variableSalary.js index 8cd818b5..1bd063d0 100644 --- a/pc4mobx/hrmSalary/apis/variableSalary.js +++ b/pc4mobx/hrmSalary/apis/variableSalary.js @@ -44,7 +44,7 @@ export const getVariableSalaryDetail = params => { }; // 获取当前管理员下的所有的个税扣缴义务人 export const getAdminTaxAgentList = () => { - return WeaTools.callApi("/api/bs/hrmsalary/siaccount/getAdminTaxAgentList", "get", {}); + return WeaTools.callApi("/api/bs/hrmsalary/taxAgent/selectList", "GET", { isShare: false }); }; // 浮动薪酬档案导出 export const exportVariableSalary = (params) => { diff --git a/pc4mobx/hrmSalary/components/CustomBrowser/components/AssociativeSearchSingle.js b/pc4mobx/hrmSalary/components/CustomBrowser/components/AssociativeSearchSingle.js new file mode 100644 index 00000000..6e6f9555 --- /dev/null +++ b/pc4mobx/hrmSalary/components/CustomBrowser/components/AssociativeSearchSingle.js @@ -0,0 +1,26 @@ +/* + * 自定义浏览框组件 + * 单选 + * @Author: 黎永顺 + * @Date: 2024/9/3 + * @Wechat: + * @Email: 971387674@qq.com + * @description: +*/ +import React, { Component } from "react"; +import { WeaLocaleProvider } from "ecCom"; +import AssociativeSearchMult from "./associativeSearchMult"; + +const getLabel = WeaLocaleProvider.getLabel; + +class AssociativeSearchSingle extends Component { + + + render() { + return ( + + ); + } +} + +export default AssociativeSearchSingle; diff --git a/pc4mobx/hrmSalary/components/CustomBrowser/components/associativeSearchMult.js b/pc4mobx/hrmSalary/components/CustomBrowser/components/associativeSearchMult.js new file mode 100644 index 00000000..3f1dbc54 --- /dev/null +++ b/pc4mobx/hrmSalary/components/CustomBrowser/components/associativeSearchMult.js @@ -0,0 +1,165 @@ +/* + * 自定义浏览框组件 + * 多选 + * @Author: 黎永顺 + * @Date: 2024/8/29 + * @Wechat: + * @Email: 971387674@qq.com + * @description: +*/ +import React, { Component } from "react"; +import { WeaLocaleProvider } from "ecCom"; +import { Button, Icon, Select } from "antd"; +import { postFetch } from "../../../util/request"; +import classNames from "classnames"; + +const getLabel = WeaLocaleProvider.getLabel; +const Option = Select.Option; + +class AssociativeSearchMult extends Component { + constructor(props) { + super(props); + this.state = { + loading: false, data: [], activeKey: "", dropdownWidth: 200 + }; + this.selectedData = {}; + } + + componentDidMount() { + const { dropdownWidth } = this.state; + const w = $(this.refs.searchWrapperMui).outerWidth(); + if (dropdownWidth < w) { + this.setState({ dropdownWidth: w }); + } + } + + handleSearch = (value) => { + this.setState({ loading: true }); + this.getData(value); + }; + getData = (name = "") => { + const { browserConditionParam } = this.props; + const { + completeURL, filterByName, searchParamsKey, convertDatasource, dataParams = {} + } = browserConditionParam; + if (_.trim(name)) { + 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: "" }); + } + }; + getActiveKey = (data) => { + const { selectedValues = [] } = this.props; + let v = ""; + if (data && data.length > 0) { + let target = data.filter((d) => selectedValues.indexOf(d.id) === -1); + if (!_.isEmpty(target)) v = String(target[0].id); + } + return v; + }; + 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]; + } + } + }; + 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); + this.setState({ activeKey: "" }); + }; + handleBlur = () => this.setState({ data: [], activeKey: "" }); + handleClick = (e) => { + e && e.preventDefault(); + const { datas, selectedValues } = this.props; + if (this.props.clickCallback) this.props.clickCallback(selectedValues, datas); + }; + isReadOnly = () => { + const { viewAttr } = this.props; + return viewAttr === 1 || viewAttr === "1"; + }; + + render() { + const { data, dropdownWidth } = this.state; + const { viewAttr, selectedValues, datas, isSingle, browserConditionParam = {} } = this.props; + const clsname = classNames({ + "required": (viewAttr === 3 || viewAttr === "3") && _.isEmpty(selectedValues), + "mr12": viewAttr === "3" && _.isEmpty(selectedValues), + "wea-associative-single": (isSingle || browserConditionParam.isSingle), + "wea-associative-search-mult": !(isSingle || browserConditionParam.isSingle) + }); + if (this.isReadOnly()) { + let arr = []; + selectedValues && selectedValues.map(v => { + let item = datas[v].name; + if (_.isString(item)) { + arr.push({item}); + } else { + arr.push( ); + } + }); + return ( + {arr} + ); + } + let options = data.map(d => ); + selectedValues && selectedValues.map((v) => { + v && options.unshift(); + }); + const select = ; + return ( +
+ {select} + +
+
+
+ ); + } +} + +export default AssociativeSearchMult; 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 new file mode 100644 index 00000000..4cb5a125 --- /dev/null +++ b/pc4mobx/hrmSalary/components/CustomBrowser/components/customBrowserDialog.js @@ -0,0 +1,299 @@ +/* + * 自定义浏览框组件 + * 弹框选择 + * @Author: 黎永顺 + * @Date: 2024/8/30 + * @Wechat: + * @Email: 971387674@qq.com + * @description: +*/ +import React, { Component } from "react"; +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 { + constructor(props) { + super(props); + this.state = { + loading: false, listDatas: [], pageInfo: { current: 1, pageSize: 10, total: 0 }, selectedRowKeys: [], + 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(); + 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 = {}; + } + } + + getData = () => { + const { pageInfo, query } = this.state; + const { dialogType, completeURL, convertDatasource, dataParams = {} } = this.props; + let payload = { ...dataParams, ...query }; + dialogType === "table" && (payload = { ...pageInfo, ...payload, ...query }); + this.setState({ loading: true }); + postFetch(completeURL, payload).then(({ status, data }) => { + this.setState({ loading: false }); + if (status && data.list) { + const { pageNum: current, pageSize, total } = data; + this.setState({ + listDatas: convertDatasource ? convertDatasource(data.list) : data.list, + pageInfo: { ...pageInfo, current, pageSize, total } + }); + } else { + this.setState({ listDatas: _.map(data, o => ({ ...o, id: String(o.id) })) }); + } + }); + }; + handleRowClick = record => { + if (!this.props.isSingle) return; + const values = [record.id]; + const selectedData = { [record["id"]]: record }; + this.props.onCancel(); + this.props.onChange && this.props.onChange(values, selectedData); + }; + handleClear = () => { + this.props.onCancel(); + this.props.onChange && this.props.onChange([], {}); + }; + handleOk = () => { + 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(convertSelectedRowKeys, this.selectedData); + this.props.onCancel && this.props.onCancel(); + }; + getItemById = (id) => { + const { listDatas } = this.state; + if (this.selectedData[id]) return this.selectedData[id]; + if (!_.isEmpty(listDatas)) { + for (let i = 0; i < listDatas.length; 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; + }; + renderTitle = () => { + const { dialogType, searchParamsKey, isSingle } = this.props, { + query, pageInfo, selectedRowKeys, singleFilterVal + } = this.state; + return (
+ {getLabel(111, "数据选择")} + { + dialogType === "table" ? + this.setState({ query: { ...query, [searchParamsKey]: value } })} + onSearch={() => { + this.setState({ pageInfo: { ...pageInfo, current: 1 } }, () => { + this.getData(); + selectedRowKeys.forEach((v) => { + let item = this.getItemById(v); + if (item) this.selectedData[v] = item; + }); + }); + }}/> : isSingle ? + this.setState({ singleFilterVal })}/> : +
+ } +
); + }; + + render() { + 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 - 116 : 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.handleRowClick(_.find(listDatas, item => item.id === id))} + data={listDatas.filter((item) => item.name.indexOf(_.trim(singleFilterVal)) > -1)}/> + } +
+
; + if (dialogType === "table") { + 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.getData(); + selectedRowKeys.forEach((v) => { + let item = this.getItemById(v); + if (item) this.selectedData[v] = item; + }); + }); + }, + onChange: current => { + this.setState({ pageInfo: { ...pageInfo, current } }, () => { + this.getData(); + selectedRowKeys.forEach((v) => { + let item = this.getItemById(v); + if (item) this.selectedData[v] = item; + }); + }); + } + }; + const rowSelection = { + selectedRowKeys, + onChange: selectedRowKeys => this.setState({ selectedRowKeys }) + }; + dom =
+ +
; + } + dialogType === "table" && isSingle && buttons.splice(0, 1); + return ( + this.dialog = dom} title={this.renderTitle()} + className="custom_browser_dialog" draggable={false} style={{ + width: 784, height: 460, minHeight: 200, minWidth: 380, + maxHeight: "90%", maxWidth: "90%", overflow: "hidden", transform: "translate(0px, 0px)" + }} buttons={buttons}>{dom} + ); + } +} + +export default CustomBrowserDialog; diff --git a/pc4mobx/hrmSalary/components/CustomBrowser/components/customBrowserMutiLeft.js b/pc4mobx/hrmSalary/components/CustomBrowser/components/customBrowserMutiLeft.js new file mode 100644 index 00000000..94343950 --- /dev/null +++ b/pc4mobx/hrmSalary/components/CustomBrowser/components/customBrowserMutiLeft.js @@ -0,0 +1,81 @@ +/* + * 自定义浏览框组件 + * 选择框左边 + * @Author: 黎永顺 + * @Date: 2024/8/30 + * @Wechat: + * @Email: 971387674@qq.com + * @description: +*/ +import React, { Component } from "react"; +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, selectedKeys } = this.props; + const list = datas.map(item => { + this.dataObj[item.id] = item; + return
  • this.onClick(item)} + onDoubleClick={() => this.onDoubleClick(item)}> +
    {item.name}
    +
    + +
  • ; + }); + return ( +
    +
      + {list} +
    + { + list.length === 0 && +
    + {getLabel(111, "没有可显示的数据")} +
    + } +
    + ); + } +} + +export default CustomBrowserMutiLeft; diff --git a/pc4mobx/hrmSalary/components/CustomBrowser/components/customBrowserMutiRight.js b/pc4mobx/hrmSalary/components/CustomBrowser/components/customBrowserMutiRight.js new file mode 100644 index 00000000..d8a69b3e --- /dev/null +++ b/pc4mobx/hrmSalary/components/CustomBrowser/components/customBrowserMutiRight.js @@ -0,0 +1,110 @@ +/* + * 自定义浏览框组件 + * 选择框右边 + * @Author: 黎永顺 + * @Date: 2024/8/30 + * @Wechat: + * @Email: 971387674@qq.com + * @description: +*/ +import React, { Component } from "react"; +import { WeaInputSearch, WeaLocaleProvider, WeaNewScroll } from "ecCom"; +import { Tree } from "antd"; + +const getLabel = WeaLocaleProvider.getLabel; +const TreeNode = Tree.TreeNode; + +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); + }; + onDragStart = (obj) => { + clearTimeout(timeout); + this.props.checkedCb && this.props.checkedCb([]); + }; + onDrop = (obj) => { + const dragNodes = obj.dragNodesKeys; + const targetNode = obj.node.props.eventKey; + const result = []; + this.nodeIds.filter((item) => { + return dragNodes.indexOf(String(item)) === -1; + }).forEach((id) => { + if (String(id) === targetNode) { + dragNodes.forEach((drag) => { + result.push(this.nodeObj[drag]); + }); + } + result.push(this.nodeObj[id]); + }); + this.props.onDrag && this.props.onDrag(result); + }; + + render() { + const { height, checkedKeys } = this.props; + return ( +
    + +
    + + + {this.generateTreeNodes()} + + +
    +
    + ); + } +} + +export default CustomBrowserMutiRight; diff --git a/pc4mobx/hrmSalary/components/CustomBrowser/components/customBrowserOperation.js b/pc4mobx/hrmSalary/components/CustomBrowser/components/customBrowserOperation.js new file mode 100644 index 00000000..ab56ef02 --- /dev/null +++ b/pc4mobx/hrmSalary/components/CustomBrowser/components/customBrowserOperation.js @@ -0,0 +1,64 @@ +/* + * 自定义浏览框组件 + * 弹框操作栏 + * @Author: 黎永顺 + * @Date: 2024/8/30 + * @Wechat: + * @Email: 971387674@qq.com + * @description: +*/ +import React, { Component } from "react"; +import { WeaLocaleProvider } from "ecCom"; +import { Button } from "antd"; + +const getLabel = WeaLocaleProvider.getLabel; + +class CustomBrowserOperation extends Component { + render() { + const { + moveToLeft, + moveToRight, + leftArrowText, + rightArrowText, + leftActive, + rightActive, + className, + leftAllActive, + moveAllToLeft, + rightAllActive, + moveAllToRight + } = this.props; + + const moveToLeftButton = ( + + ); + const moveToRightButton = ( + + ); + + const moveAllToLeftButton = ( + + ); + const moveAllToRightButton = ( + + ); + return ( +
    + {moveToLeftButton} + {moveToRightButton} + {moveAllToLeftButton} + {moveAllToRightButton} +
    + ); + } +} + +export default CustomBrowserOperation; diff --git a/pc4mobx/hrmSalary/components/CustomBrowser/components/customTransferDialog.js b/pc4mobx/hrmSalary/components/CustomBrowser/components/customTransferDialog.js new file mode 100644 index 00000000..5714241e --- /dev/null +++ b/pc4mobx/hrmSalary/components/CustomBrowser/components/customTransferDialog.js @@ -0,0 +1,245 @@ +/* + * 自定义穿梭框组件 + * 弹框选择 + * @Author: 黎永顺 + * @Date: 2024/8/30 + * @Wechat: + * @Email: 971387674@qq.com + * @description: +*/ +import React, { Component } from "react"; +import { WeaDialog, WeaInputSearch, WeaLocaleProvider, WeaNewScroll, WeaTable } 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"; +import "../index.less"; + +const getLabel = WeaLocaleProvider.getLabel; + +class CustomTransferDialog extends Component { + constructor(props) { + super(props); + this.state = { + loading: false, listDatas: [], columns: [], selectedRowKeys: [], pageInfo: { current: 1, pageSize: 10, total: 0 }, + query: props.searchParamsKey ? { [props.searchParamsKey]: "" } : {}, + leftListSelectedKeys: [], // 左侧table选择的keys + leftListSelectedData: [], // 左侧table选择的数据 + rightCheckedKeys: [], //右侧选择的keys + rightDatas: [] // 右侧展示的数据 + }; + this.selectedData = {}; + } + + componentWillReceiveProps(nextProps, nextContext) { + if (nextProps.visible !== this.props.visible && nextProps.visible) { + this.getData(true, nextProps); + if (nextProps.datas) { + this.setState({ + leftListSelectedData: _.values(nextProps.datas), rightDatas: _.values(nextProps.datas) + }); + } + } else if (nextProps.visible !== this.props.visible && !nextProps.visible) { + this.setState({ + query: { [this.props.searchParamsKey]: "" }, selectedRowKeys: [], + rightDatas: [], rightCheckedKeys: [], leftListSelectedData: [], leftListSelectedKeys: [], + pageInfo: { current: 1, pageSize: 10, total: 0 } + }); + this.selectedData = {}; + } + } + + getData = (init = false, props) => { + const { query, pageInfo } = this.state; + const { completeURL, convertDatasource, dataParams = {}, dialogType } = props || this.props; + let payload = { ...dataParams, ...query }; + dialogType === "table" && (payload = { ...payload, ...pageInfo }); + this.setState({ loading: true }); + postFetch(completeURL, payload).then(({ status, data }) => { + this.setState({ loading: false }); + if (status && data.list) { + const { pageNum: current, pageSize, total } = data; + this.setState({ + listDatas: convertDatasource ? convertDatasource(data.list) : data.list, columns: data.columns, + pageInfo: { ...pageInfo, current, pageSize, total } + }); + } else { + this.setState({ + listDatas: convertDatasource ? convertDatasource(data).listDatas : [], + leftListSelectedData: (init && convertDatasource) ? convertDatasource(data).checked : this.state.leftListSelectedData, + rightDatas: (init && convertDatasource) ? convertDatasource(data).checked : this.state.rightDatas + }); + } + }); + }; + handleOk = () => { + const { rightDatas } = this.state; + this.props.onChange && this.props.onChange(rightDatas); + }; + 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; + }; + renderTitle = () => { + return (
    + {this.props.title || getLabel(111, "数据选择")} +
    {this.props.titleOptsComs}
    +
    ); + }; + + render() { + const { + loading, listDatas, query, leftListSelectedKeys, rightDatas, rightCheckedKeys, pageInfo, selectedRowKeys, + columns + } = this.state; + const { + searchParamsKey, saveLoading, dialogType = "", rowKey, tableOpts = {}, buttons = [ + , + + ] + } = this.props; + 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 = +
    +
    + + + this.getData()} + onChange={value => 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} + onDrag={(data) => { + this.setState({ rightDatas: data }); + }} + /> +
    +
    +
    ; + if (dialogType === "table") { + const sheight = this.dialog ? this.dialog.state.height - 156 : 260; + 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.getData()); + }, + onChange: current => { + this.setState({ pageInfo: { ...pageInfo, current } }, () => this.getData()); + } + }; + const rowSelection = { + selectedRowKeys, + onChange: selectedRowKeys => this.setState({ selectedRowKeys }, () => this.props.onSelect(selectedRowKeys)) + }; + dom =
    + {this.props.children} + +
    ; + } + return ( + this.dialog = dom} title={this.renderTitle()} + className="custom_browser_dialog" draggable={true} style={{ + width: 784, height: 460, minHeight: 200, minWidth: 380, + maxHeight: "90%", maxWidth: "90%", overflow: "hidden", transform: "translate(0px, 0px)" + }} buttons={buttons}>{dom} + ); + } +} + +export default CustomTransferDialog; diff --git a/pc4mobx/hrmSalary/components/CustomBrowser/index.js b/pc4mobx/hrmSalary/components/CustomBrowser/index.js new file mode 100644 index 00000000..f77d566d --- /dev/null +++ b/pc4mobx/hrmSalary/components/CustomBrowser/index.js @@ -0,0 +1,136 @@ +/* + * 自定义浏览框组件 + * + * @Author: 黎永顺 + * @Date: 2024/8/29 + * @Wechat: + * @Email: 971387674@qq.com + * @description: +*/ +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"; +import classNames from "classnames"; +import "./index.less"; + +const getLabel = WeaLocaleProvider.getLabel; +const getKey = WeaTools.getKey; + +class Index extends Component { + constructor(props) { + super(props); + this.state = { + browserDialog: { visible: false }, + selectedData: {}, searchKeys: [], // 搜索按钮选择的数据和keys + rightDatas: [] // 右侧展示的数据 + }; + } + + componentDidMount() { + const { value, fieldConfig } = this.props; + const { value: defaultValue, browserConditionParam: { replaceDatas = [] } } = fieldConfig; + if ((value || defaultValue) && replaceDatas.length > 0) { + this.setState({ + 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; + return (
    + +
    ); + }; + renderMult = () => { + const { fieldConfig } = this.props; + const { browserConditionParam = {} } = fieldConfig || {}; + const { selectedData, searchKeys } = this.state; + return (
    + { + browserConditionParam.treeSelect ? + : + + } +
    ); + }; + onBrowerChangeHandler = (values, datas) => { + const { form, fieldConfig, isSingle } = this.props; + const { browserConditionParam = {} } = fieldConfig || {}; + this.setState({ + searchKeys: (isSingle || browserConditionParam.isSingle) ? values.slice(-1) : values, + 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(",") } + }); + } + }); + }; + onBrowerClick = (keys, selectedObj) => { + if (_.isEmpty(keys)) { + this.setState({ searchKeys: [], selectedData: {}, rightDatas: [] }); + } + this.setState({ browserDialog: { visible: true } }); + }; + + render() { + const { browserDialog, selectedData, searchKeys } = this.state; + const { isSingle, viewAttr, fieldConfig = {} } = this.props; + const { browserConditionParam = {} } = fieldConfig || {}; + const className = classNames({ + "wea-browser": true, + "wea-field-readonly": viewAttr === "1" || fieldConfig.viewAttr === "1" + }); + const browser = (isSingle || browserConditionParam.isSingle) ? this.renderSingle() : this.renderMult(); + const style = {}; + if (this.props.resize) style.visibility = "hidden"; + return ( +
    {browser}
    + this.setState({ browserDialog: { visible: false } })} + datas={selectedData} selectedValues={searchKeys}/> +
    + ); + } +} + +export default Index; diff --git a/pc4mobx/hrmSalary/components/CustomBrowser/index.less b/pc4mobx/hrmSalary/components/CustomBrowser/index.less new file mode 100644 index 00000000..e49d982a --- /dev/null +++ b/pc4mobx/hrmSalary/components/CustomBrowser/index.less @@ -0,0 +1,99 @@ +.custom_browser_dialog { + .wea-hr-muti-dialog-title { + display: flex; + justify-content: space-between; + align-items: center; + + .wea-select, .ant-select-selection, .ant-select { + width: 100%; + } + + .wea-select { + display: inline-block; + position: relative; + } + + .ant-select-selection { + height: 30px; + border-radius: 0; + } + } + + .wea-hr-muti-input-table { + background: #f6f6f6; + padding: 8px 16px; + height: 100%; + + .table_opts { + display: flex; + align-items: center; + justify-content: flex-end; + width: 100%; + height: 40px; + background: #FFF; + + .wea-button-icon { + margin-right: 10px; + } + } + + .wea-new-table { + background: #FFF; + } + } + + .ant-spin-nested-loading, .ant-spin-container { + height: 100%; + } + + .wea-hr-muti-dialog { + height: 100%; + background: #f6f6f6; + padding: 8px 16px; + + .wea-hr-muti-input-left, .wea-hr-muti-input-right { + background: #FFF; + } + + .wea-transfer-list { + background: #FFF; + border: 1px solid #e9e9e9; + } + + .wea-input-focus { + height: 35px !important; + width: 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/FormInfo/index.js b/pc4mobx/hrmSalary/components/FormInfo/index.js new file mode 100644 index 00000000..d0d87963 --- /dev/null +++ b/pc4mobx/hrmSalary/components/FormInfo/index.js @@ -0,0 +1,98 @@ +import React, { Component } from "react"; +import { WeaCheckbox, WeaFormItem, WeaLocaleProvider, WeaSearchGroup } from "ecCom"; +import { observer } from "mobx-react"; +import { WeaSwitch } from "comsMobx"; + +const getLabel = WeaLocaleProvider.getLabel; +@observer +export default class FormInfo extends Component { + renderForm = () => { + const { + formFields, form, colCount, itemRender, onSelectedChangeHandle, showLabel, multiColumn, custLabelCol, + childrenComponents + } = this.props; + + let groupArr = []; + const formParams = form.getFormParams(); + const labelVisible = showLabel == null || showLabel == true; + const col = colCount ? colCount : 1; + const labelCol = labelVisible ? (custLabelCol || 6) : 0; + const itemProps = { + // ratio1to2: labelVisible && custLabelCol == null, + style: { marginLeft: 0 }, + tipPosition: "bottom", + labelCol: { span: labelCol }, + wrapperCol: { span: 22 - labelCol } + }; + const textAreaProps = { minRows: 4, maxRows: 4 }; + + formFields.map((fields, i) => { + let formItems = []; + fields.items.map((field, j) => { + const customerRender = itemRender != null ? itemRender[field.domkey[0]] : null; + const showCheckbox = field.checkbox || false; + let label = getLabel(field.lanId, field.label); + if (showCheckbox) + label = { + field.checkboxValue = v === "1"; + onSelectedChangeHandle && onSelectedChangeHandle(field, v); + }}/>; + let coms; + if (customerRender == null) { + coms = ; + } else { + coms = customerRender({ + ...field, helpfulTip: getLabel(field.helpfulTipLanId || "", field.helpfulTip || "") + }, textAreaProps, form, formParams); + } + Object.assign(itemProps, { label, error: form.getError(field) }); + let col = colCount ? colCount : 1; + if (multiColumn != null) {//检查有哪些字段需要一行显示多个 + const idx = _.findIndex(multiColumn, item => item.key === field.domkey[0]); + if (idx > -1) { + col = field.colSpan || 1; + if (multiColumn[idx].labelCol != null)//检查字段是否有配置标题宽度 + Object.assign(itemProps, { + labelCol: { span: multiColumn[idx].labelCol }, + wrapperCol: { span: 24 - multiColumn[idx].labelCol } + }); + } else { + Object.assign(itemProps, { + labelCol: { span: labelCol }, + wrapperCol: { span: 24 - labelCol } + }); + } + } + coms != null && formItems.push({ + com: ({coms}), hide: field.hide, + col + }); + + if (childrenComponents && childrenComponents[field.domkey[0]]) { + childrenComponents[field.domkey[0]]().map(child => formItems.push(child)); + } + }); + + groupArr.push(); + }); + return groupArr; + }; + + render() { + const { formFields, className, form } = this.props; + if (formFields == null || !form.isFormInit) return (
    ); + return ( +
    {this.renderForm()}
    + ); + } +} diff --git a/pc4mobx/hrmSalary/components/PersonalScopeModal/index.js b/pc4mobx/hrmSalary/components/PersonalScopeModal/index.js index d0718a2f..f4c62718 100644 --- a/pc4mobx/hrmSalary/components/PersonalScopeModal/index.js +++ b/pc4mobx/hrmSalary/components/PersonalScopeModal/index.js @@ -39,47 +39,33 @@ class PersonalScopeModal extends Component { } componentDidMount() { - const { isTaxgent = true } = this.props; - if (isTaxgent) { - this.getTaxAgentRangeForm(); - } else { - this.commonEnumList(); - // const employeeStatus = [ - // { key: "TRIAL", showname: "试用" }, - // { key: "FORMAL", showname: "正式" }, - // { key: "TEMPORARY", showname: "临时" }, - // { key: "DELAY", showname: "试用延期" }, - // { key: "FIRE", showname: "解雇" }, - // { key: "DEPARTURE", showname: "离职" }, - // { key: "RETIRED", showname: "退休" } - // ]; - // const targetTypeList = [ - // { - // key: "EMPLOYEE", - // showname: "人员", - // selected: false - // }, - // { - // key: "SUBCOMPANY", - // showname: "分部", - // selected: false - // }, - // { - // key: "DEPT", - // showname: "部门", - // selected: false - // }, - // { - // key: "POSITION", - // showname: "岗位", - // selected: false - // } - // ]; - // this.setState({ targetTypeList, employeeStatus }); + + } + + componentWillReceiveProps(nextProps, nextContext) { + if (nextProps.visible !== this.props.visible && nextProps.visible) { + const { isTaxgent = true } = nextProps; + if (isTaxgent) { + this.getTaxAgentRangeForm(); + } else { + this.commonEnumList(nextProps); + } + if (!_.isEmpty(nextProps.record)) { + this.setState({ + targetType: nextProps.record.targetType, + targetTypeIds: nextProps.record.targetType !== "SQL" ? String(nextProps.record.targetId) : nextProps.record.target, + targetTypeIdsNames: nextProps.record.targetName, + status: nextProps.record.status, + statusAll: "" + }); + } else { + this.handleReset(); + } } } - commonEnumList = () => { + commonEnumList = (props) => { + const { record } = props; commonEnumList({ enumClass: "com.engine.salary.enums.UserStatusEnum" }).then(({ status, data }) => { if (status) { const targetTypeList = [ @@ -112,6 +98,11 @@ class PersonalScopeModal extends Component { this.setState({ targetTypeList, employeeStatus: _.map(_.filter(data, o => o.value !== 7), it => ({ key: it.enum, showname: it.defaultLabel })) + }, () => { + if (!_.isEmpty(record)) { + const bool = _.every(_.map(this.state.employeeStatus, it => it.key), item => record.status.split(",").includes(item)); + this.setState({ statusAll: bool ? "0" : "" }); + } }); } }); @@ -129,7 +120,7 @@ class PersonalScopeModal extends Component { }; handleSubmit = () => { const { status, targetTypeIds, targetType } = this.state; - const { includeType, saveKeyVal, onSuccess, onCancel, APISaveFox } = this.props; + const { includeType, saveKeyVal, onSuccess, onCancel, APISaveFox, record } = this.props; if (_.isEmpty(status) || _.isEmpty(targetTypeIds)) { Modal.warning({ title: "信息确认", @@ -139,14 +130,14 @@ class PersonalScopeModal extends Component { } const payload = { employeeStatus: status.split(","), - includeType, + includeType, id: record.id, targetParams: targetType !== "SQL" ? _.map(targetTypeIds.split(","), it => ({ targetType, targetId: it, target: "" })) : [{ targetType, targetId: "0", target: targetTypeIds }], [saveKeyVal["key"]]: saveKeyVal["value"] }; this.setState({ loading: true }); - APISaveFox["save"](payload).then(({ status, errormsg }) => { + APISaveFox[_.isEmpty(record) ? "save" : "edit"](payload).then(({ status, errormsg }) => { this.setState({ loading: false }); if (status) { message.success("保存成功"); @@ -159,6 +150,7 @@ class PersonalScopeModal extends Component { }).catch(() => this.setState({ loading: true })); }; renderBrowser = () => { + const { record } = this.props; const { targetType, targetTypeIds, targetTypeIdsNames } = this.state; let browserType = {}; switch (targetType) { @@ -176,7 +168,7 @@ class PersonalScopeModal extends Component { break; case "SQL": return
    - this.setState({ targetTypeIds: val, targetTypeIdsNames: val })}/> }/>
    ; @@ -186,9 +178,9 @@ class PersonalScopeModal extends Component { return { this.setState({ targetTypeIds, targetTypeIdsNames }); @@ -197,7 +189,7 @@ class PersonalScopeModal extends Component { }; handleReset = () => { this.setState({ - targetType: "EMPLOYEE", + targetType: !_.isEmpty(this.props.record) ? this.props.record.targetType : "EMPLOYEE", targetTypeIds: "", status: "", statusAll: "" @@ -205,7 +197,7 @@ class PersonalScopeModal extends Component { }; render() { - const { onCancel, title, visible } = this.props; + const { onCancel, title, visible, record } = this.props; const { employeeStatus, targetTypeList, targetType, status, statusAll, loading } = this.state; const buttons = [ , @@ -233,6 +225,7 @@ class PersonalScopeModal extends Component {
    this.setState({ targetType })} diff --git a/pc4mobx/hrmSalary/components/PersonalScopeTable/index.js b/pc4mobx/hrmSalary/components/PersonalScopeTable/index.js index 8b38ba01..d8824c8b 100644 --- a/pc4mobx/hrmSalary/components/PersonalScopeTable/index.js +++ b/pc4mobx/hrmSalary/components/PersonalScopeTable/index.js @@ -41,7 +41,7 @@ class PersonalScopeTable extends Component { } getPersonalScopeList = (tabActive = this.props.tabActive) => { - const { searchValue, searchKeyVal, APIFox } = this.props; + const { searchValue, searchKeyVal, APIFox, showOperateBtn } = this.props; const { pageInfo, loading } = this.state; const payload = { [searchKeyVal["key"]]: searchKeyVal["value"], @@ -59,7 +59,10 @@ class PersonalScopeTable extends Component { columns: _.map(columns, item => { return { ...item, - render: (text) => { + render: (text, record) => { + if (item.dataIndex === "targetName" && showOperateBtn) { + return this.props.onEditScope(record)}>{text}; + } return {text}; } }; diff --git a/pc4mobx/hrmSalary/components/excelEditor/extendCodeMirror.js b/pc4mobx/hrmSalary/components/excelEditor/extendCodeMirror.js index e70c6967..32a5e5b0 100644 --- a/pc4mobx/hrmSalary/components/excelEditor/extendCodeMirror.js +++ b/pc4mobx/hrmSalary/components/excelEditor/extendCodeMirror.js @@ -18,8 +18,10 @@ CodeMirror.extendMode("javascript", { if (this.jsonMode) { return /^[\[,{]$/.test(content) || /^}/.test(textAfter) || /^]/.test(textAfter); } else { - if (content == ";" && state.lexical && state.lexical.type == ")") return false; - return /^[;{}]$/.test(content) && !/^;/.test(textAfter); + if (content == ";" && state.lexical && state.lexical.type == "}") return false; + // if (content == ";" && state.lexical && state.lexical.type == ")") return false; + return /[=,]/.test(content) || /.*\)/.test(textAfter); + // return /^[;{}]$/.test(content) && !/^;/.test(textAfter); } } }); @@ -94,7 +96,8 @@ CodeMirror.defineExtension("autoFormatRange", function (from, to) { atSol = false; } if (!atSol && inner.mode.newlineAfterToken && - inner.mode.newlineAfterToken(style, cur, stream.string.slice(stream.pos) || text[i + 1] || "", inner.state)) + // inner.mode.newlineAfterToken(style, cur, stream.string.slice(stream.pos) || text[i + 1] || "", inner.state)) + inner.mode.newlineAfterToken(style, cur, stream.string.slice(stream.pos, stream.pos + 2) || text[i + 1] || "", inner.state)) newline(); } if (!stream.pos && outer.blankLine) outer.blankLine(state); diff --git a/pc4mobx/hrmSalary/components/logViewModal/index.js b/pc4mobx/hrmSalary/components/logViewModal/index.js index 1867b765..6df7b5b8 100644 --- a/pc4mobx/hrmSalary/components/logViewModal/index.js +++ b/pc4mobx/hrmSalary/components/logViewModal/index.js @@ -40,7 +40,7 @@ class Index extends Component { this.setState({ dataSource: [], columns: [], pageInfo: { current: 0, pageSize: 10, total: 0 }, loading: false - }); + }, () => this.props.baseFormStore.form.resetForm()); } } diff --git a/pc4mobx/hrmSalary/components/pcTemplate/index.less b/pc4mobx/hrmSalary/components/pcTemplate/index.less index e57fe5e5..6ea7eaa5 100644 --- a/pc4mobx/hrmSalary/components/pcTemplate/index.less +++ b/pc4mobx/hrmSalary/components/pcTemplate/index.less @@ -82,6 +82,8 @@ } .data-detail { + padding-bottom: 16px; + .salary-group { background: #FFF; @@ -153,13 +155,14 @@ .item-count { //flex-basis: 328px; flex: 1; - padding-left: 16px; + padding: 12px 16px; height: 100%; - line-height: 40px; background: #fff; font-size: 12px; color: #5F5F5F; word-break: break-all; + display: flex; + align-items: center; } } } diff --git a/pc4mobx/hrmSalary/index.js b/pc4mobx/hrmSalary/index.js index 27bc86f2..272bdbdd 100644 --- a/pc4mobx/hrmSalary/index.js +++ b/pc4mobx/hrmSalary/index.js @@ -54,68 +54,16 @@ import TopologyMap from "./pages/topologyMap"; import SupplementaryCalc from "./pages/supplementaryCalc"; import VariableSalary from "./pages/variableSalary"; import Layout from "./layout"; - import stores from "./stores"; import "./style/index"; - // 读取系统多语言配置 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 补算 -// variableSalary 浮动薪酬 - const Routes = ( diff --git a/pc4mobx/hrmSalary/layout.js b/pc4mobx/hrmSalary/layout.js index f1ad9a67..a4919d5d 100644 --- a/pc4mobx/hrmSalary/layout.js +++ b/pc4mobx/hrmSalary/layout.js @@ -22,6 +22,8 @@ class Layout extends Component { componentWillReceiveProps(nextProps, nextContext) { if (window.e9LibsConfigCustomF && _.some(window.e9LibsConfigCustomF, o => (_.some(o, k => k === "h_hrmSalary")))) { + stores.baseFormStore.initForm(); + stores.baseFormStore.initFormExtra(); if (window.location.hash.indexOf("payroll") !== -1) { window.localStorage.removeItem("template-basedata"); window.localStorage.removeItem("salary-showset"); @@ -30,6 +32,7 @@ class Layout extends Component { } componentDidMount() { + this.setFontSize(); if (window.e9LibsConfigCustomF && _.some(window.e9LibsConfigCustomF, o => (_.some(o, k => k === "h_hrmSalary")))) { const src = "/spa/hrmSalary/hrmSalaryCalculateDetail/css/iconfont/iconfont.css"; const link = document.createElement("link"); @@ -41,8 +44,31 @@ class Layout extends Component { top.$(".ant-message").remove(); window.location.hash.indexOf("mobilepayroll") === -1 && stores.taxAgentStore.getPermission(); } + window.addEventListener("storage", this.setFontSize); } + componentWillUnmount() { + window.removeEventListener("storage", this.setFontSize); + } + + setFontSize = () => { + const { themeFontSize } = JSON.parse(localStorage.getItem("theme-themeInfo")) || { themeFontSize: "12" }; + if (window.location.href.indexOf("/spa/hrmSalary/") !== -1) { + const href = `/cloudstore/resource/pc/com/font-size/${themeFontSize}px.css`; + jQuery("#theme-font").remove(); + window.parent.jQuery("#theme-font1").remove(); + jQuery(jQuery("head")[0]).append(``); + const link = document.createElement("link"); + link.setAttribute("rel", "stylesheet"); + link.setAttribute("type", "text/css"); + link.setAttribute("href", href); + link.setAttribute("id", "theme-font1"); + setTimeout(() => { + window.parent.document.head.appendChild(link); + }, 500); + } + }; + render() { return ( {this.props.children} diff --git a/pc4mobx/hrmSalary/pages/adjustSalaryManage/index.js b/pc4mobx/hrmSalary/pages/adjustSalaryManage/index.js index d1fd2bb9..a58245c7 100644 --- a/pc4mobx/hrmSalary/pages/adjustSalaryManage/index.js +++ b/pc4mobx/hrmSalary/pages/adjustSalaryManage/index.js @@ -46,8 +46,8 @@ class Index extends Component { const payload = { ...pageInfo, ...extra, departmentIds: departmentIds ? departmentIds.split(",") : [], - positionIds: departmentIds ? departmentIds.split(",") : [], - operatorIds: departmentIds ? departmentIds.split(",") : [], + positionIds: positionIds ? positionIds.split(",") : [], + operatorIds: operatorIds ? operatorIds.split(",") : [], effectiveTime: effectiveTime1 ? [effectiveTime1, effectiveTime2] : [], operateTime: operateTime1 ? [operateTime1, operateTime2] : [] }; diff --git a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/conditions.js b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/conditions.js index 6a19614c..80f7e4dd 100644 --- a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/conditions.js +++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/conditions.js @@ -1,4 +1,3 @@ -import React from "react"; import { WeaLocaleProvider } from "ecCom"; const { getLabel } = WeaLocaleProvider; @@ -154,6 +153,36 @@ export const salaryDetailSearchConditions = [ multiple: true, viewAttr: 2 }, + { + browserConditionParam: { + completeParams: {}, + conditionDataParams: {}, + dataParams: {}, + destDataParams: {}, + hasAddBtn: false, + hasAdvanceSerach: false, + idSeparator: ",", + isAutoComplete: 1, + isDetail: 0, + isMultCheckbox: false, + isSingle: false, + icon: "icon-coms-hrm", + linkUrl: "", + pageSize: 10, + quickSearchName: "", + replaceDatas: [], + title: "", + type: "17", + viewAttr: 2 + }, + colSpan: 1, + conditionType: "BROWSER", + domkey: ["employeeIds"], + fieldcol: 16, + label: getLabel(111, "人员"), + labelcol: 8, + viewAttr: 2 + }, { browserConditionParam: { completeParams: {}, @@ -219,3 +248,66 @@ export const salaryDetailSearchConditions = [ col: 2 } ]; +export const tempCondition = [ + { + items: [ + { + conditionType: "INPUT", + domkey: ["name"], + fieldcol: 14, + label: "模板名称", + lanId: 111, + labelcol: 6, + value: "", + rules: "required|string", + viewAttr: 3 + }, + { + conditionType: "UPLOAD", + domkey: ["fileId"], + fieldcol: 14, + label: "导出模板", + lanId: 111, + labelcol: 6, + value: "", + datas: [], + multiSelection: false, + showClearAll: false, + showListBottom: true, + showListTop: true, + maxFilesNumber: 1, + limitType: "xlsx", + uploadUrl: "/api/doc/upload/uploadFile", + category: "111", + viewAttr: 2 + }, + { + conditionType: "SELECT", + domkey: ["sharedType"], + fieldcol: 14, + label: "可见性", + lanId: 111, + labelcol: 6, + options: [], + rules: "required|string", + viewAttr: 3 + }, + { + conditionType: "SELECT", + domkey: ["limitIds"], + fieldcol: 14, + label: "可见性范围", + lanId: 111, + labelcol: 6, + options: [], + detailtype: 3, + multiple: true, + rules: "", + viewAttr: 1, + hide: true + } + ], + title: "", + defaultshow: true + } +]; diff --git a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/employeeDetails.js b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/employeeDetails.js index 48816b74..6429bba6 100644 --- a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/employeeDetails.js +++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/employeeDetails.js @@ -108,7 +108,7 @@ class EmployeeDetails extends Component { pagination={pagination} loading={loading} columns={columns} - scroll={{ y: `calc(100vh - 174px)` }} + scroll={{ y: `calc(100vh - 182px)` }} /> ); } diff --git a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/reportList.js b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/reportList.js index dccae63f..586a1216 100644 --- a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/reportList.js +++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/reportList.js @@ -5,7 +5,7 @@ * Date: 2023/4/17 */ import React, { Component } from "react"; -import { WeaLocaleProvider } from "ecCom"; +import { WeaAlertPage, WeaLocaleProvider } from "ecCom"; import { Button, Col, Dropdown, Menu, message, Modal, Row } from "antd"; import { reportStatisticsReportDelete, @@ -14,7 +14,6 @@ import { } from "../../../apis/statistics"; import "../index.less"; -const SubMenu = Menu.SubMenu; const { getLabel } = WeaLocaleProvider; class ReportList extends Component { @@ -87,7 +86,9 @@ class ReportList extends Component { return ( { - _.isEmpty(dataSource) ?
    {getLabel(111, "暂无数据")}
    : + _.isEmpty(dataSource) ? +
    暂无数据
    +
    : _.map(dataSource, it => { const { reportName, dimension, id, dimensionId, isShare } = it; return this.handleGoReportView(id)}> diff --git a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/salaryDetails.js b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/salaryDetails.js index 3f01a8bf..1893e77e 100644 --- a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/salaryDetails.js +++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/salaryDetails.js @@ -6,13 +6,19 @@ */ import React, { Component } from "react"; import { inject, observer } from "mobx-react"; -import { toJS } from "mobx"; -import { WeaLoadingGlobal, WeaLocaleProvider } from "ecCom"; import { WeaTableNew } from "comsMobx"; -import { message, Spin } from "antd"; -import * as API from "../../../apis/statistics"; +import { WeaLoadingGlobal, WeaLocaleProvider, WeaSelect } from "ecCom"; +import { Button, message, Modal, Spin } from "antd"; import { getIframeParentHeight } from "../../../util"; import { sysConfCodeRule } from "../../../apis/ruleconfig"; +import CustomTransferDialog from "../../../components/CustomBrowser/components/customTransferDialog"; +import SalaryDetailsTempDialog from "./salaryDetailsTempDialog"; +import SalaryTempMangerDialog from "./salaryTempMangerDialog"; +import { MonthRangePicker } from "../../reportView/components/statisticalMicroSettingsSlide"; +import AdvanceInputBtn from "../components/advanceInputBtn"; +import SearchPannel from "../components/searchPannel"; +import * as API from "../../../apis/statistics"; +import cs from "classnames"; import "../index.less"; const WeaTableComx = WeaTableNew.WeaTable; @@ -24,15 +30,32 @@ class SalaryDetails extends Component { constructor(props) { super(props); this.state = { - loading: false, dataSource: [], columns: [], selectedRowKeys: [], - pageInfo: { current: 1, pageSize: 10, total: 0 }, payload: {}, - showTotalCell: false, updateSum: true + loading: false, dataSource: [], columns: [], selectedRowKeys: [], tempPageList: [], sumRow: {}, + pageInfo: { current: 1, pageSize: 10, total: 0 }, payload: {}, templateId: "", tempManageQuery: false, + showTotalCell: false, updateSum: true, + tempDialog: { visible: false, setting: [], heads: [], id: "", template: {} }, + transferDialog: { + visible: false, searchParamsKey: "name", saveLoading: false, + dataParams: { page: "salary_details_report" }, + completeURL: "", convertDatasource: datas => { + return { + listDatas: _.map(datas.setting, o => ({ id: o.id || o.column, name: o.name || o.text })), + checked: converCheckedCol(datas) + }; + }, + dialogType: "temp" + }, + tempManageDialog: { //模板管理 + visible: false, completeURL: "", dialogType: "table", dataParams: { page: "salary_details_report" } + } }; } - componentDidMount() { - this.getSalaryList(this.props); + async componentDidMount() { + const [{ data: confCode }] = await Promise.all([sysConfCodeRule({ code: "OPEN_ACCT_RESULT_SUM" })]); + this.setState({ showTotalCell: confCode === "1" }); window.addEventListener("message", this.handleReceive, false); + window.addEventListener("resize", () => this.forceUpdate(), false); } componentWillReceiveProps(nextProps, nextContext) { @@ -43,20 +66,31 @@ class SalaryDetails extends Component { componentWillUnmount() { window.removeEventListener("message", this.handleReceive, false); + window.removeEventListener("message", () => this.forceUpdate(), false); this.setState(({ selectedRowKeys: [] })); } + getPageListTemplatelist = () => { + API.getPageListTemplatelist({ page: "salary_details_report" }).then(({ status, data }) => { + if (status) { + this.setState({ + tempPageList: _.map(data, o => ({ ...o, key: String(o.id), showname: o.name })), + templateId: !_.isEmpty(_.find(data, o => !!o.checked)) ? String(_.find(data, o => !!o.checked).id) : "" + }); + } + }); + }; handleReceive = ({ data }) => { const { type, payload: { id, params } = {} } = data; const { pageInfo } = this.state; if (type === "init") { - this.getColumns(); + // this.getColumns(); + this.getSalaryList(this.props); } else if (type === "turn") { if (id === "PAGEINFO") { const { pageNum: current, size: pageSize } = params; this.setState({ - pageInfo: { ...pageInfo, current, pageSize }, - updateSum: false + pageInfo: { ...pageInfo, current, pageSize }, updateSum: false }, () => this.getSalaryList(this.props)); } else if (id === "CHECKBOX") { const { selectedRowKeys: checkBox } = params; @@ -73,56 +107,67 @@ class SalaryDetails extends Component { childFrameObj && childFrameObj.contentWindow.postMessage(JSON.stringify({ ...payload, i18n }), "*"); }; getSalaryList = (props) => { - const { attendanceStore: { salaryDetailSearchForm, tableStore }, dateRange } = props; + const { attendanceStore: { salaryDetailSearchForm, tableStore }, dateRange } = props || this.props; const [startDateStr, endDateStr] = dateRange; - const { taxAgentIds, subcompanyIds, departmentIds, ...extra } = salaryDetailSearchForm.getFormParams(); - const { pageInfo } = this.state; + const { taxAgentIds, subcompanyIds, departmentIds, employeeIds, ...extra } = salaryDetailSearchForm.getFormParams(); + const { pageInfo, transferDialog, updateSum } = this.state; const payload = { taxAgentIds: taxAgentIds ? taxAgentIds.split(",") : [], departmentIds: departmentIds ? departmentIds.split(",") : [], subcompanyIds: subcompanyIds ? subcompanyIds.split(",") : [], + employeeIds: employeeIds ? employeeIds.split(",") : [], ...extra, ...pageInfo, startDateStr, endDateStr }; this.setState({ loading: true }); - API.getSalaryList(payload).then(async ({ status, data }) => { - // API.getSalaryListSum(payload), - const [{ data: confCode }] = await Promise.all([sysConfCodeRule({ code: "OPEN_ACCT_RESULT_SUM" })]); + API.getSalaryList(payload).then(({ status, data }) => { + if (updateSum) this.getSalaryListSum(payload); this.setState({ loading: false }); if (status) { - const { dataKey, pageInfo: pageparams } = data; + const { columns, dataKey, pageInfo: pageparams } = data; const { list: dataSource, pageNum: current, total, pageSize } = pageparams; this.setState({ - dataSource, pageInfo: { ...pageInfo, current, total, pageSize }, payload, - showTotalCell: confCode === "1" - }, () => tableStore.getDatas(dataKey.datas)); + columns, dataSource, pageInfo: { ...pageInfo, current, total, pageSize }, payload + }, () => { + // tableStore.getDatas(dataKey.datas) + this.getColumns(); + }); } }).catch(() => this.setState({ loading: false })); }; + getSalaryListSum = (payload) => { + API.getSalaryListSum(payload).then(({ status, data }) => { + if (status) this.setState({ sumRow: data.sumRow }, () => this.getColumns()); + }); + }; handleExportSalaryList = (key) => { - const { attendanceStore: { tableStore } } = this.props; - let { selectedRowKeys, payload } = this.state; + // const { attendanceStore: { tableStore }, salaryDetailShowType } = this.props; + let { selectedRowKeys, payload, columns: tempCols } = this.state; + // const customCols = _.filter(toJS(tableStore.columns), (item) => item.display === "true" && item.dataIndex !== "acctTimes"); + // const columns = salaryDetailShowType === "1" ? _.filter(tempCols, o => o.column !== "acctTimes") : customCols; + const columns = _.filter(tempCols, o => o.column !== "acctTimes"); if (key === "SELECTED" && selectedRowKeys.length === 0) { message.warning(getLabel(543345, "请选择需要导出的数据!")); return; } WeaLoadingGlobal.start(); const promise = API.exportSalaryList({ - ...payload, ids: key === "SELECTED" ? selectedRowKeys : [], - columns: _.map(_.filter(toJS(tableStore.columns), (item) => item.display === "true" && item.dataIndex !== "acctTimes"), o => o.dataIndex) + ...payload, ids: key === "SELECTED" ? selectedRowKeys : [], columns: _.map(columns, o => o.column || o.dataIndex) }); }; getColumns = () => { - const { attendanceStore: { tableStore } } = this.props; - const { dataSource, pageInfo, selectedRowKeys, showTotalCell, payload, updateSum } = this.state; - const columns = _.filter(toJS(tableStore.columns), (item) => item.display === "true" && item.dataIndex !== "acctTimes"); - const sumRowlistUrl = showTotalCell ? "/api/bs/hrmsalary/report/statistics/employee/salaryListSum" : ""; + // const { attendanceStore: { tableStore }, salaryDetailShowType } = this.props; + const { + columns: tempCols, dataSource, pageInfo, selectedRowKeys, showTotalCell, sumRow + } = this.state; + // const customCols = _.filter(toJS(tableStore.columns), (item) => item.display === "true" && item.dataIndex !== "acctTimes"); + // const columns = salaryDetailShowType === "1" ? _.filter(tempCols, o => o.column !== "acctTimes") : customCols; + const columns = _.filter(tempCols, o => o.column !== "acctTimes"); if (!_.isEmpty(columns)) { this.postMessageToChild({ - dataSource, pageInfo, selectedRowKeys, showTotalCell, calcDetail: true, tableScrollHeight: 154, - sumRowlistUrl, payload: { ...payload, updateSum }, + dataSource, pageInfo, selectedRowKeys, showTotalCell, calcDetail: true, tableScrollHeight: 154, sumRow, columns: _.map(columns, (it, idx) => ({ - ...it, - width: (it.dataIndex === "taxAgent" || it.dataIndex === "salarySob") ? 176 : it.oldWidth, + dataIndex: it.column || it.dataIndex, title: it.text || it.title, calcDetail: true, + width: (it.dataIndex === "taxAgent" || it.dataIndex === "salarySob") ? 176 : (it.width || it.oldWidth), fixed: (idx === 1 || idx === 0 || idx === 2) ? "left" : "", ellipsis: true })) @@ -130,30 +175,161 @@ class SalaryDetails extends Component { } return []; }; + handleSetDefCols = (params = {}) => this.setState({ + transferDialog: { + ...this.state.transferDialog, visible: true, dataParams: { ...this.state.transferDialog.dataParams, ...params }, + completeURL: "/api/bs/hrmsalary/common/pageList/template/get", dialogType: "temp" + } + }, () => this.getPageListTemplatelist()); + + savePageListSetting = (values) => { + const { transferDialog } = this.state; + const payload = { + ...transferDialog.dataParams, setting: _.map(values, o => o.id) + }; + this.setState({ transferDialog: { ...this.state.transferDialog, saveLoading: true } }); + API.savePageListSetting(payload).then(({ status, errormsg }) => { + this.setState({ transferDialog: { ...this.state.transferDialog, saveLoading: false } }); + if (status) { + message.success(getLabel(111, "操作成功!")); + this.setState({ + transferDialog: { ...this.state.transferDialog, visible: false, dialogType: "temp" } + }, () => this.getSalaryList()); + } else { + message.error(errormsg); + } + }); + }; + handelAddTemp = (templateId = "") => { + const { tempDialog, tempPageList } = this.state; + if (_.isEmpty(this.transferRef.state.rightDatas)) { + message.warning(getLabel(111, "请选择设置!")); + return; + } + this.setState({ + tempDialog: { + ...tempDialog, visible: true, setting: _.map(this.transferRef.state.rightDatas, o => o.id), + heads: _.map(this.transferRef.state.rightDatas, o => o.name) + // template: _.find(tempPageList, o => o.key === templateId) + } + }); + }; + changePageListTemplate = (templateId) => { + this.setState({ templateId }, () => { + API.changePageListTemplate({ page: "salary_details_report", templateId }) + .then(({ status, errormsg }) => { + if (status) { + message.success(getLabel(111, "操作成功!")); + this.setState({ + transferDialog: { + ...this.state.transferDialog, + dataParams: { ...this.state.transferDialog.dataParams, id: templateId } + } + }, () => { + this.transferRef.getData(true); + this.getSalaryList(); + }); + } else { + message.error(errormsg); + } + }); + }); + }; + handleDelTemp = (ids) => { + Modal.confirm({ + title: getLabel(131329, "信息确认"), + content: getLabel(111, "确认删除吗?"), + onOk: () => { + API.deleteTemplatePageList({ ids }).then(({ status, errormsg }) => { + if (status) { + message.success(getLabel(111, "操作成功!")); + this.setState({ tempManageQuery: !this.state.tempManageQuery }, () => this.getPageListTemplatelist()); + } else { + message.error(errormsg); + } + }); + } + }); + }; render() { - const { loading, dataSource } = this.state; - const { attendanceStore: { tableStore } } = this.props; - return ( -
    - -