diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/addItems.js b/pc4mobx/hrmSalary/pages/dataAcquisition/addItems.js
index 6ce5d59d..07dcad4d 100644
--- a/pc4mobx/hrmSalary/pages/dataAcquisition/addItems.js
+++ b/pc4mobx/hrmSalary/pages/dataAcquisition/addItems.js
@@ -26,11 +26,12 @@ class AddItems extends Component {
}
};
}
+
componentDidMount() {
this.setState({
baseInfo: {
...this.state.baseInfo,
- declareMonth: this.props.editId.declareMonth,
+ declareMonth: this.props.editId.declareMonth || this.props.editId.taxYearMonth,
taxAgentId: this.props.editId.taxAgentId,
taxAgentName: this.props.editId.taxAgentName,
employeeId: this.props.editId.employeeId,
@@ -46,12 +47,13 @@ class AddItems extends Component {
});
});
}
+
componentWillReceiveProps(nextProps, nextContext) {
if (nextProps.editId !== this.props.editId) {
this.setState({
baseInfo: {
...this.state.baseInfo,
- declareMonth: nextProps.editId.declareMonth,
+ declareMonth: nextProps.editId.declareMonth || nextProps.editId.taxYearMonth,
taxAgentId: nextProps.editId.taxAgentId,
taxAgentName: nextProps.editId.taxAgentName,
employeeId: nextProps.editId.employeeId,
diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/components/tableRecord.js b/pc4mobx/hrmSalary/pages/dataAcquisition/components/tableRecord.js
index bd6007b8..616a36f0 100644
--- a/pc4mobx/hrmSalary/pages/dataAcquisition/components/tableRecord.js
+++ b/pc4mobx/hrmSalary/pages/dataAcquisition/components/tableRecord.js
@@ -30,21 +30,45 @@ class TableRecord extends Component {
accumulatedSituationId: "",
specialAddDeductionId: "",
taxAgentId: "",
- declareMonth: []
+ declareMonth: null,
+ taxYearMonth: null
}
};
}
componentDidMount() {
- this.getTableRecordData();
+ this.convertData(this.props);
}
- getTableRecordData = (payload) => {
- const { loading, pageInfo } = this.state;
- const { url, ...extraPayload } = this.props;
- const module = { ...pageInfo, url, ...extraPayload, ...payload };
+ componentWillReceiveProps(nextProps, nextContext) {
+ this.convertData(nextProps);
+ }
+
+ convertData = (props) => {
+ const { recordPayload } = this.state;
+ const { record, screenParams } = props;
+ const modules = _.reduce(screenParams, (pre, cur) => (_.assign(pre, {
+ [cur]: record[cur],
+ [screenParams[0]]: record.id
+ })), {});
+ this.setState({
+ recordPayload: {
+ ...recordPayload,
+ ...modules
+ }
+ }, () => this.getTableRecordData());
+ };
+
+ getTableRecordData = () => {
+ const { loading, pageInfo, recordPayload } = this.state;
+ const { url, screenParams } = this.props;
+ const monthkey = screenParams[screenParams.length - 1];
+ const module = {
+ ...pageInfo, ...recordPayload, url,
+ [monthkey]: Object.prototype.toString.call(recordPayload[monthkey]) === "[object Array]" ? _.compact(recordPayload[monthkey]) : recordPayload[monthkey]
+ };
this.setState({ loading: { ...loading, query: true } });
- getTableRecordDate(_.omit(module, ["className", "items", "total"])).then(({ status, data }) => {
+ getTableRecordDate(_.pick(module, [...screenParams, "current", "pageSize", "url"])).then(({ status, data }) => {
this.setState({ loading: { ...loading, query: false } });
if (status) {
const { columns, list: dataSource, pageNum: current, pageSize, total } = data;
@@ -65,17 +89,30 @@ class TableRecord extends Component {
*/
handleTablerecordScreen = ({ key, value }) => {
const { recordPayload } = this.state;
- // this.setState({
- // recordPayload: {
- // ...recordPayload,
- // [key]: value
- // }
- // }, () => {
- // this.tableRecordRef.getTableRecordData(this.state.recordPayload);
- // });
+ this.setState({
+ recordPayload: {
+ ...recordPayload,
+ [key]: value
+ }
+ }, () => this.getTableRecordData());
};
+ handleResetSelectKeys = () => {
+ this.setState({
+ selectedRowKeys: [],
+ recordPayload: {
+ accumulatedSpecialAdditionalDeductionId: "",
+ otherTaxExemptDeductionId: "",
+ accumulatedSituationId: "",
+ specialAddDeductionId: "",
+ taxAgentId: "",
+ declareMonth: null,
+ taxYearMonth: null
+ }
+ });
+ };
+
render() {
- const { className, screenParams, taxAgentOption } = this.props;
+ const { className, screenParams, taxAgentOption, record } = this.props;
const { columns, dataSource, loading, selectedRowKeys, pageInfo, recordPayload } = this.state;
const rowSelection = {
selectedRowKeys,
@@ -102,16 +139,20 @@ class TableRecord extends Component {
});
}
};
- const items = [
+ const items = screenParams.length === 1 ? [
{
- com: Input({ value: editId.username })
+ com: Input({ value: record.username })
+ }
+ ] : [
+ {
+ com: Input({ value: record.username })
},
{
com: DataCollectionDateRangePick({
label: "税款所属期",
- range: recordPayload.declareMonth,
+ range: recordPayload[screenParams[screenParams.length - 1]] || [],
onChange: this.handleTablerecordScreen,
- key: "declareMonth"
+ key: screenParams[screenParams.length - 1]
})
},
{
@@ -126,7 +167,10 @@ class TableRecord extends Component {
];
return (
-
+ {
+ !_.isEmpty(screenParams) &&
+
+ }
diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js
index 7665c194..7999bc35 100644
--- a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js
+++ b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js
@@ -272,7 +272,7 @@ class Index extends Component {
/*
* Author: 黎永顺
* Description:新增数据采集-累计专项附加扣除
- * Params:
+ * Params: screenParams规则:日期必须放在数组最后一位,人员信息必须第一位
* Date: 2023/2/20
*/
handleAddData = (title = "新建", editId = {}) => {
@@ -299,6 +299,7 @@ class Index extends Component {
className="accumulated"
taxAgentOption={taxAgentOption}
url="/api/bs/hrmsalary/addUpDeduction/getDetailList"
+ record={editId}
screenParams={["accumulatedSpecialAdditionalDeductionId", "taxAgentId", "declareMonth"]}
/>
}
@@ -327,6 +328,8 @@ class Index extends Component {
data: {}
}
});
+ this.tableRecordRef && this.tableRecordRef.handleResetSelectKeys();
+ this.handleDebounce = null;
};
/*
* Author: 黎永顺
@@ -401,20 +404,47 @@ class Index extends Component {
*/
getDetailOptBtns = () => {
return [
-
- 导出选中
-
- }
- type="primary">
+
+ 导出选中
+ }
+ type="primary">
导出全部
];
};
+ /*
+ * Author: 黎永顺
+ * Description: 导出详情数据
+ * Params:
+ * Date: 2023/2/21
+ */
+ handleExportDetail = (url) => {
+ if (!this.handleDebounce) {
+ this.handleDebounce = _.debounce(() => {
+ window.open(`${window.location.origin}/api/bs/hrmsalary/addUpDeduction/exportDetail${url}`, "_self");
+ this.handleDebounce = null;
+ }, 500);
+ }
+ this.handleDebounce();
+ };
+ handleExportSelectDetail = () => {
+ const { selectedRowKeys: ids, recordPayload } = this.tableRecordRef.state;
+ if (ids.length === 0) {
+ message.warning("请选择需要导出的数据");
+ return;
+ }
+ const exportParams = _.reduce(_.keys(_.omitBy(recordPayload, it => !it)), (pre, cur) => pre + `&${cur}=${recordPayload[cur]}`, "");
+ const payload = `?${exportParams}&ids=${ids.join(",")}`;
+ this.handleExportDetail(payload);
+ };
+ handleExportAllDetail = () => {
+ const { recordPayload } = this.tableRecordRef.state;
+ const exportParams = _.reduce(_.keys(_.omitBy(recordPayload, it => !it)), (pre, cur) => pre + `&${cur}=${recordPayload[cur]}`, "");
+ const payload = `?${exportParams}&ids=`;
+ this.handleExportDetail(payload);
+ };
/*
* Author: 黎永顺
* Description: 数据采集-导入相关
@@ -494,18 +524,22 @@ class Index extends Component {
export default Index;
export const DataCollectionDatePicker = (props) => {
- const { value, label, onChange, format = "YYYY-MM", key, screen = true } = props;
- return
+ const {
+ value, label, onChange, format = "YYYY-MM", key, screen = true,
+ tip = "提示:默认显示本年截至当前月所有员工申报的累计专项附加及其他扣除额",
+ labelCol = 8, wrapperCol = 16
+ } = props;
+ return
onChange({ key, value: val })} format={format}/>
{
screen &&
-
+
}
;
};
export const DataCollectionSelect = (props) => {
- const { value, label, onChange, options, key } = props;
- return
+ const { value, label, onChange, options, key, labelCol = 10, wrapperCol = 14 } = props;
+ return
onChange({ key, value: val })} options={options}/>
;
};
@@ -518,8 +552,18 @@ export const DataCollectionDateRangePick = (props) => {
const { range, label, onChange, format = "YYYY-MM", key } = props;
const [value1 = "", value2 = ""] = range;
return
- onChange({ key, value: [val, value2] })} format={format}/>
+ onChange({ key, value: [val, value2] })} format={format}
+ disabledDate={(current) => {
+ return current && value2 && current.getTime() > new Date(value2).getTime();
+ }}
+ />
至
- onChange({ key, value: [value1, val] })} format={format}/>
+ onChange({ key, value: [value1, val] })} format={format}
+ disabledDate={(current) => {
+ return current && value1 && current.getTime() < new Date(value1).getTime();
+ }}
+ />
;
};
diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/columns.js b/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/columns.js
index 45fab4e4..689db6a4 100644
--- a/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/columns.js
+++ b/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/columns.js
@@ -65,133 +65,6 @@ export const columns = [
key: "title"
}
];
-
-export const modalColumns = [
- {
- title: "姓名",
- dataIndex: "username",
- key: "username"
- },
- {
- title: "个税扣缴义务人",
- dataIndex: "taxAgentName",
- key: "taxAgentName"
- },
- {
- title: "部门",
- dataIndex: "departmentName",
- key: "departmentName"
- },
- {
- title: "手机号",
- dataIndex: "mobile",
- key: "mobile"
- },
- {
- title: "工号",
- dataIndex: "jobNum",
- key: "jobNum"
- },
- {
- title: "证件号码",
- dataIndex: "idNo",
- key: "idNo"
- },
- {
- title: "入职日期",
- dataIndex: "hiredate",
- key: "hiredate"
- },
- {
- title: "累计收入额",
- dataIndex: "addUpIncome",
- key: "addUpIncome"
- },
- {
- title: "累计减除费用",
- dataIndex: "addUpSubtraction",
- key: "addUpSubtraction"
- },
- {
- title: "累计社保个人合计",
- dataIndex: "addUpSocialSecurityTotal",
- key: "addUpSocialSecurityTotal"
- },
- {
- title: "累计公积金个人合计",
- dataIndex: "addUpAccumulationFundTotal",
- key: "addUpAccumulationFundTotal"
- },
- {
- title: "累计子女教育",
- dataIndex: "addUpChildEducation",
- key: "addUpChildEducation"
- },
- {
- title: "累计继续教育",
- dataIndex: "addUpContinuingEducation",
- key: "addUpContinuingEducation"
- },
- {
- title: "累计住房贷款利息",
- dataIndex: "addUpHousingLoanInterest",
- key: "addUpHousingLoanInterest"
- },
- {
- title: "累计住房租金",
- dataIndex: "addUpHousingRent",
- key: "addUpHousingRent"
- },
- {
- title: "累计赡养老人",
- dataIndex: "addUpSupportElderly",
- key: "addUpSupportElderly"
- },
- {
- title: "累计企业(职业)年金及其他福利",
- dataIndex: "addUpEnterpriseAndOther",
- key: "addUpEnterpriseAndOther"
- },
- {
- title: "累计其他免税扣除",
- dataIndex: "addUpOtherDeduction",
- key: "addUpOtherDeduction"
- },
- {
- title: "累计免税收入",
- dataIndex: "addUpTaxExemptIncome",
- key: "addUpTaxExemptIncome"
- },
- {
- title: "累计准予扣除的捐赠额",
- dataIndex: "addUpAllowedDonation",
- key: "addUpAllowedDonation"
- },
- {
- title: "累计减免税额",
- dataIndex: "addUpTaxSavings",
- key: "addUpTaxSavings"
- },
- {
- title: "累计已预扣预缴税额",
- dataIndex: "addUpAdvanceTax",
- key: "addUpAdvanceTax"
- },
- {
- title: "累计婴幼儿照护",
- dataIndex: "addUpInfantCare",
- key: "addUpInfantCare"
- },
- {
- title: "累计大病医疗",
- dataIndex: "addUpIllnessMedical",
- key: "addUpIllnessMedical"
- }
-
-];
-
-export const dataSource = [];
-
export const dataCollectCondition = [
{
items: [
@@ -353,11 +226,10 @@ export const dataCollectCondition = [
defaultshow: true
}
];
-
export const taxOptions = [
{
key: "01",
- showname: "一月",
+ showname: "一月"
},
{
key: "02",
@@ -402,5 +274,5 @@ export const taxOptions = [
{
key: "12",
showname: "十二月"
- },
+ }
];
diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/editSlideContent.js b/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/editSlideContent.js
deleted file mode 100644
index 4ef993a4..00000000
--- a/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/editSlideContent.js
+++ /dev/null
@@ -1,201 +0,0 @@
-import React from "react";
-import { Col, DatePicker, Row } from "antd";
-import { inject, observer } from "mobx-react";
-import { WeaTable } from "ecCom";
-import "./editSlideContent.less";
-import moment from "moment";
-
-const { MonthPicker } = DatePicker;
-
-let emptyItem = {
- incomeLowerLimit: "0.00",
- incomeUpperLimit: "0.00",
- dutyFreeValue: "0.00",
- dutyFreeRate: "0.00",
- taxableIncomeLl: "0.00",
- taxableIncomeUl: "0.00",
- taxRate: "0.00",
- taxDeduction: "0.00"
-};
-
-@inject("cumSituationStore", "taxAgentStore")
-@observer
-export default class EditSlideContent extends React.Component {
- constructor(props) {
- super(props);
- this.state = {
- taxAgentId: "",
- startDate: "",
- endDate: "",
- editable:
- this.props.editable === undefined ? "true" : this.props.editable
- };
- }
-
- componentWillMount() {
- // 初始化渲染页面
- const {
- taxAgentStore: { fetchTaxAgentOption }
- } = this.props;
- fetchTaxAgentOption();
- }
-
- addItem() {
- const {
- taxRateStore: { setDataSource }
- } = this.props;
- let dataSource = [...this.props.taxRateStore.dataSource];
- let indexNum = 1;
- if (dataSource.length > 0) {
- indexNum = dataSource[dataSource.length - 1].indexNum + 1;
- }
- let item = { ...emptyItem };
- item.indexNum = indexNum;
- dataSource.push(item);
- setDataSource(dataSource);
- }
-
- fetchCumDeductDetailList(param) {
- const { cumSituationStore } = this.props;
- const { getCumDeductDetailList, currentRecord } = cumSituationStore;
- getCumDeductDetailList(currentRecord.id, param);
- }
-
- // 日期格式变化加载数据
- handleFetchCumDeductDetailList(startDate, endDate, taxAgentId) {
- let declareMonth = [];
- if (startDate != "" && startDate != undefined) {
- declareMonth.push(startDate);
- }
-
- if (endDate != "" && endDate != undefined) {
- declareMonth.push(endDate);
- }
- let item = {
- taxAgentId: taxAgentId
- };
- if (declareMonth.length != 0) {
- item.taxYearMonth = declareMonth;
- }
- this.fetchCumDeductDetailList(item);
- }
-
- onSelectChange = (val) => {
- const { onChangeSlideSelectKey } = this.props;
- onChangeSlideSelectKey && onChangeSlideSelectKey(val);
- };
-
- render() {
- const { cumSituationStore } = this.props;
- const { startDate, endDate, taxAgentId } = this.state;
- const {
- getCumDeductDetailList,
- currentRecord,
- slideColumns,
- slidePageObj,
- slideTableDataSource,
- setSlidePageObj,
- slideLoading
- } = cumSituationStore;
- const declareMonth = [startDate, endDate];
-
- const pagination = {
- current: slidePageObj.current,
- pageSize: slidePageObj.pageSize,
- total: slidePageObj.total,
- showTotal: (total) => `共 ${total} 条`,
- showSizeChanger: true,
- onShowSizeChange(current, pageSize) {
- setSlidePageObj({ ...slidePageObj, current, pageSize });
- getCumDeductDetailList(currentRecord.id, {
- ...slidePageObj,
- current,
- pageSize,taxAgentId:currentRecord.taxAgentId,
- declareMonth: _.filter(declareMonth, item => item)
- });
- },
- onChange(current) {
- setSlidePageObj({
- ...slidePageObj,
- current,taxAgentId:currentRecord.taxAgentId,
- pageSize: slidePageObj.pageSize
- });
- getCumDeductDetailList(currentRecord.id, {
- ...slidePageObj,
- current,
- pageSize,
- declareMonth: _.filter(declareMonth, item => item)
- });
- }
- };
- const newColumns = _.map([...slideColumns], (item) => ({ ...item }));
- const rowSelection = {
- selectedRowKeys: this.props.slideSelectedKey,
- onChange: this.onSelectChange
- };
- return (
-
-
-
- {currentRecord.username}
-
-
- 申报月份
-
-
- {
- let startDate = "";
- if (v != "" && v != undefined) {
- startDate = moment(v).format("YYYY-MM");
- }
- this.setState({ startDate });
- this.handleFetchCumDeductDetailList(
- startDate,
- endDate,
- taxAgentId
- );
- }}
- />
-
-
至
-
- {
- let endDate = "";
- if (v != "" && v != undefined) {
- endDate = moment(v).format("YYYY-MM");
- }
- this.setState({ endDate });
- this.handleFetchCumDeductDetailList(
- startDate,
- endDate,
- currentRecord.taxAgentId
- );
- }}
- />
-
-
-
-
-
-
-
-
-
- );
- }
-}
diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/editSlideContent.less b/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/editSlideContent.less
deleted file mode 100644
index 14f22326..00000000
--- a/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/editSlideContent.less
+++ /dev/null
@@ -1,22 +0,0 @@
-.cumDeductSlide {
- .topLabelBar {
- padding: 10px 20px;
- height: 40px;
- line-height: 40px;
- margin-bottom: 10px;
- }
- .formLabel {
- margin-right: 10px;
- }
- .weaRangePickerWrapper {
- display: inline-block;
- .monthPickerWrapper {
- width: 100px;
- display: inline-block;
- }
- .betweenLable {
- margin-left: 10px;
- margin-right: 10px;
- }
- }
-}
\ No newline at end of file
diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/index.js
index ac2b13e8..d49ff237 100644
--- a/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/index.js
+++ b/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/index.js
@@ -1,789 +1,532 @@
-import React from "react";
+/*
+ * Author: 黎永顺
+ * name:往期累计情况(工资、薪金)
+ * Description:
+ * Date: 2023/2/21
+ */
+import React, { Component } from "react";
import { inject, observer } from "mobx-react";
-import { toJS } from "mobx";
-import { Button, Col, Dropdown, Menu, message, Modal, Popover, Row } from "antd";
-import { WeaDatePicker, WeaHelpfulTip, WeaNewScroll, WeaSelect, WeaSlideModal, WeaTab, WeaTable, WeaTop } from "ecCom";
+import { WeaSearchGroup } from "ecCom";
+import { Button, Dropdown, Menu, message, Modal } from "antd";
+import {
+ createAddUpSituation,
+ deleteAllAddUpSituation,
+ deleteSelectAddUpSituation,
+ editAddUpSituation,
+ getAddUpSituation,
+ getCumSituationSaCondition,
+ importCumSituationParam,
+ importCumSituationPreview
+} from "../../../apis/cumSituation";
+import { removePropertyCondition } from "../../../util/response";
+import DataTables from "../dataTables";
+import Layout from "../layout";
+import ImportFormCom from "../cumDeduct/components/importFormCom";
+import { DataCollectionDatePicker, DataCollectionSelect } from "../cumDeduct";
import moment from "moment";
-import { getSearchs, renderLoading } from "../../../util"; // 渲染form数据的方法:因为多个页面都会使用,所以抽的公共方法在util中
-import ImportModal from "../../../components/importModal";
-import { dataCollectCondition, modalColumns, taxOptions } from "./columns";
-import { optionAddAll } from "../../../util/options";
-import SlideModalTitle from "../../../components/slideModalTitle";
-import EditSlideContent from "./editSlideContent";
+import { dataCollectCondition, taxOptions } from "./columns";
import AddItems from "../addItems";
-import * as API from "../../../apis/cumSituation";
-import "./index.less";
+import TableRecord from "../components/tableRecord";
-@inject("cumSituationStore", "taxAgentStore")
+@inject("taxAgentStore", "cumSituationStore")
@observer
-export default class CumSituation extends React.Component {
+class Index extends Component {
constructor(props) {
super(props);
this.state = {
- saveLoading: false,
- addVisible: false,
- editId: {},
- value: "",
- selectedKey: [],
- slideSelectedKey: [], //详情表格的选中项
- visiable: false,
- inited: false,
- monthValue: moment(new Date()).format("YYYY"),
- taxYearMonth: moment(new Date()).month() + 1 > 10 ? (moment(new Date()).month() + 1) + "" : "0" + (moment(new Date()).month() + 1),
- taxAgentId: "All",
- modalParam: {
- taxYearMonth: ""
- }
- };
- }
-
- componentWillMount() {
- // 初始化渲染页面
- const {
- cumSituationStore: { doInit, addForm },
- taxAgentStore: { fetchTaxAgentOption }
- } = this.props;
- addForm.initFormFields(dataCollectCondition);
- doInit({
- year: this.state.monthValue,
+ year: moment(new Date()).format("YYYY"),
+ declareMonth: moment(new Date()).month() + 1 > 10 ? (moment(new Date()).month() + 1) + "" : "0" + (moment(new Date()).month() + 1),
taxAgentId: "",
- taxYearMonth: this.state.monthValue + "-" + this.state.taxYearMonth
- });
- fetchTaxAgentOption().then(() => {
- this.setState({
- inited: true
- });
- });
+ innerWidth: window.innerWidth,
+ addAllLoading: false,
+ saveLoading: false,
+ slidePayload: {
+ visible: false,
+ title: "",
+ children: null,
+ data: {}
+ },
+ importPayload: {
+ visible: false,
+ importOpts: {
+ declareMonth: moment(new Date()).format("YYYY-MM")
+ },
+ importFormComponent: null,
+ step: 0,
+ importResult: {},
+ slideDataSource: []
+ },
+ exportPayloadUrl: "",
+ advanceCondition: null
+ };
+ this.tableRef = null;
+ this.addItemRef = null;
+ this.tableRecordRef = null;
}
- getSearchsAdQuick() {
- const { monthValue, taxAgentId, taxYearMonth } = this.state;
- const {
- taxAgentStore: { taxAgentOption },
- cumSituationStore: { form, getTableDatas }
- } = this.props;
- return (
-
-
- 纳税年度:
- {
- this.setState({ monthValue: c, taxYearMonth: "01" });
- let params = {};
- if (taxAgentId == "All") {
- params.taxAgentId = "";
- } else {
- params.taxAgentId = taxAgentId;
- }
- if (c != null && c !== "") {
- params.year = c;
- }
- getTableDatas({ ...params, taxYearMonth: c + "-" + taxYearMonth });
- }}
- />
-
-
-
-
-
-
- 税款所属期:
- {
- this.setState({ taxYearMonth: v });
- let params = {};
- if (taxAgentId == "All") {
- params.taxAgentId = "";
- } else {
- params.taxAgentId = taxAgentId;
- }
- if (v != null && v != "") {
- params.taxYearMonth = monthValue + "-" + v;
- }
- getTableDatas({ ...params, year: monthValue });
- }}
- />
-
-
- 个税扣缴义务人:
- {this.state.inited &&
- {
- let params = {};
- if (v === "All") {
- params.taxAgentId = "";
- } else {
- params.taxAgentId = v;
- }
- if (monthValue != null && monthValue !== "") {
- params.year = monthValue;
- }
- getTableDatas({ ...params, taxYearMonth: monthValue + "-" + taxYearMonth });
- this.setState({ taxAgentId: v });
- }}
- />}
-
-
- );
+ componentDidMount() {
+ this.getAdvanceCondition();
}
- renderFormComponent() {
- const { modalParam } = this.state;
- const { taxAgentStore: { taxAgentOption } } = this.props;
- return (
-
-
-
- 税款所属期
-
-
- this.setState({ modalParam: { taxYearMonth: value } })}
- />
-
-
- );
- }
-
- onEdit = record => {
- const {
- cumSituationStore: {
- slideVisiable,
- setSlideVisiable,
- getCumDeductDetailList,
- setCurrentRecord
+ /*
+ * Author: 黎永顺
+ * Description: 高级搜素框-表单项
+ * Params:
+ * Date: 2023/2/20
+ */
+ getAdvanceCondition = () => {
+ const { cumSituationStore: { form } } = this.props;
+ getCumSituationSaCondition().then(({ status, data }) => {
+ if (status) {
+ this.setState({ advanceCondition: removePropertyCondition(data.condition) });
+ form.initFormFields(removePropertyCondition(data.condition));
}
- } = this.props;
- setSlideVisiable(true);
- setCurrentRecord(record);
- getCumDeductDetailList(record.id, { taxAgentId: record.taxAgentId });
- };
-
- // 增加编辑功能,重写columns绑定事件
- getColumns = columns => {
- let newColumns = [];
- if (!columns) {
- return [];
- }
- newColumns = columns.map(column => {
- let newColumn = column;
- newColumn.render = (text, record, index) => {
- //前端元素转义
- let valueSpan =
- record[newColumn.dataIndex + "span"] !== undefined
- ? record[newColumn.dataIndex + "span"]
- : record[newColumn.dataIndex];
- switch (newColumn.dataIndex) {
- case "username":
- return (
- {
- this.onEdit(record);
- }}
- dangerouslySetInnerHTML={{ __html: valueSpan }}
- />
- );
- case "operate":
- return (
- {
- this.onEdit(record);
- }}>
- 查看明细
-
- );
- default:
- return ;
- }
- };
- return newColumn;
- });
- return newColumns;
- };
-
- handleCancel() {
- const { cumSituationStore } = this.props;
- const { modalVisiable, setModalVisiable, setStep } = cumSituationStore;
- setModalVisiable(false);
- setStep(0);
- }
-
- showColumn = () => {
- const { cumSituationStore: { tableStore } } = this.props;
- tableStore.setColSetVisible(true);
- tableStore.tableColSet(true);
- };
-
- // 导入参数初始化
- handleInitImport = () => {
- const {
- cumSituationStore: { setSlideDataSource, setImportResult }
- } = this.props;
- setSlideDataSource([]);
- setImportResult({});
- };
-
- onSelectChange = val => {
- this.setState({
- selectedKey: val
});
};
-
- // 搜索
- handleSearch = () => {
- const { cumSituationStore: { getTableDatas } } = this.props;
- const { monthValue, taxAgentId, taxYearMonth } = this.state;
- let params = {};
- if (monthValue != null && monthValue !== "") {
- params.year = monthValue;
- }
- if (taxAgentId != null && taxAgentId !== "" && taxAgentId !== "All") {
- params.taxAgentId = taxAgentId;
- }
- getTableDatas({ ...params, taxYearMonth: monthValue + "-" + taxYearMonth, current: 1 });
- };
- //新功能
- handleCreateUpSituation = (payload) => {
- const { editId } = this.state;
+ /*
+ * Author: 黎永顺
+ * Description: 数据采集-信息保存
+ * Params:
+ * Date: 2023/2/20
+ */
+ handleSaveDeduction = (payload) => {
+ const { slidePayload } = this.state;
+ const { data } = slidePayload;
+ const { id } = data;
this.setState({ saveLoading: true });
- if (!_.isEmpty(editId)) {
- API.editAddUpSituation({ ...payload, id: editId.id }).then(({ status, errormsg }) => {
+ if (!_.isEmpty(data)) {
+ editAddUpSituation({ ...payload, id }).then(({ status, errormsg }) => {
this.setState({ saveLoading: false });
if (status) {
message.success("编辑成功");
- this.setState({
- addVisible: false,
- editId: {}
- }, () => {
- const { cumSituationStore: { addForm } } = this.props;
- this.handleSearch();
- addForm.resetForm();
- });
+ this.handleCloseSlide();
+ this.tableRef.getTableDate();
} else {
message.error(errormsg || "编辑失败");
}
});
} else {
- API.createAddUpSituation(payload).then(({ status, errormsg }) => {
+ createAddUpSituation(payload).then(({ status, errormsg }) => {
this.setState({ saveLoading: false });
if (status) {
message.success("新增成功");
- this.setState({
- addVisible: false,
- editId: {}
- }, () => {
- const { cumSituationStore: { addForm } } = this.props;
- this.handleSearch();
- addForm.resetForm();
- });
+ this.handleCloseSlide();
+ this.tableRef.getTableDate();
} else {
message.error(errormsg || "新增失败");
}
});
}
};
- handleOperate = ({ key }, row) => {
- const { monthValue: declareMonth, taxYearMonth } = this.state;
- if (key === "edit") {
- this.setState({
- addVisible: true
- }, () => {
- API.getAddUpSituation({ id: row.id }).then(({ status, data }) => {
+ /*
+ * Author: 黎永顺
+ * Description: 导入数据采集数据
+ * Params:
+ * Date: 2023/2/20
+ */
+ handleImportFile = (params) => {
+ importCumSituationParam(params).then(({ status, data }) => {
+ if (status) {
+ const { importPayload } = this.state;
+ this.setState({
+ importPayload: { ...importPayload, importResult: data }
+ });
+ }
+ });
+ };
+ /*
+ * Author: 黎永顺
+ * Description: 导入数据采集-数据查看
+ * Params:
+ * Date: 2023/2/20
+ */
+ handlePreviewImport = (params) => {
+ importCumSituationPreview(params).then(({ status, data, errormsg }) => {
+ if (status) {
+ const { preview = [] } = data;
+ const { importPayload } = this.state;
+ this.setState({
+ importPayload: { ...importPayload, slideDataSource: preview }
+ });
+ } else {
+ message.error(errormsg || "预览失败");
+ }
+ });
+ };
+ /*
+ * Author: 黎永顺
+ * Description:列表操作
+ * Params:
+ * Date: 2023/2/20
+ */
+ handleTableOperate = ({ key }, record) => {
+ const { id } = record;
+ key === "handleAddData" ? getAddUpSituation({ id }).then(({ status, data }) => {
+ if (status) this[key]("编辑", data);
+ }) : this.deleteSelectAddUpSituation(record);
+ };
+ /*
+ * Author: 黎永顺
+ * Description:新增数据采集-往期累计情况(工资、薪金)
+ * Params: screenParams规则:日期必须放在数组最后一位,人员信息必须第一位
+ * Date: 2023/2/20
+ */
+ handleAddData = (title = "新建", editId = {}) => {
+ const { taxAgentStore, cumSituationStore: { addForm } } = this.props;
+ const { slidePayload } = this.state;
+ const { taxAgentOption } = taxAgentStore;
+ addForm.initFormFields(dataCollectCondition);
+ this.setState({
+ slidePayload: {
+ ...slidePayload,
+ visible: true,
+ title,
+ data: editId,
+ children: title.length <= 2 ?
+ this.addItemRef = dom}
+ taxAgentOption={taxAgentOption}
+ form={addForm}
+ isCum
+ editId={editId}
+ condition={dataCollectCondition}
+ /> :
+ this.tableRecordRef = dom}
+ className="accumulated"
+ taxAgentOption={taxAgentOption}
+ url="/api/bs/hrmsalary/addUpSituation/getDetailList"
+ record={editId}
+ screenParams={["accumulatedSituationId", "taxAgentId", "taxYearMonth"]}
+ />
+ }
+ });
+ };
+ /*
+ * Author: 黎永顺
+ * Description: 一键清空
+ * Params:
+ * Date: 2023/2/20
+ */
+ deleteAllAddUpSituation = () => {
+ const { declareMonth, year } = this.state;
+ const payload = {
+ taxYearMonth: year + "-" + declareMonth
+ };
+ Modal.confirm({
+ title: "信息确认",
+ content: `确定清空税款所属期为${year}-${declareMonth}的所有往期累计情况的数据吗?若数据已参与核算,已参与核算的数据不会受影响,点击核算将会按当前列表最新数据重新核算。`,
+ onOk: () => {
+ deleteAllAddUpSituation(payload).then(({ status, errormsg }) => {
if (status) {
- this.setState({ editId: data });
+ message.success("删除成功");
+ this.tableRef.getTableDate();
+ } else {
+ message.error(errormsg || "删除失败");
}
});
- });
- } else if (key === "delete") {
- const payload = {
- taxYearMonth: declareMonth + "-" + taxYearMonth,
- ids: [row.id]
- };
- Modal.confirm({
- title: "信息确认",
- content: `确定删除${row.departmentName}${row.username}(税款所属期:${declareMonth})的往期累计情况数据吗?若数据已参与核算,已参与核算的数据不会受影响,点击核算将会按当前列表最新数据重新核算。`,
- onOk: () => {
- API.deleteSelectAddUpSituation(payload).then(({ status, errormsg }) => {
- if (status) {
- message.success("删除成功");
- this.handleSearch();
- } else {
- message.error(errormsg || "删除失败");
- }
- });
- }
- });
- }
+ }
+ });
};
- deleteSelectAddUpSituation = () => {
- const { monthValue: declareMonth, selectedKey, taxYearMonth } = this.state;
- if (selectedKey.length === 0) {
- message.warning("未选择条目");
+ /*
+ * Author: 黎永顺
+ * Description: 删除所选
+ * Params:
+ * Date: 2023/2/20
+ */
+ deleteSelectAddUpSituation = (record = {}) => {
+ const { declareMonth, year } = this.state;
+ const { selectedRowKeys: ids } = this.tableRef.state;
+ const { id, departmentName, username } = record;
+ if (ids.length === 0 && !id) {
+ message.warning("请选择表格数据");
return;
}
const payload = {
- taxYearMonth: declareMonth + "-" + taxYearMonth,
- ids: selectedKey
+ taxYearMonth: year + "-" + declareMonth,
+ ids: !id ? ids : [id]
};
Modal.confirm({
title: "信息确认",
- content: "确定删除所选数据吗?若数据已参与核算,已参与核算的数据不会受影响,点击核算将会按当前列表最新数据重新核算。",
+ content: !id ? "确定删除所选数据吗?若数据已参与核算,已参与核算的数据不会受影响,点击核算将会按当前列表最新数据重新核算。" :
+ `确定删除${departmentName}${username}(税款所属期:${declareMonth})的往期累计情况数据吗?若数据已参与核算,已参与核算的数据不会受影响,点击核算将会按当前列表最新数据重新核算。`,
onOk: () => {
- API.deleteSelectAddUpSituation(payload).then(({ status, errormsg }) => {
+ deleteSelectAddUpSituation(payload).then(({ status, errormsg }) => {
if (status) {
message.success("删除成功");
- this.handleSearch();
+ this.tableRef.getTableDate();
+ this.tableRef.handleClearRows();
} else {
message.error(errormsg || "删除失败");
}
});
+ }
+ });
+ };
+ /*
+ * Author: 黎永顺
+ * Description:数据采集-导出全部
+ * Params:
+ * Date: 2023/2/20
+ */
+ handleExportAll = () => {
+ const { declareMonth, taxAgentId, year } = this.state;
+ this.setState({
+ exportPayloadUrl: `${window.location.origin}/api/bs/hrmsalary/addUpSituation/export?ids=&year=${year}&taxYearMonth=${year}-${declareMonth}&taxAgentId=${taxAgentId}`
+ });
+ };
+ /*
+ * Author: 黎永顺
+ * Description:数据采集-导出选中
+ * Params:
+ * Date: 2023/2/20
+ */
+ handleExportSelect = () => {
+ const { selectedRowKeys: ids } = this.tableRef.state;
+ const { declareMonth, taxAgentId, year } = this.state;
+ if (ids.length === 0) {
+ message.warning("请选择需要导出的数据");
+ return;
+ }
+ this.setState({
+ exportPayloadUrl: `${window.location.origin}/api/bs/hrmsalary/addUpSituation/export?ids=${ids.join(",")}&year=${year}&taxYearMonth=${year}-${declareMonth}&taxAgentId=${taxAgentId}`
+ });
+ };
+ /*
+ * Author: 黎永顺
+ * Description: 顶部操作按钮
+ * Params:
+ * Date: 2023/2/17
+ */
+ getTopBtns = () => {
+ const { addAllLoading } = this.state;
+ return [
+ ,
+ ,
+
+ 批量删除
+ 一键清空
+ 导出选中
+ 导出全部
+
+ }
+ >
+
+
+ ];
+ };
+ handleDataMenuClick = ({ key: keyFunc }) => this[keyFunc]();
+ /*
+ * Author: 黎永顺
+ * Description: 筛选组件
+ * Params:
+ * Date: 2023/2/17
+ */
+ getScreen = () => {
+ const { taxAgentStore: { taxAgentOption } } = this.props;
+ const { declareMonth, year, taxAgentId, innerWidth } = this.state;
+ const items = [
+ {
+ com: DataCollectionDatePicker({
+ label: "纳税年度",
+ value: year,
+ onChange: this.screenChange,
+ key: "year",
+ format: "YYYY",
+ tip: "提示:默认显示本年截至上次所有员工的累计收入及各项累计扣除额、已预扣税额,与本月应发和各项应扣除项一起计算出本月应缴纳税额",
+ labelCol: 11,
+ wrapperCol: 13
+ })
},
- onCancel: () => {
+ {
+ com: DataCollectionSelect({
+ label: "税款所属期",
+ value: declareMonth,
+ onChange: this.screenChange,
+ options: taxOptions,
+ key: "declareMonth",
+ labelCol: 12,
+ wrapperCol: 12
+ })
+ },
+ {
+ com: DataCollectionSelect({
+ label: "个税扣缴义务人",
+ value: taxAgentId,
+ onChange: this.screenChange,
+ options: [{ key: "", showname: "全部" }, ...taxAgentOption],
+ key: "taxAgentId",
+ labelCol: 16,
+ wrapperCol: 8
+ })
+ }
+ ];
+ return ;
+ };
+ screenChange = ({ key, value }) => {
+ this.setState({ [key]: value }, () => this.tableRef.getTableDate({ current: 1 }));
+ };
+ handleAdSearch = () => {
+ const { cumSituationStore: { form } } = this.props;
+ this.tableRef.getTableDate({ ...form.getFormParams(), current: 1 });
+ };
+ handleCloseSlide = () => {
+ const { slidePayload } = this.state;
+ this.setState({
+ slidePayload: {
+ ...slidePayload,
+ visible: false,
+ title: "",
+ chidren: null,
+ data: {}
}
});
-
+ this.tableRecordRef && this.tableRecordRef.handleResetSelectKeys();
+ this.handleDebounce = null;
};
- deleteAllAddUpSituation = () => {
- const { monthValue: declareMonth, taxYearMonth } = this.state;
+ handleSaveData = () => {
+ const { cumSituationStore: { addForm } } = this.props;
+ const { baseInfo } = this.addItemRef.state;
+ const bool = _.every(_.pick(baseInfo, ["declareMonth", "taxAgentId", "employeeId"]), v => !!v);
+ if (!bool) {
+ Modal.warning({
+ title: "信息确认",
+ content: "必要信息不完整,红色*为必填项!"
+ });
+ return;
+ }
const payload = {
- taxYearMonth: declareMonth + "-" + taxYearMonth
+ taxYearMonth: baseInfo.declareMonth,
+ ..._.pick(baseInfo, ["taxAgentId", "employeeId", "taxAgentName"]),
+ ...addForm.getFormParams()
};
- Modal.confirm({
- title: "信息确认",
- content: `确定清空税款所属期为${declareMonth}-${taxYearMonth}的所有往期累计情况的数据吗?若数据已参与核算,已参与核算的数据不会受影响,点击核算将会按当前列表最新数据重新核算。`,
- onOk: () => {
- API.deleteAllAddUpSituation(payload).then(({ status, errormsg }) => {
- if (status) {
- message.success("删除成功");
- this.handleSearch();
- } else {
- message.error(errormsg || "删除失败");
- }
- });
+ this.handleSaveDeduction(payload);
+ };
+
+ handleResize = (innerWidth) => this.setState({ innerWidth });
+ /*
+ * Author: 黎永顺
+ * Description: 数据采集-导入相关
+ * Params:
+ * Date: 2023/2/20
+ */
+ handleOpenImport = () => {
+ const { importPayload } = this.state;
+ const { importOpts } = importPayload;
+ this.setState({
+ importPayload: {
+ ...importPayload,
+ visible: true, step: 0,
+ importResult: {}, slideDataSource: [],
+ importFormComponent:
}
});
};
-
- handleButtonClick = () => {
- if (!this.handleChangeDebounce) {
- this.handleChangeDebounce = _.debounce(this.handleChange, 500);
- }
- this.handleChangeDebounce();
+ handleCloseImport = (doSearch = false) => {
+ const { importPayload } = this.state;
+ this.setState({
+ importPayload: {
+ ...importPayload, visible: false, importFormComponent: null, step: 0,
+ importOpts: {
+ declareMonth: moment(new Date()).format("YYYY-MM")
+ }, importResult: {}, slideDataSource: []
+ }
+ }, () => doSearch && this.tableRef.getTableDate());
};
-
- handleChange = e => {
- const taxYearMonth = this.state.monthValue + "-" + this.state.taxYearMonth;
- const url = `${window.location
- .origin}/api/bs/hrmsalary/addUpSituation/export?ids=&year=${this
- .state.monthValue}&taxYearMonth=${taxYearMonth}&taxAgentId=${this.state.taxAgentId == "All"
- ? ""
- : this.state.taxAgentId}`;
- window.open(url, "_self");
+ handleChangeImportForm = (key, value) => {
+ const { importPayload } = this.state;
+ const { importOpts } = importPayload;
+ this.setState({
+ importPayload: { ...importPayload, importOpts: { ...importOpts, [key]: value } }
+ });
};
-
- handleExportAllDetailClick = () => {
- if (!this.handleChangeDebounce) {
- const {
- cumSituationStore: { currentRecord }
- } = this.props;
- const url = `${window.location
- .origin}/api/bs/hrmsalary/addUpSituation/exportDetail?accumulatedSituationId=${currentRecord.id}&ids=&taxAgentId=${currentRecord.taxAgentId}`;
- window.open(url, "_self");
+ handleImportSetStep = (step) => {
+ const { importPayload } = this.state;
+ this.setState({
+ importPayload: { ...importPayload, step }
+ });
+ };
+ /*
+ * Author: 黎永顺
+ * Description:详情页面-操作按钮
+ * Params:
+ * Date: 2023/2/20
+ */
+ getDetailOptBtns = () => {
+ return [
+
+ 导出选中
+ }
+ type="primary">
+ 导出全部
+
+ ];
+ };
+ /*
+ * Author: 黎永顺
+ * Description: 导出详情数据
+ * Params:
+ * Date: 2023/2/21
+ */
+ handleExportDetail = (url) => {
+ if (!this.handleDebounce) {
+ this.handleDebounce = _.debounce(() => {
+ window.open(`${window.location.origin}/api/bs/hrmsalary/addUpSituation/exportDetail${url}`, "_self");
+ this.handleDebounce = null;
+ }, 500);
}
- this.handleChangeDebounce();
+ this.handleDebounce();
+ };
+ handleExportSelectDetail = () => {
+ const { selectedRowKeys: ids, recordPayload } = this.tableRecordRef.state;
+ if (ids.length === 0) {
+ message.warning("请选择需要导出的数据");
+ return;
+ }
+ const exportParams = _.reduce(_.keys(_.omitBy(recordPayload, it => !it)), (pre, cur) => pre + `&${cur}=${recordPayload[cur]}`, "");
+ const payload = `?${exportParams}&ids=${ids.join(",")}`;
+ this.handleExportDetail(payload);
+ };
+ handleExportAllDetail = () => {
+ const { recordPayload } = this.tableRecordRef.state;
+ const exportParams = _.reduce(_.keys(_.omitBy(recordPayload, it => !it)), (pre, cur) => pre + `&${cur}=${recordPayload[cur]}`, "");
+ const payload = `?${exportParams}&ids=`;
+ this.handleExportDetail(payload);
};
render() {
- const { cumSituationStore, taxAgentStore } = this.props;
- const { slideSelectedKey, addVisible, editId, saveLoading } = this.state;
+ const { taxAgentStore: { showOperateBtn }, cumSituationStore: { form } } = this.props;
const {
- loading,
- dataSource,
- columns,
- pageObj,
- form,
- addForm,
- condition,
- tableStore,
- showSearchAd,
- getTableDatas,
- doSearch,
- setShowSearchAd,
- previewImport,
- importFile
- } = cumSituationStore;
- const { taxAgentOption, showOperateBtn } = taxAgentStore;
- const {
- slideVisiable,
- setSlideVisiable,
- modalVisiable,
- setModalVisiable,
- slideTableStore,
- step,
- setStep,
- slideDataSource,
- importResult,
- setPageObj
- } = cumSituationStore;
- const selectedRowKeys = toJS(tableStore.selectedRowKeys) || [];
- const { modalParam, monthValue, taxAgentId } = this.state;
- const detailSelectedRowKeys = toJS(slideTableStore.selectedRowKeys) || [];
- const rightMenu = [
- // 右键菜单
- // {
- // key: "BTN_COLUMN",
- // icon: ,
- // content: "显示列定制",
- // onClick: this.showColumn,
- // },
- ];
- const collectParams = {
- // 收藏功能配置
- favname: "往期累计情况(工资、薪金)",
- favouritetype: 1,
- objid: 0,
- link: "wui/index.html#/ns_demo03/index",
- importantlevel: 1
- };
- const adBtn = [
- // 高级搜索内部按钮
- ,
- ,
-
- ];
-
- const handleMenuClick = () => {
- const { selectedKey } = this.state;
- if (_.isEmpty(selectedKey)) {
- message.warning("未选择条目");
- return;
- }
- const url = `${window.location
- .origin}/api/bs/hrmsalary/addUpSituation/export?ids=${selectedKey.join(
- ","
- )}&year=${this.state.monthValue}&taxAgentId=${this.state
- .taxAgentId == "All"
- ? ""
- : this.state.taxAgentId}`;
- window.open(url, "_self");
- // const {
- // cumSituationStore: { exportCumDeductList },
- // } = this.props;
- // exportCumDeductList(selectedRowKeys.join(","));
- };
-
- const handleBtnImport = () => {
- const { cumSituationStore: { setModalVisiable, setStep } } = this.props;
- setStep(0);
- setModalVisiable(true);
- };
-
- const btns = [
- ,
-
- 导出选中
-
- }
- type="ghost">
- 导出全部
- ,
- ,
-
- 删除所选
-
- }
- type="ghost">
- 一键清空
-
- ];
-
-
- const handleExportSelectedDetailClick = () => {
- if (this.state.slideSelectedKey.length === 0) {
- message.warning("未选择条目");
- return;
- }
- const {
- cumSituationStore: { currentRecord }
- } = this.props;
- const url = `${window.location
- .origin}/api/bs/hrmsalary/addUpSituation/exportDetail?accumulatedSituationId=${currentRecord.id}&ids=${this.state.slideSelectedKey.join(",")}&taxAgentId=${currentRecord.taxAgentId}`;
- window.open(url, "_self");
- };
-
- const renderBtns = () => {
- return [
-
- 导出选中
-
- }
- type="primary">
- 导出全部
-
- ];
- };
-
- const pagination = {
- total: pageObj.total,
- showTotal: total => `共 ${total} 条`,
- showSizeChanger: true,
- pageSizeOptions: ["10", "20", "50", "100"],
- onShowSizeChange: (current, pageSize) => {
- setPageObj({ ...pageObj, current, pageSize });
- getTableDatas({
- current,
- pageSize,
- taxYearMonth: this.state.monthValue + "-" + this.state.taxYearMonth,
- taxAgentId: taxAgentId === "All" ? "" : taxAgentId,
- year: monthValue
- });
- },
- onChange: (current) => {
- setPageObj({ ...pageObj, current, pageSize: pageObj.pageSize });
- getTableDatas({
- current,
- pageSize: pageObj.pageSize,
- taxYearMonth: this.state.monthValue + "-" + this.state.taxYearMonth,
- taxAgentId: taxAgentId === "All" ? "" : taxAgentId,
- year: monthValue
- });
- }
- };
- const rowSelection = {
- selectedRowKeys: this.state.selectedKey,
- onChange: this.onSelectChange
- };
- const newColumns = _.map([...columns], item => {
- if (item.dataIndex === "username") {
- return {
- ...item,
- width: 100,
- fixed: "left",
- render: (text, record) =>
-
- };
- } else if (item.dataIndex === "taxAgentName") {
- return {
- ...item,
- width: 180,
- fixed: "left"
- };
- } else if (item.dataIndex === "operate") {
- return {
- ...item,
- width: 120,
- fixed: "right",
- render: (text, record) =>
-
- };
- } else {
- return { ...item, width: 150 };
- }
- });
- if (_.isEmpty(newColumns)) {
- return renderLoading();
- }
+ declareMonth, taxAgentId, slidePayload, saveLoading, exportPayloadUrl, advanceCondition,
+ importPayload, year
+ } = this.state;
+ const tablePayload = { taxYearMonth: `${year}-${declareMonth}`, year, taxAgentId };
return (
-
-
} // 左侧图标
- iconBgcolor="#F14A2D" // 左侧图标背景色
- showDropIcon={false} // 是否显示下拉按钮
- dropMenuDatas={rightMenu} // 下拉菜单(和页面的右键菜单相同)
- dropMenuProps={{ collectParams }} // 收藏功能: 配置之后显示 收藏、帮助、显示页面地址 这3个功能
- buttons={showOperateBtn ? btns : []}>
-
- setShowSearchAd(bool)} //高级搜索面板受控
- searchsAd={getSearchs(form, toJS(condition), 2)} // 高级搜索内部数据
- buttonsAd={adBtn} // 高级搜索内部按钮
- onSearch={() => this.handleSearch()} // 点搜索按钮时的回调
- searchsAdQuick={this.getSearchsAdQuick()}
- onSearchChange={v => form.updateFields({ username: v })} // 在搜索框中输入的文字改变时的回调: 这里需要同步高级搜索和外部搜索框的值
- searchsBaseValue={form.getFormParams().username} // 外部input搜索值受控: 这里和高级搜索的requestname同步
- />
-
-
-
-
-
-
-
- {modalVisiable &&
-
{
- this.handleInitImport();
- }}
- templateLink={"/api/bs/hrmsalary/addUpSituation/downloadTemplate"}
- params={modalParam}
- columns={modalColumns}
- step={step}
- setStep={setStep}
- onFinish={() => {
- setModalVisiable(false);
- setStep(0);
- doSearch();
- }}
- slideDataSource={slideDataSource}
- importResult={importResult}
- previewImport={params => {
- previewImport(params);
- }}
- importFile={params => {
- importFile(params);
- }}
- renderFormComponent={() => this.renderFormComponent()}
- visiable={modalVisiable}
- onCancel={() => {
- this.handleCancel();
- }}
- />}
- {(slideVisiable || addVisible) &&
- {
- const { baseInfo } = this.addItemRef.state;
- const bool = _.every(_.pick(baseInfo, ["declareMonth", "taxAgentId", "employeeId"]), v => !_.isEmpty(v));
- if (!bool && _.isEmpty(editId)) {
- Modal.warning({
- title: "信息确认",
- content: "必要信息不完整,红色*为必填项!"
- });
- return;
- }
- const payload = {
- taxYearMonth: baseInfo.declareMonth,
- ..._.pick(baseInfo, ["taxAgentId", "employeeId", "taxAgentName"]),
- ...addForm.getFormParams()
- };
- this.handleCreateUpSituation(payload);
- }}
- editable={!!addVisible}
- showOperateBtn={showOperateBtn}
- customOperate={(showOperateBtn && !addVisible) ? renderBtns() : []}
- />
- }
- content={
- addVisible ?
- this.addItemRef = dom}
- taxAgentOption={taxAgentOption}
- form={addForm}
- isCum
- editId={!_.isEmpty(editId) ? { ...editId, declareMonth: editId.taxYearMonth } : editId}
- condition={dataCollectCondition}/> :
-
- this.setState({ slideSelectedKey: val })}
- />
- }
- onClose={() => {
- setSlideVisiable(false);
- this.setState({
- addVisible: false,
- editId: {}
- });
- }}
- showMask={true}
- closeMaskOnClick={() => {
- setSlideVisiable(false);
- this.setState({
- addVisible: false,
- editId: {}
- });
- }}
- />}
-
+
+ this.tableRef = dom}
+ url="/api/bs/hrmsalary/addUpSituation/list"
+ payload={tablePayload}
+ showOperateBtn={showOperateBtn}
+ onTableOperate={this.handleTableOperate}
+ onViewDetails={(record) => this.handleAddData("往期累计情况(工资、薪金)记录", record)}
+ />
+
);
}
}
+
+export default Index;
diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/index.less b/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/index.less
deleted file mode 100644
index 833b1df9..00000000
--- a/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/index.less
+++ /dev/null
@@ -1,64 +0,0 @@
-.slideOuterWrapper {
- .wea-slide-modal-title {
- height: initial;
- line-height: initial;
- text-align: left;
- }
-
- .rodal-close {
- z-index: 99;
- top: 10px !important;
- }
-
- .linkWapper {
- a {
- color: #4d7ad8;
- margin-right: 8px;
- }
-
- i {
- cursor: pointer;
- }
-
- a:hover {
- text-decoration: none;
- }
- }
-
-}
-
-.moreIconWrapper {
- .ant-popover-inner {
- min-width: 106px
- }
-
- .ant-popover-inner-content {
- padding: 0;
-
- .ant-menu {
- .ant-menu-item {
- border-right: none;
- height: 30px;
- line-height: 30px;
- text-align: center;
- padding: 0;
- }
- }
- }
-}
-
-@media (min-width: 1260px) {
- .slideOuterWrapper {
- .reqTopWrapper .wea-new-top-req-title > div:first-child > div {
- max-width: 100% !important;
- }
- }
-}
-
-@media screen and (min-width: 1060px) and (max-width: 1260px) {
- .slideOuterWrapper {
- .reqTopWrapper .wea-new-top-req-title > div:first-child > div {
- max-width: calc(100% - 96px) !important;
- }
- }
-}
diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/index.less b/pc4mobx/hrmSalary/pages/dataAcquisition/index.less
index af9a1fa2..a580739f 100644
--- a/pc4mobx/hrmSalary/pages/dataAcquisition/index.less
+++ b/pc4mobx/hrmSalary/pages/dataAcquisition/index.less
@@ -83,6 +83,30 @@
}
}
+ .screenSituationWrapper {
+ padding: 0;
+
+ .wea-content {
+ padding: 0;
+ }
+
+ .wea-form-cell {
+ padding: 0 16px;
+
+ .wea-date-picker {
+ width: 70%;
+
+ input {
+ min-width: inherit !important;
+ }
+ }
+ }
+
+ .wea-helpful-tip {
+ padding-left: 10px;
+ }
+ }
+
.dataContent {
flex: 1;
overflow: hidden;
diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/columns.js b/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/columns.js
index 2d1dfb19..cb2efd8f 100644
--- a/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/columns.js
+++ b/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/columns.js
@@ -65,68 +65,6 @@ export const columns = [
key: "title"
}
];
-
-
-export const modalColumns = [
- {
- title: "姓名",
- dataIndex: "username",
- key: "username"
- },
- {
- title: "个税扣缴义务人",
- dataIndex: "taxAgentName",
- key: "taxAgentName"
- },
- {
- title: "部门",
- dataIndex: "departmentName",
- key: "departmentName"
- },
- {
- title: "手机号",
- dataIndex: "mobile",
- key: "mobile"
- },
- {
- title: "工号",
- dataIndex: "jobNum",
- key: "jobNum"
- },
- {
- title: "证件号码",
- dataIndex: "idNo",
- key: "idNo"
- },
- {
- title: "入职日期",
- dataIndex: "hiredate",
- key: "hiredate"
- },
- {
- title: "商业健康保险",
- dataIndex: "businessHealthyInsurance",
- key: "businessHealthyInsurance"
- },
- {
- title: "税延养老保险",
- dataIndex: "taxDelayEndowmentInsurance",
- key: "taxDelayEndowmentInsurance"
- },
- {
- title: "其他",
- dataIndex: "otherDeduction",
- key: "otherDeduction"
- },
- {
- title: "准予扣除的捐赠额",
- dataIndex: "deductionAllowedDonation",
- key: "deductionAllowedDonation"
- }
-];
-
-export const dataSource = [];
-
export const dataCollectCondition = [
{
items: [
diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/editSlideContent.js b/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/editSlideContent.js
deleted file mode 100644
index e66c6b4f..00000000
--- a/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/editSlideContent.js
+++ /dev/null
@@ -1,213 +0,0 @@
-import React from "react";
-import { Col, DatePicker, Row } from "antd";
-import { inject, observer } from "mobx-react";
-import { WeaTable } from "ecCom";
-import "./editSlideContent.less";
-import moment from "moment";
-
-const { MonthPicker } = DatePicker;
-
-let emptyItem = {
- incomeLowerLimit: "0.00",
- incomeUpperLimit: "0.00",
- dutyFreeValue: "0.00",
- dutyFreeRate: "0.00",
- taxableIncomeLl: "0.00",
- taxableIncomeUl: "0.00",
- taxRate: "0.00",
- taxDeduction: "0.00"
-};
-
-@inject("otherDeductStore", "taxAgentStore")
-@observer
-export default class EditSlideContent extends React.Component {
- constructor(props) {
- super(props);
- this.state = {
- taxAgentId: "",
- startDate: "",
- endDate: "",
- editable:
- this.props.editable === undefined ? "true" : this.props.editable
- };
- }
-
- componentWillMount() {
- // 初始化渲染页面
- const {
- taxAgentStore: { fetchTaxAgentOption }
- } = this.props;
- fetchTaxAgentOption();
- }
-
- addItem() {
- const {
- taxRateStore: { setDataSource }
- } = this.props;
- let dataSource = [...this.props.taxRateStore.dataSource];
- let indexNum = 1;
- if (dataSource.length > 0) {
- indexNum = dataSource[dataSource.length - 1].indexNum + 1;
- }
- let item = { ...emptyItem };
- item.indexNum = indexNum;
- dataSource.push(item);
- setDataSource(dataSource);
- }
-
- fetchCumDeductDetailList(param) {
- const { otherDeductStore } = this.props;
- const { getOtherDeductDetailList, currentRecord } = otherDeductStore;
- getOtherDeductDetailList(currentRecord.id, param);
- }
-
- // 日期格式变化加载数据
- handleFetchCumDeductDetailList(startDate, endDate, taxAgentId) {
- let declareMonth = [];
- if (startDate != "" && startDate != undefined) {
- declareMonth.push(startDate);
- }
-
- if (endDate != "" && endDate != undefined) {
- declareMonth.push(endDate);
- }
- let item = {
- taxAgentId: taxAgentId
- };
- if (declareMonth.length != 0) {
- item.declareMonth = declareMonth;
- }
- this.fetchCumDeductDetailList(item);
- }
-
- onSelectChange = (val) => {
- const { onChangeSlideSelectKey } = this.props;
- onChangeSlideSelectKey && onChangeSlideSelectKey(val);
- };
-
- render() {
- const { otherDeductStore } = this.props;
- const {
- getOtherDeductDetailList,
- currentRecord,
- slideColumns,
- slidePageObj,
- slideTableDataSource,
- setSlidePageObj,
- slideLoading
- } = otherDeductStore;
- const { startDate, endDate, taxAgentId } = this.state;
- const declareMonth = [startDate, endDate];
-
- const pagination = {
- current: slidePageObj.current,
- pageSize: slidePageObj.pageSize,
- total: slidePageObj.total,
- showTotal: (total) => `共 ${total} 条`,
- showSizeChanger: true,
- onShowSizeChange(current, pageSize) {
- setSlidePageObj({ ...slidePageObj, current, pageSize });
- getOtherDeductDetailList(currentRecord.id, {
- ...slidePageObj,
- current,
- pageSize,
- declareMonth: _.filter(declareMonth, item => item)
- });
- },
- onChange(current) {
- setSlidePageObj({
- ...slidePageObj,
- current, taxAgentId: currentRecord.taxAgentId,
- pageSize: slidePageObj.pageSize
- });
- getOtherDeductDetailList(currentRecord.id, {
- ...slidePageObj,
- current, taxAgentId: currentRecord.taxAgentId,
- declareMonth: _.filter(declareMonth, item => item)
- });
- }
- };
- const newColumns = _.map([...slideColumns], (item) => ({ ...item }));
- const rowSelection = {
- selectedRowKeys: this.props.slideSelectedKey,
- onChange: this.onSelectChange
- };
- return (
-
-
-
- {currentRecord.username}
-
-
- 税款所属期
-
-
- {
- let startDate = "";
- if (v != "" && v != undefined) {
- startDate = moment(v).format("YYYY-MM");
- }
- this.setState({ startDate });
- this.handleFetchCumDeductDetailList(
- startDate,
- endDate,
- taxAgentId
- );
- }}
- />
-
-
至
-
- {
- let endDate = "";
- if (v != "" && v != undefined) {
- endDate = moment(v).format("YYYY-MM");
- }
- this.setState({ endDate });
- this.handleFetchCumDeductDetailList(
- startDate,
- endDate,
- currentRecord.taxAgentId
- );
- }}
- />
-
-
-
- {/**/}
- {/* 个税扣缴义务人*/}
- {/* {*/}
- {/* this.setState({ taxAgentId: v });*/}
- {/* this.handleFetchCumDeductDetailList(startDate, endDate, v);*/}
- {/* }}*/}
- {/* />*/}
- {/**/}
-
-
-
-
-
-
- );
- }
-}
diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/editSlideContent.less b/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/editSlideContent.less
deleted file mode 100644
index 14f22326..00000000
--- a/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/editSlideContent.less
+++ /dev/null
@@ -1,22 +0,0 @@
-.cumDeductSlide {
- .topLabelBar {
- padding: 10px 20px;
- height: 40px;
- line-height: 40px;
- margin-bottom: 10px;
- }
- .formLabel {
- margin-right: 10px;
- }
- .weaRangePickerWrapper {
- display: inline-block;
- .monthPickerWrapper {
- width: 100px;
- display: inline-block;
- }
- .betweenLable {
- margin-left: 10px;
- margin-right: 10px;
- }
- }
-}
\ No newline at end of file
diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/index.js
index d53144ef..3930168a 100644
--- a/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/index.js
+++ b/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/index.js
@@ -1,380 +1,207 @@
-import React from "react";
+/*
+ * Author: 黎永顺
+ * name: 其他免税扣除
+ * Description:
+ * Date: 2023/2/21
+ */
+import React, { Component } from "react";
import { inject, observer } from "mobx-react";
-import { toJS } from "mobx";
-import { Button, Col, Dropdown, Menu, message, Modal, Popover, Row } from "antd";
-import { WeaDatePicker, WeaHelpfulTip, WeaSelect, WeaSlideModal, WeaTab, WeaTable, WeaTop, WeaNewScroll } from "ecCom";
+import { WeaSearchGroup } from "ecCom";
+import { Button, Dropdown, Menu, message, Modal } from "antd";
+import {
+ createData,
+ deleteAllData,
+ deleteSelectData,
+ editData,
+ extendToLastMonth, getData,
+ getOtherDeductSaCondition,
+ importOtherDeductionParam,
+ importOtherDeductionPreview
+} from "../../../apis/otherDeduct";
+import { removePropertyCondition } from "../../../util/response";
+import DataTables from "../dataTables";
+import Layout from "../layout";
import moment from "moment";
-import { getSearchs, renderLoading } from "../../../util"; // 渲染form数据的方法:因为多个页面都会使用,所以抽的公共方法在util中
-import ImportModal from "../../../components/importModal";
-import { dataCollectCondition, modalColumns } from "./columns";
+import ImportFormCom from "../cumDeduct/components/importFormCom";
+import { DataCollectionDatePicker, DataCollectionSelect } from "../cumDeduct";
+import { getAddUpDeduction } from "../../../apis/cumDeduct";
+import { dataCollectCondition } from "./columns";
import AddItems from "../addItems";
-import SlideModalTitle from "../../../components/slideModalTitle";
-import EditSlideContent from "./editSlideContent";
-import { optionAddAll } from "../../../util/options";
-import * as API from "../../../apis/otherDeduct";
-import "./index.less";
+import TableRecord from "../components/tableRecord";
-@inject("otherDeductStore", "taxAgentStore")
+@inject("taxAgentStore", "otherDeductStore")
@observer
-export default class OtherDeduct extends React.Component {
+class Index extends Component {
constructor(props) {
super(props);
this.state = {
- saveLoading: false,
+ declareMonth: moment(new Date()).format("YYYY-MM"),
+ taxAgentId: "",
+ innerWidth: window.innerWidth,
lastLoading: false,
- addVisible: false,
- editId: {},
- value: "",
- selectedKey: [],
- slideSelectedKey: [], //详情表格的选中项
- visiable: false,
- monthValue: moment(new Date()).format("YYYY-MM"),
- taxAgentId: "All",
- inited: false,
- modalParam: {
- declareMonth: ""
- }
+ saveLoading: false,
+ slidePayload: {
+ visible: false,
+ title: "",
+ children: null,
+ data: {}
+ },
+ importPayload: {
+ visible: false,
+ importOpts: {
+ declareMonth: moment(new Date()).format("YYYY-MM")
+ },
+ importFormComponent: null,
+ step: 0,
+ importResult: {},
+ slideDataSource: []
+ },
+ exportPayloadUrl: "",
+ advanceCondition: null
};
+ this.tableRef = null;
+ this.addItemRef = null;
+ this.tableRecordRef = null;
}
- componentWillMount() {
- // 初始化渲染页面
- const {
- otherDeductStore: { doInit, addForm },
- taxAgentStore: { fetchTaxAgentOption }
- } = this.props;
- addForm.initFormFields(dataCollectCondition);
- doInit({ declareMonth: [this.state.monthValue], taxAgentId: "" });
- fetchTaxAgentOption().then(() => {
- this.setState({
- inited: true
- });
- });
+ componentDidMount() {
+ this.getAdvanceCondition();
}
- getSearchsAdQuick() {
- const { monthValue, taxAgentId } = this.state;
- const {
- taxAgentStore: { taxAgentOption },
- otherDeductStore: { form, getTableDatas }
- } = this.props;
- return (
-
-
- 税款所属期:
- {
- this.setState({ monthValue: v });
- let params = {};
- if (taxAgentId == "All") {
- params.taxAgentId = "";
- } else {
- params.taxAgentId = taxAgentId;
- }
- if (v != null && v != "") {
- params.declareMonth = [v];
- }
- getTableDatas(params);
- }}
- />
-
-
-
-
-
-
-
- 个税扣缴义务人:
- {this.state.inited &&
- {
- let params = {};
- if (v == "All") {
- params.taxAgentId = "";
- } else {
- params.taxAgentId = v;
- }
- if (monthValue != null && monthValue != "") {
- params.declareMonth = [monthValue];
- }
- getTableDatas(params);
- this.setState({ taxAgentId: v });
- }}
- />}
-
-
- );
- }
-
- onEdit = record => {
- const {
- otherDeductStore: {
- slideVisiable,
- setSlideVisiable,
- getOtherDeductDetailList,
- setCurrentRecord
+ /*
+ * Author: 黎永顺
+ * Description: 高级搜素框-表单项
+ * Params:
+ * Date: 2023/2/20
+ */
+ getAdvanceCondition = () => {
+ const { otherDeductStore: { form } } = this.props;
+ getOtherDeductSaCondition().then(({ status, data }) => {
+ if (status) {
+ this.setState({ advanceCondition: removePropertyCondition(data.condition) });
+ form.initFormFields(removePropertyCondition(data.condition));
}
- } = this.props;
- setSlideVisiable(true);
- setCurrentRecord(record);
- getOtherDeductDetailList(record.id, { taxAgentId: record.taxAgentId });
- };
-
- // 增加编辑功能,重写columns绑定事件
- getColumns = columns => {
- let newColumns = "";
- newColumns = columns.map(column => {
- let newColumn = column;
- newColumn.render = (text, record, index) => {
- //前端元素转义
- let valueSpan =
- record[newColumn.dataIndex + "span"] !== undefined
- ? record[newColumn.dataIndex + "span"]
- : record[newColumn.dataIndex];
- switch (newColumn.dataIndex) {
- case "username":
- return (
- {
- this.onEdit(record);
- }}
- dangerouslySetInnerHTML={{ __html: valueSpan }}
- />
- );
- case "operate":
- return (
- {
- this.onEdit(record);
- }}>
- 查看明细
-
- );
- default:
- return ;
- }
- };
- return newColumn;
- });
- return newColumns;
- };
-
- handleCancel() {
- const { otherDeductStore } = this.props;
- const { modalVisiable, setModalVisiable, setStep } = otherDeductStore;
- setModalVisiable(false);
- setStep(0);
- }
-
- onOperatesClick = (record, index, operate, flag) => {
- switch (operate.index.toString()) {
- case "0": // 查看明细
- this.onEdit(record);
- break;
- }
- };
-
- renderFormComponent() {
- const { modalParam } = this.state;
- return (
-
-
-
- 税款所属期
-
-
- this.setState({ modalParam: { declareMonth: value } })}
- />
-
-
- );
- }
-
- showColumn = () => {
- const { otherDeductStore: { tableStore } } = this.props;
- tableStore.setColSetVisible(true);
- tableStore.tableColSet(true);
- };
-
- // 初始化导入参数
- handleInitImport() {
- const {
- otherDeductStore: { setSlideDataSource, setImportResult }
- } = this.props;
- setSlideDataSource([]);
- setImportResult({});
- }
-
- onSelectChange = val => {
- this.setState({
- selectedKey: val
});
};
-
- handleSearch = () => {
- const { otherDeductStore: { getTableDatas } } = this.props;
- const { monthValue, taxAgentId } = this.state;
- let params = {};
- if (monthValue != null && monthValue !== "") {
- params.declareMonth = [monthValue];
- }
- if (taxAgentId != null && taxAgentId !== "" && taxAgentId !== "All") {
- params.taxAgentId = taxAgentId;
- }
- getTableDatas({ ...params, current: 1 });
+ /*
+ * Author: 黎永顺
+ * Description: 沿用上月
+ * Params:
+ * Date: 2023/2/21
+ */
+ extendToLastMonth = () => {
+ const { declareMonth, taxAgentId } = this.state;
+ const payload = { declareMonth, taxAgentId };
+ this.setState({ lastLoading: true });
+ extendToLastMonth(payload).then(({ status, data, errormsg }) => {
+ this.setState({ lastLoading: false });
+ if (status) {
+ message.success(data || "操作成功");
+ this.tableRef.getTableDate();
+ } else {
+ message.error(errormsg || "操作失败");
+ }
+ }).catch(() => this.setState({ lastLoading: false }));
};
-
- //新功能
- handleCreateData = (payload) => {
- const { editId } = this.state;
+ /*
+ * Author: 黎永顺
+ * Description: 数据采集-信息保存
+ * Params:
+ * Date: 2023/2/20
+ */
+ handleSaveDeduction = (payload) => {
+ const { slidePayload } = this.state;
+ const { data } = slidePayload;
+ const { id } = data;
this.setState({ saveLoading: true });
- if (!_.isEmpty(editId)) {
- API.editData({ ...payload, id: editId.id }).then(({ status, errormsg }) => {
+ if (!_.isEmpty(data)) {
+ editData({ ...payload, id }).then(({ status, errormsg }) => {
this.setState({ saveLoading: false });
if (status) {
message.success("编辑成功");
- this.setState({
- addVisible: false,
- editId: {}
- }, () => {
- const { otherDeductStore: { doSearch, addForm } } = this.props;
- const { monthValue, taxAgentId } = this.state;
- doSearch({
- declareMonth: [monthValue],
- taxAgentId: taxAgentId === "All" ? "" : taxAgentId
- });
- addForm.resetForm();
- });
+ this.handleCloseSlide();
+ this.tableRef.getTableDate();
} else {
message.error(errormsg || "编辑失败");
}
});
} else {
- API.createData(payload).then(({ status, errormsg }) => {
+ createData(payload).then(({ status, errormsg }) => {
this.setState({ saveLoading: false });
if (status) {
message.success("新增成功");
- this.setState({
- addVisible: false,
- editId: {}
- }, () => {
- const { otherDeductStore: { doSearch, addForm } } = this.props;
- const { monthValue, taxAgentId } = this.state;
- doSearch({
- declareMonth: [monthValue],
- taxAgentId: taxAgentId === "All" ? "" : taxAgentId
- });
- addForm.resetForm();
- });
+ this.handleCloseSlide();
+ this.tableRef.getTableDate();
} else {
message.error(errormsg || "新增失败");
}
});
}
};
- handleOperate = ({ key }, row) => {
- const { monthValue: declareMonth, taxAgentId } = this.state;
- const { otherDeductStore: { doSearch } } = this.props;
- if (key === "edit") {
- this.setState({
- addVisible: true
- }, () => {
- API.getData({ id: row.id }).then(({ status, data }) => {
- if (status) {
- this.setState({ editId: data });
- }
+ /*
+ * Author: 黎永顺
+ * Description: 导入数据采集数据
+ * Params:
+ * Date: 2023/2/20
+ */
+ handleImportFile = (params) => {
+ importOtherDeductionParam(params).then(({ status, data }) => {
+ if (status) {
+ const { importPayload } = this.state;
+ this.setState({
+ importPayload: { ...importPayload, importResult: data }
});
- });
- } else if (key === "delete") {
- const payload = {
- declareMonth,
- ids: [row.id]
- };
- Modal.confirm({
- title: "信息确认",
- content: `确定删除${row.departmentName}${row.username}(税款所属期:${declareMonth})的其他免税扣除数据吗?若数据已参与核算,已参与核算的数据不会受影响,点击核算将会按当前列表最新数据重新核算。`,
- onOk: () => {
- API.deleteSelectData(payload).then(({ status, errormsg }) => {
- if (status) {
- message.success("删除成功");
- doSearch({
- declareMonth: [declareMonth],
- taxAgentId: taxAgentId === "All" ? "" : taxAgentId
- });
- } else {
- message.error(errormsg || "删除失败");
- }
- });
- }
- });
- }
- };
- deleteSelectData = () => {
- const { monthValue: declareMonth, taxAgentId, selectedKey } = this.state;
- const { otherDeductStore: { doSearch } } = this.props;
- if (selectedKey.length === 0) {
- message.warning("未选择条目");
- return;
- }
- const payload = {
- declareMonth,
- ids: selectedKey
- };
- Modal.confirm({
- title: "信息确认",
- content: "确定删除所选数据吗?若数据已参与核算,已参与核算的数据不会受影响,点击核算将会按当前列表最新数据重新核算。",
- onOk: () => {
- API.deleteSelectData(payload).then(({ status, errormsg }) => {
- if (status) {
- message.success("删除成功");
- doSearch({
- declareMonth: [declareMonth],
- taxAgentId: taxAgentId === "All" ? "" : taxAgentId
- });
- } else {
- message.error(errormsg || "删除失败");
- }
- });
- },
- onCancel: () => {
}
});
-
};
+ /*
+ * Author: 黎永顺
+ * Description: 导入数据采集-数据查看
+ * Params:
+ * Date: 2023/2/20
+ */
+ handlePreviewImport = (params) => {
+ importOtherDeductionPreview(params).then(({ status, data, errormsg }) => {
+ if (status) {
+ const { preview = [] } = data;
+ const { importPayload } = this.state;
+ this.setState({
+ importPayload: { ...importPayload, slideDataSource: preview }
+ });
+ } else {
+ message.error(errormsg || "预览失败");
+ }
+ });
+ };
+ /*
+ * Author: 黎永顺
+ * Description:列表操作
+ * Params:
+ * Date: 2023/2/20
+ */
+ handleTableOperate = ({ key }, record) => {
+ const { id } = record;
+ key === "handleAddData" ? getData({ id }).then(({ status, data }) => {
+ if (status) this[key]("编辑", data);
+ }) : this.deleteSelectData(record);
+ };
+ /*
+ * Author: 黎永顺
+ * Description: 一键清空
+ * Params:
+ * Date: 2023/2/20
+ */
deleteAllData = () => {
- const { monthValue: declareMonth, taxAgentId } = this.state;
- const { otherDeductStore: { doSearch } } = this.props;
- const payload = {
- declareMonth,
- taxAgentId: taxAgentId === "All" ? "" : taxAgentId
- };
+ const { declareMonth, taxAgentId } = this.state;
+ const payload = { declareMonth, taxAgentId };
Modal.confirm({
title: "信息确认",
content: `确定清空税款所属期为${declareMonth}的所有其他免税扣除数据吗?若数据已参与核算,已参与核算的数据不会受影响,点击核算将会按当前列表最新数据重新核算。`,
onOk: () => {
- API.deleteAllData(payload).then(({ status, errormsg }) => {
+ deleteAllData(payload).then(({ status, errormsg }) => {
if (status) {
message.success("删除成功");
- doSearch({
- declareMonth: [declareMonth],
- taxAgentId: taxAgentId === "All" ? "" : taxAgentId
- });
+ this.tableRef.getTableDate();
} else {
message.error(errormsg || "删除失败");
}
@@ -382,447 +209,322 @@ export default class OtherDeduct extends React.Component {
}
});
};
-
- //沿用上月
- extendToLastMonth = () => {
- const { monthValue: declareMonth, taxAgentId } = this.state;
- const { otherDeductStore: { doSearch } } = this.props;
- const payload = {
- declareMonth,
- taxAgentId: taxAgentId === "All" ? "" : taxAgentId
- };
- this.setState({ lastLoading: true });
- API.extendToLastMonth(payload).then(({ status, data, errormsg }) => {
- this.setState({ lastLoading: false });
- if (status) {
- message.success(data || "操作成功");
- doSearch({
- declareMonth: [declareMonth],
- taxAgentId: taxAgentId === "All" ? "" : taxAgentId
+ /*
+ * Author: 黎永顺
+ * Description: 删除所选
+ * Params:
+ * Date: 2023/2/20
+ */
+ deleteSelectData = (record = {}) => {
+ const { declareMonth } = this.state;
+ const { selectedRowKeys: ids } = this.tableRef.state;
+ const { id, departmentName, username } = record;
+ if (ids.length === 0 && !id) {
+ message.warning("请选择表格数据");
+ return;
+ }
+ const payload = { declareMonth, ids: !id ? ids : [id] };
+ Modal.confirm({
+ title: "信息确认",
+ content: !id ? "确定删除所选数据吗?若数据已参与核算,已参与核算的数据不会受影响,点击核算将会按当前列表最新数据重新核算。" :
+ `确定删除${departmentName}${username}(税款所属期:${declareMonth})的其他免税扣除数据吗?若数据已参与核算,已参与核算的数据不会受影响,点击核算将会按当前列表最新数据重新核算。`,
+ onOk: () => {
+ deleteSelectData(payload).then(({ status, errormsg }) => {
+ if (status) {
+ message.success("删除成功");
+ this.tableRef.getTableDate();
+ this.tableRef.handleClearRows();
+ } else {
+ message.error(errormsg || "删除失败");
+ }
});
- } else {
- message.error(errormsg || "操作失败");
}
- }).catch(() => this.setState({ lastLoading: false }));
+ });
};
- handleButtonClick = () => {
- if (!this.handleChangeDebounce) {
- this.handleChangeDebounce = _.debounce(this.handleChange, 500);
+ /*
+ * Author: 黎永顺
+ * Description:数据采集-导出全部
+ * Params:
+ * Date: 2023/2/20
+ */
+ handleExportAll = () => {
+ const { declareMonth, taxAgentId } = this.state;
+ this.setState({
+ exportPayloadUrl: `${window.location.origin}/api/bs/hrmsalary/otherDeduction/export?ids=&declareMonth=${declareMonth}&taxAgentId=${taxAgentId}`
+ });
+ };
+ /*
+ * Author: 黎永顺
+ * Description:数据采集-导出选中
+ * Params:
+ * Date: 2023/2/20
+ */
+ handleExportSelect = () => {
+ const { selectedRowKeys: ids } = this.tableRef.state;
+ const { declareMonth, taxAgentId } = this.state;
+ if (ids.length === 0) {
+ message.warning("请选择需要导出的数据");
+ return;
}
- this.handleChangeDebounce();
+ this.setState({
+ exportPayloadUrl: `${window.location.origin}/api/bs/hrmsalary/otherDeduction/export?ids=${ids.join(",")}&declareMonth=${declareMonth}&taxAgentId=${taxAgentId}`
+ });
+ };
+ /*
+ * Author: 黎永顺
+ * Description:新增数据采集-累计专项附加扣除
+ * Params: screenParams规则:日期必须放在数组最后一位,人员信息必须第一位
+ * Date: 2023/2/20
+ */
+ handleAddData = (title = "新建", editId = {}) => {
+ const { taxAgentStore, otherDeductStore: { addForm } } = this.props;
+ const { slidePayload } = this.state;
+ const { taxAgentOption } = taxAgentStore;
+ addForm.initFormFields(dataCollectCondition);
+ this.setState({
+ slidePayload: {
+ ...slidePayload,
+ visible: true,
+ title,
+ data: editId,
+ children: title.length <= 2 ?
+ this.addItemRef = dom}
+ taxAgentOption={taxAgentOption}
+ form={addForm}
+ editId={editId}
+ condition={dataCollectCondition}
+ /> :
+ this.tableRecordRef = dom}
+ className="accumulated"
+ taxAgentOption={taxAgentOption}
+ url="/api/bs/hrmsalary/otherDeduction/getDetailList"
+ record={editId}
+ screenParams={["otherTaxExemptDeductionId", "taxAgentId", "declareMonth"]}
+ />
+ }
+ });
+ };
+ /*
+ * Author: 黎永顺
+ * Description: 顶部操作按钮
+ * Params:
+ * Date: 2023/2/17
+ */
+ getTopBtns = () => {
+ const { lastLoading } = this.state;
+ return [
+ ,
+ ,
+ ,
+
+ 批量删除
+ 一键清空
+ 导出选中
+ 导出全部
+
+ }
+ >
+
+
+ ];
+ };
+ handleDataMenuClick = ({ key: keyFunc }) => this[keyFunc]();
+ /*
+ * Author: 黎永顺
+ * Description: 筛选组件
+ * Params:
+ * Date: 2023/2/17
+ */
+ getScreen = () => {
+ const { taxAgentStore: { taxAgentOption } } = this.props;
+ const { declareMonth, taxAgentId, innerWidth } = this.state;
+ const items = [
+ {
+ com: DataCollectionDatePicker({
+ label: "税款所属期",
+ value: declareMonth,
+ onChange: this.screenChange,
+ key: "declareMonth",
+ tip: "提示:默认显示当前月所有员工申报的其他免税扣除额"
+ })
+ },
+ {
+ com: DataCollectionSelect({
+ label: "个税扣缴义务人",
+ value: taxAgentId,
+ onChange: this.screenChange,
+ options: [{ key: "", showname: "全部" }, ...taxAgentOption],
+ key: "taxAgentId"
+ })
+ }
+ ];
+ return ;
+ };
+ screenChange = ({ key, value }) => {
+ this.setState({ [key]: value }, () => this.tableRef.getTableDate({ current: 1 }));
+ };
+ handleCloseSlide = () => {
+ const { slidePayload } = this.state;
+ this.setState({
+ slidePayload: {
+ ...slidePayload,
+ visible: false,
+ title: "",
+ chidren: null,
+ data: {}
+ }
+ });
+ this.tableRecordRef && this.tableRecordRef.handleResetSelectKeys();
+ this.handleDebounce = null;
+ };
+ handleSaveData = () => {
+ const { otherDeductStore: { addForm } } = this.props;
+ const { baseInfo } = this.addItemRef.state;
+ const bool = _.every(_.pick(baseInfo, ["declareMonth", "taxAgentId", "employeeId"]), v => !!v);
+ if (!bool) {
+ Modal.warning({
+ title: "信息确认",
+ content: "必要信息不完整,红色*为必填项!"
+ });
+ return;
+ }
+ const payload = {
+ ..._.pick(baseInfo, ["declareMonth", "taxAgentId", "employeeId", "taxAgentName"]),
+ ...addForm.getFormParams()
+ };
+ this.handleSaveDeduction(payload);
+ };
+ handleAdSearch = () => {
+ const { otherDeductStore: { form } } = this.props;
+ this.tableRef.getTableDate({ ...form.getFormParams(), current: 1 });
};
- handleChange = e => {
- const { selectedKey } = this.state;
- const url = `${window.location
- .origin}/api/bs/hrmsalary/otherDeduction/export?ids=&declareMonth=${this
- .state.monthValue}&taxAgentId=${this.state.taxAgentId == "All"
- ? ""
- : this.state.taxAgentId}`;
- window.open(url, "_self");
+ handleResize = (innerWidth) => this.setState({ innerWidth });
+ /*
+ * Author: 黎永顺
+ * Description: 数据采集-导入相关
+ * Params:
+ * Date: 2023/2/20
+ */
+ handleOpenImport = () => {
+ const { importPayload } = this.state;
+ const { importOpts } = importPayload;
+ this.setState({
+ importPayload: {
+ ...importPayload,
+ visible: true, step: 0,
+ importResult: {}, slideDataSource: [],
+ importFormComponent:
+ }
+ });
};
- handleExportAllDetailClick = () => {
- if (!this.handleChangeDebounce) {
- const {
- otherDeductStore: { currentRecord }
- } = this.props;
- const url = `${window.location
- .origin}/api/bs/hrmsalary/otherDeduction/exportDetail?otherTaxExemptDeductionId=${currentRecord.id}&ids=&taxAgentId=${currentRecord.taxAgentId}`;
- window.open(url, "_self");
+ handleCloseImport = (doSearch = false) => {
+ const { importPayload } = this.state;
+ this.setState({
+ importPayload: {
+ ...importPayload, visible: false, importFormComponent: null, step: 0,
+ importOpts: {
+ declareMonth: moment(new Date()).format("YYYY-MM")
+ }, importResult: {}, slideDataSource: []
+ }
+ }, () => doSearch && this.tableRef.getTableDate());
+ };
+ handleChangeImportForm = (key, value) => {
+ const { importPayload } = this.state;
+ const { importOpts } = importPayload;
+ this.setState({
+ importPayload: { ...importPayload, importOpts: { ...importOpts, [key]: value } }
+ });
+ };
+ handleImportSetStep = (step) => {
+ const { importPayload } = this.state;
+ this.setState({
+ importPayload: { ...importPayload, step }
+ });
+ };
+ /*
+ * Author: 黎永顺
+ * Description:详情页面-操作按钮
+ * Params:
+ * Date: 2023/2/20
+ */
+ getDetailOptBtns = () => {
+ return [
+
+ 导出选中
+ }
+ type="primary">
+ 导出全部
+
+ ];
+ };
+ /*
+ * Author: 黎永顺
+ * Description: 导出详情数据
+ * Params:
+ * Date: 2023/2/21
+ */
+ handleExportDetail = (url) => {
+ if (!this.handleDebounce) {
+ this.handleDebounce = _.debounce(() => {
+ window.open(`${window.location.origin}/api/bs/hrmsalary/otherDeduction/exportDetail${url}`, "_self");
+ this.handleDebounce = null;
+ }, 500);
}
- this.handleChangeDebounce();
+ this.handleDebounce();
+ };
+ handleExportSelectDetail = () => {
+ const { selectedRowKeys: ids, recordPayload } = this.tableRecordRef.state;
+ if (ids.length === 0) {
+ message.warning("请选择需要导出的数据");
+ return;
+ }
+ const exportParams = _.reduce(_.keys(_.omitBy(recordPayload, it => !it)), (pre, cur) => pre + `&${cur}=${recordPayload[cur]}`, "");
+ const payload = `?${exportParams}&ids=${ids.join(",")}`;
+ this.handleExportDetail(payload);
+ };
+ handleExportAllDetail = () => {
+ const { recordPayload } = this.tableRecordRef.state;
+ const exportParams = _.reduce(_.keys(_.omitBy(recordPayload, it => !it)), (pre, cur) => pre + `&${cur}=${recordPayload[cur]}`, "");
+ const payload = `?${exportParams}&ids=`;
+ this.handleExportDetail(payload);
};
render() {
- const { otherDeductStore, taxAgentStore } = this.props;
+ const { taxAgentStore: { showOperateBtn }, otherDeductStore: { form } } = this.props;
const {
- loading,
- dataSource,
- columns,
- pageObj,
- hasRight,
- form,
- condition,
- tableStore,
- showSearchAd,
- getTableDatas,
- doSearch,
- setShowSearchAd,
- previewImport,
- importFile,
- addForm
- } = otherDeductStore;
- const { taxAgentOption, showOperateBtn } = taxAgentStore;
- const {
- slideVisiable,
- setSlideVisiable,
- modalVisiable,
- setModalVisiable,
- slideTableStore,
- step,
- setStep,
- slideDataSource,
- importResult,
- setPageObj
- } = otherDeductStore;
- const selectedRowKeys = toJS(tableStore.selectedRowKeys) || [];
- const {
- modalParam,
- monthValue,
- taxAgentId,
- slideSelectedKey,
- addVisible,
- editId,
- saveLoading,
- lastLoading
+ declareMonth, taxAgentId, slidePayload, saveLoading, exportPayloadUrl, advanceCondition,
+ importPayload
} = this.state;
-
- const detailSelectedRowKeys = toJS(slideTableStore.selectedRowKeys) || [];
-
- const rightMenu = [
- // 右键菜单
- // {
- // key: "BTN_COLUMN",
- // icon: ,
- // content: "显示列定制",
- // onClick: this.showColumn,
- // },
- ];
- const collectParams = {
- // 收藏功能配置
- favname: "其他免税扣除",
- favouritetype: 1,
- objid: 0,
- link: "wui/index.html#/ns_demo03/index",
- importantlevel: 1
- };
- const adBtn = [
- // 高级搜索内部按钮
- ,
- ,
-
- ];
-
- const handleMenuClick = () => {
- const { selectedKey } = this.state;
- if (_.isEmpty(selectedKey)) {
- message.warning("未选择条目");
- return;
- }
-
- const url = `${window.location
- .origin}/api/bs/hrmsalary/otherDeduction/export?ids=${selectedKey.join(
- ","
- )}&declareMonth=${this.state.monthValue}&taxAgentId=${this.state
- .taxAgentId == "All"
- ? ""
- : this.state.taxAgentId}`;
- window.open(url, "_self");
- // const {
- // otherDeductStore: { exportOtherDeductList },
- // } = this.props;
- // exportOtherDeductList(selectedKey.join(","));
- };
-
- const handleBtnImport = () => {
- const { otherDeductStore: { setModalVisiable, setStep } } = this.props;
- setStep(0);
- setModalVisiable(true);
- };
-
- const btns = [
- ,
-
- 导出选中
-
- }
- type="ghost">
- 导出全部
- ,
- ,
-
- 删除所选
-
- }
- type="ghost">
- 一键清空
- ,
-
- ];
-
- const handleExportSelectedDetailClick = () => {
- if (this.state.slideSelectedKey.length === 0) {
- message.warning("未选择条目");
- return;
- }
- const {
- otherDeductStore: { currentRecord }
- } = this.props;
- const url = `${window.location
- .origin}/api/bs/hrmsalary/otherDeduction/exportDetail?otherTaxExemptDeductionId=${currentRecord.id}&ids=${this.state.slideSelectedKey.join(",")}&taxAgentId=${currentRecord.taxAgentId}`;
- window.open(url, "_self");
- };
-
- const renderBtns = () => {
- return [
-
- 导出选中
-
- }
- type="primary">
- 导出全部
-
- ];
- };
-
- const rowSelection = {
- selectedRowKeys: this.state.selectedKey,
- onChange: this.onSelectChange
- };
- const pagination = {
- total: pageObj.total,
- showTotal: total => `共 ${total} 条`,
- showSizeChanger: true,
- pageSizeOptions: ["10", "20", "50", "100"],
- onShowSizeChange(current, pageSize) {
- setPageObj({ ...pageObj, current, pageSize });
- getTableDatas({
- current,
- pageSize,
- taxAgentIdL: taxAgentId === "All" ? "" : taxAgentId,
- declareMonth: monthValue && [monthValue]
- });
- },
- onChange(current) {
- setPageObj({ ...pageObj, current, pageSize: pageObj.pageSize });
- getTableDatas({
- current,
- pageSize: pageObj.pageSize,
- taxAgentId: taxAgentId === "All" ? "" : taxAgentId,
- declareMonth: monthValue && [monthValue]
- });
- }
- };
-
- const newColumns = _.map([...columns], item => {
- if (item.dataIndex === "username") {
- return {
- ...item,
- render: (text, record) =>
-
- };
- } else if (item.dataIndex === "taxAgentName") {
- return {
- ...item
- };
- } else if (item.dataIndex === "operate") {
- return {
- ...item,
- render: (text, record) =>
-
- };
- } else {
- return { ...item };
- }
- });
- if (_.isEmpty(newColumns)) {
- return renderLoading();
- }
-
+ const tablePayload = { declareMonth: [declareMonth], taxAgentId };
return (
-
-
} // 左侧图标
- iconBgcolor="#F14A2D" // 左侧图标背景色
- showDropIcon={false} // 是否显示下拉按钮
- dropMenuDatas={rightMenu} // 下拉菜单(和页面的右键菜单相同)
- dropMenuProps={{ collectParams }} // 收藏功能: 配置之后显示 收藏、帮助、显示页面地址 这3个功能
- buttons={showOperateBtn ? btns : []}>
-
- setShowSearchAd(bool)} //高级搜索面板受控
- searchsAd={getSearchs(form, toJS(condition), 2)} // 高级搜索内部数据
- buttonsAd={adBtn} // 高级搜索内部按钮
- onSearch={() => this.handleSearch()} // 点搜索按钮时的回调
- searchsAdQuick={this.getSearchsAdQuick()}
- onSearchChange={v => form.updateFields({ username: v })} // 在搜索框中输入的文字改变时的回调: 这里需要同步高级搜索和外部搜索框的值
- searchsBaseValue={form.getFormParams().username} // 外部input搜索值受控: 这里和高级搜索的requestname同步
- />
-
-
-
-
-
-
-
- {modalVisiable &&
-
{
- this.handleInitImport();
- }}
- templateLink={"/api/bs/hrmsalary/otherDeduction/downloadTemplate"}
- params={modalParam}
- columns={modalColumns}
- step={step}
- setStep={setStep}
- onFinish={() => {
- setModalVisiable(false);
- setStep(0);
- doSearch({
- taxAgentId: taxAgentId === "All" ? "" : taxAgentId,
- declareMonth: monthValue && [monthValue]
- });
- }}
- importResult={importResult}
- slideDataSource={slideDataSource}
- previewImport={params => {
- previewImport(params);
- }}
- importFile={params => {
- importFile(params);
- }}
- renderFormComponent={() => this.renderFormComponent()}
- visiable={modalVisiable}
- onCancel={() => {
- this.handleCancel();
- }}
- />}
- {(slideVisiable || addVisible) &&
- {
- const { baseInfo } = this.addItemRef.state;
- const bool = _.every(_.pick(baseInfo, ["declareMonth", "taxAgentId", "employeeId"]), v => !_.isEmpty(v));
- if (!bool && _.isEmpty(editId)) {
- Modal.warning({
- title: "信息确认",
- content: "必要信息不完整,红色*为必填项!"
- });
- return;
- }
- const payload = {
- ..._.pick(baseInfo, ["declareMonth", "taxAgentId", "employeeId", "taxAgentName"]),
- ...addForm.getFormParams()
- };
- this.handleCreateData(payload);
- }}
- loading={saveLoading}
- editable={!!addVisible}
- showOperateBtn={showOperateBtn}
- customOperate={(showOperateBtn && !addVisible) ? renderBtns() : []}
- />
- }
- content={
- addVisible ?
- this.addItemRef = dom}
- taxAgentOption={taxAgentOption}
- form={addForm}
- editId={editId}
- condition={dataCollectCondition}
- /> :
-
- this.setState({ slideSelectedKey: val })}
- />
- }
- onClose={() => {
- setSlideVisiable(false);
- this.setState({
- addVisible: false,
- editId: {}
- });
- }}
- showMask={true}
- closeMaskOnClick={() => {
- setSlideVisiable(false);
- this.setState({
- addVisible: false,
- editId: {}
- });
- }}
- />}
-
+
+ this.tableRef = dom}
+ url="/api/bs/hrmsalary/otherDeduction/list"
+ payload={tablePayload}
+ showOperateBtn={showOperateBtn}
+ onTableOperate={this.handleTableOperate}
+ onViewDetails={(record) => this.handleAddData("其他免税扣除记录", record)}
+ />
+
);
}
}
+
+export default Index;
diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/specialAddDeduction/components/inlineForm.js b/pc4mobx/hrmSalary/pages/dataAcquisition/specialAddDeduction/components/inlineForm.js
deleted file mode 100644
index 30a44c4e..00000000
--- a/pc4mobx/hrmSalary/pages/dataAcquisition/specialAddDeduction/components/inlineForm.js
+++ /dev/null
@@ -1,25 +0,0 @@
-import React, { Component } from "react";
-import { Form } from "antd";
-import { WeaSelect } from "ecCom";
-import { optionAddWhole } from "../../../../util/options";
-
-class InlineForm extends Component {
-
- render() {
- const { taxAgentOption = [], form, onChange } = this.props;
- return (
-
-
-
-
- );
- }
-}
-
-export default Form.create()(InlineForm);
diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/specialAddDeduction/components/specialAddContent.js b/pc4mobx/hrmSalary/pages/dataAcquisition/specialAddDeduction/components/specialAddContent.js
deleted file mode 100644
index cfdfff2c..00000000
--- a/pc4mobx/hrmSalary/pages/dataAcquisition/specialAddDeduction/components/specialAddContent.js
+++ /dev/null
@@ -1,87 +0,0 @@
-import React, { Component } from "react";
-import { WeaTable } from "ecCom";
-import * as API from "../../../../apis/special";
-
-class SpecialAddContent extends Component {
- constructor(props) {
- super(props);
- this.state = {
- dataSource: [],
- columns: [],
- loading: {
- query: false
- },
- selectedRowKeys: [],
- pageInfo: {
- current: 1,
- pageSize: 10,
- total: 0
- }
- };
- }
-
- componentWillReceiveProps(nextProps, nextContext) {
- if (nextProps.specialId !== this.props.specialId) {
- nextProps.specialId && this.specialAddDeductionGetDetailList({ specialAddDeductionId: nextProps.specialId });
- }
- }
-
- specialAddDeductionGetDetailList = (payload) => {
- this.setState({ loading: { ...this.state.loading, query: true } });
- API.specialAddDeductionGetDetailList(payload).then(({ status, data }) => {
- this.setState({ loading: { ...this.state.loading, query: false } });
- if (status) {
- const { columns, list: dataSource, pageSize, pageNum, total } = data;
- this.setState({
- columns, dataSource,
- pageInfo: {
- ...this.pageInfo,
- pageSize, pageNum, total
- }
- });
- }
- });
- };
-
- render() {
- const { columns, dataSource, pageInfo, selectedRowKeys, loading } = this.state;
- const { specialId } = this.props;
- const pagination = {
- ...pageInfo,
- showTotal: (total) => `共 ${total} 条`,
- pageSizeOptions: ["10", "20", "50", "100"],
- showSizeChanger: true,
- showQuickJumper: true,
- onShowSizeChange: (current, pageSize) => {
- this.setState({
- pageInfo: { ...pageInfo, current, pageSize }
- }, () => {
- this.specialAddDeductionGetDetailList({ specialAddDeductionId: specialId, current, pageSize });
- });
- },
- onChange: (current) => {
- this.setState({
- pageInfo: { ...pageInfo, current }
- }, () => {
- this.specialAddDeductionGetDetailList({ specialAddDeductionId: specialId, current });
- });
- }
- };
- const rowSelection = {
- selectedRowKeys,
- onChange: (selectedRowKeys) => this.setState({ selectedRowKeys })
- };
- return (
-
- );
- }
-}
-
-export default SpecialAddContent;
diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/specialAddDeduction/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/specialAddDeduction/index.js
index 0d31317b..92460e95 100644
--- a/pc4mobx/hrmSalary/pages/dataAcquisition/specialAddDeduction/index.js
+++ b/pc4mobx/hrmSalary/pages/dataAcquisition/specialAddDeduction/index.js
@@ -1,293 +1,165 @@
import React, { Component } from "react";
import { inject, observer } from "mobx-react";
-import { Button, Col, Dropdown, Menu, message, Modal, Popover, Row } from "antd";
-import { WeaPopoverHrm, WeaSelect, WeaSlideModal, WeaTab, WeaTable, WeaTools, WeaTop, WeaNewScroll } from "ecCom";
-import InlineForm from "./components/inlineForm";
-import { getSearchs, renderLoading } from "../../../util";
-import * as API from "../../../apis/special";
-import SlideModalTitle from "../../../components/slideModalTitle";
+import { WeaSearchGroup } from "ecCom";
+import { Button, Dropdown, Menu, message, Modal } from "antd";
+import DataTables from "../dataTables";
+import Layout from "../layout";
+import {
+ getSearchCondition,
+ getSpecialAddDeduction,
+ specialAddDeductionCreateData,
+ specialAddDeductionDeleteAllData,
+ specialAddDeductionDeleteSelectData,
+ specialAddDeductionEditData,
+ specialAddDeductionImportData,
+ specialAddDeductionPreview
+} from "../../../apis/special";
+import { removePropertyCondition } from "../../../util/response";
+import { DataCollectionSelect } from "../cumDeduct";
+import ImportFormCom from "../cumDeduct/components/importFormCom";
+import { condition } from "./components/condition";
import AddItems from "../addItems";
-import SpecialAddContent from "./components/specialAddContent";
-import { condition, searchCondition } from "./components/condition";
-import ImportModal from "../../../components/importModal";
-import { specialModalColumns } from "../cumDeduct/columns";
-import "./index.less";
+import TableRecord from "../components/tableRecord";
-@inject("specialAddStore", "taxAgentStore")
+@inject("taxAgentStore", "specialAddStore")
@observer
-class SpecialAddDeduction extends Component {
+class Index extends Component {
constructor(props) {
super(props);
this.state = {
- loading: {
- query: false
- },
- advanceParams: { //高级搜索参数
+ taxAgentId: "",
+ innerWidth: window.innerWidth,
+ saveLoading: false,
+ slidePayload: {
visible: false,
- condition: []
+ title: "",
+ children: null,
+ data: {}
},
- drawerParams: { //抽屜弹框参数
- visible: false, title: "新建",
- loading: false, isView: true,
- editId: {}
+ importPayload: {
+ visible: false,
+ importOpts: {
+ taxAgentId: ""
+ },
+ importFormComponent: null,
+ step: 0,
+ importResult: {},
+ slideDataSource: []
},
- importParams: { //导入弹框参数
- visible: false, step: 0,
- importResult: [],
- payload: { taxAgentId: "" }
- },
- dataSource: [],
- columns: [],
- selectedRowKeys: [],
- pageInfo: {
- current: 1, pageSize: 10, total: 0
- }
+ exportPayloadUrl: "",
+ advanceCondition: null
};
- this.inlineForm = null;
+ this.tableRef = null;
this.addItemRef = null;
- this.specialContentRef = null;
+ this.tableRecordRef = null;
}
componentDidMount() {
- const { taxAgentStore: { getTaxAgentSelectListAsAdmin }, specialAddStore: { addForm } } = this.props;
- addForm.initFormFields(condition);
- getTaxAgentSelectListAsAdmin();
- this.getSearchCondition();
- this.specialAddDeductionList();
+ this.getAdvanceCondition();
}
- getSearchCondition = () => {
- const { specialAddStore: { advanceForm } } = this.props;
- const { advanceParams } = this.state;
- API.getSearchCondition().then(({ status, data }) => {
- if (status) {
- const { condition } = data;
- this.setState({
- advanceParams: {
- ...advanceParams,
- condition: condition
- }
- }, () => advanceForm.initFormFields(this.state.advanceParams.condition));
- }
- });
- };
- specialAddDeductionList = (params = {}) => {
- const { loading, pageInfo } = this.state;
- const { specialAddStore: { advanceForm } } = this.props;
- const queryParams = advanceForm.getFormParams();
- const extraParams = this.inlineForm ? this.inlineForm.getFieldsValue() : {};
- const payload = {
- ...pageInfo,
- ...queryParams,
- ...extraParams,
- ...params
- };
- this.setState({ loading: { ...loading, query: true } });
- API.specialAddDeductionList(payload).then(({ status, data }) => {
- this.setState({ loading: { ...loading, query: false } });
- if (status) {
- const { columns, list: dataSource, pageNum: current, pageSize, total } = data;
- const { userid } = WeaTools.ls.getJSONObj("theme-account") || {};
- this.setState({
- pageInfo: { ...pageInfo, current, pageSize, total },
- dataSource,
- columns: _.map(columns, item => {
- const { dataIndex } = item;
- if (dataIndex === "username") {
- return {
- ...item,
- render: (text, record) => {
- return window.pointerXY(e)}
- title={text}
- >
- {text}
- ;
- }
- };
- } else if (dataIndex === "operate") {
- return {
- ...item,
- render: (text, record) => (
-
- )
- };
- } else {
- return { ...item };
- }
- })
- });
- }
- });
- };
- handleSaveSpecialList = (payload) => {
- const { drawerParams } = this.state;
- this.setState({ drawerParams: { ...drawerParams, loading: true } });
- if (!_.isEmpty(drawerParams.editId)) {
- API.specialAddDeductionEditData({ ...payload, id: drawerParams.editId.id }).then(({ status, errormsg }) => {
- this.setState({ drawerParams: { ...drawerParams, loading: false } });
+ /*
+ * Author: 黎永顺
+ * Description: 数据采集-信息保存
+ * Params:
+ * Date: 2023/2/20
+ */
+ handleSaveDeduction = (payload) => {
+ const { slidePayload } = this.state;
+ const { data } = slidePayload;
+ const { id } = data;
+ this.setState({ saveLoading: true });
+ if (!_.isEmpty(data)) {
+ specialAddDeductionEditData({ ...payload, id }).then(({ status, errormsg }) => {
+ this.setState({ saveLoading: false });
if (status) {
message.success("编辑成功");
- this.setState({
- drawerParams: {
- ...drawerParams,
- visible: false,
- isView: true,
- editId: {}
- }
- }, () => {
- const { specialAddStore: { addForm } } = this.props;
- this.specialAddDeductionList();
- addForm.resetForm();
- });
+ this.handleCloseSlide();
+ this.tableRef.getTableDate();
} else {
message.error(errormsg || "编辑失败");
}
});
} else {
- API.specialAddDeductionCreateData(payload).then(({ status, errormsg }) => {
- this.setState({ drawerParams: { ...drawerParams, loading: false } });
+ specialAddDeductionCreateData(payload).then(({ status, errormsg }) => {
+ this.setState({ saveLoading: false });
if (status) {
message.success("新增成功");
- this.setState({
- drawerParams: {
- ...drawerParams,
- visible: false,
- isView: true,
- editId: {}
- }
- }, () => {
- const { specialAddStore: { addForm } } = this.props;
- this.specialAddDeductionList();
- addForm.resetForm();
- });
+ this.handleCloseSlide();
+ this.tableRef.getTableDate();
} else {
message.error(errormsg || "新增失败");
}
});
}
};
- handleOperate = ({ key }, row) => {
- const { drawerParams } = this.state;
- if (key === "edit") {
- this.setState({
- drawerParams: {
- ...drawerParams,
- visible: true,
- isView: false,
- title: "编辑"
- }
- }, () => {
- const { drawerParams: params } = this.state;
- API.getSpecialAddDeduction({ id: row.id }).then(({ status, data }) => {
- if (status) {
- this.setState({
- drawerParams: {
- ...params,
- editId: data
- }
- });
- }
+ /*
+ * Author: 黎永顺
+ * Description: 导入数据采集数据
+ * Params:
+ * Date: 2023/2/20
+ */
+ handleImportFile = (params) => {
+ specialAddDeductionImportData(params).then(({ status, data }) => {
+ if (status) {
+ const { importPayload } = this.state;
+ this.setState({
+ importPayload: { ...importPayload, importResult: data }
});
- });
- } else if (key === "delete") {
- const payload = {
- ids: [row.id]
- };
- Modal.confirm({
- title: "信息确认",
- content: `确定删除${row.departmentName}${row.username}的专项附加扣除数据吗?若数据已参与核算,已参与核算的数据不会受影响,点击核算将会按当前列表最新数据重新核算。`,
- onOk: () => {
- API.specialAddDeductionDeleteSelectData(payload).then(({ status, errormsg }) => {
- if (status) {
- message.success("删除成功");
- this.specialAddDeductionList();
- } else {
- message.error(errormsg || "删除失败");
- }
- });
- }
- });
- }
- };
- deleteSelectAddUpDeduction = () => {
- const { selectedRowKeys } = this.state;
- if (selectedRowKeys.length === 0) {
- message.warning("未选择条目");
- return;
- }
- const payload = {
- ids: selectedRowKeys
- };
- Modal.confirm({
- title: "信息确认",
- content: "确定删除所选数据吗?若数据已参与核算,已参与核算的数据不会受影响,点击核算将会按当前列表最新数据重新核算。",
- onOk: () => {
- API.specialAddDeductionDeleteSelectData(payload).then(({ status, errormsg }) => {
- if (status) {
- message.success("删除成功");
- this.specialAddDeductionList();
- } else {
- message.error(errormsg || "删除失败");
- }
- });
- },
- onCancel: () => {
}
});
-
};
+ /*
+ * Author: 黎永顺
+ * Description: 导入数据采集-数据查看
+ * Params:
+ * Date: 2023/2/20
+ */
+ handlePreviewImport = (params) => {
+ specialAddDeductionPreview(params).then(({ status, data, errormsg }) => {
+ if (status) {
+ const { preview = [] } = data;
+ const { importPayload } = this.state;
+ this.setState({
+ importPayload: { ...importPayload, slideDataSource: preview }
+ });
+ } else {
+ message.error(errormsg || "预览失败");
+ }
+ });
+ };
+ /*
+ * Author: 黎永顺
+ * Description: 高级搜素框-表单项
+ * Params:
+ * Date: 2023/2/20
+ */
+ getAdvanceCondition = () => {
+ const { specialAddStore: { advanceForm } } = this.props;
+ getSearchCondition().then(({ status, data }) => {
+ if (status) {
+ this.setState({ advanceCondition: removePropertyCondition(data.condition) });
+ advanceForm.initFormFields(removePropertyCondition(data.condition));
+ }
+ });
+ };
+ /*
+ * Author: 黎永顺
+ * Description: 一键清空
+ * Params:
+ * Date: 2023/2/20
+ */
specialAddDeductionDeleteAllData = () => {
- const extraParams = this.inlineForm ? this.inlineForm.getFieldsValue() : {};
- const payload = {
- ...extraParams
- };
+ const { taxAgentId } = this.state;
+ const payload = { taxAgentId };
Modal.confirm({
title: "信息确认",
content: `确定清空所有专项附加扣除数据吗?若数据已参与核算,已参与核算的数据不会受影响,点击核算将会按当前列表最新数据重新核算。`,
onOk: () => {
- API.specialAddDeductionDeleteAllData(payload).then(({ status, errormsg }) => {
+ specialAddDeductionDeleteAllData(payload).then(({ status, errormsg }) => {
if (status) {
message.success("删除成功");
- this.specialAddDeductionList();
+ this.tableRef.getTableDate();
} else {
message.error(errormsg || "删除失败");
}
@@ -295,370 +167,318 @@ class SpecialAddDeduction extends Component {
}
});
};
- specialAddDeductionPreview = (payload) => {
- const { importParams } = this.state;
- API.specialAddDeductionPreview(payload).then(({ status, data }) => {
- if (status) {
- const { preview: slideDataSource } = data;
- this.setState({
- importParams: {
- ...importParams,
- slideDataSource
+ /*
+ * Author: 黎永顺
+ * Description: 删除所选
+ * Params:
+ * Date: 2023/2/20
+ */
+ specialAddDeductionDeleteSelectData = (record = {}) => {
+ const { selectedRowKeys: ids } = this.tableRef.state;
+ const { id, departmentName, username } = record;
+ if (ids.length === 0 && !id) {
+ message.warning("请选择表格数据");
+ return;
+ }
+ const payload = { ids: !id ? ids : [id] };
+ Modal.confirm({
+ title: "信息确认",
+ content: !id ? "确定删除所选数据吗?若数据已参与核算,已参与核算的数据不会受影响,点击核算将会按当前列表最新数据重新核算。" :
+ `确定删除${departmentName}${username}的累计专项附加扣除数据吗?若数据已参与核算,已参与核算的数据不会受影响,点击核算将会按当前列表最新数据重新核算。`,
+ onOk: () => {
+ specialAddDeductionDeleteSelectData(payload).then(({ status, errormsg }) => {
+ if (status) {
+ message.success("删除成功");
+ this.tableRef.getTableDate();
+ this.tableRef.handleClearRows();
+ } else {
+ message.error(errormsg || "删除失败");
}
});
}
});
};
- specialAddDeductionImportData = (payload) => {
- const { importParams } = this.state;
- API.specialAddDeductionImportData(payload).then(({ status, data: importResult }) => {
- if (status) {
- this.setState({
- importParams: {
- ...importParams,
- step: 2,
- importResult
- }
- });
+ /*
+ * Author: 黎永顺
+ * Description:数据采集-导出全部
+ * Params:
+ * Date: 2023/2/20
+ */
+ handleExportAll = () => {
+ const { taxAgentId } = this.state;
+ this.setState({
+ exportPayloadUrl: `${window.location.origin}/api/bs/hrmsalary/specialAddDeduction/export?ids=&taxAgentId=${taxAgentId}`
+ });
+ };
+ /*
+ * Author: 黎永顺
+ * Description:数据采集-导出选中
+ * Params:
+ * Date: 2023/2/20
+ */
+ handleExportSelect = () => {
+ const { selectedRowKeys: ids } = this.tableRef.state;
+ const { taxAgentId } = this.state;
+ if (ids.length === 0) {
+ message.warning("请选择需要导出的数据");
+ return;
+ }
+ this.setState({
+ exportPayloadUrl: `${window.location.origin}/api/bs/hrmsalary/specialAddDeduction/export?ids=${ids.join(",")}&taxAgentId=${taxAgentId}`
+ });
+ };
+ /*
+ * Author: 黎永顺
+ * Description: 筛选组件
+ * Params:
+ * Date: 2023/2/17
+ */
+ getScreen = () => {
+ const { taxAgentStore: { taxAgentOption } } = this.props;
+ const { taxAgentId } = this.state;
+ const items = [
+ {
+ com: DataCollectionSelect({
+ label: "个税扣缴义务人",
+ value: taxAgentId,
+ onChange: this.screenChange,
+ options: [{ key: "", showname: "全部" }, ...taxAgentOption],
+ key: "taxAgentId"
+ })
+ }
+ ];
+ return ;
+ };
+ screenChange = ({ key, value }) => {
+ this.setState({ [key]: value }, () => this.tableRef.getTableDate({ current: 1 }));
+ };
+ /*
+ * Author: 黎永顺
+ * Description: 顶部操作按钮
+ * Params:
+ * Date: 2023/2/17
+ */
+ getTopBtns = () => {
+ return [
+ ,
+ ,
+
+ 批量删除
+ 一键清空
+ 导出选中
+ 导出全部
+
+ }
+ >
+
+
+ ];
+ };
+ handleDataMenuClick = ({ key: keyFunc }) => this[keyFunc]();
+ /*
+ * Author: 黎永顺
+ * Description:新增数据采集-专项附加扣除
+ * Params: screenParams规则:日期必须放在数组最后一位,人员信息必须第一位
+ * Date: 2023/2/20
+ */
+ handleAddData = (title = "新建", editId = {}) => {
+ const { taxAgentStore, specialAddStore: { addForm } } = this.props;
+ const { slidePayload } = this.state;
+ const { taxAgentOption } = taxAgentStore;
+ addForm.initFormFields(condition);
+ this.setState({
+ slidePayload: {
+ ...slidePayload,
+ visible: true,
+ title,
+ data: editId,
+ children: title.length <= 2 ?
+ this.addItemRef = dom}
+ taxAgentOption={taxAgentOption}
+ form={addForm}
+ isSpecial
+ editId={editId}
+ condition={condition}
+ /> :
+ this.tableRecordRef = dom}
+ className="accumulated"
+ taxAgentOption={taxAgentOption}
+ url="/api/bs/hrmsalary/specialAddDeduction/getDetailList"
+ record={editId}
+ screenParams={["specialAddDeductionId"]}
+ />
}
});
};
- specialAddDeductionExport = () => {
- if (!this.handleChangeDebounce) {
- this.handleChangeDebounce = _.debounce(() => {
- const url = `${window.location.origin}/api/bs/hrmsalary/specialAddDeduction/export?ids=&taxAgentId=${this.inlineForm.getFieldsValue().taxAgentId}`;
- window.open(url, "_self");
+ /*
+ * Author: 黎永顺
+ * Description:列表操作
+ * Params:
+ * Date: 2023/2/20
+ */
+ handleTableOperate = ({ key }, record) => {
+ const { id } = record;
+ key === "handleAddData" ? getSpecialAddDeduction({ id }).then(({ status, data }) => {
+ if (status) this[key]("编辑", data);
+ }) : this.specialAddDeductionDeleteSelectData(record);
+ };
+ handleCloseSlide = () => {
+ const { slidePayload } = this.state;
+ this.setState({
+ slidePayload: {
+ ...slidePayload,
+ visible: false,
+ title: "",
+ chidren: null,
+ data: {}
+ }
+ });
+ this.tableRecordRef && this.tableRecordRef.handleResetSelectKeys();
+ this.handleDebounce = null;
+ };
+ handleSaveData = () => {
+ const { specialAddStore: { addForm } } = this.props;
+ const { baseInfo } = this.addItemRef.state;
+ const bool = _.every(_.pick(baseInfo, ["taxAgentId", "employeeId"]), v => !!v);
+ if (!bool) {
+ Modal.warning({
+ title: "信息确认",
+ content: "必要信息不完整,红色*为必填项!"
+ });
+ return;
+ }
+ const payload = {
+ ..._.pick(baseInfo, ["taxAgentId", "employeeId", "taxAgentName"]),
+ ...addForm.getFormParams()
+ };
+ this.handleSaveDeduction(payload);
+ };
+ handleAdSearch = () => {
+ const { specialAddStore: { advanceForm } } = this.props;
+ this.tableRef.getTableDate({ ...advanceForm.getFormParams(), current: 1 });
+ };
+
+ handleResize = (innerWidth) => this.setState({ innerWidth });
+ /*
+ * Author: 黎永顺
+ * Description: 数据采集-导入相关
+ * Params:
+ * Date: 2023/2/20
+ */
+ handleOpenImport = () => {
+ const { importPayload } = this.state;
+ const { importOpts } = importPayload;
+ const { taxAgentStore: { taxAgentOption } } = this.props;
+ this.setState({
+ importPayload: {
+ ...importPayload,
+ visible: true, step: 0,
+ importResult: {}, slideDataSource: [],
+ importFormComponent:
+ }
+ });
+ };
+ handleCloseImport = (doSearch = false) => {
+ const { importPayload } = this.state;
+ this.setState({
+ importPayload: {
+ ...importPayload, visible: false, importFormComponent: null, step: 0,
+ importOpts: {
+ taxAgentId: ""
+ }, importResult: {}, slideDataSource: []
+ }
+ }, () => doSearch && this.tableRef.getTableDate());
+ };
+ handleChangeImportForm = (key, value) => {
+ const { importPayload } = this.state;
+ const { importOpts } = importPayload;
+ this.setState({
+ importPayload: { ...importPayload, importOpts: { ...importOpts, [key]: value } }
+ });
+ };
+ handleImportSetStep = (step) => {
+ const { importPayload } = this.state;
+ this.setState({
+ importPayload: { ...importPayload, step }
+ });
+ };
+ /*
+ * Author: 黎永顺
+ * Description:详情页面相关-操作按钮
+ * Params:
+ * Date: 2023/2/20
+ */
+ getDetailOptBtns = () => {
+ return [
+
+ 导出选中
+ }
+ type="primary">
+ 导出全部
+
+ ];
+ };
+ handleExportDetail = (url) => {
+ if (!this.handleDebounce) {
+ this.handleDebounce = _.debounce(() => {
+ window.open(`${window.location.origin}/api/bs/hrmsalary/specialAddDeduction/export${url}`, "_self");
+ this.handleDebounce = null;
}, 500);
}
- this.handleChangeDebounce();
+ this.handleDebounce();
};
-
- specialAddDeductionExportSelect = () => {
- const { selectedRowKeys } = this.state;
- if (selectedRowKeys.length === 0) {
- message.warning("未选择条目");
+ handleExportSelectDetail = () => {
+ const { selectedRowKeys: ids, recordPayload } = this.tableRecordRef.state;
+ if (ids.length === 0) {
+ message.warning("请选择需要导出的数据");
return;
}
- const url = `${window.location.origin}/api/bs/hrmsalary/specialAddDeduction/export?ids=${selectedRowKeys.join(",")}&taxAgentId=${this.inlineForm.getFieldsValue().taxAgentId}`;
- window.open(url, "_self");
+ const exportParams = _.reduce(_.keys(_.omitBy(recordPayload, it => !it)), (pre, cur) => pre + `&${cur}=${recordPayload[cur]}`, "");
+ const payload = `?${exportParams}&ids=${ids.join(",")}`;
+ this.handleExportDetail(payload);
};
- handleExportSelectSpecialDetail = () => {
- const { state: { selectedRowKeys } } = this.specialContentRef;
- if (selectedRowKeys.length === 0) {
- message.warning("未选择条目");
- return;
- }
- const url = `${window.location.origin}/api/bs/hrmsalary/specialAddDeduction/export?ids=${selectedRowKeys.join(",")}`;
- window.open(url, "_self");
- };
- getSearchsAdQuick = (isAd) => {
- const { advanceParams } = this.state;
- // advanceParams.condition
- const { taxAgentStore: { taxAgentAdminOption }, specialAddStore: { advanceForm } } = this.props;
- return isAd ? getSearchs(advanceForm, searchCondition, 2)
- : this.inlineForm = dom}
- taxAgentOption={taxAgentAdminOption}
- onChange={(taxAgentId) => this.specialAddDeductionList({ taxAgentId })}
- />;
- };
- renderImportormComponent = () => {
- const { importParams } = this.state;
- const { taxAgentStore: { taxAgentAdminOption } } = this.props;
- return (
-
-
-
- 个税扣缴义务人
-
- {
- this.setState({ importParams: { ...importParams, payload: { taxAgentId: v } } });
- }}
- />
-
-
- );
- };
-
- handleExportAllSpecialDetail = () => {
- if (!this.handleChangeDebounce) {
- this.handleChangeDebounce = _.debounce(this.handleChange, 500);
- }
- this.handleChangeDebounce();
- };
-
- handleChange = e => {
- const url = `${window.location.origin}/api/bs/hrmsalary/specialAddDeduction/export`;
- window.open(url, "_self");
+ handleExportAllDetail = () => {
+ const { recordPayload } = this.tableRecordRef.state;
+ const exportParams = _.reduce(_.keys(_.omitBy(recordPayload, it => !it)), (pre, cur) => pre + `&${cur}=${recordPayload[cur]}`, "");
+ const payload = `?${exportParams}&ids=`;
+ this.handleExportDetail(payload);
};
render() {
+ const { taxAgentStore: { showOperateBtn }, specialAddStore: { advanceForm } } = this.props;
const {
- advanceParams,
- dataSource,
- columns,
- loading,
- selectedRowKeys,
- pageInfo,
- drawerParams,
- importParams
+ declareMonth, taxAgentId, slidePayload, saveLoading, exportPayloadUrl, advanceCondition,
+ importPayload
} = this.state;
- const { userid } = WeaTools.ls.getJSONObj("theme-account") || {};
- const { taxAgentStore, specialAddStore: { advanceForm, addForm } } = this.props;
- const { showOperateBtn, taxAgentAdminOption } = taxAgentStore;
- const rowSelection = {
- selectedRowKeys,
- onChange: (selectedRowKeys) => this.setState({ selectedRowKeys })
- };
- const customBtns = [
-
- 导出选中
-
- }
- type="primary"
- >
- 导出全部
-
- ];
- const btns = [
- ,
-
- 导出选中
-
- }
- type="ghost"
- >
- 导出全部
- ,
- ,
-
- 删除所选
-
- }
- type="ghost"
- >
- 一键清空
-
- ];
- const pagination = {
- ...pageInfo,
- showTotal: (total) => `共 ${total} 条`,
- pageSizeOptions: ["10", "20", "50", "100"],
- showSizeChanger: true,
- showQuickJumper: true,
- onShowSizeChange: (current, pageSize) => {
- this.setState({
- pageInfo: { ...pageInfo, current, pageSize }
- }, () => {
- this.specialAddDeductionList({
- current,
- pageSize
- });
- });
- },
- onChange: (current) => {
- this.setState({
- pageInfo: { ...pageInfo, current }
- }, () => {
- this.specialAddDeductionList({
- current
- });
- });
- }
- };
- //加载数据
- if (_.isEmpty(columns)) {
- // 无权限处理
- return renderLoading();
- }
+ const tablePayload = { taxAgentId };
return (
-
-
}
- iconBgcolor="#F14A2D"
- buttons={showOperateBtn ? btns : []}
- >
-
-
advanceForm.updateFields({ username: v })}
- onAdReset={() => advanceForm.reset()}
- onAdSearch={() => this.specialAddDeductionList({ current: 1 })}
- onSearch={() => this.specialAddDeductionList({ current: 1 })}
- searchsAdQuick={this.getSearchsAdQuick()}
- searchsAd={this.getSearchsAdQuick(true)}
- setShowSearchAd={bool => this.setState({ advanceParams: { ...advanceParams, visible: bool } })}
- />
-
-
-
-
-
- {
- const { baseInfo } = this.addItemRef.state;
- const bool = _.every(_.pick(baseInfo, ["taxAgentId", "employeeId"]), v => !_.isEmpty(v));
- if (!bool && _.isEmpty(drawerParams.editId)) {
- Modal.warning({
- title: "信息确认",
- content: "必要信息不完整,红色*为必填项!"
- });
- return;
- }
- const payload = {
- ..._.pick(baseInfo, ["taxAgentId", "employeeId", "taxAgentName"]),
- ...addForm.getFormParams()
- };
- this.handleSaveSpecialList(payload);
- }}
- editable={(showOperateBtn && !drawerParams.isView)}
- showOperateBtn={showOperateBtn}
- customOperate={(showOperateBtn && drawerParams.isView) ? customBtns : (!showOperateBtn && userid == drawerParams.editId.employeeId) ? [
-
- ] : []}
- />
- }
- content={
- !drawerParams.isView ?
- this.addItemRef = dom}
- taxAgentOption={taxAgentAdminOption}
- form={addForm}
- isSpecial
- editId={drawerParams.editId}
- condition={condition}
- /> :
- this.specialContentRef = dom} specialId={drawerParams.editId.id}/>
- }
- onClose={() => this.setState({
- drawerParams: {
- ...drawerParams,
- visible: false,
- isView: true,
- editId: {}
- }
- })}
- showMask={true}
- closeMaskOnClick={() => this.setState({
- drawerParams: {
- ...drawerParams,
- visible: false,
- isView: true,
- editId: {}
- }
- })}
- />
- {/*人员卡片*/}
-
- {/* 导入模板*/}
- {
- importParams.visible &&
- this.setState({ importParams: { ...importParams, step } })}
- slideDataSource={importParams.slideDataSource}
- importResult={importParams.importResult}
- onFinish={() => {
- this.setState({ importParams: { ...importParams, step: 0, visible: false } }, () => {
- this.specialAddDeductionList();
- localStorage.removeItem("fileList");
- });
- }}
- previewImport={this.specialAddDeductionPreview}
- importFile={this.specialAddDeductionImportData}
- templateLink="/api/bs/hrmsalary/specialAddDeduction/downloadTemplate"
- renderFormComponent={this.renderImportormComponent}
- visiable={importParams.visible}
- onCancel={() => {
- localStorage.removeItem("fileList");
- this.setState({
- importParams: {
- ...importParams,
- step: 0, visible: false,
- slideDataSource: [], importResult: [],
- payload: { taxAgentId: "" }
- }
- });
- }}
- />
- }
-
-
-
+
+ this.tableRef = dom}
+ url="/api/bs/hrmsalary/specialAddDeduction/list"
+ payload={tablePayload}
+ showOperateBtn={showOperateBtn}
+ onTableOperate={this.handleTableOperate}
+ onViewDetails={(record) => this.handleAddData("专项附加扣除记录", record)}
+ />
+
);
}
}
-export default SpecialAddDeduction;
-
+export default Index;
diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/specialAddDeduction/index.less b/pc4mobx/hrmSalary/pages/dataAcquisition/specialAddDeduction/index.less
deleted file mode 100644
index 18e24685..00000000
--- a/pc4mobx/hrmSalary/pages/dataAcquisition/specialAddDeduction/index.less
+++ /dev/null
@@ -1,98 +0,0 @@
-.specialAddWrapper {
- height: 100%;
-
- .wea-new-top-wapper {
- .specialAddContent {
- height: 100%;
- display: flex;
- flex-direction: column;
- overflow: hidden;
-
- .tableWrapper {
- flex: 1;
- overflow: hidden;
- }
-
- .wea-tab-search-ad-quick {
- .wea-tab-left {
- display: flex;
- align-items: center;
- }
-
- .wea-tab-right {
- margin-top: 0;
- }
-
- .wea-search-container-search-ad-quick {
- top: 47px !important;
- }
- }
- }
- }
-
- .linkWapper {
- a {
- color: #4d7ad8;
- margin-right: 8px;
- }
-
- i {
- cursor: pointer;
- }
-
- a:hover {
- text-decoration: none;
- }
- }
-}
-
-.moreIconWrapper {
- .ant-popover-inner {
- min-width: 106px
- }
-
- .ant-popover-inner-content {
- padding: 0;
-
- .ant-menu {
- .ant-menu-item {
- border-right: none;
- height: 30px;
- line-height: 30px;
- text-align: center;
- padding: 0;
- }
- }
- }
-}
-
-.specialAddSlideWrapper {
- .wea-slide-modal-title {
- height: initial;
- line-height: initial;
- text-align: left;
- }
-
- .rodal-close {
- z-index: 99;
- top: 10px !important;
- }
-
-}
-
-@media (min-width: 1260px) {
- .specialAddSlideWrapper {
- .reqTopWrapper .wea-new-top-req-title > div:first-child > div {
- max-width: 100% !important;
- }
- }
-}
-
-@media screen and (min-width: 1060px) and (max-width: 1260px) {
- .specialAddSlideWrapper {
- .reqTopWrapper .wea-new-top-req-title > div:first-child > div {
- max-width: calc(100% - 96px) !important;
- }
- }
-}
-