From 1cf526c9948eaaacd8ec45d2ebb23778d91f682a Mon Sep 17 00:00:00 2001 From: MustangDeng <670124965@qq.com> Date: Tue, 8 Mar 2022 16:07:27 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B4=AF=E8=AE=A1=E4=B8=93=E9=A1=B9=E9=99=84?= =?UTF-8?q?=E5=8A=A0=E6=89=A3=E9=99=A4=E9=A1=B5=E9=9D=A2=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/apis/cumDeduct.js | 9 +- pc4mobx/hrmSalary/apis/taxAgent.js | 2 +- .../pages/dataAcquisition/cumDeduct/index.js | 90 ++++++++++++++++--- .../dataAcquisition/cumDeduct/index.less | 31 +++++++ pc4mobx/hrmSalary/stores/cumDeduct.js | 68 ++++++++++++++ pc4mobx/hrmSalary/stores/index.js | 4 +- pc4mobx/hrmSalary/stores/taxAgent.js | 10 ++- 7 files changed, 200 insertions(+), 14 deletions(-) create mode 100644 pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.less create mode 100644 pc4mobx/hrmSalary/stores/cumDeduct.js diff --git a/pc4mobx/hrmSalary/apis/cumDeduct.js b/pc4mobx/hrmSalary/apis/cumDeduct.js index c10874e3..3e234938 100644 --- a/pc4mobx/hrmSalary/apis/cumDeduct.js +++ b/pc4mobx/hrmSalary/apis/cumDeduct.js @@ -2,7 +2,14 @@ import { WeaTools } from 'ecCom'; //数据采集-累计专项附加扣除列表 export const getCumDeductList = params => { - return WeaTools.callApi('/api/bs/hrmsalary/addUpDeduction/list', 'POST', params); + return fetch('/api/bs/hrmsalary/addUpDeduction/list', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }).then(res => res.json()) } //数据采集-累计专项附加扣除列表的高级搜索 diff --git a/pc4mobx/hrmSalary/apis/taxAgent.js b/pc4mobx/hrmSalary/apis/taxAgent.js index 6849dae8..b475c216 100644 --- a/pc4mobx/hrmSalary/apis/taxAgent.js +++ b/pc4mobx/hrmSalary/apis/taxAgent.js @@ -35,5 +35,5 @@ export const deleteTaxAgent = params => { //个税扣缴义务人下拉列表 export const getTaxAgentSelectList = params => { - return WeaTools.callApi('/api/bs/hrmsalary/taxAgent/selectList', 'POST', params); + return WeaTools.callApi('/api/bs/hrmsalary/taxAgent/selectList', 'GET', params); } \ No newline at end of file diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js index 7e05edd1..96b5d0fe 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js @@ -4,19 +4,22 @@ import { toJS } from 'mobx'; import { Button, Table, DatePicker, Dropdown, Menu, Modal } from 'antd'; -import { WeaTop, WeaTab, WeaRightMenu, WeaRangePicker, WeaTable } from 'ecCom'; +import { WeaTop, WeaTab, WeaRightMenu, WeaRangePicker, WeaDatePicker, WeaSelect, WeaHelpfulTip } from 'ecCom'; +import { WeaTableNew } from "comsMobx" + +const WeaTable = WeaTableNew.WeaTable; import { renderNoright, getSearchs } from '../../../util'; // 渲染form数据的方法:因为多个页面都会使用,所以抽的公共方法在util中 import CustomTab from '../../../components/customTab'; import ContentWrapper from '../../../components/contentWrapper'; import ImportModal from '../../../components/importModal' - - import { columns, dataSource } from './columns'; const { MonthPicker } = DatePicker; -@inject('baseTableStore') +import "./index.less" + +@inject('cumDeductStore', "taxAgentStore") @observer export default class CumDeduct extends React.Component { constructor(props) { @@ -24,16 +27,62 @@ export default class CumDeduct extends React.Component { this.state = { value: "", selectedKey: "0", - visiable: true + visiable: false, + monthValue: "", + taxAgentId: "" } } - + componentWillMount() { // 初始化渲染页面 + const { cumDeductStore: { doInit }, taxAgentStore: {fetchTaxAgentOption} } = this.props; + doInit(); + fetchTaxAgentOption(); + } + + getSearchsAdQuick() { + const { monthValue, taxAgentId } = this.state; + const { taxAgentStore: {taxAgentOption }} = this.props; + return ( +
+
+ 申报月份: + this.setState({ monthValue: value })} + /> +
+ +
+ +
+ +
+ 个税扣缴义务人: + { + this.setState({ taxAgentId: v }); + }} + /> +
+
+ ) + } render() { - const { baseTableStore } = this.props; - const { loading, hasRight, form, condition, tableStore, showSearchAd, getTableDatas, doSearch, setShowSearchAd } = baseTableStore; - + const { cumDeductStore, taxAgentStore } = this.props; + const { loading, hasRight, form, condition, tableStore, showSearchAd, getTableDatas, doSearch, setShowSearchAd } = cumDeductStore; + const { taxAgentOption } = taxAgentStore + if (!hasRight && !loading) { // 无权限处理 return renderNoright(); } @@ -93,6 +142,8 @@ export default class CumDeduct extends React.Component { ] + + return (
- + +
+ + setShowSearchAd(bool)} //高级搜索面板受控 + searchsAd={getSearchs(form, toJS(condition), 2)} // 高级搜索内部数据 + buttonsAd={adBtn} // 高级搜索内部按钮 + onSearch={getTableDatas} // 点搜索按钮时的回调 + searchsAdQuick={this.getSearchsAdQuick()} + onSearchChange={v => form.updateFields({ username: v })} // 在搜索框中输入的文字改变时的回调: 这里需要同步高级搜索和外部搜索框的值 + searchsBaseValue={form.getFormParams().username} // 外部input搜索值受控: 这里和高级搜索的requestname同步 + /> +
+
{this.setState({visiable: false})}}/> diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.less b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.less new file mode 100644 index 00000000..9663398d --- /dev/null +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.less @@ -0,0 +1,31 @@ +.cumDeductWrapper { + .weaTabWrapper { + position: relative; + .searchConditionWrapper { + width: 600px; + margin-left: 10px; + margin-top: 8px; + } + .searchConditionItem { + float: left; + } + .conditionFormLabel { + margin-right: 10px; + } + .helperWrapper { + float: left; + margin-left: 10px; + margin-right: 10px; + margin-top: 6px; + } + } + + .wea-tab-search-ad-quick { + .wea-tab-right-search-ad-quick { + margin-top: 0px; + } + .wea-search-container-search-ad-quick { + top: 46px; + } + } +} \ No newline at end of file diff --git a/pc4mobx/hrmSalary/stores/cumDeduct.js b/pc4mobx/hrmSalary/stores/cumDeduct.js new file mode 100644 index 00000000..c2669f38 --- /dev/null +++ b/pc4mobx/hrmSalary/stores/cumDeduct.js @@ -0,0 +1,68 @@ +import { observable, action, toJS } from 'mobx'; +import { message } from 'antd'; +import { WeaForm, WeaTableNew } from 'comsMobx'; + +import * as API from '../apis/cumDeduct'; // 引入API接口文件 +import * as TaxAgentApi from '../apis/taxAgent' + +const { TableStore } = WeaTableNew; + +export class CumDeductStore { + @observable tableStore = new TableStore(); // new table + @observable form = new WeaForm(); // nrew 一个form + @observable condition = []; // 存储后台得到的form数据 + @observable hasRight = true; // 判断用户是有权限查看当前页面: 没有权限渲染无权限页面,有权限渲染数据 + @observable showSearchAd = false; // 高级搜索面板显示 + @observable loading = true; // 数据加载状态 + + + // 初始化操作 + @action + doInit = () => { + this.getCondition(); + this.getTableDatas(); + } + + // 获得高级搜索表单数据 + @action + getCondition = () => { + API.getCumDeductSaCondition().then(action(res => { + if (res.status) { // 接口请求成功/失败处理 + this.condition = res.data.condition; + this.form.initFormFields(res.data.condition); // 渲染高级搜索form表单 + } else { + message.error(res.msg || '接口调用失败!') + } + })); + } + + // 渲染table数据 + @action + getTableDatas = (toFirstPage = true) => { + this.loading = true; + let params = this.form.getFormParams() || {}; + API.getCumDeductList(params).then(action(res => { + if (res.status) { // 接口请求成功/失败处理 + toFirstPage ? this.tableStore.getDatas(res.data.datas, 1) : this.tableStore.getDatas(res.data.datas); // table 请求数据 + } else { + message.error(res.msg || '接口调用失败!') + } + this.loading = false; + })); + } + + @action + setShowSearchAd = bool => this.showSearchAd = bool; + + // 高级搜索 - 搜索 + @action doSearch = () => { + this.getTableDatas(); + this.showSearchAd = false; + } + + + + + + +} \ No newline at end of file diff --git a/pc4mobx/hrmSalary/stores/index.js b/pc4mobx/hrmSalary/stores/index.js index 1d15bd4e..cbe7f65a 100644 --- a/pc4mobx/hrmSalary/stores/index.js +++ b/pc4mobx/hrmSalary/stores/index.js @@ -4,12 +4,14 @@ import { MySalaryStore } from'./mySalary'; import { TaxAgentStore } from './taxAgent'; import { BaseFormStore } from './baseForm'; import { taxRateStore } from './taxRate'; +import { CumDeductStore } from "./cumDeduct" module.exports = { baseFormStore: new BaseFormStore(), baseTableStore: new BaseTableStore(), mySalaryStore: new MySalaryStore(), taxAgentStore: new TaxAgentStore(), - taxRateStore: new taxRateStore() + taxRateStore: new taxRateStore(), + cumDeductStore: new CumDeductStore() }; diff --git a/pc4mobx/hrmSalary/stores/taxAgent.js b/pc4mobx/hrmSalary/stores/taxAgent.js index fcc62773..c0a26995 100644 --- a/pc4mobx/hrmSalary/stores/taxAgent.js +++ b/pc4mobx/hrmSalary/stores/taxAgent.js @@ -21,7 +21,7 @@ export class TaxAgentStore { @observable columns = []; @observable dataSource = []; - + @observable taxAgentOption = []; // 个税扣缴义务人 @action @@ -118,5 +118,13 @@ export class TaxAgentStore { } }) } + + @action fetchTaxAgentOption = () => { + API.getTaxAgentSelectList().then(action(res => { + if(res.status) { + this.taxAgentOption = res.data.list.map(item => {return {key: item.id, showname: item.content}}) + } + })) + } } \ No newline at end of file