forked from ddrilling/asb_cloud_front
* Исправлено название методов обновления записи
* Добавлена минимальная ширина селектор телеметрии (300px) * Добавлено обесцвечивание неиспользованной телеметрии в спелекторе
This commit is contained in:
parent
7c78cb3c32
commit
826085bc70
@ -51,7 +51,7 @@ export default function CompanyController() {
|
|||||||
columns={companyColumns}
|
columns={companyColumns}
|
||||||
dataSource={companies}
|
dataSource={companies}
|
||||||
onRowAdd={makeActionHandler('insert', handlerProps)}
|
onRowAdd={makeActionHandler('insert', handlerProps)}
|
||||||
onRowEdit={makeActionHandler('update', handlerProps)}
|
onRowEdit={makeActionHandler('put', handlerProps)}
|
||||||
onRowDelete={makeActionHandler('delete', handlerProps)}
|
onRowDelete={makeActionHandler('delete', handlerProps)}
|
||||||
/>
|
/>
|
||||||
</LoaderPortal>
|
</LoaderPortal>
|
||||||
|
@ -55,7 +55,7 @@ export const PermissionController = () => {
|
|||||||
columns={columns}
|
columns={columns}
|
||||||
dataSource={permissions}
|
dataSource={permissions}
|
||||||
onRowAdd={makeActionHandler('insert', handlerProps)}
|
onRowAdd={makeActionHandler('insert', handlerProps)}
|
||||||
onRowEdit={makeActionHandler('update', handlerProps)}
|
onRowEdit={makeActionHandler('put', handlerProps)}
|
||||||
onRowDelete={makeActionHandler('delete', handlerProps)}
|
onRowDelete={makeActionHandler('delete', handlerProps)}
|
||||||
/>
|
/>
|
||||||
</LoaderPortal>
|
</LoaderPortal>
|
||||||
|
@ -158,7 +158,7 @@ export default function UserController() {
|
|||||||
columns={columns}
|
columns={columns}
|
||||||
dataSource={users}
|
dataSource={users}
|
||||||
onRowAdd={makeActionHandler('insert', handlerProps)}
|
onRowAdd={makeActionHandler('insert', handlerProps)}
|
||||||
onRowEdit={makeActionHandler('update', handlerProps)}
|
onRowEdit={makeActionHandler('put', handlerProps)}
|
||||||
onRowDelete={makeActionHandler('delete', handlerProps)}
|
onRowDelete={makeActionHandler('delete', handlerProps)}
|
||||||
additionalButtons={additionalButtons}
|
additionalButtons={additionalButtons}
|
||||||
buttonsWidth={120}
|
buttonsWidth={120}
|
||||||
|
@ -23,27 +23,33 @@ import {
|
|||||||
import { arrayOrDefault } from '../../utils'
|
import { arrayOrDefault } from '../../utils'
|
||||||
import { coordsFixed } from './DepositController'
|
import { coordsFixed } from './DepositController'
|
||||||
|
|
||||||
|
import '../../styles/admin.css'
|
||||||
|
|
||||||
const wellTypes = [
|
const wellTypes = [
|
||||||
{ value: 1, label: 'Наклонно-направленная' },
|
{ value: 1, label: 'Наклонно-направленная' },
|
||||||
{ value: 2, label: 'Горизонтальная' },
|
{ value: 2, label: 'Горизонтальная' },
|
||||||
]
|
]
|
||||||
|
|
||||||
const TelemetrySelect = memo(({ telemetry, value, onChange }) => {
|
const TelemetrySelect = memo(({ telemetry, value, onChange }) => {
|
||||||
const [options, setOptions] = useState([])
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
const options = telemetry.map((row) => ({
|
|
||||||
value: row.id,
|
|
||||||
label: getTelemetryLabel(row)
|
|
||||||
}))
|
|
||||||
setOptions(options)
|
|
||||||
}, [telemetry])
|
|
||||||
|
|
||||||
const onSelectChange = (id) => {
|
const onSelectChange = (id) => {
|
||||||
onChange?.(telemetry.find((row) => row.id === id))
|
onChange?.(telemetry.find((row) => row.id === id))
|
||||||
}
|
}
|
||||||
|
|
||||||
return <Select options={options} value={value?.id} onChange={onSelectChange}/>
|
return (
|
||||||
|
<Select
|
||||||
|
value={value?.id}
|
||||||
|
onChange={onSelectChange}
|
||||||
|
dropdownClassName={'telemetry_select'}
|
||||||
|
>
|
||||||
|
{telemetry.map((row, i) => (
|
||||||
|
<Select.Option key={i} value={row.id}>
|
||||||
|
<span className={row?.info?.well ? 'telemetry_used' : 'telemetry_unused'}>
|
||||||
|
{getTelemetryLabel(row)}
|
||||||
|
</span>
|
||||||
|
</Select.Option>
|
||||||
|
))}
|
||||||
|
</Select>
|
||||||
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
export default function WellController() {
|
export default function WellController() {
|
||||||
@ -104,7 +110,7 @@ export default function WellController() {
|
|||||||
editable: true,
|
editable: true,
|
||||||
render: (telemetry) => <TelemetryView telemetry={telemetry} />,
|
render: (telemetry) => <TelemetryView telemetry={telemetry} />,
|
||||||
input: <TelemetrySelect telemetry={telemetry}/>,
|
input: <TelemetrySelect telemetry={telemetry}/>,
|
||||||
}),
|
}, ),
|
||||||
makeTagColumn('Компании', 'companies', companies, 'id', 'caption', {
|
makeTagColumn('Компании', 'companies', companies, 'id', 'caption', {
|
||||||
editable: true,
|
editable: true,
|
||||||
render: (company) => <CompanyView company={company} />,
|
render: (company) => <CompanyView company={company} />,
|
||||||
@ -117,6 +123,11 @@ export default function WellController() {
|
|||||||
`Не удалось загрузить список кустов`
|
`Не удалось загрузить список кустов`
|
||||||
), [])
|
), [])
|
||||||
|
|
||||||
|
const recordParser = (record) => ({
|
||||||
|
...record,
|
||||||
|
idTelemetry: record.telemetry.id,
|
||||||
|
})
|
||||||
|
|
||||||
const handlerProps = {
|
const handlerProps = {
|
||||||
service: AdminWellService,
|
service: AdminWellService,
|
||||||
setLoader: setShowLoader,
|
setLoader: setShowLoader,
|
||||||
@ -131,8 +142,8 @@ export default function WellController() {
|
|||||||
bordered
|
bordered
|
||||||
columns={columns}
|
columns={columns}
|
||||||
dataSource={wells}
|
dataSource={wells}
|
||||||
onRowAdd={makeActionHandler('insert', handlerProps)}
|
onRowAdd={makeActionHandler('insert', handlerProps, recordParser)}
|
||||||
onRowEdit={makeActionHandler('put', handlerProps)}
|
onRowEdit={makeActionHandler('put', handlerProps, recordParser)}
|
||||||
onRowDelete={makeActionHandler('delete', handlerProps)}
|
onRowDelete={makeActionHandler('delete', handlerProps)}
|
||||||
//additionalButtons={addititonalButtons}
|
//additionalButtons={addititonalButtons}
|
||||||
buttonsWidth={95}
|
buttonsWidth={95}
|
||||||
|
12
src/styles/admin.css
Normal file
12
src/styles/admin.css
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
.telemetry_select {
|
||||||
|
min-width: 300px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.telemetry_select .telemetry_used {
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
|
|
||||||
|
.telemetry_select .telemetry_unused {
|
||||||
|
color: gray;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user