first commit

This commit is contained in:
编码猿
2024-09-27 01:32:49 +08:00
commit 28ebe05a64
7399 changed files with 1174529 additions and 0 deletions

View File

@@ -0,0 +1 @@
c8fb8ed7-4225-4997-9b12-9b4d5c112419

View File

@@ -0,0 +1 @@
6a539a53-0a1e-40de-8757-59c5295ec8c5

View File

@@ -0,0 +1,11 @@
@import '../../../assets/less/public/color.less';
@import '../../../assets/less/public/mixins.less';
.index {
padding: 20px;
height: 100%;
background-color: #ffffff;
.title {
.title();
}
}

View File

@@ -0,0 +1,251 @@
import React, { IocComponent } from '@Ioc/index';
import style from './index.less';
import {
Input,
Select,
Button,
DatePicker,
Table,
message,
Popconfirm,
Modal,
Row,
Col,
Switch,
} from 'antd';
// @ts-ignore
import E from 'wangeditor';
import publicCss from '@less/public/index.less';
import { BuyerService } from '@/core/service/buyerService';
import { Utils } from '@/core/utils/utils';
const { Option } = Select;
const { RangePicker } = DatePicker;
const { TextArea } = Input;
export default class ExceptionList extends IocComponent {
state: { [index: string]: any } = {
columns: [
{
title: 'id',
dataIndex: 'id',
key: 'id',
},
{
title: '任务名称',
dataIndex: 'job_title',
key: 'job_title',
},
{
title: '异常',
dataIndex: 'msg_title',
key: 'msg_title',
},
{
title: '队列名称',
dataIndex: 'queue_name',
key: 'queue_name',
},
{
title: '时间',
dataIndex: 'create_time',
key: 'create_time',
render: (text: any, record: any) => {
return <span>{Utils.formatDate(record.create_time)}</span>;
},
},
{
title: '操作',
dataIndex: 'x',
key: 'x',
render: (text: any, record: any) => {
return (
<>
<Button
style={{ marginRight: 10 }}
onClick={async () => {
await this.getFailedDetail(record.id);
}}
>
</Button>
<Button
danger
onClick={async () => {
await this.deleteFailedRecord();
}}
>
</Button>
</>
);
},
},
],
params: {
limit: 10,
page: 1,
},
PageCount: '',
FailedList: [],
loading: false,
isShowAddModal: false,
FailedDetail: {},
selectedRowKeys: [],
};
async componentDidMount() {
await this.getFailedLists();
}
/**
* 异常列表
*/
async getFailedLists() {
this.setState({ loading: true });
let res = await BuyerService.getFailedList(this.state.params);
if (res.hasOwnProperty('list')) {
this.state.PageCount = res.count;
this.setState({ FailedList: res.list });
}
this.setState({ loading: false });
}
/**
* 获取异常详情
*/
async getFailedDetail(id: string) {
let res = await BuyerService.getFailedDetail({ id: id });
let params = [],
msg = [];
if (res.param) {
for (const stateKey in res.param) {
params.push({
title: stateKey,
id: res.param[stateKey],
});
}
}
if (res.msg) {
for (const stateKey in res.msg) {
msg.push({
title: stateKey,
id: res.msg[stateKey],
});
}
}
res.param = params;
res.msg = msg;
this.setState({ FailedDetail: res, isShowAddModal: true });
}
/**
* 删除异常
*/
async deleteFailedRecord() {
let res = await BuyerService.deleteFailedRecord({
ids: this.state.selectedRowKeys,
});
await this.getFailedLists();
console.log('删除:', res);
}
onSelectChange = (selectedRowKeys: any, selectedRows: any) => {
this.state.selectedRowKeys = selectedRowKeys;
this.setState({});
};
render() {
const { selectedRowKeys } = this.state;
const rowSelection = {
selectedRowKeys,
onChange: this.onSelectChange,
};
return (
<div className={style.index}>
<div className={style.title}></div>
<div className={publicCss.flex} style={{ marginBottom: 20 }}>
<Table
loading={this.state.loading}
rowKey="id"
rowSelection={rowSelection}
columns={this.state.columns}
dataSource={this.state.FailedList}
pagination={{
showSizeChanger: true,
showQuickJumper: false,
current: this.state.params.page,
showTotal: () => `${this.state.PageCount}`,
// @ts-ignore
total: this.state.PageCount,
pageSize: this.state.params.limit,
onShowSizeChange: async (current, size) => {
this.state.params.page = current;
this.state.params.limit = size;
await this.getFailedLists();
},
onChange: async current => {
this.state.params.page = current;
await this.getFailedLists();
},
}}
/>
<Modal
width="60%"
title="详情"
destroyOnClose={true}
visible={this.state.isShowAddModal}
onCancel={() => this.setState({ isShowAddModal: false })}
onOk={async () => {}}
>
<Row style={{ marginBottom: 15 }}>
<Col span={3}>id</Col>
<Col span={21}>{this.state.FailedDetail.id}</Col>
</Row>
<Row style={{ marginBottom: 15 }}>
<Col span={3}></Col>
<Col span={21}>{this.state.FailedDetail.queue_name}</Col>
</Row>
<Row style={{ marginBottom: 15 }}>
<Col span={3}></Col>
<Col span={21}>{this.state.FailedDetail.job_title}</Col>
</Row>
<Row style={{ marginBottom: 15 }}>
<Col span={3}></Col>
<Col span={21}>
{this.state.FailedDetail.param &&
this.state.FailedDetail.param.map(
(val: any, index: number) => {
return (
<p style={{ marginBottom: 4 }} key={index}>
{val.title}{val.id}
</p>
);
},
)}
</Col>
</Row>
<Row style={{ marginBottom: 15 }}>
<Col span={3}></Col>
<Col span={21}>
{this.state.FailedDetail.msg &&
this.state.FailedDetail.msg.map((val: any, index: number) => {
return (
<p style={{ marginBottom: 4 }} key={index}>
{val.title}{val.id}
</p>
);
})}
</Col>
</Row>
</Modal>
</div>
</div>
);
}
}

