Commit 1a8ff635 authored by 前端-许佳敏's avatar 前端-许佳敏

merge: 合并标品0518分支

parents 1af000c8 6478b4d6
...@@ -38,6 +38,24 @@ const homeRoute = { ...@@ -38,6 +38,24 @@ const homeRoute = {
component: '@/pages/home', component: '@/pages/home',
}; };
const indexComRoute = {
path: `/memberCenter/formView`,
icon: 'home',
name: '表单能力',
routes: [
{
path: `/memberCenter/formView/form`,
name: '表单预览',
component: '@/pages/formView/form',
},
{
path: `/memberCenter/formView/formDesign`,
name: '表单设计',
component: '@/pages/formView/formDesign',
}
]
}
const srmPurchaserHomeRoute = { const srmPurchaserHomeRoute = {
path: `/memberCenter/srmPurchaserHome`, path: `/memberCenter/srmPurchaserHome`,
name: 'srmPurchaserHome', name: 'srmPurchaserHome',
...@@ -48,7 +66,7 @@ const srmPurchaserHomeRoute = { ...@@ -48,7 +66,7 @@ const srmPurchaserHomeRoute = {
// isDev ? [ homeRoute, OrderRoute ] : // isDev ? [ homeRoute, OrderRoute ] :
// const routes = asyncRoutes; // const routes = asyncRoutes;
const routes = isDev ? [ homeRoute, contracRoute, CommodityRoute] : asyncRoutes; const routes = isDev ? [homeRoute, indexComRoute, contracRoute, CommodityRoute] : asyncRoutes;
const memberCenterRoute = { const memberCenterRoute = {
path: '/memberCenter', path: '/memberCenter',
...@@ -102,6 +120,7 @@ const memberCenterRoute = { ...@@ -102,6 +120,7 @@ const memberCenterRoute = {
// marketingRoute, // marketingRoute,
// DealAbilityRoute, // DealAbilityRoute,
// ...asyncRoutes, // ...asyncRoutes,
// indexComRoute,
...routes, ...routes,
{ {
path: '/memberCenter/noAuth', path: '/memberCenter/noAuth',
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
}, },
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@linkseeks/designable-component": "1.0.0",
"@ant-design/icons": "^4.2.1", "@ant-design/icons": "^4.2.1",
"@ant-design/pro-layout": "^5.0.16", "@ant-design/pro-layout": "^5.0.16",
"@antv/data-set": "^0.11.5", "@antv/data-set": "^0.11.5",
......
...@@ -1213,4 +1213,5 @@ export default { ...@@ -1213,4 +1213,5 @@ export default {
'commodity.products.xuanzexiayouxiaoshoushangpin': '选择下游销售商品', 'commodity.products.xuanzexiayouxiaoshoushangpin': '选择下游销售商品',
'commodity.addProduct.productAttributeForm.addAttribute.error1': '最多输入12个字符,6个汉字', 'commodity.addProduct.productAttributeForm.addAttribute.error1': '最多输入12个字符,6个汉字',
'commodity.kucun': '库存',
} }
...@@ -211,8 +211,9 @@ const ReturnInfoDrawer: React.FC<ReturnInfoDrawerProps> = ({ ...@@ -211,8 +211,9 @@ const ReturnInfoDrawer: React.FC<ReturnInfoDrawerProps> = ({
orderId: `${applyInfo.orderId}`, orderId: `${applyInfo.orderId}`,
}); });
if (res.code === 1000) { if (res.code === 1000) {
payList = res.data.map((item) => { payList = res.data.map((item, index) => {
const payRatio = +(new BigNumber(item.payRate).multipliedBy(100)).toFixed(2); const payRatio = +(new BigNumber(item.payRate).multipliedBy(100)).toFixed(2);
const current = payList[index];
return { return {
payId: item.paymentId, payId: item.paymentId,
payCount: item.batchNo, payCount: item.batchNo,
...@@ -223,7 +224,7 @@ const ReturnInfoDrawer: React.FC<ReturnInfoDrawerProps> = ({ ...@@ -223,7 +224,7 @@ const ReturnInfoDrawer: React.FC<ReturnInfoDrawerProps> = ({
payWayName: item.payTypeName, payWayName: item.payTypeName,
channel: item.payChannel, channel: item.payChannel,
channelName: item.payChannelName, channelName: item.payChannelName,
refundAmount: +(new BigNumber(+applyInfo.remaining).multipliedBy(applyInfo.purchasePrice).multipliedBy(item.payRate)).toFixed(2), refundAmount: current?.refundAmount ? current?.refundAmount : +(new BigNumber(+applyInfo.remaining).multipliedBy(applyInfo.purchasePrice).multipliedBy(item.payRate)).toFixed(2),
payTime: item.payTime, payTime: item.payTime,
payRuleId: item.fundMode, payRuleId: item.fundMode,
externalState: 3, // 这个状态写死了,因为现在只有付款了才会出现这条支付信息 externalState: 3, // 这个状态写死了,因为现在只有付款了才会出现这条支付信息
......
import { getIntl } from 'umi'; import { getIntl } from 'umi';
import { ISchema } from '@formily/antd'; import { ISchema } from '@formily/antd';
import { FORM_FILTER_PATH } from '@/formSchema/const'; import { FORM_FILTER_PATH } from '@/formSchema/const';
import { useCallback } from 'react';
import { isEmpty } from 'lodash';
const intl = getIntl(); const intl = getIntl();
type Options = { type Options = {
showStatus: boolean showStatus: boolean,
attributeValueList?: any
} }
export const getSchema = (options: Options) => { export const getSchema = (options: Options) => {
console.log(options.attributeValueList, 'attributeValueList')
const schema: ISchema = { const schema: ISchema = {
type: 'object', type: 'object',
properties: { properties: {
...@@ -49,26 +53,26 @@ export const getSchema = (options: Options) => { ...@@ -49,26 +53,26 @@ export const getSchema = (options: Options) => {
type: 'string', type: 'string',
'x-component-props': { 'x-component-props': {
placeholder: intl.formatMessage({ id: 'material.name', defaultMessage: '物料名称' }), placeholder: intl.formatMessage({ id: 'material.name', defaultMessage: '物料名称' }),
allowClear: true, allowClear: true,
}, },
}, },
materialGroupId: { materialGroupId: {
type: 'string', type: 'string',
'x-component': 'Cascader', 'x-component': 'Cascader',
'x-component-props': { 'x-component-props': {
placeholder: intl.formatMessage({ id: 'material.group.title', defaultMessage: '物料组'}), placeholder: intl.formatMessage({ id: 'material.group.title', defaultMessage: '物料组'}),
allowClear: true, allowClear: true,
fieldNames: { label: 'title', value: 'id', children: 'children' }, fieldNames: { label: 'title', value: 'id', children: 'children' },
style: { width: '150px' }, style: { width: '150px' },
showSearch: true showSearch: true
}, },
}, },
brandId: { brandId: {
type: 'string', type: 'string',
enum: [], enum: [],
'x-component-props': { 'x-component-props': {
placeholder: intl.formatMessage({ id: 'material.brand', defaultMessage: '品牌' }), placeholder: intl.formatMessage({ id: 'material.brand', defaultMessage: '品牌' }),
allowClear: true, allowClear: true,
showSearch: true, showSearch: true,
style: { width: '150px' }, style: { width: '150px' },
}, },
...@@ -78,7 +82,7 @@ export const getSchema = (options: Options) => { ...@@ -78,7 +82,7 @@ export const getSchema = (options: Options) => {
'x-component': 'Cascader', 'x-component': 'Cascader',
'x-component-props': { 'x-component-props': {
placeholder: intl.formatMessage({ id: 'material.category', defaultMessage: '品类' }), placeholder: intl.formatMessage({ id: 'material.category', defaultMessage: '品类' }),
allowClear: true, allowClear: true,
style: { width: '150px' }, style: { width: '150px' },
showSearch: true, showSearch: true,
fieldNames: { label: 'title', value: 'id', children: 'children' }, fieldNames: { label: 'title', value: 'id', children: 'children' },
...@@ -89,10 +93,11 @@ export const getSchema = (options: Options) => { ...@@ -89,10 +93,11 @@ export const getSchema = (options: Options) => {
visible: options.showStatus, visible: options.showStatus,
'x-component-props': { 'x-component-props': {
placeholder: intl.formatMessage({ id: 'material.interiorStateName', defaultMessage: '内部状态' }), placeholder: intl.formatMessage({ id: 'material.interiorStateName', defaultMessage: '内部状态' }),
allowClear: true, allowClear: true,
enum: [], enum: [],
}, },
}, },
...(!isEmpty(options.attributeValueList) && options.attributeValueList),
submit: { submit: {
'x-component': 'Submit', 'x-component': 'Submit',
'x-mega-props': { 'x-mega-props': {
......
...@@ -595,7 +595,8 @@ const MaterialAdd: React.FC<IProps> = (props) => { ...@@ -595,7 +595,8 @@ const MaterialAdd: React.FC<IProps> = (props) => {
value: `${_row.id}-${_row.value}` value: `${_row.id}-${_row.value}`
})) }))
} }
const withRequire = !isEmpty // 有歧义,品类那边弄反了
const withRequire = isEmpty
? { ? {
'x-rules': [ 'x-rules': [
{ {
......
...@@ -123,6 +123,44 @@ export const getSchema = (schema: ISchema | null): ISchema => { ...@@ -123,6 +123,44 @@ export const getSchema = (schema: ISchema | null): ISchema => {
} }
] ]
}, },
materialGroup: {
title: intl.formatMessage({ id: 'material.belong.materialGroup', defaultMessage: '所属物料组' }),
type: 'string',
"x-component": 'Cascader',
"x-component-props": {
options: [],
showSearch: true,
fieldNames: { label: 'title', value: 'id', children: 'children' },
},
},
brand: {
title: intl.formatMessage({ id: 'material.brand', defaultMessage: '品牌' }),
type: 'string',
enum: [],
'x-component-props': {
showSearch: true,
},
description: `{{desc()}}`
},
category: {
title: intl.formatMessage({ id: 'material.category', defaultMessage: '品类' }),
"x-component": 'Cascader',
"x-component-props": {
options: [],
showSearch: true,
fieldNames: { label: 'title', value: 'id', children: 'children' },
},
'x-rules': [
{
required: true,
message: intl.formatMessage({ id: 'material.category.required', defaultMessage: '请填写品类' })
},
]
},
remark: {
title: intl.formatMessage({ id: 'material.remark', defaultMessage: '备注'}),
type: 'string',
}
} }
} }
} }
......
import React, { useRef, useState } from 'react'; import React, { useCallback, useRef, useState } from 'react';
import StandardTable from '@/components/StandardTable'; import StandardTable from '@/components/StandardTable';
import { PageHeaderWrapper } from '@ant-design/pro-layout'; import { PageHeaderWrapper } from '@ant-design/pro-layout';
import NiceForm from '@/components/NiceForm'; import NiceForm from '@/components/NiceForm';
...@@ -20,11 +20,124 @@ import { useIntl } from 'umi'; ...@@ -20,11 +20,124 @@ import { useIntl } from 'umi';
import AuthButton from '@/components/AuthButton'; import AuthButton from '@/components/AuthButton';
import { renderMaterialSourceList } from '../common/render-list-auxiliary'; import { renderMaterialSourceList } from '../common/render-list-auxiliary';
type Options = {
item: any,
attributeValueList?: any[],
type?: number,
}
/**
* type: 1: 输入框 2: 单选 3: 多选
*/
const value = [
{
"id": 118,
"name": "功率",
"type": 1,
"attributeValueList": []
},
{
"id": 119,
"name": "颜色",
"type": 3,
"attributeValueList": [
{
"id": 186,
"value": "大红色"
},
{
"id": 187,
"value": "橘黄色"
},
{
"id": 188,
"value": "紫色"
},
{
"id": 189,
"value": "蓝色"
},
{
"id": 190,
"value": "白色"
},
{
"id": 191,
"value": "黑色"
}
]
},
{
"id": 120,
"name": "尺码",
"type": 2,
"attributeValueList": [
{
"id": 192,
"value": "36"
},
{
"id": 193,
"value": "37"
},
{
"id": 194,
"value": "38"
},
{
"id": 195,
"value": "39"
},
{
"id": 196,
"value": "40"
}
]
},
{
"id": 121,
"name": "规格1",
"type": 2,
"attributeValueList": [
{
"id": 178,
"value": "格格"
},
{
"id": 179,
"value": "ttt"
},
{
"id": 180,
"value": "t2"
},
{
"id": 181,
"value": "t3"
},
{
"id": 182,
"value": "t4"
},
{
"id": 183,
"value": "t5"
},
{
"id": 184,
"value": "t6"
},
{
"id": 185,
"value": "t7"
}
]
}]
/** /**
* 物料查询 * 物料查询
*/ */
const formActions = createFormActions(); const formActions = createFormActions();
const querySchema = getSchema({ showStatus: true });
export type SearchParams = Omit<GetProductGoodsGetMaterialListRequest, 'materialGroupId'> & { export type SearchParams = Omit<GetProductGoodsGetMaterialListRequest, 'materialGroupId'> & {
materialGroupId: string[], materialGroupId: string[],
...@@ -49,6 +162,12 @@ const MaterialQuery = () => { ...@@ -49,6 +162,12 @@ const MaterialQuery = () => {
}), }),
} }
}); });
const [attributeValueList, setAttributeValueList] = useState<any>({});
const querySchema = useCallback(() => {
return getSchema({ showStatus: true, attributeValueList })
}, [attributeValueList]);
const handleFrozonOrEnable = async (params: { id: string; interiorState: number }) => { const handleFrozonOrEnable = async (params: { id: string; interiorState: number }) => {
if (params.interiorState === FROZEN) { if (params.interiorState === FROZEN) {
...@@ -240,6 +359,7 @@ const MaterialQuery = () => { ...@@ -240,6 +359,7 @@ const MaterialQuery = () => {
} }
const handleSearch = (values: SearchParams) => { const handleSearch = (values: SearchParams) => {
const { materialGroupId, customerCategoryId, status, ...rest } = values; const { materialGroupId, customerCategoryId, status, ...rest } = values;
const formatMaterialGroupId = materialGroupId && materialGroupId.length > 0 const formatMaterialGroupId = materialGroupId && materialGroupId.length > 0
? { materialGroupId: materialGroupId?.pop() } ? { materialGroupId: materialGroupId?.pop() }
...@@ -274,6 +394,27 @@ const MaterialQuery = () => { ...@@ -274,6 +394,27 @@ const MaterialQuery = () => {
onFrozonOrEnable({ status: 0, goodsId: activeItem.id, freezeReason: value.reason }) onFrozonOrEnable({ status: 0, goodsId: activeItem.id, freezeReason: value.reason })
} }
const attributeValueSchema = (options: Options) => {
return {
[`${options?.item?.id}_${options?.item?.type}`]: {
type: 'string',
...(options?.attributeValueList ? {
enum: options?.attributeValueList.map(item => {
return {
label: item.value,
value: item.id
}
}),
} : null),
'x-component-props': {
placeholder: options?.item?.name,
allowClear: true,
style: { width: '150px' },
},
}
}
}
return ( return (
<PageHeaderWrapper <PageHeaderWrapper
title={intl.formatMessage({ id: 'material.query.title', defaultMessage: '物料查询' })} title={intl.formatMessage({ id: 'material.query.title', defaultMessage: '物料查询' })}
...@@ -291,7 +432,7 @@ const MaterialQuery = () => { ...@@ -291,7 +432,7 @@ const MaterialQuery = () => {
controlRender={ controlRender={
<NiceForm <NiceForm
components={{ controllerBtns, Cascader }} components={{ controllerBtns, Cascader }}
schema={querySchema} schema={querySchema()}
actions={formActions} actions={formActions}
onSubmit={handleSearch} onSubmit={handleSearch}
effects={($, actions) => { effects={($, actions) => {
...@@ -300,6 +441,24 @@ const MaterialQuery = () => { ...@@ -300,6 +441,24 @@ const MaterialQuery = () => {
useAsyncCascader('customerCategoryId', fetchCategoryData) useAsyncCascader('customerCategoryId', fetchCategoryData)
useAsyncSelect('brandId', fetchBrand, ["name", "id"]) useAsyncSelect('brandId', fetchBrand, ["name", "id"])
useAsyncSelect('status', fetchStatus, ["name", "status"]) useAsyncSelect('status', fetchStatus, ["name", "status"])
/** 属性接口在这里调用 */
$('onFieldInputChange', 'customerCategoryId').subscribe(state => {
const attributeValue = {}
value.forEach(_item => {
switch (_item?.type) {
case 2:
Object.assign(attributeValue, attributeValueSchema({ item: _item, type: _item?.type, attributeValueList: _item?.attributeValueList }))
break;
case 3:
Object.assign(attributeValue, attributeValueSchema({ item: _item, type: _item?.type, attributeValueList: _item?.attributeValueList }))
break;
default:
Object.assign(attributeValue, attributeValueSchema({ item: _item, type: _item?.type }))
break;
}
})
setAttributeValueList({...attributeValue})
})
}} }}
/> />
} }
......
...@@ -53,7 +53,7 @@ const FormList = (props: any) => { ...@@ -53,7 +53,7 @@ const FormList = (props: any) => {
//相同物料组合成同一条 //相同物料组合成同一条
const handlePurchaseData = (selectRow)=>{ const handlePurchaseData = (selectRow)=>{
let data = [...selectRow] let data = selectRow
let newArray = data.reduce((total, cur, index) => { let newArray = data.reduce((total, cur, index) => {
let hasValue = total.findIndex(current => { let hasValue = total.findIndex(current => {
return current.productNo === cur.productNo; return current.productNo === cur.productNo;
...@@ -65,8 +65,7 @@ const FormList = (props: any) => { ...@@ -65,8 +65,7 @@ const FormList = (props: any) => {
return total; return total;
}, []); }, []);
newArray.map((item: any, index: number) => {
let newData = newArray.map((item: any, index: number) => {
let num = 0 let num = 0
let prpIdsList = item.prpIds.toString().split(',') let prpIdsList = item.prpIds.toString().split(',')
...@@ -163,9 +162,20 @@ const FormList = (props: any) => { ...@@ -163,9 +162,20 @@ const FormList = (props: any) => {
i.num = i.quantity i.num = i.quantity
i.price = '' i.price = ''
i.prpIds = i.prpId i.prpIds = i.prpId
i.price = ''
return i return i
}) })
setPurchaseData( purchaseData.concat(data) )
let newData = purchaseData
data.map((ii)=>{
if(!purchaseData.some(i=> i.prpId == ii.prpId)) newData.push(ii)
})
setPurchaseData(newData)
resolve({...res.data,data}) resolve({...res.data,data})
} }
}) })
......
import React, { useState } from 'react';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { SchemaForm } from '@linkseeks/designable-component';
const FormLayout = () => {
const normalSchema = {
"type": "object",
"properties": {
"lg14okvuk25": {
"type": "void",
"x-component": "LXCard",
"x-component-props": {
"title": "基本信息",
"layout": 2
},
"x-designable-id": "lg14okvuk25",
"x-index": 0,
"properties": {
"name": {
"type": "string",
"title": "名称",
"x-decorator": "FormItem",
"x-component": "Input",
"x-validator": [],
"x-component-props": {},
"x-decorator-props": {
"colon": false,
"labelAlign": "left"
},
"x-designable-id": "vumg6d2f3d7",
"x-index": 0,
"name": "name",
"description": "",
"required": true
},
"age": {
"type": "string",
"title": "年龄",
"x-decorator": "FormItem",
"x-component": "Input",
"x-validator": [],
"x-component-props": {},
"x-decorator-props": {
"colon": false,
"labelAlign": "left"
},
"x-designable-id": "x63in1if66b",
"x-index": 1,
"name": "age"
}
}
}
},
}
return (
<PageHeaderWrapper>
<SchemaForm schema={normalSchema} />
</PageHeaderWrapper>
)
}
export default FormLayout
import React from 'react';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { Button, Card, Form } from 'antd';
const layout: any = {
colon: false,
labelCol: { style: { width: "144px" } },
labelAlign: "left"
};
const FormDesignLayout = () => {
return (
<PageHeaderWrapper>
<Card>
<Form {...layout}>
<Form.Item label='表单设计'>
<Button href='http://lx-designable.lingxi0518.com/' target='_blank' style={{ color: '#ffffff' }}>进入表单设计</Button>
</Form.Item>
</Form>
</Card>
</PageHeaderWrapper>
)
}
export default FormDesignLayout
...@@ -92,6 +92,9 @@ const List: React.FC<Iprops> = (props: Iprops) => { ...@@ -92,6 +92,9 @@ const List: React.FC<Iprops> = (props: Iprops) => {
} }
const handlePublic = useCallback(async (ids: number[]) => { const handlePublic = useCallback(async (ids: number[]) => {
if (!ids.length) {
return;
}
try { try {
setSubmitLoading(() => true) setSubmitLoading(() => true)
const { code, data } = await postMemberAppraisalWaitPublishPublish({ ids: ids }); const { code, data } = await postMemberAppraisalWaitPublishPublish({ ids: ids });
...@@ -107,6 +110,9 @@ const List: React.FC<Iprops> = (props: Iprops) => { ...@@ -107,6 +110,9 @@ const List: React.FC<Iprops> = (props: Iprops) => {
}, [ref]) }, [ref])
const handleBatchRemove = useCallback(async (ids: number[]) => { const handleBatchRemove = useCallback(async (ids: number[]) => {
if (!ids.length) {
return;
}
try { try {
setSubmitLoading(() => true) setSubmitLoading(() => true)
const { code, data } = await postMemberAppraisalDelete({ ids: ids }); const { code, data } = await postMemberAppraisalDelete({ ids: ids });
......
...@@ -46,6 +46,9 @@ const List: React.FC<Iprops> = (props: Iprops) => { ...@@ -46,6 +46,9 @@ const List: React.FC<Iprops> = (props: Iprops) => {
) )
const handleBatchUpdate = useCallback(async (ids: number[]) => { const handleBatchUpdate = useCallback(async (ids: number[]) => {
if (!ids.length) {
return;
}
try { try {
setSubmitLoading(() => true) setSubmitLoading(() => true)
const { code, data } = await postMemberAppraisalWaitAuditOneAuditBatch({ ids: ids }); const { code, data } = await postMemberAppraisalWaitAuditOneAuditBatch({ ids: ids });
......
...@@ -47,6 +47,9 @@ const List: React.FC<Iprops> = (props: Iprops) => { ...@@ -47,6 +47,9 @@ const List: React.FC<Iprops> = (props: Iprops) => {
) )
const handleBatchUpdate = async (ids: number[]) => { const handleBatchUpdate = async (ids: number[]) => {
if (!ids.length) {
return;
}
try { try {
setSubmitLoading(true) setSubmitLoading(true)
const { code, data } = await postMemberAppraisalWaitAuditTwoAuditBatch({ ids }); const { code, data } = await postMemberAppraisalWaitAuditTwoAuditBatch({ ids });
......
...@@ -148,14 +148,15 @@ const getFieldType = (field: ElementType, editable: boolean = true) => { ...@@ -148,14 +148,15 @@ const getFieldType = (field: ElementType, editable: boolean = true) => {
} }
: null : null
), ),
( // paas平台删除了配置正则的接口相关
field.pattern // (
? { // field.pattern
pattern: field.pattern, // ? {
message: field.msg, // pattern: new RegExp(field.pattern),
} // message: field.msg,
: null // }
), // : null
// ),
].filter(Boolean), ].filter(Boolean),
}; };
......
import React from 'react' import React from 'react'
import { getIntl, history } from 'umi' import { getIntl, history } from 'umi'
import { Card, Button, Space, message } from 'antd' import { Card, Button, Space, message, Modal } from 'antd'
import StandardTable from '@/components/StandardTable'; import StandardTable from '@/components/StandardTable';
import { PageHeaderWrapper } from '@ant-design/pro-layout' import { PageHeaderWrapper } from '@ant-design/pro-layout'
import { PlusCircleOutlined } from '@ant-design/icons' import { PlusCircleOutlined } from '@ant-design/icons'
...@@ -14,6 +14,8 @@ import DateRangePickerUnix from '@/components/NiceForm/components/DateRangePicke ...@@ -14,6 +14,8 @@ import DateRangePickerUnix from '@/components/NiceForm/components/DateRangePicke
import '../../constants/index.less' import '../../constants/index.less'
import { postPurchaseInviteTenderApplyCheckInviteTender, postPurchaseInviteTenderDeleteInviteTender, postPurchaseInviteTenderGetAddInviteTenderList } from '@/services/PurchaseV2Api' import { postPurchaseInviteTenderApplyCheckInviteTender, postPurchaseInviteTenderDeleteInviteTender, postPurchaseInviteTenderGetAddInviteTenderList } from '@/services/PurchaseV2Api'
import AuthButton from '@/components/AuthButton'; import AuthButton from '@/components/AuthButton';
import { postTemplateWebMemberPurchaseWebExitMemberPurchase } from '@/services/TemplateV2Api';
import { getAuth } from '@/utils/auth';
const intl = getIntl(); const intl = getIntl();
// 待新增招标 // 待新增招标
...@@ -28,6 +30,7 @@ const fetchTableData = async (params) => { ...@@ -28,6 +30,7 @@ const fetchTableData = async (params) => {
} }
const ReadyAddBid: React.FC<ReadyAddBidProps> = (props) => { const ReadyAddBid: React.FC<ReadyAddBidProps> = (props) => {
const { memberId, memberRoleId } = getAuth();
// 删除api // 删除api
const { run: deleteRun } = useHttpRequest(postPurchaseInviteTenderDeleteInviteTender) const { run: deleteRun } = useHttpRequest(postPurchaseInviteTenderDeleteInviteTender)
// 提交审核api // 提交审核api
...@@ -84,6 +87,21 @@ const ReadyAddBid: React.FC<ReadyAddBidProps> = (props) => { ...@@ -84,6 +87,21 @@ const ReadyAddBid: React.FC<ReadyAddBidProps> = (props) => {
// } // }
} }
const clickAdd = () => {
postTemplateWebMemberPurchaseWebExitMemberPurchase({memberId, memberRoleId}, {ctlType: 'none'}).then(({code, data}) => {
if(code === 1000) {
if(data) {
history.push('/memberCenter/procurementAbility/callForBids/readyAddMallBid/add')
} else {
Modal.confirm({
title: intl.formatMessage({ id: 'table.purchase.qingchuangjiancaigoumenhu'}),
onOk: () => history.push('/memberCenter/procurementAbility/purchasDoor/purchasInfo')
})
}
}
})
}
return <PageHeaderWrapper> return <PageHeaderWrapper>
<Card> <Card>
<StandardTable <StandardTable
...@@ -123,7 +141,7 @@ const ReadyAddBid: React.FC<ReadyAddBidProps> = (props) => { ...@@ -123,7 +141,7 @@ const ReadyAddBid: React.FC<ReadyAddBidProps> = (props) => {
<Button <Button
icon={<PlusCircleOutlined />} icon={<PlusCircleOutlined />}
type='primary' type='primary'
onClick={() => history.push('/memberCenter/procurementAbility/callForBids/readyAddMallBid/add')} onClick={clickAdd}
> >
{intl.formatMessage({ id: 'table.purchase.added' })} {intl.formatMessage({ id: 'table.purchase.added' })}
</Button> </Button>
......
...@@ -518,7 +518,7 @@ const MemberDocCategoryPro: React.ForwardRefRenderFunction<MemberDocCategoryProR ...@@ -518,7 +518,7 @@ const MemberDocCategoryPro: React.ForwardRefRenderFunction<MemberDocCategoryProR
renderAddition, renderAddition,
renderRemove, renderRemove,
}} }}
effects={($, { setFieldState }) => { effects={($, { setFieldState, getFieldValue }) => {
useBusinessEffects(); useBusinessEffects();
onFormInit$().subscribe(() => { onFormInit$().subscribe(() => {
...@@ -601,6 +601,18 @@ const MemberDocCategoryPro: React.ForwardRefRenderFunction<MemberDocCategoryProR ...@@ -601,6 +601,18 @@ const MemberDocCategoryPro: React.ForwardRefRenderFunction<MemberDocCategoryProR
console.warn(err); console.warn(err);
}); });
}); });
// 品类改变触发联动 品类禁用项
onFieldValueChange$('categories.*.details').subscribe(async (fieldState) => {
const categoriesValue = await getFieldValue('categories');
const allDetailsCheckedKeys = categoriesValue.reduce((pre, now) => pre.concat(now.details), []);
formActions.setFieldState(
'categories.*.details',
state => {
FormPath.setIn(state, 'props.x-component-props.disabledKeys', allDetailsCheckedKeys);
}
);
});
}} }}
actions={formActions} actions={formActions}
schema={schema(isEditable)} schema={schema(isEditable)}
......
...@@ -148,14 +148,15 @@ const getFieldType = (field: ElementType, editable: boolean = true) => { ...@@ -148,14 +148,15 @@ const getFieldType = (field: ElementType, editable: boolean = true) => {
} }
: null : null
), ),
( // paas平台删除了配置正则的接口相关
field.pattern // (
? { // field.pattern
pattern: field.pattern, // ? {
message: field.msg, // pattern: new RegExp(field.pattern),
} // message: field.msg,
: null // }
), // : null
// ),
].filter(Boolean), ].filter(Boolean),
}; };
......
...@@ -22,6 +22,12 @@ export type MaterialType = GetContractManagePagePurchaseMaterielListResponseDeta ...@@ -22,6 +22,12 @@ export type MaterialType = GetContractManagePagePurchaseMaterielListResponseDeta
* 唯一key * 唯一key
*/ */
key: string, key: string,
/**
* 关联请购单数据
*/
requisitionList: GetContractManagePagePurchaseMaterielListResponseDetail['requisitionList'][0] & {
orderQuantity?: number,
}[]
} }
export type OrderMaterialsConfirmValue = MaterialType[] export type OrderMaterialsConfirmValue = MaterialType[]
...@@ -77,6 +83,7 @@ export interface OrderMaterialsDrawerProps { ...@@ -77,6 +83,7 @@ export interface OrderMaterialsDrawerProps {
export interface OrderMaterialsDrawerRef { export interface OrderMaterialsDrawerRef {
deleteItem: (record: PostOrderMaterialData) => void, deleteItem: (record: PostOrderMaterialData) => void,
deleteAll: () => void, deleteAll: () => void,
initCheckedKeys: (dataSource: OrderMaterialsConfirmValue) => void,
} }
type RequisitionListItem = GetContractManagePagePurchaseMaterielListResponseDetail['requisitionList'][0] & { type RequisitionListItem = GetContractManagePagePurchaseMaterielListResponseDetail['requisitionList'][0] & {
...@@ -84,6 +91,10 @@ type RequisitionListItem = GetContractManagePagePurchaseMaterielListResponseDeta ...@@ -84,6 +91,10 @@ type RequisitionListItem = GetContractManagePagePurchaseMaterielListResponseDeta
* 唯一key * 唯一key
*/ */
key: string, key: string,
/**
* 采购数量
*/
orderQuantity?: string | number,
} }
type MaterialsListItem = Omit<GetContractManagePagePurchaseMaterielListResponseDetail, 'requisitionList'> & { type MaterialsListItem = Omit<GetContractManagePagePurchaseMaterielListResponseDetail, 'requisitionList'> & {
...@@ -265,6 +276,18 @@ const OrderMaterialsDrawer: React.ForwardRefRenderFunction<OrderMaterialsDrawerR ...@@ -265,6 +276,18 @@ const OrderMaterialsDrawer: React.ForwardRefRenderFunction<OrderMaterialsDrawerR
} }
}; };
const handleInitSelectRows = (checkeds: string[], selected: boolean, selectedRows?: MaterialsListItem[]) => {
const { levelMap, maxLevel } = getLevelEntities(keyEntities.current);
if (selected) {
const keys = [...checkedKeysState, ...checkeds];
const { halfCheckedKeys, checkedKeys } = fillConductCheck(keys, levelMap, maxLevel);
setCheckedKeysState(checkedKeys);
setHalfCheckedState(halfCheckedKeys);
}
if (!selected) {}
};
const expandedRowRender = (parentRecord: MaterialsListItem, parentIndex: number) => { const expandedRowRender = (parentRecord: MaterialsListItem, parentIndex: number) => {
const expandedColumns: ColumnType<RequisitionListItem>[] = [ const expandedColumns: ColumnType<RequisitionListItem>[] = [
{ {
...@@ -446,9 +469,53 @@ const OrderMaterialsDrawer: React.ForwardRefRenderFunction<OrderMaterialsDrawerR ...@@ -446,9 +469,53 @@ const OrderMaterialsDrawer: React.ForwardRefRenderFunction<OrderMaterialsDrawerR
setExpandedRowKeys(expandedKeys); setExpandedRowKeys(expandedKeys);
}; };
const handleInitCheckedKeys = (dataSource: OrderMaterialsConfirmValue) => {
const normalized = normalizeMaterialsList(dataSource);
keyEntities.current = {
...keyEntities.current,
...convertDataToEntities(normalized).keyEntities,
};
// 初始勾选
const checkeds = [];
normalized.forEach((item) => {
// 有 children 则表示是 请购单合同下单
if (item.children && item.children.length) {
item.children.forEach((child) => {
checkeds.push(child.key);
});
} else {
checkeds.push(item.key);
}
});
handleInitSelectRows(checkeds, true);
// 设置Form初始值
const requisitionValue: { [key: string]: string } = {};
for (let i = 0; i < normalized.length; i++) {
const item = normalized[i];
if (item.children && item.children.length) {
item.children.forEach((child) => {
requisitionValue[child.key] = child.orderQuantity as string;
});
}
}
// 没有值的话跳过设置
if (Object.keys(requisitionValue).length) {
form.setFieldsValue({
materials: {
requisitionList: requisitionValue,
},
});
requisitionListValue.current = {
...requisitionListValue.current,
...(requisitionValue || {}),
};
}
};
useImperativeHandle(ref, () => ({ useImperativeHandle(ref, () => ({
deleteItem: handleDelete, deleteItem: handleDelete,
deleteAll: handleDeleteAll, deleteAll: handleDeleteAll,
initCheckedKeys: handleInitCheckedKeys,
})); }));
return ( return (
......
...@@ -31,7 +31,7 @@ export const procurmentRenderInit = (initValue: any) => { ...@@ -31,7 +31,7 @@ export const procurmentRenderInit = (initValue: any) => {
vendorMemberId: initValue.vendorMemberId, vendorMemberId: initValue.vendorMemberId,
vendorMemberName: initValue.vendorMemberName, vendorMemberName: initValue.vendorMemberName,
vendorRoleId: initValue.vendorRoleId, vendorRoleId: initValue.vendorRoleId,
product: initValue.product, // product: initValue.product,
deliveryAddresId: initValue.consignee.consigneeId, deliveryAddresId: initValue.consignee.consigneeId,
hasInvoice: initValue.hasInvoice, hasInvoice: initValue.hasInvoice,
orderId: initValue.orderId, orderId: initValue.orderId,
......
...@@ -15,7 +15,7 @@ export const useModelTypeChange = (callback) => { ...@@ -15,7 +15,7 @@ export const useModelTypeChange = (callback) => {
export const useContractChange = (callback) => { export const useContractChange = (callback) => {
const utils = useLinkageUtils() const utils = useLinkageUtils()
// 选择的合同发生改变时 // 选择的合同发生改变时
FormEffectHooks.onFieldValueChange$('contract').subscribe(state => { FormEffectHooks.onFieldInputChange$('contract').subscribe(state => {
callback(state) callback(state)
}) })
} }
......
...@@ -16,7 +16,7 @@ import { useUpdate } from '@umijs/hooks' ...@@ -16,7 +16,7 @@ import { useUpdate } from '@umijs/hooks'
import { help } from '../../common' import { help } from '../../common'
import styles from './index.less' import styles from './index.less'
import { useMaterialTable } from './model/useMaterialTable' import { useMaterialTable } from './model/useMaterialTable'
import { convertOrderMaterialData } from './utils'; import { convertOrderMaterialData, convertOrderMaterialDataSource } from './utils';
import ContractModalTable from './components/contractModalTable' import ContractModalTable from './components/contractModalTable'
import MaterialModalTable from './components/materialModalTable' import MaterialModalTable from './components/materialModalTable'
import RequisitionModalTable, { RequisitionModalTableRef } from './components/requisitionModalTable' import RequisitionModalTable, { RequisitionModalTableRef } from './components/requisitionModalTable'
...@@ -186,10 +186,13 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => { ...@@ -186,10 +186,13 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
...productState.props["x-component-props"], ...productState.props["x-component-props"],
columns, columns,
scroll: { x: columns.reduce((total, current) => total += current.width, 0) }, scroll: { x: columns.reduce((total, current) => total += current.width, 0) },
prefix: productState.editable && pageStatus === PageStatus.ADD ? materialAddButton : '', // prefix: productState.editable && pageStatus === PageStatus.ADD ? materialAddButton : '',
prefix: materialAddButton,
} }
}) })
}, 1000) }, 1000)
// 初始订单物料抽屉勾选项
orderMaterialsDrawerRef.current?.initCheckedKeys(convertOrderMaterialDataSource(res.data.product.products as any));
setFormLoading(false) setFormLoading(false)
}) })
} }
...@@ -208,7 +211,6 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => { ...@@ -208,7 +211,6 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
let fnResult = null let fnResult = null
// 新增订单/编辑订单 // 新增订单/编辑订单
const params = { ...value } const params = { ...value }
console.log(value)
// 校验订单物料 // 校验订单物料
if(!(params.products?.length)) { if(!(params.products?.length)) {
setTimeout(() => setVisibleOrderMaterialsDrawer(true), 500) setTimeout(() => setVisibleOrderMaterialsDrawer(true), 500)
...@@ -329,7 +331,6 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => { ...@@ -329,7 +331,6 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
} }
// const _params = procurementProcessField(params) // const _params = procurementProcessField(params)
console.log(params)
if(id) { if(id) {
fnResult = await postOrderBuyerCreateSrmUpdate({...params, orderId: id}) fnResult = await postOrderBuyerCreateSrmUpdate({...params, orderId: id})
} else { } else {
......
import { PostOrderBuyerCreateSrmRequest } from "@/services/OrderNewV2Api"; import { PostOrderBuyerCreateSrmRequest } from "@/services/OrderNewV2Api";
export type PostOrderMaterialData = PostOrderBuyerCreateSrmRequest['products'][0] & { export type PostOrderMaterialData = PostOrderBuyerCreateSrmRequest['products'][0] & {
detailId: number,
/** /**
* 订单物料抽屉内部key * 订单物料抽屉内部key
*/ */
......
...@@ -49,6 +49,39 @@ export const convertOrderMaterialData = (dataSource: OrderMaterialsConfirmValue[ ...@@ -49,6 +49,39 @@ export const convertOrderMaterialData = (dataSource: OrderMaterialsConfirmValue[
quotedSpec: dataSource.associatedType, quotedSpec: dataSource.associatedType,
quotedCategory: dataSource.associatedCategory, quotedCategory: dataSource.associatedCategory,
quotedBrand: dataSource.associatedBrand, quotedBrand: dataSource.associatedBrand,
detailId: dataSource.detailId,
key: dataSource.key, key: dataSource.key,
}); });
/**
* SRM订单详情商品数据 转 订单物料数据,用于编辑时初始订单物料抽屉数据
* @param dataSource SRM订单详情商品数据
* @returns 订单物料数据
*/
export const convertOrderMaterialDataSource = (dataSource: PostOrderMaterialData[]): OrderMaterialsConfirmValue=> {
const ret: OrderMaterialsConfirmValue = [];
dataSource.forEach((item) => {
ret.push(({
id: item.productId,
materielNo: item.productNo,
materielName: item.name,
category: item.category,
brand: item.brand,
type: item.spec,
unit: item.unit,
isHasTax: item.tax ? 1 : 0,
taxRate: item.taxRate,
price: item.price,
supplierInventory: item.stock,
requisitionList: item.requisitions?.map(({ requisitionId, orderQuantity }) => ({
detailId: requisitionId,
orderQuantity: orderQuantity,
})) || undefined,
associatedDataId: item.quotedSkuId,
associatedGoods: item.quotedName,
associatedType: item.quotedSpec,
associatedCategory: item.quotedCategory,
associatedBrand: item.quotedBrand,
}) as unknown as OrderMaterialsConfirmValue[0])
});
return ret;
};
...@@ -27,6 +27,7 @@ const formActions = createFormActions(); ...@@ -27,6 +27,7 @@ const formActions = createFormActions();
const modalFormActions = createFormActions(); const modalFormActions = createFormActions();
const intl = getIntl(); const intl = getIntl();
const Inventory: React.FC<{}> = () => { const Inventory: React.FC<{}> = () => {
const { goodsNo } = history.location.query;
const [current, setCurrent] = useState(null); const [current, setCurrent] = useState(null);
const [modalVisible, setModalVisible] = useState(false); const [modalVisible, setModalVisible] = useState(false);
const [confirmLoading, setConfirmLoading] = useState(false); const [confirmLoading, setConfirmLoading] = useState(false);
...@@ -140,7 +141,7 @@ const Inventory: React.FC<{}> = () => { ...@@ -140,7 +141,7 @@ const Inventory: React.FC<{}> = () => {
const fetchListData = (params: any) => { const fetchListData = (params: any) => {
const materialGroupId = params.materialGroupId ? params.materialGroupId[params.materialGroupId.length - 1] : undefined const materialGroupId = params.materialGroupId ? params.materialGroupId[params.materialGroupId.length - 1] : undefined
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
getProductInventoryList({ ...params, materialGroupId }) getProductInventoryList({ ...params, materialGroupId, goodsNo })
.then(res => { .then(res => {
if (res.code === 1000) { if (res.code === 1000) {
resolve(res.data); resolve(res.data);
...@@ -216,6 +217,13 @@ const Inventory: React.FC<{}> = () => { ...@@ -216,6 +217,13 @@ const Inventory: React.FC<{}> = () => {
</Button> </Button>
</AuthButton> </AuthButton>
); );
useEffect(() => {
if (goodsNo) {
formActions.setFieldValue('goodsNo', goodsNo);
}
}, [goodsNo]);
return ( return (
<PageHeaderWrapper> <PageHeaderWrapper>
<Card> <Card>
......
...@@ -159,7 +159,7 @@ const WarehouseForm: React.FC<WarehouseFormProps> = ({ ...@@ -159,7 +159,7 @@ const WarehouseForm: React.FC<WarehouseFormProps> = ({
}} }}
> >
<NiceForm <NiceForm
previewPlaceholder="' '" previewPlaceholder=" "
editable={isEdit || !id} editable={isEdit || !id}
expressionScope={{ expressionScope={{
AddressLabel, AddressLabel,
......
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