From 5a494893c76d8523169f90bb994eb834d1759124 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Fri, 6 Sep 2024 13:18:52 +0800 Subject: [PATCH] =?UTF-8?q?custom/=E9=A2=86=E6=82=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../apis/custom-apis/lingyue/index.js | 3 + .../components/associativeSearchMult.js | 4 +- .../components/customBrowserDialog.js | 59 ++++++++++++++----- .../components/CustomBrowser/index.less | 10 +++- .../lingyue/historyVouncherSummary/index.js | 40 +++++++++++-- .../pages/custom-pages/lingyue/index.less | 14 +++++ .../lingyue/vouncherSummary/index.js | 23 +++++--- 7 files changed, 122 insertions(+), 31 deletions(-) diff --git a/pc4mobx/hrmSalary/apis/custom-apis/lingyue/index.js b/pc4mobx/hrmSalary/apis/custom-apis/lingyue/index.js index 71b9b94f..b0a1d330 100644 --- a/pc4mobx/hrmSalary/apis/custom-apis/lingyue/index.js +++ b/pc4mobx/hrmSalary/apis/custom-apis/lingyue/index.js @@ -46,3 +46,6 @@ export const getHistoryVoucherList = (params) => { export const getHistoryVoucherDetailList = (params) => { return postFetch("/api/bs/hrmsalary/ly/PZ/historyVoucherDetailList", params); }; +export const deleteHistoryVoucher = (params) => { + return postFetch("/api/bs/hrmsalary/ly/PZ/deleteHistoryVoucher", params); +}; diff --git a/pc4mobx/hrmSalary/components/CustomBrowser/components/associativeSearchMult.js b/pc4mobx/hrmSalary/components/CustomBrowser/components/associativeSearchMult.js index d55b88ed..db895085 100644 --- a/pc4mobx/hrmSalary/components/CustomBrowser/components/associativeSearchMult.js +++ b/pc4mobx/hrmSalary/components/CustomBrowser/components/associativeSearchMult.js @@ -39,9 +39,9 @@ class AssociativeSearchMult extends Component { }; getData = (name = "") => { const { browserConditionParam } = this.props; - const { completeURL, searchParamsKey, convertDatasource } = browserConditionParam; + const { completeURL, searchParamsKey, convertDatasource, dataParams = {} } = browserConditionParam; if (_.trim(name)) { - postFetch(completeURL, { [searchParamsKey]: name, current: 1, pageSize: 9999 }) + postFetch(completeURL, { ...dataParams, [searchParamsKey]: name, current: 1, pageSize: 9999 }) .then(({ status, data }) => { this.setState({ loading: false }); if (status && data.list) { diff --git a/pc4mobx/hrmSalary/components/CustomBrowser/components/customBrowserDialog.js b/pc4mobx/hrmSalary/components/CustomBrowser/components/customBrowserDialog.js index 25dc8d1e..4e3ac10c 100644 --- a/pc4mobx/hrmSalary/components/CustomBrowser/components/customBrowserDialog.js +++ b/pc4mobx/hrmSalary/components/CustomBrowser/components/customBrowserDialog.js @@ -21,7 +21,8 @@ class CustomBrowserDialog extends Component { constructor(props) { super(props); this.state = { - loading: false, listDatas: [], pageInfo: { current: 1, pageSize: 10, total: 0 }, selectedRowKeys: [] + loading: false, listDatas: [], pageInfo: { current: 1, pageSize: 10, total: 0 }, selectedRowKeys: [], + query: { [props.searchParamsKey]: "" } }; this.selectedData = {}; } @@ -29,12 +30,16 @@ class CustomBrowserDialog extends Component { 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 } }); + this.selectedData = {}; + } } - getData = (query = {}) => { - const { pageInfo } = this.state; - const { dialogType, completeURL, convertDatasource } = this.props; - let payload = {}; + getData = () => { + const { pageInfo, query } = this.state; + const { dialogType, completeURL, convertDatasource, dataParams = {} } = this.props; + let payload = { ...dataParams }; dialogType === "table" && (payload = { ...pageInfo, ...payload, ...query }); this.setState({ loading: true }); postFetch(completeURL, payload).then(({ status, data }) => { @@ -63,7 +68,6 @@ class CustomBrowserDialog extends Component { }; handleOk = () => { const { selectedRowKeys } = this.state; - this.selectedData = {}; selectedRowKeys.forEach((v) => { let item = this.getItemById(v); if (item) this.selectedData[v] = item; @@ -72,8 +76,8 @@ class CustomBrowserDialog extends Component { this.props.onCancel && this.props.onCancel(); }; getItemById = (id) => { - const { listDatas } = this.state, { datas } = this.props; - if (datas[id]) return datas[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 (id === listDatas[i].id) return listDatas[i]; @@ -82,8 +86,8 @@ class CustomBrowserDialog extends Component { }; render() { - const { loading, listDatas, pageInfo, selectedRowKeys } = this.state; - const { dialogType, tableProps: { rowKey, columns }, isSingle } = this.props; + const { loading, listDatas, pageInfo, selectedRowKeys, query } = this.state; + const { dialogType, tableProps: { rowKey, columns }, isSingle, searchParamsKey } = this.props; const sheight = this.dialog ? this.dialog.state.height - 55 : 260; const buttons = [ , @@ -121,19 +125,44 @@ class CustomBrowserDialog extends Component { onShowSizeChange: (current, pageSize) => { this.setState({ pageInfo: { ...pageInfo, current, pageSize } - }, () => this.getData()); + }, () => { + 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()); + 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 = ; + dom = + 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; + }); + }); + }}/> + + ; } dialogType === "table" && isSingle && buttons.splice(0, 1); return ( diff --git a/pc4mobx/hrmSalary/components/CustomBrowser/index.less b/pc4mobx/hrmSalary/components/CustomBrowser/index.less index 5e681ecf..e2d30e6e 100644 --- a/pc4mobx/hrmSalary/components/CustomBrowser/index.less +++ b/pc4mobx/hrmSalary/components/CustomBrowser/index.less @@ -1,11 +1,19 @@ .custom_browser_dialog { + .tableSearch { + float: right; + margin: 16px; + position: relative; + z-index: 99; + min-width: 200px; + } + .ant-spin-nested-loading, .ant-spin-container { height: 100%; } .wea-input-focus { height: 35px !important; - width: 100% !important; + //width: 100% !important; input { height: 100% !important; diff --git a/pc4mobx/hrmSalary/pages/custom-pages/lingyue/historyVouncherSummary/index.js b/pc4mobx/hrmSalary/pages/custom-pages/lingyue/historyVouncherSummary/index.js index 210ab44f..5f334360 100644 --- a/pc4mobx/hrmSalary/pages/custom-pages/lingyue/historyVouncherSummary/index.js +++ b/pc4mobx/hrmSalary/pages/custom-pages/lingyue/historyVouncherSummary/index.js @@ -8,13 +8,18 @@ * @description: */ import React, { Component } from "react"; -import { WeaDatePicker, WeaFormItem, WeaInputSearch, WeaLocaleProvider, WeaTable, WeaTop } from "ecCom"; +import { inject, observer } from "mobx-react"; +import { Modal, WeaDatePicker, WeaFormItem, WeaInputSearch, WeaLocaleProvider, WeaTable, WeaTop } from "ecCom"; +import { message } from "antd"; import HistoryVouncherDetail from "./historyVouncherDetail"; import * as API from "../../../../apis/custom-apis/lingyue"; +import { deleteHistoryVoucher } from "../../../../apis/custom-apis/lingyue"; import moment from "moment"; const getLabel = WeaLocaleProvider.getLabel; +@inject("taxAgentStore") +@observer class Index extends Component { constructor(props) { super(props); @@ -29,7 +34,7 @@ class Index extends Component { } getHistoryVoucherList = () => { - const { pageInfo, query } = this.state; + const { pageInfo, query } = this.state, { taxAgentStore: { salaryManager } } = this.props; const payload = { ...pageInfo, ...query }; this.setState({ loading: true }); API.getHistoryVoucherList(payload).then(({ status, data }) => { @@ -40,16 +45,39 @@ class Index extends Component { dataSource, pageInfo: { ...pageInfo, current, pageSize, total }, columns: [ ...columns, { - dataIndex: "options", title: getLabel(111, "操作"), width: 150, - render: (__, record) => ( this.setState({ - detail: { visible: true, id: record.id } - })}>{getLabel(111, "查看详情")}) + dataIndex: "options", title: getLabel(111, "操作"), width: 160, + render: (__, record) => ( + this.setState({ + detail: { visible: true, id: record.id } + })}>{getLabel(111, "查看详情")} + { + salaryManager && + this.handleDelListItem(record.id)}>{getLabel(111, "删除")} + } + ) } ] }); } }); }; + handleDelListItem = (id) => { + Modal.confirm({ + title: getLabel(111, "信息确认"), + content: getLabel(111, "是否删除已推送成功的凭证记录?删除后可再次推送,请同步删除NC中对应凭证。"), + onOk: () => { + deleteHistoryVoucher({ id }).then(({ status, errormsg }) => { + if (status) { + message.success(getLabel(111, "操作成功!")); + this.getHistoryVoucherList(); + } else { + message.error(errormsg); + } + }); + } + }); + }; render() { const { query, dataSource, columns, pageInfo, loading, detail } = this.state; diff --git a/pc4mobx/hrmSalary/pages/custom-pages/lingyue/index.less b/pc4mobx/hrmSalary/pages/custom-pages/lingyue/index.less index 4404e46e..de54d442 100644 --- a/pc4mobx/hrmSalary/pages/custom-pages/lingyue/index.less +++ b/pc4mobx/hrmSalary/pages/custom-pages/lingyue/index.less @@ -36,6 +36,20 @@ padding: 16px 16px 0 16px; background: #F6F6F6; overflow-y: hidden; + position: relative; + + .fixed-total-table { + position: absolute; + bottom: 0; + left: 0; + padding: 0 16px; + border-top: 1px solid #e9e9e9; + + .wea-table-edit-title, .ant-table-selection-column > span { + display: none; + } + + } .wea-table-edit, .wea-new-table { background: #FFF; diff --git a/pc4mobx/hrmSalary/pages/custom-pages/lingyue/vouncherSummary/index.js b/pc4mobx/hrmSalary/pages/custom-pages/lingyue/vouncherSummary/index.js index 6517545b..f52971ca 100644 --- a/pc4mobx/hrmSalary/pages/custom-pages/lingyue/vouncherSummary/index.js +++ b/pc4mobx/hrmSalary/pages/custom-pages/lingyue/vouncherSummary/index.js @@ -21,7 +21,7 @@ class Index extends Component { constructor(props) { super(props); this.state = { - datas: [], columns: [], loading: false + datas: [], totalData: [], columns: [], loading: false }; } @@ -36,12 +36,12 @@ class Index extends Component { ffgsqc: decodeURI(getURLParameters(window.location.hash).ffgsqc) }; WeaLoadingGlobal.start(); - API.genAndPreveiw(payload).then(({ status, data }) => { + API.genAndPreveiw(payload).then(({ status, data, errormsg }) => { WeaLoadingGlobal.destroy(); if (status) { - const { columns, data: datas } = data; + const { columns, data: datas, totalData } = data; this.setState({ - datas, columns: columns.map(col => ({ + datas, totalData: [totalData], columns: columns.map(col => ({ title: col.text, dataIndex: col.column, key: col.column, width: (100 / columns.length) + "%", com: [ { @@ -54,12 +54,14 @@ class Index extends Component { const replaceDatas = _.isArray(text) ? _.map(text, o => ({ ...o, id: o.bh, name: `${o.fzhslx}:${o.bh}/${o.mc}` })) : !_.isNil(text) ? [{ ...text, id: text.bh, name: `${text.fzhslx}:${text.bh}/${text.mc}` }] : []; + const fzhslxEnum = { "fzhsXmqs": 0, "fzhsFwlb": 1, "fzhsSllb": 2, "fzhsKs": 3 }; return } showDropIcon={false} iconBgcolor="#F14A2D" className="custom_vouchers_lingyue" - buttons={[]}>
this.setState({ datas })} getRowSelection={rowSelection => !pzlxEnum.includes(pzlx) ? rowSelection : false} - tableProps={{ scroll: { y: `calc(100vh - 174.58px)` } }} + tableProps={{ scroll: { y: `calc(100vh - 190.58px)` } }} /> +
+ ({ ...o, com: [{ key: o.column, type: "TEXT" }] }))}/> +
);