View File

@@ -0,0 +1 @@
4375fe55-0f3f-43ae-9d2d-652cee754b35

View File

@@ -0,0 +1,11 @@
@import '../../../assets/less/public/color.less';
@import '../../../assets/less/public/mixins.less';
.index {
padding: 20px;
height: 100%;
background-color: #ffffff;
.title {
.title();
}
}

View File

@@ -0,0 +1,404 @@
import React, { IocComponent } from '@Ioc/index';
import style from './index.less';
import {
Input,
Select,
Button,
DatePicker,
Table,
message,
Popconfirm,
Modal,
Row,
Col,
Switch,
} from 'antd';
// @ts-ignore
import E from 'wangeditor';
import publicCss from '@less/public/index.less';
import { BuyerService } from '@/core/service/buyerService';
import { Utils } from '@/core/utils/utils';
const { Option } = Select;
const { RangePicker } = DatePicker;
const { TextArea } = Input;
export default class HelpCenter extends IocComponent {
state: { [index: string]: any } = {
columns: [
{
title: 'id',
dataIndex: 'id',
key: 'id',
},
{
title: '标题',
dataIndex: 'title',
key: 'title',
},
{
title: '类型',
dataIndex: 'type',
render: (text: any, record: any) => {
return <span>{record.nav.name}</span>;
},
},
{
title: '发布时间',
dataIndex: 'create_time',
key: 'create_time',
render: (text: any, record: any) => {
return <span>{Utils.formatDate(record.create_time)}</span>;
},
},
{
title: '操作',
dataIndex: 'x',
render: (text: any, record: any) => {
return (
<>
<a
onClick={async () => {
await this.guideDetail(record.id);
}}
>
{' '}
{' '}
</a>
<Popconfirm
title="确定删除吗?"
onConfirm={async () => {
await this.guideDelete(record.id);
}}
onCancel={() => {}}
okText="确认"
cancelText="取消"
>
<a onClick={async () => {}}></a>
</Popconfirm>
</>
);
},
},
],
params: {
title: '',
type: '',
limit: 20,
page: 1,
},
PageCount: 0,
guideNavData: [],
guideListData: [],
guideDetailData: {},
guideAddParams: {
title: '',
content: '',
type: '',
},
isShowAddModal: false,
isShowEditModal: false,
addHelpContent: '',
editHelpContent: '',
editInfo: {},
loading: false,
};
async componentDidMount() {
await this.guideList();
await this.guideNav();
}
/**
* 初始化 添加 富文本编辑器
*/
initAddEditor() {
this.state.addHelpContent = new E(this.refs.addHelpContent);
this.state.addHelpContent.customConfig.zIndex = 100;
this.state.addHelpContent.create();
}
/**
* 初始化 编辑 富文本编辑器
*/
initEditEditor() {
this.state.editHelpContent = new E(this.refs.editHelpContent);
this.state.editHelpContent.customConfig.zIndex = 100;
this.state.editHelpContent.create();
}
/**
* 公告类型
*/
async guideNav() {
let res = await BuyerService.guideNav({});
this.setState({ guideNavData: res });
}
/**
* 列表
*/
async guideList() {
this.setState({ loading: true });
let res = await BuyerService.guideList(this.state.params);
if (res.hasOwnProperty('list')) {
this.state.PageCount = res.count;
this.setState({ guideListData: res.list });
console.log('guideList: ', this.state.guideListData);
}
this.setState({ loading: false });
}
/**
* 删除
* @param id
*/
async guideDelete(id: any) {
let res = await BuyerService.guideDelete({ guide_id: id });
await this.guideList();
}
/**
* 添加
*/
async guideAdd() {
let res = await BuyerService.guideAdd(this.state.guideAddParams);
await this.guideList();
this.setState({ isShowAddModal: false });
}
/**
* 帮助详情
* @param id
*/
async guideDetail(id: string) {
let res = await BuyerService.guideDetail({ guide_id: id });
this.setState({ guideDetailData: res });
// 保存编辑接口需要的id参数
this.state.guideAddParams.guide_id = res.id;
this.setState({ isShowEditModal: true });
setTimeout(() => {
this.initEditEditor();
// 赋值富文本编辑框
this.state.editHelpContent.txt.html(res.content);
}, 300);
}
async guideModify() {
console.log('编辑参数:', this.state.guideAddParams);
let res = await BuyerService.guideModify(this.state.guideAddParams);
await this.guideList();
this.setState({ isShowEditModal: false });
}
/**
* 添加新帮助的弹窗
* @constructor
*/
AddHelp() {
return (
<Modal
width="60%"
title="添加帮助"
destroyOnClose={true}
visible={this.state.isShowAddModal}
onCancel={() => this.setState({ isShowAddModal: false })}
onOk={async () => {
this.state.guideAddParams.content = this.state.addHelpContent.txt.html();
await this.guideAdd();
}}
>
<Row style={{ marginBottom: 15 }}>
<Col span={3}></Col>
<Col span={21}>
<Input
style={{ width: '100%' }}
placeholder="请输入帮助标题"
onChange={e => {
this.state.guideAddParams.title = e.target.value;
this.setState({});
}}
/>
</Col>
</Row>
<Row style={{ marginBottom: 15 }}>
<Col span={3}></Col>
<Col span={21}>
<div ref="addHelpContent" style={{ textAlign: 'left' }} />
</Col>
</Row>
<Row style={{ marginBottom: 15 }}>
<Col span={3}></Col>
<Col span={21}>
<Select
defaultValue="帮助类型"
style={{ width: 160 }}
onChange={(value: any) => {
this.state.guideAddParams.type = value;
this.setState({});
}}
>
{this.state.guideNavData.map((val: any, index: number) => {
return (
<Option key={index} value={val.id}>
{val.name}
</Option>
);
})}
</Select>
</Col>
</Row>
</Modal>
);
}
/**
* 编辑帮助的弹窗
* @constructor
*/
EditHelp() {
return (
<Modal
width="60%"
title="编辑帮助"
destroyOnClose={true}
visible={this.state.isShowEditModal}
onCancel={() => this.setState({ isShowEditModal: false })}
onOk={async () => {
this.state.guideAddParams.content = this.state.editHelpContent.txt.html();
await this.guideModify();
}}
>
<Row style={{ marginBottom: 15 }}>
<Col span={3}></Col>
<Col span={21}>
<Input
style={{ width: '100%' }}
placeholder="请输入帮助标题"
value={this.state.guideDetailData.title}
onChange={e => {
this.state.guideDetailData.title = e.target.value;
this.state.guideAddParams.title = e.target.value;
this.setState({});
}}
/>
</Col>
</Row>
<Row style={{ marginBottom: 15 }}>
<Col span={3}></Col>
<Col span={21}>
<div ref="editHelpContent" style={{ textAlign: 'left' }} />
</Col>
</Row>
<Row style={{ marginBottom: 15 }}>
<Col span={3}></Col>
<Col span={21}>
<Select
defaultValue={this.state.guideDetailData.nav_id}
style={{ width: 160 }}
onChange={(value: any) => {
this.state.guideAddParams.type = value;
this.setState({});
}}
>
{this.state.guideNavData.map((val: any, index: number) => {
return (
<Option key={index} value={val.id}>
{val.name}
</Option>
);
})}
</Select>
</Col>
</Row>
</Modal>
);
}
render() {
return (
<div className={style.index}>
<div className={style.title}></div>
<div className={publicCss.flex} style={{ marginBottom: 20 }}>
<Input
className={publicCss.ml10}
style={{ width: 240, marginRight: 10 }}
placeholder="请输入标题"
onChange={e => {
this.state.params.title = e.target.value;
this.setState({});
}}
/>
<Select
defaultValue="帮助类型"
style={{ width: 160 }}
onChange={(value: any) => {
this.state.params.type = value;
this.setState({});
}}
>
{this.state.guideNavData.map((val: any, index: number) => {
return (
<Option key={index} value={val.id}>
{val.name}
</Option>
);
})}
</Select>
<Button
className={publicCss.ml10}
type="primary"
onClick={async () => {
await this.guideList();
}}
>
</Button>
</div>
<div className={publicCss.flex} style={{ marginBottom: 20 }}>
<Button
type="primary"
onClick={() => {
this.setState({ isShowAddModal: true });
setTimeout(() => this.initAddEditor(), 300);
}}
>
</Button>
</div>
{this.AddHelp()}
{this.EditHelp()}
<Table
loading={this.state.loading}
rowKey="id"
columns={this.state.columns}
dataSource={this.state.guideListData}
pagination={{
showSizeChanger: true,
showQuickJumper: false,
current: this.state.params.page,
showTotal: () => `${this.state.PageCount}`,
// @ts-ignore
total: this.state.PageCount,
pageSize: this.state.params.limit,
onShowSizeChange: async (current, size) => {
this.state.params.page = current;
this.state.params.limit = size;
await this.guideList();
},
onChange: async current => {
this.state.params.page = current;
await this.guideList();
},
}}
/>
</div>
);
}
}

