From 3654e2a3785c2cb6e7a0bc063817594fc3333f63 Mon Sep 17 00:00:00 2001 From: lys <971387674@qq.com> Date: Mon, 11 Nov 2024 14:43:17 +0800 Subject: [PATCH] =?UTF-8?q?feature/2.16.1.2410.01-=E8=96=AA=E9=85=AC?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E6=8A=A5=E8=A1=A8=E8=96=AA=E8=B5=84=E6=98=8E?= =?UTF-8?q?=E7=BB=86=E6=B7=BB=E5=8A=A0=E6=A8=A1=E6=9D=BF=E5=88=87=E6=8D=A2?= =?UTF-8?q?=E5=92=8C=E6=A8=A1=E6=9D=BF=E5=88=9B=E5=BB=BA=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/customBrowserMutiRight.js | 25 +++- .../components/customTransferDialog.js | 1 + .../components/salaryDetails.js | 112 ++++++++++-------- .../components/salaryDetailsTempDialog.js | 12 +- .../analysisOfSalaryStatistics/index.less | 24 +++- 5 files changed, 117 insertions(+), 57 deletions(-) diff --git a/pc4mobx/hrmSalary/components/CustomBrowser/components/customBrowserMutiRight.js b/pc4mobx/hrmSalary/components/CustomBrowser/components/customBrowserMutiRight.js index ed56dd09..a77e6e4d 100644 --- a/pc4mobx/hrmSalary/components/CustomBrowser/components/customBrowserMutiRight.js +++ b/pc4mobx/hrmSalary/components/CustomBrowser/components/customBrowserMutiRight.js @@ -66,6 +66,26 @@ class CustomBrowserMutiRight extends Component { 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(item) === -1; + }).forEach((id) => { + if (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; @@ -76,9 +96,8 @@ class CustomBrowserMutiRight extends Component {
+ onSelect={this.checkHandler} onDoubleClick={this.onDoubleClick} selectedKeys={checkedKeys} + onDragStart={this.onDragStart} onDrop={this.onDrop}> {this.generateTreeNodes()} diff --git a/pc4mobx/hrmSalary/components/CustomBrowser/components/customTransferDialog.js b/pc4mobx/hrmSalary/components/CustomBrowser/components/customTransferDialog.js index af640c34..94aaad3f 100644 --- a/pc4mobx/hrmSalary/components/CustomBrowser/components/customTransferDialog.js +++ b/pc4mobx/hrmSalary/components/CustomBrowser/components/customTransferDialog.js @@ -188,6 +188,7 @@ class CustomTransferDialog extends Component { data={rightDatas} checkedKeys={rightCheckedKeys} checkedCb={rightCheckedKeys => this.setState({ rightCheckedKeys })} onDoubleClick={this.onRightDoubleClick} + onDrag={(data) => {this.setState({rightDatas: data})}} />
diff --git a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/salaryDetails.js b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/salaryDetails.js index 565a87bd..cbc72a7c 100644 --- a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/salaryDetails.js +++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/salaryDetails.js @@ -30,9 +30,9 @@ class SalaryDetails extends Component { constructor(props) { super(props); this.state = { - loading: false, dataSource: [], columns: [], selectedRowKeys: [], tempPageList: [], + loading: false, dataSource: [], columns: [], selectedRowKeys: [], tempPageList: [], sumRow: {}, pageInfo: { current: 1, pageSize: 10, total: 0 }, payload: {}, templateId: "", - showTotalCell: false, updateSum: true, tempDialog: { visible: false, setting: [] }, + showTotalCell: false, updateSum: true, tempDialog: { visible: false, setting: [], id: "", template: {} }, transferDialog: { visible: false, searchParamsKey: "name", dataParams: { page: "salary_details_report" }, saveLoading: false, completeURL: "", convertDatasource: datas => { @@ -46,13 +46,16 @@ class SalaryDetails extends Component { }; } - componentDidMount() { - this.getSalaryList(this.props); - this.getPageListTemplatelist(); + async componentDidMount() { + const [{ data: confCode }] = await Promise.all([sysConfCodeRule({ code: "OPEN_ACCT_RESULT_SUM" })]); + this.setState({ + showTotalCell: confCode === "1" + }, () => { + this.getSalaryList(this.props); + this.getPageListTemplatelist(); + }); window.addEventListener("message", this.handleReceive, false); - window.addEventListener("resize", () => this.setState({ - transferDialog: { ...this.state.transferDialog, cancel: true } - }, () => this.forceUpdate()), false); + window.addEventListener("resize", () => this.forceUpdate(), false); } componentWillReceiveProps(nextProps, nextContext) { @@ -63,9 +66,7 @@ class SalaryDetails extends Component { componentWillUnmount() { window.removeEventListener("message", this.handleReceive, false); - window.removeEventListener("message", () => this.setState({ - transferDialog: { ...this.state.transferDialog, cancel: true } - }, () => this.forceUpdate()), false); + window.removeEventListener("message", () => this.forceUpdate(), false); this.setState(({ selectedRowKeys: [] })); } @@ -73,9 +74,9 @@ class SalaryDetails extends Component { API.getPageListTemplatelist({ page: "salary_details_report" }).then(({ status, data }) => { if (status) { this.setState({ - tempPageList: _.map(data, o => ({ key: String(o.id), showname: o.name })), + 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) : "", - transferDialog: { ...this.state.transferDialog, visible: false, cancel: true, type: "default" } + transferDialog: { ...this.state.transferDialog, visible: false, type: "default" } }); } }); @@ -110,7 +111,7 @@ class SalaryDetails extends Component { const { attendanceStore: { salaryDetailSearchForm, tableStore }, dateRange } = props || this.props; const [startDateStr, endDateStr] = dateRange; const { taxAgentIds, subcompanyIds, departmentIds, ...extra } = salaryDetailSearchForm.getFormParams(); - const { pageInfo, transferDialog } = this.state; + const { pageInfo, transferDialog, updateSum } = this.state; const payload = { taxAgentIds: taxAgentIds ? taxAgentIds.split(",") : [], departmentIds: departmentIds ? departmentIds.split(",") : [], @@ -118,20 +119,23 @@ class SalaryDetails extends Component { ...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 { columns, dataKey, pageInfo: pageparams } = data; const { list: dataSource, pageNum: current, total, pageSize } = pageparams; this.setState({ - columns, dataSource, pageInfo: { ...pageInfo, current, total, pageSize }, payload, - showTotalCell: confCode === "1", transferDialog: { ...transferDialog, cancel: false } + columns, dataSource, pageInfo: { ...pageInfo, current, total, pageSize }, payload }, () => tableStore.getDatas(dataKey.datas)); } }).catch(() => this.setState({ loading: false })); }; + getSalaryListSum = (payload) => { + API.getSalaryListSum(payload).then(({ status, data }) => { + if (status) this.setState({ sumRow: data.sumRow }); + }); + }; handleExportSalaryList = (key) => { const { attendanceStore: { tableStore }, salaryDetailShowType } = this.props; let { selectedRowKeys, payload, columns: tempCols } = this.state; @@ -149,15 +153,13 @@ class SalaryDetails extends Component { getColumns = () => { const { attendanceStore: { tableStore }, salaryDetailShowType } = this.props; const { - columns: tempCols, dataSource, pageInfo, selectedRowKeys, showTotalCell, payload, updateSum, transferDialog + columns: tempCols, dataSource, pageInfo, selectedRowKeys, showTotalCell, sumRow, transferDialog } = this.state; const customCols = _.filter(toJS(tableStore.columns), (item) => item.display === "true" && item.dataIndex !== "acctTimes"); - const sumRowlistUrl = showTotalCell ? "/api/bs/hrmsalary/report/statistics/employee/salaryListSum" : ""; const columns = salaryDetailShowType === "1" ? _.filter(tempCols, o => o.column !== "acctTimes") : customCols; - if (!_.isEmpty(columns) && !transferDialog.visible && !transferDialog.cancel) { + 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) => ({ dataIndex: it.column || it.dataIndex, title: it.text || it.title, calcDetail: true, width: (it.dataIndex === "taxAgent" || it.dataIndex === "salarySob") ? 176 : (it.width || it.oldWidth), @@ -170,13 +172,14 @@ class SalaryDetails extends Component { }; handleSetDefCols = () => this.setState({ transferDialog: { - ...this.state.transferDialog, completeURL: "/api/bs/hrmsalary/common/pageList/get/setting", visible: true + ...this.state.transferDialog, completeURL: "/api/bs/hrmsalary/common/pageList/get/setting", visible: true, + dataParams: { page: "salary_details_report" } } }); converCheckedCol = (data) => { return _.reduce(data.checked || [], (pre, cur) => { - const item = _.find(data.setting, k => k.id === cur); - if (!_.isEmpty(item)) return [...pre, item]; + const item = _.find(data.setting, k => (k.id === cur) || (k.column === cur.column)); + if (!_.isEmpty(item)) return [...pre, { ...item, id: item.id || item.column, name: item.name || item.text }]; return pre; }, []); }; @@ -205,12 +208,17 @@ class SalaryDetails extends Component { } }); }; - handelAddTemp = () => this.setState({ - transferDialog: { - ...this.state.transferDialog, visible: true, type: "temp", - completeURL: "/api/bs/hrmsalary/common/pageList/template/get" - } - }); + handelAddTemp = (templateId) => { + const { transferDialog, tempDialog, tempPageList } = this.state; + this.setState({ + transferDialog: { + ...transferDialog, visible: true, type: "temp", + dataParams: { ...transferDialog.dataParams, id: templateId }, + completeURL: "/api/bs/hrmsalary/common/pageList/template/get" + }, + tempDialog: { ...tempDialog, id: templateId, template: _.find(tempPageList, o => o.key === templateId) } + }); + }; changePageListTemplate = (templateId) => { this.setState({ templateId }, () => { API.changePageListTemplate({ page: "salary_details_report", templateId }).then(({ status, errormsg }) => { @@ -231,21 +239,25 @@ class SalaryDetails extends Component {
{ salaryDetailShowType === "1" && - +
+ + { + templateId && + this.handelAddTemp(templateId)}> + + + } +
} - this.setState({ - transferDialog: { ...this.state.transferDialog, cancel: true } - }, () => this.props.handleOpenAdvanceSearch())} onAdvanceSearch={this.props.handleAdvanceSearch}/> +
- { - this.setState({ - transferDialog: { ...this.state.transferDialog, cancel: true } - }, () => this.props.onCancel()); - }} onAdSearch={this.props.onAdSearch}/> +
@@ -267,14 +279,18 @@ class SalaryDetails extends Component { this.setState({ transferDialog: { - ...transferDialog, completeURL: "", visible: false, cancel: true, type: "default" + ...transferDialog, completeURL: "", visible: false, type: "default" } })}/> {/*薪资明细模板设置*/} - this.setState({ + this.setState({ tempDialog: { ...tempDialog, visible: false, setting: [] } - })}/> + }, () => callback && callback())} + onSuccess={() => { + this.getPageListTemplatelist(); + this.getSalaryList(); + }}/>
); diff --git a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/salaryDetailsTempDialog.js b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/salaryDetailsTempDialog.js index 8fad6460..f89e5969 100644 --- a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/salaryDetailsTempDialog.js +++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/salaryDetailsTempDialog.js @@ -39,12 +39,13 @@ class SalaryDetailTempDialog extends Component { getTempForm = (props) => { getTaxAgentSelectList().then(({ status, data }) => { if (status) { + const { id, template } = props; this.setState({ conditions: _.map(tempCondition, item => ({ ...item, items: _.map(item.items, o => { if (getKey(o) === "sharedType") { return { - ...o, label: getLabel(o.lanId, o.label), value: "0", + ...o, label: getLabel(o.lanId, o.label), value: id ? String(template["sharedType"]) : "0", options: [ { key: "0", showname: getLabel(111, "公共") }, { key: "1", showname: getLabel(111, "私有") } @@ -52,11 +53,12 @@ class SalaryDetailTempDialog extends Component { }; } else if (getKey(o) === "limitIds") { return { - ...o, label: getLabel(o.lanId, o.label), + ...o, label: getLabel(o.lanId, o.label), hide: !id || (id && template["sharedType"] === 0), + value: id ? template["limitIds"].join(",") : "", options: _.map(data, o => ({ key: o.id, showname: o.content })) }; } - return { ...o, label: getLabel(o.lanId, o.label) }; + return { ...o, label: getLabel(o.lanId, o.label), value: id ? template[getKey(o)] : "" }; }) })) }, () => { @@ -67,13 +69,13 @@ class SalaryDetailTempDialog extends Component { }); }; save = () => { - const { attendanceStore: { tempForm }, setting } = this.props; + const { attendanceStore: { tempForm }, setting, id } = this.props; tempForm.validateForm().then(f => { if (f.isValid) { this.setState({ loading: true }); const { limitIds, ...formVal } = tempForm.getFormParams(); const payload = { - page: "salary_details_report", setting, ...formVal, + page: "salary_details_report", setting, id, ...formVal, limitIds: !_.isEmpty(limitIds) ? limitIds.split(",") : [] }; API.savePageListTemplate(payload).then(({ status, errormsg }) => { diff --git a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/index.less b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/index.less index a2fa2079..40c137f0 100644 --- a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/index.less +++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/index.less @@ -220,8 +220,30 @@ margin-bottom: 8px; padding: 0 8px; + .custom-select { + display: flex; + align-content: center; + position: relative; + + .custom-select-edit { + position: absolute; + right: -56px; + cursor: pointer; + display: inline-block; + vertical-align: middle; + background-color: #f4f4f4; + color: #b2b2b2; + border: 1px solid #d9d9d9; + border-left: none; + width: 28px; + height: 30px; + line-height: 28px; + text-align: center; + } + } + .rangePickerBox { - margin: 0 10px 0 40px; + margin: 0 10px 0 68px; } }