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

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

parents bb2c5118 210bd253
......@@ -15,7 +15,7 @@
// import AfterService from './afterServiceRoute' // 售后
// import HandlingRoute from './handlingRoute'; // 加工能力
import asyncRoutes from '../router.config.json';
import ProcurementRoute from './procurementRoute';
// import ProcurementRoute from './procurementRoute';
// import { callForBidsRoute } from './procurementRoute/callForBids';
// import { purchaseInquiryRoute } from './procurementRoute/purchaseInquiry';
// import contracRoute from './contracRoute';
......
......@@ -114,7 +114,7 @@ const MultAddress = (props) => {
if (res.code === 1000) {
result[idx].provinceCode = val;
result[idx].province = item.name;
// @todo 编辑情况下 第一次不清空
// @ 编辑情况下 第一次不清空
if(!cityAfterRef.current) {
result[idx].cityCode = null;
result[idx].city = null;
......@@ -140,7 +140,7 @@ const MultAddress = (props) => {
if(res.code === 1000) {
result[idx].cityCode = val;
result[idx].city = items.name;
// @todo 编辑情况下 第一次不清空
// @ 编辑情况下 第一次不清空
if(!areaAfterRef.current) {
result[idx].areaCode = null;
result[idx].area = null;
......
......@@ -47,8 +47,7 @@ const MultAddress = (props) => {
// 是否仅读
const { readOnly = null } = props.props
console.log(_v, 'vvv')
// 处理表单提交置空触发错误角标提示
let value = null
if(!_v.length) {
value = [{ provinceCode: null, province: null, cityCode: null, city: null }]
......@@ -62,6 +61,7 @@ const MultAddress = (props) => {
const [province, setprovince] = useState<any>([]); // 省列表
const [city, setcity] = useState<any>([]); // 市列表
const flag = useRef<boolean>(true)
const cityAfterRef = useRef<boolean>(true)
useEffect(() => {
PublicApi.getManageAreaAll().then(res => {
......@@ -92,7 +92,10 @@ const MultAddress = (props) => {
}
}, [value])
// 触发onChange改变值
/**
* 触发onChange改变值
* @param num (1省 2市)
* */
const changeAddress = async (val: any, idx: number, num: number) => {
const result = [...value]
const cityCode: Array<any> = []
......@@ -112,12 +115,22 @@ const MultAddress = (props) => {
// 渲染省份option
const renderProvice = async (result, val, idx) => {
console.log(result, val, idx)
await province.forEach(item => {
if (item.code === val) {
PublicApi.getManageAreaByPcodeAll({ pcode: val }).then((res: any) => {
if (res.code === 1000) {
result[idx].provinceCode = val;
result[idx].province = item.name;
// @todo 编辑情况下 result[idx]存在id ?第一次渲染回填值的时候不清空
// if(result[idx]?.i d&& ) {
// console.log(cityAfterRef.current, 1, item)
// result[idx].cityCode = null;
// result[idx].city = null;
// } else {
// console.log(cityAfterRef.current, 2, item)
// cityAfterRef.current = false;
// }
city[idx] = { citydata: res.data }
setcity([...city])
}
......
......@@ -611,7 +611,7 @@ export const DOC_STATUS = {
[DOC_STATUS_REVIEWED]: '已审核',
};
// 订单类型
// 下单模式
export enum OrderModalType {
/**
......
/*
* @Author: XieZhiXiong
* @Date: 2021-04-21 18:13:25
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-04-21 18:34:25
* @Description: 订单相关常量
*/
/* --------------------------------- 订单类型 -------------------------------- */
/**
* 询价采购
*/
export const ORDER_TYPE_INQUIRYT_PURCHASE = 1;
/**
* 需求采购
*/
export const ORDER_TYPE_DEMAND_PURCHASE = 2;
/**
* 现货采购
*/
export const ORDER_TYPE_STORE_PURCHASE = 3;
/**
* 集采
*/
export const ORDER_TYPE_CENTRAL_PURCHASE = 4;
/**
* 渠道直采
*/
export const ORDER_TYPE_CHANNEL_DIRECT_MINING = 5;
/**
* 渠道现货
*/
export const ORDER_TYPE_CHANNEL_STORE = 6;
/**
* 积分兑换
*/
export const ORDER_TYPE_POINTS = 7;
/**
* 渠道积分兑换
*/
export const ORDER_TYPE_CHANNEL_POINTS = 8;
/**
* 采购询价合同
*/
export const ORDER_TYPE_INQUIRY_CONTRACT = 9;
/**
* 采购竞价合同
*/
export const ORDER_TYPE_BIDDING_CONTRACT = 10;
/**
* 采购招标合同
*/
export const ORDER_TYPE_TENDER_CONTRACT = 11;
\ No newline at end of file
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2020-11-04 15:09:09
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-02-20 17:54:10
* @LastEditTime: 2021-04-22 14:54:25
* @Description: 维修商品抽屉组件
*/
import React, { useState, useEffect } from 'react';
......@@ -73,7 +73,7 @@ interface GoodsDrawerProps {
/**
* 流程类型:1.订单交易流程 2.售后换货流程 3.售后退货流程 4.售后维修流程
*/
afterType: 1 | 2 | 3 | 4,
afterType: 1 | 2 | 3 | 4;
};
interface GoodsDrawerState {
......@@ -157,80 +157,6 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
flattened = [];
tableColumn: ColumnType<any>[] = [
{
title: '订单号',
dataIndex: 'orderNo',
align: 'center',
},
{
title: '订单摘要',
dataIndex: 'orderThe',
align: 'center',
},
{
title: '供应会员',
dataIndex: 'supplyMembersName',
align: 'center',
},
{
title: '下单时间',
dataIndex: 'createTime',
align: 'center',
render: text => moment(text).format('YYYY-MM-DD HH:mm:ss'),
},
{
title: '订单状态',
dataIndex: 'externalState',
align: 'center',
render: text => PurchaseOrderOutWorkStateTexts[text],
},
{
title: '订单类型',
dataIndex: 'type',
align: 'center',
render: text => ORDER_TYPE2[text],
},
];
childTableColumn: ColumnType<any>[] = [
{
title: 'ID',
dataIndex: 'productId',
align: 'center',
},
{
title: '商品名称',
dataIndex: 'productName',
align: 'center',
},
{
title: '品类',
dataIndex: 'category',
align: 'center',
},
{
title: '品牌',
dataIndex: 'brand',
align: 'center',
},
{
title: '单位',
dataIndex: 'unit',
align: 'center',
},
{
title: '订单数量',
dataIndex: 'purchaseCount',
align: 'center',
},
{
title: '已维修数量',
dataIndex: 'repairCount',
align: 'center',
},
];
// 获取订单列表
getOrderList = async () => {
const { page, size, searchVal } = this.state;
......@@ -638,7 +564,7 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
<div className={styles['order-body']}>
<NestTable
NestColumns={[this.tableColumn, this.childTableColumn]}
NestColumns={[]}
className="common_tb"
rowClassName={(_, index) => (index % 2) === 0 && 'tb_bg'}
rowKey="id"
......
......@@ -112,7 +112,7 @@ export interface goodItem {
*/
ruleConfigurationId?: number
}[]
};
}
export interface OrderListParams {
orderNo: string;
......@@ -120,9 +120,9 @@ export interface OrderListParams {
startCreateTime: string;
endCreateTime: string;
type: number;
};
}
export interface OrderListRes {
data: { [key: string]: any }[];
totalCount: number;
};
\ No newline at end of file
}
\ No newline at end of file
import React, { useState, useEffect, useRef } from 'react';
import React, { useState, useEffect, useMemo } from 'react';
import { Button, Card, Spin, Badge, message } from 'antd';
import { ColumnType } from 'antd/lib/table/interface';
import { DeleteOutlined } from '@ant-design/icons';
import { Radio, ArrayTable } from '@formily/antd-components';
import { ArrayTable } from '@formily/antd-components';
import { history, Link, Prompt } from 'umi';
import moment from 'moment';
import { findLastIndex } from 'lodash';
......@@ -11,20 +10,25 @@ import { SaveOutlined, PlusOutlined } from '@ant-design/icons';
import { createFormActions, FormEffectHooks } from '@formily/antd';
import { PublicApi } from '@/services/api';
import { GetAsReplaceGoodsPageReturnedGoodsResponseDetail } from '@/services/AfterServiceApi';
import { normalizeFiledata, FileData, isJSONStr } from '@/utils';
import { normalizeFiledata, FileData } from '@/utils';
import {
PurchaseOrderOutWorkStateTexts,
ORDER_TYPE2,
ORDER_TYPE2_POINTS,
ORDER_TYPE2_CHANNEL_POINTS,
} from '@/constants';
import {
ORDER_TYPE_INQUIRY_CONTRACT,
ORDER_TYPE_BIDDING_CONTRACT,
ORDER_TYPE_TENDER_CONTRACT,
} from '@/constants/order';
import ReutrnEle from '@/components/ReturnEle';
import StatusTag from '@/components/StatusTag';
import NiceForm from '@/components/NiceForm';
import GoodsDrawer from '../../../../components/GoodsDrawer';
import { OrderListRes } from '../../../../components/GoodsDrawer/interface';
import AddressFormItem from '../../../../components/AddressFormItem';
import { addBillSchema } from './schema';
import { addSchema } from './schema';
import { createEffects } from './effects';
import {
EXCHANGE_OUTER_STATUS_TAG_MAP,
......@@ -36,6 +40,7 @@ const {
onFormInputChange$,
onFormInit$,
onFieldInputChange$,
onFieldValueChange$,
} = FormEffectHooks;
interface BillsFormProps {
......@@ -99,7 +104,13 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
const [goodsValue, setGoodsValue] = useState([]);
const [submitLoading, setSubmitLoading] = useState(false);
const [visibleGoodsDrawer, setVisibleGoodsDrawer] = useState(false);
const [applyType, setApplyType] = useState(1);
const [orderTypeValue, setOrderTypeValue] = useState(0);
const isMateriel = (
orderTypeValue === ORDER_TYPE_INQUIRY_CONTRACT
|| orderTypeValue === ORDER_TYPE_BIDDING_CONTRACT
|| orderTypeValue === ORDER_TYPE_TENDER_CONTRACT
);
const tableColumn: ColumnType<any>[] = [
{
......@@ -135,7 +146,13 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
align: 'center',
render: text => ORDER_TYPE2[text],
},
];
isMateriel ? {
title: '合同编号',
dataIndex: 'type2',
align: 'center',
render: () => 'H-13-00002',
} : null,
].filter(Boolean) as ColumnType<any>[];
const childTableColumn = (record): ColumnType<any>[] => {
const isPointsOrder = record.type === ORDER_TYPE2_POINTS || record.type === ORDER_TYPE2_CHANNEL_POINTS;
......@@ -189,11 +206,6 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
];
};
const setColumnsTitle = (orderType: number) => {
const isPointsOrder = orderType === ORDER_TYPE2_POINTS || orderType === ORDER_TYPE2_CHANNEL_POINTS;
setApplyType(isPointsOrder ? 2 : 1);
};
// 根据供应会员获取订单列表
const getOrderList = (params): Promise<OrderListRes> => {
const supplierMemberValue = addSchemaAction.getFieldValue('supplierMember');
......@@ -203,7 +215,8 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
orderNo: detailInfo.orderNo,
...params,
supplyMembersId: supplierMemberValue[0].memberId,
supplyMembersRoleId: supplierMemberValue[0].roleId,
supplyMembersRoleId: supplierMemberValue[0].roleId,
type: orderTypeValue,
}).then(res => {
if (res.code === 1000) {
resolve(res.data);
......@@ -244,7 +257,6 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
outerTaskList,
replaceBatch,
replaceId,
orderType,
...rest
} = res.data;
......@@ -295,13 +307,12 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
remaining: item.purchaseCount || 0, // 已换货数量,这里取 采购数量判断即可
id: item.orderRecordId,
taskType,
orderType,
orderType: rest.orderType,
},
})),
...rest,
});
setGoodsValue(goodsDetailList.map(item => item.orderRecordId));
setColumnsTitle(orderType);
}
}).finally(() => {
setInfoLoading(false);
......@@ -362,12 +373,17 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
}, []);
const handleAddGoods = () => {
const supplierMemberValue = addSchemaAction.getFieldValue('supplierMember');
const supplierMemberVal = addSchemaAction.getFieldValue('supplierMember');
const orderTypeVal = addSchemaAction.getFieldValue('orderType');
if (!supplierMemberValue || !supplierMemberValue.length) {
if (!supplierMemberVal || !supplierMemberVal.length) {
message.error('请先选择供应会员');
return;
}
if (!orderTypeVal) {
message.error('请先选择售后订单类型');
return;
}
setVisibleGoodsDrawer(true);
};
......@@ -379,7 +395,7 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
onClick={handleAddGoods}
type="dashed"
>
选择换货商品
{!isMateriel ? '选择换货商品' : '选择换货物料'}
</Button>
) : null;
......@@ -521,7 +537,6 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
const handleGoodsConfirm = values => {
const preValues = addSchemaAction.getFieldValue('replaceGoodsList');
const value = [];
const first = values.length ? values[0] : {};
values.forEach(item => {
const atom = {
......@@ -550,7 +565,6 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
if (preValues.length) {
newData.reverse();
}
setColumnsTitle(first.orderType);
addSchemaAction.setFieldValue('replaceGoodsList', newData);
};
......@@ -566,6 +580,8 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
<Badge color={EXCHANGE_INNER_STATUS_BADGE_MAP[detailInfo?.innerStatus]} text={detailInfo?.innerStatusName} />
);
const schemaValue = useMemo(() => addSchema(orderTypeValue), [orderTypeValue]);
return (
<Spin spinning={infoLoading}>
<PageHeaderWrapper
......@@ -635,15 +651,19 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
onFieldInputChange$('supplierMember').subscribe(() => {
setGoodsValue([]);
});
onFieldValueChange$('orderType').subscribe(fieldState => {
setOrderTypeValue(fieldState.value);
});
}}
onSubmit={handleSubmit}
actions={addSchemaAction}
schema={addBillSchema(applyType)}
schema={schemaValue}
/>
</Card>
<GoodsDrawer
title="选择换货商品"
title={!isMateriel ? '选择换货商品' : '选择换货物料'}
afterType={2}
visible={visibleGoodsDrawer}
fetchOrderList={getOrderList}
......
......@@ -2,8 +2,19 @@ import { ISchema } from '@formily/antd';
import Search from '@/components/NiceForm/components/Search';
import Submit from '@/components/NiceForm/components/Submit';
import { PATTERN_MAPS } from '@/constants/regExp';
import { UPLOAD_TYPE, DELIVERY_TYPE_ENUM } from '@/constants';
import { PublicApi } from '@/services/api';
import { GlobalConfig } from '@/global/config';
import {
UPLOAD_TYPE,
DELIVERY_TYPE_ENUM,
ORDER_TYPE2_POINTS,
ORDER_TYPE2_CHANNEL_POINTS,
} from '@/constants';
import {
ORDER_TYPE_INQUIRY_CONTRACT,
ORDER_TYPE_BIDDING_CONTRACT,
ORDER_TYPE_TENDER_CONTRACT,
} from '@/constants/order';
// 供应会员列表列
const supplierColumns = [
......@@ -68,397 +79,455 @@ const supplierSchema: ISchema = {
},
};
/**
*
* @param type 类型目前只有 1.普通的 跟 2.积分的
*/
export const addBillSchema = (applyType: number): ISchema => ({
type: 'object',
properties: {
REPOSIT_TABS: {
type: 'object',
'x-component': 'tab',
'x-component-props': {
type: 'card',
},
properties: {
'tab-1': {
type: 'object',
'x-component': 'tabpane',
'x-component-props': {
tab: '基本信息',
},
properties: {
MEGA_LAYOUT1: {
type: 'object',
'x-component': 'Mega-Layout',
'x-component-props': {
labelCol: 4,
wrapperCol: 12,
labelAlign: 'left',
},
properties: {
applyAbstract: {
type: 'string',
title: '申请单摘要',
'x-rules': [
{
required: true,
message: '请填写申请单摘要',
},
{
limitByte: true, // 自定义校验规则
maxByte: 60,
}
],
const orderTypeArr = GlobalConfig.web.orderType.map((item) => ({
label: item.platformWayName,
value: item.id,
}));
export const addSchema = (orderType: number): ISchema => {
const isPoints = orderType === ORDER_TYPE2_POINTS || orderType === ORDER_TYPE2_CHANNEL_POINTS;
const isMateriel = (
orderType === ORDER_TYPE_INQUIRY_CONTRACT
|| orderType === ORDER_TYPE_BIDDING_CONTRACT
|| orderType === ORDER_TYPE_TENDER_CONTRACT
);
return {
type: 'object',
properties: {
REPOSIT_TABS: {
type: 'object',
'x-component': 'tab',
'x-component-props': {
type: 'card',
},
properties: {
'tab-1': {
type: 'object',
'x-component': 'tabpane',
'x-component-props': {
tab: '基本信息',
},
properties: {
MEGA_LAYOUT1: {
type: 'object',
'x-component': 'Mega-Layout',
'x-component-props': {
labelCol: 4,
wrapperCol: 12,
labelAlign: 'left',
},
// 这是用 Mega-Layout 设置独立作用域,不然会被 Form 的布局影响到弹窗的布局
MEGA_LAYOUT1_1: {
type: 'object',
'x-component': 'Mega-Layout',
'x-component-props': {
wrapperCol: 24,
properties: {
applyAbstract: {
type: 'string',
title: '申请单摘要',
'x-rules': [
{
required: true,
message: '请填写申请单摘要',
},
{
limitByte: true, // 自定义校验规则
maxByte: 60,
}
],
},
properties: {
supplierMember: {
type: 'string',
title: '供应会员',
'x-component': 'CustomRelevance',
'x-component-props': {
title: '关联',
tip: '请选择对应单据',
modalProps: {
title: '选择会员',
},
columns: supplierColumns,
fetchTableData: getSupplier,
formilyProps: {
ctx: {
schema: supplierSchema,
components: {
Search,
Submit,
},
effects: ($, actions) => {
},
inline: false,
}
},
tableProps: {
rowKey: 'id',
lableKey: 'name',
// 这是用 Mega-Layout 设置独立作用域,不然会被 Form 的布局影响到弹窗的布局
MEGA_LAYOUT1_1: {
type: 'object',
'x-component': 'Mega-Layout',
'x-component-props': {
wrapperCol: 24,
},
properties: {
supplierMember: {
type: 'string',
title: '供应会员',
'x-component': 'CustomRelevance',
'x-component-props': {
title: '关联',
tip: '请选择对应单据',
modalProps: {
title: '选择会员',
},
columns: supplierColumns,
fetchTableData: getSupplier,
formilyProps: {
ctx: {
schema: supplierSchema,
components: {
Search,
Submit,
},
effects: ($, actions) => {
},
inline: false,
}
},
tableProps: {
rowKey: 'id',
lableKey: 'name',
},
},
'x-mega-props': {
wrapperCol: 12,
},
'x-rules': [
{
required: true,
message: '请选择供应会员',
},
],
},
'x-mega-props': {
wrapperCol: 12,
},
'x-rules': [
{
required: true,
message: '请选择供应会员',
},
],
},
},
orderType: {
type: 'string',
title: '售后订单类型',
enum: orderTypeArr,
'x-component-props': {
placeholder: '请选择',
},
required: true,
},
applyNo: {
type: 'string',
title: '申请单号',
'x-component': 'Text',
},
},
applyNo: {
type: 'string',
title: '申请单号',
'x-component': 'Text',
},
applyTime: {
type: 'string',
title: '单据时间',
'x-component': 'Text',
},
outerStatus: {
type: 'string',
title: '外部状态',
'x-component': 'Children',
'x-component-props': {
children: '{{OuterStatus}}'
applyTime: {
type: 'string',
title: '单据时间',
'x-component': 'Text',
},
},
innerStatus: {
type: 'string',
title: '内部状态',
'x-component': 'Children',
'x-component-props': {
children: '{{InnerStatus}}'
outerStatus: {
type: 'string',
title: '外部状态',
'x-component': 'Children',
'x-component-props': {
children: '{{OuterStatus}}'
},
},
},
innerStatus: {
type: 'string',
title: '内部状态',
'x-component': 'Children',
'x-component-props': {
children: '{{InnerStatus}}'
},
},
},
},
},
},
},
'tab-2': {
type: 'object',
'x-component': 'tabpane',
'x-component-props': {
tab: '单据明细',
},
properties: {
MEGA_LAYOUT2: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
labelCol: 4,
labelAlign: 'left',
},
properties: {
addBtn: {
type: 'object',
'x-component': 'Children',
'x-component-props': {
children: '{{TableAddButton}}'
},
'tab-2': {
type: 'object',
'x-component': 'tabpane',
'x-component-props': {
tab: '单据明细',
},
properties: {
MEGA_LAYOUT2: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
labelCol: 4,
labelAlign: 'left',
},
replaceGoodsList: {
type: 'array',
'x-component': 'ArrayTable',
'x-component-props': {
renderAddition: () => null,
renderRemove: '{{renderListTableRemove}}',
renderMoveDown: () => null,
renderMoveUp: () => null,
operationsWidth: 100,
operations: {
align: 'center',
},
properties: {
addBtn: {
type: 'object',
'x-component': 'Children',
'x-component-props': {
children: '{{TableAddButton}}'
},
},
'x-rules': [
{
required: true,
message: '请选择换货商品',
replaceGoodsList: {
type: 'array',
'x-component': 'ArrayTable',
'x-component-props': {
renderAddition: () => null,
renderRemove: '{{renderListTableRemove}}',
renderMoveDown: () => null,
renderMoveUp: () => null,
operationsWidth: 100,
operations: {
align: 'center',
},
},
],
items: {
type: 'object',
properties: {
orderNo: {
type: 'string',
title: '订单号',
'x-component': 'OrderNo',
},
productId: {
type: 'string',
title: '商品ID',
'x-component': 'Text',
},
productName: {
type: 'string',
title: '商品名称',
'x-component': 'Text',
},
category: {
type: 'string',
title: '品类',
'x-component': 'Text',
},
brand: {
type: 'string',
title: '品牌',
'x-component': 'Text',
'x-rules': [
{
required: true,
message: !isMateriel ? '请选择换货商品' : '请选择换货物料',
},
unit: {
type: 'string',
title: '单位',
'x-component': 'Text',
},
purchaseCount: {
type: 'string',
title: applyType !== 2 ? '采购数量' : '兑换数量',
'x-component': 'Text',
},
purchasePrice: {
type: 'string',
title: applyType !== 2 ? '采购单价' : '所需积分',
'x-component': 'Text',
},
purchaseAmount: {
type: 'string',
title: applyType !== 2 ? '采购金额' : '所需积分小计',
'x-component': 'Text',
},
replaceCount: {
type: 'string',
title: '换货数量',
'x-component-props': {
allowClear: true,
style: {
maxWidth: 150,
},
},
'x-rules': [
{
required: true,
message: '请填写换货数量',
},
{
pattern: PATTERN_MAPS.weight,
message: '请填写正数,最多保留3位小数',
},
],
},
replaceReason: {
type: 'string',
title: '换货原因',
'x-component-props': {
allowClear: true,
style: {
maxWidth: 150,
],
items: {
type: 'object',
properties: {
...(
!isMateriel ? ({
orderNo: {
type: 'string',
title: '订单号',
'x-component': 'OrderNo',
},
productId: {
type: 'string',
title: '商品ID',
'x-component': 'Text',
},
productName: {
type: 'string',
title: '商品名称',
'x-component': 'Text',
},
category: {
type: 'string',
title: '品类',
'x-component': 'Text',
},
brand: {
type: 'string',
title: '品牌',
'x-component': 'Text',
},
unit: {
type: 'string',
title: '单位',
'x-component': 'Text',
},
}) : ({
orderNo: {
type: 'string',
title: '订单号',
'x-component': 'OrderNo',
},
productId: {
type: 'string',
title: '物料编号',
'x-component': 'Text',
},
productName: {
type: 'string',
title: '物料名称、规格',
'x-component': 'Text',
},
category: {
type: 'string',
title: '品类',
'x-component': 'Text',
},
brand: {
type: 'string',
title: '品牌',
'x-component': 'Text',
},
unit: {
type: 'string',
title: '单位',
'x-component': 'Text',
},
aaa: {
type: 'string',
title: orderType !== ORDER_TYPE_TENDER_CONTRACT ? '关联报价商品ID、名称、规格、品类、品牌' : '关联投标商品ID、名称、规格、品类、品牌',
'x-component': 'Text',
},
})
),
purchaseCount: {
type: 'string',
title: !isPoints ? '采购数量' : '兑换数量',
'x-component': 'Text',
},
purchasePrice: {
type: 'string',
title: !isPoints ? '采购单价' : '所需积分',
'x-component': 'Text',
},
purchaseAmount: {
type: 'string',
title: !isPoints ? '采购金额' : '所需积分小计',
'x-component': 'Text',
},
replaceCount: {
type: 'string',
title: '换货数量',
'x-component-props': {
allowClear: true,
style: {
maxWidth: 150,
},
},
},
'x-rules': [
{
required: true,
message: '请填写换货原因',
'x-rules': [
{
required: true,
message: '请填写换货数量',
},
{
pattern: PATTERN_MAPS.weight,
message: '请填写正数,最多保留3位小数',
},
],
},
replaceReason: {
type: 'string',
title: '换货原因',
'x-component-props': {
allowClear: true,
style: {
maxWidth: 150,
},
},
{
limitByte: true, // 自定义校验规则
maxByte: 60,
}
],
},
// 不用于展示,只用于收集值
id: {
type: 'string',
display: false,
},
// 其他数据,不用于展示,只用于收集值
extraData: {
type: 'string',
display: false,
'x-rules': [
{
required: true,
message: '请填写换货原因',
},
{
limitByte: true, // 自定义校验规则
maxByte: 60,
}
],
},
// 不用于展示,只用于收集值
id: {
type: 'string',
display: false,
},
// 其他数据,不用于展示,只用于收集值
extraData: {
type: 'string',
display: false,
},
},
},
}
}
},
},
},
},
},
},
'tab-3': {
type: 'object',
'x-component': 'tabpane',
'x-component-props': {
tab: '相关附件',
},
properties: {
MEGA_LAYOUT3: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
labelCol: 4,
labelAlign: 'left',
},
properties: {
proofFileList: {
title: '附件',
'x-component': 'AntUpload',
'x-component-props': {
action: '/api/file/file/upload/prefix',
data: {
fileType: UPLOAD_TYPE,
prefix: '/afterService/returnApplication/',
},
beforeUpload: '{{beforeUpload}}',
accept: '.xls, .xlsx, .doc, .docx, .wps, .pdf, .jpg, .png, .jpeg',
},
'x-rules': [
{
required: false,
message: '请上传附件',
'tab-3': {
type: 'object',
'x-component': 'tabpane',
'x-component-props': {
tab: '相关附件',
},
properties: {
MEGA_LAYOUT3: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
labelCol: 4,
labelAlign: 'left',
},
properties: {
proofFileList: {
title: '附件',
'x-component': 'AntUpload',
'x-component-props': {
action: '/api/file/file/upload/prefix',
data: {
fileType: UPLOAD_TYPE,
prefix: '/afterService/returnApplication/',
},
beforeUpload: '{{beforeUpload}}',
accept: '.xls, .xlsx, .doc, .docx, .wps, .pdf, .jpg, .png, .jpeg',
},
],
description: '一次上传一个文件,每个附件大小不能超过20M',
'x-rules': [
{
required: false,
message: '请上传附件',
},
],
description: '一次上传一个文件,每个附件大小不能超过20M',
},
},
},
},
},
},
'tab-4': {
type: 'object',
'x-component': 'tabpane',
'x-component-props': {
tab: '退货收货地址',
},
},
properties: {
MEGA_LAYOUT4: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
labelCol: 4,
wrapperCol: 12,
labelAlign: 'left',
},
properties: {
deliveryType: {
title: '配送方式',
type: 'string',
enum: DELIVERY_TYPE_ENUM,
'x-component-props': {
placeholder: '请选择',
'tab-4': {
type: 'object',
'x-component': 'tabpane',
'x-component-props': {
tab: '退货收货地址',
},
properties: {
MEGA_LAYOUT4: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
labelCol: 4,
wrapperCol: 12,
labelAlign: 'left',
},
properties: {
deliveryType: {
title: '配送方式',
type: 'string',
enum: DELIVERY_TYPE_ENUM,
'x-component-props': {
placeholder: '请选择',
},
'x-rules': [
{
required: true,
message: '请选择配送方式',
},
],
},
'x-rules': [
{
required: true,
message: '请选择配送方式',
// 退货发货地址
shippingAddress: {
title: '退货发货地址',
type: 'string',
visible: false,
'x-component': 'AddressFormItem',
'x-component-props': {
dataSource: [],
},
],
},
// 退货发货地址
shippingAddress: {
title: '退货发货地址',
type: 'string',
visible: false,
'x-component': 'AddressFormItem',
'x-component-props': {
dataSource: [],
'x-rules': [
{
required: true,
message: '请选择退货发货地址',
},
],
},
'x-rules': [
{
required: true,
message: '请选择退货发货地址',
},
],
},
// 退货自提地址
pickupAddress: {
title: '退货自提地址',
type: 'string',
visible: false,
'x-component': 'AddressFormItem',
'x-component-props': {
dataSource: [],
// 退货自提地址
pickupAddress: {
title: '退货自提地址',
type: 'string',
visible: false,
'x-component': 'AddressFormItem',
'x-component-props': {
dataSource: [],
},
'x-rules': [
{
required: true,
message: '请选择退货自提地址',
},
],
},
'x-rules': [
{
required: true,
message: '请选择退货自提地址',
},
],
},
// 换货收货地址
deliveryAddress: {
title: '换货收货地址',
type: 'string',
'x-component': 'AddressFormItem',
'x-component-props': {
dataSource: [],
// 换货收货地址
deliveryAddress: {
title: '换货收货地址',
type: 'string',
'x-component': 'AddressFormItem',
'x-component-props': {
dataSource: [],
},
'x-rules': [
{
required: true,
message: '请选择换货收货地址',
},
],
},
'x-rules': [
{
required: true,
message: '请选择换货收货地址',
},
],
},
},
},
},
},
},
},
},
},
});
\ No newline at end of file
};
};
\ No newline at end of file
......@@ -2,16 +2,16 @@
* @Author: XieZhiXiong
* @Date: 2020-11-03 18:30:47
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-01-21 16:26:00
* @LastEditTime: 2021-04-22 15:09:55
* @Description: 联动逻辑相关
*/
import { Modal } from 'antd';
import { FormEffectHooks, FormPath } from '@formily/antd';
import { useLinkageUtils } from '@/utils/formEffectUtils';
import {
} from '@/constants';
import { PublicApi } from '@/services/api';
ORDER_TYPE_INQUIRY_CONTRACT,
ORDER_TYPE_BIDDING_CONTRACT,
ORDER_TYPE_TENDER_CONTRACT,
} from '@/constants/order';
import { useLinkageUtils } from '@/utils/formEffectUtils';
const {
onFieldInputChange$,
......@@ -25,7 +25,7 @@ export const useBusinessEffects = (context, actions) => {
getFieldState,
setFieldState,
} = actions;
// const linkage = useLinkageUtils();
const linkage = useLinkageUtils();
// 校验维修数量
onFieldInputChange$('repairGoodsList.*.repairCount').subscribe(fieldState => {
......@@ -53,8 +53,8 @@ export const useBusinessEffects = (context, actions) => {
// );
});
// 供应会员联动 单据明细
onFieldInputChange$('supplierMember').subscribe(fieldState => {
// 供应会员、订单类型 联动 单据明细
onFieldInputChange$('*(supplierMember,orderType)').subscribe(fieldState => {
const replaceGoodsListValue = getFieldValue('repairGoodsList');
if (replaceGoodsListValue && replaceGoodsListValue.length) {
setFieldValue('repairGoodsList', []);
......
import React, { useState, useEffect, useRef } from 'react';
import React, { useState, useEffect, useMemo } from 'react';
import { Button, Card, Spin, Badge, message } from 'antd';
import { ColumnType } from 'antd/lib/table/interface';
import { DeleteOutlined } from '@ant-design/icons';
import { Radio, ArrayTable } from '@formily/antd-components';
import { ArrayTable } from '@formily/antd-components';
import { history, Prompt, Link } from 'umi';
import moment from 'moment';
import { findLastIndex } from 'lodash';
......@@ -11,13 +12,22 @@ import { createFormActions, FormEffectHooks } from '@formily/antd';
import { PublicApi } from '@/services/api';
import { GetAsRepairGoodsPageRepairGoodsResponse } from '@/services/AfterServiceApi';
import { normalizeFiledata, FileData, isJSONStr } from '@/utils';
import {
PurchaseOrderOutWorkStateTexts,
ORDER_TYPE2,
} from '@/constants';
import {
ORDER_TYPE_INQUIRY_CONTRACT,
ORDER_TYPE_BIDDING_CONTRACT,
ORDER_TYPE_TENDER_CONTRACT,
} from '@/constants/order';
import ReutrnEle from '@/components/ReturnEle';
import NiceForm from '@/components/NiceForm';
import StatusTag from '@/components/StatusTag';
import GoodsDrawer from '../../../../components/GoodsDrawer';
import { OrderListRes } from '../../../../components/GoodsDrawer/interface';
import AddressFormItem from '../../../../components/AddressFormItem';
import { addBillSchema } from './schema';
import { addSchema } from './schema';
import { createEffects } from './effects';
import {
REPAIR_OUTER_STATUS_TAG_MAP,
......@@ -27,6 +37,7 @@ import {
const addSchemaAction = createFormActions();
const {
onFormInputChange$,
onFieldValueChange$,
onFormInit$,
} = FormEffectHooks;
......@@ -84,6 +95,93 @@ const RepairForm: React.FC<BillsFormProps> = ({
const [goodsValue, setGoodsValue] = useState([]);
const [submitLoading, setSubmitLoading] = useState(false);
const [visibleDrawer, setVisibleDrawer] = useState(false);
const [orderTypeValue, setOrderTypeValue] = useState(0);
const isMateriel = (
orderTypeValue === ORDER_TYPE_INQUIRY_CONTRACT
|| orderTypeValue === ORDER_TYPE_BIDDING_CONTRACT
|| orderTypeValue === ORDER_TYPE_TENDER_CONTRACT
);
const tableColumn: ColumnType<any>[] = [
{
title: '订单号',
dataIndex: 'orderNo',
align: 'center',
},
{
title: '订单摘要',
dataIndex: 'orderThe',
align: 'center',
},
{
title: '供应会员',
dataIndex: 'supplyMembersName',
align: 'center',
},
{
title: '下单时间',
dataIndex: 'createTime',
align: 'center',
render: text => moment(text).format('YYYY-MM-DD HH:mm:ss'),
},
{
title: '订单状态',
dataIndex: 'externalState',
align: 'center',
render: text => PurchaseOrderOutWorkStateTexts[text],
},
{
title: '订单类型',
dataIndex: 'type',
align: 'center',
render: text => ORDER_TYPE2[text],
},
isMateriel ? {
title: '合同编号',
dataIndex: 'type2',
align: 'center',
render: () => 'H-13-00002',
} : null,
].filter(Boolean) as ColumnType<any>[];
const childTableColumn: ColumnType<any>[] = [
{
title: 'ID',
dataIndex: 'productId',
align: 'center',
},
{
title: '商品名称',
dataIndex: 'productName',
align: 'center',
},
{
title: '品类',
dataIndex: 'category',
align: 'center',
},
{
title: '品牌',
dataIndex: 'brand',
align: 'center',
},
{
title: '单位',
dataIndex: 'unit',
align: 'center',
},
{
title: '订单数量',
dataIndex: 'purchaseCount',
align: 'center',
},
{
title: '已维修数量',
dataIndex: 'repairCount',
align: 'center',
},
];
// 获取维修申请详情
const getDetailInfo = () => {
......@@ -142,6 +240,7 @@ const RepairForm: React.FC<BillsFormProps> = ({
setInfoLoading(true);
PublicApi.getOrderProcurementOrderDetails({
id: `${orderId}`,
orderNo: '',
})
.then(res => {
if (res.code === 1000) {
......@@ -221,7 +320,8 @@ const RepairForm: React.FC<BillsFormProps> = ({
orderNo: detailInfo.orderNo,
...params,
supplyMembersId: supplierMemberValue[0].memberId,
supplyMembersRoleId: supplierMemberValue[0].roleId,
supplyMembersRoleId: supplierMemberValue[0].roleId,
type: orderTypeValue,
}).then(res => {
if (res.code === 1000) {
resolve(res.data);
......@@ -240,24 +340,28 @@ const RepairForm: React.FC<BillsFormProps> = ({
}, []);
const handleAddGoods = () => {
const supplierMemberValue = addSchemaAction.getFieldValue('supplierMember');
const supplierMemberVal = addSchemaAction.getFieldValue('supplierMember');
const orderTypeVal = addSchemaAction.getFieldValue('orderType');
if (!supplierMemberValue || !supplierMemberValue.length) {
if (!supplierMemberVal || !supplierMemberVal.length) {
message.error('请先选择供应会员');
return;
}
if (!orderTypeVal) {
message.error('请先选择售后订单类型');
return;
}
setVisibleDrawer(true);
};
const TableAddButton = isEdit || !id ? (
<Button
style={{ marginBottom: 16 }}
block
icon={<PlusOutlined />}
onClick={handleAddGoods}
type="dashed"
block
>
选择维修商品
{!isMateriel ? '选择维修商品' : '选择维修物料'}
</Button>
) : null;
......@@ -385,6 +489,8 @@ const RepairForm: React.FC<BillsFormProps> = ({
<Badge color={REPAIR_INNER_STATUS_BADGE_MAP[detailInfo?.innerStatus]} text={detailInfo?.innerStatusName} />
);
const schemaValue = useMemo(() => addSchema(orderTypeValue), [orderTypeValue]);
return (
<Spin spinning={infoLoading || repairGoodsLoading}>
<PageHeaderWrapper
......@@ -453,14 +559,19 @@ const RepairForm: React.FC<BillsFormProps> = ({
});
}
});
onFieldValueChange$('orderType').subscribe(fieldState => {
setOrderTypeValue(fieldState.value);
});
}}
onSubmit={handleSubmit}
actions={addSchemaAction}
schema={addBillSchema}
schema={schemaValue}
/>
</Card>
<GoodsDrawer
title={!isMateriel ? '选择维修商品' : '选择维修物料'}
afterType={4}
visible={visibleDrawer}
fetchOrderList={getOrderList}
......@@ -468,6 +579,9 @@ const RepairForm: React.FC<BillsFormProps> = ({
onConfirm={handleGoodsConfirm}
checked={goodsValue}
onChange={handleGoodsChange}
nestProps={{
NestColumns: [tableColumn, childTableColumn],
}}
searchable={!orderId}
/>
......
......@@ -4,6 +4,12 @@ import Submit from '@/components/NiceForm/components/Submit';
import { PATTERN_MAPS } from '@/constants/regExp';
import { UPLOAD_TYPE } from '@/constants';
import { PublicApi } from '@/services/api';
import { GlobalConfig } from '@/global/config';
import {
ORDER_TYPE_INQUIRY_CONTRACT,
ORDER_TYPE_BIDDING_CONTRACT,
ORDER_TYPE_TENDER_CONTRACT,
} from '@/constants/order';
// 供应会员列表列
const supplierColumns = [
......@@ -68,331 +74,392 @@ const supplierSchema: ISchema = {
},
};
export const addBillSchema: ISchema = {
type: 'object',
properties: {
REPOSIT_TABS: {
type: 'object',
'x-component': 'tab',
'x-component-props': {
type: 'card',
},
properties: {
'tab-1': {
type: 'object',
'x-component': 'tabpane',
'x-component-props': {
tab: '基本信息',
},
properties: {
MEGA_LAYOUT1: {
type: 'object',
'x-component': 'Mega-Layout',
'x-component-props': {
labelCol: 4,
wrapperCol: 12,
labelAlign: 'left',
},
properties: {
applyAbstract: {
type: 'string',
title: '申请单摘要',
'x-rules': [
{
required: true,
message: '请填写申请单摘要',
},
{
limitByte: true, // 自定义校验规则
maxByte: 60,
}
],
const orderTypeArr = GlobalConfig.web.orderType.map((item) => ({
label: item.platformWayName,
value: item.id,
}));
export const addSchema = (orderType: number): ISchema => {
const isMateriel = (
orderType === ORDER_TYPE_INQUIRY_CONTRACT
|| orderType === ORDER_TYPE_BIDDING_CONTRACT
|| orderType === ORDER_TYPE_TENDER_CONTRACT
);
return {
type: 'object',
properties: {
REPOSIT_TABS: {
type: 'object',
'x-component': 'tab',
'x-component-props': {
type: 'card',
},
properties: {
'tab-1': {
type: 'object',
'x-component': 'tabpane',
'x-component-props': {
tab: '基本信息',
},
properties: {
MEGA_LAYOUT1: {
type: 'object',
'x-component': 'Mega-Layout',
'x-component-props': {
labelCol: 4,
wrapperCol: 12,
labelAlign: 'left',
},
// 这是用 Mega-Layout 设置独立作用域,不然会被 Form 的布局影响到弹窗的布局
MEGA_LAYOUT1_1: {
type: 'object',
'x-component': 'Mega-Layout',
'x-component-props': {
wrapperCol: 24,
properties: {
applyAbstract: {
type: 'string',
title: '申请单摘要',
'x-rules': [
{
required: true,
message: '请填写申请单摘要',
},
{
limitByte: true, // 自定义校验规则
maxByte: 60,
}
],
},
properties: {
supplierMember: {
type: 'string',
title: '供应会员',
'x-component': 'CustomRelevance',
'x-component-props': {
title: '关联',
tip: '请选择对应单据',
modalProps: {
title: '选择会员',
},
columns: supplierColumns,
fetchTableData: getSupplier,
formilyProps: {
ctx: {
schema: supplierSchema,
components: {
Search,
Submit,
},
effects: ($, actions) => {
},
inline: false,
}
},
tableProps: {
rowKey: 'id',
lableKey: 'name',
// 这是用 Mega-Layout 设置独立作用域,不然会被 Form 的布局影响到弹窗的布局
MEGA_LAYOUT1_1: {
type: 'object',
'x-component': 'Mega-Layout',
'x-component-props': {
wrapperCol: 24,
},
properties: {
supplierMember: {
type: 'string',
title: '供应会员',
'x-component': 'CustomRelevance',
'x-component-props': {
title: '关联',
tip: '请选择对应单据',
modalProps: {
title: '选择会员',
},
columns: supplierColumns,
fetchTableData: getSupplier,
formilyProps: {
ctx: {
schema: supplierSchema,
components: {
Search,
Submit,
},
effects: ($, actions) => {
},
inline: false,
}
},
tableProps: {
rowKey: 'id',
lableKey: 'name',
},
},
'x-mega-props': {
wrapperCol: 12,
},
'x-rules': [
{
required: true,
message: '请选择供应会员',
},
],
},
'x-mega-props': {
wrapperCol: 12,
},
'x-rules': [
{
required: true,
message: '请选择供应会员',
},
],
},
},
orderType: {
type: 'string',
title: '售后订单类型',
enum: orderTypeArr,
'x-component-props': {
placeholder: '请选择',
},
required: true,
},
applyNo: {
type: 'string',
title: '申请单号',
'x-component': 'Text',
},
},
applyNo: {
type: 'string',
title: '申请单号',
'x-component': 'Text',
},
applyTime: {
type: 'string',
title: '单据时间',
'x-component': 'Text',
},
outerStatus: {
type: 'string',
title: '外部状态',
'x-component': 'Children',
'x-component-props': {
children: '{{OuterStatus}}'
applyTime: {
type: 'string',
title: '单据时间',
'x-component': 'Text',
},
},
innerStatus: {
type: 'string',
title: '内部状态',
'x-component': 'Children',
'x-component-props': {
children: '{{InnerStatus}}'
outerStatus: {
type: 'string',
title: '外部状态',
'x-component': 'Children',
'x-component-props': {
children: '{{OuterStatus}}'
},
},
},
innerStatus: {
type: 'string',
title: '内部状态',
'x-component': 'Children',
'x-component-props': {
children: '{{InnerStatus}}'
},
},
},
},
},
},
},
'tab-2': {
type: 'object',
'x-component': 'tabpane',
'x-component-props': {
tab: '单据明细',
},
properties: {
MEGA_LAYOUT2: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
labelCol: 4,
labelAlign: 'left',
},
properties: {
addBtn: {
type: 'object',
'x-component': 'Children',
'x-component-props': {
children: '{{TableAddButton}}'
},
'tab-2': {
type: 'object',
'x-component': 'tabpane',
'x-component-props': {
tab: '单据明细',
},
properties: {
MEGA_LAYOUT2: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
labelCol: 4,
labelAlign: 'left',
},
repairGoodsList: {
type: 'array',
'x-component': 'ArrayTable',
'x-component-props': {
renderAddition: () => null,
renderRemove: '{{renderListTableRemove}}',
renderMoveDown: () => null,
renderMoveUp: () => null,
operationsWidth: 100,
operations: {
align: 'center',
},
properties: {
addBtn: {
type: 'object',
'x-component': 'Children',
'x-component-props': {
children: '{{TableAddButton}}',
},
},
'x-rules': [
{
required: true,
message: '请选择维修商品',
repairGoodsList: {
type: 'array',
'x-component': 'ArrayTable',
'x-component-props': {
renderAddition: () => null,
renderRemove: '{{renderListTableRemove}}',
renderMoveDown: () => null,
renderMoveUp: () => null,
operationsWidth: 100,
operations: {
align: 'center',
},
},
],
items: {
type: 'object',
properties: {
orderNo: {
type: 'string',
title: '订单号',
'x-component': 'OrderNo',
},
productId: {
type: 'string',
title: '商品ID',
'x-component': 'Text',
},
productName: {
type: 'string',
title: '商品名称',
'x-component': 'Text',
},
category: {
type: 'string',
title: '品类',
'x-component': 'Text',
},
brand: {
type: 'string',
title: '品牌',
'x-component': 'Text',
'x-rules': [
{
required: true,
message: !isMateriel ? '请选择维修商品' : '请选择维修物料',
},
unit: {
type: 'string',
title: '单位',
'x-component': 'Text',
},
// 采购数量
purchaseCount: {
type: 'string',
title: '采购数量',
'x-component': 'Text',
},
repairCount: {
type: 'string',
title: '维修数量',
'x-component-props': {
allowClear: true,
style: {
maxWidth: 150,
},
],
items: {
type: 'object',
properties: {
...(
!isMateriel ? ({
orderNo: {
type: 'string',
title: '订单号',
'x-component': 'OrderNo',
},
productId: {
type: 'string',
title: '商品ID',
'x-component': 'Text',
},
productName: {
type: 'string',
title: '商品名称',
'x-component': 'Text',
},
category: {
type: 'string',
title: '品类',
'x-component': 'Text',
},
brand: {
type: 'string',
title: '品牌',
'x-component': 'Text',
},
unit: {
type: 'string',
title: '单位',
'x-component': 'Text',
},
}) : ({
orderNo: {
type: 'string',
title: '订单号',
'x-component': 'OrderNo',
},
productId: {
type: 'string',
title: '物料编号',
'x-component': 'Text',
},
productName: {
type: 'string',
title: '物料名称、规格',
'x-component': 'Text',
},
category: {
type: 'string',
title: '品类',
'x-component': 'Text',
},
brand: {
type: 'string',
title: '品牌',
'x-component': 'Text',
},
unit: {
type: 'string',
title: '单位',
'x-component': 'Text',
},
aaa: {
type: 'string',
title: orderType !== ORDER_TYPE_TENDER_CONTRACT ? '关联报价商品ID、名称、规格、品类、品牌' : '关联投标商品ID、名称、规格、品类、品牌',
'x-component': 'Text',
},
})
),
// 采购数量
purchaseCount: {
type: 'string',
title: '采购数量',
'x-component': 'Text',
},
'x-rules': [
{
required: true,
message: '请填写维修数量',
},
{
pattern: PATTERN_MAPS.weight,
message: '请填写正数,最多保留3位小数',
},
],
},
repairReason: {
type: 'string',
title: '维修原因',
'x-component-props': {
allowClear: true,
style: {
maxWidth: 150,
repairCount: {
type: 'string',
title: '维修数量',
'x-component-props': {
allowClear: true,
style: {
maxWidth: 150,
},
},
},
'x-rules': [
{
required: true,
message: '请填写维修原因',
'x-rules': [
{
required: true,
message: '请填写维修数量',
},
{
pattern: PATTERN_MAPS.weight,
message: '请填写正数,最多保留3位小数',
},
],
},
repairReason: {
type: 'string',
title: '维修原因',
'x-component-props': {
allowClear: true,
style: {
maxWidth: 150,
},
},
{
limitByte: true, // 自定义校验规则
maxByte: 60,
}
],
},
// 其他数据,不用于展示,只用于收集值
extraData: {
type: 'string',
display: false,
'x-rules': [
{
required: true,
message: '请填写维修原因',
},
{
limitByte: true, // 自定义校验规则
maxByte: 60,
}
],
},
// 其他数据,不用于展示,只用于收集值
extraData: {
type: 'string',
display: false,
},
},
},
}
},
},
},
},
},
},
'tab-3': {
type: 'object',
'x-component': 'tabpane',
'x-component-props': {
tab: '相关附件',
},
properties: {
MEGA_LAYOUT3: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
labelCol: 4,
labelAlign: 'left',
},
properties: {
faultFileList: {
title: '附件',
'x-component': 'AntUpload',
'x-component-props': {
action: '/api/file/file/upload/prefix',
data: {
fileType: UPLOAD_TYPE,
prefix: '/afterService/repairApplication/',
},
beforeUpload: '{{beforeUpload}}',
accept: '.xls, .xlsx, .doc, .docx, .wps, .pdf, .jpg, .png, .jpeg',
},
'x-rules': [
{
required: false,
message: '请上传附件',
'tab-3': {
type: 'object',
'x-component': 'tabpane',
'x-component-props': {
tab: '相关附件',
},
properties: {
MEGA_LAYOUT3: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
labelCol: 4,
labelAlign: 'left',
},
properties: {
faultFileList: {
title: '附件',
'x-component': 'AntUpload',
'x-component-props': {
action: '/api/file/file/upload/prefix',
data: {
fileType: UPLOAD_TYPE,
prefix: '/afterService/repairApplication/',
},
beforeUpload: '{{beforeUpload}}',
accept: '.xls, .xlsx, .doc, .docx, .wps, .pdf, .jpg, .png, .jpeg',
},
],
description: '一次上传一个文件,每个附件大小不能超过20M',
'x-rules': [
{
required: false,
message: '请上传附件',
},
],
description: '一次上传一个文件,每个附件大小不能超过20M',
},
},
},
},
},
},
'tab-4': {
type: 'object',
'x-component': 'tabpane',
'x-component-props': {
tab: '维修地址',
},
},
properties: {
MEGA_LAYOUT3: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
labelCol: 4,
labelAlign: 'left',
},
properties: {
repairAddress: {
title: '维修地址',
type: 'string',
'x-component': 'AddressFormItem',
'x-component-props': {
dataSource: [],
'tab-4': {
type: 'object',
'x-component': 'tabpane',
'x-component-props': {
tab: '维修地址',
},
properties: {
MEGA_LAYOUT3: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
labelCol: 4,
labelAlign: 'left',
},
properties: {
repairAddress: {
title: '维修地址',
type: 'string',
'x-component': 'AddressFormItem',
'x-component-props': {
dataSource: [],
},
'x-rules': [
{
required: true,
message: '请选择维修地址',
},
],
},
'x-rules': [
{
required: true,
message: '请选择维修地址',
},
],
},
},
},
},
},
},
},
},
},
};
};
\ No newline at end of file
import React, { useState, useEffect, useRef } from 'react';
import React, { useState, useEffect, useMemo } from 'react';
import { Button, Card, Spin, Badge, message } from 'antd';
import { ColumnType } from 'antd/lib/table/interface';
import { DeleteOutlined } from '@ant-design/icons';
import { Radio, ArrayTable } from '@formily/antd-components';
import { ArrayTable } from '@formily/antd-components';
import { history, Prompt, Link } from 'umi';
import moment from 'moment';
import { findLastIndex } from 'lodash';
......@@ -13,6 +12,11 @@ import { PublicApi } from '@/services/api';
import { GetAsReturnGoodsPageReturnedGoodsResponse } from '@/services/AfterServiceApi';
import { normalizeFiledata, FileData, isJSONStr } from '@/utils';
import { PurchaseOrderOutWorkStateTexts, ORDER_TYPE2 } from '@/constants';
import {
ORDER_TYPE_INQUIRY_CONTRACT,
ORDER_TYPE_BIDDING_CONTRACT,
ORDER_TYPE_TENDER_CONTRACT,
} from '@/constants/order';
import ReutrnEle from '@/components/ReturnEle';
import StatusTag from '@/components/StatusTag';
import NiceForm from '@/components/NiceForm';
......@@ -20,7 +24,7 @@ import GoodsDrawer from '../../../../components/GoodsDrawer';
import { OrderListRes } from '../../../../components/GoodsDrawer/interface';
import AddressFormItem from '../../../../components/AddressFormItem';
import ReturnInfoDrawer, { OrderInfo } from '../../../../components/ReturnInfoDrawer';
import { addBillSchema } from './schema';
import { addSchema } from './schema';
import { createEffects } from './effects';
import {
RETURN_OUTER_STATUS_TAG_MAP,
......@@ -30,6 +34,7 @@ import {
const addSchemaAction = createFormActions();
const {
onFormInputChange$,
onFieldValueChange$,
onFormInit$,
} = FormEffectHooks;
......@@ -91,6 +96,13 @@ const ReturnForm: React.FC<BillsFormProps> = ({
const [visibleGoodsDrawer, setVisibleGoodsDrawer] = useState(false);
const [visibleReturnInfoDrawer, setVisibleReturnInfoDrawer] = useState(false);
const [goodsValue, setGoodsValue] = useState([]);
const [orderTypeValue, setOrderTypeValue] = useState(0);
const isMateriel = (
orderTypeValue === ORDER_TYPE_INQUIRY_CONTRACT
|| orderTypeValue === ORDER_TYPE_BIDDING_CONTRACT
|| orderTypeValue === ORDER_TYPE_TENDER_CONTRACT
);
const tableColumn: ColumnType<any>[] = [
{
......@@ -126,7 +138,13 @@ const ReturnForm: React.FC<BillsFormProps> = ({
align: 'center',
render: text => ORDER_TYPE2[text],
},
];
isMateriel ? {
title: '合同编号',
dataIndex: 'type2',
align: 'center',
render: () => 'H-13-00002',
} : null,
].filter(Boolean) as ColumnType<any>[];
const childTableColumn: ColumnType<any>[] = [
{
......@@ -191,7 +209,8 @@ const ReturnForm: React.FC<BillsFormProps> = ({
orderNo: detailInfo.orderNo,
...params,
supplyMembersId: supplierMemberValue[0].memberId,
supplyMembersRoleId: supplierMemberValue[0].roleId,
supplyMembersRoleId: supplierMemberValue[0].roleId,
type: orderTypeValue,
}).then(res => {
if (res.code === 1000) {
resolve(res.data);
......@@ -348,12 +367,17 @@ const ReturnForm: React.FC<BillsFormProps> = ({
}, []);
const handleAddGoods = () => {
const supplierMemberValue = addSchemaAction.getFieldValue('supplierMember');
const supplierMemberVal = addSchemaAction.getFieldValue('supplierMember');
const orderTypeVal = addSchemaAction.getFieldValue('orderType');
if (!supplierMemberValue || !supplierMemberValue.length) {
if (!supplierMemberVal || !supplierMemberVal.length) {
message.error('请先选择供应会员');
return;
}
if (!orderTypeVal) {
message.error('请先选择售后订单类型');
return;
}
setVisibleGoodsDrawer(true);
};
......@@ -365,7 +389,7 @@ const ReturnForm: React.FC<BillsFormProps> = ({
onClick={handleAddGoods}
type="dashed"
>
选择退货商品
{!isMateriel ? '选择退货商品' : '选择退货物料'}
</Button>
) : null;
......@@ -606,6 +630,8 @@ const ReturnForm: React.FC<BillsFormProps> = ({
<Badge color={RETURN_INNER_STATUS_BADGE_MAP[detailInfo?.innerStatus]} text={detailInfo?.innerStatusName} />
);
const schemaValue = useMemo(() => addSchema(orderTypeValue), [orderTypeValue]);
return (
<Spin spinning={infoLoading}>
<PageHeaderWrapper
......@@ -674,15 +700,19 @@ const ReturnForm: React.FC<BillsFormProps> = ({
});
}
});
onFieldValueChange$('orderType').subscribe(fieldState => {
setOrderTypeValue(fieldState.value);
});
}}
onSubmit={handleSubmit}
actions={addSchemaAction}
schema={addBillSchema}
schema={schemaValue}
/>
</Card>
<GoodsDrawer
title="选择退货商品"
title={!isMateriel ? '选择退货商品' : '选择退货物料'}
afterType={3}
visible={visibleGoodsDrawer}
fetchOrderList={getOrderList}
......
......@@ -4,6 +4,12 @@ import Submit from '@/components/NiceForm/components/Submit';
import { PATTERN_MAPS } from '@/constants/regExp';
import { UPLOAD_TYPE, DELIVERY_TYPE_ENUM } from '@/constants';
import { PublicApi } from '@/services/api';
import { GlobalConfig } from '@/global/config';
import {
ORDER_TYPE_INQUIRY_CONTRACT,
ORDER_TYPE_BIDDING_CONTRACT,
ORDER_TYPE_TENDER_CONTRACT,
} from '@/constants/order';
// 供应会员列表列
const supplierColumns = [
......@@ -68,360 +74,421 @@ const supplierSchema: ISchema = {
},
};
export const addBillSchema: ISchema = {
type: 'object',
properties: {
REPOSIT_TABS: {
type: 'object',
'x-component': 'tab',
'x-component-props': {
type: 'card',
},
properties: {
'tab-1': {
type: 'object',
'x-component': 'tabpane',
'x-component-props': {
tab: '基本信息',
},
properties: {
MEGA_LAYOUT1: {
type: 'object',
'x-component': 'Mega-Layout',
'x-component-props': {
labelCol: 4,
wrapperCol: 12,
labelAlign: 'left',
},
properties: {
applyAbstract: {
type: 'string',
title: '申请单摘要',
'x-rules': [
{
required: true,
message: '请填写申请单摘要',
},
{
limitByte: true, // 自定义校验规则
maxByte: 60,
}
],
const orderTypeArr = GlobalConfig.web.orderType.map((item) => ({
label: item.platformWayName,
value: item.id,
}));
export const addSchema = (orderType: number): ISchema => {
const isMateriel = (
orderType === ORDER_TYPE_INQUIRY_CONTRACT
|| orderType === ORDER_TYPE_BIDDING_CONTRACT
|| orderType === ORDER_TYPE_TENDER_CONTRACT
);
return {
type: 'object',
properties: {
REPOSIT_TABS: {
type: 'object',
'x-component': 'tab',
'x-component-props': {
type: 'card',
},
properties: {
'tab-1': {
type: 'object',
'x-component': 'tabpane',
'x-component-props': {
tab: '基本信息',
},
properties: {
MEGA_LAYOUT1: {
type: 'object',
'x-component': 'Mega-Layout',
'x-component-props': {
labelCol: 4,
wrapperCol: 12,
labelAlign: 'left',
},
// 这是用 Mega-Layout 设置独立作用域,不然会被 Form 的布局影响到弹窗的布局
MEGA_LAYOUT1_1: {
type: 'object',
'x-component': 'Mega-Layout',
'x-component-props': {
wrapperCol: 24,
properties: {
applyAbstract: {
type: 'string',
title: '申请单摘要',
'x-rules': [
{
required: true,
message: '请填写申请单摘要',
},
{
limitByte: true, // 自定义校验规则
maxByte: 60,
}
],
},
properties: {
supplierMember: {
type: 'string',
title: '供应会员',
'x-component': 'CustomRelevance',
'x-component-props': {
title: '关联',
tip: '请选择对应单据',
modalProps: {
title: '选择会员',
},
columns: supplierColumns,
fetchTableData: getSupplier,
formilyProps: {
ctx: {
schema: supplierSchema,
components: {
Search,
Submit,
},
effects: ($, actions) => {
},
inline: false,
}
},
tableProps: {
rowKey: 'id',
lableKey: 'name',
// 这是用 Mega-Layout 设置独立作用域,不然会被 Form 的布局影响到弹窗的布局
MEGA_LAYOUT1_1: {
type: 'object',
'x-component': 'Mega-Layout',
'x-component-props': {
wrapperCol: 24,
},
properties: {
supplierMember: {
type: 'string',
title: '供应会员',
'x-component': 'CustomRelevance',
'x-component-props': {
title: '关联',
tip: '请选择对应单据',
modalProps: {
title: '选择会员',
},
columns: supplierColumns,
fetchTableData: getSupplier,
formilyProps: {
ctx: {
schema: supplierSchema,
components: {
Search,
Submit,
},
effects: ($, actions) => {
},
inline: false,
}
},
tableProps: {
rowKey: 'id',
lableKey: 'name',
},
},
'x-mega-props': {
wrapperCol: 12,
},
'x-rules': [
{
required: true,
message: '请选择供应会员',
},
],
},
'x-mega-props': {
wrapperCol: 12,
},
'x-rules': [
{
required: true,
message: '请选择供应会员',
},
],
},
},
orderType: {
type: 'string',
title: '售后订单类型',
enum: orderTypeArr,
'x-component-props': {
placeholder: '请选择',
},
required: true,
},
applyNo: {
type: 'string',
title: '申请单号',
'x-component': 'Text',
},
},
applyNo: {
type: 'string',
title: '申请单号',
'x-component': 'Text',
},
applyTime: {
type: 'string',
title: '单据时间',
'x-component': 'Text',
},
outerStatus: {
type: 'string',
title: '外部状态',
'x-component': 'Children',
'x-component-props': {
children: '{{OuterStatus}}'
applyTime: {
type: 'string',
title: '单据时间',
'x-component': 'Text',
},
},
innerStatus: {
type: 'string',
title: '内部状态',
'x-component': 'Children',
'x-component-props': {
children: '{{InnerStatus}}'
outerStatus: {
type: 'string',
title: '外部状态',
'x-component': 'Children',
'x-component-props': {
children: '{{OuterStatus}}'
},
},
},
innerStatus: {
type: 'string',
title: '内部状态',
'x-component': 'Children',
'x-component-props': {
children: '{{InnerStatus}}'
},
},
},
},
},
},
},
'tab-2': {
type: 'object',
'x-component': 'tabpane',
'x-component-props': {
tab: '单据明细',
},
properties: {
MEGA_LAYOUT2: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
labelCol: 4,
labelAlign: 'left',
},
properties: {
addBtn: {
type: 'object',
'x-component': 'Children',
'x-component-props': {
children: '{{TableAddButton}}'
},
'tab-2': {
type: 'object',
'x-component': 'tabpane',
'x-component-props': {
tab: '单据明细',
},
properties: {
MEGA_LAYOUT2: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
labelCol: 4,
labelAlign: 'left',
},
returnGoodsList: {
type: 'array',
'x-component': 'ArrayTable',
'x-component-props': {
renderAddition: () => null,
renderRemove: '{{renderListTableRemove}}',
renderMoveDown: () => null,
renderMoveUp: () => null,
operationsWidth: 100,
operations: {
align: 'center',
},
properties: {
addBtn: {
type: 'object',
'x-component': 'Children',
'x-component-props': {
children: '{{TableAddButton}}',
},
},
'x-rules': [
{
required: true,
message: '请选择退货商品',
returnGoodsList: {
type: 'array',
'x-component': 'ArrayTable',
'x-component-props': {
renderAddition: () => null,
renderRemove: '{{renderListTableRemove}}',
renderMoveDown: () => null,
renderMoveUp: () => null,
operationsWidth: 100,
operations: {
align: 'center',
},
},
],
items: {
type: 'object',
properties: {
orderNo: {
type: 'string',
title: '订单号',
'x-component': 'OrderNo',
},
productId: {
type: 'string',
title: '商品ID',
'x-component': 'Text',
},
productName: {
type: 'string',
title: '商品名称',
'x-component': 'Text',
},
category: {
type: 'string',
title: '品类',
'x-component': 'Text',
},
brand: {
type: 'string',
title: '品牌',
'x-component': 'Text',
},
unit: {
type: 'string',
title: '单位',
'x-component': 'Text',
},
purchaseCount: {
type: 'string',
title: '采购数量',
'x-component': 'Text',
},
purchasePrice: {
type: 'string',
title: '采购单价',
'x-component': 'Text',
'x-rules': [
{
required: true,
message: !isMateriel ? '请选择退货商品' : '请选择退货物料',
},
purchaseAmount: {
type: 'string',
title: '采购金额',
'x-component': 'Text',
},
payAmount: {
type: 'string',
title: '已支付金额',
'x-component': 'Text',
},
returnCount: {
type: 'string',
title: '退货数量',
'x-component': 'Text',
'x-rules': [
{
required: true,
message: '请输入退货数量',
},
],
},
refundAmount: {
type: 'string',
title: '退款金额',
'x-component': 'Text',
'x-rules': [
{
required: true,
message: '请输入退款金额',
},
],
},
// 其他数据,不用于展示,只用于收集值
extraData: {
type: 'string',
display: false,
],
items: {
type: 'object',
properties: {
...(
!isMateriel ? ({
orderNo: {
type: 'string',
title: '订单号',
'x-component': 'OrderNo',
},
productId: {
type: 'string',
title: '商品ID',
'x-component': 'Text',
},
productName: {
type: 'string',
title: '商品名称',
'x-component': 'Text',
},
category: {
type: 'string',
title: '品类',
'x-component': 'Text',
},
brand: {
type: 'string',
title: '品牌',
'x-component': 'Text',
},
unit: {
type: 'string',
title: '单位',
'x-component': 'Text',
},
purchaseCount: {
type: 'string',
title: '采购数量',
'x-component': 'Text',
},
}) : ({
orderNo: {
type: 'string',
title: '订单号',
'x-component': 'OrderNo',
},
productId: {
type: 'string',
title: '物料编号',
'x-component': 'Text',
},
productName: {
type: 'string',
title: '物料名称、规格',
'x-component': 'Text',
},
category: {
type: 'string',
title: '品类',
'x-component': 'Text',
},
brand: {
type: 'string',
title: '品牌',
'x-component': 'Text',
},
unit: {
type: 'string',
title: '单位',
'x-component': 'Text',
},
aaa: {
type: 'string',
title: orderType !== ORDER_TYPE_TENDER_CONTRACT ? '关联报价商品ID、名称、规格、品类、品牌' : '关联投标商品ID、名称、规格、品类、品牌',
'x-component': 'Text',
},
})
),
purchasePrice: {
type: 'string',
title: '采购单价',
'x-component': 'Text',
},
purchaseAmount: {
type: 'string',
title: '采购金额',
'x-component': 'Text',
},
payAmount: {
type: 'string',
title: '已支付金额',
'x-component': 'Text',
},
returnCount: {
type: 'string',
title: '退货数量',
'x-component': 'Text',
'x-rules': [
{
required: true,
message: '请输入退货数量',
},
],
},
refundAmount: {
type: 'string',
title: '退款金额',
'x-component': 'Text',
'x-rules': [
{
required: true,
message: '请输入退款金额',
},
],
},
// 其他数据,不用于展示,只用于收集值
extraData: {
type: 'string',
display: false,
},
},
},
}
}
},
},
},
},
},
},
'tab-3': {
type: 'object',
'x-component': 'tabpane',
'x-component-props': {
tab: '相关附件',
},
properties: {
MEGA_LAYOUT3: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
labelCol: 4,
labelAlign: 'left',
},
properties: {
proofFileList: {
title: '附件',
'x-component': 'AntUpload',
'x-component-props': {
action: '/api/file/file/upload/prefix',
data: {
fileType: UPLOAD_TYPE,
prefix: '/afterService/returnApplication/',
},
beforeUpload: '{{beforeUpload}}',
accept: '.xls, .xlsx, .doc, .docx, .wps, .pdf, .jpg, .png, .jpeg',
},
'x-rules': [
{
required: false,
message: '请上传附件',
'tab-3': {
type: 'object',
'x-component': 'tabpane',
'x-component-props': {
tab: '相关附件',
},
properties: {
MEGA_LAYOUT3: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
labelCol: 4,
labelAlign: 'left',
},
properties: {
proofFileList: {
title: '附件',
'x-component': 'AntUpload',
'x-component-props': {
action: '/api/file/file/upload/prefix',
data: {
fileType: UPLOAD_TYPE,
prefix: '/afterService/returnApplication/',
},
beforeUpload: '{{beforeUpload}}',
accept: '.xls, .xlsx, .doc, .docx, .wps, .pdf, .jpg, .png, .jpeg',
},
],
description: '一次上传一个文件,每个附件大小不能超过20M',
'x-rules': [
{
required: false,
message: '请上传附件',
},
],
description: '一次上传一个文件,每个附件大小不能超过20M',
},
},
},
},
},
},
'tab-4': {
type: 'object',
'x-component': 'tabpane',
'x-component-props': {
tab: '退货收货地址',
},
},
properties: {
MEGA_LAYOUT4: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
labelCol: 4,
wrapperCol: 12,
labelAlign: 'left',
},
properties: {
deliveryType: {
title: '配送方式',
type: 'string',
enum: DELIVERY_TYPE_ENUM,
'x-component-props': {
placeholder: '请选择',
'tab-4': {
type: 'object',
'x-component': 'tabpane',
'x-component-props': {
tab: '退货收货地址',
},
properties: {
MEGA_LAYOUT4: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
labelCol: 4,
wrapperCol: 12,
labelAlign: 'left',
},
properties: {
deliveryType: {
title: '配送方式',
type: 'string',
enum: DELIVERY_TYPE_ENUM,
'x-component-props': {
placeholder: '请选择',
},
'x-rules': [
{
required: true,
message: '请选择配送方式',
},
],
},
'x-rules': [
{
required: true,
message: '请选择配送方式',
// 退货发货地址
shippingAddress: {
title: '退货发货地址',
type: 'string',
visible: false,
'x-component': 'AddressFormItem',
'x-component-props': {
dataSource: [],
},
],
},
// 退货发货地址
shippingAddress: {
title: '退货发货地址',
type: 'string',
visible: false,
'x-component': 'AddressFormItem',
'x-component-props': {
dataSource: [],
'x-rules': [
{
required: true,
message: '请选择退货发货地址',
},
],
},
'x-rules': [
{
required: true,
message: '请选择退货发货地址',
},
],
},
// 退货自提地址
pickupAddress: {
title: '退货自提地址',
type: 'string',
visible: false,
'x-component': 'AddressFormItem',
'x-component-props': {
dataSource: [],
// 退货自提地址
pickupAddress: {
title: '退货自提地址',
type: 'string',
visible: false,
'x-component': 'AddressFormItem',
'x-component-props': {
dataSource: [],
},
'x-rules': [
{
required: true,
message: '请选择退货自提地址',
},
],
},
'x-rules': [
{
required: true,
message: '请选择退货自提地址',
},
],
},
},
},
},
},
},
},
},
},
};
};
\ No newline at end of file
......@@ -39,65 +39,69 @@ export const columnsSetMember: any[] = [
export const buildColumns: any[] = [
{
dataIndex: 'id',
title: 'ID',
align: 'center',
className: 'commonHide',
},
{
dataIndex: 'id',
title: '序号',
align: 'center',
render: (r, t, i) => i++
render: (t, r, i) => ++i
},
{
dataIndex: 'name',
dataIndex: 'type',
align: 'center',
title: '专家类型'
title: '专家类型',
key: 'type'
},
{
dataIndex: 'memberTypeName',
title: '专家专业级别',
align: 'center'
dataIndex: 'speciality',
title: '专家专业类别',
align: 'center',
key: 'speciality'
},
{
dataIndex: 'roleName',
dataIndex: 'qualification',
title: '专家资格证书',
align: 'center'
align: 'center',
key: 'qualification'
},
{
dataIndex: 'orderThe',
dataIndex: 'userJobTitle',
title: '专家专业职称',
align: 'center'
align: 'center',
key: 'userJobTitle'
},
{
dataIndex: 'receiverName',
title: '从事年限',
align: 'center'
align: 'center',
key: 'type'
},
{
dataIndex: 'supplyMembersName',
title: '所属行业',
align: 'center'
align: 'center',
key: 'type'
},
{
dataIndex: 'supplyMembersName',
title: '要求地区',
align: 'center'
align: 'center',
key: 'type'
},
{
dataIndex: 'supplyMembersName',
title: '排除地区',
align: 'center'
align: 'center',
key: 'type'
},
{
dataIndex: 'supplyMembersName',
title: '工作单位',
align: 'center'
align: 'center',
key: 'type'
},
{
dataIndex: 'supplyMembersName',
title: '抽取人数',
align: 'center'
align: 'center',
key: 'type'
},
// {
// dataIndex: 'ctl',
......
......@@ -135,6 +135,15 @@ const AddRemarkBidCommittee:React.FC<AddRemarkBidCommitteeProps> = (props) => {
addSchemaAction.setFieldValue('openTenderTime', formatTimeString(selectRow[0]['openTenderTime']))
addSchemaAction.setFieldValue('remarkTime', `${formatTimeString(selectRow[0]['evaluationStartTime'])} ~ ${formatTimeString(selectRow[0]['evaluationEndTime'])}`)
addSchemaAction.setFieldValue('createTime', formatTimeString(selectRow[0]['createTime']))
// 获取组件条件里面的评标专家库列表
PublicApi.getPurchaseExpertGetExpertList({current: '1', pageSize: '999'}).then(res => {
const { data, code } = res
if(code === 1000) {
addSchemaAction.setFieldValue('conditionLists', data)
}
})
}
const onConditonClick = () => {
......
......@@ -3,7 +3,7 @@ import { history } from 'umi'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import ReutrnEle from '@/components/ReturnEle'
import { usePageStatus, PageStatus } from '@/hooks/usePageStatus'
import { Button, Card } from 'antd'
import { Button, Card, message } from 'antd'
import { createFormActions } from '@formily/antd'
import { PlusOutlined, SaveOutlined } from '@ant-design/icons'
import NiceForm from '@/components/NiceForm'
......@@ -37,6 +37,10 @@ const AddRemarkBidTemplate:React.FC<AddRemarkBidTemplateProps> = (props) => {
const handleSubmit = async (value) => {
setBtnLoading(true)
if(!value?.templateContentList?.length) {
setBtnLoading(false)
return message.error('请填写评标内容')
}
PublicApi.postPurchaseTemplateSaveOrUpdateTemplate(value).then(res => {
if(res.code === 1000) {
history.goBack()
......
......@@ -17,7 +17,7 @@ import '../../constants/index.less'
export interface RemarkBidCommitteeProps {}
const fetchTableData = async (params) => {
const { data } = await PublicApi.getOrderProcurementReviewedListOne(params)
const { data } = await PublicApi.getPurchaseExpertExtractGetExpertExtractList(params)
return data
}
......
import React, { useRef } from 'react'
import { Button } from 'antd'
import { Button, Popconfirm } from 'antd'
import StatusSwitch from '@/components/StatusSwitch'
import { PublicApi } from '@/services/api'
import EyePreview from '@/components/EyePreview'
......@@ -83,7 +83,17 @@ export const useSelfTable = () => {
key: 'ctl',
render: (text, record) => <>
<Button type='link' onClick={() => history.push(`/memberCenter/procurementAbility/callForBids/remarkBidTemplate/edit?id=${record.id}`)}>编辑</Button>
<Button type='link' onClick={() => handleDelete(record.id)}>删除</Button>
<Popconfirm
title="确定要执行该操作?"
onConfirm={() => handleDelete(record.id)}
okText="是"
cancelText="否"
>
<Button
type='link'
// onClick={() => handleDelete(record.id)}
>删除</Button>
</Popconfirm>
</>
}
])
......
......@@ -114,6 +114,17 @@ const AddTender:React.FC<AddTenderProps> = (props) => {
setBtnLoading(false)
return message.error('请先关联投标商品')
}
// 校验单价
let judgementByCount = params.submitTenderMateriel?.length && params.submitTenderMateriel.map(item => {
if(item.price && typeof item.taxRate === 'number'){
return true
} else {
return false
}
})
if(!judgementByCount || judgementByCount.includes(false)){
throw new Error('请填写商品单价')
}
if(value?.id) params.id = value.id
const res = await PublicApi.postPurchaseSubmitTenderSaveSubmitTender(params)
if(res.code === 1000) {
......
......@@ -12,6 +12,9 @@ export const orderTypeLabel = ['',
'渠道现货',
'积分兑换',
'渠道积分兑换',
'采购询价合同下单',
'采购招标合同下单',
'采购竞价合同下单',
]
/**
......
......@@ -8,6 +8,7 @@ import OrderMergeInfo from '../../components/orderMergeInfo'
import OrderDeleveRecord from '../../components/orderDeleveRecord'
import OrderTransformRecord from '../../components/orderTransformRecord'
import OrderSaleRecord from '../orderSaleRecord'
import { ORDER_TYPE2_BIDDING_CONTRACT, ORDER_TYPE2_ENQUIRY_CONTRACT, ORDER_TYPE2_TENDER_CONTRACT } from '@/constants'
export interface OrderDetailSectionProps {
formContext: any,
......@@ -42,7 +43,16 @@ const OrderDetailSection:React.FC<OrderDetailSectionProps> = ({formContext, type
{ type === 'saleOrder' ? <SaleOrderProductTable/> : <OrderProductTable editable /> }
<OrderPayTabs />
{/* 采购合同下单不显示 支付信息栏 */}
{
formContext.data.type === ORDER_TYPE2_ENQUIRY_CONTRACT ||
formContext.data.type === ORDER_TYPE2_BIDDING_CONTRACT ||
formContext.data.type === ORDER_TYPE2_TENDER_CONTRACT
?
null
:
<OrderPayTabs />
}
<OrderMergeInfo />
......
......@@ -10,7 +10,7 @@ import ModalForm from '@/components/ModalForm'
import { createFormActions } from '@formily/antd'
import MellowCard from '@/components/MellowCard'
import { AddressPop } from '../../purchaseOrder/orderCollect/components/productModalTable'
import { DELIVERY_TYPE } from '@/constants'
import { DELIVERY_TYPE, OrderModalType } from '@/constants'
export interface OrderProductTableProps {
editable: boolean
......@@ -218,6 +218,8 @@ const OrderProductTable:React.FC<OrderProductTableProps> = ({editable}) => {
const { ctl, data, preview } = useContext(OrderDetailContext)
const { orderProductRequests = [], orderModel } = data || {}
const creditsCommodity = (orderModel === 24 || orderModel === 25) // 积分或渠道积分下单模式
// 合同下单模式
const contractOrder = (orderModel === OrderModalType.PURCHASE_ENQUIRY_CONTRACT_ORDER || orderModel === OrderModalType.PURCHASE_TENDER_CONTRACT_ORDER || orderModel === OrderModalType.PURCHASE_BIDDING_CONTRACT_ORDER)
const productComponents = {
body: {
......@@ -272,6 +274,7 @@ const OrderProductTable:React.FC<OrderProductTableProps> = ({editable}) => {
})
};
// 订单商品
const productInfoColumns: any[] = [
{
title: 'ID',
......@@ -347,6 +350,101 @@ const OrderProductTable:React.FC<OrderProductTableProps> = ({editable}) => {
}
]
// 订单物料
const materialInfo: any[] = [
{
title: 'ID',
dataIndex: 'id',
align: 'center',
key: 'id',
className: 'commonHide'
},
{
title: '物料编号',
dataIndex: 'materialCode',
align: 'center',
key: 'materialCode',
},
{
title: '物料名称/规格',
dataIndex: 'materialName',
align: 'center',
key: 'materialName',
render: (t, r) => <>{t}/{r.materialType}</>
},
{
title: '品类',
dataIndex: 'materialCategory',
align: 'center',
key: 'materialCategory',
},
{
title: '品牌',
dataIndex: 'materialBrand',
align: 'center',
key: 'materialBrand',
},
{
title: '单位',
dataIndex: 'unit',
align: 'center',
key: 'unit',
},
{
title: '关联报价商品ID/名称/规格/品类/品牌',
dataIndex: 'materialId',
align: 'center',
key: 'materialId',
render: (t, r) => `${t}/${r.productName}/${r.category}/${r.brand}`
},
{
title: '单价(元)',
dataIndex: 'price',
align: 'left',
key: 'price',
},
{
title: '供方库存',
dataIndex: 'inventory',
align: 'center',
key: 'inventory',
},
{
title: '采购数量',
dataIndex: 'purchaseCount',
align: 'center',
key: 'purchaseCount',
},
{
title: '含税',
dataIndex: 'taxInclusive',
align: 'center',
key: 'taxInclusive',
render: (t, r) => t ? '是' : '否'
},
{
title: '税率',
dataIndex: 'taxRate',
align: 'center',
key: 'taxRate',
},
{
title: '金额',
dataIndex: 'money',
align: 'center',
key: 'money',
},
// 接口调用
{
title: '配送方式',
dataIndex: 'logistics',
align: 'center',
key: 'logistics',
render: (text) => (text && text.deliveryType && text.deliveryType === 2) ?
<AddressPop pickInfo={text}>{DELIVERY_TYPE[text.deliveryType]}</AddressPop> : DELIVERY_TYPE[text?.deliveryType]
}
]
const columns = !editable ? productInfoColumns : productInfoColumns.map(col => {
......@@ -365,9 +463,9 @@ const OrderProductTable:React.FC<OrderProductTableProps> = ({editable}) => {
};
});
return (
<MellowCard title='订单商品' style={{marginTop: 24}} bordered={false}>
<MellowCard title={contractOrder ? '订单物料' : '订单商品'} style={{marginTop: 24}} bordered={false}>
<Table
columns={productInfoColumns}
columns={ contractOrder ? materialInfo : productInfoColumns }
dataSource={orderProductRequests}
components={productComponents}
rowKey='id'
......
......@@ -13,7 +13,7 @@ import { usePageStatus } from '@/hooks/usePageStatus'
import ModalTable from '@/components/ModalTable'
import { formatTimeString } from '@/utils'
import { AddressPop } from '../../purchaseOrder/orderCollect/components/productModalTable'
import { DELIVERY_TYPE, SaleOrderInsideWorkStateTexts } from '@/constants'
import { DELIVERY_TYPE, OrderModalType, SaleOrderInsideWorkStateTexts } from '@/constants'
export interface OrderProductTableProps {}
......@@ -295,7 +295,9 @@ const SaleOrderProductTable:React.FC<OrderProductTableProps> = (props) => {
const { page_type } = usePageStatus()
const { orderProductRequests = [], orderModel } = data || {}
const creditsCommodity = (orderModel === 24 || orderModel === 25) // 积分或渠道积分下单模式
// 合同下单模式
const contractOrder = (orderModel === OrderModalType.PURCHASE_ENQUIRY_CONTRACT_ORDER || orderModel === OrderModalType.PURCHASE_TENDER_CONTRACT_ORDER || orderModel === OrderModalType.PURCHASE_BIDDING_CONTRACT_ORDER)
console.log(contractOrder, 'fff')
const [warehouseVisible, setWarehouseVisible] = useState(false)
const [checkProductId, setCheckProductId] = useState(0) // 选中的商品id
const warehouseRef = useRef<any>({})
......@@ -367,6 +369,7 @@ const SaleOrderProductTable:React.FC<OrderProductTableProps> = (props) => {
setWarehouseVisible(true)
}
// 订单商品列
const productInfoColumns: any[] = [
{
title: 'ID',
......@@ -445,11 +448,112 @@ const SaleOrderProductTable:React.FC<OrderProductTableProps> = (props) => {
dataIndex: 'record',
align: 'center',
key: 'record',
// @todo 尚未实现, 需UI设计
render: (_, record) => <Button type='link' onClick={() => handlePreviewWarehouse(record)}>查看</Button>
},
]
// 订单物料
const materialInfo: any[] = [
{
title: 'ID',
dataIndex: 'id',
align: 'center',
key: 'id',
className: 'commonHide'
},
{
title: '物料编号',
dataIndex: 'materialCode',
align: 'center',
key: 'materialCode',
},
{
title: '物料名称/规格',
dataIndex: 'materialName',
align: 'center',
key: 'materialName',
render: (t, r) => <>{t}/{r.materialType}</>
},
{
title: '品类',
dataIndex: 'materialCategory',
align: 'center',
key: 'materialCategory',
},
{
title: '品牌',
dataIndex: 'materialBrand',
align: 'center',
key: 'materialBrand',
},
{
title: '单位',
dataIndex: 'unit',
align: 'center',
key: 'unit',
},
{
title: '关联报价商品ID/名称/规格/品类/品牌',
dataIndex: 'materialId',
align: 'center',
key: 'materialId',
render: (t, r) => `${t}/${r.productName}/${r.category}/${r.brand}`
},
{
title: '单价(元)',
dataIndex: 'price',
align: 'left',
key: 'price',
},
{
title: '供方库存',
dataIndex: 'inventory',
align: 'center',
key: 'inventory',
},
{
title: '采购数量',
dataIndex: 'purchaseCount',
align: 'center',
key: 'purchaseCount',
},
{
title: '含税',
dataIndex: 'taxInclusive',
align: 'center',
key: 'taxInclusive',
render: (t, r) => t ? '是' : '否'
},
{
title: '税率',
dataIndex: 'taxRate',
align: 'center',
key: 'taxRate',
},
{
title: '金额',
dataIndex: 'money',
align: 'center',
key: 'money',
},
// 接口调用
{
title: '配送方式',
dataIndex: 'logistics',
align: 'center',
key: 'logistics',
render: (text) => (text && text.deliveryType && text.deliveryType === 2) ?
<AddressPop pickInfo={text}>{DELIVERY_TYPE[text.deliveryType]}</AddressPop> : DELIVERY_TYPE[text?.deliveryType]
},
{
title: '仓位库存扣减记录',
dataIndex: 'record',
align: 'center',
key: 'record',
render: (_, record) => <Button type='link' onClick={() => handlePreviewWarehouse(record)}>查看</Button>
}
]
const fetchWarehouseData = useCallback(async (params) => {
const { data } = await PublicApi.getWarehousePositionDeductionRecordList({...params, productId: String(checkProductId)})
return data
......@@ -471,9 +575,9 @@ const SaleOrderProductTable:React.FC<OrderProductTableProps> = (props) => {
};
});
return (
<MellowCard title='订单商品' style={{marginTop: 24}} bordered={false}>
<MellowCard title={contractOrder ? '订单物料' : '订单商品'} style={{marginTop: 24}} bordered={false}>
<Table
columns={columns}
columns={ contractOrder ? materialInfo : columns}
dataSource={orderProductRequests.sort((a, b) => a.id - b.id)}
components={productComponents}
rowKey='id'
......
......@@ -88,7 +88,7 @@ export const AddressPop = (props) => {
{
receiveInfo && <>
<p>{receiveInfo.shipperName} / {receiveInfo.phone}</p>
<p>{receiveInfo.provinceName + receiveInfo.cityName + receiveInfo.districtName + receiveInfo.address}</p>
<p>{receiveInfo.provinceName + receiveInfo.cityName + receiveInfo.districtName + receiveInfo.address || receiveInfo.fullAddress}</p>
</>
}
</div>
......@@ -162,6 +162,7 @@ const ProductModalTable:React.FC<ProductModalTableProps> = (props) => {
const handleConfirmProduct = async () => {
// 判断所选择的商品是否属于同一个工作流
// @ts-ignore
const res = await PublicApi.postOrderIsWorkFlow({
memberId: rowSelectionCtl.selectRow[0].memberId,
memberRoleId: rowSelectionCtl.selectRow[0].memberRoleId,
......
......@@ -81,7 +81,8 @@ export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions
}, [orderProducts])
const getPayLists = (memberId, memberRoleId) => {
PublicApi.getPayPayWayList({memberId, memberRoleId}).then(res => {
// PublicApi.getPayPayWayList({memberId, memberRoleId}).then(res => {
PublicApi.getPayPayWayAccount({memberId, memberRoleId}).then(res => {
const { code, data } = res
if (code === 1000) {
const newColumns = [...columns]
......
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