From c3e701f3b6501fe79760a22819b809aba262e20c Mon Sep 17 00:00:00 2001 From: MustangDeng <670124965@qq.com> Date: Fri, 1 Apr 2022 09:28:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B9=E6=A1=88=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../socialSecurityBenefits/programme/index.js | 18 +++++++++++++++++- pc4mobx/hrmSalary/stores/programme.js | 10 ++++++---- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/index.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/index.js index 95d69883..21bf0e1a 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/index.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/index.js @@ -2,7 +2,7 @@ import React from 'react'; import { inject, observer } from 'mobx-react'; import { toJS } from 'mobx'; -import { Button, Table, DatePicker, Row, Col } from 'antd'; +import { Button, Table, DatePicker, Row, Col, Switch, Modal } from 'antd'; import { WeaTop, WeaTab, WeaRightMenu, WeaRangePicker, WeaInputSearch, WeaSlideModal, WeaSelect } from 'ecCom'; @@ -73,6 +73,20 @@ export default class Programme extends React.Component { return newColumns; } + handleCategoryStatusChange(record, value) { + const {programmeStore: { updateCustomCategoryStatus }} = this.props; + Modal.confirm({ + title: '信息确认', + content: `确认要${value ? '启用' : '停用'}吗`, + onOk:() => { + updateCustomCategoryStatus(record.id, value) + }, + onCancel: () => { + + }, + }); + } + getCustomColumns = (columns) => { let newColumns = ''; newColumns = columns.map(column => { @@ -82,6 +96,8 @@ export default class Programme extends React.Component { switch(newColumn.dataIndex) { case "operate": return {this.onCustomEdit(record)}}>编辑 + case "is_use": + return {this.handleCategoryStatusChange(record, value)}}/> default: return
} diff --git a/pc4mobx/hrmSalary/stores/programme.js b/pc4mobx/hrmSalary/stores/programme.js index a60cc31e..f81a5652 100644 --- a/pc4mobx/hrmSalary/stores/programme.js +++ b/pc4mobx/hrmSalary/stores/programme.js @@ -203,7 +203,12 @@ export class ProgrammeStore { // 自定义福利启用、停用 @action - updateCustomCategoryStatus = (params) => { + updateCustomCategoryStatus = (id, isUse) => { + + let params = { + id, + isUse: isUse ? 1 : 0 + } API.updateCustomCategoryStatus(params).then(res => { if(res.status) { message.success("修改成功") @@ -214,7 +219,4 @@ export class ProgrammeStore { }) } - - - } \ No newline at end of file