feat: 新编译器支持i18n检查,修复部分i18n问题
This commit is contained in:
parent
fc80c876cd
commit
22ccb83a46
|
|
@ -46,7 +46,7 @@ const checkers = [
|
|||
const { orderId, price } = data;
|
||||
data.refundable = false;
|
||||
if (orderId) {
|
||||
// 所有已经支付和正在支付的pay之和不能超过订单总和
|
||||
// @oak-ignore 所有已经支付和正在支付的pay之和不能超过订单总和
|
||||
const order = context.select('order', {
|
||||
data: {
|
||||
id: 1,
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ export default function render(props) {
|
|||
const { accounts, oakFullpath, oakExecutable, canCreate, systemId } = props.data;
|
||||
const { t, addItem, execute, clean } = props.methods;
|
||||
const getNotNullMessage = (entity, attr) => {
|
||||
// @oak-ignore
|
||||
return t('notnull', { value: t(`${entity}:attr.${attr}`) });
|
||||
};
|
||||
const errMsg = oakExecutable instanceof OakException && (oakExecutable instanceof OakAttrNotNullException ? getNotNullMessage(oakExecutable.getEntity(), oakExecutable.getAttributes()[0]) : t(oakExecutable.message));
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ export default function render(props) {
|
|||
const { apAccount, aliPay, oakFullpath, systemId } = props.data;
|
||||
const { t, update } = props.methods;
|
||||
if (apAccount) {
|
||||
// @oak-ignore
|
||||
return (<Form labelCol={{ span: 6 }} wrapperCol={{ span: 16 }} layout="horizontal" style={{ minWidth: 860 }}>
|
||||
{(!aliPay || aliPay.$$createAt$$ === 1) && <AliPayUpsert oakPath={`${oakFullpath}.aliPay`} systemId={systemId} key="apCreate"/>}
|
||||
{(apAccount.aliPayId && apAccount?.$$createAt$$ !== 1) && <AliPayUpsert oakPath={`${oakFullpath}.aliPay`} systemId={systemId} key="apUpdate" oakId={apAccount.aliPayId}/>}
|
||||
|
|
|
|||
|
|
@ -9,9 +9,12 @@ export default function render(props) {
|
|||
const { apAccountId, apProducts, oakFullpath, oakExecutable, canCreate, systemId } = props.data;
|
||||
const { t, addItem, execute, clean } = props.methods;
|
||||
const getNotNullMessage = (entity, attr) => {
|
||||
// @oak-ignore
|
||||
return t('notnull', { value: t(`${entity}:attr.${attr}`) });
|
||||
};
|
||||
const errMsg = oakExecutable instanceof OakException && (oakExecutable instanceof OakAttrNotNullException ? getNotNullMessage(oakExecutable.getEntity(), oakExecutable.getAttributes()[0]) : t(oakExecutable.message));
|
||||
const errMsg = oakExecutable instanceof OakException && (
|
||||
// @oak-ignore
|
||||
oakExecutable instanceof OakAttrNotNullException ? getNotNullMessage(oakExecutable.getEntity(), oakExecutable.getAttributes()[0]) : t(oakExecutable.message));
|
||||
const [upsertId, setUpsertId] = useState('');
|
||||
const U = (<Modal width={920} destroyOnClose title={`${t('apProduct:name')}${t('common::action.update')}`} open={!!upsertId} onCancel={() => {
|
||||
clean();
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ export default function render(props) {
|
|||
return (<Form labelCol={{ span: 8 }} wrapperCol={{ span: 12 }} layout="horizontal" style={{ minWidth: 560 }}>
|
||||
<Form.Item label={t('apProduct:attr.type')}>
|
||||
<Select value={apProduct.type} options={['native', 'mp', 'jsapi', 'h5', 'app', 'person', 'code'].map(ele => ({
|
||||
// @oak-ignore
|
||||
label: t(`apProduct:v.type.${ele}`),
|
||||
value: ele,
|
||||
}))} onSelect={(type) => {
|
||||
|
|
|
|||
|
|
@ -41,11 +41,15 @@ export default function render(props) {
|
|||
const getNotNullMessage = (attr) => {
|
||||
if (['channel', 'name', 'qrCode'].includes(attr)) {
|
||||
const upsertRow = accounts?.find(ele => ele.id === upsertId);
|
||||
// @oak-ignore
|
||||
return t('notnull', { value: t(`offlineAccount::label.${attr}.${upsertRow.type}`) });
|
||||
}
|
||||
// @oak-ignore
|
||||
return t('notnull', { value: t(`offlineAccount:attr.${attr}`) });
|
||||
};
|
||||
const errMsg = oakExecutable instanceof OakException && (oakExecutable instanceof OakAttrNotNullException ? getNotNullMessage(oakExecutable.getAttributes()[0]) : t(oakExecutable.message));
|
||||
const errMsg = oakExecutable instanceof OakException && (
|
||||
// @oak-ignore
|
||||
oakExecutable instanceof OakAttrNotNullException ? getNotNullMessage(oakExecutable.getAttributes()[0]) : t(oakExecutable.message));
|
||||
const U = (<Modal destroyOnClose width={920} title={`${t('offlineAccount:name')}${t('common::action.add')}`} open={!!upsertId} onCancel={() => {
|
||||
clean();
|
||||
setUpsertId('');
|
||||
|
|
|
|||
|
|
@ -7,17 +7,22 @@ export default function render(props) {
|
|||
return (<Form labelCol={{ span: 8 }} wrapperCol={{ span: 12 }} layout="horizontal" style={{ minWidth: 860, maxHeight: '55vh', overflowY: 'auto' }}>
|
||||
<Form.Item label={t('offlineAccount:attr.type')} required>
|
||||
<Select value={offlineAccount.type} options={['bank', 'alipay', 'wechat', 'shouqianba', 'others'].map(ele => ({
|
||||
// @oak-ignore
|
||||
label: t(`offlineAccount:v.type.${ele}`),
|
||||
value: ele,
|
||||
}))} onSelect={(value) => update({ type: value })}/>
|
||||
</Form.Item>
|
||||
{['bank', 'others'].includes(offlineAccount.type) && <Form.Item label={t(`offlineAccount::label.channel.${offlineAccount.type}`)} required>
|
||||
{['bank', 'others'].includes(offlineAccount.type) && <Form.Item
|
||||
// @oak-ignore
|
||||
label={t(`offlineAccount::label.channel.${offlineAccount.type}`)} required>
|
||||
<Input value={offlineAccount.channel || ''} onChange={({ currentTarget }) => {
|
||||
const { value } = currentTarget;
|
||||
update({
|
||||
channel: value,
|
||||
});
|
||||
}} placeholder={t(`placeholder.channel.${offlineAccount.type}`)}/>
|
||||
}}
|
||||
// @oak-ignore
|
||||
placeholder={t(`placeholder.channel.${offlineAccount.type}`)}/>
|
||||
</Form.Item>}
|
||||
{!!offlineAccount.type && <Form.Item label={t(`offlineAccount::label.name.${offlineAccount.type}`)} required={['bank'].includes(offlineAccount.type)}>
|
||||
<Input value={offlineAccount.name || ''} onChange={({ currentTarget }) => {
|
||||
|
|
|
|||
|
|
@ -46,7 +46,9 @@ export default function Render(props) {
|
|||
return (<ErrorBlock status="default" title={t('paying')}/>);
|
||||
}
|
||||
if (!legal) {
|
||||
return (<ErrorBlock status="default" title={t('illegalState', { state: t(`order:v.iState.${order.iState}`) })}/>);
|
||||
return (<ErrorBlock status="default"
|
||||
// @oak-ignore
|
||||
title={t('illegalState', { state: t(`order:v.iState.${order.iState}`) })}/>);
|
||||
}
|
||||
return (<div className={Styles.container}>
|
||||
<Info t={t} price={ToYuan(order.price)}/>
|
||||
|
|
|
|||
|
|
@ -45,7 +45,9 @@ export default function Render(props) {
|
|||
return (<Result status="warning" title={t('paying')}/>);
|
||||
}
|
||||
if (!legal) {
|
||||
return (<Result status="warning" title={t('illegalState', { state: t(`order:v.iState.${order.iState}`) })}/>);
|
||||
return (<Result status="warning"
|
||||
// @oak-ignore
|
||||
title={t('illegalState', { state: t(`order:v.iState.${order.iState}`) })}/>);
|
||||
}
|
||||
return (<div className={Styles.container}>
|
||||
<Info t={t} price={ToYuan(order.price)}/>
|
||||
|
|
|
|||
|
|
@ -201,6 +201,7 @@ export default function Render(props) {
|
|||
{t('common::back')}
|
||||
</Button>);
|
||||
}
|
||||
// @oak-ignore
|
||||
return (<div className={Styles.container}>
|
||||
<Card title={t('title')} extra={<Tag color={iStateColor}>{t(`pay:v.iState.${iState}`)}</Tag>}>
|
||||
<div>
|
||||
|
|
|
|||
|
|
@ -211,7 +211,9 @@ export default function Render(props) {
|
|||
</Space>}>
|
||||
<div className={Styles.container}>
|
||||
<div className={Styles.detail}>
|
||||
<Descriptions column={1} bordered items={[
|
||||
<Descriptions column={1} bordered
|
||||
// @oak-ignore
|
||||
items={[
|
||||
{
|
||||
key: '0',
|
||||
label: t('type.label'),
|
||||
|
|
|
|||
|
|
@ -78,6 +78,7 @@ export default function Render(props) {
|
|||
'offlineAccount': 'red',
|
||||
'wpProduct': 'green',
|
||||
};
|
||||
// @oak-ignore
|
||||
return (<div>
|
||||
<Tag color={colorDict[entity] || 'gray'}>{t(`payChannel::${row.entity}`)}</Tag>
|
||||
{entity === 'offlineAccount' && (<div className={Styles.entityDetail}>
|
||||
|
|
|
|||
|
|
@ -154,6 +154,7 @@ export default function render(props) {
|
|||
...Object.keys(PayChannelConfigDict).map((ele) => {
|
||||
const C = PayChannelConfigDict[ele];
|
||||
return {
|
||||
// @oak-ignore
|
||||
label: (<div className={Styles.systemLabel}>
|
||||
{t(`${ele}:name`)}
|
||||
</div>),
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@ export default function Render(props) {
|
|||
'offlineAccount': 'red',
|
||||
'wpProduct': 'green',
|
||||
};
|
||||
// @oak-ignore
|
||||
return (<div>
|
||||
<Tag color={colorDict[entity] || 'gray'}>{t(`payChannel::${entity}`)}</Tag>
|
||||
<div className={Styles.entityDetail}>{row.payChannel}</div>
|
||||
|
|
|
|||
|
|
@ -130,6 +130,7 @@ export default function render(props) {
|
|||
if (DetailRender) {
|
||||
Modal.info({
|
||||
width: 560,
|
||||
// @oak-ignore
|
||||
title: `${t(`${entity}:name`)}${t('common::action.detail')}`,
|
||||
content: (<DetailRender data={data} systemId={systemId} t={t}/>),
|
||||
onOk() { },
|
||||
|
|
@ -151,8 +152,12 @@ export default function render(props) {
|
|||
setShowHistoryList(false);
|
||||
}} width={800} title={showHistoryAcc.entity === 'offlineAccount' ?
|
||||
(showHistoryAcc.data.type === 'bank' ?
|
||||
// @oak-ignore
|
||||
`${t(`${showHistoryAcc.entity}:v.type.${showHistoryAcc.data.type}`)}-${showHistoryAcc.data.channel}-${t('history')}`
|
||||
: `${t(`${showHistoryAcc.entity}:v.type.${showHistoryAcc.data.type}`)}-${showHistoryAcc.data.name}-${t('history')}`) : `${t(`${showHistoryAcc.entity}:name`)}-${t('history')}`} footer={null}>
|
||||
// @oak-ignore
|
||||
: `${t(`${showHistoryAcc.entity}:v.type.${showHistoryAcc.data.type}`)}-${showHistoryAcc.data.name}-${t('history')}`
|
||||
// @oak-ignore
|
||||
) : `${t(`${showHistoryAcc.entity}:name`)}-${t('history')}`} footer={null}>
|
||||
<div style={{ height: '65vh' }}>
|
||||
<SysAccountOperList entity={showHistoryAcc.entity} entityId={showHistoryAcc.data.id} oakPath="$opb-sysAccount-survery-operList"/>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -50,9 +50,12 @@ export default function render(props) {
|
|||
const { accounts, oakFullpath, oakExecutable, canCreate, systemId } = props.data;
|
||||
const { t, addItem, execute, clean } = props.methods;
|
||||
const getNotNullMessage = (entity, attr) => {
|
||||
// @oak-ignore
|
||||
return t('notnull', { value: t(`${entity}:attr.${attr}`) });
|
||||
};
|
||||
const errMsg = oakExecutable instanceof OakException && (oakExecutable instanceof OakAttrNotNullException ? getNotNullMessage(oakExecutable.getEntity(), oakExecutable.getAttributes()[0]) : t(oakExecutable.message));
|
||||
const errMsg = oakExecutable instanceof OakException && (
|
||||
// @oak-ignore
|
||||
oakExecutable instanceof OakAttrNotNullException ? getNotNullMessage(oakExecutable.getEntity(), oakExecutable.getAttributes()[0]) : t(oakExecutable.message));
|
||||
const [upsertId, setUpsertId] = useState('');
|
||||
const U = (<Modal width={920} destroyOnClose title={`${t('wpAccount:name')}${t('common::action.add')}`} open={!!upsertId} onCancel={() => {
|
||||
clean();
|
||||
|
|
|
|||
|
|
@ -9,9 +9,12 @@ export default function render(props) {
|
|||
const { wpAccountId, wpProducts, oakFullpath, oakExecutable, canCreate, systemId } = props.data;
|
||||
const { t, addItem, execute, clean } = props.methods;
|
||||
const getNotNullMessage = (entity, attr) => {
|
||||
// @oak-ignore
|
||||
return t('notnull', { value: t(`${entity}:attr.${attr}`) });
|
||||
};
|
||||
const errMsg = oakExecutable instanceof OakException && (oakExecutable instanceof OakAttrNotNullException ? getNotNullMessage(oakExecutable.getEntity(), oakExecutable.getAttributes()[0]) : t(oakExecutable.message));
|
||||
const errMsg = oakExecutable instanceof OakException && (
|
||||
// @oak-ignore
|
||||
oakExecutable instanceof OakAttrNotNullException ? getNotNullMessage(oakExecutable.getEntity(), oakExecutable.getAttributes()[0]) : t(oakExecutable.message));
|
||||
const [upsertId, setUpsertId] = useState('');
|
||||
const U = (<Modal width={920} destroyOnClose title={`${t('wpProduct:name')}${t('common::action.update')}`} open={!!upsertId} onCancel={() => {
|
||||
clean();
|
||||
|
|
|
|||
|
|
@ -6,7 +6,9 @@ export default function render(props) {
|
|||
if (wpProduct) {
|
||||
return (<Form labelCol={{ span: 8 }} wrapperCol={{ span: 12 }} layout="horizontal" style={{ minWidth: 560 }}>
|
||||
<Form.Item label={t('wpProduct:attr.type')}>
|
||||
<Select value={wpProduct.type} options={['native', 'mp', 'jsapi', 'h5', 'app'].map(ele => ({
|
||||
<Select value={wpProduct.type} options={['native', 'mp', 'jsapi', 'h5', 'app'].map(
|
||||
// @oak-ignore
|
||||
ele => ({
|
||||
label: t(`wpProduct:v.type.${ele}`),
|
||||
value: ele,
|
||||
}))} onSelect={(type) => {
|
||||
|
|
|
|||
|
|
@ -104,6 +104,7 @@ export default function render(props: WebComponentProps<EntityDict, 'apAccount',
|
|||
|
||||
|
||||
const getNotNullMessage = (entity: string, attr: keyof EntityDict[keyof EntityDict]['OpSchema']) => {
|
||||
// @oak-ignore
|
||||
return t('notnull', { value: t(`${entity}:attr.${attr}`) });
|
||||
};
|
||||
const errMsg = oakExecutable instanceof OakException && (
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ export default function render(props: WebComponentProps<EntityDict, 'apAccount',
|
|||
const { t, update } = props.methods;
|
||||
|
||||
if (apAccount) {
|
||||
// @oak-ignore
|
||||
return (
|
||||
<Form
|
||||
labelCol={{ span: 6 }}
|
||||
|
|
|
|||
|
|
@ -20,9 +20,11 @@ export default function render(props: WebComponentProps<EntityDict, 'apProduct',
|
|||
const { t, addItem, execute, clean } = props.methods;
|
||||
|
||||
const getNotNullMessage = (entity: string, attr: keyof EntityDict[keyof EntityDict]['OpSchema']) => {
|
||||
// @oak-ignore
|
||||
return t('notnull', { value: t(`${entity}:attr.${attr}`) });
|
||||
};
|
||||
const errMsg = oakExecutable instanceof OakException && (
|
||||
// @oak-ignore
|
||||
oakExecutable instanceof OakAttrNotNullException ? getNotNullMessage(oakExecutable.getEntity() as string, oakExecutable.getAttributes()[0] as keyof EntityDict[keyof EntityDict]['OpSchema']) : t(oakExecutable.message)
|
||||
);
|
||||
const [upsertId, setUpsertId] = useState('');
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ export default function render(props: WebComponentProps<EntityDict, 'apProduct',
|
|||
value={apProduct.type}
|
||||
options={['native', 'mp', 'jsapi', 'h5', 'app', 'person', 'code'].map(
|
||||
ele => ({
|
||||
// @oak-ignore
|
||||
label: t(`apProduct:v.type.${ele}`),
|
||||
value: ele,
|
||||
})
|
||||
|
|
|
|||
|
|
@ -80,12 +80,14 @@ export default function render(props: WebComponentProps<EntityDict, 'offlineAcco
|
|||
const getNotNullMessage = (attr: keyof EntityDict['offlineAccount']['OpSchema']) => {
|
||||
if (['channel', 'name', 'qrCode'].includes(attr)) {
|
||||
const upsertRow = accounts?.find(ele => ele.id === upsertId)!;
|
||||
|
||||
// @oak-ignore
|
||||
return t('notnull', { value: t(`offlineAccount::label.${attr}.${upsertRow!.type}`) });
|
||||
}
|
||||
// @oak-ignore
|
||||
return t('notnull', { value: t(`offlineAccount:attr.${attr}`) });
|
||||
};
|
||||
const errMsg = oakExecutable instanceof OakException && (
|
||||
// @oak-ignore
|
||||
oakExecutable instanceof OakAttrNotNullException ? getNotNullMessage(oakExecutable.getAttributes()[0] as keyof EntityDict['offlineAccount']['OpSchema']) : t(oakExecutable.message)
|
||||
);
|
||||
const U = (
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ export default function render(props: WebComponentProps<EntityDict, 'offlineAcco
|
|||
value={offlineAccount.type}
|
||||
options={['bank', 'alipay', 'wechat', 'shouqianba', 'others'].map(
|
||||
ele => ({
|
||||
// @oak-ignore
|
||||
label: t(`offlineAccount:v.type.${ele}`),
|
||||
value: ele,
|
||||
})
|
||||
|
|
@ -33,6 +34,7 @@ export default function render(props: WebComponentProps<EntityDict, 'offlineAcco
|
|||
/>
|
||||
</Form.Item>
|
||||
{['bank', 'others'].includes(offlineAccount.type!) && <Form.Item
|
||||
// @oak-ignore
|
||||
label={t(`offlineAccount::label.channel.${offlineAccount.type}`)}
|
||||
required
|
||||
>
|
||||
|
|
@ -44,6 +46,7 @@ export default function render(props: WebComponentProps<EntityDict, 'offlineAcco
|
|||
channel: value,
|
||||
});
|
||||
}}
|
||||
// @oak-ignore
|
||||
placeholder={t(`placeholder.channel.${offlineAccount.type}`)}
|
||||
/>
|
||||
</Form.Item>}
|
||||
|
|
|
|||
|
|
@ -117,6 +117,7 @@ export default function Render(props: WebComponentProps<EntityDict, 'order', fal
|
|||
return (
|
||||
<Result
|
||||
status="warning"
|
||||
// @oak-ignore
|
||||
title={t('illegalState', { state: t(`order:v.iState.${order.iState}`) })}
|
||||
/>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -118,6 +118,7 @@ export default function Render(props: WebComponentProps<EntityDict, 'order', fal
|
|||
return (
|
||||
<ErrorBlock
|
||||
status="default"
|
||||
// @oak-ignore
|
||||
title={t('illegalState', { state: t(`order:v.iState.${order.iState}`) })}
|
||||
/>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -411,6 +411,7 @@ export default function Render(props: WebComponentProps<EntityDict, 'pay', false
|
|||
<Descriptions
|
||||
column={1}
|
||||
bordered
|
||||
// @oak-ignore
|
||||
items={[
|
||||
{
|
||||
key: '0',
|
||||
|
|
|
|||
|
|
@ -388,7 +388,7 @@ export default function Render(props: WebComponentProps<EntityDict, 'pay', false
|
|||
</Button>
|
||||
);
|
||||
}
|
||||
|
||||
// @oak-ignore
|
||||
return (
|
||||
<div className={Styles.container}>
|
||||
<Card
|
||||
|
|
|
|||
|
|
@ -107,6 +107,7 @@ export default function Render(props: WebComponentProps<EntityDict, 'pay', false
|
|||
'offlineAccount': 'red',
|
||||
'wpProduct': 'green',
|
||||
};
|
||||
// @oak-ignore
|
||||
return (
|
||||
<div>
|
||||
<Tag color={colorDict[entity as 'account'] || 'gray'}>{t(`payChannel::${row.entity}`)}</Tag>
|
||||
|
|
|
|||
|
|
@ -308,6 +308,7 @@ export default function render(props: WebComponentProps<EntityDict, 'system', fa
|
|||
(ele) => {
|
||||
const C = PayChannelConfigDict[ele];
|
||||
return {
|
||||
// @oak-ignore
|
||||
label: (
|
||||
<div className={Styles.systemLabel}>
|
||||
{t(`${ele}:name`)}
|
||||
|
|
|
|||
|
|
@ -96,6 +96,7 @@ export default function Render(props: WebComponentProps<EntityDict, 'refund', fa
|
|||
'offlineAccount': 'red',
|
||||
'wpProduct': 'green',
|
||||
};
|
||||
// @oak-ignore
|
||||
return (
|
||||
<div>
|
||||
<Tag color={colorDict[entity as 'account'] || 'gray'}>{t(`payChannel::${entity}`)}</Tag>
|
||||
|
|
|
|||
|
|
@ -289,6 +289,7 @@ export default function render(props: WebComponentProps<EntityDict, 'offlineAcco
|
|||
if (DetailRender) {
|
||||
Modal.info({
|
||||
width: 560,
|
||||
// @oak-ignore
|
||||
title: `${t(`${entity}:name`)}${t('common::action.detail')}`,
|
||||
content: (
|
||||
<DetailRender
|
||||
|
|
@ -320,10 +321,13 @@ export default function render(props: WebComponentProps<EntityDict, 'offlineAcco
|
|||
setShowHistoryList(false);
|
||||
}}
|
||||
width={800}
|
||||
title={showHistoryAcc.entity === 'offlineAccount' ?
|
||||
title={showHistoryAcc.entity === 'offlineAccount' ?
|
||||
(showHistoryAcc.data.type === 'bank' ?
|
||||
// @oak-ignore
|
||||
`${t(`${showHistoryAcc.entity}:v.type.${showHistoryAcc.data.type}`)}-${showHistoryAcc.data.channel}-${t('history')}`
|
||||
// @oak-ignore
|
||||
: `${t(`${showHistoryAcc.entity}:v.type.${showHistoryAcc.data.type}`)}-${showHistoryAcc.data.name}-${t('history')}`
|
||||
// @oak-ignore
|
||||
) : `${t(`${showHistoryAcc.entity}:name`)}-${t('history')}`}
|
||||
footer={null}
|
||||
>
|
||||
|
|
|
|||
|
|
@ -104,9 +104,11 @@ export default function render(props: WebComponentProps<EntityDict, 'wpAccount',
|
|||
|
||||
|
||||
const getNotNullMessage = (entity: string, attr: keyof EntityDict[keyof EntityDict]['OpSchema']) => {
|
||||
// @oak-ignore
|
||||
return t('notnull', { value: t(`${entity}:attr.${attr}`) });
|
||||
};
|
||||
const errMsg = oakExecutable instanceof OakException && (
|
||||
// @oak-ignore
|
||||
oakExecutable instanceof OakAttrNotNullException ? getNotNullMessage(oakExecutable.getEntity() as string, oakExecutable.getAttributes()[0] as keyof EntityDict[keyof EntityDict]['OpSchema']) : t(oakExecutable.message)
|
||||
);
|
||||
const [upsertId, setUpsertId] = useState('');
|
||||
|
|
|
|||
|
|
@ -20,9 +20,11 @@ export default function render(props: WebComponentProps<EntityDict, 'wpProduct',
|
|||
const { t, addItem, execute, clean } = props.methods;
|
||||
|
||||
const getNotNullMessage = (entity: string, attr: keyof EntityDict[keyof EntityDict]['OpSchema']) => {
|
||||
// @oak-ignore
|
||||
return t('notnull', { value: t(`${entity}:attr.${attr}`) });
|
||||
};
|
||||
const errMsg = oakExecutable instanceof OakException && (
|
||||
// @oak-ignore
|
||||
oakExecutable instanceof OakAttrNotNullException ? getNotNullMessage(oakExecutable.getEntity() as string, oakExecutable.getAttributes()[0] as keyof EntityDict[keyof EntityDict]['OpSchema']) : t(oakExecutable.message)
|
||||
);
|
||||
const [upsertId, setUpsertId] = useState('');
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ export default function render(props: WebComponentProps<EntityDict, 'wpProduct',
|
|||
<Select
|
||||
value={wpProduct.type}
|
||||
options={['native', 'mp', 'jsapi', 'h5', 'app'].map(
|
||||
// @oak-ignore
|
||||
ele => ({
|
||||
label: t(`wpProduct:v.type.${ele}`),
|
||||
value: ele,
|
||||
|
|
|
|||
Loading…
Reference in New Issue