|
@@ -1,6 +1,6 @@
|
|
|
import { useAjax } from "@/Hook/useAjax"
|
|
|
import { getPackLinkCodeListApi, GetPackLinkCodeListProps, updatePackLinkCodeApi } from "@/services/gameData/roleOperate"
|
|
|
-import { Button, Col, DatePicker, Form, Input, message, Modal, Row, Select, Space } from "antd"
|
|
|
+import { Button, Col, DatePicker, Form, Input, message, Modal, Popconfirm, Row, Space } from "antd"
|
|
|
import React, { useEffect, useState } from "react"
|
|
|
import style from '../../components/TableData/index.less'
|
|
|
import moment from "moment"
|
|
@@ -56,10 +56,10 @@ const LinkCode: React.FC<Props> = ({ data, visible, onClose }) => {
|
|
|
}, [queryFrom])
|
|
|
|
|
|
|
|
|
- const handleEnabled = (checked: boolean) => {
|
|
|
- updatePackLinkCode.run({ ids: selectedRows.map(item => item.id), enabled: checked }).then(res => {
|
|
|
+ const handleEnabled = () => {
|
|
|
+ updatePackLinkCode.run({ ids: selectedRows.map(item => item.id), linkId: data.id }).then(res => {
|
|
|
if (res) {
|
|
|
- message.success('修改成功')
|
|
|
+ message.success('删除成功')
|
|
|
getPackLinkCodeList.refresh()
|
|
|
setSelectedRows([])
|
|
|
}
|
|
@@ -71,8 +71,13 @@ const LinkCode: React.FC<Props> = ({ data, visible, onClose }) => {
|
|
|
<strong>{data?.gameName}({data?.codeTypeName}) 链接礼包码</strong>
|
|
|
<a onClick={() => { setaddCodeVisible(true); }}>新增礼包码</a>
|
|
|
{selectedRows?.length > 0 && <>
|
|
|
- <a style={{ color: '#52C41A' }} onClick={() => handleEnabled(true)}>修改为可用</a>
|
|
|
- <a style={{ color: 'red' }} onClick={() => handleEnabled(false)}>修改为不可用</a>
|
|
|
+
|
|
|
+ <Popconfirm
|
|
|
+ title="确定删除?"
|
|
|
+ onConfirm={() => handleEnabled()}
|
|
|
+ >
|
|
|
+ <a style={{ color: 'red' }}>删除</a>
|
|
|
+ </Popconfirm>
|
|
|
</>}
|
|
|
</Space>}
|
|
|
visible={visible}
|
|
@@ -86,7 +91,7 @@ const LinkCode: React.FC<Props> = ({ data, visible, onClose }) => {
|
|
|
<Col><Form.Item name='code'>
|
|
|
<Input placeholder="礼包码" allowClear style={{ width: 120 }} />
|
|
|
</Form.Item></Col>
|
|
|
- <Col><Form.Item name='enabled'>
|
|
|
+ {/* <Col><Form.Item name='enabled'>
|
|
|
<Select
|
|
|
showSearch
|
|
|
style={{ width: 120 }}
|
|
@@ -99,7 +104,7 @@ const LinkCode: React.FC<Props> = ({ data, visible, onClose }) => {
|
|
|
<Select.Option value={1}>是</Select.Option>
|
|
|
<Select.Option value={0}>否</Select.Option>
|
|
|
</Select>
|
|
|
- </Form.Item></Col>
|
|
|
+ </Form.Item></Col> */}
|
|
|
<Col><Form.Item name='createTime'>
|
|
|
<DatePicker.RangePicker style={{ width: 250 }} placeholder={['创建时间开始', '创建时间结束']} />
|
|
|
</Form.Item></Col>
|
|
@@ -122,7 +127,7 @@ const LinkCode: React.FC<Props> = ({ data, visible, onClose }) => {
|
|
|
sortDirections={['ascend', 'descend', null]}
|
|
|
current={queryFrom.pageNum}
|
|
|
pageSize={queryFrom.pageSize}
|
|
|
- columns={columnsPosCode(() => getPackLinkCodeList.refresh())}
|
|
|
+ columns={columnsPosCode(data.id, () => getPackLinkCodeList.refresh())}
|
|
|
dataSource={getPackLinkCodeList?.data?.records}
|
|
|
scroll={{ x: 900, y: 600 }}
|
|
|
onChange={(pagination: any, filters: any, sortData: any) => {
|