From f61c4bfbb0bc95c5c01a9af0194ee888d8f57ecc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Thu, 9 Feb 2023 17:24:51 +0800 Subject: [PATCH] =?UTF-8?q?=E8=96=AA=E8=B5=84=E9=A1=B9=E7=9B=AE=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E9=A1=B5=E9=9D=A2=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/pages/salaryItem/columns.js | 2 +- .../pages/salaryItem/salaryItemForm.js | 68 ++++++++++++++++--- 2 files changed, 58 insertions(+), 12 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/salaryItem/columns.js b/pc4mobx/hrmSalary/pages/salaryItem/columns.js index ccf8083b..a23f2db3 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/columns.js +++ b/pc4mobx/hrmSalary/pages/salaryItem/columns.js @@ -85,7 +85,7 @@ export const salaryItemFields = [ key: 'taxAgentIds', label: '可见性范围', type: 'SELECT', - viewAttr: 2, + viewAttr: 3, tip: '' }, { diff --git a/pc4mobx/hrmSalary/pages/salaryItem/salaryItemForm.js b/pc4mobx/hrmSalary/pages/salaryItem/salaryItemForm.js index c0b2fef1..2b3d8dcc 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/salaryItemForm.js +++ b/pc4mobx/hrmSalary/pages/salaryItem/salaryItemForm.js @@ -9,23 +9,69 @@ import { WeaCheckbox, WeaFormItem, WeaInput, WeaSearchGroup, WeaSelect, WeaTexta import { salaryItemFields, valTakeOptions } from "./columns"; class SalaryItemForm extends Component { + constructor(props) { + super(props); + this.state = { + salaryItemFieldsList: salaryItemFields + }; + } + + componentDidMount() { + const { salaryItemFieldsList } = this.state; + const { request, isAdd } = this.props; + const { systemType, sharedType, valueType } = request; + console.log(this.state.salaryItemFieldsList, this.props); + this.setState({ + salaryItemFieldsList: _.map(salaryItemFieldsList, item => { + const { key } = item; + switch (key) { + case "sharedType": + return { ...item, display: systemType.toString() === "0" || isAdd }; + case "taxAgentIds": + return { ...item, display: sharedType === "1" }; + case "formulaContent": + return { ...item, display: valueType === "2" || valueType === "3" }; + default: + break; + } + return { ...item }; + }) + }); + } + render() { - const { userStatusList } = this.props; + const { userStatusList, request } = this.props; + const { salaryItemFieldsList } = this.state; return ( { - _.map(salaryItemFields, item => { - const { key, label, type, viewAttr, tip, options } = item; - return + _.map(salaryItemFieldsList, item => { + const { key, label, type, viewAttr, tip, options, display = true } = item; + const value = request[key] ? request[key].toString() : ""; + return { - type === "INPUT" ? : - type === "SWITCH" ? : - type === "SELECT" ? - : - type === "RADIO" ? : - type === "TEXTAREA" ? : null + (type === "INPUT" && display) ? + + : + (type === "SWITCH" && display) ? + + + : + (type === "SELECT" && display) ? + + + : + (type === "RADIO" && display) ? + + + : + (type === "TEXTAREA" && display) ? + + : null } - ; + ; }) }