Commit 7f97fee0 authored by XieZhiXiong's avatar XieZhiXiong

fix: 修复产品名称不显示的问题

parent a27553dc
@import '../../../global/styles/utils.less';
.productName {
.textOverflow();
}
\ No newline at end of file
import React, { useState, useRef } from 'react'; import React, { useState, useRef } from 'react';
import { Card, Rate, Button, Space, Modal, message } from 'antd'; import { Card, Rate, Button, Space, Modal, message, Tooltip } from 'antd';
import { ClockCircleOutlined, QuestionCircleOutlined } from '@ant-design/icons'; import { ClockCircleOutlined, QuestionCircleOutlined } from '@ant-design/icons';
import { Link } from 'umi'; import { Link } from 'umi';
import { StandardTable } from 'god'; import { StandardTable } from 'god';
import { ColumnType } from 'antd/lib/table/interface'; import { ColumnType } from 'antd/lib/table/interface';
import { createFormActions } from '@formily/antd'; import { createFormActions } from '@formily/antd';
import moment from 'moment'; import moment from 'moment';
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch'; import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import { FORM_FILTER_PATH } from '@/formSchema/const'; import { FORM_FILTER_PATH } from '@/formSchema/const';
import { useAsyncInitSelect } from '@/formSchema/effects/useAsyncInitSelect'; import { useAsyncInitSelect } from '@/formSchema/effects/useAsyncInitSelect';
import { PublicApi } from '@/services/api'; import { PublicApi } from '@/services/api';
import { isJSONStr } from '@/utils'; import { isJSONStr } from '@/utils';
import EyePreview from '@/components/EyePreview'; import EyePreview from '@/components/EyePreview';
import NiceForm from '@/components/NiceForm'; import NiceForm from '@/components/NiceForm';
import { listSearchSchema } from './schema'; import { listSearchSchema } from './schema';
import { COMMENT_STATUS_VISIBLE, COMMENT_STATUS_INVISIBLE } from '../constants'; import { COMMENT_STATUS_VISIBLE, COMMENT_STATUS_INVISIBLE } from '../constants';
import styles from './index.less'; import styles from './index.less';
const { confirm } = Modal; const { confirm } = Modal;
const formActions = createFormActions(); const formActions = createFormActions();
const CommentManage: React.FC = () => { const CommentManage: React.FC = () => {
const ref = useRef<any>({}); const ref = useRef<any>({});
const [selectedRowKeys, setSelectedRowKeys] = useState<Array<number>>([]); const [selectedRowKeys, setSelectedRowKeys] = useState<Array<number>>([]);
const handleVisibleComment = (status, id) => { const handleVisibleComment = (status, id) => {
const msg = message.loading({ const msg = message.loading({
content: '正在操作,请稍候...', content: '正在操作,请稍候...',
duration: 0, duration: 0,
}); });
PublicApi.postMemberPlatformCommentOrderTradeHistoryUpdateStatus({ PublicApi.postMemberPlatformCommentOrderTradeHistoryUpdateStatus({
id, id,
status, status,
}).then(res => { }).then(res => {
if (res.code === 1000) { if (res.code === 1000) {
ref.current.reload(); ref.current.reload();
} }
}).finally(() => { }).finally(() => {
msg(); msg();
}); });
}; };
const columns: ColumnType<any>[] = [ const columns: ColumnType<any>[] = [
{ {
title: '订单号', title: '订单号',
dataIndex: 'orderNo', dataIndex: 'orderNo',
align: 'center', align: 'center',
render: (text, record) => ( render: (text, record) => (
<EyePreview <EyePreview
url={`/comment/manage/detail?id=${record.id}`} url={`/comment/manage/detail?id=${record.id}`}
> >
{text} {text}
</EyePreview> </EyePreview>
), ),
}, },
{ {
title: '交易商品/交易时间', title: '交易商品/交易时间',
dataIndex: 'product', dataIndex: 'product',
align: 'center', align: 'center',
render: (text, record) => { render: (text, record) => {
const product = isJSONStr(text) || {}; return (
return ( <>
<> <Tooltip title={text}>
<div>{product.productName}</div> <div className={styles.productName}>{text}</div>
<div </Tooltip>
style={{ <div
marginTop: 4, style={{
}} marginTop: 4,
> }}
<ClockCircleOutlined /> >
{` ${record.dealTime}`} <ClockCircleOutlined />
</div> {` ${record.dealTime}`}
</> </div>
) </>
}, )
}, },
{ },
title: '被评价方', {
dataIndex: 'subMemberName', title: '被评价方',
align: 'center', dataIndex: 'subMemberName',
}, align: 'center',
{ },
title: '评价方', {
dataIndex: 'memberName', title: '评价方',
align: 'center', dataIndex: 'memberName',
render: (text, record) => <>{text}</>, align: 'center',
}, render: (text, record) => <>{text}</>,
{ },
title: '评价星级', {
dataIndex: 'star', title: '评价星级',
align: 'center', dataIndex: 'star',
render: text => <Rate value={text} disabled />, align: 'center',
}, render: text => <Rate value={text} disabled />,
{ },
title: '评价内容', {
dataIndex: 'comment', title: '评价内容',
align: 'center', dataIndex: 'comment',
ellipsis: true, align: 'center',
}, ellipsis: true,
{ },
title: '评价时间', {
dataIndex: 'createTime', title: '评价时间',
align: 'center', dataIndex: 'createTime',
}, align: 'center',
{ },
title: '操作', {
dataIndex: 'action', title: '操作',
align: 'center', dataIndex: 'action',
render: (_, record) => ( align: 'center',
<> render: (_, record) => (
<Button <>
type="link" <Button
onClick={() => handleVisibleComment((record.status === COMMENT_STATUS_VISIBLE || !record.status) ? COMMENT_STATUS_INVISIBLE : COMMENT_STATUS_VISIBLE, record.id)} type="link"
> onClick={() => handleVisibleComment((record.status === COMMENT_STATUS_VISIBLE || !record.status) ? COMMENT_STATUS_INVISIBLE : COMMENT_STATUS_VISIBLE, record.id)}
{(record.status === COMMENT_STATUS_VISIBLE || !record.status) ? '屏蔽' : '已屏蔽'} >
</Button> {(record.status === COMMENT_STATUS_VISIBLE || !record.status) ? '屏蔽' : '已屏蔽'}
</> </Button>
), </>
}, ),
]; },
];
const fetchListData = (params: any) => {
const { createTimeStart, createTimeEnd, dealTimeStart, dealTimeEnd, ...rest } = params; const fetchListData = (params: any) => {
return new Promise((resolve, reject) => { const { createTimeStart, createTimeEnd, dealTimeStart, dealTimeEnd, ...rest } = params;
PublicApi.getMemberPlatformCommentOrderTradeHistoryPage({ return new Promise((resolve, reject) => {
...rest, PublicApi.getMemberPlatformCommentOrderTradeHistoryPage({
createTimeStart: createTimeStart ? moment(+createTimeStart).format('YYYY-MM-DD HH:mm:ss') : null, ...rest,
createTimeEnd: createTimeEnd ? moment(+createTimeEnd).format('YYYY-MM-DD HH:mm:ss') : null, createTimeStart: createTimeStart ? moment(+createTimeStart).format('YYYY-MM-DD HH:mm:ss') : null,
dealTimeStart: dealTimeStart ? moment(+dealTimeStart).format('YYYY-MM-DD HH:mm:ss') : null, createTimeEnd: createTimeEnd ? moment(+createTimeEnd).format('YYYY-MM-DD HH:mm:ss') : null,
dealTimeEnd: dealTimeEnd ? moment(+dealTimeEnd).format('YYYY-MM-DD HH:mm:ss') : null, dealTimeStart: dealTimeStart ? moment(+dealTimeStart).format('YYYY-MM-DD HH:mm:ss') : null,
}) dealTimeEnd: dealTimeEnd ? moment(+dealTimeEnd).format('YYYY-MM-DD HH:mm:ss') : null,
.then(res => { })
if (res.code === 1000) { .then(res => {
resolve(res.data); if (res.code === 1000) {
} resolve(res.data);
reject(); }
}) reject();
.catch(() => { })
reject(); .catch(() => {
}); reject();
}); });
}; });
};
// 初始化高级筛选选项
const fetchSelectOptions = async () => { // 初始化高级筛选选项
return {}; const fetchSelectOptions = async () => {
}; return {};
};
const handleBatchDelete = () => {
if (!selectedRowKeys.length) { const handleBatchDelete = () => {
message.warning('未选择任何评论'); if (!selectedRowKeys.length) {
return; message.warning('未选择任何评论');
} return;
confirm({ }
title: '提示', confirm({
icon: <QuestionCircleOutlined />, title: '提示',
content: '确定要删除选中的评论吗?', icon: <QuestionCircleOutlined />,
okText: '确定', content: '确定要删除选中的评论吗?',
cancelText: '取消', okText: '确定',
onOk() { cancelText: '取消',
return new Promise((resolve, reject) => { onOk() {
PublicApi.postMemberPlatformCommentOrderTradeHistoryDelete({ return new Promise((resolve, reject) => {
ids: selectedRowKeys, PublicApi.postMemberPlatformCommentOrderTradeHistoryDelete({
}) ids: selectedRowKeys,
.then(res => { })
if (res.code === 1000) { .then(res => {
ref.current.reload(); if (res.code === 1000) {
setSelectedRowKeys([]); ref.current.reload();
resolve(); setSelectedRowKeys([]);
} resolve();
reject(); }
}) reject();
.catch(() => { })
reject(); .catch(() => {
}); reject();
}); });
}, });
}); },
}; });
};
const controllerBtns = (
<Space> const controllerBtns = (
<Button onClick={handleBatchDelete}>批量删除</Button> <Space>
</Space> <Button onClick={handleBatchDelete}>批量删除</Button>
); </Space>
);
const rowSelection = {
onChange: (keys: any, rows: {}[]) => { const rowSelection = {
setSelectedRowKeys(keys); onChange: (keys: any, rows: {}[]) => {
}, setSelectedRowKeys(keys);
selectedRowKeys: selectedRowKeys, },
}; selectedRowKeys: selectedRowKeys,
};
return (
<Card> return (
<StandardTable <Card>
tableProps={{ <StandardTable
rowKey: 'id', tableProps={{
}} rowKey: 'id',
columns={columns} }}
currentRef={ref} columns={columns}
rowSelection={rowSelection} currentRef={ref}
fetchTableData={(params: any) => fetchListData(params)} rowSelection={rowSelection}
controlRender={ fetchTableData={(params: any) => fetchListData(params)}
<NiceForm controlRender={
actions={formActions} <NiceForm
onSubmit={values => ref.current.reload(values)} actions={formActions}
expressionScope={{ onSubmit={values => ref.current.reload(values)}
controllerBtns, expressionScope={{
}} controllerBtns,
effects={($, actions) => { }}
useStateFilterSearchLinkageEffect( effects={($, actions) => {
$, useStateFilterSearchLinkageEffect(
actions, $,
'product', actions,
FORM_FILTER_PATH, 'product',
); FORM_FILTER_PATH,
useAsyncInitSelect( );
['innerStatus', 'outerStatus'], useAsyncInitSelect(
fetchSelectOptions, ['innerStatus', 'outerStatus'],
); fetchSelectOptions,
}} );
schema={listSearchSchema} }}
/> schema={listSearchSchema}
} />
/> }
</Card> />
); </Card>
}; );
};
export default CommentManage; export default CommentManage;
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment