custom/领悦

This commit is contained in:
黎永顺 2024-09-06 13:18:52 +08:00
parent 2064cc4111
commit 5a494893c7
7 changed files with 122 additions and 31 deletions

View File

@ -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);
};

View File

@ -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) {

View File

@ -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 = [
<Button type="primary" onClick={this.handleOk}>{getLabel(111, "确 定")}</Button>,
@ -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 = <WeaTable dataSource={listDatas} loading={loading} pagination={pagination} scroll={{ y: sheight }}
onRowClick={this.handleRowClick} rowSelection={!isSingle ? rowSelection : null}
rowKey={rowKey || "id"} columns={columns}/>;
dom = <React.Fragment>
<WeaInputSearch value={query[searchParamsKey]} className="tableSearch"
onChange={value => 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;
});
});
}}/>
<WeaTable dataSource={listDatas} loading={loading} pagination={pagination} scroll={{ y: sheight }}
onRowClick={this.handleRowClick} rowSelection={!isSingle ? rowSelection : null}
rowKey={rowKey || "id"} columns={columns}/>
</React.Fragment>;
}
dialogType === "table" && isSingle && buttons.splice(0, 1);
return (

View File

@ -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;

View File

@ -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) => (<a href="javascript:void(0);" onClick={() => this.setState({
detail: { visible: true, id: record.id }
})}>{getLabel(111, "查看详情")}</a>)
dataIndex: "options", title: getLabel(111, "操作"), width: 160,
render: (__, record) => (<React.Fragment>
<a href="javascript:void(0);" onClick={() => this.setState({
detail: { visible: true, id: record.id }
})}>{getLabel(111, "查看详情")}</a>
{
salaryManager &&
<a href="javascript:void(0);" style={{ marginLeft: 10 }}
onClick={() => this.handleDelListItem(record.id)}>{getLabel(111, "删除")}</a>
}
</React.Fragment>)
}
]
});
}
});
};
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;

View File

@ -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;

View File

@ -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 <CustomBrowser
fieldConfig={{
viewAttr: !pzlxEnum.includes(pzlx) ? 2 : 1,
browserConditionParam: {
isSingle: col.column !== "fzhsOther", replaceDatas,
dialogType: "table", searchParamsKey: "key",
dataParams: { fzhslx: fzhslxEnum[col.column] },
tableProps: {
rowKey: "bh", columns: [
{ title: getLabel(111, "名称"), dataIndex: "mc" },
@ -83,6 +85,8 @@ class Index extends Component {
]
}))
});
} else {
message.error(errormsg);
}
});
};
@ -114,13 +118,13 @@ class Index extends Component {
};
render() {
const { datas, columns, loading } = this.state;
const { datas, columns, loading, totalData } = this.state;
const pzlx = getQueryString("pzlx");
return (
<WeaTop
title={getLabel(111, "凭证预览汇总表")} icon={<i className="icon-coms-fa"/>} showDropIcon={false}
iconBgcolor="#F14A2D" className="custom_vouchers_lingyue"
buttons={[<Button type="primary" loading={loading}
buttons={[<Button type="primary" loading={loading} disabled={_.isEmpty(datas)}
onClick={this.pushNotifications}>{getLabel(111, "推送")}</Button>]}>
<div className="vouchers-body">
<WeaTableEdit
@ -128,8 +132,13 @@ class Index extends Component {
showAdd={!pzlxEnum.includes(pzlx)} showDelete={!pzlxEnum.includes(pzlx)}
columns={columns} datas={datas} onChange={datas => this.setState({ datas })}
getRowSelection={rowSelection => !pzlxEnum.includes(pzlx) ? rowSelection : false}
tableProps={{ scroll: { y: `calc(100vh - 174.58px)` } }}
tableProps={{ scroll: { y: `calc(100vh - 190.58px)` } }}
/>
<div className="fixed-total-table">
<WeaTableEdit showCopy={false} showAdd={false} showDelete={false}
datas={totalData} tableProps={{ showHeader: false }}
columns={_.map(columns, o => ({ ...o, com: [{ key: o.column, type: "TEXT" }] }))}/>
</div>
</div>
</WeaTop>
);