View File

@@ -0,0 +1 @@
44cc251c-7273-4dec-a86b-b16e1ba74232

View File

@@ -0,0 +1,11 @@
@import '../../../assets/less/public/color.less';
@import '../../../assets/less/public/mixins.less';
.index {
padding: 20px;
height: 100%;
background-color: #ffffff;
.title {
.title();
}
}

View File

@@ -0,0 +1,371 @@
import React, { IocComponent } from '@Ioc/index';
import style from './index.less';
import {
Input,
Select,
Button,
DatePicker,
Table,
message,
Modal,
Row,
Col,
Switch,
} from 'antd';
import publicCss from '@less/public/index.less';
import { BuyerService } from '@/core/service/buyerService';
import { Utils } from '@/core/utils/utils';
// @ts-ignore
import E from 'wangeditor';
const { Option } = Select;
const { RangePicker } = DatePicker;
const { TextArea } = Input;
/**
* 买家提现记录
*/
export default class Notice extends IocComponent {
state: { [index: string]: any } = {
columns: [
{
title: 'id',
dataIndex: 'id',
key: 'id',
},
{
title: '标题',
dataIndex: 'title',
key: 'title',
},
{
title: '类型',
dataIndex: 'type',
render: (text: any, record: any) => {
return <span>{record.nav.name}</span>;
},
},
{
title: '发布时间',
dataIndex: 'create_time',
key: 'create_time',
},
{
title: '操作',
dataIndex: 'x',
render: (text: any, record: any) => {
return (
<>
<a onClick={async () => await this.announceDetail(record.id)}>
{' '}
{' '}
</a>
<a onClick={async () => await this.announceDelete(record.id)}>
</a>
</>
);
},
},
],
params: {
title: '',
type: '',
limit: 10,
page: 1,
},
PageCount: '', // 共有多少条
NoticeData: [],
isShowModal: false,
isShowEditModal: false,
addParams: {
title: '',
content: '',
type: '',
// status: false,
// sort: '',
},
announceDetailData: {},
announceNavList: [],
loading: false,
};
private editorAdd: any;
private editorModify: any;
async componentDidMount() {
await this.announceList();
await this.announceNav();
}
/**
* 公告类型
*/
async announceNav() {
let res = await BuyerService.announceNav({});
this.setState({ announceNavList: res });
console.log('公告类型:', res);
}
/**
* 删除公告
*/
async announceDelete(id: any) {
let res = await BuyerService.announceDelete({ announce_id: id });
await this.announceList();
}
initAddEditor() {
this.editorAdd = new E(this.refs.editorAddElem);
this.editorAdd.customConfig.zIndex = 100;
this.editorAdd.create();
}
initeditorModify() {
console.log(this.refs.editorModifyElem);
this.editorModify = new E(this.refs.editorModifyElem);
this.editorModify.customConfig.zIndex = 100;
this.editorModify.create();
}
async announceList() {
this.setState({ loading: true });
let res = await BuyerService.announceList(this.state.params);
this.state.NoticeData = res.data.data;
this.state.PageCount = res.count;
this.state.NoticeData.forEach((val: any, index: number) => {
val.key = index;
val.create_time = Utils.formatDate(val.create_time);
val.status = val.status == 1 ? '启用' : '不启用';
});
this.setState({ loading: false });
this.setState({});
}
async add() {
let res = await BuyerService.add(this.state.addParams);
await this.announceList();
}
/**
* 公告详情
* @param id
*/
async announceDetail(id: string) {
let res = await BuyerService.announceDetail({ announce_id: id });
await this.setState({ announceDetailData: res, isShowEditModal: true });
console.log(this.state.announceDetailData);
this.initeditorModify();
this.editorModify.txt.html((this.state.announceDetailData as any).content);
}
/**
* 更新
*/
async modify() {
// @ts-ignore
this.state.announceDetailData.announce_id = this.state.announceDetailData.id;
let res = await BuyerService.modify(this.state.announceDetailData);
await this.announceList();
}
render() {
return (
<div className={style.index}>
<div className={style.title}></div>
<div className={publicCss.flex} style={{ marginBottom: 20 }}>
<Input
className={publicCss.ml10}
style={{ width: 240, marginRight: 10 }}
placeholder="请输入标题"
onChange={e => {
this.state.params.title = e.target.value;
this.setState({});
}}
/>
<Select
defaultValue="公告类型"
style={{ width: 160 }}
onChange={(value: any) => {
this.state.params.type = value;
console.log('公告类型: ', this.state.params.type);
this.setState({});
}}
>
{this.state.announceNavList.map((val: any, index: number) => {
return (
<Option key={index} value={val.id}>
{val.name}
</Option>
);
})}
</Select>
<Button
className={publicCss.ml10}
type="primary"
onClick={async () => {
await this.announceList();
}}
>
</Button>
</div>
<div className={publicCss.flex} style={{ marginBottom: 20 }}>
<Button
type="primary"
style={{ marginRight: 15 }}
onClick={async () => {
await this.setState({ isShowModal: true });
this.initAddEditor();
}}
>
</Button>
</div>
<div style={{ marginTop: '20px', marginBottom: '10px' }}>
<Table
loading={this.state.loading}
columns={this.state.columns}
dataSource={this.state.NoticeData}
pagination={{
showSizeChanger: true,
showQuickJumper: false,
current: this.state.params.page,
showTotal: () => `${this.state.PageCount}`,
// @ts-ignore
total: this.state.PageCount,
pageSize: this.state.params.limit,
onShowSizeChange: async (current, size) => {
this.state.params.page = current;
this.state.params.limit = size;
await this.announceList();
},
onChange: async current => {
this.state.params.page = current;
await this.announceList();
},
}}
/>
</div>
<Modal
width="60%"
title="添加新公告"
destroyOnClose={true}
visible={this.state.isShowModal}
onCancel={() => {
this.state.addParams = {
title: '',
content: '',
type: '',
status: false,
sort: '',
};
this.setState({});
this.setState({ isShowModal: false });
}}
onOk={async () => {
this.state.addParams.content = this.editorAdd.txt.html();
await this.add();
}}
>
<Row style={{ marginBottom: 15 }}>
<Col span={3}></Col>
<Col span={21}>
<Input
style={{ width: '100%' }}
placeholder="请输入公告标题"
onChange={e => {
this.state.addParams.title = e.target.value;
this.setState({});
}}
/>
</Col>
</Row>
<Row style={{ marginBottom: 15 }}>
<Col span={3}></Col>
<Col span={21}>
<div ref="editorAddElem" style={{ textAlign: 'left' }} />
</Col>
</Row>
<Row style={{ marginBottom: 15 }}>
<Col span={3}></Col>
<Col span={21}>
<Select
defaultValue="公告类型"
style={{ width: 160 }}
onChange={(value: any) => {
this.state.addParams.type = value;
this.setState({});
}}
>
{this.state.announceNavList.map((val: any, index: number) => {
return (
<Option key={index} value={val.id}>
{val.name}
</Option>
);
})}
</Select>
</Col>
</Row>
</Modal>
<Modal
width="60%"
title="编辑公告"
destroyOnClose={true}
visible={this.state.isShowEditModal}
onCancel={() => {
this.setState({ isShowEditModal: false });
}}
onOk={async () => {
this.state.announceDetailData.content = this.editorModify.txt.html();
await this.modify();
}}
>
<Row style={{ marginBottom: 15 }}>
<Col span={3}></Col>
<Col span={21}>
<Input
style={{ width: '100%' }}
value={this.state.announceDetailData.title}
placeholder="请输入公告标题"
onChange={e => {
this.state.announceDetailData.title = e.target.value;
this.setState({});
}}
/>
</Col>
</Row>
<Row style={{ marginBottom: 15 }}>
<Col span={3}></Col>
<Col span={21}>
<div ref="editorModifyElem" style={{ textAlign: 'left' }} />
</Col>
</Row>
<Row style={{ marginBottom: 15 }}>
<Col span={3}></Col>
<Col span={21}>
<Select
defaultValue={this.state.announceDetailData.nav_id}
style={{ width: 160 }}
onChange={(value: any) => {
this.state.announceDetailData.type = value;
this.setState({});
}}
>
{this.state.announceNavList.map((val: any, index: number) => {
return (
<Option key={index} value={val.id}>
{val.name}
</Option>
);
})}
</Select>
</Col>
</Row>
</Modal>
</div>
);
}
}

