Commit eeed6163 authored by 前端-钟卫鹏's avatar 前端-钟卫鹏

fix: 评标模板已经关联不给予更改操作,对接SRM订单修改

parent 3ee6e3fd
......@@ -77,8 +77,8 @@ const memberCenterRoute = {
// AuthConfigRoute,
// MemberRoute,
// HandlingRoute,
marketingRoute,
// ...asyncRoutes,
// marketingRoute,
...asyncRoutes,
{
path: '/memberCenter/noAuth',
auth: false,
......
import React, { useRef } from 'react'
import { Button, Popconfirm } from 'antd'
import { Button, message, Popconfirm } from 'antd'
import StatusSwitch from '@/components/StatusSwitch'
import { PublicApi } from '@/services/api'
import EyePreview from '@/components/EyePreview'
......@@ -67,13 +67,29 @@ export const useSelfTable = () => {
}
const handleDelete = (id) => {
PublicApi.postPurchaseTemplateDeleteBatchTemplate({ idList: [id] }).then(res => {
if(res.code === 1000) {
ref.current.reload()
}
})
if(!verifyCorrelation(id)) {
PublicApi.postPurchaseTemplateDeleteBatchTemplate({ idList: [id] }).then(res => {
if(res.code === 1000) {
ref.current.reload()
}
})
} else {
return message.error('该评标模板已经被使用,不能删除')
}
}
const handleEdit = (id) => {
if(!verifyCorrelation(id)) {
history.push(`/memberCenter/procurementAbility/callForBids/remarkBidTemplate/edit?id=${id}`)
} else {
return message.error('该评标模板已经被使用,不能修改')
}
}
const verifyCorrelation = async (id) => {
const { data } = await getPurchaseTemplateGetTemplateIsUse({id})
return data
}
const secondColumns: any[] = baseBidListColumns.concat([
{
......@@ -82,7 +98,7 @@ export const useSelfTable = () => {
dataIndex: 'ctl',
key: 'ctl',
render: (text, record) => <>
<Button type='link' onClick={() => history.push(`/memberCenter/procurementAbility/callForBids/remarkBidTemplate/edit?id=${record.id}`)}>编辑</Button>
<Button type='link' onClick={() => handleEdit(record.id)}>编辑</Button>
<Popconfirm
title="确定要执行该操作?"
onConfirm={() => handleDelete(record.id)}
......@@ -91,7 +107,6 @@ export const useSelfTable = () => {
>
<Button
type='link'
// onClick={() => handleDelete(record.id)}
>删除</Button>
</Popconfirm>
</>
......
import { ISchema } from "@formily/antd";
export const schema: ISchema = {
type: 'object',
properties: {
NO_SUBMIT: {
type: 'object',
"x-component": "mega-layout",
"x-component-props": {
grid: true,
autoRow: true,
labelCol: 4,
labelAlign: 'left',
columns: 2
},
properties: {
addresId: {
type: 'string',
enum: [],
title: '发货地址',
"x-rules": [
{
message: '请选择发货地址',
required: true
}
],
"x-mega-props": {
span: 1
}
},
deliveryTime: {
type: 'string',
"x-component": 'date',
title: '发货日期',
"x-rules": [
{
message: '请选择发货日期',
required: true
}
],
"x-mega-props": {
full: true,
span: 1
}
},
logisticsNo: {
type: 'string',
title: '物流单号',
"x-rules": [
{
limitByte: true,
maxByte: 20
},
],
"x-mega-props": {
span: 1
}
},
logisticsCompanyId: {
type: 'string',
enum: [],
title: '物流公司',
"x-mega-props": {
span: 1
}
},
products: {
type: 'array',
"x-component": 'MultTable',
"x-component-props": {
rowKey: 'skuId',
columns: "{{productColumns}}",
components: "{{productComponents}}",
// expandable: "{{productChildren}}",
// pagination: { size: 'small' }
},
"x-mega-props": {
span: 2
}
},
address: {
type: 'string',
display: false
},
company: {
type: 'string',
display: false
}
}
}
}
}
// 商品列 @todo 补充积分类型文案
export const productColumns: any = [
{
title: '商品ID',
dataIndex: 'skuId',
align: 'center',
key: 'skuId'
},
{
title: '商品名称',
dataIndex: 'name',
align: 'center',
key: 'name',
},
{
title: '品类',
dataIndex: 'category',
align: 'center',
key: 'category'
},
{
title: '品牌',
dataIndex: 'brand',
align: 'center',
key: 'brand',
},
{
title: '单位',
dataIndex: 'unit',
align: 'center',
key: 'unit'
},
{
title: '单价',
dataIndex: 'price',
align: 'center',
key: 'price',
},
{
title: '已发货',
dataIndex: 'delivered',
align: 'center',
key: 'delivered',
},
{
title: '未发货',
dataIndex: 'leftCount',
align: 'center',
key: 'leftCount',
},
{
title: '已收货',
dataIndex: 'received',
align: 'center',
key: 'received',
},
{
title: '差异数量',
dataIndex: 'differCount',
align: 'center',
key: 'differCount',
},
{
title: '发货数量',
dataIndex: 'deliveryCount',
align: 'left',
key: 'deliveryCount',
formItem: 'input',
editable: true,
width: 140,
},
]
// 物料列
export const materialColumns: any = [
{
title: 'ID',
dataIndex: 'productId',
align: 'center',
key: 'productId',
className: 'commonHide'
},
{
title: '物料编号',
dataIndex: 'productNo',
align: 'center',
key: 'productNo',
},
{
title: '物料名称/规格',
dataIndex: 'name',
align: 'center',
key: 'name',
// render: (t, r) => `${t}/${r.type}`
},
{
title: '品类',
dataIndex: 'category',
align: 'center',
key: 'category',
},
{
title: '品牌',
dataIndex: 'brand',
align: 'center',
key: 'brand',
},
{
title: '单位',
dataIndex: 'unit',
align: 'center',
key: 'unit',
},
{
title: '关联报价商品ID/名称/规格/品类/品牌',
dataIndex: 'quotedSkuId',
align: 'center',
key: 'quotedSkuId',
render: (t, r) => `${t}/${r.quotedName || ''}/${r.quotedCategory || ''}/${r.quotedBrand || ''}`
},
{
title: '采购数量',
dataIndex: 'quantity',
align: 'center',
key: 'quantity',
},
{
title: '已发货',
dataIndex: 'delivered',
align: 'center',
key: 'delivered',
},
{
title: '未发货',
dataIndex: 'leftCount',
align: 'center',
key: 'leftCount',
},
{
title: '已收货',
dataIndex: 'received',
align: 'center',
key: 'received',
},
{
title: '差异数量',
dataIndex: 'differCount',
align: 'center',
key: 'differCount',
},
{
title: '发货数量',
dataIndex: 'deliveryCount',
align: 'left',
key: 'deliveryCount',
formItem: 'input',
editable: true,
width: 140,
},
]
import React, { useContext, useRef, useEffect, useState } from 'react'
import { Button, Drawer } from 'antd'
import NiceForm from '@/components/NiceForm'
import { createFormActions, ISchema } from '@formily/antd'
import { createFormActions } from '@formily/antd'
import { history } from 'umi'
import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect'
import { PublicApi } from '@/services/api'
import { OrderDetailContext } from '../../_public/order/context'
import moment from 'moment'
import { useProductTable } from './model/useProductTable'
import { OrderKindType } from '@/constants/order'
import { schema } from './constant'
export interface OrderHandDeleveModalProps {
currentRef: any
......@@ -15,116 +17,15 @@ export interface OrderHandDeleveModalProps {
const schemaActions = createFormActions()
const schema: ISchema = {
type: 'object',
properties: {
NO_SUBMIT: {
type: 'object',
"x-component": "mega-layout",
"x-component-props": {
// labelAlign: 'left',
// labelCol: 6,
grid: true,
autoRow: true,
labelCol: 4,
labelAlign: 'left',
columns: 2
},
properties: {
addresId: {
type: 'string',
enum: [],
title: '发货地址',
"x-rules": [
{
message: '请选择发货地址',
required: true
}
],
"x-mega-props": {
span: 1
}
},
deliveryTime: {
type: 'string',
"x-component": 'date',
title: '发货日期',
"x-rules": [
{
message: '请选择发货日期',
required: true
}
],
"x-mega-props": {
full: true,
span: 1
}
},
logisticsNo: {
type: 'string',
title: '物流单号',
"x-rules": [
// {
// required: true,
// message: '请输入物流单号'
// },
{
limitByte: true,
maxByte: 20
},
],
"x-mega-props": {
span: 1
}
},
logisticsCompanyId: {
type: 'string',
enum: [],
title: '物流公司',
// "x-rules": [
// {
// message: '请选择物流公司',
// required: true
// }
// ],
"x-mega-props": {
span: 1
}
},
products: {
type: 'array',
"x-component": 'MultTable',
"x-component-props": {
rowKey: 'skuId',
columns: "{{productColumns}}",
components: "{{productComponents}}",
// expandable: "{{productChildren}}",
// pagination: { size: 'small' }
},
"x-mega-props": {
span: 2
}
},
address: {
type: 'string',
display: false
},
company: {
type: 'string',
display: false
}
}
}
}
}
const OrderHandDeleveModal:React.FC<OrderHandDeleveModalProps> = (props) => {
const { data } = useContext(OrderDetailContext)
const { orderKind } = data || {}
const contractOrder = (orderKind === OrderKindType.SRM_ORDER)
const dataRef = useRef<any>({})
const { currentRef } = props
const [visible, setVisible] = useState<boolean>(false)
const [loading, setLoading] = useState<boolean>(false)
const { productColumns, productComponents, ...sectionProps } = useProductTable(schemaActions)
const { productColumns, productComponents, ...sectionProps } = useProductTable(schemaActions, contractOrder)
useEffect(() => {
if (currentRef) {
......
import React, { useState } from 'react'
import { ISchemaFormActions, ISchemaFormAsyncActions } from '@formily/antd';
import ProductTableCell, { ProductEditableRow } from '../components/productTableCell';
// @todo 补充积分类型文案
const productColumns: any = [
{
title: '商品ID',
dataIndex: 'skuId',
align: 'center',
key: 'skuId'
},
{
title: '商品名称',
dataIndex: 'name',
align: 'center',
key: 'name',
},
{
title: '品类',
dataIndex: 'category',
align: 'center',
key: 'category'
},
{
title: '品牌',
dataIndex: 'brand',
align: 'center',
key: 'brand',
},
{
title: '单位',
dataIndex: 'unit',
align: 'center',
key: 'unit'
},
{
title: '单价',
dataIndex: 'price',
align: 'center',
key: 'price',
},
// {
// title: '采购数量',
// dataIndex: 'quantity',
// align: 'center',
// key: 'quantity',
// },
// {
// title: '含税',
// dataIndex: 'tax',
// align: 'center',
// key: 'tax',
// render: (text) => text ? '是' : '否'
// },
// {
// title: '金额',
// dataIndex: 'amount',
// align: 'center',
// key: 'amount',
// },
{
title: '已发货',
dataIndex: 'delivered',
align: 'center',
key: 'delivered',
},
{
title: '未发货',
dataIndex: 'leftCount',
align: 'center',
key: 'leftCount',
},
{
title: '已收货',
dataIndex: 'received',
align: 'center',
key: 'received',
},
{
title: '差异数量',
dataIndex: 'differCount',
align: 'center',
key: 'differCount',
},
{
title: '发货数量',
dataIndex: 'deliveryCount',
align: 'left',
key: 'deliveryCount',
formItem: 'input',
editable: true,
width: 140,
},
]
import { productColumns, materialColumns } from '../constant';
/**
* @param ctx schemaAction
*/
export const useProductTable = (ctx: ISchemaFormActions | ISchemaFormAsyncActions) => {
export const useProductTable = (ctx: ISchemaFormActions | ISchemaFormAsyncActions, kind: boolean) => {
const productComponents = {
body: {
......@@ -139,9 +48,27 @@ export const useProductTable = (ctx: ISchemaFormActions | ISchemaFormAsyncAction
};
})
const materialMergeColumns = materialColumns.map(col => {
if (!col.editable) {
return col;
}
return {
...col,
onCell: record => ({
record,
editable: ctx.getFormState().editable === false ? false : col.editable,
dataIndex: col.dataIndex,
title: col.title,
formItem: col.formItem,
formItemProps: col.formItemProps,
handleSave
}),
};
})
return {
productColumns: productMergeColumns,
productColumns: kind ? materialMergeColumns : productMergeColumns,
productComponents,
}
}
......@@ -339,9 +339,9 @@ const OrderProductTable:React.FC<OrderProductTableProps> = ({editable}) => {
},
{
title: '关联报价商品ID/名称/规格/品类/品牌',
dataIndex: 'quotedProductId',
dataIndex: 'quotedSkuId',
align: 'center',
key: 'quotedProductId',
key: 'quotedSkuId',
render: (t, r) => `${t}/${r.quotedName}/${r.quotedCategory}/${r.quotedBrand}`
},
{
......
......@@ -501,9 +501,9 @@ const SaleOrderProductTable:React.FC<OrderProductTableProps> = (props) => {
},
{
title: '关联报价商品ID/名称/规格/品类/品牌',
dataIndex: 'quotedProductId',
dataIndex: 'quotedSkuId',
align: 'center',
key: 'quotedProductId',
key: 'quotedSkuId',
render: (t, r) => `${t}/${r.quotedName}/${r.quotedCategory}/${r.quotedBrand}`
},
{
......
......@@ -56,7 +56,7 @@ const ContractModalTable:React.FC<ContractModalTableProps> = (props) => {
schemaAction.setFieldValue('contractNo', item.contractNo)
schemaAction.setFieldValue('contract', item)
const { data } = await fetchOrderApi.getContractPurchaseMaterielList({
contractId: item.id,
contractId: item?.id || item?.contractId,
current: 1,
pageSize: 999,
})
......@@ -80,7 +80,7 @@ const ContractModalTable:React.FC<ContractModalTableProps> = (props) => {
temp.relevanceProductCategory = v.associatedCategory;
temp.relevanceProductBrand = v.associatedBrand;
temp.price = v.price;
temp.stock = v.bidCount;
temp.stock = v.supplierInventory;
temp.tax = v.isHasTax;
temp.taxRate = v.taxRate;
// @ 配送方式 默认物流
......
......@@ -103,7 +103,7 @@ const MaterialModalTable:React.FC<MaterialModalTableProps> = (props) => {
temp.relevanceProductCategory = v.associatedCategory;
temp.relevanceProductBrand = v.associatedBrand;
temp.price = v.price;
temp.stock = v.bidCount;
temp.stock = v.supplierInventory;
temp.tax = v.isHasTax;
temp.taxRate = v.taxRate;
// @ 配送方式 默认物流
......
......@@ -25,13 +25,42 @@ export const PriceComp = (props) => {
</div>
}
/** 修改采购合同下单 回显字段转换 */
/** 修改合同下单 初始值转换 */
export const procurmentRenderInit = (initValue: any) => {
// ...data.consignee,
// ...data.contract,
return {
...initValue.requirement.detail,
vendorMemberId: initValue.vendorMemberId,
vendorMemberName: initValue.vendorMemberName,
vendorRoleId: initValue.vendorRoleId,
product: initValue.product,
deliveryAddresId: initValue.consignee.consigneeId,
hasInvoice: initValue.hasInvoice,
orderId: initValue.orderId,
orderKind: initValue.orderKind,
orderMode: initValue.orderMode,
orderModeName: initValue.orderModeName,
type: initValue.orderTypeName,
digest: initValue.digest,
deliverDate: initValue.consignee.deliverDate,
theInvoiceId: initValue.invoice.invoiceId,
hasContract: initValue.hasContract,
contractNo: initValue.contract.contractNo,
contract: {...initValue.contract},
}
}
/** 修改采购合同下单 回显商品字段转换 */
export const procurementRenderField = (_orderProductRequests) => {
return _orderProductRequests.map(item => {
return {
...item,
// 此id为sukId
relevanceProductId: item.quotedProductId,
relevanceProductId: item.quotedSkuId,
// relevanceSkuId: item.quotedSkuId,
relevanceProductName: item.quotedName,
relevanceProductBrand: item.quotedBrand,
......@@ -57,8 +86,8 @@ export const procurementProcessField = (value) => {
quotedSkuId: item.relevanceProductId,
quotedName: item.relevanceProductName,
quotedSpec: item.relevanceProductType,
materialCategory: item.relevanceProductCategory,
materialBrand: item.relevanceProductBrand,
quotedCategory: item.relevanceProductCategory,
quotedBrand: item.relevanceProductBrand,
}
})
return value
......
......@@ -9,7 +9,7 @@ import { SaveOutlined, LinkOutlined, PlusOutlined } from '@ant-design/icons'
import NiceForm from '@/components/NiceForm'
import { mergeAllSchemas } from './schema'
import { useModelTypeChange, useEditHideField, useOrderFormInitEffect, useOrderUpdateChangeOther, useProductTableChangeForPay } from './effects'
import { orderCombination, orderTypeLabelMap, procurementProcessField, procurementRenderField } from './constant'
import { orderCombination, orderTypeLabelMap, procurementProcessField, procurementRenderField, procurmentRenderInit } from './constant'
import CirculationRecord from '../components/circulationRecord'
import SelectAddress from './components/selectAddress'
import TheInvoiceList from './components/theInvoiceList'
......@@ -107,14 +107,10 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
PublicApi.getOrderBuyerCreateDetail({ orderId: id }).then(res => {
const { data } = res
const _orderProductRequests = procurementRenderField(data.product.products)
setInitFormValue({
...data,
...data.consignee,
...data.contract,
...data.requirement.detail,
})
setInitFormValue(() => procurmentRenderInit(data))
setTimeout(() => {
addSchemaAction.setFieldValue('products', _orderProductRequests)
addSchemaAction.setFieldValue('contract', {...data.contract})
}, 1000)
setFormLoading(false)
})
......@@ -161,7 +157,6 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
})
console.log(deliveryAddress)
params.products = params.products.map(item => {
// const address = deliveryAddress.filter(item => item.isDefault)[0]
const address = deliveryAddress[0]
return {
...item,
......@@ -190,27 +185,29 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
}
// 合同数据字段转换
params.contract = {
contractId: params.contract.id,
contractNo: params.contract.contractNo,
digest: params.contract.contractAbstract,
effectDate: params.contract.startTime,
expireDate: params.contract.endTime,
partB: params.contract.partyBName,
contractType: params.contract.sourceType,
leftAmount: params.contract.freeAmount,
receiptNo: params.contract.sourceNo,
if(pageStatus === PageStatus.ADD) {
params.contract = {
contractId: params.contract.id,
contractNo: params.contract.contractNo,
digest: params.contract.contractAbstract,
effectDate: params.contract.startTime,
expireDate: params.contract.endTime,
partB: params.contract.partyBName,
contractType: params.contract.sourceType,
leftAmount: params.contract.freeAmount,
receiptNo: params.contract.sourceNo,
}
}
// 交付地址数据字段转换拼接 查询省市区冗余
const { data: addressDetail} = await PublicApi.getLogisticsReceiverAddressGet({
id: params.deliveryAddresId.id
id: params.deliveryAddresId?.id || params.deliveryAddresId
})
const { data: countryCode } = await PublicApi.getManageCountryAreaGetTelCode({})
params.consignee = {
deliverDate: params.deliverDate,
consigneeId: params.deliveryAddresId.id,
consignee: params.deliveryAddresId.receiverName,
consigneeId: addressDetail.id,
consignee: addressDetail.receiverName,
provinceCode: addressDetail.provinceCode,
cityCode: addressDetail.cityCode,
districtCode: addressDetail.districtCode,
......@@ -230,11 +227,11 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
}
}
const _params = procurementProcessField(params)
console.log(_params)
if(id) {
fnResult = await PublicApi.postOrderBuyerCreateSrmUpdate({...params, id})
fnResult = await PublicApi.postOrderBuyerCreateSrmUpdate({..._params, orderId: id})
} else {
const _params = procurementProcessField(params)
console.log(_params)
fnResult = await PublicApi.postOrderBuyerCreateSrm(_params)
}
if (fnResult.code === 1000) {
......
......@@ -156,26 +156,6 @@ const basicInfo: ISchema = {
title: '采购合同信息',
visible: false
}
// contractId: {
// type: 'number',
// title: '采购合同ID',
// visible: false
// },
// quotationNo: {
// type: 'string',
// title: '对应单据',
// visible: false
// },
// sourceType: {
// type: 'number',
// title: '合同下单的寻源类型',
// visible: false
// },
// purchaseType: {
// type: 'number',
// title: '合同下单的是否有限制下单金额',
// visible: false
// },
}
},
......
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