From 1823149ae24a8f45a3219ea71f8d72a221c772e0 Mon Sep 17 00:00:00 2001 From: MustangDeng <670124965@qq.com> Date: Tue, 24 May 2022 23:55:12 +0800 Subject: [PATCH] =?UTF-8?q?bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../importModal/selectFieldModal.js | 56 ++++++- .../pages/calculateDetail/salaryDetail.js | 7 +- .../pages/salaryFile/salaryItemChangeList.js | 4 +- .../socialSecurityBenefits/archives/index.js | 1 - pc4mobx/hrmSalary/stores/archives.js | 6 +- pc4mobx/hrmSalary/stores/cumDeduct.js | 6 +- pc4mobx/hrmSalary/stores/cumSituation.js | 6 +- pc4mobx/hrmSalary/stores/otherDeduct.js | 6 +- pc4mobx/hrmSalary/util/index.js | 84 ++++++++++ pc4mobx/hrmSalary/util/index2.js | 150 ------------------ pc4mobx/hrmSalary/util/response.js | 26 +++ 11 files changed, 183 insertions(+), 169 deletions(-) delete mode 100644 pc4mobx/hrmSalary/util/index2.js create mode 100644 pc4mobx/hrmSalary/util/response.js diff --git a/pc4mobx/hrmSalary/pages/calculateDetail/acctResult/importModal/selectFieldModal.js b/pc4mobx/hrmSalary/pages/calculateDetail/acctResult/importModal/selectFieldModal.js index 865ada7d..f96561ed 100644 --- a/pc4mobx/hrmSalary/pages/calculateDetail/acctResult/importModal/selectFieldModal.js +++ b/pc4mobx/hrmSalary/pages/calculateDetail/acctResult/importModal/selectFieldModal.js @@ -40,20 +40,24 @@ export default class SelectFieldModal extends React.Component { // 公式项改变 handleFormalChange(item, value, flag) { item.checked = value == 1 ? true: false + let fieldData = {...this.state.fieldData} if(flag) { // 公式项 - this.fieldData.formulaItems.map(fieldItem => { + fieldData.formulaItems.map(fieldItem => { if(item.salaryItemId == fieldItem.salaryItemId) { fieldItem.checked = item.checked } }) } else { // 输入项 - this.fieldData.inputItems.map(fieldItem => { + fieldData.inputItems.map(fieldItem => { if(item.salaryItemId == fieldItem.salaryItemId) { fieldItem.checked = item.checked } }) } - + this.setState({ + fieldData + }) + this.fieldData = fieldData } // 添加按钮点击回调 @@ -62,6 +66,46 @@ export default class SelectFieldModal extends React.Component { this.props.onCancel() } + // 标题checkbox点击 + handleTitleCheckboxChange(value, flag) { + let checked = value == 1 ? true: false + let fieldData = {...this.state.fieldData} + if(flag === 'formula') { + fieldData.formulaItems.map(fieldItem => { + fieldItem.checked = checked + }) + } else if(flag === "input") { + fieldData.inputItems.map(fieldItem => { + fieldItem.checked = checked + }) + } + this.setState({ + fieldData + }) + + this.fieldData = fieldData; + } + + // 只显示已选中 + showSelectedChange(value) { + let checked = value == 1 ? true: false + let fieldData = {...this.fieldData} + if(checked) { + if(fieldData.formulaItems) { + fieldData.formulaItems = fieldData.formulaItems.filter(fieldItem => fieldItem.checked) + } + if(fieldData.inputItems) { + fieldData.inputItems = fieldData.inputItems.filter(fieldItem => fieldItem.checked) + } + } + + this.setState({ + fieldData + }) + } + + + render() { const { fieldData } = this.state; return ( @@ -74,7 +118,7 @@ export default class SelectFieldModal extends React.Component {
- + {this.handleTitleCheckboxChange(value, "formula")}}/>
@@ -89,7 +133,7 @@ export default class SelectFieldModal extends React.Component {
- + {this.handleTitleCheckboxChange(value, "input")}}/>
@@ -103,7 +147,7 @@ export default class SelectFieldModal extends React.Component {
- + {this.showSelectedChange(value)}}/>
) diff --git a/pc4mobx/hrmSalary/pages/calculateDetail/salaryDetail.js b/pc4mobx/hrmSalary/pages/calculateDetail/salaryDetail.js index b419d14d..3f321af3 100644 --- a/pc4mobx/hrmSalary/pages/calculateDetail/salaryDetail.js +++ b/pc4mobx/hrmSalary/pages/calculateDetail/salaryDetail.js @@ -67,13 +67,17 @@ export default class SalaryDetail extends React.Component { result.oldWidth = result.width; result.width = "150px"; if(result.children) { - result.width = null; + result.width = (result.children.length * 150) + "px"; result.children.map(child => { child.title = child.text child.dataIndex = child.column child.width = "150px"; }) } + + if(result.dataIndex === "taxAgentName" || result.dataIndex === "username" || result.dataIndex === "departmentName") { + result.fixed = "left" + } return result; }) columns.push({ @@ -84,7 +88,6 @@ export default class SalaryDetail extends React.Component { return {this.handleEdit(record)}}>编辑 } }) - console.log("columns: ", columns); return columns; } diff --git a/pc4mobx/hrmSalary/pages/salaryFile/salaryItemChangeList.js b/pc4mobx/hrmSalary/pages/salaryFile/salaryItemChangeList.js index 76aba627..8b399f57 100644 --- a/pc4mobx/hrmSalary/pages/salaryFile/salaryItemChangeList.js +++ b/pc4mobx/hrmSalary/pages/salaryFile/salaryItemChangeList.js @@ -57,8 +57,8 @@ export default class SalaryItemChangeList extends React.Component { // 页面跳转 handlePageChange(value) { this.searchParams.current = value - const { salaryFileStore: {singleSalaryItemList} } = this.props; - singleSalaryItemList(this.searchParams) + const { salaryFileStore: {fetchSingleSalaryItemList} } = this.props; + fetchSingleSalaryItemList(this.searchParams) } render() { diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/index.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/index.js index b8eb29e0..b09f48b2 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/index.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/index.js @@ -246,7 +246,6 @@ export default class Archives extends React.Component { // getColumns={this.getColumns} // onOperatesClick={this.onOperatesClick.bind(this)} /> */} - { API.getCondition().then(action(res => { if (res.status) { // 接口请求成功/失败处理 - this.condition = res.data.condition; - this.form.initFormFields(res.data.condition); // 渲染高级搜索form表单 + let condition = removePropertyCondition(res.data.condition) + this.condition = condition; + this.form.initFormFields(condition); // 渲染高级搜索form表单 } else { message.error(res.msg || '接口调用失败!') } diff --git a/pc4mobx/hrmSalary/stores/cumDeduct.js b/pc4mobx/hrmSalary/stores/cumDeduct.js index f9c99fcc..42ba3d22 100644 --- a/pc4mobx/hrmSalary/stores/cumDeduct.js +++ b/pc4mobx/hrmSalary/stores/cumDeduct.js @@ -4,6 +4,7 @@ import { WeaForm, WeaTableNew } from 'comsMobx'; import * as API from '../apis/cumDeduct'; // 引入API接口文件 import * as TaxAgentApi from '../apis/taxAgent' +import { removePropertyCondition } from '../util/response'; const { TableStore } = WeaTableNew; @@ -62,8 +63,9 @@ export class CumDeductStore { getCondition = () => { API.getCumDeductSaCondition().then(action(res => { if (res.status) { // 接口请求成功/失败处理 - this.condition = res.data.condition; - this.form.initFormFields(res.data.condition); // 渲染高级搜索form表单 + let condition = removePropertyCondition(res.data.condition) + this.condition = condition; + this.form.initFormFields(condition); // 渲染高级搜索form表单 } else { message.error(res.errormsg || '接口调用失败!') } diff --git a/pc4mobx/hrmSalary/stores/cumSituation.js b/pc4mobx/hrmSalary/stores/cumSituation.js index f3361912..39229018 100644 --- a/pc4mobx/hrmSalary/stores/cumSituation.js +++ b/pc4mobx/hrmSalary/stores/cumSituation.js @@ -1,6 +1,7 @@ import { observable, action, toJS } from 'mobx'; import { message } from 'antd'; import { WeaForm, WeaTableNew } from 'comsMobx'; +import { removePropertyCondition } from '../util/response'; import * as API from '../apis/cumSituation'; // 引入API接口文件 import * as TaxAgentApi from '../apis/taxAgent' @@ -60,8 +61,9 @@ export class CumSituationStore { getCondition = () => { API.getCumSituationSaCondition().then(action(res => { if (res.status) { // 接口请求成功/失败处理 - this.condition = res.data.condition; - this.form.initFormFields(res.data.condition); // 渲染高级搜索form表单 + let condition = removePropertyCondition(res.data.condition) + this.condition = condition; + this.form.initFormFields(condition); // 渲染高级搜索form表单 } else { message.error(res.errormsg || '接口调用失败!') } diff --git a/pc4mobx/hrmSalary/stores/otherDeduct.js b/pc4mobx/hrmSalary/stores/otherDeduct.js index 86f9ba08..c2af08f1 100644 --- a/pc4mobx/hrmSalary/stores/otherDeduct.js +++ b/pc4mobx/hrmSalary/stores/otherDeduct.js @@ -1,6 +1,7 @@ import { observable, action, toJS } from 'mobx'; import { message } from 'antd'; import { WeaForm, WeaTableNew } from 'comsMobx'; +import { removePropertyCondition } from '../util/response'; import * as API from '../apis/otherDeduct'; // 引入API接口文件 import * as TaxAgentApi from '../apis/taxAgent' @@ -61,8 +62,9 @@ export class OtherDeductStore { getCondition = () => { API.getOtherDeductSaCondition().then(action(res => { if (res.status) { // 接口请求成功/失败处理 - this.condition = res.data.condition; - this.form.initFormFields(res.data.condition); // 渲染高级搜索form表单 + let condition = removePropertyCondition(res.data.condition) + this.condition = condition; + this.form.initFormFields(condition); // 渲染高级搜索form表单 } else { message.error(res.errormsg || '接口调用失败!') } diff --git a/pc4mobx/hrmSalary/util/index.js b/pc4mobx/hrmSalary/util/index.js index 6aef0a40..f74d1172 100644 --- a/pc4mobx/hrmSalary/util/index.js +++ b/pc4mobx/hrmSalary/util/index.js @@ -3,11 +3,95 @@ import { WeaSwitch } from 'comsMobx'; import { WeaLocaleProvider, WeaAlertPage, WeaSearchGroup, WeaFormItem } from 'ecCom'; const getLabel = WeaLocaleProvider.getLabel; +// 渲染form表单: 一般对form的渲染都统一使用该方法 +export const getCustomSearchs = (form, condition, col, isCenter) => { + const { isFormInit } = form; + const formParams = form.getFormParams(); + let items = []; + let group = []; + isFormInit && condition && + condition.map(c =>{ + c.items.map(fields => { + items.push({ + com:( + + + ), + colSpan:1, + }) + }); + }); + + if(items.length > 0) { + group.push( + ) + return group; + } +} + +// 渲染form表单: 一般对form的渲染都统一使用该方法 +// export const getSearchs = (form, condition, col, isCenter) => { +// const { isFormInit } = form; +// const formParams = form.getFormParams(); +// let group = []; +// isFormInit && condition && condition.map(c =>{ +// let items = []; +// c.items.map(fields => { +// items.push({ +// com:( +// +// +// ), +// colSpan:1, +// }) +// }); +// group.push( +// ) +// }); +// return group; +// } + // 渲染form表单: 一般对form的渲染都统一使用该方法 export const getSearchs = (form, condition, col, isCenter) => { const { isFormInit } = form; const formParams = form.getFormParams(); + console.log("formParams: ", formParams); let group = []; + console.log("condition:", condition); isFormInit && condition && condition.map(c =>{ let items = []; c.items.map(fields => { diff --git a/pc4mobx/hrmSalary/util/index2.js b/pc4mobx/hrmSalary/util/index2.js deleted file mode 100644 index bf81e977..00000000 --- a/pc4mobx/hrmSalary/util/index2.js +++ /dev/null @@ -1,150 +0,0 @@ -import { Spin } from 'antd'; -import { WeaSwitch } from 'comsMobx'; -import { WeaLocaleProvider, WeaAlertPage, WeaSearchGroup, WeaFormItem } from 'ecCom'; -const getLabel = WeaLocaleProvider.getLabel; - -// 渲染form表单: 一般对form的渲染都统一使用该方法 -export const getCustomSearchs = (form, condition, col, isCenter) => { - const { isFormInit } = form; - const formParams = form.getFormParams(); - let items = []; - let group = []; - isFormInit && condition && - condition.map(c =>{ - c.items.map(fields => { - items.push({ - com:( - - - ), - colSpan:1, - }) - }); - }); - - if(items.length > 0) { - group.push( - ) - return group; - } -} - -// 渲染form表单: 一般对form的渲染都统一使用该方法 -// export const getSearchs = (form, condition, col, isCenter) => { -// const { isFormInit } = form; -// const formParams = form.getFormParams(); -// let group = []; -// isFormInit && condition && condition.map(c =>{ -// let items = []; -// c.items.map(fields => { -// items.push({ -// com:( -// -// -// ), -// colSpan:1, -// }) -// }); -// group.push( -// ) -// }); -// return group; -// } - -// 渲染form表单: 一般对form的渲染都统一使用该方法 -export const getSearchs = (form, condition, col, isCenter) => { - const { isFormInit } = form; - const formParams = form.getFormParams(); - let group = []; - isFormInit && condition && condition.map(c =>{ - let items = []; - c.items.map(fields => { - items.push({ - com:( - - - ), - colSpan:1, - }) - }); - group.push( - ) - }); - return group; -} - -// 页面加载中效果处理 -export const renderLoading = (loading) => ( -
- -
-) - -// 无权限处理 -export const renderNoright = () => ( - -
- {getLabel(2012,'对不起,您暂时没有权限!')} -
-
-) - -// 暂无数据处理 -export const renderNoData = () => ( - -
- 暂无数据 -
-
-) \ No newline at end of file diff --git a/pc4mobx/hrmSalary/util/response.js b/pc4mobx/hrmSalary/util/response.js new file mode 100644 index 00000000..d93d6fab --- /dev/null +++ b/pc4mobx/hrmSalary/util/response.js @@ -0,0 +1,26 @@ +/** + * 删除属性为空的属性 + * @param {*} obj + * @returns + */ +export const removeProperty = (obj) => { + Object.keys(obj).forEach(item => { + if (obj[item] === undefined || obj[item] === null || obj[item] === 'null') delete obj[item] + }) + return obj +} + +/** + * condition删除为空的属性 + */ +export const removePropertyCondition = (condition) => { + condition.forEach(group => { + group.items && group.items.forEach(item => { + removeProperty(item) + if(item.browserConditionParam) { + removeProperty(item.browserConditionParam) + } + }) + }) + return condition +} \ No newline at end of file