Commit 34d0a9f8 authored by 前端-黄佳鑫's avatar 前端-黄佳鑫
parents 1b59b331 792b81aa
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,18 @@ const basicTab = {
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: {
......@@ -157,17 +158,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 +178,7 @@ const basicTab = {
children: '待提交通知单'
}
},
status2: {
innerStatus: {
type: 'string',
title: '内部状态',
'x-component': 'Children',
......@@ -209,14 +212,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 +266,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 +276,7 @@ const detailTab = {
message: '请选择要加工的商品'
}
]
}
},
}
}
}
......@@ -380,19 +422,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}}",
},
}
}
}
......
......@@ -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,15 @@ 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;
}, []);
const onOk = () => {
restProps.onOk(memberRowCtl)
restProps.onOk()
cancel();
}
......@@ -51,7 +51,7 @@ const EnterPrise = ({visible, cancel, ...restProps}) => {
schema={schema}
actions={actions}
effects={effects}
expressionScope={{rowSelection: selectRow}}
expressionScope={{rowSelection: rowSelection}}
></SearchForm>
: null
}
......
......@@ -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,9 @@ const Content: React.FC<Iprops> = React.forwardRef((props, conftentRef) => {
const handleFormSubmit = (value) => {
props.formSubmit(value);
}
console.log(files);
return (
<div className={styles.container}>
<div className={styles.menu}>
......@@ -123,7 +126,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 +143,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 +168,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 +226,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;
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