Добавлены названия таблиц, настройка таблиц включена по-умолчанию

This commit is contained in:
Александр Сироткин 2022-03-10 20:46:02 +05:00
parent c69bcf7089
commit 4bb71ddbfd
32 changed files with 65 additions and 19 deletions

View File

@ -17,7 +17,6 @@ export { makeSelectColumn } from './select'
export { makeTagColumn, makeTagInput } from './tag'
export { makeFilterTextMatch, makeTextColumn } from './text'
export {
rawTimezones,
timezoneOptions,
TimezoneSelect,
makeTimezoneColumn,

View File

@ -17,10 +17,10 @@ export type TableContainer = TableProps<any> & {
dataSource: any[]
children?: ReactNode
tableName?: string
showSettingsChanger?: boolean
hideSettingsChanger?: boolean
}
export const Table = memo<TableContainer>(({ columns, dataSource, children, tableName, showSettingsChanger, ...other }) => {
export const Table = memo<TableContainer>(({ columns, dataSource, children, tableName, hideSettingsChanger, ...other }) => {
const [newColumns, setNewColumns] = useState<TableColumns>([])
const [settings, setSettings] = useState<TableSettings>({})
@ -33,7 +33,7 @@ export const Table = memo<TableContainer>(({ columns, dataSource, children, tabl
useEffect(() => setSettings(tableName ? getTableSettings(tableName) : {}), [tableName])
useEffect(() => setNewColumns(() => {
const newColumns = applySettings(columns, settings)
if (tableName && showSettingsChanger) {
if (tableName && !hideSettingsChanger) {
const oldTitle = newColumns[0].title
newColumns[0].title = (props) => (
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'stretch', justifyContent: 'space-between', position: 'relative', padding: '16px 0' }}>
@ -45,12 +45,15 @@ export const Table = memo<TableContainer>(({ columns, dataSource, children, tabl
)
}
return newColumns
}), [settings, columns, onSettingsChanged, showSettingsChanger, tableName])
}), [settings, columns, onSettingsChanged, hideSettingsChanger, tableName])
return (
<>
<RawTable columns={newColumns} dataSource={tryAddKeys(dataSource)} {...other}>{children}</RawTable>
</>
<RawTable
{...other}
columns={newColumns}
dataSource={tryAddKeys(dataSource)}
children={children}
/>
)
})

View File

@ -4,7 +4,6 @@ export { DatePickerWrapper } from './DatePickerWrapper'
export { Table } from './Table'
export {
RegExpIsFloat,
rawTimezones,
timezoneOptions,
TimezoneSelect,
makeGroupColumn,

View File

@ -81,6 +81,7 @@ export const ClusterController = memo(() => {
onRowAdd={hasPermission('AdminCluster.edit') && makeActionHandler('insert', handlerProps, null, 'Добавление куста')}
onRowEdit={hasPermission('AdminCluster.edit') && makeActionHandler('update', handlerProps, null, 'Редактирование куста')}
onRowDelete={hasPermission('AdminCluster.delete') && makeActionHandler('delete', handlerProps, null, 'Удаление куста')}
tableName={'admin_cluster_controller'}
/>
</LoaderPortal>
)

View File

@ -76,6 +76,7 @@ export const CompanyController = memo(() => {
onRowAdd={hasPermission('AdminCompany.edit') && makeActionHandler('insert', handlerProps, null, 'Добавлениее компаний')}
onRowEdit={hasPermission('AdminCompany.edit') && makeActionHandler('update', handlerProps, null, 'Редактирование команий')}
onRowDelete={hasPermission('AdminCompany.delete') && makeActionHandler('delete', handlerProps, null, 'Удаление компаний')}
tableName={'admin_company_controller'}
/>
</LoaderPortal>
)

View File

@ -57,6 +57,7 @@ export const CompanyTypeController = memo(() => {
onRowAdd={hasPermission('AdminCompanyType.edit') && makeActionHandler('insert', handlerProps, null, 'Добавление типа компаний')}
onRowEdit={hasPermission('AdminCompanyType.edit') && makeActionHandler('update', handlerProps, null, 'Редактирование типа компаний')}
onRowDelete={hasPermission('AdminCompanyType.delete') && makeActionHandler('delete', handlerProps, null, 'Удаление типа компаний')}
tableName={'admin_company_type_controller'}
/>
</LoaderPortal>
)

View File

@ -51,6 +51,7 @@ export const DepositController = memo(() => {
onRowAdd={hasPermission('AdminDeposit.edit') && makeActionHandler('insert', handlerProps, null, 'Добавление месторождения')}
onRowEdit={hasPermission('AdminDeposit.edit') && makeActionHandler('update', handlerProps, null, 'Редактирование месторождения')}
onRowDelete={hasPermission('AdminDeposit.delete') && makeActionHandler('delete', handlerProps, null, 'Удаление месторождения')}
tableName={'admin_deposit_controller'}
/>
</LoaderPortal>
)

View File

@ -60,6 +60,7 @@ export const PermissionController = memo(() => {
onRowAdd={hasPermission('AdminPermission.edit') && makeActionHandler('insert', handlerProps, null, 'Добавление права')}
onRowEdit={hasPermission('AdminPermission.edit') && makeActionHandler('update', handlerProps, null, 'Редактирование права')}
onRowDelete={hasPermission('AdminPermission.delete') && makeActionHandler('delete', handlerProps, null, 'Удаление права')}
tableName={'admin_permission_controller'}
/>
</LoaderPortal>
)

View File

@ -69,6 +69,7 @@ export const RoleController = memo(() => {
onRowAdd={hasPermission('AdminUserRole.edit') && makeActionHandler('insert', handlerProps, null, 'Добавление роли')}
onRowEdit={hasPermission('AdminUserRole.edit') && makeActionHandler('update', handlerProps, null, 'Редактирование роли')}
onRowDelete={hasPermission('AdminUserRole.delete') && makeActionHandler('delete', handlerProps, null, 'Удаление роли')}
tableName={'admin_role_controller'}
/>
</LoaderPortal>
)

View File

@ -56,6 +56,7 @@ export const TelemetryController = memo(() => {
columns={columns}
dataSource={telemetryData}
pagination={defaultPagination}
tableName={'admin_telemetry_controller'}
/>
</LoaderPortal>
)

View File

@ -216,6 +216,7 @@ export const UserController = memo(() => {
additionalButtons={additionalButtons}
buttonsWidth={120}
pagination={defaultPagination}
tableName={'admin_user_controller'}
/>
</LoaderPortal>
<ChangePassword

View File

@ -41,6 +41,7 @@ export const VisitLog = memo(() => {
columns={columns}
dataSource={logData}
pagination={defaultPagination}
tableName={'visit_log'}
/>
</LoaderPortal>
)

View File

@ -134,6 +134,7 @@ export const WellController = memo(() => {
onRowDelete={hasPermission('AdminWell.delete') && makeActionHandler('delete', handlerProps, null, 'Удаление скважины')}
//additionalButtons={addititonalButtons}
buttonsWidth={95}
tableName={'admin_well_controller'}
/>
</LoaderPortal>
)

View File

@ -170,6 +170,7 @@ export const ClusterWells = memo(({ statsWells }) => {
bordered
pagination={false}
rowKey={(record) => record.caption}
tableName={'cluster'}
/>
<Modal

View File

@ -1,7 +1,6 @@
import { Table } from 'antd'
import { makeTextColumn, makeNumericColumnPlanFact } from '@components/Table'
import { getPrecision } from '@utils/functions'
export const WellOperationsTable = ({ wellOperations }) => {
@ -34,6 +33,7 @@ export const WellOperationsTable = ({ wellOperations }) => {
dataSource={operations}
rowKey={(record) => record.key}
pagination={{ defaultPageSize: 10 }}
tableName={'well_operations'}
/>
)
}

View File

@ -8,6 +8,8 @@ import { PointerIcon } from '@components/icons'
import LoaderPortal from '@components/LoaderPortal'
import { invokeWebApiWrapperAsync } from '@components/factory'
import '@styles/index.css'
const defaultViewParams = { center: [60.81226, 70.0562], zoom: 5 }
const calcViewParams = (clusters) => {

View File

@ -46,7 +46,7 @@ const columns = [
}
]
export const DocumentsTemplate = ({ idCategory, idWell, accept, headerChild, customColumns, beforeTable, onChange}) => {
export const DocumentsTemplate = ({ idCategory, idWell, accept, headerChild, customColumns, beforeTable, onChange, tableName }) => {
const [page, setPage] = useState(1)
const [filterDataRange, setFilterDataRange] = useState([])
const [filterCompanyName, setFilterCompanyName] = useState([])
@ -173,6 +173,7 @@ export const DocumentsTemplate = ({ idCategory, idWell, accept, headerChild, cus
}}
onRowDelete={hasPermission(`File.edit${idCategory}`) && handleFileDelete}
rowKey={(record) => record.id}
tableName={tableName ?? `file_${idCategory}`}
/>
</LoaderPortal>
)

View File

@ -46,7 +46,7 @@ export const MenuDocuments = memo(({ idWell }) => {
<Switch>
{documentCategories.map(category => (
<PrivateRoute path={join(root, category.key)} key={`${category.key}`}>
<DocumentsTemplate idCategory={category.id} idWell={idWell} />
<DocumentsTemplate idCategory={category.id} idWell={idWell} tableName={`documents_${category.key}`} />
</PrivateRoute>
))}
<PrivateDefaultRoute urls={documentCategories.map((cat) => join(root, cat.key))}/>

View File

@ -160,6 +160,7 @@ export const CategoryEditor = memo(({ idWell, visible, category, onClosed }) =>
bordered
columns={userColumns}
dataSource={filteredUsers}
tableName={`drilling_program_category_editor`}
/>
</LoaderPortal>
</div>

View File

@ -118,6 +118,7 @@ export const CategoryHistory = ({ idWell, idCategory, visible, onClose }) => {
showSizeChanger: true,
onChange: onPaginationChange
}}
tableName={'drilling_program_history'}
/>
</LoaderPortal>
</Modal>

View File

@ -48,6 +48,7 @@ export const InclinometryTable = memo(({ group, visible, onClose }) => {
columns={tableColumns}
scroll={tableScroll}
bordered
tableName={'measure_inclinometry'}
/>
</Modal>
)

View File

@ -11,14 +11,14 @@ import {
import LoaderPortal from '@components/LoaderPortal'
import { invokeWebApiWrapperAsync } from '@components/factory'
import { MeasureService } from '@api'
import { hasPermission } from '@utils/permissions'
import { formatDate } from '@utils'
import { MeasureService } from '@api'
import { View } from './View'
import '@styles/index.css'
import '@styles/measure.css'
import { hasPermission } from '@asb/utils/permissions'
const createEditingColumns = (cols, renderDelegate) =>
cols.map(col => ({ render: renderDelegate, ...col }))

View File

@ -136,6 +136,7 @@ export const Messages = memo(({ idWell }) => {
onChange: (page) => setPage(page)
}}
rowKey={(record) => record.id}
tableName={'messages'}
/>
</LoaderPortal>
</>

View File

@ -78,6 +78,7 @@ export const Reports = memo(({ idWell }) => {
columns={columns}
dataSource={reports}
pagination={{ pageSize: 13 }}
tableName={'reports'}
/>
</LoaderPortal>
)

View File

@ -24,6 +24,8 @@ import DrillingProgram from './DrillingProgram'
import TelemetryAnalysis from './TelemetryAnalysis'
import WellCompositeEditor from './WellCompositeEditor'
import '@styles/index.css'
const { Content } = Layout
export const Well = memo(() => {

View File

@ -62,6 +62,7 @@ export const DrillProcessFlow = memo(({ idWell }) => {
bordered
columns={columns}
dataSource={flows}
tableName={'well_operations_flow'}
onRowAdd={hasPermission('DrillFlowChart.edit') && onAdd}
onRowEdit={hasPermission('DrillFlowChart.edit') && onEdit}
onRowDelete={hasPermission('DrillFlowChart.delete') && onDelete}

View File

@ -71,6 +71,7 @@ export const WellDrillParams = memo(({ idWell }) => {
bordered
columns={columns}
dataSource={params}
tableName={'well_drill_params'}
onRowAdd={hasPermission('DrillParams.edit') && makeActionHandler('insert', handlerProps, recordParser, 'Добавление режима бурения')}
onRowEdit={hasPermission('DrillParams.edit') && makeActionHandler('update', handlerProps, recordParser, 'Редактирование режима бурения')}
onRowDelete={hasPermission('DrillParams.delete') && makeActionHandler('delete', handlerProps, recordParser, 'Удаление режима бурения')}

View File

@ -132,6 +132,7 @@ export const WellOperationsEditor = memo(({ idWell, idType, ...other }) => {
total: paginationTotal,
onChange: (page, pageSize) => setPageNumAndPageSize({ current: page, pageSize })
}}
tableName={'well_operationse_editor'}
/>
</LoaderPortal>
)

View File

@ -63,6 +63,7 @@ export const WellSectionsStat = memo(({ idWell }) => {
size={'small'}
columns={columns}
dataSource={sections}
tableName={'well_operations_sections'}
/>
</LoaderPortal>
)

View File

@ -56,7 +56,7 @@ export const WellOperations = memo(({ idWell }) => {
<WellSectionsStat idWell={idWell}/>
</PrivateRoute>
<PrivateRoute path={`${rootPath}/plan`}>
<WellOperationsEditor idWell={idWell} idType={0} tableName={'well_operations_plan'} showSettingsChanger />
<WellOperationsEditor idWell={idWell} idType={0} tableName={'well_operations_plan'}/>
</PrivateRoute>
<PrivateRoute path={`${rootPath}/fact`}>
<WellOperationsEditor idWell={idWell} idType={1} tableName={'well_operations_fact'}/>

View File

@ -14,7 +14,20 @@
//@layout-header-background: rgb(195, 40,40);
@layout-header-background: rgb(65, 63, 61);
#root, .app{min-height:100%;}
@header-height: 64px;
@layout-min-height: calc(100vh - @header-height);
#root, .app{
min-height:100%;
}
.ant-layout{
flex: 1;
> .ant-menu {
flex: 0;
}
}
html {
display: flex;
@ -49,6 +62,7 @@ html {
align-items: center;
justify-content: space-around;
gap: 50px;
height: @header-height;
}
.header .logo {
@ -98,9 +112,15 @@ html {
margin-right: 2px;
}
.ant-layout-content {
display: flex;
flex-direction: column;
align-items: stretch;
}
.sheet{
padding: 5px 24px;
min-height: 280px;
min-height: calc(@layout-min-height - 15px); // 280px;
margin: 0 15px 15px 15px;
}

View File

@ -72,7 +72,7 @@ body {
}
.h-100vh {
height: 100vh;
height: calc(100vh - 64px);
}
.vertical-align-center {
@ -84,7 +84,7 @@ body {
}
.text-align-r-container {
width: 100%;
width: 100%;
text-align: right;
}