Commit be53efc4 authored by 前端-钟卫鹏's avatar 前端-钟卫鹏
parents fe3ea95e 0008a665
......@@ -127,13 +127,6 @@ const LogisticsRoute: RouterChild = {
path: '/memberCenter/logisticsAbility/logisticsSubmit',
name: 'logisticsSubmit',
routes: [
// 新增
{
path: '/memberCenter/logisticsAbility/logisticsSubmit/addLogistics',
name: 'addToOrderSubmit',
component: '@/pages/logistics/addLogistics',
hideInMenu: true
},
// 快递单查询
{
path: '/memberCenter/logisticsAbility/logisticsSubmit/orderSubmitSearchList',
......@@ -154,31 +147,17 @@ const LogisticsRoute: RouterChild = {
component: '@/pages/logistics/logisticsSubmit/toOrderSumitList',
},
// 待提交物流单-新增
// {
// path: '/memberCenter/logisticsAbility/logisticsSubmit/toOrderSumitList/add',
// name: 'addToOrderSubmit',
// component: '@/pages/logistics/logisticsSubmit/toOrderSubmitDetail',
// hideInMenu: true
// },
// 待提交物流单-新增
{
path: '/memberCenter/logisticsAbility/logisticsSubmit/toOrderSumitList/add',
name: 'addToOrderSubmit',
component: '@/pages/logistics/logisticsSubmit/detail',
component: '@/pages/logistics/addLogistics',
hideInMenu: true
},
// 待提交物流单-编辑
// {
// path: '/memberCenter/logisticsAbility/logisticsSubmit/toOrderSumitList/edit',
// name: 'editToOrderSubmit',
// component: '@/pages/logistics/logisticsSubmit/toOrderSubmitDetail',
// hideInMenu: true
// },
// 待提交物流单-编辑
{
path: '/memberCenter/logisticsAbility/logisticsSubmit/toOrderSumitList/edit',
name: 'editToOrderSubmit',
component: '@/pages/logistics/logisticsSubmit/detail',
component: '@/pages/logistics/addLogistics',
hideInMenu: true
},
]
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2020-11-18 11:22:44
* @LastEditors: XieZhiXiong
* @LastEditTime: 2020-12-09 17:06:14
* @LastEditTime: 2020-12-17 14:54:03
* @Description: 待新增换货发货单
*/
import React, { useState, useRef } from 'react';
......@@ -104,7 +104,7 @@ const ExchangePrAddLogistics: React.FC = () => {
type="link"
onClick={
() =>
history.push(`/memberCenter/logisticsAbility/logisticsSubmit/toOrderSumitList/add?createType=${4}&shipmentOrderCode=${record.returnDeliveryNo}&relevanceOrderId=${record.replaceId}&relevanceType=${2}`)
history.push(`/memberCenter/logisticsAbility/logisticsSubmit/toOrderSumitList/add?createType=${4}&id=${record.replaceId}`)
}
>
新增
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2020-11-18 11:22:44
* @LastEditors: XieZhiXiong
* @LastEditTime: 2020-12-09 17:10:48
* @LastEditTime: 2020-12-17 15:09:13
* @Description: 待新增换货发货单
*/
import React, { useState, useRef } from 'react';
......@@ -104,7 +104,7 @@ const ReturnPrAddLogistics: React.FC = () => {
type="link"
onClick={
() =>
history.push(`/memberCenter/logisticsAbility/logisticsSubmit/toOrderSumitList/add?createType=${5}&shipmentOrderCode=${record.replaceDeliveryNo}&relevanceOrderId=${record.replaceId}&relevanceType=${3}`)
history.push(`/memberCenter/logisticsAbility/logisticsSubmit/toOrderSumitList/add?createType=${5}&id=${record.replaceId}`)
}
>
新增
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2020-11-06 16:30:44
* @LastEditors: XieZhiXiong
* @LastEditTime: 2020-12-09 17:14:37
* @LastEditTime: 2020-12-17 15:13:16
* @Description: 待新增退货发货单
*/
import React, { useState, useRef } from 'react';
......@@ -109,7 +109,7 @@ const ReturnPrAddLogistics: React.FC = () => {
type="link"
onClick={
() =>
history.push(`/memberCenter/logisticsAbility/logisticsSubmit/toOrderSumitList/add?createType=${6}&shipmentOrderCode=${record.returnDeliveryNo}&relevanceOrderId=${record.returnId}&relevanceType=${4}`)
history.push(`/memberCenter/logisticsAbility/logisticsSubmit/toOrderSumitList/add?createType=${6}&id=${record.returnId}`)
}
>
新增
......
......@@ -49,7 +49,7 @@ const common_columns: any = [
]
const MemberSettleAdd: React.FC = () => {
const [visible, setVisible] = useState(false)
const [memberRowSelection, memberRowCtl] = useRowSelectionTable({ customKey: 'id' });
const [memberRowSelection, memberRowCtl] = useRowSelectionTable({ customKey: 'uniqueId' });
const [initialValue, setInitialValue] = useState({});
const { id, preview } = usePageStatus();
const [submitLoading, setSubmitLoading ] = useState(false);
......@@ -77,7 +77,7 @@ const MemberSettleAdd: React.FC = () => {
title: '操作',
render: (text, record) => {
return (
<div onClick={() => handleRemove(record.memberId)}>删除</div>
<div onClick={() => handleRemove(record.uniqueId)}>删除</div>
)
}
}
......@@ -102,7 +102,11 @@ const MemberSettleAdd: React.FC = () => {
const fetchMemberData = async (params: any) => {
//member/manage/lower/page/bynamerole
const { data } = await PublicApi.getMemberManageLowerPageBynamerole(params);
return data
return {
...data,
data: data.data.map((v) => ({...v, uniqueId: v.memberId + "_" + v.roleId})),
totalCount: data.totalCount
}
}
// 获取适用会员下拉搜索框
......@@ -155,11 +159,11 @@ const MemberSettleAdd: React.FC = () => {
const handleRemove = (id: number) => {
const string = 'Tabs.memberTab.someLists';
const chooseList = formActions.getFieldValue(string);
const res = chooseList.filter((item) => item.memberId !== id);
const res = chooseList.filter((item) => item.uniqueId !== id);
formActions.setFieldValue(string, res);
// 必须设置key
memberRowCtl.setSelectRow(res);
memberRowCtl.setSelectedRowKeys(res.map((item) => item.memberId))
memberRowCtl.setSelectedRowKeys(res.map((item) => item.uniqueId))
}
// 从PAAS平台--规则配置--平台规则配置取已勾选的结算方式决定是否显示结算方式
......@@ -188,10 +192,11 @@ const MemberSettleAdd: React.FC = () => {
otherValues: [res.data.settlementDays, res.data.settlementDate],
}
})
formActions.setFieldValue('Tabs.memberTab.someLists', res.data.memberList);
const list = res.data.memberList.map((item) => ({...item, uniqueId: item.memberId + "_" + item.roleId}))
formActions.setFieldValue('Tabs.memberTab.someLists', list);
// 必须设置key
memberRowCtl.setSelectRow(res.data.memberList);
memberRowCtl.setSelectedRowKeys(res.data.memberList.map((item) => item.memberId))
memberRowCtl.setSelectRow(list);
memberRowCtl.setSelectedRowKeys(res.data.memberList.map((item) => item.memberId + "_" + item.roleId))
} else {
message.error({content: res.message})
}
......@@ -238,7 +243,7 @@ const MemberSettleAdd: React.FC = () => {
rowSelection={memberRowSelection}
fetchTableData={params => fetchMemberData(params)}
tableProps={{
rowKey: 'id',
rowKey: 'uniqueId',
}}
formilyProps={
{
......
......@@ -27,13 +27,13 @@ export const indexSchema = {
},
},
name: {
type: 'string',
'x-component': 'Search',
type: 'string',
'x-component': 'Search',
"x-mega-props": {
"span": 2
},
'x-component-props': {
placeholder: '搜索',
placeholder: '搜索',
advanced: false,
},
},
......@@ -44,7 +44,7 @@ export const indexSchema = {
/**
* 新增会员结算策略schema
*
*
*/
export const addSchema = {
......@@ -129,7 +129,7 @@ export const addSchema = {
},
'x-component': 'MultTable',
'x-component-props': {
rowKey: 'memberId',
rowKey: 'uniqueId',
prefix: "{{tableAddButton}}",
columns: "{{tableColumns}}"
// columns: "{{tableColumns}}",
......@@ -176,7 +176,7 @@ export const memberSchema = {
style: {width: '200px'}
}
},
submit: {
"x-component": 'Submit',
"x-mega-props": {
......@@ -189,4 +189,4 @@ export const memberSchema = {
}
}
}
}
\ No newline at end of file
}
import React from 'react';
export const productColumns = [
// { title: '订单号', dataIndex: 'orderNo' },
{ title: '商品ID', dataIndex: 'commodityId' },
{ title: '商品名称', dataIndex: 'name' },
{ title: '品类', dataIndex: 'customerCategoryName' },
{ title: '品牌', dataIndex: 'brandName' },
{ title: '单位', dataIndex: 'unitName' },
// { title: '订单数量', dataIndex: 'orderTotal' },
// { title: '剩余加工数量', dataIndex: 'restTotal' },
{ title: '加工数量', dataIndex: 'processNum' },
{ title: '加工单价', dataIndex: 'processUnitPrice' },
{ title: '加工费', dataIndex: 'processTotalPrice'},
]
export const orderColumns = [
{ title: '订单号', dataIndex: 'orderNo' },
{ title: '商品ID', dataIndex: 'commodityId' },
{ title: '商品名称', dataIndex: 'name' },
{ title: '品类', dataIndex: 'customerCategoryName' },
{ title: '品牌', dataIndex: 'brandName' },
{ title: '单位', dataIndex: 'unitName' },
{ title: '订单数量', dataIndex: 'orderTotal' },
{ title: '剩余加工数量', dataIndex: 'restTotal' },
{ title: '加工数量', dataIndex: 'processNum' },
{ title: '加工单价', dataIndex: 'processUnitPrice' },
{ title: '加工费', dataIndex: 'processTotalPrice'},
]
import { createFormActions, FormEffectHooks } from '@formily/antd';
import { PublicApi } from '@/services/api';
const { onFieldValueChange$, onFieldMount$ } = FormEffectHooks
/**
* formEffect, 表单联动操作放这里操作,包括表单的生命周期等操作
*/
export const formEffects = () => {
const formActions = createFormActions()
// 当物流为 物流时,那么填充
onFieldMount$('receivefullAddress').subscribe((state) => {
PublicApi.getLogisticsReceiverAddressPage({current: '1', pageSize: '99'})
.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("receivefullAddress", (state) => {
state.props["x-component-props"]["options"] = options;
})
})
})
/**
* 当改变物流地址的时候,那么修改隐藏的3个字段,
* 1. receiveAddress 详细的物流地址
* 2. receiveUserName 收货人
* 3. receiveUserTel 收货人电话
*/
onFieldValueChange$('receivefullAddress').subscribe((state) => {
if(state.visible) {
const options = state.props["x-component-props"]["options"];
const target = options.filter((item) => item.value == state.value)[0];
if(target) {
const [receiveAddress, receiveUserName, receiveUserTel] = target.label.split("/");
formActions.setFieldValue("receiveAddress", receiveAddress.trim());
formActions.setFieldValue("receiveUserName", receiveUserName.trim());
formActions.setFieldValue("receiveUserTel", receiveUserTel.trim());
formActions.setFieldValue("receiverAddressId", state.value)
}
}
})
}
This diff is collapsed.
/*
* @Author: your name
* @Date: 2020-10-12 13:37:06
* @LastEditTime: 2020-10-16 16:55:22
* @Description: 新建生产通知单 schema
*/
import React from 'react';
import { Space, Menu, Dropdown } from 'antd';
import { DownOutlined } from '@ant-design/icons';
import ProcessDetail from '../../components/ProcessDetail'
import { innerWorkFlowRecordColumn, outerWorkflowRecordsColumn} from '../detail/columns';
// 流转记录
export const historyColumn = [
......@@ -90,7 +80,30 @@ const basicTab = {
value: 2
}
],
default: 1
"x-linkages": [
{
"type": "value:state",
"target": "*(productList, productSource)",
"condition": "{{ $self.value === 1 }}",
state: {
display: false,
},
otherwise:{//条件不满足时控制bbb字段的编辑状态
display:true
}
},
{
"type": "value:state",
"target": "*(orderList, orderSource)",
"condition": "{{ $self.value === 2 }}",
state: {
display: false,
},
otherwise:{//条件不满足时控制bbb字段的编辑状态
display:true
}
},
]
},
deliveryDate: {
......@@ -157,17 +170,19 @@ const basicTab = {
type: 'string',
display: false
},
docNo: {
noticeNo: {
type: 'string',
title: '通知单号',
'x-component': 'Text'
editable: false,
// 'x-component': 'Text'
},
docTime: {
createTime: {
type: 'string',
title: '单据时间',
'x-component': 'Text'
editable: false
// 'x-component': 'I'
},
status: {
outerStatus: {
type: 'string',
title: '外部状态',
'x-component': 'Children',
......@@ -175,7 +190,7 @@ const basicTab = {
children: '待提交通知单'
}
},
status2: {
innerStatus: {
type: 'string',
title: '内部状态',
'x-component': 'Children',
......@@ -209,14 +224,53 @@ const detailTab = {
labelAlign: 'left'
},
properties: {
selectedSource: {
orderSource: {
type: 'string',
title: '通知单来源',
'x-component': 'Children',
'x-component': 'Radio',
'x-component-props': {
options: [{
label: '加工订单',
value: 1,
}],
defaultValue: 1,
},
},
productSource: {
type: 'string',
title: '通知单来源',
'x-component': 'Radio',
'x-component-props': {
children: '{{source}}',
options: [{
label: '加工商品',
value: 2,
}],
defaultValue: 2,
},
},
someLists: {
// 加工商品
productList: {
type: 'array:number',
'x-mega-props': {
wrapperCol: 24,
},
'x-component': 'MultTable',
'x-component-props': {
rowKey: (record) => record.id + "_" + record.fullId,
prefix: "{{tableProductAddButton}}",
columns: "{{renderProductColumn}}"
// columns: "{{tableColumns}}",
},
'x-rules': [
{
required: true,
message: '请选择要加工的商品'
}
],
},
// 订单
orderList: {
type: 'array:number',
'x-mega-props': {
wrapperCol: 24,
......@@ -224,8 +278,8 @@ const detailTab = {
'x-component': 'MultTable',
'x-component-props': {
rowKey: (record) => record.id + "_" + record.fullId,
prefix: "{{tableAddButton}}",
columns: "{{noticesDetailColumn}}"
prefix: "{{tableOrderAddButton}}",
columns: "{{renderOrderColumn}}"
// columns: "{{tableColumns}}",
},
'x-rules': [
......@@ -234,7 +288,7 @@ const detailTab = {
message: '请选择要加工的商品'
}
]
}
},
}
}
}
......@@ -380,19 +434,49 @@ const historyRecord = {
properties: {
controller: {
type: 'object',
'x-component': 'Children',
"x-component": 'aaa',
"x-component-props": {
options: [
{ label: '外部流转', value: 1 },
{ label: '内部流转', value: 2 }
],
optionType: 'button',
},
'x-linkages': [
{
type: 'value:visible',
target: 'outerWorkFlow',
condition: '{{$value === 1}}'
},
{
type: 'value:visible',
target: 'innerWorkFlow',
condition: '{{$value === 2}}'
},
],
},
outerWorkFlow: {
type: 'array:number',
'x-mega-props': {
wrapperCol: 24,
},
'x-component': 'MultTable',
'x-component-props': {
children: '{{RadioBtnGroup}}'
columns: outerWorkflowRecordsColumn
}
},
historyTable: {
type: 'object',
'x-component': 'Table',
innerWorkFlow: {
type: 'array:number',
'x-mega-props': {
wrapperCol: 24,
},
'x-component': 'MultTable',
'x-component-props': {
columns: historyColumn
}
rowKey: (record) => record.id ,
columns: innerWorkFlowRecordColumn
// columns: "{{tableColumns}}",
},
}
}
}
......
......@@ -23,12 +23,12 @@ import {
ASSIGN_PENDING_RECEIVE,
PENDING_RECEIPT_PATH,
} from '../../common';
import { action } from 'mobx';
const formActions = createFormActions();
const ADD_PROCESS_PATH = '/memberCenter/tranactionAbility/stockSellStorage/bills/add';
const ADD_DELIVERY_PATH = '/memberCenter/tranactionAbility/stockSellStorage/bills/add';
const ADD_LOGISTICS_PATH = '/memberCenter/logisticsAbility/logisticsSubmit/toOrderSumitList/add';
const DETAIL_LOGISTICS_PATH = '/memberCenter/logisticsAbility/logisticsSubmit/orderSubmitSearchList/detail'
const SERVICE_MAPS = {
......@@ -174,8 +174,8 @@ const processStock: React.FC<{}> = () => {
<a onClick={() => handleVisible(record.id)}>审核</a>
</Popconfirm>
),
[OuterAndInnerStatus.pending_add_logistics]: <Link to={`${ADD_LOGISTICS_PATH}?createType=3&shipmentOrderId=${record.deliveryId}&shipmentOrderCode=${record.deliveryNo}&relevanceOrderId=${record.id}`}>新增物流单</Link>,
[OuterAndInnerStatus.pending_confirm_logistics]: <Link to={`${ADD_LOGISTICS_PATH}?createType=3&shipmentOrderId=${record.deliveryId}&shipmentOrderCode=${record.deliveryNo}&relevanceOrderId=${record.id}&isPreview=1`}>查看物流单</Link>,
[OuterAndInnerStatus.pending_add_logistics]: <Link to={`${ADD_LOGISTICS_PATH}?createType=3&id=${record.id}`}>新增物流单</Link>,
[OuterAndInnerStatus.pending_confirm_logistics]: <Link to={`${DETAIL_LOGISTICS_PATH}?id=${record.id}`}>查看物流单</Link>,
[OuterAndInnerStatus.pending_confirm_deliver]: <Link to={`${PENDING_DELIVERD_PATH}/detail?id=${record.id}`}>发货</Link>,
[OuterAndInnerStatus.pending_add_process_in_warehouse]: (
<Link
......
......@@ -11,9 +11,9 @@ export const useRowSelection = (options) => {
type: type,
selectedRowKeys: selectedKeys,
onSelect: async (record: any, selected: boolean, selectedRows: any[], nativeEvent) => {
const tempKey = record[primaryKey];
// const tempKey = record[primaryKey];
if(type === 'radio') {
setSelectedKeys(record[tempKey]);
setSelectedKeys([record[primaryKey]]);
setSelectedRows(selectedRows);
return ;
}
......
......@@ -9,15 +9,23 @@ import { schema } from './schema';
const actions = createAsyncFormActions();
const { onFieldInit$, onFieldMount$ } = FormEffectHooks
const EnterPrise = ({visible, cancel, ...restProps}) => {
const [selectRow, memberRowCtl] = useRowSelectionTable({ customKey: 'id', type: 'radio'});
const EnterPrise = ({visible, cancel, rowSelection, ...restProps}) => {
// const [selectRow, memberRowCtl] = useRowSelectionTable({ customKey: 'id', type: 'radio'});
const fetchData = useCallback(async (params: any) => {
let res = await PublicApi.getMemberManageLowerPageBynamerole(params);
return res;
console.log(res);
return {
...res,
code: res.code,
data: {
data: res.data.data.map((v) => ({...v, uniqueId: v.memberId + "_" + v.roleId})),
total: res.data.code
}
};
}, []);
const onOk = () => {
restProps.onOk(memberRowCtl)
restProps.onOk()
cancel();
}
......@@ -51,7 +59,7 @@ const EnterPrise = ({visible, cancel, ...restProps}) => {
schema={schema}
actions={actions}
effects={effects}
expressionScope={{rowSelection: selectRow}}
expressionScope={{rowSelection: rowSelection}}
></SearchForm>
: null
}
......
......@@ -132,7 +132,7 @@ export const schema = {
"x-component": "Table",
"x-component-props": {
"columns": columns,
"rowKey": "id",
"rowKey": "uniqueId",
"pagination":false,
"rowSelection": "{{rowSelection}}"
}
......
......@@ -93,7 +93,7 @@ const Content: React.FC<Iprops> = React.forwardRef((props, conftentRef) => {
height = height + 112;
flag = true;
return {
name: item.name,
name: item.name,
min: prevHeight,
max: height
}
......@@ -110,6 +110,7 @@ const Content: React.FC<Iprops> = React.forwardRef((props, conftentRef) => {
const handleFormSubmit = (value) => {
props.formSubmit(value);
}
return (
<div className={styles.container}>
<div className={styles.menu}>
......@@ -123,7 +124,7 @@ const Content: React.FC<Iprops> = React.forwardRef((props, conftentRef) => {
})
}
</div>
<div className={styles.body} ref={ref}>
<div className={styles.common} >
<div className={styles.header}>{"基本信息"}</div>
......@@ -140,7 +141,7 @@ const Content: React.FC<Iprops> = React.forwardRef((props, conftentRef) => {
<Col className={styles.label} span={4}>商品品类</Col>
<Col span={12}> {category}</Col>
</Row>
<Row className={styles.infoRow}>
<Row className={styles.infoRow}>
<Col className={styles.label} span={4}>商品品牌</Col>
<Col span={12}>{brand}</Col>
</Row>
......@@ -165,20 +166,19 @@ const Content: React.FC<Iprops> = React.forwardRef((props, conftentRef) => {
<div className={styles.header}>{"附件"}</div>
<div className={styles.info}>
{
files.length === 0 && props.type != 'edit'
files.length === 0
? <p></p>
: null
}
{
files.map((item,key) => {
return (
<FileList name={item.name} url={item.url} key={key} />
)
})
: props.type != 'edit'
? files.map((item,key) => {
return (
<FileList name={item.name} url={item.url} key={key} />
)
})
: null
}
{
props.type == 'edit'
? <UploadFile onChange={props.fileOnChange} fileMaxSize={20*1024} />
? <UploadFile fileList={files} onChange={props.fileOnChange} fileMaxSize={20*1024} />
: null
}
</div>
......@@ -224,4 +224,4 @@ const Content: React.FC<Iprops> = React.forwardRef((props, conftentRef) => {
)
})
export default React.memo(Content);
\ No newline at end of file
export default React.memo(Content);
......@@ -17,6 +17,7 @@ interface Iprops {
productName: string,
unitName: string,
uniqueID: string,
files: any[],
}
interface IfileProps {
......@@ -28,7 +29,7 @@ const ProcessDetail: React.FC<Iprops> = (props) => {
const {skuId, type, productName, ...rest} = props;
const [visible, setVisible] = useState<boolean>(false);
const [info, setInfo] = useState<any>({})
const [files, setFiles] = useState<IfileProps[]>([])
const [files, setFiles] = useState<IfileProps[]>(() => props.files)
const contentRef = useRef(null)
const onClose = () => {
......@@ -68,8 +69,11 @@ const ProcessDetail: React.FC<Iprops> = (props) => {
}
}
useEffect(() => {
setFiles(props.files);
}, [props.files])
const formSubmit = (values) => {
console.log(values);
!!props.submit && props.submit({
files: files,
uniqueID: props.uniqueID,
......@@ -112,11 +116,11 @@ const ProcessDetail: React.FC<Iprops> = (props) => {
>
{
visible
? <Content
name={info?.name}
id={info?.productId}
? <Content
name={info?.name}
id={info?.productId}
brand={info?.brand}
category={info?.category}
category={info?.category}
unitName={info?.unitName}
productProps={info?.attributes}
quantity={info?.quantity}
......@@ -130,10 +134,10 @@ const ProcessDetail: React.FC<Iprops> = (props) => {
/>
: null
}
</Drawer>
</>
)
}
export default ProcessDetail;
\ No newline at end of file
export default ProcessDetail;
......@@ -4,7 +4,6 @@ import { Upload, Button, message } from 'antd';
import { UploadOutlined } from '@ant-design/icons'
import { UPLOAD_TYPE } from '@/constants'
import FileListItem from './FileList';
import url from '*.svg';
const UploadFile = (props) => {
const { fileList = [], onChange, fileMaxSize = 20 } = props
......@@ -51,8 +50,7 @@ const UploadFile = (props) => {
};
const removeFile = (key) => {
const res = fileList.filter((item) => item != key);
console.log(res);
const res = fileList.filter((item) => item.name != key);
onChange(res);
}
......@@ -62,10 +60,10 @@ const UploadFile = (props) => {
{
fileList.map((item, key) => {
return (
<FileListItem
key={item}
name={item.name}
url={item.url}
<FileListItem
key={key}
name={item.name}
url={item.url}
removeFile={removeFile}
/>
)
......@@ -77,8 +75,7 @@ const UploadFile = (props) => {
</Upload>
<div className={styles.tips}>一次上传一个文件,每个附件大小不能超过{fileMaxSize / 1024}M</div>
</div>
)
}
export default UploadFile;
\ No newline at end of file
export default UploadFile;
import React, { ReactText, useRef, useEffect, useLayoutEffect, useState } from 'react';
import { StandardTable } from 'god';
import { ISchema } from '@formily/antd';
import NestTable from '@/components/NestTable';
import { IStandardTableProps } from 'god/dist/src/standard-table';
import { Row, Col, Modal, Form, Radio } from 'antd';
import Search from '@/components//NiceForm/components/Search';
import SearchSelect from '@/components//NiceForm/components/SearchSelect';
import Submit from '@/components//NiceForm/components/Submit';
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import { FORM_FILTER_PATH } from '@/formSchema/const';
import DateSelect from '@/components//NiceForm/components/DateSelect';
import { PublicApi } from '@/services/api';
export interface ModalTableProps extends IStandardTableProps<any> {
width?: number,
confirm?: Function,
cancel?(),
visible?: boolean,
resetModal?: object,
useNestTable?: boolean, // 是否使用嵌套表格
nestColumns?: any[],
nestTableProps?: any,
// fix: 新增参数, 为true时每次开启弹窗都会重新reload接口
forceRender?: boolean,
invoicesNo?: string, // 对应订单号/售后单号
relevanceType?: number, //对应单据类型
}
export const logisticsDeliverySearchSchema: ISchema = {
type: 'object',
properties: {
invoicesNo: {
type: 'string',
'x-component': 'ModalSearch',
'x-component-props': {
placeholder: '单据号',
align: 'flex-left',
},
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'flex-layout',
'x-component-props': {
rowStyle: {
flexWrap: 'nowrap',
style: {
marginRight: 0
}
},
colStyle: {
marginTop: 20,
},
},
properties: {
orderNo: {
type: 'string',
"x-component-props": {
placeholder: '会员名称',
style: {
width: 160
}
}
},
invoicesAbstract: {
type: 'string',
"x-component-props": {
placeholder: '单据摘要',
style: {
width: 160
}
}
},
"[startTransactionTime,endTransactionTime]": {
type: 'string',
"x-component": "dateSelect",
"x-component-props": {
placeholder: '单据时间(全部)',
}
},
submit: {
"x-component": 'Submit',
"x-mega-props": {
span: 1
},
"x-component-props": {
children: '查询'
}
}
}
}
}
}
export const otherSearchSchema: ISchema = {
type: 'object',
properties: {
applyNo: {
type: 'string',
'x-component': 'ModalSearch',
'x-component-props': {
placeholder: '申请单号',
align: 'flex-left',
},
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'flex-layout',
'x-component-props': {
rowStyle: {
flexWrap: 'nowrap',
style: {
marginRight: 0
}
},
colStyle: {
marginTop: 20,
},
},
properties: {
memberName: {
type: 'string',
"x-component-props": {
placeholder: '会员名称',
style: {
width: 160
}
}
},
applyAbstract: {
type: 'string',
"x-component-props": {
placeholder: '单据摘要',
style: {
width: 160
}
}
},
"[startTime,endTime]": {
type: 'string',
"x-component": "dateSelect",
"x-component-props": {
placeholder: '单据时间(全部)',
}
},
submit: {
"x-component": 'Submit',
"x-mega-props": {
span: 1
},
"x-component-props": {
children: '查询'
}
}
}
}
}
}
const ModalTableOrder: React.FC<ModalTableProps> = (props) => {
const { width = 704, confirm, cancel, visible, currentRef, resetModal, forceRender, useNestTable = false, nestColumns, nestTableProps, invoicesNo, relevanceType, ...resetTable } = props
const selfRef = currentRef || useRef<any>({})
useEffect(() => {
if (visible && forceRender) {
// 重新开启时需reload接口
// fix: 去掉自动reload接口, 防止重复请求
// fix: 新增forceRender接口, 用于控制弹窗是否需要reload
selfRef.current.reload && selfRef.current.reload()
} else {
selfRef.current.resetField && selfRef.current.resetField({
validate: false
})
}
}, [visible])
const [form] = Form.useForm();
const [type, setType] = useState<number>(1);
const [modalTitle, setmodalTitle] = useState<string>('订单');
useEffect(() => {
console.log(relevanceType)
setType(relevanceType)
}, [visible])
useEffect(() => {
form.setFieldsValue({
radio: type
})
}, [type])
const fetchData = (parmas?: any) => {
return new Promise(resolve => {
switch (type) {
case 1:
PublicApi.getOrderLogisticsOrderList({ ...parmas }).then(res => {
if (res.code === 1000) {
res.data.data.forEach((item:any) => {
item.applyNo = item.orderNo
item.applyAbstract = item.orderThe
item.applyTime = item.createTime
})
resolve(res.data)
}
})
break;
case 2:
PublicApi.getAsReplaceGoodsPageToBeAddReturnByLogistics({ ...parmas }).then((res:any) => {
if (res.code === 1000) {
res.data.data.forEach((item:any) => {
item.id = item.applyId
})
resolve(res.data)
}
})
break;
case 3:
PublicApi.getAsReplaceGoodsPageToBeAddReplaceByLogistics({ ...parmas }).then((res:any) => {
if (res.code === 1000) {
res.data.data.forEach((item:any) => {
item.id = item.applyId
})
resolve(res.data)
}
})
break;
case 4:
PublicApi.getAsReturnGoodsPageByLogistics({ ...parmas }).then((res:any) => {
if (res.code === 1000) {
res.data.data.forEach((item:any) => {
item.id = item.applyId
})
resolve(res.data)
}
})
break;
}
})
}
return (
<Modal
width={width}
title={modalTitle}
onOk={() => confirm(type)}
onCancel={cancel}
visible={visible}
{...resetModal}
maskClosable={false}
>
{
useNestTable ? (
<NestTable
NestColumns={nestColumns}
className="common_tb"
rowClassName={(_, index) => (index % 2) === 0 && "tb_bg"}
{...nestTableProps}
/>
) : (
<StandardTable
tableType='small'
currentRef={selfRef}
fetchTableData={(params) => fetchData(params)}
formRender={(child, ps) => <Row justify='space-between' style={{ marginBottom: 16 }}>
<Col span={18} style={{ zIndex: 99 }}>
<Form form={form}>
<Form.Item name='radio' label='单据选择'>
<Radio.Group onChange={(e) => { setType(e.target.value); selfRef.current.reload(); }}>
<Radio value={1}>订单</Radio>
<Radio value={2}>换货申请单(退货发货)</Radio>
<Radio value={3}>换货申请单(换货发货)</Radio>
<Radio value={4}>退货申请单</Radio>
</Radio.Group>
</Form.Item>
</Form>
</Col>
<Col style={{ marginTop: 4 }}>{ps}</Col>
<Col span={18} style={{ zIndex: 99 }}>{child}</Col>
</Row >}
formilyProps={
{
ctx: {
schema: type === 1 ? logisticsDeliverySearchSchema : otherSearchSchema,
components: { ModalSearch: Search, SearchSelect, Submit, DateSelect },
effects: ($, actions) => {
useStateFilterSearchLinkageEffect(
$,
actions,
type === 1 ? 'invoicesNo' : 'applyNo',
FORM_FILTER_PATH,
);
}
}
}
}
{...resetTable}
/>
)
}
</Modal>
)
}
ModalTableOrder.defaultProps = {}
export default ModalTableOrder
This diff is collapsed.
......@@ -156,7 +156,7 @@ export const otherSearchSchema: ISchema = {
}
}
const ModalTableOrder: React.FC<ModalTableProps> = (props) => {
const { width = 704, confirm, cancel, visible, currentRef, resetModal, forceRender, useNestTable = false, nestColumns, nestTableProps, invoicesNo, relevanceType, ...resetTable } = props
const { width = 704, confirm, cancel, visible, currentRef, resetModal, forceRender, useNestTable = false, nestColumns, nestTableProps, invoicesNo, relevanceType=1, ...resetTable } = props
const selfRef = currentRef || useRef<any>({})
useEffect(() => {
if (visible && forceRender) {
......
......@@ -53,12 +53,12 @@ const ChannelIndex: React.FC<ChannelIndexPropsType> = (props) => {
}, [shopInfo])
const findFirstAdvertsByType = (templateId) => {
let params = {
const params: any = {
templateId,
type: 1,
memberId
}
//@ts-ignore
PublicApi.getTemplateChannelFindAdvertsByType(params).then(res => {
if (res.code === 1000) {
setFirstAdvertList(res.data)
......@@ -67,12 +67,12 @@ const ChannelIndex: React.FC<ChannelIndexPropsType> = (props) => {
}
const findSecondAdvertsByType = (templateId) => {
let params = {
const params: any = {
templateId,
type: 2,
memberId
}
//@ts-ignore
PublicApi.getTemplateChannelFindAdvertsByType(params).then(res => {
if (res.code === 1000) {
setSecondAdvertList(res.data)
......@@ -85,9 +85,11 @@ const ChannelIndex: React.FC<ChannelIndexPropsType> = (props) => {
*/
const fetchFirstCategory = () => {
return new Promise((resolve) => {
const params: any = {
memberId
}
//@ts-ignore
PublicApi.getTemplateChannelFindAllFirstCategory({ memberId }).then(res => {
PublicApi.getTemplateChannelFindAllFirstCategory(params).then(res => {
if (res.code === 1000) {
setCategoryList(res.data)
resolve(res.data)
......@@ -101,13 +103,12 @@ const ChannelIndex: React.FC<ChannelIndexPropsType> = (props) => {
*/
const fetchCategoryById = (categoryId, templateId) => {
return new Promise((resolve) => {
let param = {
const param: any = {
templateId: templateId,
categoryId,
memberId
}
// @ts-ignore
PublicApi.getTemplateChannelFindFirstCategoryDetail(param).then(res => {
if(res.code === 1000) {
resolve(res.data)
......@@ -117,11 +118,11 @@ const ChannelIndex: React.FC<ChannelIndexPropsType> = (props) => {
}
const getCategoryComponents = async (templateId) => {
let result = []
let firstCategory: any = await fetchFirstCategory()
const result = []
const firstCategory: any = await fetchFirstCategory()
for (let item of firstCategory) {
let categoryDetail: any = await fetchCategoryById(item.id, templateId)
for (const item of firstCategory) {
const categoryDetail: any = await fetchCategoryById(item.id, templateId)
result.push(
<ShopFloorLine
linkUrl={`${GlobalConfig.channelRootRoute}/commodity?channelId=${shopUrlParam}&categoryId=${item.id}&categoryName=${btoa(encodeURIComponent(item.name))}`}
......
......@@ -709,15 +709,19 @@ const CommodityDetail = (props) => {
}
}
}
if(unitPricePicList.lenght > 0) {
setCurrentPriceRange(sortUnitPrice(unitPricePicList[0].unitPrice))
if(unitPricePicList.length > 0) {
setCurrentPriceRange(sortUnitPrice(unitPricePicList[0].unitPrice))
initStockCount(unitPricePicList)
}
// setStockCount(unitPricePicList[0].stockCount)
setCommodityImgList(tempImgList)
setAttributeList(tempAttrList)
}
/**
* 初始化库存信息 每个规格库存总和
* @param unitPricePicList
*/
const initStockCount = (unitPricePicList: any) => {
if (!unitPricePicList) {
return
......
......@@ -40,7 +40,7 @@ const MallIndex: React.FC<MallIndexPropsType> = (props) => {
templateId: mallTemplateId,
type: 1
}
PublicApi.getTemplatePlatformFindAdvertsByType(params).then(res => {
PublicApi.getTemplateAdornWebEnterpriseFindAdvertsByType(params).then(res => {
if (res.code === 1000) {
setFirstAdvertList(res.data)
}
......@@ -52,7 +52,7 @@ const MallIndex: React.FC<MallIndexPropsType> = (props) => {
templateId: mallTemplateId,
type: 2
}
PublicApi.getTemplatePlatformFindAdvertsByType(params).then(res => {
PublicApi.getTemplateAdornWebEnterpriseFindAdvertsByType(params).then(res => {
if (res.code === 1000) {
setSecondAdvertList(res.data)
}
......@@ -64,7 +64,7 @@ const MallIndex: React.FC<MallIndexPropsType> = (props) => {
*/
const fetchFirstCategory = () => {
return new Promise((resolve) => {
PublicApi.getTemplatePlatformFindAllFirstCategory().then(res => {
PublicApi.getTemplateWebCategoryWebFindAllFirstCategory().then(res => {
if (res.code === 1000) {
setCategoryList(res.data)
resolve(res.data)
......@@ -83,7 +83,7 @@ const MallIndex: React.FC<MallIndexPropsType> = (props) => {
categoryId
}
PublicApi.getTemplatePlatformFindFirstCategoryDetail(param).then(res => {
PublicApi.getTemplateAdornWebEnterpriseCategoryAdorn(param).then(res => {
if (res.code === 1000) {
resolve(res.data)
}
......
......@@ -58,7 +58,8 @@ const ShopIndex: React.FC<ChannelIndexPropsType> = (props) => {
const params: any = {
templateId: shopInfo.templateId,
type: 2,
memberId
memberId,
roleId: shopInfo.roleId
}
PublicApi.getTemplateShopFindAdvertsByType(params).then(res => {
......
......@@ -520,13 +520,8 @@ export const findLastIndexFlowState = (data: any[], customKey = 'isExecute'): nu
}
// 循环数据,找到状态值,一直覆盖
for (let i = 0; i < data.length; i++) {
if (!data[i][customKey]) {
if (data[i][customKey]) {
index = i;
break;
}
// 循环到最后如果 index 还是为 0 的话,说明工作流全部跑完了,此时 index 为 data.length - 1
if (i === data.length - 1 && index === 0) {
index = data.length - 1;
}
}
return index;
......
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