Commit efe30e35 authored by Bill's avatar Bill

fix: 修改首页跳转带搜索条件

parent d264c174
......@@ -38,7 +38,6 @@
"start:25": "cross-env SITE_ID=1 BACK_GATEWAY=http://10.0.0.25:8100 USE_ROUTE_CONFIG=true SOCKET_URL=ws://10.0.0.25:9400 yarn start",
"start:v2": "cross-env SITE_ID=1 BACK_GATEWAY=http://10.0.0.17:8100 USE_ROUTE_CONFIG=true SOCKET_URL=ws://10.0.0.17:9880 yarn start",
"start:v2Preview": "cross-env SITE_ID=1 BACK_GATEWAY=http://10.0.1.220:8100 USE_ROUTE_CONFIG=false SOCKET_URL=ws://10.0.1.220:9400 yarn start"
},
"lint-staged": {
"*.{js,jsx,less,md,json}": [
......@@ -67,7 +66,7 @@
"bizcharts": "^4.0.14",
"copy-to-clipboard": "^3.3.1",
"crypto-js": "^4.0.0",
"god": "0.2.5",
"god": "^0.2.9",
"immutability-helper": "^3.1.1",
"lingxi-design": "^2.0.1",
"lingxi-design-ui": "^2.0.6",
......
......@@ -7,7 +7,16 @@ export enum PageStatus {
PREVIEW
}
export const usePageStatus = () => {
type resultData = {
id: string,
pageStatus: PageStatus,
lastTypeParams: string,
preview: any,
} & {
[key: string]: string | number,
}
export const usePageStatus = (): resultData => {
const { preview, id = '', ...rest } = history.location.query
const lastTypeParams = history.location.pathname.substr(history.location.pathname.lastIndexOf('/'))
// 默认预览状态
......@@ -28,5 +37,5 @@ export const usePageStatus = () => {
preview,
lastTypeParams,
...rest,
}
}
\ No newline at end of file
} as const
}
/**
* 给Standard table 设置搜索值
*/
import { useMemo } from "react";
import { usePageStatus } from "./usePageStatus";
const useSetSearchValueInTable = () => {
const { id, lastTypeParams, pageStatus, preview, ...rest } = usePageStatus();
const cacheData = useMemo(() => rest, [rest])
const formatInitialValue = useMemo(() => {
const length = Object.keys(rest).length;
if (length === 0) {
return {}
}
return {
value: rest
}
}, [cacheData])
return {
searchData: rest,
formatInitialValue,
}
}
export default useSetSearchValueInTable
......@@ -20,6 +20,7 @@ import { fetchOptions } from '../../common'
import useFetchColumns from '../../hooks/useFetchColumns';
import UploadVoucherModal from '../../components/UploadVoucherModal';
import Voucher from '../../components/Voucher';
import useSetSearchValueInTable from '@/hooks/useSetSearchValueInTable';
const { RangePicker } = DatePicker;
const formActions = createFormActions();
......@@ -38,6 +39,7 @@ interface SearchParams {
const SettlementList = () => {
const ref = useRef<any>({})
const { searchData, formatInitialValue } = useSetSearchValueInTable();
const { columns, manualStatus, payModalVisible, balanceInfo, payModalOnCancel, viewModalonCancel, viewVisible, payVoucherInfo } = useFetchColumns("payable");
const [files, setFiles] = useState<any>([]);
const [uploadSubmitLoading, setUploadSubmitLoading] = useState<boolean>()
......@@ -51,6 +53,7 @@ const SettlementList = () => {
...params,
orderType: params.orderType || 0,
status: params.status || 0,
...searchData,
}
// /settle/accounts/member/settlement/pagePayableSettlement
const { data } = await PublicApi.getSettleAccountsMemberSettlementPagePayableSettlement(searchParams);
......@@ -106,7 +109,7 @@ const SettlementList = () => {
const handleSearch = (values: SearchParams) => {
const format = 'YYYY-MM-DD'
const startTime = values.startTime?.format(format);
const endTime = values.endTime ? values.endTime.format("YYYY-MM-DD") + " 23:59:59" : "";
const endTime = values.endTime ? values.endTime.endOf("days").format("YYYY-MM-DD HH:mm:ss"): "";
ref.current.reload({...values, startTime, endTime});
}
......@@ -139,6 +142,7 @@ const SettlementList = () => {
}}
schema={schema}
onSubmit={handleSearch}
{...formatInitialValue}
// onReset={() => {
// formActions.setFieldValue('startTime', null);
// formActions.setFieldValue('endTime', null);
......
......@@ -51,14 +51,7 @@ export const schema: ISchema = {
},
status: {
type: 'string',
enum: [
{ label: '结算状态(所有)', value: 0 },
{ label: '待对账', value: 1 },
{ label: '待付款', value: 2 },
{ label: '代收款', value: 3 },
{ label: '完成', value: 4 },
],
default: 0,
enum: [],
'x-component-props': {
placeholder: '结算状态(全部)',
allowClear: true,
......@@ -66,12 +59,7 @@ export const schema: ISchema = {
},
orderType: {
type: 'string',
enum: [
{ label: '结算单据(所有)', value: 0 },
{ label: '生产通知单', value: 1 },
{ label: '物流单', value: 2 },
],
default: 0,
enum: [],
'x-component-props': {
placeholder: '结算单据(全部)',
allowClear: true,
......
......@@ -19,6 +19,8 @@ import { PublicApi } from '@/services/api'
// import StatusTag from '../../components/StatusTag';
import StatusTag, { STATUS_TYPE } from '@/components/StatusTag'
import { fetchOptions } from '../../common';
import useSetSearchValueInTable from '@/hooks/useSetSearchValueInTable';
import { numFormat, priceFormat } from '@/utils/numberFomat';
const RangePicker = DatePicker.RangePicker;
const formActions = createFormActions();
......@@ -27,6 +29,7 @@ const SettlementList = () => {
const ref = useRef<any>({});
const [visible, setVisible] = useState(false);
const [activeData, setActiveData] = useState({});
const { searchData, formatInitialValue } = useSetSearchValueInTable();
/**
* 获取开票管理列表
......@@ -36,8 +39,9 @@ const SettlementList = () => {
// /settle/accounts/member/settlement/pageReceiptInvoice
const searchParams = {
...params,
invoiceStatus: typeof params.invoiceStatus == 'undefined' ? 2 : params.invoiceStatus ,
payStatus: typeof params.payStatus == 'undefined' ? 2 : params.payStatus,
invoiceStatus: params?.invoiceStatus || 2 ,
payStatus: params?.payStatus || 2,
...searchData,
}
const { data } = await PublicApi.getSettleAccountsMemberSettlementPageReceiptInvoice(searchParams);
return data
......@@ -49,16 +53,15 @@ const SettlementList = () => {
const handleSearch = (values) => {
const format = 'YYYY-MM-DD'
const payStartTime = values.payStartTime?.format(format);
const payEndTime = values.payEndTime ? values.payEndTime.format(format) + " 23:59:59" : "";
const payEndTime = values.payEndTime ? values.payEndTime.endOf("day").format('YYYY-MM-DD HH:mm:ss') : "";
const orderStartTime = values.orderStartTime?.format(format);
const orderEndTime = values.orderEndTime ? values.orderEndTime?.format(format) + " 23:59:59" : ""; ;
const orderEndTime = values.orderEndTime ? values.orderEndTime.endOf("day").format('YYYY-MM-DD HH:mm:ss') : ""; ;
ref.current.reload({...values, payStartTime, payEndTime, orderStartTime, orderEndTime});
}
const handleShow = (record) => {
document.body.parentNode.style.overflowY = "hidden";
setVisible(true)
console.log(record);
setActiveData({
id: record.id,
type: record.invoiceStatus,
......@@ -82,7 +85,7 @@ const SettlementList = () => {
return (
<div>
<p>{record.orderNo}</p>
<StatusTag title={record.settlementOrderTypeName} type={STATUS_TYPE[record.settlementOrderType]} />
<StatusTag title={record.settlementOrderTypeName} type={STATUS_TYPE[record.settlementOrderType] as "success"} />
</div>
)
}
......@@ -107,7 +110,13 @@ const SettlementList = () => {
return record.isHasTax ? `${record.isHasTaxName}/${record.taxRate}` : '否';
}
},
{title: '单据总额', dataIndex: 'orderAmount'},
{
title: '单据总额',
dataIndex: 'orderAmount',
render: (text, record) => {
return numFormat(record.orderAmount)
}
},
{
title: '支付批次/环节',
dataIndex: 'batch',
......@@ -120,7 +129,13 @@ const SettlementList = () => {
)
}
},
{title: '支付金额', dataIndex: 'payAmount'},
{
title: '支付金额',
dataIndex: 'payAmount',
render: (text, record) => {
return priceFormat(record.payAmount)
}
},
{title: '支付时间', dataIndex: 'payTime'},
{
title: '开票状态',
......@@ -204,12 +219,13 @@ const SettlementList = () => {
formActions.setFieldValue('orderStartTime', null);
formActions.setFieldValue('orderEndTime', null);
}}
{...formatInitialValue}
/>
}
/>
</Card>
<InvoiceCreate
{...activeData}
{...activeData as any}
title="开具发票"
width={800}
visible={visible}
......
......@@ -69,12 +69,7 @@ export const schema: ISchema = {
},
invoiceStatus: {
type: 'string',
default: 2,
enum: [
{label: '开票状态(全部)', value: 2},
{label: '未开票', value: 0},
{label: '已开票', value: 1}
],
enum: [],
'x-component-props': {
placeholder: '开票状态(全部)',
allowClear: true,
......@@ -82,12 +77,7 @@ export const schema: ISchema = {
},
payStatus: {
type: 'string',
default: 2,
enum: [
{label: '支付状态(全部)', value: 2},
{label: '未支付', value: 0},
{label: '已支付', value: 1}
],
enum: [],
'x-component-props': {
placeholder: '支付状态(全部)',
allowClear: true,
......
......@@ -4,12 +4,13 @@
* @Description: 应付账款结算
*/
import React, { useCallback, useEffect, useRef, useState } from 'react';
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import { Card, DatePicker, Modal, Space, Button} from 'antd';
import NiceForm from '@/components/NiceForm';
import { FORM_FILTER_PATH } from '@/formSchema/const';
import { createFormActions } from '@formily/antd';
// import StandardTable from './StandardTable';
import { StandardTable } from 'god';
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect';
......@@ -19,23 +20,39 @@ import { fetchOptions } from '../../common';
import useFetchColumns from '../../hooks/useFetchColumns'
import Voucher from '../../components/Voucher';
import ConfirmAccount from '../../components/ConfirmAccount';
import { usePageStatus } from '@/hooks/usePageStatus';
import useSetSearchValueInTable from '@/hooks/useSetSearchValueInTable';
const { RangePicker } = DatePicker;
const formActions = createFormActions();
type requestDataType = {
status: number,
orderType: string | number,
startTime: string,
endTime: string,
settlementName: string,
payName: string,
settlementNo: number,
current: number,
pageSize: number,
}
const SettlementList = () => {
const ref = useRef<any>({})
const { searchData, formatInitialValue } = useSetSearchValueInTable();
const [files, setFiles] = useState<any>([]);
const { columns, confirmPayInfo, confirmPayVisible, reconciliationInfo, reconciliationVisible, viewVisible, payVoucherInfo, viewModalonCancel, confirmPayOnCancel, reconciliationOnCancel } = useFetchColumns("receiveable")
const fetchListData = async (params) => {
const fetchListData = async (params: requestDataType) => {
const searchParams = {
...params,
orderType: params.orderType || 0,
status: params.status || 0,
orderType: params.orderType || '0',
status: params.status || '0',
...searchData,
}
// /settle/accounts/member/settlement/pagePayableSettlement
const { data } = await PublicApi.getSettleAccountsMemberSettlementPageReceivableSettlement(searchParams);
const { data } = await PublicApi.getSettleAccountsMemberSettlementPageReceivableSettlement(searchParams as any);
return data
}
......@@ -79,7 +96,7 @@ const SettlementList = () => {
const handleSearch = (values: any) => {
const format = 'YYYY-MM-DD'
const startTime = values.startTime?.format(format);
const endTime = values.endTime ? values.endTime.format("YYYY-MM-DD") + " 23:59:59" : "";
const endTime = values.endTime ? values.endTime.endOf("day").format('YYYY-MM-DD HH:mm:ss') : "";
ref.current.reload({...values, startTime, endTime});
}
......@@ -112,10 +129,7 @@ const SettlementList = () => {
}}
schema={schema}
onSubmit={handleSearch}
onReset={() => {
formActions.setFieldValue('startTime', null);
formActions.setFieldValue('endTime', null);
}}
{...formatInitialValue}
/>
}
/>
......
......@@ -51,14 +51,7 @@ export const schema: ISchema = {
},
status: {
type: 'string',
enum: [
{ label: '结算状态(所有)', value: 0 },
{ label: '待对账', value: 1 },
{ label: '待付款', value: 2 },
{ label: '代收款', value: 3 },
{ label: '完成', value: 4 },
],
default: 0,
enum: [],
'x-component-props': {
placeholder: '结算状态(全部)',
allowClear: true,
......@@ -66,12 +59,7 @@ export const schema: ISchema = {
},
orderType: {
type: 'string',
enum: [
{ label: '结算单据(所有)', value: 0 },
{ label: '生产通知单', value: 1 },
{ label: '物流单', value: 2 },
],
default: 0,
enum: [],
'x-component-props': {
placeholder: '结算单据(全部)',
allowClear: true,
......
......@@ -41,7 +41,7 @@ export const fetchOptions = (service) => {
return async function() {
const res = await service();
if(res.code === 1000) {
return res.data.map((item) => {return { label: item.text, value: item.id }})
return res.data.map((item) => {return { label: item.text, value: item.id.toString() }})
}
return [];
}
......
......@@ -160,7 +160,7 @@ const UploadVoucherModal: React.FC<UploadVocherProps> = (props) => {
{
infoList.map((_item) => {
return (
<div className={styles.formItem}>
<div className={styles.formItem} key={_item.dataIndex}>
<span className={styles.label}>{_item.title}</span>
{/* 可以设置render 自定义 渲染 */}
<span className={styles.value}>{accountInfo?.[_item.dataIndex]}</span>
......
......@@ -25,6 +25,8 @@ import Voucher from '../../components/Voucher';
import { TO_BE_RECONCILED, TO_BE_COLLECTED, COMPLETED } from '../../common/constants';
import useFetchColumns from '../../hooks/useFetchColumns';
import { STATUS_TEXT } from '@/constants/balance';
import { numFormat, priceFormat } from '@/utils/numberFomat';
import useSetSearchValueInTable from '@/hooks/useSetSearchValueInTable';
const formActions = createFormActions();
const { RangePicker } = DatePicker;
......@@ -49,6 +51,7 @@ const AccountReceivable = () => {
handleViewPayModal
} = useFetchColumns("receiveable");
const [files, setFiles] = useState([]);
const { searchData, formatInitialValue } = useSetSearchValueInTable();
const columns = [
{
......@@ -64,10 +67,10 @@ const AccountReceivable = () => {
},
{title: '结算日期', dataIndex: 'settlementDate'},
{title: '结算方式', dataIndex: 'settlementWayName'},
{title: '总单数', dataIndex: 'totalCount'},
{title: '代收金额', dataIndex: 'collectAmount', render: (text) => `¥${text}`},
{title: '总单数', dataIndex: 'totalCount', render: (text) => numFormat(text)},
{title: '代收金额', dataIndex: 'collectAmount', render: (text) => `¥${priceFormat(text)}`},
{title: '佣金', dataIndex: 'brokerage'},
{title: '结算金额', dataIndex: 'amount', render: (text) => `¥${text}`},
{title: '结算金额', dataIndex: 'amount', render: (text) => `¥${priceFormat(text)}`},
{title: '结算时间', dataIndex: 'settlementTime'},
{title: '支付方式', dataIndex: 'payWayName'},
{
......@@ -101,11 +104,12 @@ const AccountReceivable = () => {
const { retColumn } = useIsExistBrokerage(columns, ["brokerage"]);
const fetchListData = async (params) => {
const searchData = {
const postData = {
...params,
status: typeof params.status == 'undefined' ? 0 : params.status,
status: params.status || 0,
...searchData
}
const { data } = await PublicApi.getSettleAccountsPlatformSettlementPageReceivableSettlement(searchData);
const { data } = await PublicApi.getSettleAccountsPlatformSettlementPageReceivableSettlement(postData);
return data
}
/**
......@@ -150,7 +154,7 @@ const AccountReceivable = () => {
const handleSearch = (values: any) => {
const format = 'YYYY-MM-DD'
const startTime = values.startTime?.format(format);
const endTime = values.endTime ? values.endTime.format(format) + " 23:59:59" : "";;
const endTime = values.endTime ? values.endTime.endOf("days").format('YYYY-MM-DD HH:mm:ss') : "";;
ref.current.reload({...values, startTime, endTime});
}
......@@ -183,6 +187,7 @@ const AccountReceivable = () => {
formActions.setFieldValue('startTime', null);
formActions.setFieldValue('endTime', null);
}}
{...formatInitialValue}
/>
}
/>
......
......@@ -66,7 +66,6 @@ export const schema: ISchema = {
enum: [
{label: '结算状态(全部)', value: 0},
],
default: 0,
'x-component-props': {
placeholder: '结算状态(全部)',
allowClear: true,
......
......@@ -24,6 +24,7 @@ import Voucher from '../../components/Voucher';
import ConfirmAccount from '../../components/ConfirmAccount';
import { COMPLETED, TO_BE_COLLECTED, TO_BE_RECONCILED } from '../../common/constants';
import { STATUS_TEXT } from '@/constants/balance';
import useSetSearchValueInTable from '@/hooks/useSetSearchValueInTable';
const formActions = createFormActions();
const Integral: React.FC = () => {
......@@ -43,6 +44,7 @@ const Integral: React.FC = () => {
handleViewPayModal
} = useFetchColumns("receiveable");
const [files, setFiles] = useState([]);
const { searchData, formatInitialValue } = useSetSearchValueInTable();
const columns = [
{
......@@ -100,12 +102,13 @@ const Integral: React.FC = () => {
]
const fetchListData = async (params) => {
const searchData = {
const postData = {
...params,
status: typeof params.status == 'undefined' ? 0 : params.status,
status: params.status || 0,
...searchData,
}
// /settle/accounts/platform/score/settlement/pageReceivableSettlement
const { data } = await PublicApi.getSettleAccountsPlatformScoreSettlementPageReceivableSettlement(searchData);
const { data } = await PublicApi.getSettleAccountsPlatformScoreSettlementPageReceivableSettlement(postData);
return data
}
......@@ -182,6 +185,7 @@ const Integral: React.FC = () => {
formActions.setFieldValue('startTime', null);
formActions.setFieldValue('endTime', null);
}}
{...formatInitialValue}
/>
}
/>
......
......@@ -68,18 +68,11 @@ export const schema: ISchema = {
// },
status: {
type: 'string',
enum: [
{label: '结算状态(全部)', value: 0},
{label: '待对账', value: 1},
{label: '待付款', value: 2},
{label: '待收款', value: 3},
{label: '待完成', value: 4},
],
enum: [],
'x-component-props': {
placeholder: '结算状态(全部)',
allowClear: true,
},
default: 0
},
submit: {
'x-component': 'Submit',
......@@ -149,7 +142,6 @@ export const detailSchema: ISchema = {
orderTime: {
type: 'string',
enum: orderTime,
default: 0,
'x-component-props': {
placeholder: '下单时间(全部)',
allowClear: true,
......@@ -158,7 +150,6 @@ export const detailSchema: ISchema = {
payTime: {
type: 'string',
enum: payTime,
default: 0,
'x-component-props': {
placeholder: '支付时间(全部)',
allowClear: true,
......
......@@ -52,7 +52,50 @@ type EnterpriceType = {
roleId: number | string
}
type submitDataType = {}
type submitDataType = {
deliveryDate: string,
/**配送方式 */
deliveryType: 1 | 2 | number & {},
/* 加工企业id */
processMemberId: number,
processName: string
processRoleId: number,
/** 来源 1 加工订单, 2 加工商品 */
source: 1 | 2 | number & {},
/** 通知单摘要 */
summary: string,
orderList?: {
/** 品牌 */
brand: string,
category: string
/** skuid */
commodityId: number,
/** 附件 */
enclosure: [],
/** 订单商品下 唯一id */
id: string,
/** 是否是 */
isHasTax: 0 | 1 | number | {},
/** 是否含税、税率,显示用 */
isHasTaxAndTaxRate: "是/1%",
/** 商品图片 */
mainPic: string,
/** 商品名 */
name: string,
/** 定点 */
orderId: 17532
orderNo: "JJDJ21563"
processNum: "22"
processTotalPrice: "726.00"
processUnitPrice: "33"
purchaseCount: 3
purchaseCountAndUnit: "3/瓶"
skuid: 511
surplusAndProcessNum: -19
taxRate: "1"
unitName: "瓶"
}
}
/** @tofix 临时的,因为后端不返回只能值么临时搞着 */
const MALL_NAME = {
......@@ -105,6 +148,7 @@ const Create = () => {
const { visible: processOrderVisible, toggle: processOrderToggle } = useModal();
const [orderProductSelectRowKeys, setOrderProductSelectRowKeys] = useState<string[]>([])
const [orderProductselectRowRecord, setOrderProductSelectRowRecord] = useState<{[key: string]: any}[]>([]);
const [processOrder, setProcessOrder] = useState<GetOrderProcessingOrderListResponseDetail[]>([])
/** ---- 加工订单end ------- */
/**
......@@ -454,26 +498,26 @@ const Create = () => {
}, [])
/** @tofix 有bug */
const handleBeforeOrderChecked = (record: GetOrderProcessingOrderListResponseDetail, checked: boolean, selectedRows: GetOrderProcessingOrderListResponseDetail[]) => {
const { productDateilss, orderNo, id } = record;
const keys = productDateilss.map((_item) => `${_item.orderId}_${_item.id}`);
if (checked) {
let productRow = selectedRows.reduce((prev, current) => {
const { productDateilss, orderNo } = current;
const withOrderNo = productDateilss.map((_row) => ({..._row, orderNo}))
const result = prev.concat(withOrderNo)
return result
}, [])
/** 处理重复值 */
const orderProductKeys = productRow.map((_item) => `${_item.orderId}_${_item.id}`);
const keys = Array.from(new Set(orderProductSelectRowKeys.concat(orderProductKeys)));
const filterSameKeys = productRow.filter((_row) => !keys.includes(`${_row.orderId}_${_row.id}`));
setOrderProductSelectRowKeys(orderProductKeys);
setOrderProductSelectRowRecord((prev) => prev.concat(filterSameKeys))
const uniqueKeys = Array.from(new Set(orderProductSelectRowKeys.concat(keys)))
const uniqueList = orderProductselectRowRecord.concat(
productDateilss.map((_item) => {
return {
orderNo: orderNo,
..._item,
}
})
)
setOrderProductSelectRowKeys(uniqueKeys);
setOrderProductSelectRowRecord(uniqueList)
setProcessOrder((prev) => prev.concat(record))
} else {
const { productDateilss, orderNo } = record;
const removeKeys = productDateilss.map((_item) => `${_item.orderId}_${_item.id}`);
setOrderProductSelectRowKeys((prev) => prev.filter((_row) => !removeKeys.includes(_row)));
setOrderProductSelectRowRecord((prev) => prev.filter((_row) => !removeKeys.includes(`${_row.orderId}_${_row.id}`)))
setOrderProductSelectRowKeys((prev) => prev.filter((_row) => !keys.includes(_row)));
setOrderProductSelectRowRecord((prev) => prev.filter((_row) => !keys.includes(`${_row.orderId}_${_row.id}`)))
setProcessOrder((prev) => prev.filter((_item) => _item.id !== id))
}
return true;
......@@ -481,7 +525,6 @@ const Create = () => {
const tiggerProcessOrderProductOk = () => {
// const productOrderList = orderProductselectRowRecord.
const orderList = formActions.getFieldValue('detail.layout1.orderList');
console.info(orderProductselectRowRecord, orderList)
const uniqueIdList = new Set(orderList.map((_item) => `${_item.orderId}_${_item.id}`));
/** 获取新增数列 */
const newAddList = orderProductselectRowRecord
......@@ -504,26 +547,23 @@ const Create = () => {
}
});
const selectRowId = new Set(orderProductselectRowRecord.map((_item) => `${_item.orderId}__${_item.id}`));
const selectRowId = new Set(orderProductselectRowRecord.map((_item) => `${_item.orderId}_${_item.id}`));
// 过滤减少项
const hasRemoveListRes = []
orderList.forEach((_item) => {
if(selectRowId.has(_item.skuid)) {
if(selectRowId.has(`${_item.orderId}_${_item.id}`)) {
hasRemoveListRes.push(_item)
}
})
const newDataSource = hasRemoveListRes.concat(newAddList);
formActions.setFieldValue('detail.layout1.orderList', newDataSource);
// setProcessProduct(newDataSource.map((_item) => ({ ..._item, id: _item.skuid})))
processOrderToggle(false);
}
/** ------- 加工订单相关end------- */
const onSubmit = (value) => {
const onSubmit = (value: any) => {
console.log(value)
}
......@@ -659,7 +699,7 @@ const Create = () => {
}}
mode={"checkbox"}
beforeChecked={handleBeforeOrderChecked}
value={processProduct}
value={processOrder}
/>
<ProductDrawer
visible={productDrawerVisible}
......
......@@ -26,7 +26,7 @@ const KEY_TITLE = {
// 5、开票管理:判断当前用户是否有开票管理权限,有则显示开票管理按钮与图标,点击跳转支付能力-应收账款管理-开票管理
const SettlementCenter: React.FC<Iprops> = () => {
const { loading, responseData, filterEmptyList, isError, ref } = useViewRequest<GetReportMemberHomeGetSettleAccountTallyResponse, any>(PublicApi.getReportMemberHomeGetSettleAccountTally, {})
const { loading, responseData, filterEmptyList, isError, ref, withQueryParams } = useViewRequest<GetReportMemberHomeGetSettleAccountTallyResponse, any>(PublicApi.getReportMemberHomeGetSettleAccountTally, {})
const { hasAbilityFunc, userAuth } = useGetAuth();
const hasAbility = hasAbilityFunc('balance');
......@@ -60,6 +60,26 @@ const SettlementCenter: React.FC<Iprops> = () => {
].filter((_item) => userAuth.urls?.includes(_item.url))
}, [userAuth])
/** @review 就离谱, 搜索状态值拼接到链接上,后端不做交给了前端。坑啊 */
const withParamsList = useMemo(() => {
const status = {
"待对账": "status=1",
"待付款": "status=2",
"待收款": "status=3",
"已完成": "status=4",
}
return {
"platformList": status,
"platformScoreList": status,
"payableList": status,
"receivableList": {
...status,
"待开票": "invoiceStatus=0"
}
}
}, [])
const withSearchStatusData = useMemo(() => withQueryParams(withParamsList), [withQueryParams, withParamsList]);
return (
<Layout
hasAuth={hasAbility}
......@@ -71,7 +91,7 @@ const SettlementCenter: React.FC<Iprops> = () => {
>
<>
<Layout.Tag tagList={tagsList} />
<Layout.StaticsDataList title={KEY_TITLE} dataSource={filterEmptyList} />
<Layout.StaticsDataList title={KEY_TITLE} dataSource={withSearchStatusData} />
</>
</Layout>
)
......
import { getAuth } from "@/utils/auth"
import { useCallback, useMemo } from "react";
import _groupBy from 'lodash/groupBy'
import _sortBy from 'lodash/sortBy'
type AbilityNameType = "orderAbility"
| 'shopAbility'
......@@ -174,6 +174,7 @@ const useGetAuth = () => {
const generateLayoutData = useCallback((authLayouts: string[], isCheckedLayouts: isCheckedLayoutsType[]) => {
const filterNameIsNull = isCheckedLayouts.filter((_item) => _item.name !== null);
const res = collection2Obj(filterNameIsNull, "name");
const newLayoutData = authLayouts.map((_item, index) => {
const target: isCheckedLayoutsType = res[_item] || ({});
return {
......@@ -184,7 +185,8 @@ const useGetAuth = () => {
isShow: target?.id ? true : false,
}
})
return newLayoutData
// console.log(newLayoutData);
return _sortBy(newLayoutData, "sort");
}, [])
return {
......
......@@ -72,7 +72,28 @@ function useViewRequest<T, P>(fn: (postData: P) => Promise<ResponseDataType & {
const isEmpty = useMemo(() => {
return filterEmptyList && Object.keys(filterEmptyList).length === 0;
}, [filterEmptyList])
return { loading, isError, ref, hasRequest, refresh, responseData, filterEmptyList, inViewPort, isEmpty } as const
const withQueryParams = useCallback((withParamsList: { [key: string]: { [name: string]: string } }) => {
const newData = {...filterEmptyList}
Object.keys(withParamsList).forEach((_item) => {
const target = newData?.[_item];
if (target) {
newData[_item] = target.map((_row) => {
if (withParamsList?.[_item]?.[_row.name]) {
return {
..._row,
link: `${_row.link}?${withParamsList[_item][_row.name]}`
}
}
return _row;
})
}
})
return newData
}, [filterEmptyList])
return { loading, isError, ref, hasRequest, refresh, responseData, filterEmptyList, inViewPort, isEmpty, withQueryParams } as const
}
export default useViewRequest
......@@ -29,12 +29,12 @@ export const evaluateAddSchema: ISchema = {
},
properties: {
subject: {
title: '修改主题',
title: '考评主题',
type: 'string',
'x-rules': [
{
required: true,
message: '请填写修改主题'
message: '请填写考评主题'
},
{
limitByte: true, // 自定义校验规则
......
......@@ -19,10 +19,10 @@ import StatusTag from '@/components/StatusTag';
import { PublicApi } from '@/services/api';
import useSpliceArray from '@/hooks/useSpliceArray';
import { querySchema } from './schema';
import {
MEMBER_STATUS_TAG_MAP,
MEMBER_INNER_STATUS_BADGE_COLOR,
MEMBER_OUTER_STATUS_TYPE,
import {
MEMBER_STATUS_TAG_MAP,
MEMBER_INNER_STATUS_BADGE_COLOR,
MEMBER_OUTER_STATUS_TYPE,
} from '../constant';
import styles from './index.less';
......@@ -39,7 +39,7 @@ const fetchData = async (params: any) => {
payload.endDate = moment(+endDate).format('YYYY-MM-DD');
}
const res = await PublicApi.getMemberAbilityMaintenancePage(payload);
if (res.code === 1000) {
return res.data;
}
......@@ -125,7 +125,7 @@ const MemberMaintain: React.FC<[]> = () => {
<>
{record.showFreeze && (
<Link to={`/memberCenter/memberAbility/manage/maintain/freeze?validateId=${record.validateId}`}>
<Button
<Button
type="link"
>
冻结
......@@ -134,7 +134,7 @@ const MemberMaintain: React.FC<[]> = () => {
)}
{record.showUnfreeze && (
<Link to={`/memberCenter/memberAbility/manage/maintain/unfreeze?validateId=${record.validateId}`}>
<Button
<Button
type="link"
>
解冻
......@@ -142,8 +142,8 @@ const MemberMaintain: React.FC<[]> = () => {
</Link>
)}
{record.showCorrect && (
<Link to={`/memberCenter/memberAbility/memberRectification/rectificationAdd/add?validateId=${record.validateId}`}>
<Button
<Link to={`/memberCenter/memberAbility/memberRectification/rectificationAdd/add?name=${record.name}&memberId=${record.memberId}&roleId=${record.roleId}`}>
<Button
type="link"
>
整改
......@@ -152,7 +152,7 @@ const MemberMaintain: React.FC<[]> = () => {
)}
{record.showEliminate && (
<Link to={`/memberCenter/memberAbility/manage/maintain/eliminate?validateId=${record.validateId}`}>
<Button
<Button
type="link"
>
淘汰
......@@ -161,7 +161,7 @@ const MemberMaintain: React.FC<[]> = () => {
)}
{record.showBlacklist && (
<Link to={`/memberCenter/memberAbility/manage/maintain/black?validateId=${record.validateId}`}>
<Button
<Button
type="link"
>
黑名单
......@@ -181,20 +181,20 @@ const MemberMaintain: React.FC<[]> = () => {
if (res.code === 1000) {
const { data = {} }: any = res;
const {
innerStatus = [],
outerStatus = [],
status = [],
memberTypes = [],
roles = [],
levels = [],
sources = [],
const {
innerStatus = [],
outerStatus = [],
status = [],
memberTypes = [],
roles = [],
levels = [],
sources = [],
} = data;
const statusIndex = columns.findIndex((item) => item.dataIndex === 'statusName');
const outerIndex = columns.findIndex((item) => item.dataIndex === 'outerStatusName');
const innerIndex = columns.findIndex((item) => item.dataIndex === 'innerStatusName');
if (statusIndex) {
columnsHandle.replace(statusIndex, {
...columns[statusIndex],
......@@ -218,10 +218,10 @@ const MemberMaintain: React.FC<[]> = () => {
memberTypeId: memberTypes.map(item => ({ label: item.memberTypeName, value: item.memberTypeId })),
roleId: roles.map(item => ({ label: item.roleName, value: item.roleId })),
level: levels.map(item => ({ label: item.levelTag, value: item.level })),
source: sources.map(item => ({ label: item.text, value: item.id })),
innerStatus: innerStatus.map(item => ({ label: item.text, value: item.id })),
outerStatus: outerStatus.map(item => ({ label: item.text, value: item.id })),
status: status.map(item => ({ label: item.text, value: item.id })),
source: sources.map(item => ({ label: item.text, value: item.id })),
innerStatus: innerStatus.map(item => ({ label: item.text, value: item.id })),
outerStatus: outerStatus.map(item => ({ label: item.text, value: item.id })),
status: status.map(item => ({ label: item.text, value: item.id })),
};
}
return {};
......
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