custom/领悦

This commit is contained in:
黎永顺 2024-09-02 14:00:22 +08:00
parent f843a8cc32
commit 4385b8c6b2
11 changed files with 228 additions and 20 deletions

View File

@ -13,6 +13,9 @@ export const getLYSalaryReportListSum = (params) => {
export const batchDeleteSalaryReport = (params) => {
return postFetch("/api/bs/hrmsalary/ly/salaryReport/batchDelete", params);
};
export const getLYPermission = (params) => {
return postFetch("/api/bs/hrmsalary/ly/salaryReport/lyPermission", params);
};
export const exportSalaryReport = (params) => {
return postExportFetch("/api/bs/hrmsalary/ly/salaryReport/export", params);
};
@ -31,4 +34,6 @@ export const batchDeleteSIReport = (params) => {
export const exportSIReport = (params) => {
return postExportFetch("/api/bs/hrmsalary/ly/socialReport/export", params);
};
export const genAndPreveiw = (params) => {
return postFetch("/api/bs/hrmsalary/ly/PZ/genAndPreveiw", params);
};

View File

@ -2,12 +2,14 @@ import React from "react";
import Route from "react-router/lib/Route";
import CustomSalarySummary from "./lingyue/salarySummary";
import CustomSocialFundSummary from "./lingyue/socialFundSummary";
import VouncherSummary from "./lingyue/vouncherSummary";
const CustomRoutes = [
<Route key="customPage_salarySummary_lingyue" path="customPage_salarySummary_lingyue"
component={CustomSalarySummary}/>,
<Route key="customPage_socailFundSummary_lingyue" path="customPage_socailFundSummary_lingyue"
component={CustomSocialFundSummary}/>
component={CustomSocialFundSummary}/>,
<Route key="customPage_vouchers_lingyue" path="customPage_vouchers_lingyue" component={VouncherSummary}/>
];
export default CustomRoutes;

View File

@ -1,11 +1,11 @@
export const conditions = [
export const dataConditions = [
{
items: [
{
colSpan: 1,
conditionType: "MONTHPICKER",
domkey: ["salaryMonth"],
fieldcol: 18,
fieldcol: 16,
label: "薪资所属月",
lanId: 111,
labelcol: 6,
@ -18,3 +18,24 @@ export const conditions = [
defaultshow: true
}
];
export const vouchersConditions = [
{
items: [
{
colSpan: 1,
conditionType: "SELECT",
domkey: ["pzlx"],
fieldcol: 16,
label: "凭证类型",
lanId: 111,
labelcol: 6,
rules: "required|string",
options: [],
value: "",
viewAttr: 3
}
],
title: "",
defaultshow: true
}
];

View File

@ -13,7 +13,7 @@ import { WeaDialog, WeaLocaleProvider } from "ecCom";
import { Button, message } from "antd";
import { getSearchs } from "../../../../util";
import * as API from "../../../../apis/custom-apis/lingyue";
import { conditions } from "./conditions";
import { dataConditions } from "./conditions";
const getLabel = WeaLocaleProvider.getLabel;
const APIFOX = {
@ -38,7 +38,7 @@ class GenerateDataDialog extends Component {
initLYForm = () => {
this.setState({
conditions: _.map(conditions, item => ({
conditions: _.map(dataConditions, item => ({
...item, items: _.map(item.items, o => ({ ...o, label: getLabel(o.lanId, o.label) }))
}))
}, () => {
@ -46,7 +46,6 @@ class GenerateDataDialog extends Component {
form.initFormFields(this.state.conditions);
});
};
save = () => {
const { LYStore: { form }, type, onSearch } = this.props;
form.validateForm().then(f => {

View File

@ -0,0 +1,74 @@
import React, { Component } from "react";
import { inject, observer } from "mobx-react";
import { WeaDialog, WeaLocaleProvider } from "ecCom";
import { Button } from "antd";
import { vouchersConditions } from "./conditions";
import { commonEnumList } from "../../../../apis/ruleconfig";
import { getSearchs } from "../../../../util";
import { convertToUrlString } from "../../../../util/url";
import "../index.less";
const getLabel = WeaLocaleProvider.getLabel;
@inject("LYStore")
@observer
class GenerateVouchersDialog extends Component {
constructor(props) {
super(props);
this.state = {
loading: false, conditions: []
};
}
componentWillReceiveProps(nextProps, nextContext) {
if (nextProps.visible !== this.props.visible && nextProps.visible) this.initLYForm();
if (nextProps.visible !== this.props.visible && !nextProps.visible) nextProps.LYStore.initForm();
}
initLYForm = () => {
commonEnumList({ enumClass: "com.engine.salary.enums.ly.LyPZTypeEnum" })
.then(({ status, data }) => {
if (status) {
this.setState({
conditions: _.map(vouchersConditions, item => ({
...item, items: _.map(item.items, o => ({
...o, label: getLabel(o.lanId, o.label),
options: _.map(data, item => ({ key: String(item.value), showname: item.defaultLabel }))
}))
}))
}, () => {
const { LYStore: { form } } = this.props;
form.initFormFields(this.state.conditions);
});
}
});
};
save = () => {
const { LYStore: { form }, ffgsqc, salaryMonth } = this.props;
const payload = { ...form.getFormParams(), ffgsqc, salaryMonth };
form.validateForm().then(f => {
if (f.isValid) {
window.open(`/spa/hrmSalary/static/index.html#/main/hrmSalary/customPage_vouchers_lingyue?${convertToUrlString(payload)}`, "_blank");
} else {
f.showErrors();
}
}).catch(() => this.setState({ loading: false }));
};
render() {
const { conditions, loading } = this.state;
const { LYStore: { form } } = this.props;
return (
<WeaDialog
{...this.props} style={{ width: 480, height: 80 }} initLoadCss title={getLabel(111, "生成并预览凭证")}
buttons={[
<Button type="primary" onClick={this.save} loading={loading}>{getLabel(111, "确定")}</Button>
]}
>
<div className="form-dialog-layout">{getSearchs(form, conditions, 1, false)}</div>
</WeaDialog>
);
}
}
export default GenerateVouchersDialog;

View File

@ -12,6 +12,7 @@ import { WeaLoadingGlobal, WeaLocaleProvider } from "ecCom";
import { message, Modal, Spin } from "antd";
import * as API from "../../../../apis/custom-apis/lingyue";
import GenerateDataDialog from "./generateDataDialog";
import GenerateVouchersDialog from "./generateVouchersDialog";
const getLabel = WeaLocaleProvider.getLabel;
const interfaceType = {
@ -34,7 +35,8 @@ class List extends Component {
super(props);
this.state = {
dataSource: [], columns: [], pageInfo: { current: 1, pageSize: 10, total: 0 }, loading: false,
selectedRowKeys: [], sumDataSource: {}, payload: {}, visible: false
selectedRowKeys: [], sumDataSource: {}, payload: {}, visible: false,
voucherDialog: { visible: false }
};
this.handleDebounce = null;
}
@ -94,6 +96,7 @@ class List extends Component {
const { list: dataSource, pageNum: current, pageSize, total } = result;
this.setState({
pageInfo: { ...pageInfo, current, pageSize, total },
voucherDialog: { ...this.state.voucherDialog, ...query },
dataSource, columns, sumDataSource, payload
}, () => {
onInit();
@ -113,6 +116,9 @@ class List extends Component {
case "GENERATE":
this.setState({ visible: true });
break;
case "GENERATEVOUCHER":
this.setState({ voucherDialog: { ...this.state.voucherDialog, visible: true } });
break;
case "EXPORTALL":
WeaLoadingGlobal.start();
const promise = interfaceType[type]["export"](payload);
@ -142,7 +148,7 @@ class List extends Component {
};
render() {
const { loading, dataSource, visible } = this.state;
const { loading, dataSource, visible, voucherDialog } = this.state;
const { type } = this.props;
const dom = document.querySelector(".wea-new-top-content");
let height = 307.53;
@ -161,6 +167,9 @@ class List extends Component {
</Spin>
<GenerateDataDialog type={type} visible={visible} onCancel={() => this.setState({ visible: false })}
onSearch={this.getLYList}/>
<GenerateVouchersDialog {...voucherDialog} onCancel={() => this.setState({
voucherDialog: { ...this.state.voucherDialog, visible: false }
})}/>
</div>
);
}

View File

@ -4,6 +4,10 @@
height: 30px;
line-height: 0;
}
.wea-form-item {
min-width: 250px;
}
}
.lingyue-body {
@ -18,3 +22,17 @@
}
}
}
//凭证汇总表
.custom_vouchers_lingyue {
.vouchers-body {
height: 100%;
padding: 16px 16px 0 16px;
background: #F6F6F6;
overflow-y: hidden;
.wea-table-edit {
background: #FFF;
}
}
}

View File

@ -9,7 +9,7 @@
*/
import React, { Component } from "react";
import { inject, observer } from "mobx-react";
import { WeaDatePicker, WeaInputSearch, WeaLocaleProvider, WeaTop } from "ecCom";
import { WeaDatePicker, WeaFormItem, WeaInputSearch, WeaLocaleProvider, WeaTop } from "ecCom";
import { Button } from "antd";
import "./index.less";
@ -19,23 +19,31 @@ const getLabel = WeaLocaleProvider.getLabel;
@observer
class Layout extends Component {
render() {
const { title, query, onChange, listRef, isQuery, taxAgentStore: { salaryManager } } = this.props;
const {
title, query, onChange, listRef, isQuery, lyAuth = false, ffgsqcLabel, taxAgentStore: { salaryManager }
} = this.props;
const { salaryMonth, ffgsqc } = query;
let buttons = [
<Button type="primary" onClick={() => listRef.handleOperate("GENERATE")}>{getLabel(111, "生成数据")}</Button>,
<Button type="ghost" onClick={() => listRef.handleOperate("BATCHDEL")}>{getLabel(111, "批量删除")}</Button>,
<WeaDatePicker format="YYYY-MM" value={salaryMonth}
onChange={value => onChange({ ...query, salaryMonth: value, isQuery: !isQuery })}/>,
<WeaInputSearch value={ffgsqc} onChange={value => onChange({ ...query, ffgsqc: value })}
onSearch={() => onChange({ ...query, isQuery: !isQuery })}/>
<WeaFormItem label={getLabel(111, "薪资所属月")} labelCol={{ span: 8 }} wrapperCol={{ span: 16 }}>
<WeaDatePicker format="YYYY-MM" value={salaryMonth}
onChange={value => onChange({ ...query, salaryMonth: value, isQuery: !isQuery })}/>
</WeaFormItem>,
<WeaFormItem label={ffgsqcLabel} labelCol={{ span: 8 }} wrapperCol={{ span: 16 }}>
<WeaInputSearch value={ffgsqc} onChange={value => onChange({ ...query, ffgsqc: value })}
onSearch={() => onChange({ ...query, isQuery: !isQuery })}/>
</WeaFormItem>
];
const dropMenuDatas = [
{ key: "EXPORTALL", icon: <i className="iconfont icon-daochu"/>, content: getLabel(81272, "导出全部") }
];
!salaryManager && (buttons = buttons.slice(2));
lyAuth && buttons.unshift(<Button type="primary"
onClick={() => listRef.handleOperate("GENERATEVOUCHER")}>{getLabel(111, "生成并预览凭证")}</Button>);
return (
<WeaTop
title={title} icon={<i className="icon-coms-fa"/>} buttons={buttons} showDropIcon={salaryManager}
title={title} icon={<i className="icon-coms-fa"/>} buttons={buttons} showDropIcon={true}
iconBgcolor="#F14A2D" className="custom_salary_lingyue" dropMenuDatas={dropMenuDatas}
onDropMenuClick={key => listRef.handleOperate(key)}>
<div className="lingyue-body">{this.props.children}</div>

View File

@ -12,6 +12,7 @@ import { WeaLocaleProvider } from "ecCom";
import moment from "moment";
import Layout from "../layout";
import List from "../components/list";
import * as API from "../../../../apis/custom-apis/lingyue";
const getLabel = WeaLocaleProvider.getLabel;
@ -19,19 +20,23 @@ class Index extends Component {
constructor(props) {
super(props);
this.state = {
query: { salaryMonth: moment().format("YYYY-MM"), ffgsqc: "" }, isQuery: false
query: { salaryMonth: moment().format("YYYY-MM"), ffgsqc: "" }, isQuery: false, lyAuth: false
};
this.listRef = null;
}
componentDidMount() {
API.getLYPermission().then(({ status, data }) => this.setState({ lyAuth: !!status && !!data }));
}
handleLayoutChange = ({ isQuery, ...val }) => this.setState({ query: { ...this.state.query, ...val } },
() => this.setState({ isQuery }));
render() {
const { query, isQuery } = this.state;
const { query, isQuery, lyAuth } = this.state;
return (
<Layout title={getLabel(111, "薪资汇总表")} query={query} onChange={this.handleLayoutChange}
listRef={this.listRef} isQuery={isQuery}>
listRef={this.listRef} isQuery={isQuery} lyAuth={lyAuth} ffgsqcLabel={getLabel(111, "发放公司全称")}>
<List query={query} isQuery={isQuery} type="salarySum" ref={dom => this.listRef = dom}
onInit={() => this.forceUpdate()}/>
</Layout>

View File

@ -30,7 +30,7 @@ class Index extends Component {
const { query, isQuery } = this.state;
return (
<Layout title={getLabel(111, "社保公积金汇总表")} query={query} onChange={this.handleLayoutChange}
listRef={this.listRef} isQuery={isQuery}>
listRef={this.listRef} isQuery={isQuery} ffgsqcLabel={getLabel(111, "购买公司全称")}>
<List query={query} isQuery={isQuery} type="socialFundSum" ref={dom => this.listRef = dom}
onInit={() => this.forceUpdate()}/>
</Layout>

View File

@ -0,0 +1,67 @@
/*
* 凭证汇总表
*
* @Author: 黎永顺
* @Date: 2024/8/30
* @Wechat:
* @Email: 971387674@qq.com
* @description:
*/
import React, { Component } from "react";
import { WeaLocaleProvider, WeaTableEdit, WeaTop } from "ecCom";
import * as API from "../../../../apis/custom-apis/lingyue";
import { getURLParameters } from "../../../../util/url";
const getLabel = WeaLocaleProvider.getLabel;
class Index extends Component {
constructor(props) {
super(props);
this.state = {
datas: [], columns: []
};
}
componentDidMount() {
this.genAndPreveiw();
}
genAndPreveiw = () => {
this.setState({ loading: true });
const payload = { ...getURLParameters(window.location.hash) };
API.genAndPreveiw(payload).then(({ status, data }) => {
this.setState({ loading: false });
if (status) {
const { columns, data: datas } = data;
this.setState({
datas, columns: columns.map(col => ({
title: col.text, dataIndex: col.column, key: col.column, width: col.width,
com: [
{ label: "", type: "INPUT", viewAttr: 1, key: col.column }
],
colSpan: 1
}))
});
}
});
};
render() {
const { datas, columns } = this.state;
return (
<WeaTop
title={getLabel(111, "凭证汇总表")} icon={<i className="icon-coms-fa"/>} buttons={[]} showDropIcon={false}
iconBgcolor="#F14A2D" className="custom_vouchers_lingyue">
<div className="vouchers-body">
<WeaTableEdit
ref={el => this.tableEdit = el} showCopy={false} deleteConfirm
columns={columns} datas={datas} onChange={datas => this.setState({ datas })}
getRowSelection={() => false} tableProps={{ scroll: { y: `calc(100vh - 174.58px)` } }}
/>
</div>
</WeaTop>
);
}
}
export default Index;