方案修改

This commit is contained in:
MustangDeng 2022-04-01 09:28:05 +08:00
parent d964f349f1
commit c3e701f3b6
2 changed files with 23 additions and 5 deletions

View File

@ -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 <a onClick={() => {this.onCustomEdit(record)}}>编辑</a>
case "is_use":
return <Switch checked={text == 1} onChange={(value) => {this.handleCategoryStatusChange(record, value)}}/>
default:
return <div dangerouslySetInnerHTML={{ __html: valueSpan }} />
}

View File

@ -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 {
})
}
}