!2470 看图王添加板材材质、材料名(商品名称)字段信息

pull/2472/MERGE
j787701730 11 months ago committed by ChenX
parent 776104bb15
commit 1b7b1ea13d

@ -1,15 +1,15 @@
import { useObserver } from "mobx-react";
import React from "react";
import React, { useRef } from "react";
import { ShareViewStore } from "../ShareViewStore";
import { SPGetSpiteSize } from "../ShareViewUtil";
import BoardRemarksWidget from "./BoardRemarksWidget";
import { GetBlockColor, SPGetSpiteSize } from "../ShareViewUtil";
import { BoardMoreMsgWidget, BoardMsgDialog, IBoardMsgDialogShow } from "./BoardRemarksWidget";
const BoardMessageWidget = (() =>
{
const shareViewStore: ShareViewStore = ShareViewStore.GetInstance();
const BoardMsgDialogRef = useRef<IBoardMsgDialogShow>();
return useObserver(
() =>
{
@ -22,26 +22,21 @@ const BoardMessageWidget = (() =>
<div>{size.height}</div>
<div>{size.width}</div>
<div>{size.thickness}</div>
<div>{shareViewStore.SelectedBoard.BoardProcessOption.color}</div>
{
Array.isArray(shareViewStore.SelectedBoard.BoardProcessOption.remarks) &&
shareViewStore.SelectedBoard.BoardProcessOption.remarks.length ? (
<div
onClick={(e) =>
{
e.stopPropagation();
}}
style={{ pointerEvents: 'auto', cursor: 'default', display: 'flex', alignItems: 'center' }}
>
<span></span>
<BoardRemarksWidget
name={shareViewStore.SelectedBoard.Name}
remarks={shareViewStore.SelectedBoard.BoardProcessOption.remarks}
isPhone
/>
</div>
) : null
}
<div>{GetBlockColor(shareViewStore.SelectedBoard)}</div>
<div
onClick={(e) =>
{
e.stopPropagation();
}}
style={{ pointerEvents: 'auto', cursor: 'default', display: 'flex', alignItems: 'center' }}
>
<span></span>
<BoardMoreMsgWidget onClick={() =>
{
BoardMsgDialogRef.current?.show(shareViewStore.SelectedBoard);
}} />
</div>
<BoardMsgDialog ref={BoardMsgDialogRef} />
</div>
);
} else

@ -1,75 +1,157 @@
import { Dialog, Icon } from '@blueprintjs/core';
import React, { FC, useState } from 'react';
import React, { FC, forwardRef, useImperativeHandle, useState } from 'react';
import { Board } from '../../../DatabaseServices/Entity/Board';
import { ShareViewStore } from '../ShareViewStore';
interface IProps
type IBoardMoreMsgWidgetProps = {
onClick?: () => void;
};
/** 更多信息按钮 */
export const BoardMoreMsgWidget: FC<IBoardMoreMsgWidgetProps> = (props) =>
{
return (
<span style={{
wordBreak: "break-all",
display: 'inline-flex',
width: 24, height: 24,
justifyContent: 'center',
alignItems: 'center',
cursor: 'pointer'
}}
onClick={(e) =>
{
e.stopPropagation();
props.onClick && props.onClick();
}}
>
<Icon icon='comment' color='#1890ff' />
</span>
);
};
interface IBoardMsgDialogProps
{
remarks?: any[];
name?: string;
isPhone?: boolean;
ref: React.Ref<any>;
}
const BoardRemarksWidget: FC<IProps> = (props) =>
export type IBoardMsgDialogShow = {
show: (board: Board) => void;
};
/** 板材 更多信息 备注等 */
export const BoardMsgDialog: FC<IBoardMsgDialogProps> = forwardRef((_props, ref) =>
{
const [open, setOpen] = useState(false);
const [boardName, setBoardName] = useState<string>('');
const [boardMsgList, setBoardMsgList] = useState<{
label: string,
value: string,
}[]>([]);
const [remarks, setRemarks] = useState<[string, string][]>([]);
const shareViewStore: ShareViewStore = ShareViewStore.GetInstance();
useImperativeHandle(ref, () => ({
show: (board: Board) =>
{
const { BoardProcessOption, Name } = board;
const { remarks, material, boardName } = BoardProcessOption;
setBoardName(Name);
setBoardMsgList([
{
label: '材质',
value: material,
},
{
label: '材料名称',
value: boardName,
}
]);
setRemarks(Array.isArray(remarks) ? remarks : []);
setOpen(true);
},
}));
return (
<>
{Array.isArray(props.remarks) && props.remarks.length ? (
<span
style={{ cursor: 'pointer' }}
onClick={(e) =>
{
e.stopPropagation();
}}
>
<span style={{
wordBreak: "break-all", display: 'inline-flex', width: 24, height: 24,
justifyContent: 'center',
alignItems: 'center'
}}
onClick={(e) =>
{
setOpen(true);
e.stopPropagation();
}}
>
<Icon icon='comment' color='#1890ff' />
</span>
<Dialog
isOpen={open} onClose={() =>
{
setOpen(false);
}}
title={`${props.name || "板件"} 备注`}
style={{ width: window.innerWidth <= 768 ? '90vw' : '600px', background: '#fff', paddingBottom: 16 }}
>
<div style={{
padding: 16, paddingBottom: 2, background: '#fff', fontSize: 14,
maxHeight: '80vh', overflow: 'auto'
}}>
<table className='sp-table'>
<thead>
<Dialog
isOpen={open}
onClose={() =>
{
setOpen(false);
}}
title={`${boardName || "板件"} 更多信息`}
style={{
width: window.innerWidth <= 768 ? '90vw' : '600px',
background: '#fff',
paddingBottom: 16
}}
>
<div style={{
padding: 16,
paddingBottom: 2,
background: '#fff',
fontSize: 14,
maxHeight: '80vh',
overflow: 'auto'
}}>
{
shareViewStore.Props.showBom == false ? null : (
<table className='sp-table' style={{ marginBottom: 12, }}>
<colgroup>
<col style={{ width: 76 }} />
<col />
</colgroup>
<thead>
<tr>
<th colSpan={2} style={{ textAlign: 'center' }}></th>
</tr>
</thead>
<tbody>
{boardMsgList.map((item) => (
<tr key={item.label}>
<td
style={{
textAlign: 'right',
borderRight: 'none',
paddingRight: 0,
paddingLeft: 0,
}}>
{item.label}
</td>
<td style={{ paddingLeft: 0, }}>{item.value}</td>
</tr>
))}
</tbody>
</table>
)
}
<table className='sp-table'>
<thead>
<tr>
<th style={{ width: '30%' }}></th>
<th></th>
</tr>
</thead>
<tbody>
{remarks.length ? (
<>
{remarks.map((remark) => (
<tr>
<th style={{ width: '30%' }}></th>
<th></th>
<td>{remark[0]}</td>
<td>{remark[1]}</td>
</tr>
</thead>
<tbody>
{props.remarks.map((remark) => (
<tr>
<td>{remark[0]}</td>
<td>{remark[1]}</td>
</tr>
))}
</tbody>
</table>
</div>
</Dialog>
</span>
) : null}
</>
))
}
</>
) : (
<tr>
<td colSpan={2} style={{ textAlign: 'center' }}></td>
</tr>
)}
</tbody>
</table>
</div>
</Dialog>
);
};
export default BoardRemarksWidget;
});

@ -6,7 +6,7 @@ import { ICompHardwareOption, IHardwareOption, IToplineOption } from "../../../U
import { shareViewApp } from "../ShareViewService";
import { ShareViewStore } from "../ShareViewStore";
import { GetBlockColor, GetBlockNo, GetBoxItemInfo, MaterialDetailScrollTo, SPGetSpiteSize } from "../ShareViewUtil";
import BoardRemarksWidget from "./BoardRemarksWidget";
import { BoardMoreMsgWidget, BoardMsgDialog, IBoardMsgDialogShow } from "./BoardRemarksWidget";
interface IProps
{
@ -31,6 +31,7 @@ const MaterialBottomSheet: React.FC<IProps> = forwardRef((props, ref) =>
const bottomSheetRef = useRef<any>(null);
const shareViewStore: ShareViewStore = ShareViewStore.GetInstance();
const isPhone = window.innerWidth <= 768;
const BoardMsgDialogRef = useRef<IBoardMsgDialogShow>();
useImperativeHandle(ref, () => (
{
@ -209,13 +210,15 @@ const MaterialBottomSheet: React.FC<IProps> = forwardRef((props, ref) =>
<th className="st-td-number"></th>
<th style={{ width: 50 }} className="st-td-number"></th>
<th></th>
<th style={{ width: 44 }}></th>
{!isPhone && <th></th>}
{!isPhone && <th></th>}
<th style={{ width: 44 }}></th>
</tr >
</thead >
<tbody>
{flagRef.current && item.boardList.length == 0 ? (
<tr>
<td colSpan={5} style={{ textAlign: "center" }}></td>
<td colSpan={(!view_id ? 8 : 7) + (isPhone ? 0 : 2)} style={{ textAlign: "center" }}></td>
</tr>
) : item.boardList.map((item: Board, i) =>
{
@ -244,18 +247,20 @@ const MaterialBottomSheet: React.FC<IProps> = forwardRef((props, ref) =>
<td className="st-td-number">{size.width}</td>
<td className="st-td-number">{size.thickness}</td>
<td>{color}</td>
{!isPhone && <td>{item.BoardProcessOption.material}</td>}
{!isPhone && <td>{item.BoardProcessOption.boardName}</td>}
<td style={{ textAlign: "center", padding: 0 }}>
<BoardRemarksWidget
remarks={item.BoardProcessOption.remarks}
name={item.Name}
isPhone={isPhone}
/>
<BoardMoreMsgWidget onClick={() =>
{
BoardMsgDialogRef.current?.show(item);
}} />
</td>
</tr >
</tr>
);
})}
</tbody >
</tbody>
</table >
<BoardMsgDialog ref={BoardMsgDialogRef} />
{
Array.isArray(item.hardwareCompositeList) && item.hardwareCompositeList.length ? (
<table className="sp-table" style={{ marginTop: 8 }}>

Loading…
Cancel
Save