Commit 233871d1 authored by XieZhiXiong's avatar XieZhiXiong

开发中

parent 46cd4783
/*
* @Author: LeeJiancong
* @Date: 2020-07-31 19:56:22
* @LastEditors: LeeJiancong
* @LastEditors: XieZhiXiong
* @Copyright: 1549414730@qq.com
* @LastEditTime: 2020-09-15 17:18:01
* @LastEditTime: 2020-09-16 15:37:06
*/
const TranactionRoute = {
......@@ -48,7 +48,7 @@ const TranactionRoute = {
path: '/memberCenter/tranactionAbility/stockSellStorage/addBills',
name: 'addBills',
hideInMenu: true,
component: '@/pages/transaction/stockSellStorage/bills/addBills',
component: '@/pages/transaction/stockSellStorage/bills/addBills/index',
},
{
path: '/memberCenter/tranactionAbility/stockSellStorage/inventory',
......
import React, { useState, useEffect, useRef } from 'react';
import { Row, Col, Input, Button, Modal } from 'antd';
import React, { useState, useEffect } from 'react';
import { Input, Button } from 'antd';
import { LinkOutlined } from '@ant-design/icons';
import styled from 'styled-components';
import cx from 'classnames';
import { StandardTable } from 'god';
import NiceForm from '@/components/NiceForm';
import { createFormActions, FormEffectHooks } from '@formily/antd';
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import { FORM_FILTER_PATH } from '@/formSchema/const';
const formActions = createFormActions();
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable';
import ModalTable from '@/components/ModalTable';
const RowStyleLayout = styled(props => <div {...props} />)`
width: 100%;
.relevance {
border-color: #6b778c;
background-color: #6b778c;
border-radius: 0;
}
.ant-input-group-addon {
padding: 0;
}
`;
const data = [
{
key: '1',
role: '采购商',
businessType: '采购',
roleType: '服务消费',
memberType: '企业会员',
},
{
key: '2',
role: '供应商',
businessType: '商品供应',
roleType: '服务提供',
memberType: '企业会员',
const Relevance = props => {
const {
editable,
value = [],
} = props;
const {
modalProps = {
title: '标题',
width: 960,
},
];
selectionType = 'radio',
columns,
formilyProps,
tableProps = {},
fetchTableData,
title = '选择',
} = props.props['x-component-props'];
// 模拟请求
const fetchData = (params: any) => {
return new Promise((resolve, reject) => {
const queryResult = data.find(v => v.key === params.keywords);
setTimeout(() => {
resolve({
code: 200,
message: '',
data: queryResult ? [queryResult] : data,
});
}, 1000);
});
};
const tableRowKey = tableProps.rowKey || 'id';
const tableRowLableKey = tableProps.lableKey || ''; // Input展示用的 key val
const Relevance = props => {
const ref = useRef<any>({});
const [selectedRowKeys, setSelectedRowKeys] = useState<Array<string>>([]);
const [visible, setVisible] = useState(false);
const propsParams = props.props['x-component-props'];
const [rowSelection, rowCtl] = useRowSelectionTable({ type: selectionType });
useEffect(() => {
console.log('props', propsParams);
}, []);
// Table 只能缓存 keys
const rowKeys = value.map(item => item[tableRowKey]);
rowCtl.setSelectedRowKeys(rowKeys);
}, [props.value]);
const handlePreview = () => {
setVisible(!visible);
};
const handleConfirm = () => {
const rows = rowCtl.selectRow;
const keys = rows.map(item => item[tableRowKey]);
const rowSelection = {
selectedRowKeys: selectedRowKeys,
onChange: (selectedRowKeys: any, selectedRows: any) => {},
};
const handleSubmit = type => {
if (type === 'confirm') {
} else {
if (props.mutators) {
props.mutators.change(rows);
setVisible(false);
return;
}
rowCtl.setSelectedRowKeys(keys);
setVisible(false);
};
return (
<RowStyleLayout>
<Row>
<Col span={16}>
<Input disabled></Input>
</Col>
<Col span={8}>
<Input
value={
tableRowLableKey ?
value.map(item => item[tableRowLableKey]).join(',') :
'请指明 lableKey 值'
}
addonAfter={(
<>
{editable && (
<Button
type="primary"
className="relevance"
icon={<LinkOutlined />}
onClick={handlePreview}
onClick={() => setVisible(true)}
block
>
关联
{title}
</Button>
</Col>
</Row>
)}
</>
)}
disabled
/>
<Modal
title={propsParams.modalTitle || ''}
<ModalTable
confirm={handleConfirm}
cancel={() => setVisible(false)}
visible={visible}
width={propsParams.modalWidth || ''}
destroyOnClose
onOk={() => handleSubmit('confirm')}
onCancel={() => handleSubmit('cancel')}
>
<StandardTable
columns={propsParams.modalColumns}
currentRef={ref}
tableProps={{ rowKey: 'key' }}
width={960}
{...modalProps}
modalTitle={modalProps.title}
rowSelection={rowSelection}
fetchTableData={(params: any) => fetchData(params)}
controlRender={
<NiceForm
actions={formActions}
onSubmit={values => ref.current.reload(values)}
effects={($, actions) => {
useStateFilterSearchLinkageEffect(
$,
actions,
'search',
FORM_FILTER_PATH,
);
}}
schema={propsParams.modalSchema}
/>
}
columns={columns}
fetchTableData={fetchTableData}
formilyProps={formilyProps}
tableProps={tableProps}
/>
</Modal>
</RowStyleLayout>
);
};
......
......@@ -294,6 +294,13 @@ export const DOC_DIRECTION = {
[DOC_DIRECTION_OUTGOING]: '出库 - ',
};
// 对应单据
export const DEPENDENT_DOC_ORDER = 1; // 订单
export const DEPENDENT_DOC_EXCHANGE = 2; // 换货
export const DEPENDENT_DOC_RETURN = 3; // 退货
export const DEPENDENT_DOC_PRODUCTION = 4; // 生产
export const DEPENDENT_DOC_INTERNAL = 5; // 内部
// 订单类型
export const ORDER_TYPE2_INQUIRY = 1; // 询价采购
export const ORDER_TYPE2_DEMAND = 2; // 需求采购
......
import { useBusinessEffects } from './useBusinessEffects';
import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect';
import { PublicApi } from '@/services/api';
// 获取单据类型
const fetchInvoicesType = (): Promise<any[]> => {
return new Promise((resolve, reject) => {
PublicApi.getWarehouseInvoicesTypeAll().then(res => {
if (res.code === 1000) {
resolve(res.data);
}
reject();
}).catch(() => {
reject();
});
});
};
// 获取仓库
const fetchInventory = (): Promise<any[]> => {
return new Promise((resolve, reject) => {
PublicApi.getWarehouseWarehouseAll().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
import React, { useState, useEffect, useRef } from 'react';
import { usePageStatus } from '@/hooks/usePageStatus';
import { history } from 'umi';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { SaveOutlined, PlusOutlined } from '@ant-design/icons';
import { createFormActions, FormEffectHooks } from '@formily/antd';
import { Button, Card } from 'antd';
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable';
import { PublicApi } from '@/services/api';
/*
* @Author: XieZhiXiong
* @Date: 2020-09-16 15:16:47
* @LastEditors: XieZhiXiong
* @LastEditTime: 2020-09-16 20:16:05
* @Description: 联动逻辑相关
*/
import { FormEffectHooks, FormPath } from '@formily/antd';
import { useLinkageUtils } from '@/utils/formEffectUtils';
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import ReutrnEle from '@/components/ReturnEle';
import NiceForm from '@/components/NiceForm';
import ModalTable from '@/components/ModalTable';
import {
ORDER_TYPE2,
DEPENDENT_DOC_ORDER,
DEPENDENT_DOC_EXCHANGE,
DEPENDENT_DOC_RETURN,
DEPENDENT_DOC_PRODUCTION,
DEPENDENT_DOC_INTERNAL,
} from '@/constants';
import Search from '@/components/NiceForm/components/Search';
import Submit from '@/components/NiceForm/components/Submit';
import DateSelect from '@/components/NiceForm/components/DateSelect';
import { FORM_FILTER_PATH } from '@/formSchema/const';
import { ORDER_TYPE2 } from '@/constants';
import { getBillsDetailSchema, orderBillSchema } from './schema';
const addSchemaAction = createFormActions();
const { onFieldValueChange$ } = FormEffectHooks;
import { PublicApi } from '@/services/api';
import { orderBillSchema } from '../schema';
import { a } from '@/pages/editor/configs/componentConfigs/HTML';
const AddBills: React.FC<{}> = (props: any) => {
const ref = useRef({});
const { pageStatus, preview, id } = usePageStatus();
const [warehouseList, setWarehouseList] = useState<any>([]);
const [invoicesTypeList, setInvoicesTypeList] = useState<any>([]);
const [relevance, setRelevance] = useState(1);
const {
onFieldInputChange$,
onFieldValueChange$,
} = FormEffectHooks;
// 订单
const orderColumns: any[] = [
// 弹窗表格列-订单
const orderColumns: any[] = [
{
title: '订单号',
align: 'center',
......@@ -62,10 +62,10 @@ const AddBills: React.FC<{}> = (props: any) => {
align: 'center',
dataIndex: 'externalState',
},
];
];
// 生成通知单列表
const productionColumns = [
// 生成通知单列表
const productionColumns = [
{
title: '通知单号',
align: 'center',
......@@ -96,10 +96,10 @@ const AddBills: React.FC<{}> = (props: any) => {
dataIndex: 'state',
key: 'state',
},
];
];
// 售后订单列表
const afterSaleColumns = [
// 售后订单列表
const afterSaleColumns = [
{
title: '申请单号',
align: 'center',
......@@ -130,98 +130,10 @@ const AddBills: React.FC<{}> = (props: any) => {
dataIndex: 'state',
key: 'state',
},
];
const [modalColumns, setModalColumns] = useState(orderColumns);
const [visibleRelation, setVisibleRelation] = useState(false);
const [relationRowSelection, relationRowCtl] = useRowSelectionTable({type: 'radio'})
const tableColumns = [
{ dataIndex: 'id', title: 'ID' },
{
dataIndex: 'no',
title: '货号',
render: (text, record) => <span>{text}</span>,
},
{ dataIndex: 'pname', title: '货品名称' },
{ dataIndex: 'size', title: '规格/型号' },
{ dataIndex: 'type', title: '品类' },
{ dataIndex: 'brand', title: '品牌' },
{ dataIndex: 'unit', title: '单位' },
{ dataIndex: 'name', title: '商品名称' },
{ dataIndex: 'univalence', title: '单价' },
{ dataIndex: 'numberr', title: '单据数量' },
{ dataIndex: 'price', title: '金额' },
{
dataIndex: 'ctl',
title: '操作',
render: (text, record) => (
<Button type="link" onClick={() => handleDeleteTable(record.id)}>
删除
</Button>
),
},
];
// 弹出单据明细
const handleAddMemberBtn = () => {};
// 删除选中单据明细
const handleDeleteTable = id => {};
const tableAddButton = (
<Button
style={{ marginBottom: 16 }}
block
icon={<PlusOutlined />}
onClick={handleAddMemberBtn}
type="dashed"
>
添加单据明细
</Button>
);
useEffect(() => {
PublicApi.getWarehouseInvoicesTypeAll().then(res => {
setInvoicesTypeList(getList(res.data));
});
PublicApi.getWarehouseWarehouseAll().then(res => {
setWarehouseList(getList(res.data));
});
}, []);
// 重组(单据类型、对应仓库)列表数据
const getList = list => {
let newList = [];
for (let item of list) {
newList.push({ label: item.name, value: item.id });
}
return newList;
};
const handleSubmit = value => {
if (pageStatus === 0)
return PublicApi.postWarehouseInvoicesAdd({ ...value }).then(res => {
if (res.code === 1000) return history.goBack();
});
else
return PublicApi.postWarehouseInvoicesUpdata({
id: usePageStatus().id,
...value,
}).then(res => {
if (res.code === 1000) return history.goBack();
});
};
];
// 关联单据弹窗 confirm
const handleConfirmRelation = () => {
console.log('relationRowCtl.selectRow', relationRowCtl.selectRow);
setVisibleRelation(false);
};
// 获取关联类型列表数据
const fetchRelationList = async (params: any) => {
const shopType = addSchemaAction.getFieldValue('shopType')
// 获取订单相关数据
const fetchOrderList = async (params: any) => {
const res = await PublicApi.getOrderPurchaseReceiptAddList({
...params,
})
......@@ -229,78 +141,18 @@ const AddBills: React.FC<{}> = (props: any) => {
return res.data;
}
return [];
};
return (
<PageHeaderWrapper
onBack={() => history.goBack()}
backIcon={<ReutrnEle description="返回" />}
title={
pageStatus === 0
? '新建单据'
: pageStatus === 1
? '编辑单据'
: '查看单据'
}
extra={
preview != '1'
? [
<Button
key="1"
type="primary"
icon={<SaveOutlined />}
onClick={() => addSchemaAction.submit()}
>
保存
</Button>,
]
: []
}
>
<Card>
<Button onClick={() => setVisibleRelation(true)}>点我弹出</Button>
<NiceForm
expressionScope={{
tableColumns,
tableAddButton,
}}
effects={$=> {
$('onFieldValueChange', 'relevanceInvoices').subscribe(state => {
setRelevance(state.value);
setModalColumns(
state.value === 1
? orderColumns
: state.value === 2 || state.value === 3
? afterSaleColumns
: productionColumns,
);
});
}}
onSubmit={handleSubmit}
actions={addSchemaAction}
schema={getBillsDetailSchema({
invoicesTypeList,
warehouseList,
relevance,
modalColumns,
})}
/>
</Card>
};
<ModalTable
modalTitle='选择订单'
confirm={handleConfirmRelation}
cancel={() => setVisibleRelation(false)}
visible={visibleRelation}
columns={orderColumns}
width={960}
rowSelection={relationRowSelection}
fetchTableData={params => fetchRelationList(params)}
formilyProps={
{
const getParams = type => {
const params = {
modalProps: {
title: '标题',
},
columns: [],
fetchTableData: undefined,
formilyProps: {
ctx: {
schema: orderBillSchema,
schema: {},
components: {
Search,
Submit,
......@@ -316,20 +168,114 @@ const AddBills: React.FC<{}> = (props: any) => {
},
inline: false,
}
}
}
tableProps={{
},
tableProps: {
rowKey: 'id',
onRow: (record) => ({
onClick: () => {
relationRowCtl.setSelectRow([record]);
relationRowCtl.setSelectedRowKeys([record.id]);
lableKey: '',
},
})
}}
/>
</PageHeaderWrapper>
);
};
switch (type) {
// 对应单据 - 订单
case DEPENDENT_DOC_ORDER: {
params.modalProps.title = '选择订单';
params.columns = orderColumns;
params.fetchTableData = fetchOrderList;
params.formilyProps.ctx.schema = orderBillSchema;
params.tableProps.lableKey = 'orderNo';
break;
}
// 对应单据 - 换货
case DEPENDENT_DOC_EXCHANGE: {
break;
}
// 对应单据 - 退货
case DEPENDENT_DOC_RETURN: {
break;
}
// 对应单据 - 生产
case DEPENDENT_DOC_PRODUCTION: {
break;
}
// 对应单据 - 内部
case DEPENDENT_DOC_INTERNAL: {
break;
}
default:
break;
}
return params;
};
export default AddBills;
export const useBusinessEffects = (context, actions) => {
const { getFieldValue, setFieldValue } = actions;
const linkage = useLinkageUtils();
onFieldInputChange$('inventoryId').subscribe(fieldState => {
const current = fieldState.originAsyncData.find(item => item.id === fieldState.value);
if (current) {
linkage.value('inventoryRole', current.principal);
}
});
onFieldValueChange$('relevanceInvoices').subscribe(fieldState => {
const params = getParams(fieldState.value);
linkage.componentProps('relevanceInvoicesId', params);
});
onFieldValueChange$('relevanceInvoicesId').subscribe(fieldState => {
console.log('fieldState.value', fieldState.value)
const relevanceInvoicesVal = getFieldValue('relevanceInvoices');
const first = fieldState.value[0];
if (!first) {
return;
}
switch (relevanceInvoicesVal) {
// 对应单据 - 订单
case DEPENDENT_DOC_ORDER: {
setFieldValue('memberName', first.supplyMembersName);
setFieldValue('address', '暂无收货地址');
setFieldValue('transport', '暂无物流方式');
break;
}
// 对应单据 - 换货
case DEPENDENT_DOC_EXCHANGE: {
break;
}
// 对应单据 - 退货
case DEPENDENT_DOC_RETURN: {
break;
}
// 对应单据 - 生产
case DEPENDENT_DOC_PRODUCTION: {
break;
}
// 对应单据 - 内部
case DEPENDENT_DOC_INTERNAL: {
break;
}
default:
break;
}
});
}
\ No newline at end of file
import React, { useState, useEffect, useRef } from 'react';
import { usePageStatus } from '@/hooks/usePageStatus';
import { history } from 'umi';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { SaveOutlined, PlusOutlined } from '@ant-design/icons';
import { createFormActions, FormEffectHooks } from '@formily/antd';
import { Button, Card } from 'antd';
import { PublicApi } from '@/services/api';
import ReutrnEle from '@/components/ReturnEle';
import NiceForm from '@/components/NiceForm';
import { getBillsDetailSchema, orderBillSchema } from './schema';
import { createEffects } from './effects';
const addSchemaAction = createFormActions();
const {
onFieldValueChange$,
onFieldInputChange$,
} = FormEffectHooks;
const AddBills: React.FC<{}> = (props: any) => {
const { pageStatus, preview, id } = usePageStatus();
const [relevance, setRelevance] = useState(1);
const [modalColumns, setModalColumns] = useState([]);
const tableColumns = [
{ dataIndex: 'id', title: 'ID' },
{
dataIndex: 'no',
title: '货号',
render: (text, record) => <span>{text}</span>,
},
{ dataIndex: 'pname', title: '货品名称' },
{ dataIndex: 'size', title: '规格/型号' },
{ dataIndex: 'type', title: '品类' },
{ dataIndex: 'brand', title: '品牌' },
{ dataIndex: 'unit', title: '单位' },
{ dataIndex: 'name', title: '商品名称' },
{ dataIndex: 'univalence', title: '单价' },
{ dataIndex: 'numberr', title: '单据数量' },
{ dataIndex: 'price', title: '金额' },
{
dataIndex: 'ctl',
title: '操作',
render: (text, record) => (
<Button type="link" onClick={() => handleDeleteTable(record.id)}>
删除
</Button>
),
},
];
// 弹出单据明细
const handleAddMemberBtn = () => {};
// 删除选中单据明细
const handleDeleteTable = id => {};
const tableAddButton = (
<Button
style={{ marginBottom: 16 }}
block
icon={<PlusOutlined />}
onClick={handleAddMemberBtn}
type="dashed"
>
添加单据明细
</Button>
);
useEffect(() => {
}, []);
const handleSubmit = value => {
if (pageStatus === 0)
return PublicApi.postWarehouseInvoicesAdd({ ...value }).then(res => {
if (res.code === 1000) return history.goBack();
});
else
return PublicApi.postWarehouseInvoicesUpdata({
id: usePageStatus().id,
...value,
}).then(res => {
if (res.code === 1000) return history.goBack();
});
};
return (
<PageHeaderWrapper
onBack={() => history.goBack()}
backIcon={<ReutrnEle description="返回" />}
title={
pageStatus === 0
? '新建单据'
: pageStatus === 1
? '编辑单据'
: '查看单据'
}
extra={
preview != '1'
? [
<Button
key="1"
type="primary"
icon={<SaveOutlined />}
onClick={() => addSchemaAction.submit()}
>
保存
</Button>,
]
: []
}
>
<Card>
<NiceForm
expressionScope={{
tableColumns,
tableAddButton,
}}
effects={($, actions) => createEffects($, actions)}
onSubmit={handleSubmit}
actions={addSchemaAction}
schema={getBillsDetailSchema({
relevance,
modalColumns,
})}
/>
</Card>
</PageHeaderWrapper>
);
};
export default AddBills;
import { ISchema } from '@formily/antd';
import moment from 'moment';
import { FORM_FILTER_PATH } from '@/formSchema/const';
import {
ORDER_TYPE2_INQUIRY,
ORDER_TYPE2_DEMAND,
ORDER_TYPE2_SPOT,
ORDER_TYPE2_CENTRALIZED,
ORDER_TYPE2_POINTS,
ORDER_TYPE2_CHANNEL_DIRECT,
ORDER_TYPE2_CHANNEL_SPOT,
ORDER_TYPE2_CHANNEL_POINTS,
ORDER_TYPE2,
DEPENDENT_DOC_ORDER,
DEPENDENT_DOC_EXCHANGE,
DEPENDENT_DOC_RETURN,
DEPENDENT_DOC_PRODUCTION,
DEPENDENT_DOC_INTERNAL,
} from '@/constants';
const orderDetailSchema: ISchema = {
type: 'object',
properties: {
MEGALAYOUT2: {
type: 'object',
'x-component': 'Mega-Layout',
'x-component-props': {
},
properties: {
search: {
type: 'string',
'x-component': 'Search',
'x-component-props': {
placeholder: '搜索',
align: 'flex-start',
},
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'Mega-Layout',
visible: false,
'x-component-props': {
inline: true,
},
properties: {
orderNo: {
type: 'string',
'x-component-props': {
placeholder: '订单号',
},
},
invoicesAbstract: {
type: 'string',
'x-component-props': {
placeholder: '订单摘要',
},
},
memberName: {
type: 'string',
'x-component-props': {
placeholder: '会员名称',
},
},
time: {
type: 'string',
'x-component-props': {
placeholder: '请选择交易时间',
},
enum: [],
},
state: {
type: 'string',
'x-component-props': {
placeholder: '请选择单据状态',
},
enum: [],
},
},
},
},
},
},
};
const productionDetailSchema: ISchema = {
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',
},
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'mega-layout',
visible: false,
'x-component-props': {
inline: true,
},
properties: {
orderNo: {
type: 'string',
'x-component-props': {
placeholder: '通知单号',
},
},
invoicesAbstract: {
type: 'string',
'x-component-props': {
placeholder: '通知单摘要',
},
},
memberName: {
type: 'string',
'x-component-props': {
placeholder: '加工企业',
},
},
time: {
type: 'string',
'x-component-props': {
placeholder: '请选择单据时间',
},
enum: [],
},
},
},
},
},
},
};
const afterSaleDetailSchema: ISchema = {
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',
},
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'mega-layout',
visible: false,
'x-component-props': {
inline: true,
},
properties: {
orderNo: {
type: 'string',
'x-component-props': {
placeholder: '申请单号',
},
},
invoicesAbstract: {
type: 'string',
'x-component-props': {
placeholder: '申请单摘要',
},
},
memberName: {
type: 'string',
'x-component-props': {
placeholder: '会员名称',
},
},
time: {
type: 'string',
'x-component-props': {
placeholder: '请选择单据时间',
},
enum: [],
},
},
},
},
},
},
};
export const getBillsDetailSchema = params => {
let modalSchema, modalTitle;
if (params.relevance === 1) {
modalSchema = orderDetailSchema;
modalTitle = '选择订单';
} else if (params.relevance === 2 || params.relevance === 3) {
modalSchema = afterSaleDetailSchema;
modalTitle = '选择售后单';
} else {
modalSchema = productionDetailSchema;
modalTitle = '选择生产通知单';
}
const billsDetailSchema: ISchema = {
type: 'object',
properties: {
REPOSIT_TABS: {
type: 'object',
'x-component': 'tab',
'x-component-props': {
type: 'card',
},
properties: {
'tab-1': {
type: 'object',
'x-component': 'tabpane',
'x-component-props': {
tab: '基本信息',
},
properties: {
MEGA_LAYOUT1: {
type: 'object',
'x-component': 'Mega-Layout',
'x-component-props': {
labelCol: 4,
wrapperCol: 12,
labelAlign: 'left',
},
properties: {
invoicesTypeId: {
type: 'string',
title: '单据类型',
enum: [],
'x-component-props': {
placeholder: '请选择',
},
required: true,
},
inventoryId: {
type: 'string',
title: '对应仓库',
enum: [],
'x-component-props': {
placeholder: '请选择',
},
required: true,
},
invoicesAbstract: {
type: 'string',
title: '单据摘要',
required: true,
},
inventoryRole: {
type: 'string',
title: '仓库人员',
required: true,
},
transactionTime: {
type: 'date',
title: '单据时间',
default: moment(),
'x-component-props': {
format: 'YYYY-MM-DD HH:mm:ss',
showTime: true,
},
required: true,
},
relevanceInvoices: {
type: 'radio',
title: '对应单据',
required: true,
enum: [
{ label: '订单', value: DEPENDENT_DOC_ORDER },
{ label: '换货申请单', value: DEPENDENT_DOC_EXCHANGE },
{ label: '退货申请单', value: DEPENDENT_DOC_RETURN },
{ label: '生产通知单', value: DEPENDENT_DOC_PRODUCTION },
{ label: '内部单据', value: DEPENDENT_DOC_INTERNAL },
],
default: 1,
},
// 这是用 Mega-Layout 设置独立作用域,不然会被 Form 的布局影响到弹窗的布局
MEGA_LAYOUT1_1: {
type: 'object',
'x-component': 'Mega-Layout',
'x-component-props': {
wrapperCol: 24,
},
properties: {
relevanceInvoicesId: {
type: 'string',
title: '关联单据',
'x-component': 'CustomRelevance',
'x-component-props': {
title: '关联',
},
'x-mega-props': {
wrapperCol: 12,
},
'x-rules': [
{
required: true,
message: '请关联单据',
},
],
},
},
},
memberName: {
type: 'string',
'x-component': 'Text',
title: '会员名称',
default: '暂无',
},
address: {
type: 'string',
'x-component': 'Text',
title: '收货地址',
default: '暂无',
},
transport: {
type: 'string',
'x-component': 'Text',
title: '物流方式',
default: '暂无',
},
},
},
},
},
'tab-2': {
type: 'object',
'x-component': 'tabpane',
'x-component-props': {
tab: '单据明细',
},
properties: {
MEGA_LAYOUT2: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
labelCol: 4,
labelAlign: 'left',
},
properties: {
applyMember: {
type: 'array:number',
'x-component': 'MultTable',
'x-component-props': {
rowKey: 'memberId',
columns: '{{tableColumns}}',
prefix: '{{tableAddButton}}',
},
default: [
{ id: 1, name: '名称', type: '类型' },
{ id: 2, name: '名称1', type: '类型1' },
],
},
},
},
},
},
},
},
},
};
return billsDetailSchema;
};
export const orderBillSchema: ISchema = {
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',
},
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'Mega-Layout',
'x-component-props': {
grid: true,
full: true,
autoRow: true,
columns: 3,
},
properties: {
orderNo: {
type: 'string',
'x-component-props': {
placeholder: '订单号(全部)',
allowClear: true,
},
},
orderThe: {
type: 'string',
'x-component-props': {
placeholder: '订单摘要(全部)',
allowClear: true,
},
},
supplyMembersName: {
type: 'string',
'x-component-props': {
placeholder: '会员名称(全部)',
allowClear: true,
},
},
'[startCreateTime, endCreateTime]': {
type: 'string',
'x-component': 'DateSelect',
'x-component-props': {
placeholder: '下单时间(全部)',
allowClear: true,
},
},
type: {
type: 'string',
'x-component-props': {
placeholder: '订单类型(全部)',
allowClear: true,
},
enum: [
{ label: ORDER_TYPE2[ORDER_TYPE2_INQUIRY], value: ORDER_TYPE2_INQUIRY },
{ label: ORDER_TYPE2[ORDER_TYPE2_DEMAND], value: ORDER_TYPE2_DEMAND },
{ label: ORDER_TYPE2[ORDER_TYPE2_SPOT], value: ORDER_TYPE2_SPOT },
{ label: ORDER_TYPE2[ORDER_TYPE2_CENTRALIZED], value: ORDER_TYPE2_CENTRALIZED },
{ label: ORDER_TYPE2[ORDER_TYPE2_POINTS], value: ORDER_TYPE2_POINTS },
{ label: ORDER_TYPE2[ORDER_TYPE2_CHANNEL_DIRECT], value: ORDER_TYPE2_CHANNEL_DIRECT },
{ label: ORDER_TYPE2[ORDER_TYPE2_CHANNEL_SPOT], value: ORDER_TYPE2_CHANNEL_SPOT },
{ label: ORDER_TYPE2[ORDER_TYPE2_CHANNEL_POINTS], value: ORDER_TYPE2_CHANNEL_POINTS },
],
},
submit: {
'x-component': 'Submit',
'x-mega-props': {
span: 1,
},
'x-component-props': {
children: '查询',
}
}
},
},
},
},
},
};
\ No newline at end of file
import { ISchema } from '@formily/antd';
import { FORM_FILTER_PATH } from '@/formSchema/const';
import {
ORDER_TYPE2_INQUIRY,
ORDER_TYPE2_DEMAND,
ORDER_TYPE2_SPOT,
ORDER_TYPE2_CENTRALIZED,
ORDER_TYPE2_POINTS,
ORDER_TYPE2_CHANNEL_DIRECT,
ORDER_TYPE2_CHANNEL_SPOT,
ORDER_TYPE2_CHANNEL_POINTS,
ORDER_TYPE2,
} from '@/constants';
export const billsSchema: ISchema = {
type: 'object',
......@@ -117,433 +106,3 @@ export const billsSchema: ISchema = {
},
},
};
\ No newline at end of file
const orderDetailSchema: ISchema = {
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',
},
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'mega-layout',
visible: false,
'x-component-props': {
inline: true,
},
properties: {
orderNo: {
type: 'string',
'x-component-props': {
placeholder: '订单号',
},
},
invoicesAbstract: {
type: 'string',
'x-component-props': {
placeholder: '订单摘要',
},
},
memberName: {
type: 'string',
'x-component-props': {
placeholder: '会员名称',
},
},
time: {
type: 'string',
'x-component-props': {
placeholder: '请选择交易时间',
},
enum: [],
},
state: {
type: 'string',
'x-component-props': {
placeholder: '请选择单据状态',
},
enum: [],
},
},
},
},
},
},
};
const productionDetailSchema: ISchema = {
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',
},
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'mega-layout',
visible: false,
'x-component-props': {
inline: true,
},
properties: {
orderNo: {
type: 'string',
'x-component-props': {
placeholder: '通知单号',
},
},
invoicesAbstract: {
type: 'string',
'x-component-props': {
placeholder: '通知单摘要',
},
},
memberName: {
type: 'string',
'x-component-props': {
placeholder: '加工企业',
},
},
time: {
type: 'string',
'x-component-props': {
placeholder: '请选择单据时间',
},
enum: [],
},
},
},
},
},
},
};
const afterSaleDetailSchema: ISchema = {
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',
},
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'mega-layout',
visible: false,
'x-component-props': {
inline: true,
},
properties: {
orderNo: {
type: 'string',
'x-component-props': {
placeholder: '申请单号',
},
},
invoicesAbstract: {
type: 'string',
'x-component-props': {
placeholder: '申请单摘要',
},
},
memberName: {
type: 'string',
'x-component-props': {
placeholder: '会员名称',
},
},
time: {
type: 'string',
'x-component-props': {
placeholder: '请选择单据时间',
},
enum: [],
},
},
},
},
},
},
};
export const getBillsDetailSchema = params => {
let modalSchema, modalTitle;
if (params.relevance === 1) {
modalSchema = orderDetailSchema;
modalTitle = '选择订单';
} else if (params.relevance === 2 || params.relevance === 3) {
modalSchema = afterSaleDetailSchema;
modalTitle = '选择售后单';
} else {
modalSchema = productionDetailSchema;
modalTitle = '选择生产通知单';
}
const relevanceInvoices =
params.relevance != 5
? {
relevanceInvoicesId: {
type: 'string',
title: '关联单据',
'x-component': 'CustomRelevance',
'x-component-props': {
modalTitle: modalTitle,
modalWidth: 1000,
modalSchema: modalSchema,
modalColumns: params.modalColumns,
},
},
memberName: {
type: 'string',
'x-component': 'Text',
title: '会员名称',
default: '暂无',
},
address: {
type: 'string',
'x-component': 'Text',
title: '发货地址',
default: '暂无',
},
logistry: {
type: 'string',
'x-component': 'Text',
title: '物流方式',
default: '暂无',
},
}
: {};
const billsDetailSchema: ISchema = {
type: 'object',
properties: {
REPOSIT_TABS: {
type: 'object',
'x-component': 'tab',
'x-component-props': {
type: 'card',
},
properties: {
'tab-1': {
type: 'object',
'x-component': 'tabpane',
'x-component-props': {
tab: '基本信息',
},
properties: {
MEGA_LAYOUT1: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
labelCol: 4,
wrapperCol: 12,
labelAlign: 'left',
},
properties: {
name: {
type: 'string',
title: '单据类型',
enum: params.invoicesTypeList,
'x-component-props': {
placeholder: '请选择',
},
required: true,
},
inventory: {
type: 'string',
title: '对应仓库',
enum: params.warehouseList,
'x-component-props': {
placeholder: '请选择',
},
required: true,
},
invoicesAbstract: {
type: 'string',
title: '单据摘要',
required: true,
},
person: {
type: 'string',
title: '仓库人员',
required: true,
},
time: {
type: 'date',
title: '单据时间',
'x-component-props': {
format: 'YYYY-MM-DD HH:mm:ss',
},
required: true,
},
relevanceInvoices: {
type: 'radio',
title: '对应单据',
required: true,
enum: [
{ label: '订单', value: 1 },
{ label: '换货申请单', value: 2 },
{ label: '退货申请单', value: 3 },
{ label: '生产通知单', value: 4 },
{ label: '内部单据', value: 5 },
],
default: 1,
},
...relevanceInvoices,
},
},
},
},
'tab-2': {
type: 'object',
'x-component': 'tabpane',
'x-component-props': {
tab: '单据明细',
},
properties: {
MEGA_LAYOUT2: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
labelCol: 4,
labelAlign: 'left',
},
properties: {
applyMember: {
type: 'array:number',
'x-component': 'MultTable',
'x-component-props': {
rowKey: 'memberId',
columns: '{{tableColumns}}',
prefix: '{{tableAddButton}}',
},
default: [
{ id: 1, name: '名称', type: '类型' },
{ id: 2, name: '名称1', type: '类型1' },
],
},
},
},
},
},
},
},
},
};
return billsDetailSchema;
};
export const orderBillSchema: ISchema = {
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',
},
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'Mega-Layout',
'x-component-props': {
grid: true,
full: true,
autoRow: true,
columns: 3,
},
properties: {
orderNo: {
type: 'string',
'x-component-props': {
placeholder: '订单号(全部)',
allowClear: true,
},
},
orderThe: {
type: 'string',
'x-component-props': {
placeholder: '订单摘要(全部)',
allowClear: true,
},
},
supplyMembersName: {
type: 'string',
'x-component-props': {
placeholder: '会员名称(全部)',
allowClear: true,
},
},
'[startCreateTime, endCreateTime]': {
type: 'string',
'x-component': 'DateSelect',
'x-component-props': {
placeholder: '下单时间(全部)',
allowClear: true,
},
},
type: {
type: 'string',
'x-component-props': {
placeholder: '订单类型(全部)',
allowClear: true,
},
enum: [
{ label: ORDER_TYPE2[ORDER_TYPE2_INQUIRY], value: ORDER_TYPE2_INQUIRY },
{ label: ORDER_TYPE2[ORDER_TYPE2_DEMAND], value: ORDER_TYPE2_DEMAND },
{ label: ORDER_TYPE2[ORDER_TYPE2_SPOT], value: ORDER_TYPE2_SPOT },
{ label: ORDER_TYPE2[ORDER_TYPE2_CENTRALIZED], value: ORDER_TYPE2_CENTRALIZED },
{ label: ORDER_TYPE2[ORDER_TYPE2_POINTS], value: ORDER_TYPE2_POINTS },
{ label: ORDER_TYPE2[ORDER_TYPE2_CHANNEL_DIRECT], value: ORDER_TYPE2_CHANNEL_DIRECT },
{ label: ORDER_TYPE2[ORDER_TYPE2_CHANNEL_SPOT], value: ORDER_TYPE2_CHANNEL_SPOT },
{ label: ORDER_TYPE2[ORDER_TYPE2_CHANNEL_POINTS], value: ORDER_TYPE2_CHANNEL_POINTS },
],
},
submit: {
'x-component': 'Submit',
'x-mega-props': {
span: 1,
},
'x-component-props': {
children: '查询',
}
}
},
},
},
},
},
};
\ No newline at end of file
......@@ -6,7 +6,7 @@ export const useLinkageUtils = () => {
setFieldState(path, state => {
const componentProps = state.props['x-component-props'] || {}
// 对象浅合并
if (key === 'props["x-component-props"]') {
if (key === 'props.x-component-props') {
value = Object.assign({}, componentProps, value)
}
FormPath.setIn(state, key, value !== undefined ? value : defaultValue)
......@@ -19,6 +19,6 @@ export const useLinkageUtils = () => {
loading: linkage('loading', true),
loaded: linkage('loading', false),
value: linkage('value'),
componentProps: linkage('props["x-component-props"]', {})
componentProps: linkage('props.x-component-props', {})
}
}
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