Commit ebc9779e authored by Bill's avatar Bill

fix: 修改加工以及首页bug

parent fd3667de
......@@ -72,10 +72,12 @@ const UploadFiles: React.FC<PickUploadProps> = (props: PickUploadProps) => {
// disabled: loading || disabled,
showUploadList: false,
onChange(info: UploadChangeParam) {
console.log(info.file)
if (info.file.status === 'error' || (info.file.status === 'done' && info.file.response?.code !== 1000)) {
message.error(info.file.response?.message || "上传失败, 请检查上传接口");
return;
}
console.log(123123);
// 如果不存在fileList, 只存在onChange 那么也要改变组件的file
if (!("fileList" in props)) {
const fileList = info.fileList;
......@@ -195,7 +197,7 @@ UploadFiles.defaultProps = {
beforeUpload: (file: UploadFile) => {
if (file.size > 20 * 1024 * 1024) {
message.error("上传文件不能大于20m")
return false
return Upload.LIST_IGNORE
}
return true
},
......
......@@ -273,14 +273,14 @@ const Create = () => {
return []
}, [])
const fetchCategory = (async (actions) => {
const fetchCategory = useCallback(async (actions) => {
const { data, code } = await PublicApi.getProductCustomerGetCustomerCategoryTree();
if (code === 1000) {
actions.setFieldState("customerCategoryId", (state) => {
state.props["x-component-props"]["options"] = data;
})
}
})
}, [])
const handleBeforeProductChecked = useCallback(async (record: GetProductCommodityCommonGetCommodityListByBuyerResponseDetail, selected: boolean, list: GetProductCommodityCommonGetCommodityListByBuyerResponseDetail[]) => {
const postData = list.map((item) => {
......@@ -508,6 +508,8 @@ const Create = () => {
const children = currentOrderData.productDateilss;
const tempData = orderProductselectRowRecord.concat(record);
const keysList = tempData.filter((_item) => _item.orderId === record.orderId);
/** @toRemove 这里逻辑重复,且要删除,让后端添加时自己判断 */
const formatData = tempData.map((_item) => {
return {
productId: _item.productId,
......@@ -534,6 +536,49 @@ const Create = () => {
// type: 'checkbox',
selectedRowKeys: orderProductSelectRowKeys,
onSelect: onSelectChange,
getCheckboxProps: (record: GetOrderProcessingOrderListResponseDetail['productDateilss'][0]) => {
return {
disabled: record.purchaseCount - record.processNum <= 0, // Column configuration not to be checked
}
},
onSelectAll: async (selected: boolean, selectedRows: GetOrderProcessingOrderListResponseDetail['productDateilss'], changeRows: any[]) => {
const filterEmptyRows = changeRows.filter(Boolean)
const keys = filterEmptyRows.map((_item) => `${_item.orderId}_${_item.id}`);
if (selected) {
const orderId = changeRows[0].orderId;
const currentOrderData = fetchedOrderData?.filter((_item) => _item.id === orderId)[0];
const addTempRow = orderProductselectRowRecord.concat(filterEmptyRows);
const addTempRowKeys = addTempRow.map((_item) => `${_item.orderId}_${_item.id}`)
/** @toRemove 这里逻辑重复,且要删除,让后端添加时自己判断 */
const formatData = addTempRow.map((_item) => {
return {
productId: _item.productId,
memberId: _item.memberId || authInfo.memberId,
memberRoleId: _item.memberRoleId || authInfo.memberRoleId,
shopId: ENTERPRISE_MALL[authInfo.memberType],
/** 1.订单交易流程2.售后换货流程3.售后退货流程4.售后维修流程, @todo 5是后端说的,具体不知道代表什么意思? */
type: 5,
}
})
const { flag } = await checkProcessEnum(formatData);
if (flag) {
setOrderProductSelectRowKeys(addTempRowKeys)
setOrderProductSelectRowRecord(addTempRow)
const keysLength = addTempRowKeys.filter((_item) => _item.includes(orderId));
if (currentOrderData.productDateilss.length === keysLength.length) {
setProcessOrder((prev) => prev.concat(currentOrderData))
}
return;
}
} else {
setOrderProductSelectRowKeys((prev) => prev.filter((_item) => !keys.includes(_item)))
setOrderProductSelectRowRecord((prev) => prev.filter((_item) => !keys.includes(`${_item.orderId}_${_item.id}`)))
}
}
// onSelectAll: onSelectAll
}
......@@ -548,7 +593,7 @@ const Create = () => {
data: []
}
}, [])
/** @tofix 有bug */
const handleBeforeOrderChecked = async (record: GetOrderProcessingOrderListResponseDetail, checked: boolean, selectedRows: GetOrderProcessingOrderListResponseDetail[]) => {
const { productDateilss, orderNo, id } = record;
const keys = productDateilss.map((_item) => `${_item.orderId}_${_item.id}`);
......@@ -774,7 +819,7 @@ const Create = () => {
return (
<div>
<AnchorPage
title="新增生产通知单"
title={ isEdit ? '修改生产通知单' : "新增生产通知单"}
anchors={anchorColumn}
extra={
<Button
......@@ -889,8 +934,16 @@ const Create = () => {
schema={orderSchema}
onOk={tiggerProcessOrderProductOk}
fetchData={handleFetchOrderList}
rowSelection={{
getCheckboxProps: (_record) => {
return {
disabled: _record.productDateilss.every((_item) => _item.purchaseCount - _item.processNum <= 0)
}
}
}}
tableProps={{
rowKey: (record) => `${record.id}`,
// disabled: productDateilss.every((_i) => ),
expandable: {
expandedRowRender: (record) => {
const withOrderNo = record.productDateilss.map((_item) => {
......
......@@ -26,8 +26,8 @@ const BIND_MANAGER = '/memberCenter/channelAbility/memberList'
// 6、如果当前用户有创建渠道商城权限,但还未创建渠道商城,则显示:您还没有创建渠道商城,请先创建渠道商城,点击创建渠道商城,跳转能力中心-渠道能力-渠道商城管理-创建渠道商城铺页
const ChannelMallCenter: React.FC<Iprops> = () => {
const { loading, responseData, isError, ref, inViewPort } = useViewRequest<GetTemplateWebMemberChannelWebFindCurrMemberChannelResponse, any>(PublicApi.getTemplateWebMemberChannelWebFindCurrMemberChannel, {})
const { userAuth, hasAbilityFunc } = useGetAuth();
const { loading, responseData, isError, ref, inViewPort } = useViewRequest<GetTemplateWebMemberChannelWebFindCurrMemberChannelResponse, any>(PublicApi.getTemplateWebMemberChannelWebFindCurrMemberChannel, {memberId: userAuth.memberId})
const hasAbility = hasAbilityFunc('channelAbility');
const bindAuth = useMemo(() => userAuth.urls?.includes(BIND_MANAGER), [userAuth]);
const [salerNum, setSalerNum] = useState(0);
......@@ -74,6 +74,7 @@ const ChannelMallCenter: React.FC<Iprops> = () => {
count: salerNum,
}
], [userAuth, bindAuth, salerNum])
return (
<Layout
hasAuth={hasAbility}
......@@ -91,7 +92,7 @@ const ChannelMallCenter: React.FC<Iprops> = () => {
>
<Fragment>
{
(responseData || !responseData?.id) && (
(responseData === null || !responseData?.id) && (
<Layout.AlertTip
content="您还没有创建渠道商城,请先创建渠道商城"
url={SHOP_CENTER}
......
import { IRequestSuccess } from '@/index.d';
import { useInViewport } from '@umijs/hooks';
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
interface ResponseDataType {
code: number,
message: string
}
/***
* 当下拉滚动到可视区域时请求数据
*/
function useViewRequest<T, P>(fn: (postData: P) => Promise<ResponseDataType & { data: T }>, params?: P) {
function useViewRequest<T, P>(fn: (postData: P) => Promise<IRequestSuccess<T>>, params?: P) {
const [loading, setLoading] = useState<boolean>(false);
const [isError, setIsError] = useState<boolean>(false);
const [inViewPort, ref] = useInViewport<HTMLDivElement>();
......@@ -95,7 +91,7 @@ function useViewRequest<T, P>(fn: (postData: P) => Promise<ResponseDataType & {
return newData
}, [filterEmptyList])
return { loading, isError, ref, hasRequest, refresh, responseData, filterEmptyList, inViewPort, isEmpty, withQueryParams } as const
return { loading, isError, ref, hasRequest, refresh, responseData, filterEmptyList, inViewPort, isEmpty, withQueryParams }
}
export default useViewRequest
......@@ -34,9 +34,7 @@ interface Iprops {
width?: number,
mode: 'checkbox' | 'radio',
customizeRadio?: boolean,
/**
* rowSelection
*/
/** 回显值 */
value?: {[key: string]: any}[],
/**
* onChange
......@@ -54,7 +52,13 @@ interface Iprops {
/**
* 勾选前操作,
*/
beforeChecked?: ((record: any, selected: boolean, selectedRows: any[]) => boolean) | ((record: any, selected: boolean, selectedRows: any[]) => Promise<any>)
beforeChecked?: ((record: any, selected: boolean, selectedRows: any[]) => boolean) | ((record: any, selected: boolean, selectedRows: any[]) => Promise<any>),
/**
* rowSelection
*/
rowSelection?: {
getCheckboxProps?: (record) => any,
}
}
const TableModal: React.FC<Iprops> = (props: Iprops) => {
......@@ -77,7 +81,8 @@ const TableModal: React.FC<Iprops> = (props: Iprops) => {
footer,
width,
components,
beforeChecked
beforeChecked,
rowSelection
} = props;
const ref = useRef<any>({});
......@@ -146,7 +151,6 @@ const TableModal: React.FC<Iprops> = (props: Iprops) => {
const keys = selectedRows.map((_item) => typeof tableProps.rowKey === 'string' ? _item[tableProps.rowKey as string] : tableProps.rowKey(_item));
setSelectRowRecord(selectedRows)
setSelectRow(keys)
}
const handleSearch = (params: any) => {
......@@ -196,6 +200,7 @@ const TableModal: React.FC<Iprops> = (props: Iprops) => {
onSelectAll: onSelectAll,
selectedRowKeys: selectRow,
hideSelectAll: customizeRadio,
...rowSelection
}}
formRender={(child, ps) => (
// <div style={{display: "flex", flexDirection: 'row', justifyContent: 'space-between'}}>
......@@ -225,7 +230,7 @@ const TableModal: React.FC<Iprops> = (props: Iprops) => {
}
TableModal.defaultProps = {
// rowSelection: null,
rowSelection: {},
mode: 'radio',
tableProps: {
rowKey: 'memberId'
......
import React, { useCallback, useRef, useState } from 'react';
import { Card, Space, Button, Spin, Popconfirm } from 'antd'
import { setColumnsByLinks } from '../../memberRectification/common/columns/queryColumns';
import { rectificationListSchema } from '../../memberRectification/common/schema';
import { querySchema } from './schema';
import useFetchList from '../../memberEvaluate/hooks/useFetchList';
import { PlusOutlined } from '@ant-design/icons';
import { FORM_FILTER_PATH } from '@/formSchema/const';
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import { PublicApi } from '@/services/api';
......@@ -16,10 +13,6 @@ import { commonColumns } from './common/columns'
interface Iprops {};
const queryColumns = setColumnsByLinks({
detail: '/memberCenter/memberAbility/profile/memberRectification/detail'
})
const List: React.FC<Iprops> = (props: Iprops) => {
const { fetchListData } = useFetchList();
const ref = useRef<any>({})
......@@ -45,7 +38,7 @@ const List: React.FC<Iprops> = (props: Iprops) => {
)
}
}
], { fetchStatusListApi: PublicApi.getMemberRectifyStatusList, key: 'outerStatus' })
], { fetchStatusListApi: PublicApi.getMemberRectifyManageStatusList, key: 'outerStatus' })
const handleFetch = async (params) => {
const result = fetchListData(PublicApi.getMemberRectifyManagePage, params);
......
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