Commit f77c3000 authored by Bill's avatar Bill

fix: 修改首页css 以及 加工能力bug

parent c3e0c079
......@@ -13,7 +13,9 @@ import ProcessProducts from '../../components/ProcessProducts';
import ProcessOrder from '../../components/ProcessOrder';
import {WrapUploadFile} from '../../components/UploadFile';
import { PublicApi } from '@/services/api';
import ProcessDetail from '../../components/ProcessDetail'
import ProcessDetail from '../../components/ProcessDetail';
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable';
/*
* @Author: Bill
* @Date: 2020-10-12 11:36:38
......@@ -33,7 +35,16 @@ const Add: React.FC<{}> = () => {
// 加工订单 modal 框
const [modalOrderVisible, setModalOrderVisible] = useState<boolean>(false);
/* --------以下是 element-------- */
const [rowSelection, selectRowCtl] = useRowSelectionTable({
customKey: 'fullId',
extendsSelection: {
getCheckboxProps: record => ({
disabled: record.purchaseCount - (record.processNum || 0) <= 0,
}),
}
});
const [productRowSelection, productSelectRowCtl] = useRowSelectionTable({ customKey: 'id' });
// 选择加工企业 modal 层
const connectProduct = (
<div>
......@@ -209,10 +220,9 @@ const Add: React.FC<{}> = () => {
formActions.setFieldValue('Tabs.tab-1.layout.processName', name);
formActions.setFieldValue('Tabs.tab-1.layout.processMemberId', memberId);
formActions.setFieldValue('Tabs.tab-1.layout.processRoleId', roleId);
}
const getChangeRows = (rows, primaryKey) => {
const getChangeRows = (rows, primaryKey: string) => {
const {selectedRowKeys, selectRow} = rows;
const currentList = formActions.getFieldValue('Tabs.tab-2.layout.someLists');
// 首先去除掉没有在selectedRowkeys 的那些数据
......@@ -238,8 +248,8 @@ const Add: React.FC<{}> = () => {
* 加工商品Modal框 行勾选回调
* @param rows
*/
const processProductSelected = (rows) => {
const newRows = getChangeRows(rows, "id")
const processProductSelected = () => {
const newRows = getChangeRows(productSelectRowCtl, "id")
formActions.setFieldValue('Tabs.tab-2.layout.someLists', newRows)
}
......@@ -247,8 +257,8 @@ const Add: React.FC<{}> = () => {
* 加工订单Modal框 行勾选回调
* @param row
*/
const processOrderOnok = (rows) => {
const newRows = getChangeRows(rows, "fullId")
const processOrderOnok = () => {
const newRows = getChangeRows(selectRowCtl, "fullId")
formActions.setFieldValue('Tabs.tab-2.layout.someLists', newRows)
}
......@@ -257,7 +267,6 @@ const Add: React.FC<{}> = () => {
*/
const handleSubmit = (values: any) => {
console.log(values)
setSubmitLoading(true);
const SELF_MENTION = 2; // 自提
const {
deliveryDate,
......@@ -277,11 +286,12 @@ const Add: React.FC<{}> = () => {
const isSomeFieldNotFill = someLists.some((item) => {
return typeof item.processNum === 'undefined' || typeof item.processUnitPrice === 'undefined'
})
if(isSomeFieldNotFill) {
message.error("通知单明细中有加工商品的加工数量或加工单价未填写");
return
}
setSubmitLoading(true);
const detailList = someLists.map((item) => {
return {
orederNo: item.orderNo, // 如果是商品加工,那么他没有订单号
......@@ -356,11 +366,22 @@ const Add: React.FC<{}> = () => {
}
}
/**
* 移除数据, 这里有个bug,移除数据时,对应的modal的rowSelection 没有跟着删除
* 尝试从父组件给rowSelection
* @param id
*/
const handleRemoveRow = (id: number) => {
const currentList = formActions.getFieldValue('Tabs.tab-2.layout.someLists');
const primaryKey = activeSource === '加工订单' ? 'fullId' : 'id'
const newList = currentList.filter((item) => item[primaryKey] !== id);
formActions.setFieldValue('Tabs.tab-2.layout.someLists', newList)
const newSelectedKeys = newList.map((item) => item.id);
if(activeSource === '加工订单') {
selectRowCtl.setSelectedRowKeys(newSelectedKeys);
} else {
productSelectRowCtl.setSelectedRowKeys(newSelectedKeys)
}
}
return (
......@@ -406,12 +427,14 @@ const Add: React.FC<{}> = () => {
visible={modalProductVisible}
cancel={() => setModalProductVisible(false)}
onOk={processProductSelected}
rowSelection={productRowSelection}
></ProcessProducts>
<ProcessOrder
visible={modalOrderVisible}
cancel={() => setModalOrderVisible(false)}
onOk={processOrderOnok}
rowSelection={rowSelection}
>
</ProcessOrder>
</Card>
......
......@@ -29,16 +29,56 @@ const ADD_PROCESS_PATH = '/memberCenter/tranactionAbility/stockSellStorage/bills
const ADD_DELIVERY_PATH = '/memberCenter/tranactionAbility/stockSellStorage/bills/add';
const ADD_LOGISTICS_PATH = '/memberCenter/logisticsAbility/logisticsSubmit/toOrderSumitList/add';
const SERVICE_MAPS = {
[PENDING_ADD_PROCESS_PATH]: PublicApi.getEnhanceSupplierToBeAddStorageList,
[PROCESSING_INVOICE_TO_BE_ADD_PATH]: PublicApi.getEnhanceProcessToBeAddDeliveryList,
[PENDING_ADD_LOGISTICS_PATH]: PublicApi.getEnhanceProcessToBeAddLogisticsList,
///enhance/process/toBeDelivery/list
[PENDING_DELIVERD_PATH]: PublicApi.getEnhanceProcessToBeDeliveryList,
[PENDING_RECEIPT_PATH]: PublicApi.getEnhanceProcessToBeConfirmReceiptList,
[ASSIGN_PENDING_RECEIVE]: PublicApi.getEnhanceSupplierToBeReceiveList
}
/**
* 记录 outerStatus 还有 innerStatus, 在不同状态的时候会渲染不同的组件
* 例子 3_15 此时 状态为待审核加工发货单, 那么对应的columns 的render组件是 <a>审核</a>
*/
enum OuterAndInnerStatus {
pending_add_process = '待新增加工发货单',
/**
* 待审核加工发货单
*/
pending_exam_add_process = '3_15',
/**
* 待新增物流单
*/
pending_add_logistics = '4_16',
/**
* 待确认物流单
*/
pending_confirm_logistics = '待确认物流单',
/**
* 待确认发货
*/
pending_confirm_deliver = '5_18',
/**
* 待新增加工入库单
*/
pending_add_process_in_warehouse = '6_18',
/**
* 待审核加工入库单
*/
pending_exam_process_in_warehouse = '6_20',
/**
* 待确认收货
*/
pending_confirm_receive = '7_21',
/**
* 待确认回单
*/
pending_confirm_receipt = '8_22'
}
enum ExamType {
delivery = "deliver", //加工发货单
warehouseReceipt = 'warehouseReceipt', // 加工入库单
......@@ -86,12 +126,14 @@ const processStock: React.FC<{}> = () => {
{
title: () => pathname == PENDING_ADD_PROCESS_PATH ? '入库单号' : '发货单号',
dataIndex: 'deliveryNo',
render: (text) => {
render: (text, record: any) => {
if(!text) {
return null
}
const url = '/memberCenter/tranactionAbility/stockSellStorage/bills/detail';
const type = pathname == PENDING_ADD_PROCESS_PATH ? DOC_TYPE_PROCESS_RECEIPT : DOC_TYPE_PROCESS_INVOICE
return (
<EyePreview url="/" >{text}</EyePreview>
<EyePreview url={`${url}?relevanceInvoicesId=${record.id}&invoicesTypeId=${type}&relevanceInvoices=${DEPENDENT_DOC_PRODUCTION}`} >{text}</EyePreview>
)
}
},
......@@ -102,62 +144,58 @@ const processStock: React.FC<{}> = () => {
dataIndex: 'action',
render: (text, record: any) => {
// 这里暂时不知道status的状态, 先用内部状态判断, 审核的先不处理, 感觉应该用入库单号去判断吧
const outerStatus = record.outerStatus;
const innerStatus = record.innerStatus;
const MAP = {
// outerStatus = 5, innerStatus = 18
'待确认发货': <Link to={`${PENDING_DELIVERD_PATH}/detail?id=${record.id}`}>发货</Link>,
// outerStatus = 6, innerStatus = 19
'待新增加工入库单': (
[OuterAndInnerStatus.pending_add_process]: (
<Link
to={`${ADD_DELIVERY_PATH}?relevanceInvoicesId=${record.id}&invoicesTypeId=${DOC_TYPE_PROCESS_RECEIPT}&relevanceInvoices=${DEPENDENT_DOC_PRODUCTION}`}
to={`${ADD_PROCESS_PATH}?relevanceInvoicesId=${record.id}&invoicesTypeId=${DOC_TYPE_PROCESS_INVOICE}&relevanceInvoices=${DEPENDENT_DOC_PRODUCTION}`}
>
新增加工入库
新增加工发货
</Link>
),
// outerStatus = 6, innerStatus = 20
'待审核加工入库单': (
[OuterAndInnerStatus.pending_exam_add_process]: (
<Popconfirm
title={`是否确认审核入库单号为${record.deliveryNo}的加工入库单?`}
title={`是否确认审核发货单号为${record.deliveryNo}的加工发货单?`}
visible={visibleID === record.id}
placement="left"
okText="确定"
cancelText="取消"
onCancel={handleCancel}
okButtonProps={{ loading: confirmLoading }}
onConfirm={() => handleExam(record.id, ExamType.warehouseReceipt)}
onConfirm={() => handleExam(record.id, ExamType.delivery)}
>
<a onClick={() => handleVisible(record.id)}>审核</a>
</Popconfirm>
),
// outerStatus = 7, innerStatus = 21
'待确认收货': <Link to={`${ASSIGN_PENDING_RECEIVE}/detail?id=${record.id}`}>收货</Link>,
'待新增加工发货单': (
[OuterAndInnerStatus.pending_add_logistics]: <Link to={`${ADD_LOGISTICS_PATH}`}>新增</Link>,
[OuterAndInnerStatus.pending_confirm_logistics]: <a>查看</a>,
[OuterAndInnerStatus.pending_confirm_deliver]: <Link to={`${PENDING_DELIVERD_PATH}/detail?id=${record.id}`}>发货</Link>,
[OuterAndInnerStatus.pending_add_process_in_warehouse]: (
<Link
to={`${ADD_PROCESS_PATH}?relevanceInvoicesId=${record.id}&invoicesTypeId=${DOC_TYPE_PROCESS_INVOICE}&relevanceInvoices=${DEPENDENT_DOC_PRODUCTION}`}
to={`${ADD_DELIVERY_PATH}?relevanceInvoicesId=${record.id}&invoicesTypeId=${DOC_TYPE_PROCESS_RECEIPT}&relevanceInvoices=${DEPENDENT_DOC_PRODUCTION}`}
>
新增加工发货
新增加工入库
</Link>
),
'待审核加工发货单': (
[OuterAndInnerStatus.pending_exam_process_in_warehouse]: (
<Popconfirm
title={`是否确认审核发货单号为${record.deliveryNo}的加工发货单?`}
title={`是否确认审核入库单号为${record.deliveryNo}的加工入库单?`}
visible={visibleID === record.id}
placement="left"
okText="确定"
cancelText="取消"
onCancel={handleCancel}
okButtonProps={{ loading: confirmLoading }}
onConfirm={() => handleExam(record.id, ExamType.delivery)}
onConfirm={() => handleExam(record.id, ExamType.warehouseReceipt)}
>
<a onClick={() => handleVisible(record.id)}>审核</a>
</Popconfirm>
),
'待新增物流单': <Link to={`${ADD_LOGISTICS_PATH}`}>新增</Link>,
'待确认物流单': <a>查看</a>,
// outerStatus = 8, innerStatus = 22
'待确认回单': <Link to={`${PENDING_RECEIPT_PATH}/detail?id=${record.id}`}>确认回单</Link>
[OuterAndInnerStatus.pending_confirm_receive]: <Link to={`${ASSIGN_PENDING_RECEIVE}/detail?id=${record.id}`}>收货</Link>,
[OuterAndInnerStatus.pending_confirm_receipt]: <Link to={`${PENDING_RECEIPT_PATH}/detail?id=${record.id}`}>确认回单</Link>
}
return MAP[record.innerStatusName]
return MAP[`${outerStatus}_${innerStatus}`] || MAP[record.innerStatusName]
}
}
]
......
......@@ -173,6 +173,7 @@ export const SUPPLIER_INNER_STATUS_COLOR = {
'4': 'processing',
"5": "success",
"9": "error",
"10": "success"
}
......@@ -226,8 +227,24 @@ export const SUPPLIER_OUTER_STATUS_COLOR: SUPPLIER_OUTER_STATUS_COLOR_TYPE= [
"success"
]
/**
* 确认生产通知单 -> 列表页 -> 内部状态
*/
export const PROCESS_OUTER_STATUS_COLOR: ("default" | "processing" | "error"| "success" | "warning")[] = [
"error", // 不接受申请
"default", // 待提交审核 processInnerStatus = 1,
"warning", // 待审核 processInnerStatus = 2,
"error", // 待审核(1级) processInnerStatus = 3 不通过
"success", // 待审核(2级) processInnerStatus = 4 审核通过
"processing", // 待新增加工发货单 processInnerStatus = 5
"warning", // 待审核加工发货单 processInnerStatus = 6
"default", // 待新增物流单 processInnerStatus = 7
"processing", // 待确认物流单 processInnerStatus = 8
"warning", // 待确认发货 processInnerStatus = 9
"success", // 已确认发货 processInnerStatus = 10
"default", // processInnerStatus = 11 待确认回单
"success", // 完成 processInnerStatus = 12
]
/**
* 待新增加工入库单
......
......@@ -10,9 +10,15 @@ const TablePagination = (props) => {
}
return (
<div style={parentStyle}>
<Pagination {...componentProps} current={props.value?.current || 1} onChange={handleChange} ></Pagination>
</div>
<>
{
total > 0
? <div style={parentStyle}>
<Pagination {...componentProps} current={props.value?.current || 1} onChange={handleChange} ></Pagination>
</div>
: null
}
</>
)
}
......
......@@ -22,7 +22,7 @@ const expandRowColumn = [
];
const ProcessProducts = ({visible, cancel, ...restProps}) => {
const ProcessProducts = ({visible, cancel, rowSelection, ...restProps}) => {
// const [mainTableSelectRow, mainTableSelectRowCtl] = useRowSelectionTable({customKey: 'id'});
const [selectRow, selectRowCtl] = useRowSelectionTable({
customKey: 'fullId',
......@@ -73,7 +73,8 @@ const ProcessProducts = ({visible, cancel, ...restProps}) => {
<Table
columns={expandRowColumn}
rowKey={(row) => row.fullId}
rowSelection={selectRow}
// rowSelection={selectRow}
rowSelection={rowSelection}
dataSource={renderData}
pagination={false}
/>
......@@ -85,8 +86,9 @@ const ProcessProducts = ({visible, cancel, ...restProps}) => {
const handleSubmit = () => {
// console.log(selectRowCtl, mainTableSelectRowCtl);
console.log(selectRowCtl)
restProps.onOk(selectRowCtl)
// console.log(selectRowCtl)
// restProps.onOk(selectRowCtl)
restProps.onOk()
cancel();
}
......
......@@ -118,18 +118,29 @@ export const schema = {
width: '150px',
margin: '0 20px 0 0'
},
default: 0,
defaultValue: 0,
}
},
type: {
type: 'string',
'x-component': 'Select',
'x-component-props': {
options: [],
options: [
{label: '询价采购', value: 1},
{label: '需求采购', value: 2},
{label: '现货采购', value: 3},
{label: '集采', value: 4},
{label: '积分兑换', value: 5},
{label: '渠道直采', value: 6},
{label: '渠道现货', value: 7},
{label: '渠道积分兑换', value: 8},
],
style: {
width: '150px',
margin: '0 20px 0 0'
}
},
placeholder: '订单类型',
allowClear: true
}
},
queryBtn: {
......
......@@ -4,11 +4,9 @@ import { PublicApi } from '@/services/api';
import EyePreview from '@/components/EyePreview';
import { BasicForm, TablePagination, SearchForm } from '../ModalForTable'
import { createAsyncFormActions, FormEffectHooks } from '@formily/antd';
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable';
import { schema } from './schema';
import { getAuth } from '@/utils/auth';
const { onFieldInit$ } = FormEffectHooks
const actions = createAsyncFormActions();
......@@ -20,8 +18,7 @@ const MALL_NAME = {
"3": "渠道商城",
"4": "渠道自有商城"
}
const ProcessProducts = ({visible, cancel, ...restProps}) => {
const [selectRow, setSelectRow] = useRowSelectionTable({ customKey: 'id' });
const ProcessProducts = ({visible, cancel, rowSelection, ...restProps}) => {
const authInfo = getAuth();
const fetchData = useCallback(async (params: any) => {
console.log(params);
......@@ -32,7 +29,6 @@ const ProcessProducts = ({visible, cancel, ...restProps}) => {
memberId:authInfo.memberId,
...params,
}
console.log(postData);
let res = await PublicApi.getProductCommodityCommonGetCommodityListByBuyer(postData);
return res;
}, [])
......@@ -52,13 +48,13 @@ const ProcessProducts = ({visible, cancel, ...restProps}) => {
]
const onOk = () => {
restProps.onOk(setSelectRow)
// restProps.onOk(setSelectRow)
restProps.onOk()
cancel();
}
const effects = () => {
onFieldInit$('branchId').subscribe((fieldState) => {
///product/select/getSelectBrand
PublicApi.getProductSelectGetSelectBrand({name: ''}).then(res => {
let options = []
if(res.code === 1000) {
......@@ -70,7 +66,6 @@ const ProcessProducts = ({visible, cancel, ...restProps}) => {
})
});
onFieldInit$('categoryId').subscribe((fieldState) => {
///product/select/getSelectBrand
PublicApi.getProductSelectGetSelectCategory({name: ''}).then(res => {
let options = []
if(res.code === 1000) {
......@@ -99,7 +94,7 @@ const ProcessProducts = ({visible, cancel, ...restProps}) => {
schema={schema}
actions={actions}
effects={effects}
expressionScope={{rowSelection: selectRow, columns: columns}}
expressionScope={{rowSelection: rowSelection, columns: columns}}
></SearchForm>
: null
}
......
......@@ -19,7 +19,8 @@ import {
CONFIRM_PENDING_SECOND,
CONFIRM_PENDING_CONFIRM,
SUPPLIER_INNER_STATUS_COLOR,
SUPPLIER_OUTER_STATUS_COLOR
SUPPLIER_OUTER_STATUS_COLOR,
PROCESS_OUTER_STATUS_COLOR
} from '../../common'
import { timeRange } from '@/utils';
......@@ -72,10 +73,8 @@ const Query: React.FC<{}> = (props) => {
return {}
}, [pathname])
// 初始化高级筛选选项
const fetchSelectOptions = useCallback(async () => {
const fetchSelectOptions = useCallback(async () => {
const { data, code } = await PublicApi.getEnhanceSupplierAllOuterAndInner()
if(code === 1000) {
return {
......@@ -120,7 +119,7 @@ const Query: React.FC<{}> = (props) => {
dataIndex: 'innerStatusName',
render: (text, record: any) => {
return (
<Badge status={SUPPLIER_INNER_STATUS_COLOR[record.processInnerStatus] || 'default'} text={text}></Badge>
<Badge status={PROCESS_OUTER_STATUS_COLOR[record.processInnerStatus] || 'default'} text={text}></Badge>
)
}
}
......
......@@ -10,12 +10,11 @@ interface Iprops {};
const url = '/memberCenter/handling/assign/query'
const KEY_TITLE = {
processList: '指派生产通知单',
supplierList: '生产通知单处理'
supplierList: '指派生产通知单',
processList: '生产通知单处理'
}
const ProcessCenter: React.FC<Iprops> = () => {
///report/member/home/getEnhanceTally
const request = useCallback(async () => {
const res = await PublicApi.getReportMemberHomeGetEnhanceTally();
return res;
......
......@@ -19,11 +19,12 @@
.item {
background: #F7F8FA;
width: 157px;
text-align: center;
color: #303133;
padding: 6px;
margin-bottom: 16px;
display: flex;
justify-content: center;
align-items: center;
a {
color: #303133;
}
......
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