Commit e0715202 authored by 前端-李俊鑫's avatar 前端-李俊鑫

feat: 完善规则引擎国际化

parent e2a12f36
......@@ -136,4 +136,8 @@ export default {
'processRuleSetting.customerName': 'Customer name',
'processRuleSetting.selectCustomer': 'Select customer',
'processRuleSetting.allCustomer': 'All customer',
'processRuleSetting.userList': 'User list',
'processRuleSetting.chulijuese': 'Processing role',
'processRuleSetting.qingxuanzechulijuese': 'Please select a processing role',
'processRuleSetting.deleteRuleTips': 'Are you sure you want to delete this process rule?',
}
......@@ -135,4 +135,8 @@ export default {
'processRuleSetting.customerName': '고객 이름',
'processRuleSetting.selectCustomer': '고객 선택',
'processRuleSetting.allCustomer': '모든 고객',
'processRuleSetting.userList': '사용자 목록',
'processRuleSetting.chulijuese': '역할 처리',
'processRuleSetting.qingxuanzechulijuese': '역할 처리 선택',
'processRuleSetting.deleteRuleTips': '이 프로세스 규칙을 삭제하시겠습니까?',
}
......@@ -136,4 +136,9 @@ export default {
'processRuleSetting.customerName': '客户名称',
'processRuleSetting.selectCustomer': '选择客户',
'processRuleSetting.allCustomer': '全部客户',
'processRuleSetting.userList': '用户列表',
'processRuleSetting.chulijuese': '处理角色',
'processRuleSetting.qingxuanzechulijuese': '请选择处理角色',
'processRuleSetting.deleteRuleTips': '确认要删除该流程规则吗?',
}
......@@ -86,8 +86,8 @@ const ProcessRules = (props: PropsType, ref) => {
// 删除流程规则
const onDeleteRuleWrap = (id: any, callback: () => void) => {
Modal.confirm({
content: '确认要删除该流程规则吗?',
okText: '确定',
content: intl.formatMessage({ id: 'processRuleSetting.deleteRuleTips', defaultMessage: '确认要删除该流程规则吗?' }),
okText: intl.formatMessage({ id: 'common.button.confirm', defaultMessage: '确定' }),
onOk: async () => { callback() }
})
}
......
......@@ -78,7 +78,7 @@ const CategoryDrawer = (props: PropsType, ref) => {
return (
<CommonDrawer
ref={drawRef}
title='选择品类'
title={`${intl.formatMessage({ id: 'common.button.select', defaultMessage: '选择' })}${intl.formatMessage({ id: 'processRuleSetting.pinlei', defaultMessage: '品类' })}`}
width={600}
destroyOnClose
onOk={handleOk}
......
......@@ -48,7 +48,6 @@ const ConfigDrawer = (props: PropsType, ref) => {
}
})
}
console.log('params', params)
setLoading(true)
postRuleEngineConfigBatchSaveOrUpdate(params).then(({ code }) => {
if (code === 1000) {
......@@ -93,7 +92,7 @@ const ConfigDrawer = (props: PropsType, ref) => {
return (
<CommonDrawer
ref={ref}
title='编辑'
title={intl.formatMessage({ id: 'common.button.edit', defaultMessage: '编辑' })}
width={400}
onOk={handleOk}
onCancel={handleCancel}
......
......@@ -146,18 +146,18 @@ const MaterialDrawer = (props: PropsType, ref) => {
const columns2: ColumnType<any>[] = [
{ title: 'ID', dataIndex: 'id', key: 'id' },
{ title: '物料编号', dataIndex: 'code', key: 'code', width: 120 },
{ title: '物料名称', dataIndex: 'name', key: 'name' },
{ title: '物料组', dataIndex: ['materialGroup', 'name'], key: 'materialGroup' },
{ title: '规格型号', dataIndex: 'type', key: 'type' },
{ title: '品类', dataIndex: ['customerCategory', 'name'], key: 'customerCategory' },
{ title: '品牌', dataIndex: ['brand', 'name'], key: 'brand' },
{ title: intl.formatMessage({ id: 'material.code', defaultMessage: '物料编号'}), dataIndex: 'code', key: 'code', width: 120 },
{ title: intl.formatMessage({ id: 'material.name', defaultMessage: '物料名称'}), dataIndex: 'name', key: 'name' },
{ title: intl.formatMessage({ id: 'material.group.title', defaultMessage: '物料组'}), dataIndex: ['materialGroup', 'name'], key: 'materialGroup' },
{ title: intl.formatMessage({ id: 'material.type', defaultMessage: '规格型号'}), dataIndex: 'type', key: 'type' },
{ title: intl.formatMessage({ id: 'material.category', defaultMessage: '品类'}), dataIndex: ['customerCategory', 'name'], key: 'customerCategory' },
{ title: intl.formatMessage({ id: 'material.brand', defaultMessage: '品牌'}), dataIndex: ['brand', 'name'], key: 'brand' },
]
return (
<CommonDrawer
ref={drawRef}
title='选择物料'
title={intl.formatMessage({ id: 'material.modal.selectMaterial.title', defaultMessage: '选择物料'})}
width={1000}
destroyOnClose
onOk={handleOk}
......@@ -183,11 +183,11 @@ const MaterialDrawer = (props: PropsType, ref) => {
onChange={(e) => onSelectAllMaterial(e.target.checked)}
disabled={!!selectCache.length}
>
全部物料
{intl.formatMessage({ id: 'material.all', defaultMessage: '全部物料'})}
</Checkbox>
</div>
<Tabs activeKey={tabKey} onChange={(key: string) => { setTabKey(key) }}>
<Tabs.TabPane tab='可选择' key='1' className='use-ant-pagination-mini'>
<Tabs.TabPane tab={intl.formatMessage({ id: 'processRuleSetting.kexuanze', defaultMessage: '可选择' })} key='1' className='use-ant-pagination-mini'>
{
!isQueryAll && (
<StandardTable
......@@ -221,7 +221,7 @@ const MaterialDrawer = (props: PropsType, ref) => {
)
}
</Tabs.TabPane>
<Tabs.TabPane tab={`已选择(${selectedRows.length})`} key='2'>
<Tabs.TabPane tab={`${intl.formatMessage({ id: 'processRuleSetting.yixuanze', defaultMessage: '已选择' })}(${selectedRows.length})`} key='2'>
<Table
rowKey='id'
dataSource={selectedRows}
......
......@@ -23,7 +23,7 @@ export const schema: ISchema = {
'x-component': 'Search',
'x-component-props': {
allowClear: true,
placeholder: '物料编号'
placeholder: intl.formatMessage({ id: 'material.code', defaultMessage: '物料编号'})
},
},
},
......@@ -45,13 +45,13 @@ export const schema: ISchema = {
type: 'string',
'x-component-props': {
allowClear: true,
placeholder: '物料名称'
placeholder: intl.formatMessage({ id: 'material.name', defaultMessage: '物料名称'})
}
},
type: {
type: 'string',
"x-component-props": {
placeholder: '规格型号'
placeholder: intl.formatMessage({ id: 'material.type', defaultMessage: '规格型号'})
}
},
materialGroupId: {
......@@ -92,7 +92,7 @@ export const schema: ISchema = {
span: 1,
},
'x-component-props': {
children: '查询',
children: intl.formatMessage({ id: 'common.button.search', defaultMessage: '查询'}),
},
},
}
......
......@@ -16,6 +16,7 @@ import { conditionOptions, interrelationOptions, Fields_Type, Select_Content_Typ
import StringDatePicker from '@/components/StringDatePicker'
import moment from 'moment'
import CustomLastSelect from '@/components/CustomLastSelect'
import { useIntl } from 'umi'
type PropsType = {
form?: FormInstance
......@@ -45,6 +46,7 @@ const getKey = (code: string, ruleFieldKey: string, fieldFieldKey: string) => {
}
const ProcessRules = ({ form, fieldsTypeOption, onFormFieldsChange }: PropsType, ref) => {
const intl = useIntl()
const [ruleShowConfig, setRuleShowConfig] = useState<Object>({})
const [rolesOptions, setRolesOptions] = useState<any[]>([])
const [handleRender, setHandleRender] = useState<boolean>(false)
......@@ -89,8 +91,8 @@ const ProcessRules = ({ form, fieldsTypeOption, onFormFieldsChange }: PropsType,
// 删除流程规则
const onDeleteRuleWrap = (id: any, callback: () => void) => {
Modal.confirm({
content: '确认要删除该流程规则吗?',
okText: '确定',
content: intl.formatMessage({ id: 'processRuleSetting.deleteRuleTips', defaultMessage: '确认要删除该流程规则吗?' }),
okText: intl.formatMessage({ id: 'common.button.confirm', defaultMessage: '确定' }),
onOk: async () => {
callback()
// 产品说这里的删除仅作当前编辑情况的删除,不与数据库相关联
......@@ -240,7 +242,7 @@ const ProcessRules = ({ form, fieldsTypeOption, onFormFieldsChange }: PropsType,
onClick={() => onRuleWrap(ruleField.key)}
>
<CaretRightFilled rotate={ruleShowConfig[ruleField.key] ? 90 : 0} style={{ fontSize: 12 }} />
{`流程规则 ${ruleIndex + 1}`}
{`${intl.formatMessage({ id: 'processRuleSetting.liuchengguize', defaultMessage: '流程规则' })} ${ruleIndex + 1}`}
<div
className={styles['rule-delete']}
......@@ -280,7 +282,7 @@ const ProcessRules = ({ form, fieldsTypeOption, onFormFieldsChange }: PropsType,
}
)
}}
title='删除'
title={intl.formatMessage({ id: 'common.button.delete', defaultMessage: '删除' })}
>
<DeleteOutlined />
</div>
......@@ -301,7 +303,7 @@ const ProcessRules = ({ form, fieldsTypeOption, onFormFieldsChange }: PropsType,
{fields.map((field: any, index) => (
<div key={field.key}>
<ConfigFieldCard
title={`条件 ${index + 1}`}
title={`${intl.formatMessage({ id: 'processRuleSetting.condition', defaultMessage: '条件' })} ${index + 1}`}
onClick={() => {
// 移除掉字段的同时,需将对应的存储已选的物料或品类数据一并移除
const { ruleFieldKey, fieldFieldKey, fieldFieldCode } = getRuleAndFieldKey(form.getFieldValue('ruleEngineConfigFieldRelations'), ruleField.key, ruleIndex, field.key, index)
......@@ -394,9 +396,9 @@ const ProcessRules = ({ form, fieldsTypeOption, onFormFieldsChange }: PropsType,
>
{
fieldsTypeItem?.type === Fields_Type.NUMBER ? // 字段类型为数字
<Input type='number' placeholder="请输入" />
<Input type='number' placeholder={intl.formatMessage({ id: 'common.form.input.placeholder', defaultMessage: '请输入' })} />
: fieldsTypeItem?.type === Fields_Type.DATE ? // 字段类型为日期
<StringDatePicker style={{ width: '100%' }} placeholder="请选择" />
<StringDatePicker style={{ width: '100%' }} placeholder={intl.formatMessage({ id: 'common.select', defaultMessage: '请选择' })} />
: fieldsTypeItem?.type === Fields_Type.STRING && fieldsTypeItem?.select_content ? // 字段类型为字符且存在选择弹窗
(
condition === CONDITION_VALUE.EQUAL || condition === CONDITION_VALUE.UNEQUAL ? // 条件为是或不是的情况才显示弹窗
......@@ -428,11 +430,11 @@ const ProcessRules = ({ form, fieldsTypeOption, onFormFieldsChange }: PropsType,
// 非 是/不是 类条件的话显示输入框
<Input
disabled={disabled}
placeholder={disabled ? '已存在相关字段选择了全部物料' : '请输入'}
placeholder={disabled ? intl.formatMessage({ id: 'processRuleSetting.selectAllTips', defaultMessage: '已存在相关字段选择了全部' }) : intl.formatMessage({ id: 'common.form.input.placeholder', defaultMessage: '请输入' })}
/>
)
: // 目前仅有字符/数字/日期三种类型 所以这里是字符+无弹窗的情况
<Input placeholder="请输入" />
<Input placeholder={intl.formatMessage({ id: 'common.form.input.placeholder', defaultMessage: '请输入' })} />
}
</Form.Item>
)
......@@ -454,14 +456,14 @@ const ProcessRules = ({ form, fieldsTypeOption, onFormFieldsChange }: PropsType,
}}
style={{ width: "100%" }}
>
<PlusOutlined /> 新增字段
<PlusOutlined /> {intl.formatMessage({ id: 'processRuleSetting.tianjiaziduan', defaultMessage: '添加字段' })}
</Button>
</Form.Item>
</div>
)
}}
</Form.List>
<ConfigFieldCard title='相互关系'>
<ConfigFieldCard title={intl.formatMessage({ id: 'processRuleSetting.xianghuguanxi', defaultMessage: '相互关系' })}>
<Form.Item
name={[ruleField.name, "relation"]}
fieldKey={[ruleField.fieldKey, "relation"]}
......@@ -473,11 +475,11 @@ const ProcessRules = ({ form, fieldsTypeOption, onFormFieldsChange }: PropsType,
</Radio.Group>
</Form.Item>
</ConfigFieldCard>
<ConfigFieldCard title='处理角色'>
<ConfigFieldCard title={intl.formatMessage({ id: 'processRuleSetting.chulijuese', defaultMessage: '处理角色' })}>
<Form.Item
name={[ruleField.name, "handleMemberRoleId"]}
fieldKey={[ruleField.fieldKey, "handleMemberRoleId"]}
rules={[{ required: true, message: '请选择处理角色' }]}
rules={[{ required: true, message: intl.formatMessage({ id: 'processRuleSetting.qingxuanzechulijuese', defaultMessage: '请选择处理角色' }) }]}
>
<SelectRoles
options={rolesOptions}
......@@ -497,7 +499,7 @@ const ProcessRules = ({ form, fieldsTypeOption, onFormFieldsChange }: PropsType,
onClick={() => {
ruleAdd({ relation: interrelationOptions[0].value })
}}>
添加规则
{intl.formatMessage({ id: 'processRuleSetting.tianjiaguize', defaultMessage: '添加规则' })}
</Button>
</Form.Item>
</div>
......
......@@ -3,12 +3,14 @@ import StandardTable from '@/components/StandardTable'
import { ColumnType } from 'antd/lib/table'
import CommonDrawer from '@/components/CommonDrawer'
import { getMemberUserPageByRoleId } from '@/services/MemberV2Api'
import { useIntl } from 'umi'
interface PropsType {
onOk?: (rows: any[], rowKeys: any[]) => void
}
const SeeUserDrawer = (props: PropsType, ref) => {
const intl = useIntl()
const tableRef = useRef<any>({})
const roleIdRef = useRef<any>()
......@@ -27,17 +29,17 @@ const SeeUserDrawer = (props: PropsType, ref) => {
}
const columns: ColumnType<any>[] = [
{ title: '序号', dataIndex: 'number', key: 'number', render: (text, record, index) => (index + 1) },
{ title: '姓名', dataIndex: 'name', key: 'name' },
{ title: '手机号码', dataIndex: 'phone', key: 'phone' },
{ title: '所属机构', dataIndex: 'orgName', key: 'orgName' },
{ title: '职位', dataIndex: 'jobTitle', key: 'jobTitle' },
{ title: intl.formatMessage({ id: 'material.no', defaultMessage: '序号'}), dataIndex: 'number', key: 'number', render: (text, record, index) => (index + 1) },
{ title: intl.formatMessage({ id: 'authConfig.personName', defaultMessage: '姓名'}), dataIndex: 'name', key: 'name' },
{ title: intl.formatMessage({ id: 'authConfig.tel', defaultMessage: '手机号'}), dataIndex: 'phone', key: 'phone' },
{ title: intl.formatMessage({ id: 'authConfig.orgName', defaultMessage: '所属机构'}), dataIndex: 'orgName', key: 'orgName' },
{ title: intl.formatMessage({ id: 'authConfig.zhiwei', defaultMessage: '职位'}), dataIndex: 'jobTitle', key: 'jobTitle' },
]
return (
<CommonDrawer
ref={ref}
title='用户列表'
title={intl.formatMessage({ id: 'processRuleSetting.userList', defaultMessage: '用户列表'})}
width={800}
footer={null}
onShow={(params: any) => {
......
import { isJSONString } from '@/utils'
import React, { useState, memo, useCallback, useRef, useEffect } from 'react'
import { useIntl } from 'umi'
import MaterialDrawer, { RefHandleType } from '../MaterialDrawer'
import WrapSelect from '../WrapSelect'
......@@ -16,6 +17,7 @@ interface PropsType {
}
const SelectMaterial = (props: PropsType) => {
const intl = useIntl()
const { onChange, value, onQueryAll, onValueChange, isAll, disabled, ...rest } = props
const [selectData, setSelectData] = useState<any[]>([])
const [isQueryAll, setIsQueryAll] = useState<boolean>(false)
......@@ -59,9 +61,9 @@ const SelectMaterial = (props: PropsType) => {
onItemDelete={onItemDelete}
data={selectData}
labelKey='value'
placeholder={isQueryAll ? '全部物料' : '请选择'}
placeholder={isQueryAll ? intl.formatMessage({ id: 'material.all', defaultMessage: '全部物料'}) : intl.formatMessage({ id: 'common.select', defaultMessage: '请选择'})}
disabled={disabled}
tips={disabled ? '已存在相关字段选择了全部物料' : ''}
tips={disabled ? intl.formatMessage({ id: 'processRuleSetting.selectAllTips', defaultMessage: '已存在相关字段选择了全部' }) : ''}
/>
<MaterialDrawer
ref={ref}
......
import React, { useState, memo, useRef } from 'react'
import { getOrderDeliveryNoticeOrderVendorPage } from '@/services/OrderNewV2Api'
import { Button, Col, Row } from 'antd'
import FetchSelect from '@/components/FetchSelect'
import { HandleType } from '@/components/CommonDrawer'
import SeeUserDrawer from '../SeeUserDrawer'
import { useIntl } from 'umi'
const SelectRoles = (props: any) => {
const intl = useIntl()
const { onChange, onValueChange, ...rest } = props
const roleIdRef = useRef<any>(rest?.value)
......@@ -32,7 +33,7 @@ const SelectRoles = (props: any) => {
style={{ marginRight: 0 }}
onClick={() => { drawRef?.current?.show(true, { roleId: roleIdRef.current }) }}
>
用户列表
{intl.formatMessage({ id: 'processRuleSetting.userList', defaultMessage: '用户列表'})}
</Button>
</Col>
</Row>
......
......@@ -3,6 +3,7 @@ import styles from './index.less'
import { LinkOutlined, CloseOutlined } from '@ant-design/icons'
import cs from 'classnames'
import { Tooltip } from 'antd'
import { useIntl } from 'umi'
interface PropsType {
onIconClick?: (isSeeMore?: boolean) => void
......@@ -17,7 +18,18 @@ interface PropsType {
}
const WrapSelect = (props: PropsType) => {
const { onIconClick, onItemClick, onItemDelete, data = [], labelKey = 'name', valueKey='id', placeholder = '请选择', disabled, tips } = props
const intl = useIntl()
const {
onIconClick,
onItemClick,
onItemDelete,
data = [],
labelKey = 'name',
valueKey='id',
placeholder = intl.formatMessage({ id: 'common.select', defaultMessage: '请选择'}),
disabled,
tips
} = props
return (
<div className={styles['wrap-select']}>
......@@ -44,7 +56,7 @@ const WrapSelect = (props: PropsType) => {
{
data.length > 3 && (
<div className={styles['content-item']} onClick={() => { !disabled && onIconClick?.(true) }}>
更多({data.length - 3})
{intl.formatMessage({ id: 'common.text.more', defaultMessage: '更多'})}({data.length - 3})
</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