Commit dce06502 authored by 前端-彭佳文's avatar 前端-彭佳文

Merge branch 'v2-220418' into 'v2-220418'

V2 220418 See merge request GavinPeng/pro-platform!12
parents 5bbdbc0d 74f603e2
/*
* @Author: XieZhiXiong
* @Date: 2021-10-18 11:11:48
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-11-17 20:29:02
* @Description:
*/
import { useBusinessEffects } from './useBusinessEffects';
import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect';
import { getProductInvoicesTypeAll, getProductWarehouseAll } from '@/services/ProductV2Api';
// 获取单据类型
const fetchInvoicesType = (): Promise<any[]> => {
return new Promise((resolve, reject) => {
getProductInvoicesTypeAll().then(res => {
if (res.code === 1000) {
resolve(res.data);
}
reject();
}).catch(() => {
reject();
});
});
};
// 获取仓库
const fetchInventory = (): Promise<any[]> => {
return new Promise((resolve, reject) => {
getProductWarehouseAll().then(res => {
if (res.code === 1000) {
resolve(res.data);
}
reject();
}).catch(() => {
reject();
});
});
};
export const createEffects = (context, actions) => {
useBusinessEffects(context, actions);
useAsyncSelect('invoicesTypeId', fetchInvoicesType, ['name', 'id']);
useAsyncSelect('inventoryId', fetchInventory, ['name', 'id']);
};
\ No newline at end of file
/*
* @Author: XieZhiXiong
* @Date: 2021-10-18 11:11:48
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-11-17 20:29:02
* @Description:
*/
import { useBusinessEffects } from './useBusinessEffects';
import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect';
import { getProductInvoicesTypeAll, getProductWarehouseAll } from '@/services/ProductV2Api';
// 获取单据类型
const fetchInvoicesType = (): Promise<any[]> => {
return new Promise((resolve, reject) => {
getProductInvoicesTypeAll().then(res => {
if (res.code === 1000) {
resolve(res.data);
}
reject();
}).catch(() => {
reject();
});
});
};
// 获取仓库
const fetchInventory = (): Promise<any[]> => {
return new Promise((resolve, reject) => {
getProductWarehouseAll().then(res => {
if (res.code === 1000) {
resolve(res.data);
}
reject();
}).catch(() => {
reject();
});
});
};
export const createEffects = (context, actions) => {
useBusinessEffects(context, actions);
useAsyncSelect('invoicesTypeId', fetchInvoicesType, ['name', 'id']);
useAsyncSelect('warehouseId', fetchInventory, ['name', 'id']);
};
import React, { useState, useEffect, useRef } from 'react';
import React, { useState, useRef } from 'react';
import { getIntl, history } from 'umi';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { Button, Card, Dropdown, Menu, Space, Badge, Popconfirm } from 'antd';
import { PlusOutlined, DownOutlined, DeleteOutlined, RollbackOutlined, SnippetsOutlined, ZoomOutOutlined } from '@ant-design/icons';
import { PlusOutlined, DownOutlined, DeleteOutlined, RollbackOutlined, SnippetsOutlined } from '@ant-design/icons';
import StandardTable from '@/components/StandardTable';
import moment from 'moment';
import { ColumnType } from 'antd/lib/table/interface';
import { getProductInvoicesList, getProductInvoicesTypeAll, getProductWarehouseAll, postProductInvoicesBatchDelete, postProductInvoicesBatchReviewAll, postProductInvoicesBatchAgainstReview } from '@/services/ProductV2Api';
import { getProductInvoicesList, getProductInvoicesTypeAll, getProductWarehouseAll, postProductInvoicesBatchDelete, postProductInvoicesBatchReview } from '@/services/ProductV2Api';
import EyePreview from '@/components/EyePreview';
import NiceForm from '@/components/NiceForm';
import { createFormActions, FormEffectHooks } from '@formily/antd';
import { createFormActions } from '@formily/antd';
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import { FORM_FILTER_PATH } from '@/formSchema/const';
import UploadModal from '@/components/UploadModal';
......@@ -70,26 +70,11 @@ const Bills: React.FC<{}> = () => {
});
};
const auditInvoices = (ids: number[], callback?: () => void) => {
const auditInvoices = (ids: number[], reviewType: number, callback?: () => void) => {
setBatchLoading(true);
postProductInvoicesBatchReviewAll({
ids,
}).then(res => {
if (res.code !== 1000) {
return;
}
if (callback) {
callback();
}
}).finally(() => {
setBatchLoading(false);
});
};
const counterclaimInvoices = (ids: number[], callback?: () => void) => {
setBatchLoading(true);
postProductInvoicesBatchAgainstReview({
postProductInvoicesBatchReview({
ids,
reviewType
}).then(res => {
if (res.code !== 1000) {
return;
......@@ -121,7 +106,7 @@ const Bills: React.FC<{}> = () => {
}
case 'BatchAudit': {
auditInvoices(selectedRowKeys, () => {
auditInvoices(selectedRowKeys, 1, () => {
setSelectedRowKeys([]);
ref.current.reload();
});
......@@ -129,7 +114,7 @@ const Bills: React.FC<{}> = () => {
}
case 'BatchCounterclaim': {
counterclaimInvoices(selectedRowKeys, () => {
auditInvoices(selectedRowKeys, 0, () => {
setSelectedRowKeys([]);
ref.current.reload();
});
......@@ -161,15 +146,8 @@ const Bills: React.FC<{}> = () => {
);
const handleCounterclaim = id => {
counterclaimInvoices([id], () => {
setSelectedRowKeys([]);
ref.current.reload();
});
};
const handleAudit = id => {
auditInvoices([id], () => {
const handleAudit = (id, reviewType) => {
auditInvoices([id], reviewType, () => {
setSelectedRowKeys([]);
ref.current.reload();
});
......@@ -258,7 +236,7 @@ const Bills: React.FC<{}> = () => {
<Button type="link" onClick={() => history.push(`/memberCenter/tranactionAbility/stockSellStorage/bills/edit?id=${record.id}`)}>{intl.formatMessage({ id: 'stockSellStorage.xiugai' })}</Button>
</AuthButton>
<AuthButton btnCode='bills.shenhe' >
<Button type="link" onClick={() => handleAudit(record.id)}>{intl.formatMessage({ id: 'stockSellStorage.shenhe' })}</Button>
<Button type="link" onClick={() => handleAudit(record.id, 1)}>{intl.formatMessage({ id: 'stockSellStorage.shenhe' })}</Button>
</AuthButton>
<AuthButton btnCode='bills.del' >
<Popconfirm
......@@ -278,7 +256,7 @@ const Bills: React.FC<{}> = () => {
</>
)}
{record.state === DOC_STATUS_REVIEWED && (
<Button type="link" onClick={() => handleCounterclaim(record.id)}>{intl.formatMessage({ id: 'stockSellStorage.fanshen' })}</Button>
<Button type="link" onClick={() => handleAudit(record.id, 0)}>{intl.formatMessage({ id: 'stockSellStorage.fanshen' })}</Button>
)}
</>
) : null;
......
......@@ -22,24 +22,24 @@ export const billsTypeDetailSchema: ISchema = {
},
properties: {
number: {
type: 'string',
type: 'text',
title: intl.formatMessage({ id: 'stockSellStorage.danjuleixingbianhao' }),
'x-component-props': {
placeholder: intl.formatMessage({ id: 'stockSellStorage.zuichang10gezifu' }),
maxLength: 10,
},
'x-rules': [
{
required: true,
message: intl.formatMessage({ id: 'stockSellStorage.qingshurudanjuleixingbian' }),
},
{
validator: value => {
const CNReg = /[\u4E00-\u9FA5]/g;
return CNReg.test(value) ? intl.formatMessage({ id: 'stockSellStorage.qingshurufeizhongwenzifu' }) : '';
},
},
],
// 'x-component-props': {
// placeholder: intl.formatMessage({ id: 'stockSellStorage.zuichang10gezifu' }),
// maxLength: 10,
// },
// 'x-rules': [
// {
// required: true,
// message: intl.formatMessage({ id: 'stockSellStorage.qingshurudanjuleixingbian' }),
// },
// {
// validator: value => {
// const CNReg = /[\u4E00-\u9FA5]/g;
// return CNReg.test(value) ? intl.formatMessage({ id: 'stockSellStorage.qingshurufeizhongwenzifu' }) : '';
// },
// },
// ],
},
name: {
type: 'string',
......
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