diff --git a/pc4mobx/hrmSalary/apis/cumDeduct.js b/pc4mobx/hrmSalary/apis/cumDeduct.js index 8d54f306..90057b60 100644 --- a/pc4mobx/hrmSalary/apis/cumDeduct.js +++ b/pc4mobx/hrmSalary/apis/cumDeduct.js @@ -1,5 +1,5 @@ import { WeaTools } from "ecCom"; -import { postFetch } from '../util/request'; +import { postFetch } from "../util/request"; //数据采集-累计专项附加扣除列表 export const getCumDeductList = (params) => { @@ -7,9 +7,9 @@ export const getCumDeductList = (params) => { method: "POST", mode: "cors", headers: { - "Content-Type": "application/json", + "Content-Type": "application/json" }, - body: JSON.stringify(params), + body: JSON.stringify(params) }).then((res) => res.json()); }; @@ -52,9 +52,9 @@ export const getCumDeductDetailList = (params) => { method: "POST", mode: "cors", headers: { - "Content-Type": "application/json", + "Content-Type": "application/json" }, - body: JSON.stringify(params), + body: JSON.stringify(params) }).then((res) => res.json()); }; @@ -62,9 +62,9 @@ export const getCumDeductDetailList = (params) => { export const exportCumDeductDetailList = (id, ids = "") => { fetch( "/api/bs/hrmsalary/addUpDeduction/exportDetail?accumulatedSpecialAdditionalDeductionId=" + - id + - "&ids=" + - ids+ "&taxAgentId=" + taxAgentId + id + + "&ids=" + + ids + "&taxAgentId=" + taxAgentId ).then((res) => res.blob().then((blob) => { var filename = `累计专项附加扣除.xlsx`; @@ -84,9 +84,9 @@ export const importCumDeductParam = (params) => { method: "POST", mode: "cors", headers: { - "Content-Type": "application/json", + "Content-Type": "application/json" }, - body: JSON.stringify(params), + body: JSON.stringify(params) }).then((res) => res.json()); }; @@ -96,34 +96,39 @@ export const importCumDeductPreview = (params) => { method: "POST", mode: "cors", headers: { - "Content-Type": "application/json", + "Content-Type": "application/json" }, - body: JSON.stringify(params), + body: JSON.stringify(params) }).then((res) => res.json()); }; //新增累计专项附加扣除 export const createAddUpDeduction = (params) => { - return postFetch('/api/bs/hrmsalary/addUpDeduction/createAddUpDeduction', params); -} + return postFetch("/api/bs/hrmsalary/addUpDeduction/createAddUpDeduction", params); +}; //查看信息 export const getAddUpDeduction = (params) => { - return postFetch('/api/bs/hrmsalary/addUpDeduction/getAddUpDeduction', params); -} + return postFetch("/api/bs/hrmsalary/addUpDeduction/getAddUpDeduction", params); +}; //编辑累计专项附加扣除 export const editAddUpDeduction = (params) => { - return postFetch('/api/bs/hrmsalary/addUpDeduction/editAddUpDeduction', params); -} + return postFetch("/api/bs/hrmsalary/addUpDeduction/editAddUpDeduction", params); +}; //批量删除累计专项附加扣除 export const deleteSelectAddUpDeduction = (params) => { - return postFetch('/api/bs/hrmsalary/addUpDeduction/deleteSelectAddUpDeduction', params); -} + return postFetch("/api/bs/hrmsalary/addUpDeduction/deleteSelectAddUpDeduction", params); +}; //一键清空累计专项附加扣除 export const deleteAllAddUpDeduction = (params) => { - return postFetch('/api/bs/hrmsalary/addUpDeduction/deleteAllAddUpDeduction', params); -} + return postFetch("/api/bs/hrmsalary/addUpDeduction/deleteAllAddUpDeduction", params); +}; //一键累计 export const autoAddAll = (params) => { - return postFetch('/api/bs/hrmsalary/addUpDeduction/autoAddAll', params); -} + return postFetch("/api/bs/hrmsalary/addUpDeduction/autoAddAll", params); +}; + +//数据采集列表查询 +export const getTableDate = ({ url, ...params }) => { + return postFetch(url, params); +}; diff --git a/pc4mobx/hrmSalary/components/UnifiedTable/index.js b/pc4mobx/hrmSalary/components/UnifiedTable/index.js new file mode 100644 index 00000000..4e6aa12e --- /dev/null +++ b/pc4mobx/hrmSalary/components/UnifiedTable/index.js @@ -0,0 +1,26 @@ +import React, { Component } from "react"; +import { WeaTable } from "ecCom"; +import "./index.less"; + +class Index extends Component { + + render() { + const { columns } = this.props; + const unifiedColumns = _.map(columns, (item, index) => { + if (index === 0 || index === 2) { + return { ...item, fixed: "left", width: 150 }; + } else if (index === 1) { + return { ...item, fixed: "left", width: 176 }; + } + if (item.dataIndex === "operate") { + return { ...item, fixed: "right", width: "120px" }; + } + return { ...item, width: "33%" }; + }); + return ( + + ); + } +} + +export default Index; diff --git a/pc4mobx/hrmSalary/components/UnifiedTable/index.less b/pc4mobx/hrmSalary/components/UnifiedTable/index.less new file mode 100644 index 00000000..e1dbaf1d --- /dev/null +++ b/pc4mobx/hrmSalary/components/UnifiedTable/index.less @@ -0,0 +1,24 @@ +.unifiedTable { + .ellipsis { + display: inline-block; + width: 100%; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + + .linkWapper { + a { + color: #4d7ad8; + margin-right: 8px; + } + + i { + cursor: pointer; + } + + a:hover { + text-decoration: none; + } + } +} diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js index e7cd2ea3..a442c1f9 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js @@ -1,62 +1,118 @@ import React, { Component } from "react"; -import { getCumDeductList } from "../../../apis/cumDeduct"; -import { WeaTable } from "ecCom"; - +import { inject, observer } from "mobx-react"; +import { WeaDatePicker, WeaFormItem, WeaHelpfulTip, WeaSearchGroup, WeaSelect } from "ecCom"; +import { Button, Dropdown, Menu } from "antd"; +import DataTables from "../dataTables"; +import Layout from "../layout"; +import moment from "moment"; +import "../index.less"; +@inject("taxAgentStore") +@observer class Index extends Component { constructor(props) { super(props); this.state = { - columns: [], dataSource: [] + declareMonth: moment(new Date()).format("YYYY-MM"), + taxAgentId: "", + innerWidth: window.innerWidth }; } - componentDidMount() { - this.getCumDeductList(); - } - - getCumDeductList = () => { - getCumDeductList({ declareMonth: ["2023-02"], taxAgentId: "" }).then(res => { - this.setState({ - columns: _.map(res.data.columns, item => { - if (item.dataIndex === "username") { - return { - ...item, - fixed: "left", - width: "20%" - }; - } - if (item.dataIndex === "taxAgentName") { - return { - ...item, - fixed: "left", - width: "25%" - }; - } - if (item.dataIndex === "operate") { - return { - ...item, - fixed: "right", - width: "100px" - }; - } - - return { - ...item, - width: "25%" - }; - }), - dataSource: res.data.list - }); - }); + handleResize = (innerWidth) => this.setState({ innerWidth }); + /* + * 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" + }) + }, + { + com: DataCollectionSelect({ + label: "个税扣缴义务人", + value: taxAgentId, + onChange: this.screenChange, + options: [{ key: "", showname: "全部" }, ...taxAgentOption], + key: "taxAgentId" + }) + } + ]; + return ; + }; + screenChange = ({ key, value }) => { + console.log(key, value); + }; + /* + * Author: 黎永顺 + * Description: 顶部操作按钮 + * Params: + * Date: 2023/2/17 + */ + getTopBtns = () => { + return [ + , + , + , + + 批量删除 + 一键清空 + 导出选中 + 导出全部 + + } + > + + + ]; + }; + handleMenuClick = ({ key }) => { + console.log(key); }; render() { - const { columns, dataSource } = this.state; + const { declareMonth, taxAgentId } = this.state; + const tablePayload = { + declareMonth: [declareMonth], + taxAgentId + }; return ( - + + + ); } } export default Index; + +const DataCollectionDatePicker = (props) => { + const { value, label, onChange, format = "YYYY-MM", key } = props; + return + onChange({ key, value })} format={format}/> + + ; +}; +const DataCollectionSelect = (props) => { + const { value, label, onChange, options, key } = props; + return + onChange({ key, value })} options={options}/> + ; +}; diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/dataTables.js b/pc4mobx/hrmSalary/pages/dataAcquisition/dataTables.js new file mode 100644 index 00000000..674f8399 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/dataTables.js @@ -0,0 +1,112 @@ +/* + * Author: 黎永顺 + * name: 数据采集-列表 + * Description: + * Date: 2023/2/17 + */ +import React, { Component } from "react"; +import { inject, observer } from "mobx-react"; +import UnifiedTable from "../../components/UnifiedTable"; +import { getTableDate } from "../../apis/cumDeduct"; +import { Menu, Popover } from "antd"; + +@inject("taxAgentStore") +@observer +class DataTables extends Component { + constructor(props) { + super(props); + this.state = { + loading: { + query: false + }, + dataSource: [], + columns: [], + selectedRowKeys: [], + pageInfo: { + current: 1, pageSize: 10, total: 0 + } + }; + } + + componentDidMount() { + this.getTableDate(); + } + + getTableDate = () => { + const { loading, pageInfo } = this.state; + const { url, payload } = this.props; + const module = { url, ...payload }; + this.setState({ loading: { ...loading, query: true } }); + getTableDate(module).then(({ status, data }) => { + this.setState({ loading: { ...loading, query: false } }); + if (status) { + const { columns, list: dataSource, pageNum: current, pageSize, total } = data; + this.setState({ + pageInfo: { ...pageInfo, current, pageSize, total }, + dataSource, + columns + }); + } + }).catch(() => this.setState({ loading: { ...loading, query: false } })); + }; + + render() { + const { columns, dataSource, loading } = this.state; + const { taxAgentStore: { showOperateBtn } } = this.props; + return { + 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) => ( +
+ 查看明细 + { + showOperateBtn && + this.handleOperate(e, record)}> + 编辑 + 删除 + } title=""> + + + } +
+ ) + }; + } else { + return { + ...item, + render: (text) => { + return {text} ; + } + }; + } + })} + dataSource={dataSource} + // pagination={pagination} + loading={loading.query} + />; + } +} + +export default DataTables; diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/index.less b/pc4mobx/hrmSalary/pages/dataAcquisition/index.less index b583068d..23d27e5f 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/index.less +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/index.less @@ -1,9 +1,10 @@ -.tipWrapper{ +.tipWrapper { display: flex; flex-direction: column; margin: 0 25px 20px 25px; border: 1px solid #e5e5e5; - .title{ + + .title { border-bottom: 1px solid #e5e5e5; height: 40px; line-height: 40px; @@ -11,7 +12,8 @@ background: #f6f6f6; font-size: 14px; } - .content{ + + .content { width: 100%; display: flex; flex-direction: column; @@ -19,3 +21,50 @@ color: #999; } } + +.layoutWrapper { + height: 100%; + display: flex; + flex-direction: column; + + .wea-tab-left { + min-width: 600px !important; + max-width: 600px !important; + } + + .screenWrapper { + padding: 0; + + .wea-content { + padding: 0; + } + + .wea-form-cell { + padding: 0 16px; + + .wea-date-picker { + width: 85%; + } + } + + .wea-helpful-tip { + padding-left: 10px; + } + } + + .dataContent { + flex: 1; + overflow: hidden; + } + +} + +//下拉框菜单样式 +.dropdownMenuWrapper { + .ant-menu-item { + border-right: none; + padding: 0 16px; + height: 30px; + line-height: 30px; + } +} diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/layout.js b/pc4mobx/hrmSalary/pages/dataAcquisition/layout.js new file mode 100644 index 00000000..a5eca7ad --- /dev/null +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/layout.js @@ -0,0 +1,61 @@ +/* + * Author: 黎永顺 + * name: 数据采集-组件框 + * Description: + * Date: 2023/2/17 + */ +import React, { Component } from "react"; +import { inject, observer } from "mobx-react"; +import { WeaNewScroll, WeaTab, WeaTop } from "ecCom"; +import "./index.less"; + +@inject("taxAgentStore") +@observer +class Layout extends Component { + constructor(props) { + super(props); + this.state = { + showSearchAd: false + }; + } + + componentDidMount() { + const { taxAgentStore: { fetchTaxAgentOption } } = this.props; + fetchTaxAgentOption(); + window.addEventListener("resize", this.resizeUpdate); + } + + componentWillUnmount() { + window.removeEventListener("resize", this.resizeUpdate); + } + + resizeUpdate = () => { + const { onResizeWindowInnerWidth } = this.props; + onResizeWindowInnerWidth(window.innerWidth); + }; + + render() { + const { showSearchAd } = this.state; + const { title, btns, leftComp, children, taxAgentStore: { showOperateBtn } } = this.props; + return ( +
+ } + iconBgcolor="#F14A2D" showDropIcon={false} + /> + 1111} + showSearchAd={showSearchAd} + setShowSearchAd={bool => this.setState({ showSearchAd: bool })} + /> +
+ {children} +
+
+ ); + } +} + +export default Layout;