View File

@@ -0,0 +1 @@
f7ccd47b-b63f-449f-a525-23314f09970b

View File

@@ -0,0 +1,11 @@
@import '../../../assets/less/public/color.less';
@import '../../../assets/less/public/mixins.less';
.index {
padding: 20px;
height: 100%;
background-color: #ffffff;
.title {
.title();
}
}

View File

@@ -0,0 +1,223 @@
import React, { IocComponent } from '@Ioc/index';
import style from './index.less';
import {
Input,
Select,
Button,
DatePicker,
Table,
message,
Popconfirm,
Modal,
Row,
Col,
Switch,
} from 'antd';
// @ts-ignore
import E from 'wangeditor';
import publicCss from '@less/public/index.less';
import { BuyerService } from '@/core/service/buyerService';
import { Utils } from '@/core/utils/utils';
const { Option } = Select;
const { RangePicker } = DatePicker;
const { TextArea } = Input;
export default class TaskExceptionList extends IocComponent {
state: { [index: string]: any } = {
columns: [
{
title: '任务编号',
dataIndex: 'task_id',
key: 'task_id',
},
{
title: '异常次数',
dataIndex: 'times',
key: 'times',
},
{
title: '异常',
dataIndex: 'msg_title',
key: 'msg_title',
},
{
title: '状态',
dataIndex: 'status_text',
key: 'status_text',
},
{
title: '时间',
dataIndex: 'create_time',
key: 'create_time',
render: (text: any, record: any) => {
return <span>{Utils.formatDate(record.create_time)}</span>;
},
},
{
title: '操作',
dataIndex: 'x',
key: 'x',
render: (text: any, record: any) => {
return (
<>
<Button
style={{ marginRight: 10 }}
onClick={async () => {
await this.taskFailedGetFailedDetail(record.id);
}}
>
</Button>
<Button
danger
onClick={async () => {
await this.taskFailedSolveFailed(record.id);
}}
>
</Button>
</>
);
},
},
],
params: {
limit: 10,
page: 1,
},
PageCount: '',
FailedList: [],
loading: false,
isShowAddModal: false,
FailedDetail: {},
};
async componentDidMount() {
await this.getFailedLists();
}
/**
* 异常列表
*/
async getFailedLists() {
this.setState({ loading: true });
let res = await BuyerService.taskFailedGetFailedList(this.state.params);
if (res.hasOwnProperty('list')) {
this.state.PageCount = res.count;
this.setState({ FailedList: res.list });
}
this.setState({ loading: false });
}
/**
* 获取异常详情
*/
async taskFailedGetFailedDetail(id: string) {
let res = await BuyerService.taskFailedGetFailedDetail({ id: id });
let msg = [];
if (res.msg) {
for (const stateKey in res.msg) {
msg.push({
title: stateKey,
id: res.msg[stateKey],
});
}
}
res.msg = msg;
this.setState({ FailedDetail: res, isShowAddModal: true });
}
/**
* 解决异常
*/
async taskFailedSolveFailed(id: string) {
let res = await BuyerService.taskFailedSolveFailed({ id: id });
await this.getFailedLists();
}
render() {
return (
<div className={style.index}>
<div className={style.title}></div>
<div className={publicCss.flex} style={{ marginBottom: 20 }}>
<Table
loading={this.state.loading}
rowKey="id"
columns={this.state.columns}
dataSource={this.state.FailedList}
pagination={{
showSizeChanger: true,
showQuickJumper: false,
current: this.state.params.page,
showTotal: () => `${this.state.PageCount}`,
// @ts-ignore
total: this.state.PageCount,
pageSize: this.state.params.limit,
onShowSizeChange: async (current, size) => {
this.state.params.page = current;
this.state.params.limit = size;
await this.getFailedLists();
},
onChange: async current => {
this.state.params.page = current;
await this.getFailedLists();
},
}}
/>
<Modal
width="60%"
title="详情"
destroyOnClose={true}
visible={this.state.isShowAddModal}
onCancel={() => this.setState({ isShowAddModal: false })}
onOk={async () => {}}
>
<Row style={{ marginBottom: 15 }}>
<Col span={3}>id</Col>
<Col span={21}>{this.state.FailedDetail.task_id}</Col>
</Row>
<Row style={{ marginBottom: 15 }}>
<Col span={3}>id</Col>
<Col span={21}>{this.state.FailedDetail.exception_id}</Col>
</Row>
<Row style={{ marginBottom: 15 }}>
<Col span={3}></Col>
<Col span={21}>{this.state.FailedDetail.times}</Col>
</Row>
<Row style={{ marginBottom: 15 }}>
<Col span={3}></Col>
<Col span={21}>
{Utils.formatDate(this.state.FailedDetail.create_time)}
</Col>
</Row>
<Row style={{ marginBottom: 15 }}>
<Col span={3}></Col>
<Col span={21}>
{Utils.formatDate(this.state.FailedDetail.solve_time)}
</Col>
</Row>
<Row style={{ marginBottom: 15 }}>
<Col span={3}></Col>
<Col span={21}>{this.state.FailedDetail.status_text}</Col>
</Row>
<Row style={{ marginBottom: 15 }}>
<Col span={3}></Col>
<Col span={21}>
{this.state.FailedDetail.msg &&
this.state.FailedDetail.msg.map((val: any, index: number) => {
return (
<p style={{ marginBottom: 4 }} key={index}>
{val.title}{val.id}
</p>
);
})}
</Col>
</Row>
</Modal>
</div>
</div>
);
}
}