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=D1=82=D0=B5=D0=BB=D0=B5=D0=BC=D0=B5=D1=82=D1=80?= =?UTF-8?q?=D0=B8=D0=B8=20=D0=B2=20=D1=81=D0=BF=D0=B5=D0=BB=D0=B5=D0=BA?= =?UTF-8?q?=D1=82=D0=BE=D1=80=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/AdminPanel/CompanyController.jsx | 2 +- src/pages/AdminPanel/PermissionController.jsx | 2 +- src/pages/AdminPanel/UserController.jsx | 2 +- src/pages/AdminPanel/WellController.jsx | 39 ++++++++++++------- src/styles/admin.css | 12 ++++++ 5 files changed, 40 insertions(+), 17 deletions(-) create mode 100644 src/styles/admin.css diff --git a/src/pages/AdminPanel/CompanyController.jsx b/src/pages/AdminPanel/CompanyController.jsx index 0d5a27e..8ce555d 100644 --- a/src/pages/AdminPanel/CompanyController.jsx +++ b/src/pages/AdminPanel/CompanyController.jsx @@ -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)} /> diff --git a/src/pages/AdminPanel/PermissionController.jsx b/src/pages/AdminPanel/PermissionController.jsx index 4e7bb17..8fcf992 100644 --- a/src/pages/AdminPanel/PermissionController.jsx +++ b/src/pages/AdminPanel/PermissionController.jsx @@ -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)} /> diff --git a/src/pages/AdminPanel/UserController.jsx b/src/pages/AdminPanel/UserController.jsx index 5f10bde..4054501 100644 --- a/src/pages/AdminPanel/UserController.jsx +++ b/src/pages/AdminPanel/UserController.jsx @@ -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} diff --git a/src/pages/AdminPanel/WellController.jsx b/src/pages/AdminPanel/WellController.jsx index b756c3b..6547e82 100644 --- a/src/pages/AdminPanel/WellController.jsx +++ b/src/pages/AdminPanel/WellController.jsx @@ -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 + {telemetry.map((row, i) => ( + + + {getTelemetryLabel(row)} + + + ))} + + ) }) export default function WellController() { @@ -104,7 +110,7 @@ export default function WellController() { editable: true, render: (telemetry) => , input: , - }), + }, ), makeTagColumn('Компании', 'companies', companies, 'id', 'caption', { editable: true, render: (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} diff --git a/src/styles/admin.css b/src/styles/admin.css new file mode 100644 index 0000000..d2f6af7 --- /dev/null +++ b/src/styles/admin.css @@ -0,0 +1,12 @@ + +.telemetry_select { + min-width: 300px !important; +} + +.telemetry_select .telemetry_used { + color: black; +} + +.telemetry_select .telemetry_unused { + color: gray; +}