Commit ba50fcad authored by Bill's avatar Bill

Merge branch 'fix-v2-220418' into 'v2-220418'

fix: 修复物料相关bug See merge request linkseeks-design/pro-platform!464
parents ba334fe8 3dd0d89b
import { Badge } from "antd"
import { Link, getIntl } from "umi"
import { MATERIAL_INNER_STATUS_BADGE_COLOR } from "./constants"
type Params = {
detailUrl: string,
......@@ -75,6 +77,7 @@ export function getColumn(params: Params) {
{
title: intl.formatMessage({ id: 'material.interiorStateName', defaultMessage: '内部状态' }),
dataIndex: 'interiorStateName',
render: (text, record) => <Badge color={MATERIAL_INNER_STATUS_BADGE_COLOR[record.interiorState]} text={text} />,
}
]
return columns.concat(params?.extraColumn || []);
......
import {
FROZEN,
PENDING_ADD_MATERIAL,
PENDING_EXAM_I,
EXAM_I_FAIL,
PENDING_EXAM_II,
EXAM_II_FAIL,
PENDING_SUBMIT_EXAM,
PENDING_EXAM_CHANGE_I,
PENDING_EXAM_CHANGE_I_FAIL,
PENDING_EXAM_CHANGE_II,
PENDING_EXAM_CHANGE_II_FAIL,
HAS_CONFIRM,
} from '@/constants/material';
/**
* 物料内部状态 Tag badge map
*/
export const MATERIAL_INNER_STATUS_BADGE_COLOR = {
[FROZEN]: 'grey',
[PENDING_ADD_MATERIAL]: 'blue',
[PENDING_EXAM_I]: 'orange',
[EXAM_I_FAIL]: 'red',
[PENDING_EXAM_II]: 'orange',
[EXAM_II_FAIL]: 'red',
[PENDING_SUBMIT_EXAM]: 'orange',
[PENDING_EXAM_CHANGE_I]: 'orange',
[PENDING_EXAM_CHANGE_I_FAIL]: 'red',
[PENDING_EXAM_CHANGE_II]: 'orange',
[PENDING_EXAM_CHANGE_II_FAIL]: 'red',
[HAS_CONFIRM]: 'green',
};
\ No newline at end of file
......@@ -290,7 +290,7 @@ export const getSchema = (schema: ISchema | null): ISchema => {
type: 'object',
"x-component": 'MellowCard',
"x-component-props": {
id: 'sourceList',
id: 'source',
title: intl.formatMessage({ id: 'material.sourceList', defaultMessage: '货源清单'})
},
visible: false,
......
......@@ -2,7 +2,21 @@ import { FormPath } from '@formily/antd';
import { Space } from 'antd';
import React from 'react';
interface OperationProps {
/**
* 删除之后触发事件
*/
onDeleteAfter?: () => void,
/**
* 保存之后触发事件
*/
onSaveAfter?: () => void,
}
const Operation = (props) => {
const xComponentProps: OperationProps = props.props['x-component-props'] || {};
const { onDeleteAfter, onSaveAfter } = xComponentProps;
/** 这里用index 做值貌似有点问题 */
const [, index] = props.name.split(".")
const id = props.form.getFieldValue(`datas.${index}.id`);
......@@ -42,6 +56,7 @@ const Operation = (props) => {
props.form.setFieldValue(`datas`, newDataSource.filter((_item) => _item.status === 1))
props.form.setFieldValue(`cacheData`, newDataSource)
onDeleteAfter?.();
}
const handleSave = () => {
......@@ -74,6 +89,7 @@ const Operation = (props) => {
});
props.form.setFieldValue(`cacheData`, newDataSource)
onSaveAfter?.();
}
if (editable) {
......
......@@ -142,7 +142,10 @@ export const schema: ISchema = {
operations: {
title: '操作',
'x-component': 'Operation',
editable: false
editable: false,
'x-component-props': {
onDeleteAfter: '{{handleActionsAfter}}',
},
}
}
}
......
......@@ -198,6 +198,13 @@ const SourceList = () => {
}
}
/**
* 处理删除操作、确认操作没有触发 onFormInputChange 的问题
*/
const handleActionsAfter = () => {
setUnsaved(true)
};
return (
<AnchorPage
title={intl.formatMessage({ id: 'material.sourceList', defaultMessage: '货源清单' })}
......@@ -218,6 +225,7 @@ const SourceList = () => {
previewPlaceholder=' '
expressionScope={{
renderAddition: renderAddition(),
handleActionsAfter: handleActionsAfter,
}}
initialValues={initialValue}
onSubmit={handleSubmit}
......
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