Commit 8e53c628 authored by 前端-黄佳鑫's avatar 前端-黄佳鑫

Merge branch 'dev-srm' of http://10.0.0.22:3000/lingxi/lingxi-business-paltform into dev-srm

parents ba38a461 a831cc6d
......@@ -24,12 +24,13 @@ const Search = props => {
const justifyAlign = align || 'flex-end';
const changeFilterVisible = () => {
if (state.filterSearch) {
props.form.reset({
// 清除FILTER_PARAMS下所有字段
selector: `*.${FORM_FILTER_PATH}.*`,
});
}
/** 隐藏的时候没必要清除, 隐藏下 提交值默认为undefined, 这里如果对niceForm下做初始值的时候,隐藏了即重置了高级筛选下的字段会把初始值也去掉了 */
// if (state.filterSearch) {
// props.form.reset({
// // 清除FILTER_PARAMS下所有字段
// selector: `*.${FORM_FILTER_PATH}.*`,
// });
// }
setState({
filterSearch: !state.filterSearch,
});
......
......@@ -16,7 +16,7 @@ const useSetSearchValueInTable = () => {
return {}
}
return {
initialValues: cacheData
value: cacheData
}
}, [cacheData])
......@@ -24,8 +24,6 @@ const useSetSearchValueInTable = () => {
setSearchData(null);
}, [])
return {
searchData: cacheData,
formatInitialValue,
......
......@@ -59,7 +59,6 @@ const SettlementList = () => {
...searchParams,
status: searchParams.status || '0',
orderType: searchParams.orderType || '0',
}
const { data } = await PublicApi.getSettleAccountsMemberSettlementPagePayableSettlement(postData);
return data
......
......@@ -22,6 +22,7 @@ import Voucher from '../../components/Voucher';
import ConfirmAccount from '../../components/ConfirmAccount';
import { usePageStatus } from '@/hooks/usePageStatus';
import useSetSearchValueInTable from '@/hooks/useSetSearchValueInTable';
import { Moment } from 'moment';
const { RangePicker } = DatePicker;
......@@ -30,8 +31,8 @@ const formActions = createFormActions();
type requestDataType = {
status: number,
orderType: string | number,
startTime: string,
endTime: string,
startTime?: Moment,
endTime?: Moment,
settlementName: string,
payName: string,
settlementNo: number,
......@@ -41,18 +42,21 @@ type requestDataType = {
const SettlementList = () => {
const ref = useRef<any>({})
const { searchData, formatInitialValue } = useSetSearchValueInTable();
const { searchData, formatInitialValue, clear } = useSetSearchValueInTable();
const [files, setFiles] = useState<any>([]);
const { columns, confirmPayInfo, confirmPayVisible, reconciliationInfo, reconciliationVisible, viewVisible, payVoucherInfo, viewModalonCancel, confirmPayOnCancel, reconciliationOnCancel } = useFetchColumns("receiveable")
const fetchListData = async (params: requestDataType) => {
const searchParams = {
...params,
orderType: params.orderType || '0',
status: params.status || '0',
...searchData,
...params,
}
const { data } = await PublicApi.getSettleAccountsMemberSettlementPageReceivableSettlement(searchParams as any);
const postData = {
...searchParams,
status: searchParams.status || '0',
orderType: searchParams.orderType || '0',
}
const { data } = await PublicApi.getSettleAccountsMemberSettlementPageReceivableSettlement(postData as any);
return data
}
......@@ -93,7 +97,7 @@ const SettlementList = () => {
/**
* 搜索
*/
const handleSearch = (values: any) => {
const handleSearch = (values: requestDataType) => {
const format = 'YYYY-MM-DD'
const startTime = values.startTime?.format(format);
const endTime = values.endTime ? values.endTime.endOf("day").format('YYYY-MM-DD HH:mm:ss') : "";
......@@ -129,6 +133,9 @@ const SettlementList = () => {
}}
schema={schema}
onSubmit={handleSearch}
onReset={() => {
clear()
}}
{...formatInitialValue}
/>
}
......
......@@ -27,6 +27,7 @@ import useFetchColumns from '../../hooks/useFetchColumns';
import { STATUS_TEXT } from '@/constants/balance';
import { numFormat, priceFormat } from '@/utils/numberFomat';
import useSetSearchValueInTable from '@/hooks/useSetSearchValueInTable';
import { GetSettleAccountsPlatformSettlementPageReceivableSettlementRequest } from '@/services/SettleV2Api';
const formActions = createFormActions();
const { RangePicker } = DatePicker;
......@@ -103,11 +104,14 @@ const AccountReceivable = () => {
const { retColumn } = useIsExistBrokerage(columns, ["brokerage"]);
const fetchListData = async (params) => {
const postData = {
const fetchListData = async (params: GetSettleAccountsPlatformSettlementPageReceivableSettlementRequest) => {
const searchParams = {
...searchData,
...params,
status: params.status || 0,
...searchData
}
const postData = {
...searchParams,
status: searchParams.status || '0',
}
const { data } = await PublicApi.getSettleAccountsPlatformSettlementPageReceivableSettlement(postData);
return data
......
......@@ -25,6 +25,7 @@ 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';
import { GetSettleAccountsPlatformScoreSettlementPageReceivableSettlementRequest } from '@/services/SettleV2Api';
const formActions = createFormActions();
const Integral: React.FC = () => {
......@@ -44,7 +45,7 @@ const Integral: React.FC = () => {
handleViewPayModal
} = useFetchColumns("receiveable");
const [files, setFiles] = useState([]);
const { searchData, formatInitialValue } = useSetSearchValueInTable();
const { searchData, formatInitialValue, clear } = useSetSearchValueInTable();
const columns = [
{
......@@ -101,11 +102,14 @@ const Integral: React.FC = () => {
}
]
const fetchListData = async (params) => {
const postData = {
...params,
status: params.status || 0,
const fetchListData = async (params: GetSettleAccountsPlatformScoreSettlementPageReceivableSettlementRequest) => {
const searchParams = {
...searchData,
...params,
}
const postData = {
...searchParams,
status: searchParams.status || '0',
}
// /settle/accounts/platform/score/settlement/pageReceivableSettlement
const { data } = await PublicApi.getSettleAccountsPlatformScoreSettlementPageReceivableSettlement(postData);
......@@ -114,7 +118,6 @@ const Integral: React.FC = () => {
/**
* 确认对账
* @param {cancel: function, id: number} cancel 为关闭回调函数
*/
const handleConfirm = async (params: {id: number}) => {
const { code } = await PublicApi.postSettleAccountsPlatformScoreSettlementConfirmAccountComplete({settlementId: params.id})
......@@ -182,8 +185,9 @@ const Integral: React.FC = () => {
schema={schema}
onSubmit={handleSearch}
onReset={() => {
formActions.setFieldValue('startTime', null);
formActions.setFieldValue('endTime', null);
clear()
// formActions.setFieldValue('startTime', null);
// formActions.setFieldValue('endTime', null);
}}
{...formatInitialValue}
/>
......
import React, { useState, useEffect, useRef, ReactNode } from 'react'
import React, { useState, useEffect, useRef, ReactNode, useMemo } from 'react'
import { history } from 'umi'
import { Button, Form, Card, Modal, Result, Progress, Select, Tooltip, Checkbox, Row, Col, Dropdown, Input, Menu, Space, message, InputNumber } from 'antd'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
......@@ -24,6 +24,7 @@ import NiceForm from '@/components/NiceForm'
import { createFormActions, FormEffectHooks } from '@formily/antd'
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch'
import { searchBrandOptionEffect, searchCustomerCategoryOptionEffect } from './effect'
import useSetSearchValueInTable from '@/hooks/useSetSearchValueInTable'
const { Option } = Select;
const { confirm } = Modal;
......@@ -62,6 +63,21 @@ const Products: React.FC<{}> = () => {
const [isDisabledOKbtn, setIsDisabledOKbtn] = useState<boolean>(false)
const [shopId, setShopId] = useState<any>()
/** 带参数查询,给表单带默认值 */
const { searchData, formatInitialValue, clear } = useSetSearchValueInTable();
const formatedFormValue = useMemo(() => {
const value = formatInitialValue?.value || {};
if (value && "statusList" in value) {
return {
value: {
...value,
statusList: +value.statusList
}
}
}
return value
}, [formatInitialValue])
const columns: ColumnType<any>[] = [
{
......@@ -237,8 +253,16 @@ const Products: React.FC<{}> = () => {
}
const fetchData = (params: any) => {
const searchParams = {
...searchData,
...params,
}
const postData = {
...searchParams,
statusList: searchParams?.statusList || '',
}
return new Promise((resolve, reject) => {
PublicApi.getProductCommodityGetCommodityList(params).then(res => {
PublicApi.getProductCommodityGetCommodityList(postData).then(res => {
const { data } = res
resolve(data)
})
......@@ -600,6 +624,10 @@ const Products: React.FC<{}> = () => {
})
}}
schema={productSchema}
{ ...formatedFormValue }
onReset={() => {
clear()
}}
/>
}
/>
......
......@@ -21,7 +21,7 @@ const ADD_REPOSITORIES = '/memberCenter/commodityAbility/repositories/add';
// 3、设置库存:判断当前用户是否有仓位库存管理权限,有则显示设置库存按钮,点击跳转能力中心-商品能力-仓位管理--新增仓位库存
const ProductCenter: React.FC<Iprops> = () => {
const { loading, responseData, isError, ref } = useViewRequest<GetReportMemberHomeGetCommodityTallyResponse, any>(PublicApi.getReportMemberHomeGetCommodityTally, {})
const { loading, responseData, isError, ref, withQueryParams } = useViewRequest<GetReportMemberHomeGetCommodityTallyResponse, any>(PublicApi.getReportMemberHomeGetCommodityTally, {})
const { userAuth, hasAbilityFunc } = useGetAuth();
const hasAbility = hasAbilityFunc('commodityAbility');
......@@ -39,6 +39,30 @@ const ProductCenter: React.FC<Iprops> = () => {
authUrl: ADD_REPOSITORIES
},
], [])
/** @review 就离谱, 搜索状态值拼接到链接上,后端不做交给了前端。坑啊 */
const withParamsList = useMemo(() => {
const status = {
"商品总数": "",
"品牌总数": "",
"待提交审核商品": "statusList=1",
"待上架商品": "statusList=2",
"待提交审核品牌": "status=1",
}
return status
}, [])
const formatDataWithLink = useMemo(() => {
// const newData = [...responseData];
const newData = responseData?.map((_item) => {
return {
..._item,
link: `${_item.link}?${withParamsList[_item.name]}`
}
})
return newData
}, [responseData, withParamsList])
return (
<Layout
hasAuth={hasAbility}
......@@ -70,7 +94,7 @@ const ProductCenter: React.FC<Iprops> = () => {
<span className={styles.rowTitle}>商品</span>
<div className={styles.rowValues}>
{
responseData && responseData.map((item: GetReportMemberHomeGetCommodityTallyResponse[0], key) => {
formatDataWithLink?.map((item: GetReportMemberHomeGetCommodityTallyResponse[0], key) => {
return (
<div className={styles.wrapCol} key={key}>
<div className={styles.colTitle}>{item.name}</div>
......
......@@ -73,6 +73,8 @@ function useViewRequest<T, P>(fn: (postData: P) => Promise<ResponseDataType & {
return filterEmptyList && Object.keys(filterEmptyList).length === 0;
}, [filterEmptyList])
/** 商品中心不适用, 就不直接兼容了 */
const withQueryParams = useCallback((withParamsList: { [key: string]: { [name: string]: string } }) => {
const newData = {...filterEmptyList}
Object.keys(withParamsList).forEach((_item) => {
......
import React, { useEffect, useMemo, useState } from 'react';
import { Card, Button } from 'antd';
import { Card, Button, message } from 'antd';
import { history } from 'umi';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { LinkOutlined, PlusOutlined, SaveOutlined } from '@ant-design/icons';
......@@ -98,8 +98,11 @@ const EvaluateAdd = (props) => {
const onSubmit = async (values: SubmitDataType) => {
const { items, appraisalDayStart, appraisalDayEnd, attachments, selectedProject, verifySteps, history: anyHistory, currentStep, ...rest } = values
// 计算权重
let totalScoreWeight = 0
const projectList = items.map((_item) => {
const { sendAppraisal, memberName, score, templates, reports, type, ...otherProps } = _item;
totalScoreWeight += +_item.scoreWeight;
return {
userId: _item.memberName.userId,
userName: _item.memberName.name,
......@@ -116,6 +119,10 @@ const EvaluateAdd = (props) => {
...otherProps
}
})
if (totalScoreWeight > 100) {
message.error(`添加的评估项目的权重和为${totalScoreWeight}, 大于100, 请修改`);
return
}
const tempPostData = {
...rest,
......@@ -186,7 +193,6 @@ const EvaluateAdd = (props) => {
})) || []
// const withProjectId = new Set(tempData.map((_item) => _item.id));
const dataSource = formActions.getFieldValue('tabs.tab-2.items') || [];
console.log("dataSource", dataSource);
// 对比两个数据, 如果dataSource 中 有 tempData 的值, 那么保留,如果没有择去除(没有id项)
const dataSourceKey = new Set(Array.from(dataSource?.map((_item) => _item.type)).filter(Boolean));
// 获取新增组
......@@ -215,9 +221,10 @@ const EvaluateAdd = (props) => {
const numberIndex = FormPath.transform(name, /\d/, $1 => {
return `${$1}`
});
const scoreWeight = formActions.getFieldValue(`items.${numberIndex}.grade`) || 0
const grade = formActions.getFieldValue(`items.${numberIndex}.scoreWeight`) || 0;
formActions.setFieldValue(`items.${numberIndex}.score`, scoreWeight * grade / 100);
const scoreWeight = formActions.getFieldValue(`items.${numberIndex}.scoreWeight`) || 0
const grade = formActions.getFieldValue(`items.${numberIndex}.grade`) || 0;
console.log(scoreWeight)
formActions.setFieldValue(`items.${numberIndex}.score`, +scoreWeight !== 0 ? scoreWeight * grade / 100 : grade);
})
}
......@@ -261,7 +268,6 @@ const EvaluateAdd = (props) => {
type: _row.type,
}
})
console.log(itmesList)
return {
appraisalDayStart: moment(appraisalDayEnd, 'YYYY-MM-DD'),
appraisalDayEnd: moment(appraisalDayEnd, 'YYYY-MM-DD'),
......
......@@ -92,9 +92,8 @@ export const evaluateAddSchema: ISchema = {
},
attachments: {
title: '附件',
type: 'object',
type: 'array',
'x-component': 'FormilyUploadFiles',
required: true,
}
}
}
......
......@@ -39,7 +39,7 @@ const BasicInfo: React.FC<IBasicInfo> = ({ title }) => {
span: 8,
fieldList: [
{ title: '招标项目:', name: 'projectName' },
{ title: '项目预算:', name: 'budget' },
{ title: '项目预算:', name: 'budget', render: (t) => `¥${t}` },
{ title: '采购类型:', name: 'purchaseType', render: (text) => PURCHASE_TYPE[text] },
{ title: '招标会员:', name: 'memberName' },
]
......
......@@ -39,7 +39,7 @@ const BasicInfo: React.FC<IBasicInfo> = ({ title }) => {
span: 8,
fieldList: [
{ title: '招标项目:', name: 'projectName' },
{ title: '项目预算:', name: 'budget' },
{ title: '项目预算:', name: 'budget', render: (t) => `¥${t}` },
{ title: '采购类型:', name: 'purchaseType', render: (text) => PURCHASE_TYPE[text] },
{ title: '招标会员:', name: 'memberName' },
]
......
......@@ -39,7 +39,7 @@ const BasicInfo: React.FC<IBasicInfo> = ({ title }) => {
span: 8,
fieldList: [
{ title: '招标项目:', name: 'projectName' },
{ title: '项目预算:', name: 'budget' },
{ title: '项目预算:', name: 'budget', render: (t) => `¥${t}` },
{ title: '采购类型:', name: 'purchaseType', render: (text) => PURCHASE_TYPE[text] },
{ title: '招标会员:', name: 'memberName' },
]
......
......@@ -39,7 +39,7 @@ const BasicInfo: React.FC<IBasicInfo> = ({ title }) => {
span: 8,
fieldList: [
{ title: '招标项目:', name: 'projectName' },
{ title: '项目预算:', name: 'budget' },
{ title: '项目预算:', name: 'budget', render: (t) => `¥${t}` },
{ title: '采购类型:', name: 'purchaseType', render: (text) => PURCHASE_TYPE[text] },
{ title: '招标会员:', name: 'memberName' },
]
......
......@@ -57,7 +57,7 @@ const DescriptionsInfo: React.FC<BasicInfoProps> = ({cardTitle, type}) => {
span: 8,
fieldList: [
{ title: '招标项目:', name: 'projectName' },
{ title: '项目预算:', name: 'budget' },
{ title: '项目预算:', name: 'budget', render: (t) => `¥${t}` },
{ title: '采购类型:', name: 'purchaseType', render: (text) => PURCHASE_TYPE[text] },
{ title: '招标会员:', name: 'memberName' },
{ title: '招标摘要:', name: 'remark' },
......@@ -157,7 +157,7 @@ const DescriptionsInfo: React.FC<BasicInfoProps> = ({cardTitle, type}) => {
span: 8,
fieldList: [
{ title: '期望交付日期:', name: 'hopeDate', render: (text) => formatTimeString(text) },
{ title: '目标价:', name: 'targetPrice' },
{ title: '目标价:', name: 'targetPrice', render: (t) => `¥${t}` },
]
},
{
......@@ -440,8 +440,8 @@ const DescriptionsInfo: React.FC<BasicInfoProps> = ({cardTitle, type}) => {
/** 类型数据映射 */
const Type_Data_Map = {
// 当详情模式为投标详情并且投标外部状态投完标才有对应的投标基本信息显示
'basicInfo': apiType[apiType.length-1] === 'r' ? basicTenderColumnList : basicColumnList,
// 招标大类显示招标信息 投标大类显示投标信息
'basicInfo': apiType[0] === 'c' ? basicColumnList : basicTenderColumnList,
'bidNeed': callForNeedList,
'registerNeed': registerNeedList,
'checkNeed': checkNeedList,
......
......@@ -115,6 +115,9 @@ export const formSchema: ISchema = {
type: 'string',
title: '目标价',
readOnly: true,
'x-component-props': {
addonBefore: "¥",
},
},
inviteTenderRequirement: {
type: 'string',
......
import React, { ReactNode, useRef, useEffect } from 'react'
import React, { ReactNode, useRef, useEffect, useMemo } from 'react'
import { history } from 'umi'
import { Button, Popconfirm, Card, message, Dropdown, Menu, Modal, Space } from 'antd'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
......@@ -19,6 +19,7 @@ import { createFormActions } from '@formily/antd'
import { FORM_FILTER_PATH } from '@/formSchema/const'
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch'
import Submit from '@/components/NiceForm/components/Submit'
import useSetSearchValueInTable from '@/hooks/useSetSearchValueInTable'
const { confirm } = Modal
......@@ -26,10 +27,34 @@ const formActions = createFormActions();
const Trademark: React.FC<{}> = () => {
const ref = useRef<any>({})
/** 带参数查询,给表单带默认值 */
const { searchData, formatInitialValue, clear } = useSetSearchValueInTable();
const formatedFormValue = useMemo(() => {
const value = formatInitialValue?.value || {};
if (value && "status" in value) {
return {
value: {
...value,
status: +value.status
}
}
}
return value
}, [formatInitialValue])
const fetchData = (params: any) => {
const searchParams = {
...searchData,
...params,
}
const postData = {
...searchParams,
name: searchParams?.name || '',
status: searchParams?.status || 0,
}
return new Promise((resolve, reject) => {
PublicApi.getProductBrandGetBrandList({ ...params, name: params.name || '', status: params.status || 0 }).then(res => {
PublicApi.getProductBrandGetBrandList(postData).then(res => {
const { data } = res
resolve(data)
})
......@@ -286,6 +311,10 @@ const Trademark: React.FC<{}> = () => {
}
}}
onSubmit={values => ref.current.reload(values)}
onReset={() => {
clear()
}}
{...formatedFormValue}
/>
}
......
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