update 调整大量细节

This commit is contained in:
2021-06-17 17:14:38 +08:00
parent aed7a07e51
commit 5b57785b81
13 changed files with 211 additions and 115 deletions

View File

@@ -45,7 +45,9 @@
.ant-mentions, .ant-mentions,
.ant-select-selector, .ant-select-selector,
.ant-input-group-addon, .ant-input-group-addon,
.ant-cascader-picker { .ant-cascader-picker,
.ant-input-affix-wrapper,
.ant-picker {
z-index: 1; z-index: 1;
text-align: left; text-align: left;
@@ -64,11 +66,23 @@
box-shadow: @box-shadow-focused; box-shadow: @box-shadow-focused;
} }
.unfoucs {
z-index: 1 !important;
box-shadow: none;
}
.ant-input { .ant-input {
&:focus { &:focus {
.focus(); .focus();
} }
} }
.ant-input-affix-wrapper {
>.ant-input {
&:focus {
.unfoucs();
}
}
}
.ant-input-number-focused, .ant-input-number-focused,
.ant-mentions-focused { .ant-mentions-focused {
.focus(); .focus();
@@ -85,6 +99,18 @@
.focus(); .focus();
} }
} }
.ant-input-affix-wrapper:focus,
.ant-input-affix-wrapper-focused {
.focus();
}
.ant-select-focused:not(.ant-select-disabled).ant-select:not(.ant-select-customize-input) {
.ant-select-selector {
.focus();
}
}
.ant-picker-focused {
.focus();
}
.ant-input-group { .ant-input-group {
.ant-row-flex { .ant-row-flex {
.ant-select { .ant-select {
@@ -205,8 +231,8 @@
h3, h3,
h4, h4,
h5 { h5 {
margin-top: @padding-sm; margin: 0;
padding: 0 @padding-md; padding: @padding-sm @padding-md @padding-xs;
} }
.yo-form-group { .yo-form-group {
margin-bottom: 0; margin-bottom: 0;

View File

@@ -13,11 +13,10 @@
} }
.ant-tabs { .ant-tabs {
height: 100%; height: 100%;
.ant-tabs-left-content { .ant-tabs-content-left {
position: relative; position: relative;
height: 100%; height: 100%;
padding: 0;
.ant-tabs-tabpane { .ant-tabs-tabpane {
position: absolute; position: absolute;
top: 0; top: 0;

View File

@@ -44,4 +44,12 @@
} }
} }
} }
.ant-list-item {
transition: @animation-duration-slow;
transition-property: background, border-bottom-color;
&:hover {
border-bottom-color: lighten(@primary-color, 30%);
background: linear-gradient(90deg, transparent 10%, @background-color-light 70%, transparent);
}
}
} }

View File

@@ -23,8 +23,26 @@
} }
} }
.ant-table { .ant-table-thead {
background-color: @white; th.ant-table-column-has-sorters {
&:hover {
background-color: darken(@background-color-base, 5%);
}
}
}
.ant-table-tbody {
>tr {
>td {
transition-property: background, border-bottom-color;
}
}
>tr.ant-table-row:hover {
>td {
border-bottom-color: lighten(@primary-color, 30%);
}
}
} }
.ant-table-small { .ant-table-small {
@@ -54,6 +72,10 @@
} }
.yo-table { .yo-table {
.ant-table {
margin: 0 !important;
}
.border-right-none() { .border-right-none() {
border-right-width: 0 !important; border-right-width: 0 !important;
@@ -126,8 +148,10 @@
} }
} }
.ant-table-pagination { .ant-table-bordered {
float: none; >.ant-table-container {
border-top: @border-width-base @border-style-base @table-border-color;
}
} }
} }

View File

@@ -27,6 +27,8 @@
text-align: right; text-align: right;
>.anticon { >.anticon {
margin-left: @padding-xs;
cursor: pointer; cursor: pointer;
color: fade(@black, 50%); color: fade(@black, 50%);
@@ -60,4 +62,7 @@
background-color: fade(@black, 45%); background-color: fade(@black, 45%);
} }
} }
.ant-tree {
color: fade(@black, 60%);
}
} }

