Browse Source
* feat: use antd@4 * feat: refactoring old code * feat: use new type * add umi-plugin-antd-icon-config plugin * feat: add table list page (#5742) * feat: add table list page * bugfix: remove unuse interface * better demo * fix lint warning * update api * update api * support sort * change to antd@4 * finish * fix ts error * dep: up @ant-design/pro-layout@5.0.0 * dep: add pro-table@2 * bugfix: fix env tag style error * bugfix: fix typescript error * bugfix: fix login style close #5960 close #5958 * feat: CreateForm use pro-tablepull/6036/head
committed by
GitHub
34 changed files with 1364 additions and 1076 deletions
@ -1,147 +1,105 @@ |
|||||
import { AutoComplete, Icon, Input } from 'antd'; |
import { SearchOutlined } from '@ant-design/icons'; |
||||
import { AutoCompleteProps, DataSourceItemType } from 'antd/es/auto-complete'; |
import { AutoComplete, Input } from 'antd'; |
||||
import React, { Component } from 'react'; |
import useMergeValue from 'use-merge-value'; |
||||
|
import { AutoCompleteProps } from 'antd/es/auto-complete'; |
||||
|
import React, { useRef } from 'react'; |
||||
|
|
||||
import classNames from 'classnames'; |
import classNames from 'classnames'; |
||||
import debounce from 'lodash/debounce'; |
|
||||
import styles from './index.less'; |
import styles from './index.less'; |
||||
|
|
||||
export interface HeaderSearchProps { |
export interface HeaderSearchProps { |
||||
onPressEnter: (value: string) => void; |
onSearch?: (value?: string) => void; |
||||
onSearch: (value: string) => void; |
onChange?: (value?: string) => void; |
||||
onChange: (value: string) => void; |
onVisibleChange?: (b: boolean) => void; |
||||
onVisibleChange: (b: boolean) => void; |
className?: string; |
||||
className: string; |
placeholder?: string; |
||||
placeholder: string; |
options: AutoCompleteProps['options']; |
||||
defaultActiveFirstOption: boolean; |
defaultOpen?: boolean; |
||||
dataSource: DataSourceItemType[]; |
|
||||
defaultOpen: boolean; |
|
||||
open?: boolean; |
open?: boolean; |
||||
defaultValue?: string; |
defaultValue?: string; |
||||
} |
|
||||
|
|
||||
interface HeaderSearchState { |
|
||||
value?: string; |
value?: string; |
||||
searchMode: boolean; |
|
||||
} |
} |
||||
|
|
||||
export default class HeaderSearch extends Component<HeaderSearchProps, HeaderSearchState> { |
const HeaderSearch: React.FC<HeaderSearchProps> = props => { |
||||
private inputRef: Input | null = null; |
const { |
||||
|
className, |
||||
static defaultProps = { |
defaultValue, |
||||
defaultActiveFirstOption: false, |
onVisibleChange, |
||||
onPressEnter: () => {}, |
placeholder, |
||||
onSearch: () => {}, |
open, |
||||
onChange: () => {}, |
defaultOpen, |
||||
className: '', |
...restProps |
||||
placeholder: '', |
} = props; |
||||
dataSource: [], |
|
||||
defaultOpen: false, |
|
||||
onVisibleChange: () => {}, |
|
||||
}; |
|
||||
|
|
||||
static getDerivedStateFromProps(props: HeaderSearchProps) { |
|
||||
if ('open' in props) { |
|
||||
return { |
|
||||
searchMode: props.open, |
|
||||
}; |
|
||||
} |
|
||||
return null; |
|
||||
} |
|
||||
|
|
||||
constructor(props: HeaderSearchProps) { |
|
||||
super(props); |
|
||||
this.state = { |
|
||||
searchMode: props.defaultOpen, |
|
||||
value: props.defaultValue, |
|
||||
}; |
|
||||
this.debouncePressEnter = debounce(this.debouncePressEnter, 500, { |
|
||||
leading: true, |
|
||||
trailing: false, |
|
||||
}); |
|
||||
} |
|
||||
|
|
||||
onKeyDown = (e: React.KeyboardEvent) => { |
const inputRef = useRef<Input | null>(null); |
||||
if (e.key === 'Enter') { |
|
||||
this.debouncePressEnter(); |
|
||||
} |
|
||||
}; |
|
||||
|
|
||||
onChange: AutoCompleteProps['onChange'] = value => { |
const [value, setValue] = useMergeValue<string | undefined>(defaultValue, { |
||||
if (typeof value === 'string') { |
value: props.value, |
||||
const { onSearch, onChange } = this.props; |
onChange: props.onChange, |
||||
this.setState({ value }); |
}); |
||||
if (onSearch) { |
|
||||
onSearch(value); |
|
||||
} |
|
||||
if (onChange) { |
|
||||
onChange(value); |
|
||||
} |
|
||||
} |
|
||||
}; |
|
||||
|
|
||||
enterSearchMode = () => { |
const [searchMode, setSearchMode] = useMergeValue(defaultOpen || false, { |
||||
const { onVisibleChange } = this.props; |
value: props.open, |
||||
onVisibleChange(true); |
onChange: onVisibleChange, |
||||
this.setState({ searchMode: true }, () => { |
}); |
||||
const { searchMode } = this.state; |
|
||||
if (searchMode && this.inputRef) { |
|
||||
this.inputRef.focus(); |
|
||||
} |
|
||||
}); |
|
||||
}; |
|
||||
|
|
||||
leaveSearchMode = () => { |
const inputClass = classNames(styles.input, { |
||||
this.setState({ |
[styles.show]: searchMode, |
||||
searchMode: false, |
}); |
||||
}); |
|
||||
}; |
|
||||
|
|
||||
debouncePressEnter = () => { |
return ( |
||||
const { onPressEnter } = this.props; |
<div |
||||
const { value } = this.state; |
className={classNames(className, styles.headerSearch)} |
||||
onPressEnter(value || ''); |
onClick={() => { |
||||
}; |
setSearchMode(true); |
||||
|
if (searchMode && inputRef.current) { |
||||
render() { |
inputRef.current.focus(); |
||||
const { className, defaultValue, placeholder, open, ...restProps } = this.props; |
} |
||||
const { searchMode, value } = this.state; |
}} |
||||
delete restProps.defaultOpen; // for rc-select not affected
|
onTransitionEnd={({ propertyName }) => { |
||||
const inputClass = classNames(styles.input, { |
if (propertyName === 'width' && !searchMode) { |
||||
[styles.show]: searchMode, |
if (onVisibleChange) { |
||||
}); |
|
||||
|
|
||||
return ( |
|
||||
<span |
|
||||
className={classNames(className, styles.headerSearch)} |
|
||||
onClick={this.enterSearchMode} |
|
||||
onTransitionEnd={({ propertyName }) => { |
|
||||
if (propertyName === 'width' && !searchMode) { |
|
||||
const { onVisibleChange } = this.props; |
|
||||
onVisibleChange(searchMode); |
onVisibleChange(searchMode); |
||||
} |
} |
||||
|
} |
||||
|
}} |
||||
|
> |
||||
|
<SearchOutlined |
||||
|
key="Icon" |
||||
|
style={{ |
||||
|
cursor: 'pointer', |
||||
|
}} |
||||
|
/> |
||||
|
<AutoComplete |
||||
|
key="AutoComplete" |
||||
|
className={inputClass} |
||||
|
value={value} |
||||
|
style={{ |
||||
|
height: 28, |
||||
|
marginTop: -6, |
||||
}} |
}} |
||||
|
options={restProps.options} |
||||
|
onChange={setValue} |
||||
> |
> |
||||
<Icon type="search" key="Icon" /> |
<Input |
||||
<AutoComplete |
ref={inputRef} |
||||
key="AutoComplete" |
defaultValue={defaultValue} |
||||
{...restProps} |
aria-label={placeholder} |
||||
className={inputClass} |
placeholder={placeholder} |
||||
value={value} |
onKeyDown={e => { |
||||
onChange={this.onChange} |
if (e.key === 'Enter') { |
||||
> |
if (restProps.onSearch) { |
||||
<Input |
restProps.onSearch(value); |
||||
ref={node => { |
} |
||||
this.inputRef = node; |
} |
||||
}} |
}} |
||||
defaultValue={defaultValue} |
onBlur={() => { |
||||
aria-label={placeholder} |
setSearchMode(false); |
||||
placeholder={placeholder} |
}} |
||||
onKeyDown={this.onKeyDown} |
/> |
||||
onBlur={this.leaveSearchMode} |
</AutoComplete> |
||||
/> |
</div> |
||||
</AutoComplete> |
); |
||||
</span> |
}; |
||||
); |
|
||||
} |
export default HeaderSearch; |
||||
} |
|
||||
|
|||||
@ -0,0 +1,154 @@ |
|||||
|
import { Request, Response } from 'express'; |
||||
|
import { parse } from 'url'; |
||||
|
import { TableListItem, TableListParams } from './data.d'; |
||||
|
|
||||
|
// mock tableListDataSource
|
||||
|
const genList = (current: number, pageSize: number) => { |
||||
|
const tableListDataSource: TableListItem[] = []; |
||||
|
|
||||
|
for (let i = 0; i < pageSize; i += 1) { |
||||
|
const index = (current - 1) * 10 + i; |
||||
|
tableListDataSource.push({ |
||||
|
key: index, |
||||
|
disabled: i % 6 === 0, |
||||
|
href: 'https://ant.design', |
||||
|
avatar: [ |
||||
|
'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png', |
||||
|
'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png', |
||||
|
][i % 2], |
||||
|
name: `TradeCode ${index}`, |
||||
|
owner: '曲丽丽', |
||||
|
desc: '这是一段描述', |
||||
|
callNo: Math.floor(Math.random() * 1000), |
||||
|
status: Math.floor(Math.random() * 10) % 4, |
||||
|
updatedAt: new Date(), |
||||
|
createdAt: new Date(), |
||||
|
progress: Math.ceil(Math.random() * 100), |
||||
|
}); |
||||
|
} |
||||
|
tableListDataSource.reverse(); |
||||
|
return tableListDataSource; |
||||
|
}; |
||||
|
|
||||
|
let tableListDataSource = genList(1, 100); |
||||
|
|
||||
|
function getRule(req: Request, res: Response, u: string) { |
||||
|
let url = u; |
||||
|
if (!url || Object.prototype.toString.call(url) !== '[object String]') { |
||||
|
// eslint-disable-next-line prefer-destructuring
|
||||
|
url = req.url; |
||||
|
} |
||||
|
const { current = 1, pageSize = 10 } = req.query; |
||||
|
const params = (parse(url, true).query as unknown) as TableListParams; |
||||
|
|
||||
|
let dataSource = [...tableListDataSource].slice((current - 1) * pageSize, current * pageSize); |
||||
|
if (params.sorter) { |
||||
|
const s = params.sorter.split('_'); |
||||
|
dataSource = dataSource.sort((prev, next) => { |
||||
|
if (s[1] === 'descend') { |
||||
|
return next[s[0]] - prev[s[0]]; |
||||
|
} |
||||
|
return prev[s[0]] - next[s[0]]; |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
if (params.status) { |
||||
|
const status = params.status.split(','); |
||||
|
let filterDataSource: TableListItem[] = []; |
||||
|
status.forEach((s: string) => { |
||||
|
filterDataSource = filterDataSource.concat( |
||||
|
dataSource.filter(item => { |
||||
|
if (parseInt(`${item.status}`, 10) === parseInt(s.split('')[0], 10)) { |
||||
|
return true; |
||||
|
} |
||||
|
return false; |
||||
|
}), |
||||
|
); |
||||
|
}); |
||||
|
dataSource = filterDataSource; |
||||
|
} |
||||
|
|
||||
|
if (params.name) { |
||||
|
dataSource = dataSource.filter(data => data.name.includes(params.name || '')); |
||||
|
} |
||||
|
const result = { |
||||
|
data: dataSource, |
||||
|
total: tableListDataSource.length, |
||||
|
success: true, |
||||
|
pageSize, |
||||
|
current: parseInt(`${params.currentPage}`, 10) || 1, |
||||
|
}; |
||||
|
|
||||
|
return res.json(result); |
||||
|
} |
||||
|
|
||||
|
function postRule(req: Request, res: Response, u: string, b: Request) { |
||||
|
let url = u; |
||||
|
if (!url || Object.prototype.toString.call(url) !== '[object String]') { |
||||
|
// eslint-disable-next-line prefer-destructuring
|
||||
|
url = req.url; |
||||
|
} |
||||
|
|
||||
|
const body = (b && b.body) || req.body; |
||||
|
const { method, name, desc, key } = body; |
||||
|
|
||||
|
switch (method) { |
||||
|
/* eslint no-case-declarations:0 */ |
||||
|
case 'delete': |
||||
|
tableListDataSource = tableListDataSource.filter(item => key.indexOf(item.key) === -1); |
||||
|
break; |
||||
|
case 'post': |
||||
|
(() => { |
||||
|
const i = Math.ceil(Math.random() * 10000); |
||||
|
const newRule = { |
||||
|
key: tableListDataSource.length, |
||||
|
href: 'https://ant.design', |
||||
|
avatar: [ |
||||
|
'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png', |
||||
|
'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png', |
||||
|
][i % 2], |
||||
|
name, |
||||
|
owner: '曲丽丽', |
||||
|
desc, |
||||
|
callNo: Math.floor(Math.random() * 1000), |
||||
|
status: Math.floor(Math.random() * 10) % 2, |
||||
|
updatedAt: new Date(), |
||||
|
createdAt: new Date(), |
||||
|
progress: Math.ceil(Math.random() * 100), |
||||
|
}; |
||||
|
tableListDataSource.unshift(newRule); |
||||
|
return res.json(newRule); |
||||
|
})(); |
||||
|
return; |
||||
|
|
||||
|
case 'update': |
||||
|
(() => { |
||||
|
let newRule = {}; |
||||
|
tableListDataSource = tableListDataSource.map(item => { |
||||
|
if (item.key === key) { |
||||
|
newRule = { ...item, desc, name }; |
||||
|
return { ...item, desc, name }; |
||||
|
} |
||||
|
return item; |
||||
|
}); |
||||
|
return res.json(newRule); |
||||
|
})(); |
||||
|
return; |
||||
|
default: |
||||
|
break; |
||||
|
} |
||||
|
|
||||
|
const result = { |
||||
|
list: tableListDataSource, |
||||
|
pagination: { |
||||
|
total: tableListDataSource.length, |
||||
|
}, |
||||
|
}; |
||||
|
|
||||
|
res.json(result); |
||||
|
} |
||||
|
|
||||
|
export default { |
||||
|
'GET /api/rule': getRule, |
||||
|
'POST /api/rule': postRule, |
||||
|
}; |
||||
@ -0,0 +1,25 @@ |
|||||
|
import React from 'react'; |
||||
|
import { Modal } from 'antd'; |
||||
|
|
||||
|
interface CreateFormProps { |
||||
|
modalVisible: boolean; |
||||
|
onCancel: () => void; |
||||
|
} |
||||
|
|
||||
|
const CreateForm: React.FC<CreateFormProps> = props => { |
||||
|
const { modalVisible, onCancel } = props; |
||||
|
|
||||
|
return ( |
||||
|
<Modal |
||||
|
destroyOnClose |
||||
|
title="新建规则" |
||||
|
visible={modalVisible} |
||||
|
onCancel={() => onCancel()} |
||||
|
footer={null} |
||||
|
> |
||||
|
{props.children} |
||||
|
</Modal> |
||||
|
); |
||||
|
}; |
||||
|
|
||||
|
export default CreateForm; |
||||
@ -0,0 +1,215 @@ |
|||||
|
import React, { useState } from 'react'; |
||||
|
import { Form, Button, DatePicker, Input, Modal, Radio, Select, Steps } from 'antd'; |
||||
|
|
||||
|
import { TableListItem } from '../data.d'; |
||||
|
|
||||
|
export interface FormValueType extends Partial<TableListItem> { |
||||
|
target?: string; |
||||
|
template?: string; |
||||
|
type?: string; |
||||
|
time?: string; |
||||
|
frequency?: string; |
||||
|
} |
||||
|
|
||||
|
export interface UpdateFormProps { |
||||
|
onCancel: (flag?: boolean, formVals?: FormValueType) => void; |
||||
|
onSubmit: (values: FormValueType) => void; |
||||
|
updateModalVisible: boolean; |
||||
|
values: Partial<TableListItem>; |
||||
|
} |
||||
|
const FormItem = Form.Item; |
||||
|
const { Step } = Steps; |
||||
|
const { TextArea } = Input; |
||||
|
const { Option } = Select; |
||||
|
const RadioGroup = Radio.Group; |
||||
|
|
||||
|
export interface UpdateFormState { |
||||
|
formVals: FormValueType; |
||||
|
currentStep: number; |
||||
|
} |
||||
|
|
||||
|
const formLayout = { |
||||
|
labelCol: { span: 7 }, |
||||
|
wrapperCol: { span: 13 }, |
||||
|
}; |
||||
|
|
||||
|
const UpdateForm: React.FC<UpdateFormProps> = props => { |
||||
|
const [formVals, setFormVals] = useState<FormValueType>({ |
||||
|
name: props.values.name, |
||||
|
desc: props.values.desc, |
||||
|
key: props.values.key, |
||||
|
target: '0', |
||||
|
template: '0', |
||||
|
type: '1', |
||||
|
time: '', |
||||
|
frequency: 'month', |
||||
|
}); |
||||
|
|
||||
|
const [currentStep, setCurrentStep] = useState<number>(0); |
||||
|
|
||||
|
const [form] = Form.useForm(); |
||||
|
|
||||
|
const { |
||||
|
onSubmit: handleUpdate, |
||||
|
onCancel: handleUpdateModalVisible, |
||||
|
updateModalVisible, |
||||
|
values, |
||||
|
} = props; |
||||
|
|
||||
|
const forward = () => setCurrentStep(currentStep + 1); |
||||
|
|
||||
|
const backward = () => setCurrentStep(currentStep - 1); |
||||
|
|
||||
|
const handleNext = async () => { |
||||
|
const fieldsValue = await form.validateFields(); |
||||
|
|
||||
|
setFormVals({ ...formVals, ...fieldsValue }); |
||||
|
|
||||
|
if (currentStep < 2) { |
||||
|
forward(); |
||||
|
} else { |
||||
|
handleUpdate(formVals); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
const renderContent = () => { |
||||
|
if (currentStep === 1) { |
||||
|
return ( |
||||
|
<> |
||||
|
<FormItem name="target" label="监控对象"> |
||||
|
<Select style={{ width: '100%' }}> |
||||
|
<Option value="0">表一</Option> |
||||
|
<Option value="1">表二</Option> |
||||
|
</Select> |
||||
|
</FormItem> |
||||
|
<FormItem name="template" label="规则模板"> |
||||
|
<Select style={{ width: '100%' }}> |
||||
|
<Option value="0">规则模板一</Option> |
||||
|
<Option value="1">规则模板二</Option> |
||||
|
</Select> |
||||
|
</FormItem> |
||||
|
<FormItem name="type" label="规则类型"> |
||||
|
<RadioGroup> |
||||
|
<Radio value="0">强</Radio> |
||||
|
<Radio value="1">弱</Radio> |
||||
|
</RadioGroup> |
||||
|
</FormItem> |
||||
|
</> |
||||
|
); |
||||
|
} |
||||
|
if (currentStep === 2) { |
||||
|
return ( |
||||
|
<> |
||||
|
<FormItem |
||||
|
name="time" |
||||
|
label="开始时间" |
||||
|
rules={[{ required: true, message: '请选择开始时间!' }]} |
||||
|
> |
||||
|
<DatePicker |
||||
|
style={{ width: '100%' }} |
||||
|
showTime |
||||
|
format="YYYY-MM-DD HH:mm:ss" |
||||
|
placeholder="选择开始时间" |
||||
|
/> |
||||
|
</FormItem> |
||||
|
<FormItem name="frequency" label="调度周期"> |
||||
|
<Select style={{ width: '100%' }}> |
||||
|
<Option value="month">月</Option> |
||||
|
<Option value="week">周</Option> |
||||
|
</Select> |
||||
|
</FormItem> |
||||
|
</> |
||||
|
); |
||||
|
} |
||||
|
return ( |
||||
|
<> |
||||
|
<FormItem |
||||
|
name="name" |
||||
|
label="规则名称" |
||||
|
rules={[{ required: true, message: '请输入规则名称!' }]} |
||||
|
> |
||||
|
<Input placeholder="请输入" /> |
||||
|
</FormItem> |
||||
|
<FormItem |
||||
|
name="desc" |
||||
|
label="规则描述" |
||||
|
rules={[{ required: true, message: '请输入至少五个字符的规则描述!', min: 5 }]} |
||||
|
> |
||||
|
<TextArea rows={4} placeholder="请输入至少五个字符" /> |
||||
|
</FormItem> |
||||
|
</> |
||||
|
); |
||||
|
}; |
||||
|
|
||||
|
const renderFooter = () => { |
||||
|
if (currentStep === 1) { |
||||
|
return ( |
||||
|
<> |
||||
|
<Button style={{ float: 'left' }} onClick={backward}> |
||||
|
上一步 |
||||
|
</Button> |
||||
|
<Button onClick={() => handleUpdateModalVisible(false, values)}>取消</Button> |
||||
|
<Button type="primary" onClick={() => handleNext()}> |
||||
|
下一步 |
||||
|
</Button> |
||||
|
</> |
||||
|
); |
||||
|
} |
||||
|
if (currentStep === 2) { |
||||
|
return ( |
||||
|
<> |
||||
|
<Button style={{ float: 'left' }} onClick={backward}> |
||||
|
上一步 |
||||
|
</Button> |
||||
|
<Button onClick={() => handleUpdateModalVisible(false, values)}>取消</Button> |
||||
|
<Button type="primary" onClick={() => handleNext()}> |
||||
|
完成 |
||||
|
</Button> |
||||
|
</> |
||||
|
); |
||||
|
} |
||||
|
return ( |
||||
|
<> |
||||
|
<Button onClick={() => handleUpdateModalVisible(false, values)}>取消</Button> |
||||
|
<Button type="primary" onClick={() => handleNext()}> |
||||
|
下一步 |
||||
|
</Button> |
||||
|
</> |
||||
|
); |
||||
|
}; |
||||
|
|
||||
|
return ( |
||||
|
<Modal |
||||
|
width={640} |
||||
|
bodyStyle={{ padding: '32px 40px 48px' }} |
||||
|
destroyOnClose |
||||
|
title="规则配置" |
||||
|
visible={updateModalVisible} |
||||
|
footer={renderFooter()} |
||||
|
onCancel={() => handleUpdateModalVisible(false, values)} |
||||
|
afterClose={() => handleUpdateModalVisible()} |
||||
|
> |
||||
|
<Steps style={{ marginBottom: 28 }} size="small" current={currentStep}> |
||||
|
<Step title="基本信息" /> |
||||
|
<Step title="配置规则属性" /> |
||||
|
<Step title="设定调度周期" /> |
||||
|
</Steps> |
||||
|
<Form |
||||
|
{...formLayout} |
||||
|
form={form} |
||||
|
initialValues={{ |
||||
|
target: formVals.target, |
||||
|
template: formVals.template, |
||||
|
type: formVals.type, |
||||
|
frequency: formVals.frequency, |
||||
|
name: formVals.name, |
||||
|
desc: formVals.desc, |
||||
|
}} |
||||
|
> |
||||
|
{renderContent()} |
||||
|
</Form> |
||||
|
</Modal> |
||||
|
); |
||||
|
}; |
||||
|
|
||||
|
export default UpdateForm; |
||||
@ -0,0 +1,35 @@ |
|||||
|
export interface TableListItem { |
||||
|
key: number; |
||||
|
disabled?: boolean; |
||||
|
href: string; |
||||
|
avatar: string; |
||||
|
name: string; |
||||
|
owner: string; |
||||
|
desc: string; |
||||
|
callNo: number; |
||||
|
status: number; |
||||
|
updatedAt: Date; |
||||
|
createdAt: Date; |
||||
|
progress: number; |
||||
|
} |
||||
|
|
||||
|
export interface TableListPagination { |
||||
|
total: number; |
||||
|
pageSize: number; |
||||
|
current: number; |
||||
|
} |
||||
|
|
||||
|
export interface TableListData { |
||||
|
list: TableListItem[]; |
||||
|
pagination: Partial<TableListPagination>; |
||||
|
} |
||||
|
|
||||
|
export interface TableListParams { |
||||
|
sorter?: string; |
||||
|
status?: string; |
||||
|
name?: string; |
||||
|
desc?: string; |
||||
|
key?: number; |
||||
|
pageSize?: number; |
||||
|
currentPage?: number; |
||||
|
} |
||||
@ -0,0 +1,238 @@ |
|||||
|
import { DownOutlined, PlusOutlined } from '@ant-design/icons'; |
||||
|
import { Button, Divider, Dropdown, Menu, message } from 'antd'; |
||||
|
import React, { useState, useRef } from 'react'; |
||||
|
import { PageHeaderWrapper } from '@ant-design/pro-layout'; |
||||
|
import ProTable, { ProColumns, ActionType } from '@ant-design/pro-table'; |
||||
|
import { SorterResult } from 'antd/es/table/interface'; |
||||
|
|
||||
|
import CreateForm from './components/CreateForm'; |
||||
|
import UpdateForm, { FormValueType } from './components/UpdateForm'; |
||||
|
import { TableListItem } from './data.d'; |
||||
|
import { queryRule, updateRule, addRule, removeRule } from './service'; |
||||
|
|
||||
|
/** |
||||
|
* 添加节点 |
||||
|
* @param fields |
||||
|
*/ |
||||
|
const handleAdd = async (fields: TableListItem) => { |
||||
|
const hide = message.loading('正在添加'); |
||||
|
try { |
||||
|
await addRule({ ...fields }); |
||||
|
hide(); |
||||
|
message.success('添加成功'); |
||||
|
return true; |
||||
|
} catch (error) { |
||||
|
hide(); |
||||
|
message.error('添加失败请重试!'); |
||||
|
return false; |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
/** |
||||
|
* 更新节点 |
||||
|
* @param fields |
||||
|
*/ |
||||
|
const handleUpdate = async (fields: FormValueType) => { |
||||
|
const hide = message.loading('正在配置'); |
||||
|
try { |
||||
|
await updateRule({ |
||||
|
name: fields.name, |
||||
|
desc: fields.desc, |
||||
|
key: fields.key, |
||||
|
}); |
||||
|
hide(); |
||||
|
|
||||
|
message.success('配置成功'); |
||||
|
return true; |
||||
|
} catch (error) { |
||||
|
hide(); |
||||
|
message.error('配置失败请重试!'); |
||||
|
return false; |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
/** |
||||
|
* 删除节点 |
||||
|
* @param selectedRows |
||||
|
*/ |
||||
|
const handleRemove = async (selectedRows: TableListItem[]) => { |
||||
|
const hide = message.loading('正在删除'); |
||||
|
if (!selectedRows) return true; |
||||
|
try { |
||||
|
await removeRule({ |
||||
|
key: selectedRows.map(row => row.key), |
||||
|
}); |
||||
|
hide(); |
||||
|
message.success('删除成功,即将刷新'); |
||||
|
return true; |
||||
|
} catch (error) { |
||||
|
hide(); |
||||
|
message.error('删除失败,请重试'); |
||||
|
return false; |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
const TableList: React.FC<{}> = () => { |
||||
|
const [sorter, setSorter] = useState<string>(''); |
||||
|
const [createModalVisible, handleModalVisible] = useState<boolean>(false); |
||||
|
const [updateModalVisible, handleUpdateModalVisible] = useState<boolean>(false); |
||||
|
const [stepFormValues, setStepFormValues] = useState({}); |
||||
|
const actionRef = useRef<ActionType>(); |
||||
|
const columns: ProColumns<TableListItem>[] = [ |
||||
|
{ |
||||
|
title: '规则名称', |
||||
|
dataIndex: 'name', |
||||
|
rules: [ |
||||
|
{ |
||||
|
required: true, |
||||
|
message: '规则名称为必填项', |
||||
|
}, |
||||
|
], |
||||
|
}, |
||||
|
{ |
||||
|
title: '描述', |
||||
|
dataIndex: 'desc', |
||||
|
valueType: 'textarea', |
||||
|
}, |
||||
|
{ |
||||
|
title: '服务调用次数', |
||||
|
dataIndex: 'callNo', |
||||
|
sorter: true, |
||||
|
hideInForm: true, |
||||
|
renderText: (val: string) => `${val} 万`, |
||||
|
}, |
||||
|
{ |
||||
|
title: '状态', |
||||
|
dataIndex: 'status', |
||||
|
hideInForm: true, |
||||
|
valueEnum: { |
||||
|
0: { text: '关闭', status: 'Default' }, |
||||
|
1: { text: '运行中', status: 'Processing' }, |
||||
|
2: { text: '已上线', status: 'Success' }, |
||||
|
3: { text: '异常', status: 'Error' }, |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
title: '上次调度时间', |
||||
|
dataIndex: 'updatedAt', |
||||
|
sorter: true, |
||||
|
valueType: 'dateTime', |
||||
|
hideInForm: true, |
||||
|
}, |
||||
|
{ |
||||
|
title: '操作', |
||||
|
dataIndex: 'option', |
||||
|
valueType: 'option', |
||||
|
render: (_, record) => ( |
||||
|
<> |
||||
|
<a |
||||
|
onClick={() => { |
||||
|
handleUpdateModalVisible(true); |
||||
|
setStepFormValues(record); |
||||
|
}} |
||||
|
> |
||||
|
配置 |
||||
|
</a> |
||||
|
<Divider type="vertical" /> |
||||
|
<a href="">订阅警报</a> |
||||
|
</> |
||||
|
), |
||||
|
}, |
||||
|
]; |
||||
|
|
||||
|
return ( |
||||
|
<PageHeaderWrapper> |
||||
|
<ProTable<TableListItem> |
||||
|
headerTitle="查询表格" |
||||
|
actionRef={actionRef} |
||||
|
rowKey="key" |
||||
|
onChange={(_, _filter, _sorter) => { |
||||
|
const sorterResult = _sorter as SorterResult<TableListItem>; |
||||
|
if (sorterResult.field) { |
||||
|
setSorter(`${sorterResult.field}_${sorterResult.order}`); |
||||
|
} |
||||
|
}} |
||||
|
params={{ |
||||
|
sorter, |
||||
|
}} |
||||
|
toolBarRender={(action, { selectedRows }) => [ |
||||
|
<Button type="primary" onClick={() => handleModalVisible(true)}> |
||||
|
<PlusOutlined /> 新建 |
||||
|
</Button>, |
||||
|
selectedRows && selectedRows.length > 0 && ( |
||||
|
<Dropdown |
||||
|
overlay={ |
||||
|
<Menu |
||||
|
onClick={async e => { |
||||
|
if (e.key === 'remove') { |
||||
|
await handleRemove(selectedRows); |
||||
|
action.reload(); |
||||
|
} |
||||
|
}} |
||||
|
selectedKeys={[]} |
||||
|
> |
||||
|
<Menu.Item key="remove">批量删除</Menu.Item> |
||||
|
<Menu.Item key="approval">批量审批</Menu.Item> |
||||
|
</Menu> |
||||
|
} |
||||
|
> |
||||
|
<Button> |
||||
|
批量操作 <DownOutlined /> |
||||
|
</Button> |
||||
|
</Dropdown> |
||||
|
), |
||||
|
]} |
||||
|
tableAlertRender={(selectedRowKeys, selectedRows) => ( |
||||
|
<div> |
||||
|
已选择 <a style={{ fontWeight: 600 }}>{selectedRowKeys.length}</a> 项 |
||||
|
<span> |
||||
|
服务调用次数总计 {selectedRows.reduce((pre, item) => pre + item.callNo, 0)} 万 |
||||
|
</span> |
||||
|
</div> |
||||
|
)} |
||||
|
request={params => queryRule(params)} |
||||
|
columns={columns} |
||||
|
rowSelection={{}} |
||||
|
/> |
||||
|
<CreateForm onCancel={() => handleModalVisible(false)} modalVisible={createModalVisible}> |
||||
|
<ProTable<TableListItem, TableListItem> |
||||
|
onSubmit={async value => { |
||||
|
const success = await handleAdd(value); |
||||
|
if (success) { |
||||
|
handleModalVisible(false); |
||||
|
if (actionRef.current) { |
||||
|
actionRef.current.reload(); |
||||
|
} |
||||
|
} |
||||
|
}} |
||||
|
rowKey="key" |
||||
|
type="form" |
||||
|
columns={columns} |
||||
|
rowSelection={{}} |
||||
|
/> |
||||
|
</CreateForm> |
||||
|
{stepFormValues && Object.keys(stepFormValues).length ? ( |
||||
|
<UpdateForm |
||||
|
onSubmit={async value => { |
||||
|
const success = await handleUpdate(value); |
||||
|
if (success) { |
||||
|
handleModalVisible(false); |
||||
|
setStepFormValues({}); |
||||
|
if (actionRef.current) { |
||||
|
actionRef.current.reload(); |
||||
|
} |
||||
|
} |
||||
|
}} |
||||
|
onCancel={() => { |
||||
|
handleUpdateModalVisible(false); |
||||
|
setStepFormValues({}); |
||||
|
}} |
||||
|
updateModalVisible={updateModalVisible} |
||||
|
values={stepFormValues} |
||||
|
/> |
||||
|
) : null} |
||||
|
</PageHeaderWrapper> |
||||
|
); |
||||
|
}; |
||||
|
|
||||
|
export default TableList; |
||||
@ -0,0 +1,38 @@ |
|||||
|
import request from '@/utils/request'; |
||||
|
import { TableListParams, TableListItem } from './data.d'; |
||||
|
|
||||
|
export async function queryRule(params?: TableListParams) { |
||||
|
return request('/api/rule', { |
||||
|
params, |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
export async function removeRule(params: { key: number[] }) { |
||||
|
return request('/api/rule', { |
||||
|
method: 'POST', |
||||
|
data: { |
||||
|
...params, |
||||
|
method: 'delete', |
||||
|
}, |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
export async function addRule(params: TableListItem) { |
||||
|
return request('/api/rule', { |
||||
|
method: 'POST', |
||||
|
data: { |
||||
|
...params, |
||||
|
method: 'post', |
||||
|
}, |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
export async function updateRule(params: TableListParams) { |
||||
|
return request('/api/rule', { |
||||
|
method: 'POST', |
||||
|
data: { |
||||
|
...params, |
||||
|
method: 'update', |
||||
|
}, |
||||
|
}); |
||||
|
} |
||||
@ -1,173 +1,117 @@ |
|||||
import { Form, Tabs } from 'antd'; |
import { Tabs, Form } from 'antd'; |
||||
import React, { Component } from 'react'; |
import React, { useState } from 'react'; |
||||
import { FormComponentProps } from 'antd/es/form'; |
import useMergeValue from 'use-merge-value'; |
||||
import classNames from 'classnames'; |
import classNames from 'classnames'; |
||||
import LoginContext, { LoginContextProps } from './LoginContext'; |
import { FormInstance } from 'antd/es/form'; |
||||
import LoginItem, { LoginItemProps, LoginItemType } from './LoginItem'; |
import { LoginParamsType } from '@/services/login'; |
||||
|
|
||||
|
import LoginContext from './LoginContext'; |
||||
|
import LoginItem, { LoginItemProps } from './LoginItem'; |
||||
import LoginSubmit from './LoginSubmit'; |
import LoginSubmit from './LoginSubmit'; |
||||
import LoginTab from './LoginTab'; |
import LoginTab from './LoginTab'; |
||||
import styles from './index.less'; |
import styles from './index.less'; |
||||
import { LoginParamsType } from '@/services/login'; |
|
||||
|
|
||||
export interface LoginProps { |
export interface LoginProps { |
||||
defaultActiveKey?: string; |
activeKey?: string; |
||||
onTabChange?: (key: string) => void; |
onTabChange?: (key: string) => void; |
||||
style?: React.CSSProperties; |
style?: React.CSSProperties; |
||||
onSubmit?: (error: unknown, values: LoginParamsType) => void; |
onSubmit?: (values: LoginParamsType) => void; |
||||
className?: string; |
className?: string; |
||||
form: FormComponentProps['form']; |
from?: FormInstance; |
||||
onCreate?: (form?: FormComponentProps['form']) => void; |
|
||||
children: React.ReactElement<typeof LoginTab>[]; |
children: React.ReactElement<typeof LoginTab>[]; |
||||
} |
} |
||||
|
|
||||
interface LoginState { |
interface LoginType extends React.FC<LoginProps> { |
||||
tabs?: string[]; |
Tab: typeof LoginTab; |
||||
type?: string; |
Submit: typeof LoginSubmit; |
||||
active?: { [key: string]: unknown[] }; |
UserName: React.FunctionComponent<LoginItemProps>; |
||||
|
Password: React.FunctionComponent<LoginItemProps>; |
||||
|
Mobile: React.FunctionComponent<LoginItemProps>; |
||||
|
Captcha: React.FunctionComponent<LoginItemProps>; |
||||
} |
} |
||||
|
|
||||
class Login extends Component<LoginProps, LoginState> { |
const Login: LoginType = props => { |
||||
public static Tab = LoginTab; |
const { className } = props; |
||||
|
const [tabs, setTabs] = useState<string[]>([]); |
||||
public static Submit = LoginSubmit; |
const [active, setActive] = useState(); |
||||
|
const [type, setType] = useMergeValue('', { |
||||
public static UserName: React.FunctionComponent<LoginItemProps>; |
value: props.activeKey, |
||||
|
onChange: props.onTabChange, |
||||
public static Password: React.FunctionComponent<LoginItemProps>; |
}); |
||||
|
const TabChildren: React.ReactComponentElement<typeof LoginTab>[] = []; |
||||
public static Mobile: React.FunctionComponent<LoginItemProps>; |
const otherChildren: React.ReactElement<unknown>[] = []; |
||||
|
React.Children.forEach( |
||||
public static Captcha: React.FunctionComponent<LoginItemProps>; |
props.children, |
||||
|
(child: React.ReactComponentElement<typeof LoginTab> | React.ReactElement<unknown>) => { |
||||
static defaultProps = { |
if (!child) { |
||||
className: '', |
return; |
||||
defaultActiveKey: '', |
} |
||||
onTabChange: () => {}, |
if ((child.type as { typeName: string }).typeName === 'LoginTab') { |
||||
onSubmit: () => {}, |
TabChildren.push(child as React.ReactComponentElement<typeof LoginTab>); |
||||
}; |
} else { |
||||
|
otherChildren.push(child); |
||||
constructor(props: LoginProps) { |
} |
||||
super(props); |
}, |
||||
this.state = { |
); |
||||
type: props.defaultActiveKey, |
return ( |
||||
tabs: [], |
<LoginContext.Provider |
||||
active: {}, |
value={{ |
||||
}; |
tabUtil: { |
||||
} |
addTab: id => { |
||||
|
setTabs([...tabs, id]); |
||||
componentDidMount() { |
}, |
||||
const { form, onCreate } = this.props; |
removeTab: id => { |
||||
if (onCreate) { |
setTabs(tabs.filter(currentId => currentId !== id)); |
||||
onCreate(form); |
}, |
||||
} |
|
||||
} |
|
||||
|
|
||||
onSwitch = (type: string) => { |
|
||||
this.setState( |
|
||||
{ |
|
||||
type, |
|
||||
}, |
|
||||
() => { |
|
||||
const { onTabChange } = this.props; |
|
||||
if (onTabChange) { |
|
||||
onTabChange(type); |
|
||||
} |
|
||||
}, |
|
||||
); |
|
||||
}; |
|
||||
|
|
||||
getContext: () => LoginContextProps = () => { |
|
||||
const { form } = this.props; |
|
||||
const { tabs = [] } = this.state; |
|
||||
return { |
|
||||
tabUtil: { |
|
||||
addTab: id => { |
|
||||
this.setState({ |
|
||||
tabs: [...tabs, id], |
|
||||
}); |
|
||||
}, |
}, |
||||
removeTab: id => { |
updateActive: activeItem => { |
||||
this.setState({ |
if (active[type]) { |
||||
tabs: tabs.filter(currentId => currentId !== id), |
active[type].push(activeItem); |
||||
}); |
} else { |
||||
|
active[type] = [activeItem]; |
||||
|
} |
||||
|
setActive(active); |
||||
}, |
}, |
||||
}, |
}} |
||||
form: { ...form }, |
> |
||||
updateActive: activeItem => { |
<div className={classNames(className, styles.login)}> |
||||
const { type = '', active = {} } = this.state; |
<Form |
||||
if (active[type]) { |
form={props.from} |
||||
active[type].push(activeItem); |
onFinish={values => { |
||||
} else { |
if (props.onSubmit) { |
||||
active[type] = [activeItem]; |
props.onSubmit(values as LoginParamsType); |
||||
} |
} |
||||
this.setState({ |
}} |
||||
active, |
> |
||||
}); |
{tabs.length ? ( |
||||
}, |
<React.Fragment> |
||||
}; |
<Tabs |
||||
}; |
animated={false} |
||||
|
className={styles.tabs} |
||||
handleSubmit = (e: React.FormEvent) => { |
activeKey={type} |
||||
e.preventDefault(); |
onChange={activeKey => { |
||||
const { active = {}, type = '' } = this.state; |
setType(activeKey); |
||||
const { form, onSubmit } = this.props; |
}} |
||||
const activeFields = active[type] || []; |
> |
||||
if (form) { |
{TabChildren} |
||||
form.validateFields(activeFields as string[], { force: true }, (err, values) => { |
</Tabs> |
||||
if (onSubmit) { |
{otherChildren} |
||||
onSubmit(err, values); |
</React.Fragment> |
||||
} |
) : ( |
||||
}); |
props.children |
||||
} |
)} |
||||
}; |
</Form> |
||||
|
</div> |
||||
render() { |
</LoginContext.Provider> |
||||
const { className, children } = this.props; |
); |
||||
const { type, tabs = [] } = this.state; |
}; |
||||
const TabChildren: React.ReactComponentElement<typeof LoginTab>[] = []; |
|
||||
const otherChildren: React.ReactElement<unknown>[] = []; |
Login.Tab = LoginTab; |
||||
React.Children.forEach( |
Login.Submit = LoginSubmit; |
||||
children, |
|
||||
(child: React.ReactComponentElement<typeof LoginTab> | React.ReactElement<unknown>) => { |
Login.UserName = LoginItem.UserName; |
||||
if (!child) { |
Login.Password = LoginItem.Password; |
||||
return; |
Login.Mobile = LoginItem.Mobile; |
||||
} |
Login.Captcha = LoginItem.Captcha; |
||||
if ((child.type as { typeName: string }).typeName === 'LoginTab') { |
|
||||
TabChildren.push(child as React.ReactComponentElement<typeof LoginTab>); |
export default Login; |
||||
} else { |
|
||||
otherChildren.push(child); |
|
||||
} |
|
||||
}, |
|
||||
); |
|
||||
return ( |
|
||||
<LoginContext.Provider value={this.getContext()}> |
|
||||
<div className={classNames(className, styles.login)}> |
|
||||
<Form onSubmit={this.handleSubmit}> |
|
||||
{tabs.length ? ( |
|
||||
<React.Fragment> |
|
||||
<Tabs |
|
||||
animated={false} |
|
||||
className={styles.tabs} |
|
||||
activeKey={type} |
|
||||
onChange={this.onSwitch} |
|
||||
> |
|
||||
{TabChildren} |
|
||||
</Tabs> |
|
||||
{otherChildren} |
|
||||
</React.Fragment> |
|
||||
) : ( |
|
||||
children |
|
||||
)} |
|
||||
</Form> |
|
||||
</div> |
|
||||
</LoginContext.Provider> |
|
||||
); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
(Object.keys(LoginItem) as (keyof LoginItemType)[]).forEach(item => { |
|
||||
Login[item] = LoginItem[item]; |
|
||||
}); |
|
||||
|
|
||||
export default Form.create<LoginProps>()(Login); |
|
||||
|
|||||
@ -1,78 +0,0 @@ |
|||||
export default { |
|
||||
'user-login.login.userName': 'userName', |
|
||||
'user-login.login.password': 'password', |
|
||||
'user-login.login.message-invalid-credentials': |
|
||||
'Invalid username or password(admin/ant.design)', |
|
||||
'user-login.login.message-invalid-verification-code': 'Invalid verification code', |
|
||||
'user-login.login.tab-login-credentials': 'Credentials', |
|
||||
'user-login.login.tab-login-mobile': 'Mobile number', |
|
||||
'user-login.login.remember-me': 'Remember me', |
|
||||
'user-login.login.forgot-password': 'Forgot your password?', |
|
||||
'user-login.login.sign-in-with': 'Sign in with', |
|
||||
'user-login.login.signup': 'Sign up', |
|
||||
'user-login.login.login': 'Login', |
|
||||
'user-login.register.register': 'Register', |
|
||||
'user-login.register.get-verification-code': 'Get code', |
|
||||
'user-login.register.sign-in': 'Already have an account?', |
|
||||
'user-login.register-result.msg': 'Account:registered at {email}', |
|
||||
'user-login.register-result.activation-email': |
|
||||
'The activation email has been sent to your email address and is valid for 24 hours. Please log in to the email in time and click on the link in the email to activate the account.', |
|
||||
'user-login.register-result.back-home': 'Back to home', |
|
||||
'user-login.register-result.view-mailbox': 'View mailbox', |
|
||||
'user-login.email.required': 'Please enter your email!', |
|
||||
'user-login.email.wrong-format': 'The email address is in the wrong format!', |
|
||||
'user-login.userName.required': 'Please enter your userName!', |
|
||||
'user-login.password.required': 'Please enter your password!', |
|
||||
'user-login.password.twice': 'The passwords entered twice do not match!', |
|
||||
'user-login.strength.msg': |
|
||||
"Please enter at least 6 characters and don't use passwords that are easy to guess.", |
|
||||
'user-login.strength.strong': 'Strength: strong', |
|
||||
'user-login.strength.medium': 'Strength: medium', |
|
||||
'user-login.strength.short': 'Strength: too short', |
|
||||
'user-login.confirm-password.required': 'Please confirm your password!', |
|
||||
'user-login.phone-number.required': 'Please enter your phone number!', |
|
||||
'user-login.phone-number.wrong-format': 'Malformed phone number!', |
|
||||
'user-login.verification-code.required': 'Please enter the verification code!', |
|
||||
'user-login.title.required': 'Please enter a title', |
|
||||
'user-login.date.required': 'Please select the start and end date', |
|
||||
'user-login.goal.required': 'Please enter a description of the goal', |
|
||||
'user-login.standard.required': 'Please enter a metric', |
|
||||
'user-login.form.get-captcha': 'Get Captcha', |
|
||||
'user-login.captcha.second': 'sec', |
|
||||
'user-login.form.optional': ' (optional) ', |
|
||||
'user-login.form.submit': 'Submit', |
|
||||
'user-login.form.save': 'Save', |
|
||||
'user-login.email.placeholder': 'Email', |
|
||||
'user-login.password.placeholder': 'Password', |
|
||||
'user-login.confirm-password.placeholder': 'Confirm password', |
|
||||
'user-login.phone-number.placeholder': 'Phone number', |
|
||||
'user-login.verification-code.placeholder': 'Verification code', |
|
||||
'user-login.title.label': 'Title', |
|
||||
'user-login.title.placeholder': 'Give the target a name', |
|
||||
'user-login.date.label': 'Start and end date', |
|
||||
'user-login.placeholder.start': 'Start date', |
|
||||
'user-login.placeholder.end': 'End date', |
|
||||
'user-login.goal.label': 'Goal description', |
|
||||
'user-login.goal.placeholder': 'Please enter your work goals', |
|
||||
'user-login.standard.label': 'Metrics', |
|
||||
'user-login.standard.placeholder': 'Please enter a metric', |
|
||||
'user-login.client.label': 'Client', |
|
||||
'user-login.label.tooltip': 'Target service object', |
|
||||
'user-login.client.placeholder': |
|
||||
'Please describe your customer service, internal customers directly @ Name / job number', |
|
||||
'user-login.invites.label': 'Inviting critics', |
|
||||
'user-login.invites.placeholder': |
|
||||
'Please direct @ Name / job number, you can invite up to 5 people', |
|
||||
'user-login.weight.label': 'Weight', |
|
||||
'user-login.weight.placeholder': 'Please enter weight', |
|
||||
'user-login.public.label': 'Target disclosure', |
|
||||
'user-login.label.help': 'Customers and invitees are shared by default', |
|
||||
'user-login.radio.public': 'Public', |
|
||||
'user-login.radio.partially-public': 'Partially public', |
|
||||
'user-login.radio.private': 'Private', |
|
||||
'user-login.publicUsers.placeholder': 'Open to', |
|
||||
'user-login.option.A': 'Colleague A', |
|
||||
'user-login.option.B': 'Colleague B', |
|
||||
'user-login.option.C': 'Colleague C', |
|
||||
'user-login.navBar.lang': 'Languages', |
|
||||
}; |
|
||||
@ -1,74 +0,0 @@ |
|||||
export default { |
|
||||
'user-login.login.userName': '用户名', |
|
||||
'user-login.login.password': '密码', |
|
||||
'user-login.login.message-invalid-credentials': '账户或密码错误(admin/ant.design)', |
|
||||
'user-login.login.message-invalid-verification-code': '验证码错误', |
|
||||
'user-login.login.tab-login-credentials': '账户密码登录', |
|
||||
'user-login.login.tab-login-mobile': '手机号登录', |
|
||||
'user-login.login.remember-me': '自动登录', |
|
||||
'user-login.login.forgot-password': '忘记密码', |
|
||||
'user-login.login.sign-in-with': '其他登录方式', |
|
||||
'user-login.login.signup': '注册账户', |
|
||||
'user-login.login.login': '登录', |
|
||||
'user-login.register.register': '注册', |
|
||||
'user-login.register.get-verification-code': '获取验证码', |
|
||||
'user-login.register.sign-in': '使用已有账户登录', |
|
||||
'user-login.register-result.msg': '你的账户:{email} 注册成功', |
|
||||
'user-login.register-result.activation-email': |
|
||||
'激活邮件已发送到你的邮箱中,邮件有效期为24小时。请及时登录邮箱,点击邮件中的链接激活帐户。', |
|
||||
'user-login.register-result.back-home': '返回首页', |
|
||||
'user-login.register-result.view-mailbox': '查看邮箱', |
|
||||
'user-login.email.required': '请输入邮箱地址!', |
|
||||
'user-login.email.wrong-format': '邮箱地址格式错误!', |
|
||||
'user-login.userName.required': '请输入用户名!', |
|
||||
'user-login.password.required': '请输入密码!', |
|
||||
'user-login.password.twice': '两次输入的密码不匹配!', |
|
||||
'user-login.strength.msg': '请至少输入 6 个字符。请不要使用容易被猜到的密码。', |
|
||||
'user-login.strength.strong': '强度:强', |
|
||||
'user-login.strength.medium': '强度:中', |
|
||||
'user-login.strength.short': '强度:太短', |
|
||||
'user-login.confirm-password.required': '请确认密码!', |
|
||||
'user-login.phone-number.required': '请输入手机号!', |
|
||||
'user-login.phone-number.wrong-format': '手机号格式错误!', |
|
||||
'user-login.verification-code.required': '请输入验证码!', |
|
||||
'user-login.title.required': '请输入标题', |
|
||||
'user-login.date.required': '请选择起止日期', |
|
||||
'user-login.goal.required': '请输入目标描述', |
|
||||
'user-login.standard.required': '请输入衡量标准', |
|
||||
'user-login.form.get-captcha': '获取验证码', |
|
||||
'user-login.captcha.second': '秒', |
|
||||
'user-login.form.optional': '(选填)', |
|
||||
'user-login.form.submit': '提交', |
|
||||
'user-login.form.save': '保存', |
|
||||
'user-login.email.placeholder': '邮箱', |
|
||||
'user-login.password.placeholder': '至少6位密码,区分大小写', |
|
||||
'user-login.confirm-password.placeholder': '确认密码', |
|
||||
'user-login.phone-number.placeholder': '手机号', |
|
||||
'user-login.verification-code.placeholder': '验证码', |
|
||||
'user-login.title.label': '标题', |
|
||||
'user-login.title.placeholder': '给目标起个名字', |
|
||||
'user-login.date.label': '起止日期', |
|
||||
'user-login.placeholder.start': '开始日期', |
|
||||
'user-login.placeholder.end': '结束日期', |
|
||||
'user-login.goal.label': '目标描述', |
|
||||
'user-login.goal.placeholder': '请输入你的阶段性工作目标', |
|
||||
'user-login.standard.label': '衡量标准', |
|
||||
'user-login.standard.placeholder': '请输入衡量标准', |
|
||||
'user-login.client.label': '客户', |
|
||||
'user-login.label.tooltip': '目标的服务对象', |
|
||||
'user-login.client.placeholder': '请描述你服务的客户,内部客户直接 @姓名/工号', |
|
||||
'user-login.invites.label': '邀评人', |
|
||||
'user-login.invites.placeholder': '请直接 @姓名/工号,最多可邀请 5 人', |
|
||||
'user-login.weight.label': '权重', |
|
||||
'user-login.weight.placeholder': '请输入', |
|
||||
'user-login.public.label': '目标公开', |
|
||||
'user-login.label.help': '客户、邀评人默认被分享', |
|
||||
'user-login.radio.public': '公开', |
|
||||
'user-login.radio.partially-public': '部分公开', |
|
||||
'user-login.radio.private': '不公开', |
|
||||
'user-login.publicUsers.placeholder': '公开给', |
|
||||
'user-login.option.A': '同事甲', |
|
||||
'user-login.option.B': '同事乙', |
|
||||
'user-login.option.C': '同事丙', |
|
||||
'user-login.navBar.lang': '语言', |
|
||||
}; |
|
||||
@ -1,74 +0,0 @@ |
|||||
export default { |
|
||||
'user-login.login.userName': '賬戶', |
|
||||
'user-login.login.password': '密碼', |
|
||||
'user-login.login.message-invalid-credentials': '賬戶或密碼錯誤(admin/ant.design)', |
|
||||
'user-login.login.message-invalid-verification-code': '驗證碼錯誤', |
|
||||
'user-login.login.tab-login-credentials': '賬戶密碼登錄', |
|
||||
'user-login.login.tab-login-mobile': '手機號登錄', |
|
||||
'user-login.login.remember-me': '自動登錄', |
|
||||
'user-login.login.forgot-password': '忘記密碼', |
|
||||
'user-login.login.sign-in-with': '其他登錄方式', |
|
||||
'user-login.login.signup': '註冊賬戶', |
|
||||
'user-login.login.login': '登錄', |
|
||||
'user-login.register.register': '註冊', |
|
||||
'user-login.register.get-verification-code': '獲取驗證碼', |
|
||||
'user-login.register.sign-in': '使用已有賬戶登錄', |
|
||||
'user-login.register-result.msg': '妳的賬戶:{email} 註冊成功', |
|
||||
'user-login.register-result.activation-email': |
|
||||
'激活郵件已發送到妳的郵箱中,郵件有效期為24小時。請及時登錄郵箱,點擊郵件中的鏈接激活帳戶。', |
|
||||
'user-login.register-result.back-home': '返回首頁', |
|
||||
'user-login.register-result.view-mailbox': '查看郵箱', |
|
||||
'user-login.email.required': '請輸入郵箱地址!', |
|
||||
'user-login.email.wrong-format': '郵箱地址格式錯誤!', |
|
||||
'user-login.userName.required': '請輸入賬戶!', |
|
||||
'user-login.password.required': '請輸入密碼!', |
|
||||
'user-login.password.twice': '兩次輸入的密碼不匹配!', |
|
||||
'user-login.strength.msg': '請至少輸入 6 個字符。請不要使用容易被猜到的密碼。', |
|
||||
'user-login.strength.strong': '強度:強', |
|
||||
'user-login.strength.medium': '強度:中', |
|
||||
'user-login.strength.short': '強度:太短', |
|
||||
'user-login.confirm-password.required': '請確認密碼!', |
|
||||
'user-login.phone-number.required': '請輸入手機號!', |
|
||||
'user-login.phone-number.wrong-format': '手機號格式錯誤!', |
|
||||
'user-login.verification-code.required': '請輸入驗證碼!', |
|
||||
'user-login.title.required': '請輸入標題', |
|
||||
'user-login.date.required': '請選擇起止日期', |
|
||||
'user-login.goal.required': '請輸入目標描述', |
|
||||
'user-login.standard.required': '請輸入衡量標淮', |
|
||||
'user-login.form.get-captcha': '獲取驗證碼', |
|
||||
'user-login.captcha.second': '秒', |
|
||||
'user-login.form.optional': '(選填)', |
|
||||
'user-login.form.submit': '提交', |
|
||||
'user-login.form.save': '保存', |
|
||||
'user-login.email.placeholder': '郵箱', |
|
||||
'user-login.password.placeholder': '至少6位密碼,區分大小寫', |
|
||||
'user-login.confirm-password.placeholder': '確認密碼', |
|
||||
'user-login.phone-number.placeholder': '手機號', |
|
||||
'user-login.verification-code.placeholder': '驗證碼', |
|
||||
'user-login.title.label': '標題', |
|
||||
'user-login.title.placeholder': '給目標起個名字', |
|
||||
'user-login.date.label': '起止日期', |
|
||||
'user-login.placeholder.start': '開始日期', |
|
||||
'user-login.placeholder.end': '結束日期', |
|
||||
'user-login.goal.label': '目標描述', |
|
||||
'user-login.goal.placeholder': '請輸入妳的階段性工作目標', |
|
||||
'user-login.standard.label': '衡量標淮', |
|
||||
'user-login.standard.placeholder': '請輸入衡量標淮', |
|
||||
'user-login.client.label': '客戶', |
|
||||
'user-login.label.tooltip': '目標的服務對象', |
|
||||
'user-login.client.placeholder': '請描述妳服務的客戶,內部客戶直接 @姓名/工號', |
|
||||
'user-login.invites.label': '邀評人', |
|
||||
'user-login.invites.placeholder': '請直接 @姓名/工號,最多可邀請 5 人', |
|
||||
'user-login.weight.label': '權重', |
|
||||
'user-login.weight.placeholder': '請輸入', |
|
||||
'user-login.public.label': '目標公開', |
|
||||
'user-login.label.help': '客戶、邀評人默認被分享', |
|
||||
'user-login.radio.public': '公開', |
|
||||
'user-login.radio.partially-public': '部分公開', |
|
||||
'user-login.radio.private': '不公開', |
|
||||
'user-login.publicUsers.placeholder': '公開給', |
|
||||
'user-login.option.A': '同事甲', |
|
||||
'user-login.option.B': '同事乙', |
|
||||
'user-login.option.C': '同事丙', |
|
||||
'user-login.navBar.lang': '語言', |
|
||||
}; |
|
||||
Loading…
Reference in new issue