From 4385b8c6b2d710fc6a3cc4973c3ee31cafe22473 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Mon, 2 Sep 2024 14:00:22 +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 | 7 +- pc4mobx/hrmSalary/pages/custom-pages/index.js | 4 +- .../lingyue/components/conditions.js | 25 ++++++- .../lingyue/components/generateDataDialog.js | 5 +- .../components/generateVouchersDialog.js | 74 +++++++++++++++++++ .../custom-pages/lingyue/components/list.js | 13 +++- .../pages/custom-pages/lingyue/index.less | 18 +++++ .../pages/custom-pages/lingyue/layout.js | 22 ++++-- .../lingyue/salarySummary/index.js | 11 ++- .../lingyue/socialFundSummary/index.js | 2 +- .../lingyue/vouncherSummary/index.js | 67 +++++++++++++++++ 11 files changed, 228 insertions(+), 20 deletions(-) create mode 100644 pc4mobx/hrmSalary/pages/custom-pages/lingyue/components/generateVouchersDialog.js create mode 100644 pc4mobx/hrmSalary/pages/custom-pages/lingyue/vouncherSummary/index.js diff --git a/pc4mobx/hrmSalary/apis/custom-apis/lingyue/index.js b/pc4mobx/hrmSalary/apis/custom-apis/lingyue/index.js index b86379c8..60422bf8 100644 --- a/pc4mobx/hrmSalary/apis/custom-apis/lingyue/index.js +++ b/pc4mobx/hrmSalary/apis/custom-apis/lingyue/index.js @@ -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); +}; diff --git a/pc4mobx/hrmSalary/pages/custom-pages/index.js b/pc4mobx/hrmSalary/pages/custom-pages/index.js index 7902a67b..e4767f84 100644 --- a/pc4mobx/hrmSalary/pages/custom-pages/index.js +++ b/pc4mobx/hrmSalary/pages/custom-pages/index.js @@ -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 = [ , + component={CustomSocialFundSummary}/>, + ]; export default CustomRoutes; diff --git a/pc4mobx/hrmSalary/pages/custom-pages/lingyue/components/conditions.js b/pc4mobx/hrmSalary/pages/custom-pages/lingyue/components/conditions.js index 6108129c..e9f99ec3 100644 --- a/pc4mobx/hrmSalary/pages/custom-pages/lingyue/components/conditions.js +++ b/pc4mobx/hrmSalary/pages/custom-pages/lingyue/components/conditions.js @@ -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 + } +]; diff --git a/pc4mobx/hrmSalary/pages/custom-pages/lingyue/components/generateDataDialog.js b/pc4mobx/hrmSalary/pages/custom-pages/lingyue/components/generateDataDialog.js index 3ce2cbd2..8fd2c024 100644 --- a/pc4mobx/hrmSalary/pages/custom-pages/lingyue/components/generateDataDialog.js +++ b/pc4mobx/hrmSalary/pages/custom-pages/lingyue/components/generateDataDialog.js @@ -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 => { diff --git a/pc4mobx/hrmSalary/pages/custom-pages/lingyue/components/generateVouchersDialog.js b/pc4mobx/hrmSalary/pages/custom-pages/lingyue/components/generateVouchersDialog.js new file mode 100644 index 00000000..f264865d --- /dev/null +++ b/pc4mobx/hrmSalary/pages/custom-pages/lingyue/components/generateVouchersDialog.js @@ -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 ( + {getLabel(111, "确定")} + ]} + > +
{getSearchs(form, conditions, 1, false)}
+
+ ); + } +} + +export default GenerateVouchersDialog; diff --git a/pc4mobx/hrmSalary/pages/custom-pages/lingyue/components/list.js b/pc4mobx/hrmSalary/pages/custom-pages/lingyue/components/list.js index 576155c5..922a44cf 100644 --- a/pc4mobx/hrmSalary/pages/custom-pages/lingyue/components/list.js +++ b/pc4mobx/hrmSalary/pages/custom-pages/lingyue/components/list.js @@ -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 { this.setState({ visible: false })} onSearch={this.getLYList}/> + this.setState({ + voucherDialog: { ...this.state.voucherDialog, visible: false } + })}/> ); } diff --git a/pc4mobx/hrmSalary/pages/custom-pages/lingyue/index.less b/pc4mobx/hrmSalary/pages/custom-pages/lingyue/index.less index d8d26268..e8c89c3e 100644 --- a/pc4mobx/hrmSalary/pages/custom-pages/lingyue/index.less +++ b/pc4mobx/hrmSalary/pages/custom-pages/lingyue/index.less @@ -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; + } + } +} diff --git a/pc4mobx/hrmSalary/pages/custom-pages/lingyue/layout.js b/pc4mobx/hrmSalary/pages/custom-pages/lingyue/layout.js index 24bd120c..523ae681 100644 --- a/pc4mobx/hrmSalary/pages/custom-pages/lingyue/layout.js +++ b/pc4mobx/hrmSalary/pages/custom-pages/lingyue/layout.js @@ -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 = [ , , - onChange({ ...query, salaryMonth: value, isQuery: !isQuery })}/>, - onChange({ ...query, ffgsqc: value })} - onSearch={() => onChange({ ...query, isQuery: !isQuery })}/> + + onChange({ ...query, salaryMonth: value, isQuery: !isQuery })}/> + , + + onChange({ ...query, ffgsqc: value })} + onSearch={() => onChange({ ...query, isQuery: !isQuery })}/> + ]; const dropMenuDatas = [ { key: "EXPORTALL", icon: , content: getLabel(81272, "导出全部") } ]; !salaryManager && (buttons = buttons.slice(2)); + lyAuth && buttons.unshift(); return ( } buttons={buttons} showDropIcon={salaryManager} + title={title} icon={} buttons={buttons} showDropIcon={true} iconBgcolor="#F14A2D" className="custom_salary_lingyue" dropMenuDatas={dropMenuDatas} onDropMenuClick={key => listRef.handleOperate(key)}>
{this.props.children}
diff --git a/pc4mobx/hrmSalary/pages/custom-pages/lingyue/salarySummary/index.js b/pc4mobx/hrmSalary/pages/custom-pages/lingyue/salarySummary/index.js index 16683ca9..a7cfe1e0 100644 --- a/pc4mobx/hrmSalary/pages/custom-pages/lingyue/salarySummary/index.js +++ b/pc4mobx/hrmSalary/pages/custom-pages/lingyue/salarySummary/index.js @@ -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 ( + listRef={this.listRef} isQuery={isQuery} lyAuth={lyAuth} ffgsqcLabel={getLabel(111, "发放公司全称")}> this.listRef = dom} onInit={() => this.forceUpdate()}/> diff --git a/pc4mobx/hrmSalary/pages/custom-pages/lingyue/socialFundSummary/index.js b/pc4mobx/hrmSalary/pages/custom-pages/lingyue/socialFundSummary/index.js index 84079dce..682c7c2a 100644 --- a/pc4mobx/hrmSalary/pages/custom-pages/lingyue/socialFundSummary/index.js +++ b/pc4mobx/hrmSalary/pages/custom-pages/lingyue/socialFundSummary/index.js @@ -30,7 +30,7 @@ class Index extends Component { const { query, isQuery } = this.state; return ( + listRef={this.listRef} isQuery={isQuery} ffgsqcLabel={getLabel(111, "购买公司全称")}> this.listRef = dom} onInit={() => this.forceUpdate()}/> diff --git a/pc4mobx/hrmSalary/pages/custom-pages/lingyue/vouncherSummary/index.js b/pc4mobx/hrmSalary/pages/custom-pages/lingyue/vouncherSummary/index.js new file mode 100644 index 00000000..c3df710c --- /dev/null +++ b/pc4mobx/hrmSalary/pages/custom-pages/lingyue/vouncherSummary/index.js @@ -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 ( + } buttons={[]} showDropIcon={false} + iconBgcolor="#F14A2D" className="custom_vouchers_lingyue"> +
+ this.tableEdit = el} showCopy={false} deleteConfirm + columns={columns} datas={datas} onChange={datas => this.setState({ datas })} + getRowSelection={() => false} tableProps={{ scroll: { y: `calc(100vh - 174.58px)` } }} + /> +
+
+ ); + } +} + +export default Index;