diff --git a/web-react/src/assets/style/lib/visibility.less b/web-react/src/assets/style/lib/visibility.less index a782155..3e16f62 100644 --- a/web-react/src/assets/style/lib/visibility.less +++ b/web-react/src/assets/style/lib/visibility.less @@ -26,3 +26,21 @@ white-space: nowrap; text-overflow: ellipsis; } +.ellipsis-2 { + display: -webkit-box; + overflow: hidden; + -webkit-box-orient: vertical; + + text-overflow: ellipsis; + + -webkit-line-clamp: 2; +} +.ellipsis-3 { + display: -webkit-box; + overflow: hidden; + -webkit-box-orient: vertical; + + text-overflow: ellipsis; + + -webkit-line-clamp: 3; +} diff --git a/web-react/src/common/api/requests/sys/appManage.js b/web-react/src/common/api/requests/sys/appManage.js index 06447d5..0596537 100644 --- a/web-react/src/common/api/requests/sys/appManage.js +++ b/web-react/src/common/api/requests/sys/appManage.js @@ -28,6 +28,7 @@ const urls = { * 修改应用状态 */ sysAppChangeStatus: ['/sysApp/changeStatus', 'post'], + sysAppDetail: ['/sysApp/detail', 'get'] } export default urls \ No newline at end of file diff --git a/web-react/src/pages/system/app/form.jsx b/web-react/src/pages/system/app/form.jsx index 45ec668..1dcbc36 100644 --- a/web-react/src/pages/system/app/form.jsx +++ b/web-react/src/pages/system/app/form.jsx @@ -2,13 +2,13 @@ import React, { Component } from 'react' import { Form, Input, InputNumber, Spin } from 'antd' import { AntIcon, IconSelector } from 'components' import { cloneDeep } from 'lodash' +import { api } from 'common/api' const initialValues = { - sort: 100 + sort: 100, } export default class form extends Component { - state = { // 加载状态 loading: true, @@ -33,17 +33,18 @@ export default class form extends Component { * 填充数据 * 可以在设置this.record之后对其作出数据结构调整 * [异步,必要] - * @param {*} params + * @param {*} params */ async fillData(params) { - - this.record = cloneDeep(params.record) //#region 从后端转换成前段所需格式 + if (params.id) { + this.record = (await api.sysAppDetail({ id: params.id })).data + } //#endregion this.form.current.setFieldsValue(this.record) this.setState({ - loading: false + loading: false, }) } @@ -51,7 +52,7 @@ export default class form extends Component { * 获取数据 * 可以对postData进行数据结构调整 * [异步,必要] - * @returns + * @returns */ async getData() { const form = this.form.current @@ -73,17 +74,21 @@ export default class form extends Component { render() { return ( -
+ }>
- + - + @@ -94,10 +99,9 @@ export default class form extends Component { - this - .iconSelector - .current - .open(this.form.current.getFieldValue('icon')) + this.iconSelector.current.open( + this.form.current.getFieldValue('icon') + ) } /> } @@ -113,9 +117,14 @@ export default class form extends Component {
- this.form.current.setFieldsValue({ - icon - })} /> + + this.form.current.setFieldsValue({ + icon, + }) + } + /> ) } diff --git a/web-react/src/pages/system/app/index.jsx b/web-react/src/pages/system/app/index.jsx index 458fb4c..1596821 100644 --- a/web-react/src/pages/system/app/index.jsx +++ b/web-react/src/pages/system/app/index.jsx @@ -87,6 +87,7 @@ export default class index extends Component { dataIndex: 'sort', width: 100, sorter: true, + defaultSortOrder: 'ascend', }, ] @@ -107,7 +108,7 @@ export default class index extends Component { render: (text, record) => ( - this.onOpen(this.editForm, record)}>编辑 + this.onOpen(this.editForm, record.id)}>编辑 <>{this.bindCodeValue(text, 'areacode_type')}, }, { @@ -60,14 +60,15 @@ export default class index extends Component { { title: '区域编号', dataIndex: 'code', - width: 80, + width: 100, sorter: true, }, { title: '行政编号', dataIndex: 'adCode', - width: 80, + width: 100, sorter: true, + defaultSortOrder: 'ascend', }, { title: '描述', diff --git a/web-react/src/pages/system/config/index.jsx b/web-react/src/pages/system/config/index.jsx index 9668b4f..53a0b7a 100644 --- a/web-react/src/pages/system/config/index.jsx +++ b/web-react/src/pages/system/config/index.jsx @@ -1,5 +1,5 @@ import React, { Component } from 'react' -import { Button, Card, Form, Input, message as Message, Popconfirm } from 'antd' +import { Button, Card, Form, Input, message as Message, Popconfirm, Tooltip } from 'antd' import { AntIcon, Auth, Container, ModalForm, QueryTable, QueryTableActions } from 'components' import { api } from 'common/api' import auth from 'components/authorized/handler' @@ -41,28 +41,41 @@ export default class index extends Component { { title: '参数名称', dataIndex: 'name', + width: 200, sorter: true, }, { title: '唯一编码', dataIndex: 'code', + width: 200, sorter: true, + ellipsis: { + showTitle: false, + }, + render: text => {text}, }, { title: '参数值', dataIndex: 'value', + width: 200, sorter: true, }, { title: '所属分类', dataIndex: 'groupCode', + width: 140, sorter: true, render: text => this.bindCodeValue(text, 'consts_type'), }, { title: '备注', dataIndex: 'remark', + width: 400, sorter: true, + ellipsis: { + showTitle: false, + }, + render: text => {text}, }, ] @@ -213,6 +226,7 @@ export default class index extends Component { autoLoad={false} loadData={this.loadData} columns={this.columns} + scroll={{ x: 1140 }} query={ diff --git a/web-react/src/pages/system/dict/dictdata/index.jsx b/web-react/src/pages/system/dict/dictdata/index.jsx index c42c5af..ddc22b1 100644 --- a/web-react/src/pages/system/dict/dictdata/index.jsx +++ b/web-react/src/pages/system/dict/dictdata/index.jsx @@ -14,20 +14,19 @@ const apiAction = { add: api.sysDictDataAdd, edit: api.sysDictDataEdit, delete: api.sysDictDataDelete, - deleteBatch: api.sysDictDataDeleteBatch + deleteBatch: api.sysDictDataDeleteBatch, } // 用于弹窗标题 const name = '字典值' export default class index extends Component { - state = { codes: { - commonStatus: [] + commonStatus: [], }, - selectedRowKeys: [] + selectedRowKeys: [], } // 表格实例 @@ -45,7 +44,7 @@ export default class index extends Component { dataIndex: 'value', sorter: true, width: 200, - render: (text, record, index) => + render: (text, record, index) => ( + ), }, { title: '字典值', dataIndex: 'code', sorter: true, width: 200, - render: (text, record, index) => + render: (text, record, index) => ( + ), }, { title: '扩展值', dataIndex: 'extCode', width: 80, align: 'center', - render: (text, record, index) => + render: (text, record, index) => ( <> - {auth('sysDictData:edit') ? + {auth('sysDictData:edit') ? ( this.onOpen(this.jsonForm, record)} style={{ @@ -87,50 +88,58 @@ export default class index extends Component { transform: 'scaleY(.85)', color: 'transparent', backgroundImage: 'linear-gradient(135deg, #007bff, #52c41a)', - WebkitBackgroundClip: 'text' + WebkitBackgroundClip: 'text', }} - >JSON - : + > + JSON + + ) : ( <>{text} - } + )} + ), }, { title: '排序', dataIndex: 'sort', sorter: true, width: 100, - render: (text, record, index) => - - + render: (text, record, index) => ( + + + + ), + defaultSortOrder: 'ascend', }, { title: '备注', dataIndex: 'remark', sorter: true, - render: (text, record, index) => - - + render: (text, record, index) => ( + + + + ), }, { title: '状态', dataIndex: 'status', sorter: true, width: 80, - render: text => this.bindCodeValue(text, 'common_status') - } + render: text => this.bindCodeValue(text, 'common_status'), + }, ] /** * 构造函数,在渲染前动态添加操作字段等 - * @param {*} props + * @param {*} props */ constructor(props) { super(props) @@ -142,27 +151,28 @@ export default class index extends Component { title: '操作', width: 150, dataIndex: 'actions', - render: (text, record, index) => ( - { - record.id !== -1 ? + render: (text, record, index) => ( + + {record.id !== -1 ? ( this.onEdit(index)}>保存编辑 - : + ) : ( this.onAdd(index)}>保存新增 - } - - this.onDelete(record)} - > - 删除 - - - ) + )} + + this.onDelete(record)} + > + 删除 + + + + ), }) } } @@ -171,9 +181,9 @@ export default class index extends Component { * 阻止外部组件引发的渲染,提升性能 * 可自行添加渲染条件 * [必要] - * @param {*} props - * @param {*} state - * @returns + * @param {*} props + * @param {*} state + * @returns */ shouldComponentUpdate(props, state) { return !isEqual(this.state, state) @@ -186,26 +196,28 @@ export default class index extends Component { componentDidMount() { this.table.current.onLoading() getDictData('common_status').then(res => { - this.setState({ - codes: res - }, () => { - this.table.current.onLoadData() - }) + this.setState( + { + codes: res, + }, + () => { + this.table.current.onLoadData() + } + ) }) } /** * 调用加载数据接口,可在调用前对query进行处理 * [异步,必要] - * @param {*} params - * @param {*} query - * @returns + * @param {*} params + * @param {*} query + * @returns */ loadData = async (params, query) => { - query = { ...query, - typeId: this.props.type.id + typeId: this.props.type.id, } const { data } = await apiAction.page({ @@ -225,15 +237,15 @@ export default class index extends Component { /** * 绑定字典数据 - * @param {*} code - * @param {*} name - * @returns + * @param {*} code + * @param {*} name + * @returns */ bindCodeValue(code, name) { name = toCamelCase(name) const codes = this.state.codes[name] if (codes) { - const c = codes.find((p) => p.code == code) + const c = codes.find(p => p.code == code) if (c) { return c.value } @@ -243,20 +255,20 @@ export default class index extends Component { /** * 打开新增/编辑弹窗 - * @param {*} modal - * @param {*} record + * @param {*} modal + * @param {*} record */ onOpen(modal, record) { modal.current.open({ - record + record, }) } /** * 对表格上的操作进行统一处理 * [异步] - * @param {*} action - * @param {*} successMessage + * @param {*} action + * @param {*} successMessage */ async onAction(action, successMessage, reload = true) { const table = this.table.current @@ -276,13 +288,10 @@ export default class index extends Component { /** * 删除 - * @param {*} record + * @param {*} record */ onDelete(record) { - this.onAction( - apiAction.delete(record), - '删除成功' - ) + this.onAction(apiAction.delete(record), '删除成功') } //#region 自定义方法 @@ -295,12 +304,12 @@ export default class index extends Component { typeId: this.props.type.id, sort: 100, status: 0, - remark: null + remark: null, } const index = this.table.current.onAddRow(record) if (index !== false) { this.form.current.setFieldsValue({ - [index]: record + [index]: record, }) } } @@ -318,10 +327,7 @@ export default class index extends Component { const record = form.getFieldsValue([index])[index] // 为了正常显示checkbox,默认给id赋予了-1,在这里删除id以表示新增 record.id = undefined - this.onAction( - apiAction.add(record), - '新增成功' - ) + this.onAction(apiAction.add(record), '新增成功') } async onEdit(index) { @@ -335,21 +341,14 @@ export default class index extends Component { } } const record = form.getFieldsValue([index])[index] - this.onAction( - apiAction.edit(record), - '编辑成功', - false - ) + this.onAction(apiAction.edit(record), '编辑成功', false) } async onDeleteBatch() { - await this.onAction( - apiAction.deleteBatch(this.state.selectedRowKeys), - '删除成功' - ) + await this.onAction(apiAction.deleteBatch(this.state.selectedRowKeys), '删除成功') this.setState({ - selectedRowKeys: [] + selectedRowKeys: [], }) } @@ -360,8 +359,8 @@ export default class index extends Component { index = dataSource.indexOf(data) this.form.current.setFieldsValue({ [index]: { - extCode - } + extCode, + }, }) dataSource[index].extCode = extCode table.setState({ dataSource }) @@ -369,7 +368,6 @@ export default class index extends Component { //#endregion render() { - const { selectedRowKeys } = this.state return ( @@ -387,9 +385,9 @@ export default class index extends Component { rowSelection={{ selectedRowKeys, onChange: selectedRowKeys => this.setState({ selectedRowKeys }), - getCheckboxProps: (record) => ({ - disabled: record.id === -1 - }) + getCheckboxProps: record => ({ + disabled: record.id === -1, + }), }} query={ @@ -409,28 +407,27 @@ export default class index extends Component { title="是否确认批量删除" onConfirm={() => this.onDeleteBatch()} > - + } - footer={ - () => - - - - } + footer={() => ( + + + + )} /> - + diff --git a/web-react/src/pages/system/dict/index.jsx b/web-react/src/pages/system/dict/index.jsx index 7d6053a..8c46ab5 100644 --- a/web-react/src/pages/system/dict/index.jsx +++ b/web-react/src/pages/system/dict/index.jsx @@ -1,6 +1,14 @@ import React, { Component } from 'react' import { Button, Card, Form, Input, message as Message, Popconfirm, Radio } from 'antd' -import { AntIcon, Auth, Container, ModalForm, QueryTable, QueryTableActions, QueryTreeLayout } from 'components' +import { + AntIcon, + Auth, + Container, + ModalForm, + QueryTable, + QueryTableActions, + QueryTreeLayout, +} from 'components' import { api } from 'common/api' import auth from 'components/authorized/handler' import { toCamelCase } from 'util/format' @@ -14,17 +22,16 @@ const apiAction = { page: api.sysDictTypePage, add: api.sysDictTypeAdd, edit: api.sysDictTypeEdit, - delete: api.sysDictTypeDelete + delete: api.sysDictTypeDelete, } const name = '字典' export default class index extends Component { - state = { codes: { - commonStatus: [] - } + commonStatus: [], + }, } // 表格实例 @@ -43,24 +50,29 @@ export default class index extends Component { { title: '字典名称', dataIndex: 'name', + width: 200, sorter: true, }, { title: '类型', key: 'type', dataIndex: 'code', + width: 120, sorter: true, - render: text => text ? '字典类型' : '目录' + render: text => (text ? '字典类型' : '目录'), }, { title: '唯一编码', dataIndex: 'code', + width: 120, sorter: true, }, { title: '排序', dataIndex: 'sort', + width: 80, sorter: true, + defaultSortOrder: 'ascend', }, { title: '备注', @@ -71,14 +83,15 @@ export default class index extends Component { { title: '状态', dataIndex: 'status', + width: 80, sorter: true, - render: text => this.bindCodeValue(text, 'common_status') + render: text => this.bindCodeValue(text, 'common_status'), }, ] /** * 构造函数,在渲染前动态添加操作字段等 - * @param {*} props + * @param {*} props */ constructor(props) { super(props) @@ -90,20 +103,22 @@ export default class index extends Component { title: '操作', width: 150, dataIndex: 'actions', - render: (text, record) => ( - - this.onOpen(this.editForm, record)}>编辑 - - - this.onDelete(record)} - > - 删除 - - - ) + render: (text, record) => ( + + + this.onOpen(this.editForm, record)}>编辑 + + + this.onDelete(record)} + > + 删除 + + + + ), }) } } @@ -112,9 +127,9 @@ export default class index extends Component { * 阻止外部组件引发的渲染,提升性能 * 可自行添加渲染条件 * [必要] - * @param {*} props - * @param {*} state - * @returns + * @param {*} props + * @param {*} state + * @returns */ shouldComponentUpdate(props, state) { return !isEqual(this.state, state) @@ -127,26 +142,28 @@ export default class index extends Component { componentDidMount() { this.table.current.onLoading() getDictData('common_status').then(res => { - this.setState({ - codes: res - }, () => { - this.table.current.onLoadData() - }) + this.setState( + { + codes: res, + }, + () => { + this.table.current.onLoadData() + } + ) }) } /** - * 调用加载数据接口,可在调用前对query进行处理 - * [异步,必要] - * @param {*} params - * @param {*} query - * @returns - */ + * 调用加载数据接口,可在调用前对query进行处理 + * [异步,必要] + * @param {*} params + * @param {*} query + * @returns + */ loadData = async (params, query) => { - query = { ...query, - pid: this.selectId + pid: this.selectId, } const { data } = await apiAction.page({ @@ -157,10 +174,10 @@ export default class index extends Component { } /** - * 调用树结构数据接口 - * [异步,必要] - * @returns - */ + * 调用树结构数据接口 + * [异步,必要] + * @returns + */ loadTreeData = async () => { const { data } = await apiAction.tree() return data @@ -169,7 +186,7 @@ export default class index extends Component { /** * 树节点选中事件 * [必要] - * @param {*} id + * @param {*} id */ onSelectTree(id) { this.selectId = id @@ -178,15 +195,15 @@ export default class index extends Component { /** * 绑定字典数据 - * @param {*} code - * @param {*} name - * @returns + * @param {*} code + * @param {*} name + * @returns */ bindCodeValue(code, name) { name = toCamelCase(name) const codes = this.state.codes[name] if (codes) { - const c = codes.find((p) => p.code == code) + const c = codes.find(p => p.code == code) if (c) { return c.value } @@ -196,21 +213,21 @@ export default class index extends Component { /** * 打开新增/编辑弹窗 - * @param {*} modal - * @param {*} record + * @param {*} modal + * @param {*} record */ onOpen(modal, record) { modal.current.open({ pid: this.selectId, - record + record, }) } /** * 对表格上的操作进行统一处理 * [异步] - * @param {*} action - * @param {*} successMessage + * @param {*} action + * @param {*} successMessage */ async onAction(action, successMessage) { this.table.current.onLoading() @@ -225,13 +242,10 @@ export default class index extends Component { /** * 删除 - * @param {*} record + * @param {*} record */ onDelete(record) { - this.onAction( - apiAction.delete(record), - '删除成功' - ) + this.onAction(apiAction.delete(record), '删除成功') } //#region 自定义方法 @@ -242,7 +256,7 @@ export default class index extends Component { this.onSelectTree(key)} + onSelect={key => this.onSelectTree(key)} > @@ -252,7 +266,7 @@ export default class index extends Component { loadData={this.loadData} columns={this.columns} queryInitialValues={{ - type: 2 + type: 2, }} query={ @@ -275,12 +289,14 @@ export default class index extends Component { + > + 新增{name} + } expandable={{ expandedRowRender: record => , - rowExpandable: record => !!record.code + rowExpandable: record => !!record.code, }} /> diff --git a/web-react/src/pages/system/log/oplog/index.jsx b/web-react/src/pages/system/log/oplog/index.jsx index 3a9b794..6c18cd7 100644 --- a/web-react/src/pages/system/log/oplog/index.jsx +++ b/web-react/src/pages/system/log/oplog/index.jsx @@ -232,13 +232,7 @@ export default class index extends Component { } expandable={{ expandedRowRender: record => ( - + {record.methodName} diff --git a/web-react/src/pages/system/log/vislog/index.jsx b/web-react/src/pages/system/log/vislog/index.jsx index ea0f940..3f5cafa 100644 --- a/web-react/src/pages/system/log/vislog/index.jsx +++ b/web-react/src/pages/system/log/vislog/index.jsx @@ -1,5 +1,16 @@ import React, { Component } from 'react' -import { Alert, Button, Card, Descriptions, Form, Popconfirm, Input, message as Message, Select, DatePicker } from 'antd' +import { + Alert, + Button, + Card, + Descriptions, + Form, + Popconfirm, + Input, + message as Message, + Select, + DatePicker, +} from 'antd' import { Auth, Container, QueryTable } from 'components' import { api } from 'common/api' import { toCamelCase } from 'util/format' @@ -7,17 +18,17 @@ import { isEqual } from 'lodash' import getDictData from 'util/dic' import moment from 'moment' -const { RangePicker } = DatePicker; +const { RangePicker } = DatePicker const apiAction = { page: api.sysVisLogPage, - delete: api.sysVisLogDelete + delete: api.sysVisLogDelete, } export default class index extends Component { state = { codes: { - visType: [] - } + visType: [], + }, } // 表格实例 table = React.createRef() @@ -26,38 +37,54 @@ export default class index extends Component { { title: '日志名称', dataIndex: 'name', + width: 200, sorter: true, }, { title: '访问类型', dataIndex: 'visType', - render: text => (<>{this.bindCodeValue(text, 'vis_type')}), + width: 120, + render: text => <>{this.bindCodeValue(text, 'vis_type')}, sorter: true, }, { title: '是否成功', dataIndex: 'success', - render: text => (<> {text ? '是' : '否'}), + width: 120, + render: text => ( + <> + {text ? ( + + ) : ( + + )} + + ), sorter: true, }, { title: 'ip', dataIndex: 'ip', + width: 180, sorter: true, }, { title: '浏览器', dataIndex: 'browser', + width: 180, sorter: true, }, { title: '访问时间', dataIndex: 'visTime', + width: 180, sorter: true, + defaultSortOrder: 'descend', }, { title: '访问人', dataIndex: 'account', + width: 180, sorter: true, }, ] @@ -66,9 +93,9 @@ export default class index extends Component { * 阻止外部组件引发的渲染,提升性能 * 可自行添加渲染条件 * [必要] - * @param {*} props - * @param {*} state - * @returns + * @param {*} props + * @param {*} state + * @returns */ shouldComponentUpdate(props, state) { return !isEqual(this.state, state) @@ -81,26 +108,29 @@ export default class index extends Component { componentDidMount() { this.table.current.onLoading() getDictData('vis_type').then(res => { - this.setState({ - codes: res - }, () => { - this.table.current.onLoadData() - }) + this.setState( + { + codes: res, + }, + () => { + this.table.current.onLoadData() + } + ) }) } /** * 调用加载数据接口,可在调用前对query进行处理 * [异步,必要] - * @param {*} params - * @param {*} query - * @returns + * @param {*} params + * @param {*} query + * @returns */ loadData = async (params, query) => { if (query.dates && query.dates.length) { - query.searchBeginTime = moment(query.dates[0]).format('YYYY-MM-DD HH:mm:ss'); - query.searchEndTime = moment(query.dates[1]).format('YYYY-MM-DD HH:mm:ss'); - delete query.dates; + query.searchBeginTime = moment(query.dates[0]).format('YYYY-MM-DD HH:mm:ss') + query.searchEndTime = moment(query.dates[1]).format('YYYY-MM-DD HH:mm:ss') + delete query.dates } const { data } = await apiAction.page({ ...params, @@ -109,16 +139,16 @@ export default class index extends Component { return data } /** - * 绑定字典数据 - * @param {*} code - * @param {*} name - * @returns - */ + * 绑定字典数据 + * @param {*} code + * @param {*} name + * @returns + */ bindCodeValue(code, name) { name = toCamelCase(name) const codes = this.state.codes[name] if (codes) { - const c = codes.find((p) => +p.code === code) + const c = codes.find(p => +p.code === code) if (c) { return c.value } @@ -129,8 +159,8 @@ export default class index extends Component { /** * 对表格上的操作进行统一处理 * [异步] - * @param {*} action - * @param {*} successMessage + * @param {*} action + * @param {*} successMessage */ async onAction(action, successMessage) { this.table.current.onLoading() @@ -144,17 +174,18 @@ export default class index extends Component { } onVisLogClear() { - this.onAction( - apiAction.delete(), - '清空成功' - ) + this.onAction(apiAction.delete(), '清空成功') } render() { return (
- +
- - + > } @@ -220,16 +245,22 @@ export default class index extends Component { } expandable={{ - expandedRowRender: record => - - + expandedRowRender: record => ( + + {record.message} + ), }} />
) } -} \ No newline at end of file +} diff --git a/web-react/src/pages/system/org/index.jsx b/web-react/src/pages/system/org/index.jsx index ad00a84..431e063 100644 --- a/web-react/src/pages/system/org/index.jsx +++ b/web-react/src/pages/system/org/index.jsx @@ -1,6 +1,14 @@ import React, { Component } from 'react' import { Button, Card, Form, Input, message as Message, Popconfirm } from 'antd' -import { AntIcon, Auth, Container, ModalForm, QueryTable, QueryTableActions, QueryTreeLayout } from 'components' +import { + AntIcon, + Auth, + Container, + ModalForm, + QueryTable, + QueryTableActions, + QueryTreeLayout, +} from 'components' import { api } from 'common/api' import auth from 'components/authorized/handler' import { toCamelCase } from 'util/format' @@ -13,17 +21,16 @@ const apiAction = { page: api.getOrgPage, add: api.sysOrgAdd, edit: api.sysOrgEdit, - delete: api.sysOrgDelete + delete: api.sysOrgDelete, } const name = '机构' export default class index extends Component { - state = { codes: { - orgType: [] - } + orgType: [], + }, } // 树框架实例 @@ -44,13 +51,13 @@ export default class index extends Component { columns = [ { title: '机构名称', - width: '400px', + width: 400, dataIndex: 'name', sorter: true, }, { title: '唯一编码', - width: '200px', + width: 200, dataIndex: 'code', sorter: true, }, @@ -58,24 +65,26 @@ export default class index extends Component { title: '机构类型', dataIndex: 'type', sorter: true, - render: text => (<>{this.bindCodeValue(text, 'org_type')}) + render: text => <>{this.bindCodeValue(text, 'org_type')}, }, { title: '排序', - width: '80px', + width: 80, dataIndex: 'sort', sorter: true, + defaultSortOrder: 'ascend', }, { title: '备注', dataIndex: 'remark', + width: 400, sorter: true, }, ] /** * 构造函数,在渲染前动态添加操作字段等 - * @param {*} props + * @param {*} props */ constructor(props) { super(props) @@ -87,20 +96,22 @@ export default class index extends Component { title: '操作', width: 150, dataIndex: 'actions', - render: (text, record) => ( - - this.onOpen(this.editForm, record)}>编辑 - - - this.onDelete(record)} - > - 删除 - - - ) + render: (text, record) => ( + + + this.onOpen(this.editForm, record)}>编辑 + + + this.onDelete(record)} + > + 删除 + + + + ), }) } } @@ -109,9 +120,9 @@ export default class index extends Component { * 阻止外部组件引发的渲染,提升性能 * 可自行添加渲染条件 * [必要] - * @param {*} props - * @param {*} state - * @returns + * @param {*} props + * @param {*} state + * @returns */ shouldComponentUpdate(props, state) { return !isEqual(this.state, state) @@ -124,26 +135,28 @@ export default class index extends Component { componentDidMount() { this.table.current.onLoading() getDictData('org_type').then(res => { - this.setState({ - codes: res - }, () => { - this.table.current.onLoadData() - }) + this.setState( + { + codes: res, + }, + () => { + this.table.current.onLoadData() + } + ) }) } /** * 调用加载数据接口,可在调用前对query进行处理 * [异步,必要] - * @param {*} params - * @param {*} query - * @returns + * @param {*} params + * @param {*} query + * @returns */ loadData = async (params, query) => { - query = { ...query, - pid: this.selectId + pid: this.selectId, } const { data } = await apiAction.page({ @@ -166,7 +179,7 @@ export default class index extends Component { /** * 树节点选中事件 * [必要] - * @param {*} id + * @param {*} id */ onSelectTree(id) { this.selectId = id @@ -175,15 +188,15 @@ export default class index extends Component { /** * 绑定字典数据 - * @param {*} code - * @param {*} name - * @returns + * @param {*} code + * @param {*} name + * @returns */ bindCodeValue(code, name) { name = toCamelCase(name) const codes = this.state.codes[name] if (codes) { - const c = codes.find((p) => p.code === code) + const c = codes.find(p => p.code == code) if (c) { return c.value } @@ -193,21 +206,21 @@ export default class index extends Component { /** * 打开新增/编辑弹窗 - * @param {*} modal - * @param {*} record + * @param {*} modal + * @param {*} record */ onOpen(modal, record) { modal.current.open({ orgId: this.selectId, - record + record, }) } /** * 对表格上的操作进行统一处理 * [异步] - * @param {*} action - * @param {*} successMessage + * @param {*} action + * @param {*} successMessage */ async onAction(action, successMessage) { this.table.current.onLoading() @@ -227,13 +240,10 @@ export default class index extends Component { /** * 删除 - * @param {*} record + * @param {*} record */ onDelete(record) { - this.onAction( - apiAction.delete(record), - '删除成功' - ) + this.onAction(apiAction.delete(record), '删除成功') } //#region 自定义方法 @@ -245,7 +255,7 @@ export default class index extends Component { ref={this.treeLayout} loadData={this.loadTreeData} defaultExpanded={true} - onSelect={(key) => this.onSelectTree(key)} + onSelect={key => this.onSelectTree(key)} > @@ -265,7 +275,9 @@ export default class index extends Component { + > + 新增{name} + } /> diff --git a/web-react/src/pages/system/pos/index.jsx b/web-react/src/pages/system/pos/index.jsx index c12f74c..e59dda6 100644 --- a/web-react/src/pages/system/pos/index.jsx +++ b/web-react/src/pages/system/pos/index.jsx @@ -2,24 +2,22 @@ import React, { Component } from 'react' import { Button, Card, Form, Input, Popconfirm, message as Message } from 'antd' import { isEqual } from 'lodash' import { AntIcon, Auth, Container, ModalForm, QueryTable, QueryTableActions } from 'components' -import { api } from "common/api" +import { api } from 'common/api' import auth from 'components/authorized/handler' import FormBody from './form' - // 配置页面所需接口函数 const apiAction = { page: api.sysPosPage, add: api.sysPosAdd, edit: api.sysPosEdit, - delete: api.sysPosDelete + delete: api.sysPosDelete, } // 用于弹窗标题 const name = '职位' export default class index extends Component { - // 表格实例 table = React.createRef() @@ -32,29 +30,34 @@ export default class index extends Component { { title: '职位名称', dataIndex: 'name', + width: 400, sorter: true, }, { title: '唯一编码', dataIndex: 'code', + width: 400, sorter: true, }, { title: '排序', dataIndex: 'sort', + width: 80, sorter: true, + defaultSortOrder: 'ascend', }, { title: '备注', dataIndex: 'remark', + width: 400, sorter: true, }, ] /** - * 构造函数,在渲染前动态添加操作字段等 - * @param {*} props - */ + * 构造函数,在渲染前动态添加操作字段等 + * @param {*} props + */ constructor(props) { super(props) @@ -65,20 +68,22 @@ export default class index extends Component { title: '操作', width: 150, dataIndex: 'actions', - render: (text, record) => ( - - this.onOpen(this.editForm, record)}>编辑 - - - this.onDelete(record)} - > - 删除 - - - ) + render: (text, record) => ( + + + this.onOpen(this.editForm, record)}>编辑 + + + this.onDelete(record)} + > + 删除 + + + + ), }) } } @@ -87,9 +92,9 @@ export default class index extends Component { * 阻止外部组件引发的渲染,提升性能 * 可自行添加渲染条件 * [必要] - * @param {*} props - * @param {*} state - * @returns + * @param {*} props + * @param {*} state + * @returns */ shouldComponentUpdate(props, state) { return !isEqual(this.state, state) @@ -98,9 +103,9 @@ export default class index extends Component { /** * 调用加载数据接口,可在调用前对query进行处理 * [异步,必要] - * @param {*} params - * @param {*} query - * @returns + * @param {*} params + * @param {*} query + * @returns */ loadData = async (params, query) => { const { data } = await apiAction.page({ @@ -111,21 +116,21 @@ export default class index extends Component { } /** - * 打开新增/编辑弹窗 - * @param {*} modal - * @param {*} record - */ + * 打开新增/编辑弹窗 + * @param {*} modal + * @param {*} record + */ onOpen(modal, record) { modal.current.open({ - record + record, }) } /** * 对表格上的操作进行统一处理 * [异步] - * @param {*} action - * @param {*} successMessage + * @param {*} action + * @param {*} successMessage */ async onAction(action, successMessage) { this.table.current.onLoading() @@ -140,13 +145,10 @@ export default class index extends Component { /** * 删除 - * @param {*} record + * @param {*} record */ onDelete(record) { - this.onAction( - apiAction.delete(record), - '删除成功' - ) + this.onAction(apiAction.delete(record), '删除成功') } render() { @@ -172,11 +174,11 @@ export default class index extends Component { + > + 新增{name} + } - > - - + > ) } -} \ No newline at end of file +} diff --git a/web-react/src/pages/system/role/index.jsx b/web-react/src/pages/system/role/index.jsx index e9edb04..865db78 100644 --- a/web-react/src/pages/system/role/index.jsx +++ b/web-react/src/pages/system/role/index.jsx @@ -16,14 +16,13 @@ const apiAction = { delete: api.sysRoleDelete, grantMenu: api.sysRoleGrantMenu, - grantData: api.sysRoleGrantData + grantData: api.sysRoleGrantData, } // 用于弹窗标题 const name = '角色' export default class index extends Component { - // 表格实例 table = React.createRef() @@ -39,23 +38,27 @@ export default class index extends Component { { title: '角色名', dataIndex: 'name', + width: 400, sorter: true, }, { title: '唯一编码', dataIndex: 'code', + width: 400, sorter: true, }, { title: '排序', dataIndex: 'sort', + width: 80, sorter: true, - } + defaultSortOrder: 'ascend', + }, ] /** * 构造函数,在渲染前动态添加操作字段等 - * @param {*} props + * @param {*} props */ constructor(props) { super(props) @@ -67,44 +70,58 @@ export default class index extends Component { title: '操作', width: 150, dataIndex: 'actions', - render: (text, record) => ( - - this.onOpen(this.editForm, record)}>编辑 - - - this.onDelete(record)} - > - 删除 - - - - - - - this.onOpen(this.menuForm, record)}>授权菜单 - - - - - this.onOpen(this.dataForm, record)}>授权数据 - - - - } - > - - 授权 - - - - - ) + render: (text, record) => ( + + + this.onOpen(this.editForm, record)}>编辑 + + + this.onDelete(record)} + > + 删除 + + + + + + + + this.onOpen(this.menuForm, record) + } + > + 授权菜单 + + + + + + + this.onOpen(this.dataForm, record) + } + > + 授权数据 + + + + + } + > + + 授权 + + + + + + ), }) } } @@ -113,9 +130,9 @@ export default class index extends Component { * 阻止外部组件引发的渲染,提升性能 * 可自行添加渲染条件 * [必要] - * @param {*} props - * @param {*} state - * @returns + * @param {*} props + * @param {*} state + * @returns */ shouldComponentUpdate(props, state) { return !isEqual(this.state, state) @@ -124,9 +141,9 @@ export default class index extends Component { /** * 调用加载数据接口,可在调用前对query进行处理 * [异步,必要] - * @param {*} params - * @param {*} query - * @returns + * @param {*} params + * @param {*} query + * @returns */ loadData = async (params, query) => { const { data } = await apiAction.page({ @@ -138,20 +155,20 @@ export default class index extends Component { /** * 打开新增/编辑弹窗 - * @param {*} modal - * @param {*} record + * @param {*} modal + * @param {*} record */ onOpen(modal, record) { modal.current.open({ - record + record, }) } /** * 对表格上的操作进行统一处理 * [异步] - * @param {*} action - * @param {*} successMessage + * @param {*} action + * @param {*} successMessage */ async onAction(action, successMessage) { this.table.current.onLoading() @@ -166,13 +183,10 @@ export default class index extends Component { /** * 删除 - * @param {*} record + * @param {*} record */ onDelete(record) { - this.onAction( - apiAction.delete(record), - '删除成功' - ) + this.onAction(apiAction.delete(record), '删除成功') } //#region 自定义方法 @@ -202,7 +216,9 @@ export default class index extends Component { + > + 新增{name} + } /> diff --git a/web-react/src/views/main/_layout/sider/index.jsx b/web-react/src/views/main/_layout/sider/index.jsx index 6a15f53..44b247a 100644 --- a/web-react/src/views/main/_layout/sider/index.jsx +++ b/web-react/src/views/main/_layout/sider/index.jsx @@ -9,8 +9,7 @@ Swiper.use([Mousewheel, Scrollbar]) const { getState, subscribe } = store -let timer, - swiper +let timer, swiper const siderSwiperOptions = { direction: 'vertical', @@ -31,17 +30,15 @@ const UpdateSwiper = () => { }, 300) } - export default class index extends Component { - state = { - ...getState('layout') + ...getState('layout'), } constructor(props) { super(props) - this.unsubscribe = subscribe('layout', (state) => { + this.unsubscribe = subscribe('layout', state => { this.setState(state) }) } @@ -78,7 +75,10 @@ export default class index extends Component {
- +