Commit d7514cfb authored by Bill's avatar Bill

对接待新增生产通知单

parent 57a54c8f
......@@ -45,5 +45,4 @@ export const fetchOptions = (service) => {
}
return [];
}
}
\ No newline at end of file
......@@ -13,6 +13,7 @@ import EnterPrise from '../../components/EnterPrise';
import ProcessProducts from '../../components/ProcessProducts';
import ProcessOrder from '../../components/ProcessOrder';
import {WrapUploadFile} from '../../components/UploadFile';
import { PublicApi } from '@/services/api';
/*
* @Author: Bill
......@@ -21,7 +22,7 @@ import {WrapUploadFile} from '../../components/UploadFile';
*/
const formActions = createFormActions();
const { onFieldValueChange$ } = FormEffectHooks
const { onFieldValueChange$, onFieldMount$ } = FormEffectHooks
const Add: React.FC<{}> = () => {
const [submitLoading, setSubmitLoading] = useState<boolean>(false);
......@@ -92,10 +93,19 @@ const Add: React.FC<{}> = () => {
setActiveSource(value);
}
})
// 设置自提的时候隐藏地址
onFieldValueChange$('Tabs.tab-1.layout.method').subscribe(({value}) => {
formActions.setFieldState('address', state => {
state.visible = value == 1
// 当物流为 物流时,那么填充
onFieldMount$('receiveAddress').subscribe((state) => {
PublicApi.getLogisticsReceiverAddressPage({current: '1', pageSize: '10'})
.then((res) => {
let options = []
if(res.code === 1000) {
options = res.data.data.map((item) => {
return { label: `${item.fullAddress} / ${item.receiverName} / ${item.phone}`, value: item.id }}
)
}
formActions.setFieldState("receiveAddress", (state) => {
state.props["x-component-props"]["options"] = options;
})
})
})
}
......@@ -115,8 +125,11 @@ const Add: React.FC<{}> = () => {
* @param rows
*/
const enterPriseOnOk = (rows) => {
console.log(rows.selectRow)
formActions.setFieldValue('Tabs.tab-1.layout.handleBusiness', "123")
const { memberId, name, roleId } = rows.selectRow[0];
formActions.setFieldValue('Tabs.tab-1.layout.processName', name);
formActions.setFieldValue('Tabs.tab-1.layout.processMemberId', memberId);
formActions.setFieldValue('Tabs.tab-1.layout.processRoleId', roleId);
}
/**
......@@ -143,6 +156,11 @@ const Add: React.FC<{}> = () => {
console.log(values);
}
useEffect(() => {
// 默认情况下选择订单加工,那么此时默认填写通知单摘要为订单商品的第一条数据
formActions.setFieldValue('Tabs.tab-1.layout.summary', "进口头层黄牛皮荔枝纹")
}, [])
/** 逻辑 end */
return (
......
......@@ -77,11 +77,15 @@ const basicTab = {
labelAlign: 'left'
},
properties: {
desc: {
summary: {
title: '通知单摘要',
type: 'string',
'x-rules': [
{
required: true,
message: '请填写通知单摘要'
},
{
limitByte: true, // 自定义校验规则
maxByte: 60
}
......@@ -90,7 +94,7 @@ const basicTab = {
placeholder: '最长60个字符,30个汉字'
}
},
handleBusiness: {
processName: {
type: 'string',
title: '加工企业',
"x-component-props": {
......@@ -104,6 +108,14 @@ const basicTab = {
}
],
},
processMemberId: { //加工企业会员ID
type: 'string',
display: false
},
processRoleId: { //加工企业会员角色ID
type: 'string',
display: false,
},
source: {
type: 'radio',
title: '通知单来源',
......@@ -121,7 +133,7 @@ const basicTab = {
default: 1
},
time: {
deliveryDate: {
type: 'string',
title: '交期',
'x-component': 'DatePicker',
......@@ -132,7 +144,7 @@ const basicTab = {
}
]
},
method: {
deliveryType: {
type: 'string',
title: '配送方式',
'x-component': 'Select',
......@@ -147,9 +159,16 @@ const basicTab = {
required: true,
message: '请选择物流方式'
}
]
],
'x-linkages': [
{
type: 'value:visible',
target: 'receiveAddress',
condition: '{{$value == 1}}'
}
],
},
address: {
receiveAddress: {
type: 'string',
title: '收货地址',
'x-rules': [
......@@ -160,9 +179,7 @@ const basicTab = {
],
'x-component': 'Select',
'x-component-props': {
options: [
{label: 'test', value: 1}
]
}
},
docNo: {
......
/**
* 时间
*/
export const commonTimeList = [
{ label: '今天', value: 1},
{ label: '一周内', value: 2},
{ label: '一个月内', value: 3},
{ label: '三个月内', value: 4},
{ label: '六个月内', value: 5},
{ label: '一年内', value: 6 },
{ label: '一年前', value: 7}
];
/**
* 单据时间
*/
export const docTime = [{label: '单据时间(全部)', value: 0}].concat(commonTimeList);
......@@ -2,54 +2,17 @@ import React, { useState } from 'react';
import { Modal} from 'antd';
import { PublicApi } from '@/services/api';
import EyePreview from '@/components/EyePreview';
import { BasicForm, TablePagination, SearchForm } from '../ModalForTable'
import { createAsyncFormActions } from '@formily/antd';
import processProductSchema from '../../schema/processProductSchema';
import { SearchForm } from '../ModalForTable'
import { createAsyncFormActions, FormEffectHooks } from '@formily/antd';
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable';
import { schema } from './schema';
const actions = createAsyncFormActions();
const columns = [
{
title: '会员ID',
dataIndex: 'id'
},
{
title: '会员名称',
dataIndex: 'name'
},
{
title: '会员类型',
dataIndex: 'type'
},
{
title: '会员角色',
dataIndex: 'role'
},
{
title: '会员等级',
dataIndex: 'level'
}
]
const tableSchema = {
table: {
type: "object",
name: "table",
"x-component": "Table",
"x-component-props": {
"columns": columns,
"rowKey": "id",
"pagination":false,
"rowSelection": "{{rowSelection}}"
}
},
}
const schema = processProductSchema(tableSchema);
const { onFieldInit$ } = FormEffectHooks
const EnterPrise = ({visible, cancel, ...restProps}) => {
const [selectRow, memberRowCtl] = useRowSelectionTable({ customKey: 'id', type: 'radio' });
const [selectRow, memberRowCtl] = useRowSelectionTable({ customKey: 'memberId', type: 'radio' });
const fetchData = async (params: any) => {
let res = await PublicApi.getManageContentColumnPage(params);
let res = await PublicApi.getMemberManageLowerPageBynamerole(params);
return res;
};
......@@ -58,6 +21,21 @@ const EnterPrise = ({visible, cancel, ...restProps}) => {
cancel();
}
const effects = () => {
onFieldInit$('roleId').subscribe((fieldState) => {
PublicApi.getMemberManageRoleSubList().then(res => {
let options = []
if(res.code === 1000) {
options = res.data.map((item) => {return { label: item.roleName, value: item.roleId }})
}
actions.setFieldState("roleId", (state) => {
state.props["x-component-props"]["options"] = options;
})
})
})
}
return (
<Modal
title="选择加工商品"
......@@ -70,6 +48,7 @@ const EnterPrise = ({visible, cancel, ...restProps}) => {
request={fetchData}
schema={schema}
actions={actions}
effects={effects}
expressionScope={{rowSelection: selectRow}}
></SearchForm>
......
const columns = [
{
title: '会员ID',
dataIndex: 'memberId'
},
{
title: '会员名称',
dataIndex: 'name'
},
{
title: '会员类型',
dataIndex: 'memberTypeName'
},
{
title: '会员角色',
dataIndex: 'roleName'
},
{
title: '会员等级',
dataIndex: 'levelTag'
}
]
export const schema = {
type: 'object',
properties: {
layout: {
type: 'object',
'x-component': 'CustomFlexRowLayout',
'x-component-props': {
justify: 'space-between',
align: 'center'
},
properties: {
'flex-layout': {
type: 'object',
name: 'rigth-layout',
"x-component": 'CustomFlexColumnLayout',
properties: {
controllers: {
type: 'object',
name: 'controllers',
'x-component': 'CustomFlexRowLayout',
'x-component-props': {
justify: 'start',
},
properties: {
name: {
type: 'string',
name: 'name',
'x-component': 'Search',
'x-component-props': {
placeholder: "请填写标题名称",
"onSearch": "{{search}}",
}
},
'HIGHT_FILTER_BTN': {
type: 'string',
name: 'HIGHT_FILTER_BTN',
'x-component': 'button',
'x-component-props': {
"children": "{{HIGHT_FILTER_BTN}}",
"onClick": "{{toggleFilters}}",
style: {
margin: '0 15px'
}
}
},
reset: {
type: 'string',
name: 'reset',
"x-component": "button",
"x-component-props": {
"onClick": "{{reset}}",
"children": "重置",
}
},
}
},
'FILTERS': {
type: 'object',
name: 'FILTERS',
'x-component': 'CustomFlexRowLayout',
'x-component-props': {
justify: 'start'
},
properties: {
roleId: {
name: 'columns',
type: 'string',
'x-component': 'Select',
'x-component-props': {
placeholder: '请选择角色',
allowClear:true,
style: {
width: '200px',
margin: '0 20px 0 0'
}
}
},
queryBtn: {
type: 'string',
'x-component': 'Submit',
"x-component-props": {
"children": "查询",
}
}
}
}
}
},
pagination: {
type: 'object',
'x-component': "TablePagination",
'x-style': {
display: 'flex',
flexDirection: 'row',
justifyContent: 'flex-end'
},
'x-component-props': {
showQuickJumper: true,
pageSize: 10,
simple: true
}
}
}
},
table: {
type: "object",
name: "table",
"x-component": "Table",
"x-component-props": {
"columns": columns,
"rowKey": "memberId",
"pagination":false,
"rowSelection": "{{rowSelection}}"
}
},
}
}
\ No newline at end of file
......@@ -58,7 +58,7 @@ const SearchForm = (props) => {
})
actions.setFieldState('pagination', state => {
//@ts-ignore
state.props["x-component-props"]["total"] = totalCount;
state.props["x-component-props"]["total"] = totalCount || 1;
})
}
......
......@@ -3,37 +3,20 @@ import { Modal} from 'antd';
import { PublicApi } from '@/services/api';
import EyePreview from '@/components/EyePreview';
import { BasicForm, TablePagination, SearchForm } from '../ModalForTable'
import { createAsyncFormActions } from '@formily/antd';
import processProductSchema from '../../schema/processProductSchema';
import { createAsyncFormActions, FormEffectHooks } from '@formily/antd';
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable';
import { schema } from './schema';
const { onFieldInit$ } = FormEffectHooks
const actions = createAsyncFormActions();
const columns = [
{ title: 'ID', dataIndex: 'id'},
{ title: '商品名称', dataIndex: 'name'},
{ title: '上架商城', dataIndex: 'shop'},
{ title: '品类', dataIndex: 'type'},
{ title: '品牌', dataIndex: 'brand'}
]
const tableSchema = {
table: {
type: "object",
"x-component": "Table",
"x-component-props": {
"columns": columns,
"rowKey": "id",
"pagination":false,
// loading: true,
"rowSelection": "{{rowSelection}}"
}
},
}
const schema = processProductSchema(tableSchema);
const ProcessProducts = ({visible, cancel, ...restProps}) => {
const [selectRow, setSelectRow] = useRowSelectionTable({ customKey: 'id' });
const fetchData = async (params: any) => {
console.log(params);
let res = await PublicApi.getManageContentColumnPage(params);
// /product/commodity/common/getCommodityListByBuyer
let res = await PublicApi.getProductCommodityCommonGetCommodityListByBuyer(params);
return res;
};
......@@ -42,10 +25,38 @@ const ProcessProducts = ({visible, cancel, ...restProps}) => {
cancel();
}
const effects = () => {
onFieldInit$('branchId').subscribe((fieldState) => {
///product/select/getSelectBrand
PublicApi.getProductSelectGetSelectBrand({name: ''}).then(res => {
let options = []
if(res.code === 1000) {
options = res.data.map((item) => {return { label: item.name, value: item.id }})
}
actions.setFieldState("branchId", (state) => {
state.props["x-component-props"]["options"] = options;
})
})
});
onFieldInit$('categoryId').subscribe((fieldState) => {
///product/select/getSelectBrand
PublicApi.getProductSelectGetSelectCategory({name: ''}).then(res => {
let options = []
if(res.code === 1000) {
options = res.data.map((item) => {return { label: item.name, value: item.id }})
}
actions.setFieldState("categoryId", (state) => {
state.props["x-component-props"]["options"] = options;
})
})
})
}
return (
<Modal
title="选择加工商品"
width={704}
width={1000}
visible={visible}
onCancel={cancel}
onOk={onOk}
......@@ -54,6 +65,7 @@ const ProcessProducts = ({visible, cancel, ...restProps}) => {
request={fetchData}
schema={schema}
actions={actions}
effects={effects}
expressionScope={{rowSelection: selectRow}}
></SearchForm>
......
const columns = [
{ title: 'ID', dataIndex: 'id'},
{ title: '商品名称', dataIndex: 'name'},
{ title: '上架商城', dataIndex: 'shop'},
{ title: '品类', dataIndex: 'type'},
{ title: '品牌', dataIndex: 'brand'}
]
export const schema = {
type: 'object',
properties: {
layout: {
type: 'object',
'x-component': 'CustomFlexRowLayout',
'x-component-props': {
justify: 'space-between',
align: 'center'
},
properties: {
'flex-layout': {
type: 'object',
name: 'rigth-layout',
"x-component": 'CustomFlexColumnLayout',
properties: {
controllers: {
type: 'object',
name: 'controllers',
'x-component': 'CustomFlexRowLayout',
'x-component-props': {
justify: 'start',
},
properties: {
name: {
type: 'string',
'x-component': 'Search',
'x-component-props': {
placeholder: "请填写商品名称",
"onSearch": "{{search}}",
}
},
'HIGHT_FILTER_BTN': {
type: 'string',
'x-component': 'button',
'x-component-props': {
"children": "{{HIGHT_FILTER_BTN}}",
"onClick": "{{toggleFilters}}",
style: {
margin: '0 15px'
}
}
},
reset: {
type: 'string',
name: 'reset',
"x-component": "button",
"x-component-props": {
"onClick": "{{reset}}",
"children": "重置",
}
},
}
},
'FILTERS': {
type: 'object',
name: 'FILTERS',
'x-component': 'CustomFlexRowLayout',
'x-component-props': {
justify: 'start'
},
properties: {
categoryId: {
type: 'string',
'x-component': 'Select',
'x-component-props': {
placeholder: '请选择商品品类',
allowClear:true,
style: {
width: '200px',
margin: '0 20px 0 0'
}
}
},
branchId: {
type: 'string',
'x-component': 'Select',
'x-component-props': {
placeholder: '请选择商品品牌',
allowClear:true,
style: {
width: '200px',
margin: '0 20px 0 0'
}
}
},
queryBtn: {
type: 'string',
'x-component': 'Submit',
"x-component-props": {
"children": "查询",
}
}
}
}
}
},
pagination: {
type: 'object',
'x-component': "TablePagination",
'x-style': {
display: 'flex',
flexDirection: 'row',
justifyContent: 'flex-end'
},
'x-component-props': {
showQuickJumper: true,
pageSize: 10,
simple: true
}
}
}
},
table: {
type: "object",
name: "table",
"x-component": "Table",
"x-component-props": {
"columns": columns,
"rowKey": "memberId",
"pagination":false,
"rowSelection": "{{rowSelection}}"
}
},
}
}
\ No newline at end of file
......@@ -2,7 +2,7 @@
* 指派生产通知单-生产通知单查询页
*/
export const QUERY_SEARCH_NAME = "desc";
export const QUERY_SEARCH_NAME = "noticeNo";
/**
* 指派生产通知单-待新增生产通知单列表页
......@@ -36,4 +36,23 @@ export const PENDING_ADD_PROCESS = "desc"
* 指派生产通知单-待收货生产通知单
*/
export const PENDING_RECEIVE = "desc"
\ No newline at end of file
export const PENDING_RECEIVE = "desc"
/**
* 下面设置各个 path 常量
*/
export const QUERY_PATH = '/query';
const QUERY_TITLE = '生产通知单查询';
/**
* 待新增生产通知单
*/
export const TO_BE_ADD_QUERY_PATH = '/tobeAddQuery';
const TO_BE_ADD_QUERY_TITLE = '待新增生产通知单';
export const TITLE_MAPS = {
[QUERY_PATH]: QUERY_TITLE,
[TO_BE_ADD_QUERY_PATH]: TO_BE_ADD_QUERY_TITLE
}
\ No newline at end of file
......@@ -27,41 +27,45 @@ import {
PENDING_SECOND_NOTICE,
PENDING_TO_SUBMIT,
PENDING_ADD_PROCESS,
PENDING_RECEIVE
PENDING_RECEIVE,
TITLE_MAPS,
QUERY_PATH,
TO_BE_ADD_QUERY_PATH,
} from './contants';
import { timeRange } from '@/utils';
const formActions = createFormActions();
const columns: ColumnsType = [
{
title: '通知单号',
dataIndex: 'id',
dataIndex: 'noticeNo',
},
{
title: '通知单摘要',
dataIndex: 'desc',
dataIndex: 'summary',
},
{
title: '加工企业名称',
dataIndex: 'businessName'
dataIndex: 'processName'
},
{
title: '单据时间',
dataIndex: 'create-at',
dataIndex: 'createTime',
},
{
title: '外部状态',
dataIndex: 'status',
dataIndex: 'outerStatusName',
},
{
title: '内部状态',
dataIndex: 'status2'
dataIndex: 'innerStatusName'
}
]
// 根据 lastTypeParams, 获取相对应的schema
const SCHEMAS = {
"/query": querySchema,
"/tobeAddQuery": tobeAddQuerySchema,
[QUERY_PATH]: querySchema,
[TO_BE_ADD_QUERY_PATH]: tobeAddQuerySchema,
"/pendingFirst": pendingFirstQuerySchema,
"/pendingSecond": pendingFirstQuerySchema,
"/pendingSubmit": pendingFirstQuerySchema,
......@@ -71,8 +75,8 @@ const columns: ColumnsType = [
// 根据 lastTypeParams, 获取对应的高级筛选 name
const FILTER_NAMES = {
"/query": QUERY_SEARCH_NAME,
"/tobeAddQuery": TO_BE_ADD_QUERY_SEARCH_NAME,
[QUERY_PATH]: QUERY_SEARCH_NAME,
[TO_BE_ADD_QUERY_PATH]: TO_BE_ADD_QUERY_SEARCH_NAME,
"/pendingFirst": PENDING_FIRST_NOTICE,
"/pendingSecond": PENDING_SECOND_NOTICE,
"/pendingSubmit": PENDING_TO_SUBMIT,
......@@ -86,6 +90,8 @@ const SERVICES = {
'/tobeAddQuery': PublicApi.getEnhanceSupplierToBeAddList
}
const Query: React.FC<{}> = (props) => {
const ref = useRef<any>({});
const { lastTypeParams } = usePageStatus();
......@@ -138,14 +144,31 @@ const Query: React.FC<{}> = (props) => {
}
</div>
)
/**
* 查询
* @params values 表单字段
*/
const handleSearch = (values: any) => {
const {docTime, ...rest} = values;
const {st, et} = timeRange(docTime);
let searchData = {
...rest,
startTime: st,
endTtime: et
}
ref.current.reload(searchData)
}
return (
<PageHeaderWrapper
title={"生产通知单查询"}
title={TITLE_MAPS[lastTypeParams] || '生产通知单查询'}
>
<Card>
<StandardTable
tableProps={{
rowKey: 'memberId',
rowKey: 'id',
}}
columns={columns}
currentRef={ref}
......@@ -154,7 +177,7 @@ const Query: React.FC<{}> = (props) => {
<NiceForm
actions={formActions}
expressionScope={{controllerBtns, batchUpdateBtn}}
onSubmit={values => ref.current.reload(values)}
onSubmit={handleSearch}
effects={($, actions) => {
useStateFilterSearchLinkageEffect($, actions, FILTER_NAMES[lastTypeParams], FORM_FILTER_PATH);
useAsyncInitSelect(
......
import { ISchema } from '@formily/antd';
import { FORM_FILTER_PATH } from '@/formSchema/const';
import { QUERY_SEARCH_NAME, TO_BE_ADD_QUERY_SEARCH_NAME } from './contants';
import { docTime } from '../../common';
/**
* @author: Bill
......@@ -20,7 +21,7 @@ export const querySchema: ISchema = {
'x-component-props': {
placeholder: '搜索',
align: 'flex-left',
tip: '输入通知单号、通知单摘要进行搜索',
tip: '输入通知单号进行搜索',
},
},
[FORM_FILTER_PATH]: {
......@@ -33,19 +34,17 @@ export const querySchema: ISchema = {
columns: 6,
},
properties: {
name: {
memberName: {
type: 'string',
default: undefined,
enum: [],
'x-component-props': {
placeholder: '加工企业名称(全部)',
placeholder: '加工企业名',
allowClear: true,
},
},
time: {
docTime: {
type: 'string',
default: undefined,
enum: [],
default: 0,
enum: docTime,
'x-component-props': {
placeholder: '单据时间(全部)',
allowClear: true,
......
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