Commit 156ff3ea authored by Bill's avatar Bill

Merge branch 'dev' of 10.0.0.22:lingxi/lingxi-business-paltform into dev

parents 196d77b5 cd578616
This diff is collapsed.
import React, { useState, useEffect } from 'react';
import { Input, Button, message } from 'antd';
import { LinkOutlined } from '@ant-design/icons';
import styled from 'styled-components';
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable';
import ModalTable from '@/components/ModalTable';
const RowStyleLayout = styled(props => <div {...props} />)`
width: 100%;
.relevance {
height: 100%;
background: #909399;
border-radius: 0;
&[disabled] {
background: #F4F5F7;
}
}
.ant-input-group-addon {
padding: 0;
border: none;
}
`;
const Relevance = props => {
const {
editable,
value = [],
} = props;
const {
modalProps = {
title: '标题',
width: 960,
},
selectionType = 'radio',
columns,
formilyProps,
tableProps = {},
fetchTableData,
title = '选择',
tip = '', // 点击按钮前的提示,用于前提需要提示的场景
disabled = false,
} = props.props['x-component-props'];
const tableRowKey = tableProps.rowKey || 'id';
const tableRowLableKey = tableProps.lableKey || ''; // Input展示用的 key val
const [visible, setVisible] = useState(false);
const [rowSelection, rowCtl] = useRowSelectionTable({ type: selectionType, customKey: tableRowKey });
useEffect(() => {
// Table 只能缓存 keys
const rowKeys = value.map(item => item[tableRowKey]);
rowCtl.setSelectedRowKeys(rowKeys);
rowCtl.setSelectRow(value);
}, [props.value, tableProps.rowKey]);
const handleConfirm = () => {
const rows = rowCtl.selectRow;
const keys = rows.map(item => item[tableRowKey]);
if (props.mutators) {
if (rows && rows.length) {
props.mutators.change(rows);
}
setVisible(false);
return;
}
rowCtl.setSelectedRowKeys(keys);
setVisible(false);
};
const handleModalVisible = () => {
if (!fetchTableData) {
message.warning(tip || '请传入 fetchTableData 属性,否则Table 将无法发起请求');
return;
}
setVisible(true);
};
return (
<RowStyleLayout>
<Input
value={
tableRowLableKey ?
value.map(item => item[tableRowLableKey]).join(',') :
''
}
addonAfter={(
<>
{editable && (
<Button
type="primary"
className="relevance"
icon={<LinkOutlined />}
onClick={handleModalVisible}
disabled={disabled}
block
>
{title}
</Button>
)}
</>
)}
disabled
/>
<ModalTable
confirm={handleConfirm}
cancel={() => setVisible(false)}
visible={visible}
width={960}
{...modalProps}
modalTitle={modalProps.title}
rowSelection={rowSelection}
columns={columns}
fetchTableData={fetchTableData}
formilyProps={formilyProps}
tableProps={tableProps}
/>
</RowStyleLayout>
);
};
Relevance.defaultProps = {};
Relevance.isFieldComponent = true;
export default Relevance;
import React, { useState, useEffect } from 'react';
import { Input, Button, message } from 'antd';
import { LinkOutlined } from '@ant-design/icons';
import styled from 'styled-components';
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable';
import ModalTable from '@/components/ModalTable';
const RowStyleLayout = styled(props => <div {...props} />)`
width: 100%;
.relevance {
height: 100%;
background: #909399;
border-radius: 0;
&[disabled] {
background: #F4F5F7;
}
}
.ant-input-group-addon {
padding: 0;
border: none;
}
`;
const Relevance = props => {
const {
editable,
value = [],
} = props;
const {
modalProps = {
title: '标题',
width: 960,
},
selectionType = 'radio',
columns,
formilyProps,
tableProps = {},
fetchTableData,
title = '选择',
tip = '', // 点击按钮前的提示,用于前提需要提示的场景
disabled = false,
} = props.props['x-component-props'];
const tableRowKey = tableProps.rowKey || 'id';
const tableRowLableKey = tableProps.lableKey || ''; // Input展示用的 key val
const [visible, setVisible] = useState(false);
const [rowSelection, rowCtl] = useRowSelectionTable({ type: selectionType, customKey: tableRowKey });
useEffect(() => {
// Table 只能缓存 keys
const rowKeys = value.map(item => item[tableRowKey]);
rowCtl.setSelectedRowKeys(rowKeys);
rowCtl.setSelectRow(value);
}, [props.value, tableProps.rowKey]);
const handleConfirm = () => {
const rows = rowCtl.selectRow;
const keys = rows.map(item => item[tableRowKey]);
if (props.mutators) {
if (rows && rows.length) {
props.mutators.change(rows);
}
setVisible(false);
return;
}
rowCtl.setSelectedRowKeys(keys);
setVisible(false);
};
const handleModalVisible = () => {
if (!fetchTableData) {
message.warning(tip || '请传入 fetchTableData 属性,否则Table 将无法发起请求');
return;
}
setVisible(true);
};
return (
<RowStyleLayout>
<Input
value={
tableRowLableKey ?
value.map(item => item[tableRowLableKey]).join(',') :
''
}
addonAfter={(
<>
{editable && (
<Button
type="primary"
className="relevance"
icon={<LinkOutlined />}
onClick={handleModalVisible}
disabled={disabled}
block
>
{title}
</Button>
)}
</>
)}
disabled
/>
<ModalTable
confirm={handleConfirm}
cancel={() => setVisible(false)}
visible={visible}
width={960}
{...modalProps}
modalTitle={modalProps.title}
rowSelection={rowSelection}
columns={columns}
fetchTableData={fetchTableData}
formilyProps={formilyProps}
tableProps={tableProps}
resetModal={{
destroyOnClose: true,
}}
/>
</RowStyleLayout>
);
};
Relevance.defaultProps = {};
Relevance.isFieldComponent = true;
export default Relevance;
/*
* @Author: XieZhiXiong
* @Date: 2020-12-22 18:01:50
* @LastEditors: XieZhiXiong
* @LastEditTime: 2020-12-22 18:01:51
* @Description: 单据列表 弹窗表格列
*/
import {
ORDER_TYPE2,
PurchaseOrderInsideWorkStateTexts,
} from '@/constants';
/**
* 采购订单-弹窗表格列
*/
export const purchaseOrderColumns: any[] = [
{
title: '订单号',
align: 'center',
dataIndex: 'orderNo',
},
{
title: '订单摘要',
align: 'center',
dataIndex: 'orderThe',
},
{
title: '会员名称',
align: 'center',
dataIndex: 'supplyMembersName',
},
{
title: '下单时间',
align: 'center',
dataIndex: 'createTime',
},
{
title: '订单类型',
align: 'center',
dataIndex: 'type',
render: text => ORDER_TYPE2[text],
},
{
title: '订单状态',
align: 'center',
dataIndex: 'interiorState',
render: text => PurchaseOrderInsideWorkStateTexts[text],
},
];
/**
* 销售订单-弹窗表格列
*/
export const salesOrderColumns: any[] = [
{
title: '订单号',
align: 'center',
dataIndex: 'orderNo',
},
{
title: '订单摘要',
align: 'center',
dataIndex: 'orderThe',
},
{
title: '会员名称',
align: 'center',
dataIndex: 'createMemberName',
},
{
title: '下单时间',
align: 'center',
dataIndex: 'createTime',
},
{
title: '订单类型',
align: 'center',
dataIndex: 'type',
render: text => ORDER_TYPE2[text],
},
{
title: '订单状态',
align: 'center',
dataIndex: 'interiorState',
render: text => PurchaseOrderInsideWorkStateTexts[text],
},
];
/**
* 加工入库单列表
*/
export const machiningWarehousingColumns = [
{
title: '通知单号',
align: 'center',
dataIndex: 'noticeNo',
},
{
title: '通知单摘要',
align: 'center',
dataIndex: 'summary',
},
{
title: '加工企业名称',
align: 'center',
dataIndex: 'processName',
},
{
title: '单据时间',
align: 'center',
dataIndex: 'createTime',
},
{
title: '申请单状态',
align: 'center',
dataIndex: 'outerStatusName',
},
];
/**
* 加工发货单列表
*/
export const machiningDeliveryColumns = [
{
title: '通知单号',
align: 'center',
dataIndex: 'noticeNo',
},
{
title: '通知单摘要',
align: 'center',
dataIndex: 'summary',
},
{
title: '供应会员',
align: 'center',
dataIndex: 'supplierName',
},
{
title: '单据时间',
align: 'center',
dataIndex: 'createTime',
},
{
title: '申请单状态',
align: 'center',
dataIndex: 'outerStatusName',
},
];
/**
* 售后发货、入库订单列表
*/
export const getAfterSaleColumns = (isPurchaser?: boolean) => {
return [
{
title: '申请单号',
align: 'center',
dataIndex: 'applyNo',
},
{
title: '申请单摘要',
align: 'center',
dataIndex: 'applyAbstract',
},
isPurchaser ? {
title: '供应会员',
align: 'center',
dataIndex: 'supplierName',
} : {
title: '采购会员',
align: 'center',
dataIndex: 'consumerName',
},
{
title: '单据时间',
align: 'center',
dataIndex: 'applyTime',
},
{
title: '申请单状态',
align: 'center',
dataIndex: 'outerStatusName',
},
];
};
\ No newline at end of file
/*
* @Author: XieZhiXiong
* @Date: 2020-12-22 17:57:26
* @LastEditors: XieZhiXiong
* @LastEditTime: 2020-12-22 17:57:26
* @Description: 获取 单据列表 弹窗数据接口相关
*/
import { PublicApi } from '@/services/api';
import moment from 'moment';
// 获取采购入库单相关数据
export const fetchOrderPurchaseReceiptAddList = async (params: any) => {
const res = await PublicApi.getOrderPurchaseReceiptAddList({
...params,
})
if (res.code === 1000) {
return {
data: res.data.data.map(item => ({
...item,
memberName: item.supplyMembersName,
membersId: item.supplyMembersId,
membersRoleId: item.supplyMembersRoleId,
})),
total: res.data.totalCount,
};
}
return [];
};
// 获取销售发货单相关数据
export const getOrderSalesInvoiceOrderList = async (params: any) => {
const res = await PublicApi.getOrderSalesInvoiceOrderList({
...params,
})
if (res.code === 1000) {
return {
data: res.data.data.map(item => ({
...item,
memberName: item.memberName,
membersId: item.memberId,
membersRoleId: item.memberRoleId,
})),
total: res.data.totalCount,
};
}
return [];
};
// 获取加工入库单单相关数据
export const getMachiningWarehousingList = async (params: any) => {
const { search, ...rest } = params;
const res = await PublicApi.getEnhanceSupplierToBeAddStorageList({
noticeNo: search,
...rest,
})
if (res.code === 1000) {
return {
data: res.data.data.map(item => ({
...item,
memberName: item.processName,
deliveryAddresId: +item.receiverAddressId,
fullAddress: item.receiveAddress || '',
receiverName: item.receiveUserName || '',
phone: item.receiveUserTel || '',
})),
total: res.data.totalCount,
};
}
return [];
};
// 获取加工发货单单相关数据
export const getMachiningDeliveryList = async (params: any) => {
const { search, ...rest } = params;
const res = await PublicApi.getEnhanceProcessToBeAddDeliveryList({
noticeNo: search,
...rest,
})
if (res.code === 1000) {
return {
data: res.data.data.map(item => ({
...item,
memberName: item.supplierName,
deliveryAddresId: +item.receiverAddressId,
fullAddress: item.receiveAddress || '',
receiverName: item.receiveUserName || '',
phone: item.receiveUserTel || '',
})),
total: res.data.totalCount,
};
}
return [];
};
// 获取售后退货发货单单相关数据
export const getRefundDeliveryList = async (params: any) => {
const { search, startTime, endTime, ...rest } = params;
const res = await PublicApi.getAsReturnGoodsPageToBeAddReturnDeliveryGoods({
applyNo: search,
startTime: startTime ? moment(+startTime).format('YYYY-MM-DD HH:mm:ss') : null,
endTime: endTime ? moment(+endTime).format('YYYY-MM-DD HH:mm:ss') : null,
...rest,
})
if (res.code === 1000) {
return {
data: res.data.data.map(item => ({
...item,
id: item.returnId,
memberName: item.supplierName,
membersId: item.parentMemberId,
membersRoleId: item.parentMemberRoleId,
deliveryAddresId: item.returnGoodsAddress.receiveId,
fullAddress: item.returnGoodsAddress.receiveAddress || '',
receiverName: item.returnGoodsAddress.receiveUserName || '',
phone: item.returnGoodsAddress.receiveUserTel || '',
deliveryType: item.returnGoodsAddress.deliveryType || '',
})),
total: res.data.totalCount,
};
}
return [];
};
// 获取售后退货入库单单相关数据
export const getRefundWarehousingList = async (params: any) => {
const { search, startTime, endTime, ...rest } = params;
const res = await PublicApi.getAsReturnGoodsPageToBeAddReturnGoodsStorage({
applyNo: search,
startTime: startTime ? moment(+startTime).format('YYYY-MM-DD HH:mm:ss') : null,
endTime: endTime ? moment(+endTime).format('YYYY-MM-DD HH:mm:ss') : null,
...rest,
})
if (res.code === 1000) {
return {
data: res.data.data.map(item => ({
...item,
id: item.returnId,
memberName: item.consumerName,
membersId: item.parentMemberId,
membersRoleId: item.parentMemberRoleId,
deliveryAddresId: item.returnGoodsAddress.sendId,
fullAddress: item.returnGoodsAddress.sendAddress || '',
receiverName: item.returnGoodsAddress.sendUserName || '',
phone: item.returnGoodsAddress.sendUserTel || '',
deliveryType: item.returnGoodsAddress.deliveryType || '',
})),
total: res.data.totalCount,
};
}
return [];
};
// 获取售后换货退货发货单单相关数据
export const getExchangeReturnDeliveryList = async (params: any) => {
const { search, startTime, endTime, ...rest } = params;
const res = await PublicApi.getAsReplaceGoodsPageToBeAddReturnDeliveryGoods({
applyNo: search,
startTime: startTime ? moment(+startTime).format('YYYY-MM-DD HH:mm:ss') : null,
endTime: endTime ? moment(+endTime).format('YYYY-MM-DD HH:mm:ss') : null,
...rest,
})
if (res.code === 1000) {
return {
data: res.data.data.map(item => ({
...item,
id: item.replaceId,
memberName: item.supplierName,
membersId: item.parentMemberId,
membersRoleId: item.parentMemberRoleId,
deliveryAddresId: item.returnGoodsAddress.receiveId,
fullAddress: item.returnGoodsAddress.receiveAddress || '',
receiverName: item.returnGoodsAddress.receiveUserName || '',
phone: item.returnGoodsAddress.receiveUserTel || '',
deliveryType: item.returnGoodsAddress.deliveryType || '',
})),
total: res.data.totalCount,
};
}
return [];
};
// 获取售后换货退货入库单单相关数据
export const getExchangeReturnWarehousingList = async (params: any) => {
const { search, startTime, endTime, ...rest } = params;
const res = await PublicApi.getAsReplaceGoodsPageToBeAddReturnGoodsStorage({
applyNo: search,
startTime: startTime ? moment(+startTime).format('YYYY-MM-DD HH:mm:ss') : null,
endTime: endTime ? moment(+endTime).format('YYYY-MM-DD HH:mm:ss') : null,
...rest,
})
if (res.code === 1000) {
return {
data: res.data.data.map(item => ({
...item,
id: item.replaceId,
memberName: item.consumerName,
membersId: item.parentMemberId,
membersRoleId: item.parentMemberRoleId,
deliveryAddresId: item.returnGoodsAddress.receiveId,
fullAddress: item.returnGoodsAddress.receiveAddress || '',
receiverName: item.returnGoodsAddress.receiveUserName || '',
phone: item.returnGoodsAddress.receiveUserTel || '',
deliveryType: item.returnGoodsAddress.deliveryType || '',
})),
total: res.data.totalCount,
};
}
return [];
};
// 获取售后换货发货单单相关数据
export const getExchangeDeliveryList = async (params: any) => {
const { search, startTime, endTime, ...rest } = params;
const res = await PublicApi.getAsReplaceGoodsPageToBeAddReplaceDeliveryGoods({
applyNo: search,
startTime: startTime ? moment(+startTime).format('YYYY-MM-DD HH:mm:ss') : null,
endTime: endTime ? moment(+endTime).format('YYYY-MM-DD HH:mm:ss') : null,
...rest,
})
if (res.code === 1000) {
return {
data: res.data.data.map(item => ({
...item,
id: item.replaceId,
memberName: item.supplierName,
membersId: item.parentMemberId,
membersRoleId: item.parentMemberRoleId,
deliveryAddresId: item.replaceGoodsAddress.receiveId,
fullAddress: item.replaceGoodsAddress.receiveAddress || '',
receiverName: item.replaceGoodsAddress.receiveUserName || '',
phone: item.replaceGoodsAddress.receiveUserTel || '',
deliveryType: item.replaceGoodsAddress.deliveryType || '',
})),
total: res.data.totalCount,
};
}
return [];
};
// 获取售后换货入库单单相关数据
export const getExchangeWarehousingList = async (params: any) => {
const { search, startTime, endTime, ...rest } = params;
const res = await PublicApi.getAsReplaceGoodsPageToBeAddReplaceGoodsStorage({
applyNo: search,
startTime: startTime ? moment(+startTime).format('YYYY-MM-DD HH:mm:ss') : null,
endTime: endTime ? moment(+endTime).format('YYYY-MM-DD HH:mm:ss') : null,
...rest,
})
if (res.code === 1000) {
return {
data: res.data.data.map(item => ({
...item,
id: item.replaceId,
memberName: item.consumerName,
membersId: item.parentMemberId,
membersRoleId: item.parentMemberRoleId,
deliveryAddresId: item.replaceGoodsAddress.receiveId,
fullAddress: item.replaceGoodsAddress.receiveAddress || '',
receiverName: item.replaceGoodsAddress.receiveUserName || '',
phone: item.replaceGoodsAddress.receiveUserTel || '',
deliveryType: item.replaceGoodsAddress.deliveryType || '',
})),
total: res.data.totalCount,
};
}
return [];
};
\ No newline at end of file
......@@ -752,6 +752,84 @@ export const machiningDeliveryBillSchema: ISchema = {
},
};
// 售后发货、入库 弹窗 search schema
export const afterSaleBillSchema = (isPurchaser: boolean): ISchema => {
return {
type: 'object',
properties: {
megaLayout: {
type: 'object',
'x-component': 'Mega-Layout',
properties: {
search: {
type: 'string',
'x-component': 'Search',
'x-mega-props': {},
'x-component-props': {
placeholder: '搜索',
align: 'flex-start',
tip: '输入 通知单号 进行搜索',
},
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'Mega-Layout',
'x-component-props': {
grid: true,
full: true,
autoRow: true,
columns: 3,
},
properties: {
applyAbstract: {
type: 'string',
'x-component-props': {
placeholder: '申请单摘要',
allowClear: true,
},
},
...(isPurchaser ? {
supplierName: {
type: 'string',
'x-component-props': {
placeholder: '供应会员',
allowClear: true,
},
},
} : {
consumerName: {
type: 'string',
'x-component-props': {
placeholder: '采购会员',
allowClear: true,
},
},
}),
'[startTime, endTime]': {
type: 'string',
'x-component': 'DateSelect',
'x-component-props': {
placeholder: '单据时间',
allowClear: true,
},
},
submit: {
'x-component': 'Submit',
'x-mega-props': {
span: 1,
},
'x-component-props': {
children: '查询',
}
}
},
},
},
},
},
}
};
export const goodsSearchSchema: ISchema = {
type: 'object',
properties: {
......
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