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}
|
||||
dataSource={companies}
|
||||
onRowAdd={makeActionHandler('insert', handlerProps)}
|
||||
onRowEdit={makeActionHandler('update', handlerProps)}
|
||||
onRowEdit={makeActionHandler('put', handlerProps)}
|
||||
onRowDelete={makeActionHandler('delete', handlerProps)}
|
||||
/>
|
||||
</LoaderPortal>
|
||||
|
@ -55,7 +55,7 @@ export const PermissionController = () => {
|
||||
columns={columns}
|
||||
dataSource={permissions}
|
||||
onRowAdd={makeActionHandler('insert', handlerProps)}
|
||||
onRowEdit={makeActionHandler('update', handlerProps)}
|
||||
onRowEdit={makeActionHandler('put', handlerProps)}
|
||||
onRowDelete={makeActionHandler('delete', handlerProps)}
|
||||
/>
|
||||
</LoaderPortal>
|
||||
|
@ -158,7 +158,7 @@ export default function UserController() {
|
||||
columns={columns}
|
||||
dataSource={users}
|
||||
onRowAdd={makeActionHandler('insert', handlerProps)}
|
||||
onRowEdit={makeActionHandler('update', handlerProps)}
|
||||
onRowEdit={makeActionHandler('put', handlerProps)}
|
||||
onRowDelete={makeActionHandler('delete', handlerProps)}
|
||||
additionalButtons={additionalButtons}
|
||||
buttonsWidth={120}
|
||||
|
@ -23,27 +23,33 @@ import {
|
||||
import { arrayOrDefault } from '../../utils'
|
||||
import { coordsFixed } from './DepositController'
|
||||
|
||||
import '../../styles/admin.css'
|
||||
|
||||
const wellTypes = [
|
||||
{ value: 1, label: 'Наклонно-направленная' },
|
||||
{ value: 2, label: 'Горизонтальная' },
|
||||
]
|
||||
|
||||
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) => {
|
||||
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() {
|
||||
@ -104,7 +110,7 @@ export default function WellController() {
|
||||
editable: true,
|
||||
render: (telemetry) => <TelemetryView telemetry={telemetry} />,
|
||||
input: <TelemetrySelect telemetry={telemetry}/>,
|
||||
}),
|
||||
}, ),
|
||||
makeTagColumn('Компании', 'companies', companies, 'id', 'caption', {
|
||||
editable: true,
|
||||
render: (company) => <CompanyView company={company} />,
|
||||
@ -117,6 +123,11 @@ export default function WellController() {
|
||||
`Не удалось загрузить список кустов`
|
||||
), [])
|
||||
|
||||
const recordParser = (record) => ({
|
||||
...record,
|
||||
idTelemetry: record.telemetry.id,
|
||||
})
|
||||
|
||||
const handlerProps = {
|
||||
service: AdminWellService,
|
||||
setLoader: setShowLoader,
|
||||
@ -131,8 +142,8 @@ export default function WellController() {
|
||||
bordered
|
||||
columns={columns}
|
||||
dataSource={wells}
|
||||
onRowAdd={makeActionHandler('insert', handlerProps)}
|
||||
onRowEdit={makeActionHandler('put', handlerProps)}
|
||||
onRowAdd={makeActionHandler('insert', handlerProps, recordParser)}
|
||||
onRowEdit={makeActionHandler('put', handlerProps, recordParser)}
|
||||
onRowDelete={makeActionHandler('delete', handlerProps)}
|
||||
//additionalButtons={addititonalButtons}
|
||||
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