View File

@@ -2,3 +2,4 @@
@primary-color: #007bff; @primary-color: #007bff;
@font-size-base: 13px; @font-size-base: 13px;
@border-radius-base: 0; @border-radius-base: 0;
@border-color-split: hsv(0, 0, 90%);

View File

@@ -1,5 +1,5 @@
import React, { Component } from 'react' import React, { Component } from 'react'
import { Button, Form, List, Pagination, Spin } from 'antd' import { Button, Form, List, Pagination, Spin, Tooltip } from 'antd'
import { AntIcon } from 'components' import { AntIcon } from 'components'
export default class QueryList extends Component { export default class QueryList extends Component {
@@ -148,12 +148,15 @@ export default class QueryList extends Component {
layout="inline" layout="inline"
ref={this.form} ref={this.form}
onFinish={(value) => this.onQuery(value)} onFinish={(value) => this.onQuery(value)}
initialValues={this.props.queryInitialValues}
> >
{query} {query}
<Form.Item> <Form.Item>
<Button.Group className="mr-xs"> <Button.Group className="mr-xs">
<Button htmlType="submit" type="primary">查询</Button> <Button htmlType="submit" type="primary" icon={<AntIcon type="search" />}>查询</Button>
<Button onClick={() => this.onResetQuery()}>重置</Button> <Tooltip placement="bottom" title="重置查询">
<Button onClick={() => this.onResetQuery()} icon={<AntIcon type="undo" />} />
</Tooltip>
</Button.Group> </Button.Group>
{ {
moreQuery && <Button>更多查询条件</Button> moreQuery && <Button>更多查询条件</Button>
@@ -181,7 +184,9 @@ export default class QueryList extends Component {
</div> </div>
<div className="yo-action-bar--actions"> <div className="yo-action-bar--actions">
<Button.Group> <Button.Group>
<Button>刷新</Button> <Tooltip placement="bottom" title="刷新">
<Button onClick={() => this.onReloadData()} type="text" icon={<AntIcon type="reload" />} />
</Tooltip>
</Button.Group> </Button.Group>
</div> </div>
</div> </div>

View File

@@ -40,7 +40,8 @@ export default class QueryTable extends Component {
size: 'small', size: 'small',
showSizeChanger: true, showSizeChanger: true,
showQuickJumper: true, showQuickJumper: true,
showTotal: (total) => `总共${total}条数据` showTotal: (total) => `总共${total}条数据`,
position: ['bottomLeft']
} }
// 默认选中页码 // 默认选中页码

View File

@@ -86,6 +86,10 @@ export default class QueryTreeLayout extends Component {
this.setState({ loading: false }) this.setState({ loading: false })
} }
onReloadData() {
this.onLoadData()
}
onExpand(expandedKeys) { onExpand(expandedKeys) {
this.setState({ this.setState({
expandedKeys, expandedKeys,
@@ -240,15 +244,26 @@ export default class QueryTreeLayout extends Component {
</div> </div>
</Layout.Header> </Layout.Header>
<div className="yo-tree-layout--bar"> <div className="yo-tree-layout--bar">
<Tooltip placement="bottom" title="刷新">
<AntIcon type="undo" onClick={() => this.onReloadData()} />
</Tooltip>
<Tooltip placement="bottom" title="折叠全部"> <Tooltip placement="bottom" title="折叠全部">
<AntIcon type="switcher" onClick={() => this.setState({ expandedKeys: [] })} /> <AntIcon type="switcher" onClick={() => this.setState({ expandedKeys: [] })} />
</Tooltip> </Tooltip>
</div> </div>
<div className="yo-tree-layout--content"> <div className="yo-tree-layout--content">
<Spin spinning={this.state.loading} indicator={<AntIcon type="loading" />}> <Spin spinning={this.state.loading} indicator={<AntIcon type="loading" />} wrapperClassName="h-100-p">
{ {
!this.state.loading && !this.state.dataSource.length ? !this.state.loading && !this.state.dataSource.length ?
<Empty /> <Empty
image={
<div className="text-center pt-md">
<AntIcon className="h3 mt-xl mb-md" type="smile" />
<p>暂无数据</p>
</div>
}
description={false}
/>
: :
<Tree <Tree
{...props} {...props}

View File

@@ -4,6 +4,7 @@ import Router from './router'
import reportWebVitals from './reportWebVitals'; import reportWebVitals from './reportWebVitals';
import { ConfigProvider } from 'antd' import { ConfigProvider } from 'antd'
import { AntIcon } from 'components'
import zhCN from 'antd/lib/locale/zh_CN' import zhCN from 'antd/lib/locale/zh_CN'
import moment from 'moment' import moment from 'moment'
import 'moment/locale/zh-cn' import 'moment/locale/zh-cn'
@@ -14,7 +15,17 @@ moment.locale('zh-cn')
//<React.StrictMode></React.StrictMode> //<React.StrictMode></React.StrictMode>
ReactDOM.render( ReactDOM.render(
<ConfigProvider locale={zhCN}> <ConfigProvider
locale={zhCN}
renderEmpty={
() => (
<div className="text-center pt-md">
<AntIcon className="h3 mb-md" type="smile" />
<p>暂无数据</p>
</div>
)
}
>
<Router /> <Router />
</ConfigProvider>, </ConfigProvider>,
document.getElementById('root') document.getElementById('root')

View File

@@ -26,6 +26,9 @@ export default class index extends Component {
} }
} }
// 树框架实例
treeLayout = React.createRef()
// 表格实例 // 表格实例
table = React.createRef() table = React.createRef()
@@ -209,8 +212,13 @@ export default class index extends Component {
async onAction(action, successMessage) { async onAction(action, successMessage) {
this.table.current.onLoading() this.table.current.onLoading()
try { try {
await action if (action) {
Message.success(successMessage) await action
}
if (successMessage) {
Message.success(successMessage)
}
this.treeLayout.current.onReloadData()
this.table.current.onReloadData() this.table.current.onReloadData()
} catch { } catch {
this.table.current.onLoaded() this.table.current.onLoaded()
@@ -234,6 +242,7 @@ export default class index extends Component {
render() { render() {
return ( return (
<QueryTreeLayout <QueryTreeLayout
ref={this.treeLayout}
loadData={this.loadTreeData} loadData={this.loadTreeData}
defaultExpanded={true} defaultExpanded={true}
onSelect={(key) => this.onSelectTree(key)} onSelect={(key) => this.onSelectTree(key)}
@@ -266,7 +275,7 @@ export default class index extends Component {
title={`新增${name}`} title={`新增${name}`}
action={apiAction.add} action={apiAction.add}
ref={this.addForm} ref={this.addForm}
onSuccess={() => this.table.current.onReloadData()} onSuccess={() => this.onAction()}
> >
<FormBody /> <FormBody />
</ModalForm> </ModalForm>
@@ -275,7 +284,7 @@ export default class index extends Component {
title={`编辑${name}`} title={`编辑${name}`}
action={apiAction.edit} action={apiAction.edit}
ref={this.editForm} ref={this.editForm}
onSuccess={() => this.table.current.onReloadData()} onSuccess={() => this.onAction()}
> >
<FormBody /> <FormBody />
</ModalForm> </ModalForm>

View File

@@ -109,7 +109,7 @@ export default class form extends Component {
//#region 从后端转换成前段所需格式 //#region 从后端转换成前段所需格式
const orgData = await this.loadOrgData() const orgData = await this.loadOrgData()
const posData = await this.loadPosData() const posData = await this.loadPosData()
const codes = await getDicData('org_type') const codes = await getDictData('org_type')
// 日期特殊处理 // 日期特殊处理
if (this.record.birthday) { if (this.record.birthday) {
@@ -278,101 +278,95 @@ export default class form extends Component {
<Spin <Spin
spinning={this.state.loading} spinning={this.state.loading}
indicator={<AntIcon type="loading" />}> indicator={<AntIcon type="loading" />}>
<Row gutter={16}> <h3 className="h3">基本信息</h3>
<Col span={10}> <div className="yo-form-group">
<h3 className="h3t">基本信息</h3> <Form.Item label="账号" name="account" rules={[{ required: true, message: '请输入账号', trigger: 'blur' }]}>
<div className="yo-form-group"> <Input autoComplete="off" placeholder="请输入账号" />
<Form.Item label="账号" name="account" rules={[{ required: true, message: '请输入账号', trigger: 'blur' }]}> </Form.Item>
<Input autoComplete="off" placeholder="请输入账号" /> <Form.Item label="姓名" name="name" rules={[{ required: true, message: '请输入姓名', trigger: 'blur' }]}>
</Form.Item> <Input autoComplete="off" placeholder="请输入姓名" />
<Form.Item label="姓名" name="name" rules={[{ required: true, message: '请输入姓名', trigger: 'blur' }]}> </Form.Item>
<Input autoComplete="off" placeholder="请输入姓名" /> {this.props.mode == 'add' && <>
</Form.Item> <Form.Item label="密码" name="password" rules={[{ required: true, message: '请输入密码', trigger: 'blur' }]}>
{this.props.mode == 'add' && <> <Input.Password autoComplete="off" placeholder="请输入密码" />
<Form.Item label="密码" name="password" rules={[{ required: true, message: '请输入密码', trigger: 'blur' }]}> </Form.Item>
<Input.Password autoComplete="off" placeholder="请输入密码" /> <Form.Item label="确认密码" name="confirm" rules={[{ required: true, message: '请确认密码', trigger: 'blur' }]}>
</Form.Item> <Input.Password autoComplete="off" placeholder="请确认密码" />
<Form.Item label="确认密码" name="confirm" rules={[{ required: true, message: '请确认密码', trigger: 'blur' }]}> </Form.Item>
<Input.Password autoComplete="off" placeholder="请确认密码" /> </>
</Form.Item> }
</> <Form.Item label="昵称" name="nickName" >
<Input autoComplete="off" placeholder="请输入昵称" />
</Form.Item>
<Form.Item label="生日" name="birthday" >
<DatePicker className="w-100-p" />
</Form.Item>
<Form.Item label="性别" name="sex" >
<Radio.Group >
<Radio.Button value={0}>
<AntIcon className="mr-xxs" type="stop" />
<span>保密</span>
</Radio.Button>
<Radio.Button value={1}>
<AntIcon style={{ color: '#1890ff' }} className="mr-xxs" type="man" />
<span></span>
</Radio.Button>
<Radio.Button value={2}>
<AntIcon style={{ color: '#eb2f96' }} className="mr-xxs" type="woman" />
<span></span>
</Radio.Button>
</Radio.Group>
</Form.Item>
<Form.Item label="邮箱" name="email" >
<Input autoComplete="off" placeholder="请输入邮箱" />
</Form.Item>
<Form.Item label="手机号" name="phone" >
<Input autoComplete="off" placeholder="请输入手机号" />
</Form.Item>
<Form.Item label="电话" name="tel" >
<Input autoComplete="off" placeholder="请输入电话" />
</Form.Item>
</div>
<h3 className="h3">员工信息</h3>
<div className="yo-form-group">
<Form.Item
label="所属组织机构"
name={['sysEmpParam', 'orgId']}
rules={[{ required: true, message: '所属组织机构' }]}>
<TreeSelect
treeData={this.state.options.orgData}
dropdownStyle={{ maxHeight: '300px', overflow: 'auto' }}
treeDefaultExpandAll
placeholder="请选择所属组织机构"
/>
</Form.Item>
<Form.Item
label="工号"
name={['sysEmpParam', 'jobNum']} >
<Input
autoComplete="off"
placeholder="请输入工号" />
</Form.Item>
<Form.Item label="职位信息" name={['sysEmpParam', 'posIdList']}>
<Select
mode="multiple"
placeholder="请选择职位信息">
{
this.state.options.posData.map(item => {
return <Select.Option
key={item.id}
value={item.id}
>
{item.name}</Select.Option>
})
} }
<Form.Item label="昵称" name="nickName" > </Select>
<Input autoComplete="off" placeholder="请输入昵称" /> </Form.Item>
</Form.Item> </div>
<Form.Item label="生日" name="birthday" > {/* <h4 className="h4">附加信息</h4>
<DatePicker className="w-100-p" />
</Form.Item>
<Form.Item label="性别" name="sex" >
<Radio.Group >
<Radio.Button value={0}>
<AntIcon className="mr-xxs" type="stop" />
<span>保密</span>
</Radio.Button>
<Radio.Button value={1}>
<AntIcon style={{ color: '#1890ff' }} className="mr-xxs" type="man" />
<span></span>
</Radio.Button>
<Radio.Button value={2}>
<AntIcon style={{ color: '#eb2f96' }} className="mr-xxs" type="woman" />
<span></span>
</Radio.Button>
</Radio.Group>
</Form.Item>
<Form.Item label="邮箱" name="email" >
<Input autoComplete="off" placeholder="请输入邮箱" />
</Form.Item>
<Form.Item label="手机号" name="phone" >
<Input autoComplete="off" placeholder="请输入手机号" />
</Form.Item>
<Form.Item label="电话" name="tel" >
<Input autoComplete="off" placeholder="请输入电话" />
</Form.Item>
</div>
</Col>
<Col span={14}>
<h3 className="h3t">员工信息</h3>
<div className="yo-form-group">
<Form.Item
label="所属组织机构"
name={['sysEmpParam', 'orgId']}
rules={[{ required: true, message: '所属组织机构' }]}>
<TreeSelect
treeData={this.state.options.orgData}
dropdownStyle={{ maxHeight: '300px', overflow: 'auto' }}
treeDefaultExpandAll
placeholder="请选择所属组织机构"
/>
</Form.Item>
<Form.Item
label="工号"
name={['sysEmpParam', 'jobNum']} >
<Input
autoComplete="off"
placeholder="请输入工号" />
</Form.Item>
<Form.Item label="职位信息" name={['sysEmpParam', 'posIdList']}>
<Select
mode="multiple"
placeholder="请选择职位信息">
{
this.state.options.posData.map(item => {
return <Select.Option
key={item.id}
value={item.id}
>
{item.name}</Select.Option>
})
}
</Select>
</Form.Item>
</div>
{/* <h4 className="h4">附加信息</h4>
<div className="pl-md pr-md"> <div className="pl-md pr-md">
{this.renderExtInfoTable()} {this.renderExtInfoTable()}
</div> */} </div> */}
</Col>
</Row>
</Spin> </Spin>
</Form> </Form>
) )

View File

@@ -301,7 +301,6 @@ export default class index extends Component {
action={apiAction.add} action={apiAction.add}
ref={this.addForm} ref={this.addForm}
onSuccess={() => this.list.current.onReloadData()} onSuccess={() => this.list.current.onReloadData()}
width={1100}
> >
<FormBody mode="add" /> <FormBody mode="add" />
</ModalForm> </ModalForm>
@@ -311,7 +310,6 @@ export default class index extends Component {
action={apiAction.edit} action={apiAction.edit}
ref={this.editForm} ref={this.editForm}
onSuccess={() => this.list.current.onReloadData()} onSuccess={() => this.list.current.onReloadData()}
width={1100}
> >
<FormBody mode="edit" /> <FormBody mode="edit" />
</ModalForm> </ModalForm>