修复编译错误

This commit is contained in:
whyour 2022-05-15 15:35:52 +08:00
parent f6a122e5ea
commit bb47d67d0b
2 changed files with 12 additions and 12 deletions

View File

@ -307,7 +307,7 @@ export default class SubscriptionService {
for (const doc of docs) { for (const doc of docs) {
this.handleTask(doc, false); this.handleTask(doc, false);
} }
await SubscriptionModel.update({ isDisabled: 1 }, { where: { id: ids } }); await SubscriptionModel.update({ is_disabled: 1 }, { where: { id: ids } });
} }
public async enabled(ids: number[]) { public async enabled(ids: number[]) {
@ -315,7 +315,7 @@ export default class SubscriptionService {
for (const doc of docs) { for (const doc of docs) {
this.handleTask(doc); this.handleTask(doc);
} }
await SubscriptionModel.update({ isDisabled: 0 }, { where: { id: ids } }); await SubscriptionModel.update({ is_disabled: 0 }, { where: { id: ids } });
} }
public async log(id: number) { public async log(id: number) {

View File

@ -117,7 +117,7 @@ const Subscription = ({ headerStyle, isPhone, theme }: any) => {
}, },
], ],
onFilter: (value: number, record: any) => { onFilter: (value: number, record: any) => {
if (record.isDisabled && record.status !== 0) { if (record.is_disabled && record.status !== 0) {
return value === 2; return value === 2;
} else { } else {
return record.status === value; return record.status === value;
@ -125,7 +125,7 @@ const Subscription = ({ headerStyle, isPhone, theme }: any) => {
}, },
render: (text: string, record: any) => ( render: (text: string, record: any) => (
<> <>
{(!record.isDisabled || {(!record.is_disabled ||
record.status !== SubscriptionStatus.idle) && ( record.status !== SubscriptionStatus.idle) && (
<> <>
{record.status === SubscriptionStatus.idle && ( {record.status === SubscriptionStatus.idle && (
@ -143,7 +143,7 @@ const Subscription = ({ headerStyle, isPhone, theme }: any) => {
)} )}
</> </>
)} )}
{record.isDisabled === 1 && {record.is_disabled === 1 &&
record.status === SubscriptionStatus.idle && ( record.status === SubscriptionStatus.idle && (
<Tag icon={<CloseCircleOutlined />} color="error"> <Tag icon={<CloseCircleOutlined />} color="error">
@ -341,10 +341,10 @@ const Subscription = ({ headerStyle, isPhone, theme }: any) => {
const enabledOrDisabledSubscription = (record: any, index: number) => { const enabledOrDisabledSubscription = (record: any, index: number) => {
Modal.confirm({ Modal.confirm({
title: `确认${record.isDisabled === 1 ? '启用' : '禁用'}`, title: `确认${record.is_disabled === 1 ? '启用' : '禁用'}`,
content: ( content: (
<> <>
{record.isDisabled === 1 ? '启用' : '禁用'} {record.is_disabled === 1 ? '启用' : '禁用'}
{' '} {' '}
<Text style={{ wordBreak: 'break-all' }} type="warning"> <Text style={{ wordBreak: 'break-all' }} type="warning">
{record.name} {record.name}
@ -356,7 +356,7 @@ const Subscription = ({ headerStyle, isPhone, theme }: any) => {
request request
.put( .put(
`${config.apiPrefix}subscriptions/${ `${config.apiPrefix}subscriptions/${
record.isDisabled === 1 ? 'enable' : 'disable' record.is_disabled === 1 ? 'enable' : 'disable'
}`, }`,
{ {
data: [record.id], data: [record.id],
@ -364,12 +364,12 @@ const Subscription = ({ headerStyle, isPhone, theme }: any) => {
) )
.then((data: any) => { .then((data: any) => {
if (data.code === 200) { if (data.code === 200) {
const newStatus = record.isDisabled === 1 ? 0 : 1; const newStatus = record.is_disabled === 1 ? 0 : 1;
const result = [...value]; const result = [...value];
const i = result.findIndex((x) => x.id === record.id); const i = result.findIndex((x) => x.id === record.id);
result.splice(i, 1, { result.splice(i, 1, {
...record, ...record,
isDisabled: newStatus, is_disabled: newStatus,
}); });
setValue(result); setValue(result);
} else { } else {
@ -404,14 +404,14 @@ const Subscription = ({ headerStyle, isPhone, theme }: any) => {
<Menu.Item <Menu.Item
key="enableOrDisable" key="enableOrDisable"
icon={ icon={
record.isDisabled === 1 ? ( record.is_disabled === 1 ? (
<CheckCircleOutlined /> <CheckCircleOutlined />
) : ( ) : (
<StopOutlined /> <StopOutlined />
) )
} }
> >
{record.isDisabled === 1 ? '启用' : '禁用'} {record.is_disabled === 1 ? '启用' : '禁用'}
</Menu.Item> </Menu.Item>
<Menu.Item key="delete" icon={<DeleteOutlined />}> <Menu.Item key="delete" icon={<DeleteOutlined />}>