Commit f2a736d1 authored by Bill's avatar Bill

fix

parent 60abf477
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.
/* import { innerWorkFlowRecordColumn, outerWorkflowRecordsColumn} from '../detail/columns';
* @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'
// 流转记录 // 流转记录
export const historyColumn = [ export const historyColumn = [
...@@ -90,7 +80,18 @@ const basicTab = { ...@@ -90,7 +80,18 @@ const basicTab = {
value: 2 value: 2
} }
], ],
default: 1 "x-linkages": [
{
"type": "value:visible",
"target": "*(orderList, orderSource)",
"condition": "{{ $self.value === 1 }}"
},
{
"type": "value:visible",
"target": "*(productList, productSource)",
"condition": "{{ $self.value === 2 }}"
},
]
}, },
deliveryDate: { deliveryDate: {
...@@ -157,17 +158,19 @@ const basicTab = { ...@@ -157,17 +158,19 @@ const basicTab = {
type: 'string', type: 'string',
display: false display: false
}, },
docNo: { noticeNo: {
type: 'string', type: 'string',
title: '通知单号', title: '通知单号',
'x-component': 'Text' editable: false,
// 'x-component': 'Text'
}, },
docTime: { createTime: {
type: 'string', type: 'string',
title: '单据时间', title: '单据时间',
'x-component': 'Text' editable: false
// 'x-component': 'I'
}, },
status: { outerStatus: {
type: 'string', type: 'string',
title: '外部状态', title: '外部状态',
'x-component': 'Children', 'x-component': 'Children',
...@@ -175,7 +178,7 @@ const basicTab = { ...@@ -175,7 +178,7 @@ const basicTab = {
children: '待提交通知单' children: '待提交通知单'
} }
}, },
status2: { innerStatus: {
type: 'string', type: 'string',
title: '内部状态', title: '内部状态',
'x-component': 'Children', 'x-component': 'Children',
...@@ -209,14 +212,53 @@ const detailTab = { ...@@ -209,14 +212,53 @@ const detailTab = {
labelAlign: 'left' labelAlign: 'left'
}, },
properties: { properties: {
selectedSource: { orderSource: {
type: 'string',
title: '通知单来源', 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': { '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', type: 'array:number',
'x-mega-props': { 'x-mega-props': {
wrapperCol: 24, wrapperCol: 24,
...@@ -224,8 +266,8 @@ const detailTab = { ...@@ -224,8 +266,8 @@ const detailTab = {
'x-component': 'MultTable', 'x-component': 'MultTable',
'x-component-props': { 'x-component-props': {
rowKey: (record) => record.id + "_" + record.fullId, rowKey: (record) => record.id + "_" + record.fullId,
prefix: "{{tableAddButton}}", prefix: "{{tableOrderAddButton}}",
columns: "{{noticesDetailColumn}}" columns: "{{renderOrderColumn}}"
// columns: "{{tableColumns}}", // columns: "{{tableColumns}}",
}, },
'x-rules': [ 'x-rules': [
...@@ -234,7 +276,7 @@ const detailTab = { ...@@ -234,7 +276,7 @@ const detailTab = {
message: '请选择要加工的商品' message: '请选择要加工的商品'
} }
] ]
} },
} }
} }
} }
...@@ -380,19 +422,49 @@ const historyRecord = { ...@@ -380,19 +422,49 @@ const historyRecord = {
properties: { properties: {
controller: { controller: {
type: 'object', 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': { 'x-component-props': {
children: '{{RadioBtnGroup}}' columns: outerWorkflowRecordsColumn
} }
}, },
historyTable: { innerWorkFlow: {
type: 'object', type: 'array:number',
'x-component': 'Table', 'x-mega-props': {
wrapperCol: 24,
},
'x-component': 'MultTable',
'x-component-props': { 'x-component-props': {
columns: historyColumn rowKey: (record) => record.id ,
} columns: innerWorkFlowRecordColumn
// columns: "{{tableColumns}}",
},
} }
} }
} }
......
...@@ -11,9 +11,9 @@ export const useRowSelection = (options) => { ...@@ -11,9 +11,9 @@ export const useRowSelection = (options) => {
type: type, type: type,
selectedRowKeys: selectedKeys, selectedRowKeys: selectedKeys,
onSelect: async (record: any, selected: boolean, selectedRows: any[], nativeEvent) => { onSelect: async (record: any, selected: boolean, selectedRows: any[], nativeEvent) => {
const tempKey = record[primaryKey]; // const tempKey = record[primaryKey];
if(type === 'radio') { if(type === 'radio') {
setSelectedKeys(record[tempKey]); setSelectedKeys([record[primaryKey]]);
setSelectedRows(selectedRows); setSelectedRows(selectedRows);
return ; return ;
} }
......
...@@ -9,15 +9,15 @@ import { schema } from './schema'; ...@@ -9,15 +9,15 @@ import { schema } from './schema';
const actions = createAsyncFormActions(); const actions = createAsyncFormActions();
const { onFieldInit$, onFieldMount$ } = FormEffectHooks const { onFieldInit$, onFieldMount$ } = FormEffectHooks
const EnterPrise = ({visible, cancel, ...restProps}) => { const EnterPrise = ({visible, cancel, rowSelection, ...restProps}) => {
const [selectRow, memberRowCtl] = useRowSelectionTable({ customKey: 'id', type: 'radio'}); // const [selectRow, memberRowCtl] = useRowSelectionTable({ customKey: 'id', type: 'radio'});
const fetchData = useCallback(async (params: any) => { const fetchData = useCallback(async (params: any) => {
let res = await PublicApi.getMemberManageLowerPageBynamerole(params); let res = await PublicApi.getMemberManageLowerPageBynamerole(params);
return res; return res;
}, []); }, []);
const onOk = () => { const onOk = () => {
restProps.onOk(memberRowCtl) restProps.onOk()
cancel(); cancel();
} }
...@@ -51,7 +51,7 @@ const EnterPrise = ({visible, cancel, ...restProps}) => { ...@@ -51,7 +51,7 @@ const EnterPrise = ({visible, cancel, ...restProps}) => {
schema={schema} schema={schema}
actions={actions} actions={actions}
effects={effects} effects={effects}
expressionScope={{rowSelection: selectRow}} expressionScope={{rowSelection: rowSelection}}
></SearchForm> ></SearchForm>
: null : null
} }
......
...@@ -93,7 +93,7 @@ const Content: React.FC<Iprops> = React.forwardRef((props, conftentRef) => { ...@@ -93,7 +93,7 @@ const Content: React.FC<Iprops> = React.forwardRef((props, conftentRef) => {
height = height + 112; height = height + 112;
flag = true; flag = true;
return { return {
name: item.name, name: item.name,
min: prevHeight, min: prevHeight,
max: height max: height
} }
...@@ -110,6 +110,9 @@ const Content: React.FC<Iprops> = React.forwardRef((props, conftentRef) => { ...@@ -110,6 +110,9 @@ const Content: React.FC<Iprops> = React.forwardRef((props, conftentRef) => {
const handleFormSubmit = (value) => { const handleFormSubmit = (value) => {
props.formSubmit(value); props.formSubmit(value);
} }
console.log(files);
return ( return (
<div className={styles.container}> <div className={styles.container}>
<div className={styles.menu}> <div className={styles.menu}>
...@@ -123,7 +126,7 @@ const Content: React.FC<Iprops> = React.forwardRef((props, conftentRef) => { ...@@ -123,7 +126,7 @@ const Content: React.FC<Iprops> = React.forwardRef((props, conftentRef) => {
}) })
} }
</div> </div>
<div className={styles.body} ref={ref}> <div className={styles.body} ref={ref}>
<div className={styles.common} > <div className={styles.common} >
<div className={styles.header}>{"基本信息"}</div> <div className={styles.header}>{"基本信息"}</div>
...@@ -140,7 +143,7 @@ const Content: React.FC<Iprops> = React.forwardRef((props, conftentRef) => { ...@@ -140,7 +143,7 @@ const Content: React.FC<Iprops> = React.forwardRef((props, conftentRef) => {
<Col className={styles.label} span={4}>商品品类</Col> <Col className={styles.label} span={4}>商品品类</Col>
<Col span={12}> {category}</Col> <Col span={12}> {category}</Col>
</Row> </Row>
<Row className={styles.infoRow}> <Row className={styles.infoRow}>
<Col className={styles.label} span={4}>商品品牌</Col> <Col className={styles.label} span={4}>商品品牌</Col>
<Col span={12}>{brand}</Col> <Col span={12}>{brand}</Col>
</Row> </Row>
...@@ -165,20 +168,19 @@ const Content: React.FC<Iprops> = React.forwardRef((props, conftentRef) => { ...@@ -165,20 +168,19 @@ const Content: React.FC<Iprops> = React.forwardRef((props, conftentRef) => {
<div className={styles.header}>{"附件"}</div> <div className={styles.header}>{"附件"}</div>
<div className={styles.info}> <div className={styles.info}>
{ {
files.length === 0 && props.type != 'edit' files.length === 0
? <p></p> ? <p></p>
: null : props.type != 'edit'
} ? files.map((item,key) => {
{ return (
files.map((item,key) => { <FileList name={item.name} url={item.url} key={key} />
return ( )
<FileList name={item.name} url={item.url} key={key} /> })
) : null
})
} }
{ {
props.type == 'edit' props.type == 'edit'
? <UploadFile onChange={props.fileOnChange} fileMaxSize={20*1024} /> ? <UploadFile fileList={files} onChange={props.fileOnChange} fileMaxSize={20*1024} />
: null : null
} }
</div> </div>
...@@ -224,4 +226,4 @@ const Content: React.FC<Iprops> = React.forwardRef((props, conftentRef) => { ...@@ -224,4 +226,4 @@ const Content: React.FC<Iprops> = React.forwardRef((props, conftentRef) => {
) )
}) })
export default React.memo(Content); export default React.memo(Content);
\ No newline at end of file
...@@ -17,6 +17,7 @@ interface Iprops { ...@@ -17,6 +17,7 @@ interface Iprops {
productName: string, productName: string,
unitName: string, unitName: string,
uniqueID: string, uniqueID: string,
files: any[],
} }
interface IfileProps { interface IfileProps {
...@@ -28,7 +29,7 @@ const ProcessDetail: React.FC<Iprops> = (props) => { ...@@ -28,7 +29,7 @@ const ProcessDetail: React.FC<Iprops> = (props) => {
const {skuId, type, productName, ...rest} = props; const {skuId, type, productName, ...rest} = props;
const [visible, setVisible] = useState<boolean>(false); const [visible, setVisible] = useState<boolean>(false);
const [info, setInfo] = useState<any>({}) const [info, setInfo] = useState<any>({})
const [files, setFiles] = useState<IfileProps[]>([]) const [files, setFiles] = useState<IfileProps[]>(() => props.files)
const contentRef = useRef(null) const contentRef = useRef(null)
const onClose = () => { const onClose = () => {
...@@ -68,8 +69,11 @@ const ProcessDetail: React.FC<Iprops> = (props) => { ...@@ -68,8 +69,11 @@ const ProcessDetail: React.FC<Iprops> = (props) => {
} }
} }
useEffect(() => {
setFiles(props.files);
}, [props.files])
const formSubmit = (values) => { const formSubmit = (values) => {
console.log(values);
!!props.submit && props.submit({ !!props.submit && props.submit({
files: files, files: files,
uniqueID: props.uniqueID, uniqueID: props.uniqueID,
...@@ -112,11 +116,11 @@ const ProcessDetail: React.FC<Iprops> = (props) => { ...@@ -112,11 +116,11 @@ const ProcessDetail: React.FC<Iprops> = (props) => {
> >
{ {
visible visible
? <Content ? <Content
name={info?.name} name={info?.name}
id={info?.productId} id={info?.productId}
brand={info?.brand} brand={info?.brand}
category={info?.category} category={info?.category}
unitName={info?.unitName} unitName={info?.unitName}
productProps={info?.attributes} productProps={info?.attributes}
quantity={info?.quantity} quantity={info?.quantity}
...@@ -130,10 +134,10 @@ const ProcessDetail: React.FC<Iprops> = (props) => { ...@@ -130,10 +134,10 @@ const ProcessDetail: React.FC<Iprops> = (props) => {
/> />
: null : null
} }
</Drawer> </Drawer>
</> </>
) )
} }
export default ProcessDetail; export default ProcessDetail;
\ No newline at end of file
...@@ -4,7 +4,6 @@ import { Upload, Button, message } from 'antd'; ...@@ -4,7 +4,6 @@ import { Upload, Button, message } from 'antd';
import { UploadOutlined } from '@ant-design/icons' import { UploadOutlined } from '@ant-design/icons'
import { UPLOAD_TYPE } from '@/constants' import { UPLOAD_TYPE } from '@/constants'
import FileListItem from './FileList'; import FileListItem from './FileList';
import url from '*.svg';
const UploadFile = (props) => { const UploadFile = (props) => {
const { fileList = [], onChange, fileMaxSize = 20 } = props const { fileList = [], onChange, fileMaxSize = 20 } = props
...@@ -51,8 +50,7 @@ const UploadFile = (props) => { ...@@ -51,8 +50,7 @@ const UploadFile = (props) => {
}; };
const removeFile = (key) => { const removeFile = (key) => {
const res = fileList.filter((item) => item != key); const res = fileList.filter((item) => item.name != key);
console.log(res);
onChange(res); onChange(res);
} }
...@@ -62,10 +60,10 @@ const UploadFile = (props) => { ...@@ -62,10 +60,10 @@ const UploadFile = (props) => {
{ {
fileList.map((item, key) => { fileList.map((item, key) => {
return ( return (
<FileListItem <FileListItem
key={item} key={key}
name={item.name} name={item.name}
url={item.url} url={item.url}
removeFile={removeFile} removeFile={removeFile}
/> />
) )
...@@ -77,8 +75,7 @@ const UploadFile = (props) => { ...@@ -77,8 +75,7 @@ const UploadFile = (props) => {
</Upload> </Upload>
<div className={styles.tips}>一次上传一个文件,每个附件大小不能超过{fileMaxSize / 1024}M</div> <div className={styles.tips}>一次上传一个文件,每个附件大小不能超过{fileMaxSize / 1024}M</div>
</div> </div>
) )
} }
export default UploadFile; export default UploadFile;
\ No newline at end of file
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