Commit d8ecef5c authored by rainbowmorel@163.com's avatar rainbowmorel@163.com

Merge branch 'v2-220418' into 20418order

parents 48f95e60 0a9abfb2
......@@ -11,13 +11,19 @@ import './index.less';
interface DraggableHeaderCellProps {
columnIndex: number,
className: string,
/**
* 是否可拖拽
*/
draggable: boolean,
/**
* 是否可改变大小
*/
resizable: boolean,
children?: React.ReactNode,
}
const DraggableHeaderCell: React.FC<DraggableHeaderCellProps> = (props) => {
const { className, children, columnIndex, ...restProps } = props;
// console.log('propsprops', props)
const { className, children, columnIndex, draggable, resizable, ...restProps } = props;
const context = React.useContext(SortableContext);
......@@ -26,14 +32,30 @@ const DraggableHeaderCell: React.FC<DraggableHeaderCellProps> = (props) => {
};
return (
<th className={classNames(className, 'sortable-header-cell')} {...restProps}>
{columnIndex !== undefined ? (
<th
className={classNames(
className,
'sortable-header-cell',
{
'sortable-header-cell__active': draggable,
},
)}
{...restProps}
>
{draggable ? (
<span className={classNames('draggable-header-handle', 'columns-draggable-handle')}>
<HolderOutlined style={{ color: 'rgba(0, 0, 0, 0.45)' }} />
<HolderOutlined
style={{
color: 'rgba(0, 0, 0, 0.45)',
fontSize: 16,
position: 'relative',
top: -2,
}}
/>
</span>
) : null}
{children}
{columnIndex !== undefined ? (
{resizable ? (
<ResizableHandleBar onSlide={handleCellWidthChange} />
) : null}
</th>
......
......@@ -4,12 +4,14 @@
.sortable-header-cell {
cursor: pointer;
transition: all .3s;
transition: all .3s !important;
position: relative;
user-select: none;
overflow: visible;
&__active {
&:hover {
padding-left: @padding-md * 2;
background-color: #EBF9F6;
.@{draggable-header-prefix}-handle {
......@@ -20,16 +22,25 @@
opacity: 1 !important;
}
}
}
.@{draggable-header-prefix} {
&-handle {
position: absolute;
top: 50%;
left: @margin-xss / 2;
top: 0;
left: 0;
bottom: 0;
z-index: 1;
transform: translateY(-50%);
padding: @padding-xs;
display: flex;
align-items: center;
justify-content: center;
opacity: 0;
cursor: grabbing;
&:hover {
background-color: rgba(255, 0, 0, 0.1);
}
}
}
}
......@@ -19,7 +19,9 @@ const normailizeAdditionalHeaderCell = (dataSource: ColumnType<any>[]) => {
onHeaderCell: () => {
return {
...(item.onHeaderCell?.(item) || {}),
columnIndex: index !== dataSource.length - 1 ? index : undefined,
columnIndex: index,
draggable: !item.fixed,
resizable: index !== dataSource.length - 1,
};
},
};
......
......@@ -73,7 +73,7 @@ export const getSchema = (options: Options) => {
style: { width: '150px' },
},
},
categoryId: {
customerCategoryId: {
type: 'string',
'x-component': 'Cascader',
'x-component-props': {
......
......@@ -62,7 +62,7 @@ function useGetDetailCommon<T extends GetProductGoodsGetGoodsProcessDetailRespon
},
{
title: '规格型号',
value: 'M20型号'
value: initialValue?.type
},
{
title: '品牌',
......@@ -74,7 +74,7 @@ function useGetDetailCommon<T extends GetProductGoodsGetGoodsProcessDetailRespon
},
{
title: '备注',
value: initialValue?.remark || ''
value: initialValue?.remake || ''
},
{
title: '品类',
......@@ -150,7 +150,7 @@ function useGetDetailCommon<T extends GetProductGoodsGetGoodsProcessDetailRespon
{
title: '附件',
render: (text, record) => {
const value = { name: '设计图纸pdf', url: '' };
const value = { name: record.name, url: record.url };
return (
<FileItem value={value} />
)
......@@ -158,10 +158,10 @@ function useGetDetailCommon<T extends GetProductGoodsGetGoodsProcessDetailRespon
},
{
title: '备注',
dataIndex: 'desc'
dataIndex: 'description'
}
]
}, [initialValue])
}, [])
/**
* 内部单据流转记录
......
......@@ -92,7 +92,18 @@ const Add = () => {
let materialGroups = []
if (data.suitableMaterialType === MATERIAL_ITEM) {
const listData = await getProductMaterialProcessPageRelMaterial({ processId: id })
materials = [...listData.data];
materials = [...listData.data].map((_item) => {
return {
name: _item.materialName,
code: _item?.materialCode || '',
materialGroup: {
name: _item.materialGroupName,
},
id: _item.materialId,
..._item,
}
});
}
if (data.suitableMaterialType === GROUP) {
......@@ -129,11 +140,11 @@ const Add = () => {
}
}),
}
} else if (values.suitableMaterialType === 2) {
} else if (values.suitableMaterialType === 3) {
tempData = {
materials: values.materials?.map((_item) => {
return {
materialId: _item,
materialId: _item.id,
}
})
}
......
......@@ -58,19 +58,19 @@ const SelectMaterial: React.FC<Iprops> & { isFieldComponent: boolean} = (props:
{
title: '规格型号',
dataIndex: 'type',
render: (text, record) => {
const { materialAttributeList } = record;
const string = materialAttributeList?.reduce((prev, current) => {
const { customerAttributeValueList } = current;
const temp = customerAttributeValueList?.map((_item) => {
return _item.value
}).join('/');
return prev + "/" + temp
}, "").slice(1);
return (
<div>{string}</div>
)
}
// render: (text, record) => {
// const { materialAttributeList } = record;
// const string = materialAttributeList?.reduce((prev, current) => {
// const { customerAttributeValueList } = current;
// const temp = customerAttributeValueList?.map((_item) => {
// return _item.value
// }).join('/');
// return prev + "/" + temp
// }, "").slice(1);
// return (
// <div>{string}</div>
// )
// }
},
{
title: '品类',
......
......@@ -24,6 +24,7 @@ export const schema: ISchema = {
{
limitByte: true,
maxByte: 12,
allowChineseTransform: false,
}
]
},
......
......@@ -210,9 +210,10 @@ const MaterialAdd = (props) => {
const toArrayData = Array.isArray(rest[_item]) ? rest[_item] : [rest[_item]]
const customerAttributeValueList = toArrayData.map((_row) => {
const splitData = _row?.split("-");
const isInput = splitData.length === 1
return {
id: splitData[0],
value: splitData[1]
id: isInput ? null : splitData[0],
value: isInput ? splitData[0] : splitData[1]
}
})
return {
......@@ -238,8 +239,7 @@ const MaterialAdd = (props) => {
...withMaterialGroup,
...withChangeData,
}
console.log(postData)
// return;
console.log("postData", postData)
setSubmitLoading(true);
const { code, data } = await postProductGoodsSaveOrUpdateGoods(postData);
setSubmitLoading(false);
......@@ -249,12 +249,21 @@ const MaterialAdd = (props) => {
history.back();
}, 100)
}
console.log("postData", postData)
}
const renderTitle = () => {
if (isEdit) {
return '编辑物料'
}
if (isAdd) {
return '新增物料'
}
return '查看物料详情'
}
return (
<AnchorPage
title={"新增物料"}
title={renderTitle()}
anchors={anchorHeader}
extra={
(isAdd || isEdit) && (
......@@ -289,10 +298,17 @@ const MaterialAdd = (props) => {
}}
effects={($, actions) => {
useAsyncCascader('category', fetchCategoryData)
useAsyncSelect('brandId', fetchBrand, ["name", "id"])
useAsyncSelect('brand', fetchBrand, ["name", "id"])
useAsyncCascader('materialGroup', fetchTreeData);
useAsyncSelect('unitId', fetchUnit, ["name", "id"])
$('onFieldInputChange', 'category').subscribe((fieldState) => {
$('onFormMount').subscribe(() => {
if (isEdit) {
formActions.setFieldState('code', (state) => {
FormPath.setIn(state, 'editable', false);
})
}
})
$('onFieldValueChange', 'category').subscribe((fieldState) => {
if (!fieldState.value || fieldState.value.length === 0) {
setSchema(
getSchema(
......@@ -302,8 +318,6 @@ const MaterialAdd = (props) => {
return;
}
const categoryId = [...fieldState.value].pop();
console.log(categoryId);
getProductCustomerGetCustomerCategoryById({id: categoryId})
.then((data) => {
console.log(data);
......
......@@ -9,7 +9,7 @@ import { Button, Card, Cascader, message, Modal, Popconfirm, Space, Spin } from
import { getColumn } from '../common/columns';
import { createFormActions, Schema } from '@formily/antd';
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable';
import { GetProductGoodsGetMaterialListRequest, getProductGoodsGetSubGoodsList, getProductGoodsGetToBeAddGoodsList, postProductGoodsDeleteBatchGoods, postProductGoodsSubmit } from '@/services/ProductV2Api';
import { GetProductGoodsGetMaterialListRequest, getProductGoodsGetSubGoodsList, getProductGoodsGetToBeAddGoodsList, getProductMaterialProcessIsExistMaterialProcess, postProductGoodsDeleteBatchGoods, postProductGoodsSubmit } from '@/services/ProductV2Api';
import { SearchParams } from '../materialQuery';
import { EMPTY, fetchBrand, fetchCategoryData, fetchTreeData, useAsyncCascader } from '../common/useGetTableSearchData';
import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect';
......@@ -43,19 +43,37 @@ const MaterialQuery = () => {
const handleSubmit = async (_row) => {
setIsLoading((prev) => prev.concat(_row.id))
const { data, code } = await postProductGoodsSubmit({ id: _row.id });
setIsLoading((prev) => prev.filter((_item) => _item !== _row.id))
if (code === 1000) {
formActions.submit();
} else if (code === 43149) {
try {
const materialGroupId = _row.materialGroup?.id
? { materialGroupId: _row.materialGroup?.id }
: {}
const processRes = await getProductMaterialProcessIsExistMaterialProcess({
materialId: _row.id,
processType: _row.interiorState === 1 ? `1` : `2`,
...materialGroupId,
} as any)
if (processRes.code !== 1000 || !processRes.data) {
Modal.warning({
title: '提交提醒',
content: `当前还未创建审核工作流, 请在物料审核流程规则配置设置`,
content: (
<div>当前还未创建审核工作流, 请在<a target={"_blank"} href={`/memberCenter/commodityAbility/material/materialAuditProcessConfig`}>物料审核流程规则配置</a>设置</div>
),
onOk() {
console.log('OK');
},
});
return;
}
const { data, code } = await postProductGoodsSubmit({ id: _row.id });
if (code === 1000) {
formActions.submit();
}
} catch(e) {}
finally {
setIsLoading((prev) => prev.filter((_item) => _item !== _row.id))
}
}
const columns = getColumn({
......@@ -161,11 +179,17 @@ const MaterialQuery = () => {
}
const handleSearch = (values: SearchParams) => {
const formatMaterialGroupId = values.materialGroupId && values.materialGroupId.length > 0
? { materialGroupId: values.materialGroupId?.pop() }
const { materialGroupId, customerCategoryId, ...rest } = values;
const formatMaterialGroupId = materialGroupId && materialGroupId.length > 0
? { materialGroupId: materialGroupId?.pop() }
: { }
const formatCategoryId = customerCategoryId && customerCategoryId.length > 0
? { customerCategoryId: customerCategoryId?.pop() }
: { }
const result = { ...values, ...formatMaterialGroupId }
const result = { ...rest, ...formatMaterialGroupId, ...formatCategoryId }
ref.current.reload(result)
};
......@@ -210,6 +234,7 @@ const MaterialQuery = () => {
unitId: target.unitId,
name: target.name,
goodsId: target.id,
type: target.type,
}
}
})
......
......@@ -44,11 +44,26 @@ export const getSchema = (schema: ISchema): ISchema => {
{
limitByte: true,
maxByte: 20,
allowChineseTransform: false
},
{
pattern: /(?=.*[0-9])(?=.*[~!@#$%^&*()_+`\-={}:";'<>?,.\/])(?=.*[a-zA-Z])/,
message: '编号由英文(不分大小写)、数字、特殊字符组成'
}
},
]
},
type: {
title: '规格型号',
type: 'string',
'x-rules': [
{
required: true,
message: '请填写规格型号'
},
{
limitByte: true,
maxByte: 24,
},
]
},
unitId: {
......@@ -217,6 +232,10 @@ export const getSchema = (schema: ISchema): ISchema => {
{
required: true,
message: '请填写备注',
},
{
limitByte: true,
maxByte: 200,
}
]
}
......@@ -253,7 +272,13 @@ export const getSchema = (schema: ISchema): ISchema => {
properties: {
changeRemark: {
title: '变更内容',
type: 'textarea'
type: 'textarea',
'x-rules': [
{
limitByte: true,
maxByte: 200,
}
]
}
}
},
......@@ -351,7 +376,7 @@ export const propsCardSchema = (schema: ISchema): ISchema => {
"x-component": 'MellowCard',
"x-component-props": {
id: 'type',
title: '规格型号'
title: '属性'
},
properties: {
layout: {
......
......@@ -12,6 +12,8 @@ type Options = {
memberRoleId: number,
unitId: string,
name: string
/** 规格 */
type: string
}
},
query?: {
......@@ -49,6 +51,14 @@ function useInitialValue(options: Options) {
return null
}
const category = initialValue.customerCategory?.fullId?.split('.').map((_item) => _item.replace(/0+/, ""));
const customerAttribute = {};
initialValue?.materialAttributeList.forEach((_item) => {
/** 1-单选、2-多选、3-输入 */
const isInput = _item.customerAttributeValueList?.[0]?.type === 3;
const res = isInput ? `${ _item.customerAttributeValueList?.[0]?.value}` : `${_item.customerAttributeValueList?.[0]?.id}-${ _item.customerAttributeValueList?.[0]?.value}`
customerAttribute[`customerAttribute-${_item.customerAttribute.id}`] = res;
})
return {
...initialValue,
brand: initialValue?.brand?.id,
......@@ -63,7 +73,9 @@ function useInitialValue(options: Options) {
goodsPic: initialValue.goodsPic?.map((_item) => ({
name: _item,
url: _item,
}))
})),
remark: initialValue?.remake,
...customerAttribute,
}
}, [initialValue])
......
......@@ -77,11 +77,16 @@ const MaterialQuery = () => {
}
const handleSearch = (values: any) => {
const formatMaterialGroupId = values.materialGroupId && values.materialGroupId.length > 0
? { materialGroupId: values.materialGroupId?.pop() }
const { materialGroupId, customerCategoryId, ...rest } = values;
const formatMaterialGroupId = materialGroupId && materialGroupId.length > 0
? { materialGroupId: materialGroupId?.pop() }
: { }
const result = { ...values, ...formatMaterialGroupId }
const formatCategoryId = customerCategoryId && customerCategoryId.length > 0
? { customerCategoryId: customerCategoryId?.pop() }
: { }
const result = { ...rest, ...formatMaterialGroupId, ...formatCategoryId }
ref.current.reload(result)
};
......@@ -99,7 +104,7 @@ const MaterialQuery = () => {
return (
<PageHeaderWrapper
title={"物料"}
title={"待审核变更一级"}
>
<Card>
<StandardTable
......@@ -120,7 +125,7 @@ const MaterialQuery = () => {
effects={($, actions) => {
useStateFilterSearchLinkageEffect($, actions, 'code', FORM_FILTER_PATH);
useAsyncCascader('materialGroupId', fetchTreeData)
useAsyncCascader('categoryId', fetchCategoryData)
useAsyncCascader('customerCategoryId', fetchCategoryData)
useAsyncSelect('brandId', fetchBrand, ["name", "id"])
}}
/>
......
......@@ -79,11 +79,16 @@ const MaterialQuery = () => {
}
const handleSearch = (values: any) => {
const formatMaterialGroupId = values.materialGroupId && values.materialGroupId.length > 0
? { materialGroupId: values.materialGroupId?.pop() }
const { materialGroupId, customerCategoryId, ...rest } = values;
const formatMaterialGroupId = materialGroupId && materialGroupId.length > 0
? { materialGroupId: materialGroupId?.pop() }
: { }
const result = { ...values, ...formatMaterialGroupId }
const formatCategoryId = customerCategoryId && customerCategoryId.length > 0
? { customerCategoryId: customerCategoryId?.pop() }
: { }
const result = { ...rest, ...formatMaterialGroupId, ...formatCategoryId }
ref.current.reload(result)
};
......@@ -101,7 +106,7 @@ const MaterialQuery = () => {
return (
<PageHeaderWrapper
title={"物料"}
title={"待审核变更二级"}
>
<Card>
<StandardTable
......@@ -122,7 +127,7 @@ const MaterialQuery = () => {
effects={($, actions) => {
useStateFilterSearchLinkageEffect($, actions, 'code', FORM_FILTER_PATH);
useAsyncCascader('materialGroupId', fetchTreeData)
useAsyncCascader('categoryId', fetchCategoryData)
useAsyncCascader('customerCategoryId', fetchCategoryData)
useAsyncSelect('brandId', fetchBrand, ["name", "id"])
}}
/>
......
......@@ -77,11 +77,17 @@ const MaterialQuery = () => {
}
const handleSearch = (values: any) => {
const formatMaterialGroupId = values.materialGroupId && values.materialGroupId.length > 0
? { materialGroupId: values.materialGroupId?.pop() }
const { materialGroupId, customerCategoryId, ...rest } = values;
const formatMaterialGroupId = materialGroupId && materialGroupId.length > 0
? { materialGroupId: materialGroupId?.pop() }
: { }
const formatCategoryId = customerCategoryId && customerCategoryId.length > 0
? { customerCategoryId: customerCategoryId?.pop() }
: { }
const result = { ...values, ...formatMaterialGroupId }
const result = { ...rest, ...formatMaterialGroupId, ...formatCategoryId }
ref.current.reload(result)
};
......@@ -99,7 +105,7 @@ const MaterialQuery = () => {
return (
<PageHeaderWrapper
title={"物料"}
title={"待审核一级"}
>
<Card>
<StandardTable
......@@ -120,7 +126,7 @@ const MaterialQuery = () => {
effects={($, actions) => {
useStateFilterSearchLinkageEffect($, actions, 'code', FORM_FILTER_PATH);
useAsyncCascader('materialGroupId', fetchTreeData)
useAsyncCascader('categoryId', fetchCategoryData)
useAsyncCascader('customerCategoryId', fetchCategoryData)
useAsyncSelect('brandId', fetchBrand, ["name", "id"])
}}
/>
......
......@@ -77,11 +77,17 @@ const MaterialQuery = () => {
}
const handleSearch = (values: any) => {
const formatMaterialGroupId = values.materialGroupId && values.materialGroupId.length > 0
? { materialGroupId: values.materialGroupId?.pop() }
const { materialGroupId, customerCategoryId, ...rest } = values;
const formatMaterialGroupId = materialGroupId && materialGroupId.length > 0
? { materialGroupId: materialGroupId?.pop() }
: { }
const formatCategoryId = customerCategoryId && customerCategoryId.length > 0
? { customerCategoryId: customerCategoryId?.pop() }
: { }
const result = { ...values, ...formatMaterialGroupId }
const result = { ...rest, ...formatMaterialGroupId, ...formatCategoryId }
ref.current.reload(result)
};
......@@ -99,7 +105,7 @@ const MaterialQuery = () => {
return (
<PageHeaderWrapper
title={"物料"}
title={"待审核二级"}
>
<Card>
<StandardTable
......@@ -120,7 +126,7 @@ const MaterialQuery = () => {
effects={($, actions) => {
useStateFilterSearchLinkageEffect($, actions, 'code', FORM_FILTER_PATH);
useAsyncCascader('materialGroupId', fetchTreeData)
useAsyncCascader('categoryId', fetchCategoryData)
useAsyncCascader('customerCategoryId', fetchCategoryData)
useAsyncSelect('brandId', fetchBrand, ["name", "id"])
}}
/>
......
......@@ -25,7 +25,8 @@ const querySchema = getSchema({ showStatus: true });
export type SearchParams = Omit<GetProductGoodsGetMaterialListRequest, 'materialGroupId'> & {
materialGroupId: string[],
status: string | number
status: string | number,
customerCategoryId: string[],
}
const URL_PREFIX = '/memberCenter/commodityAbility/material'
......@@ -195,12 +196,17 @@ const MaterialQuery = () => {
}
const handleSearch = (values: SearchParams) => {
const formatMaterialGroupId = values.materialGroupId && values.materialGroupId.length > 0
? { materialGroupId: values.materialGroupId?.pop() }
const { materialGroupId, customerCategoryId, status, ...rest } = values;
const formatMaterialGroupId = materialGroupId && materialGroupId.length > 0
? { materialGroupId: materialGroupId?.pop() }
: { }
const formatCategoryId = customerCategoryId && customerCategoryId.length > 0
? { customerCategoryId: customerCategoryId?.pop() }
: { }
const formatStatus = values.status ? { ids:[values.status] } : {}
const result = { ...values, ...formatMaterialGroupId, ...formatStatus }
const result = { ...rest, ...formatMaterialGroupId, ...formatStatus, ...formatCategoryId }
ref.current.reload(result)
};
......@@ -247,7 +253,7 @@ const MaterialQuery = () => {
effects={($, actions) => {
useStateFilterSearchLinkageEffect($, actions, 'code', FORM_FILTER_PATH);
useAsyncCascader('materialGroupId', fetchTreeData)
useAsyncCascader('categoryId', fetchCategoryData)
useAsyncCascader('customerCategoryId', fetchCategoryData)
useAsyncSelect('brandId', fetchBrand, ["name", "id"])
useAsyncSelect('status', fetchStatus, ["name", "status"])
}}
......
......@@ -74,7 +74,7 @@ const SourceList = () => {
const renderAddition = () => (
<div className={styles.addition} onClick={handleOpenModal}>
<PlusOutlined />
<span className={styles.text}>新增附件信息</span>
<span className={styles.text}>编辑供应商</span>
</div>
)
......
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