|  |  |  | 
|---|
|  |  |  | import React, { useState, useRef, useEffect, useMemo, useCallback } from "react"; | 
|---|
|  |  |  | import { useNavigate } from 'react-router-dom'; | 
|---|
|  |  |  | import { useLocation, useNavigate } from 'react-router-dom'; | 
|---|
|  |  |  | import { | 
|---|
|  |  |  | List, | 
|---|
|  |  |  | DatagridConfigurable, | 
|---|
|  |  |  | 
|---|
|  |  |  | AutocompleteInput, | 
|---|
|  |  |  | DeleteButton, | 
|---|
|  |  |  | Button, | 
|---|
|  |  |  | useRedirect, | 
|---|
|  |  |  | } from 'react-admin'; | 
|---|
|  |  |  | import { Box, Typography, Card, Stack } from '@mui/material'; | 
|---|
|  |  |  | import { styled } from '@mui/material/styles'; | 
|---|
|  |  |  | 
|---|
|  |  |  | const [createDialog, setCreateDialog] = useState(false); | 
|---|
|  |  |  | const [drawerVal, setDrawerVal] = useState(false); | 
|---|
|  |  |  | const [modalType, setmodalType] = useState(0); | 
|---|
|  |  |  | const [select, setSelect] = useState(0); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const billReload = useRef(); | 
|---|
|  |  |  | const location = useLocation(); | 
|---|
|  |  |  | const redirect = useRedirect(); | 
|---|
|  |  |  | const navigate = useNavigate(); | 
|---|
|  |  |  | const dicts = JSON.parse(localStorage.getItem('sys_dicts'))?.filter(dict => (dict.dictTypeCode == 'sys_business_type')) || []; | 
|---|
|  |  |  | const assign = (record) => { | 
|---|
|  |  |  | 
|---|
|  |  |  | sx={{ width: '100%' }} | 
|---|
|  |  |  | preferenceKey='asnOrder' | 
|---|
|  |  |  | bulkActionButtons={<> <InspectionsButton /><BulkDeleteButton mutationMode={OPERATE_MODE} /></>} | 
|---|
|  |  |  | rowClick={() => 'edit'} | 
|---|
|  |  |  | rowClick='toggleSelection' | 
|---|
|  |  |  | onToggleItem={(id, resource, record)=>{ | 
|---|
|  |  |  | redirect(location.pathname + '/' + id) | 
|---|
|  |  |  | }} | 
|---|
|  |  |  | expandSingle={true} | 
|---|
|  |  |  | omit={['id', 'createTime', 'createBy', 'memo', 'poId', 'rleStatus$']} | 
|---|
|  |  |  | > | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const MyButton = ({ setCreateDialog, setmodalType }) => { | 
|---|
|  |  |  | const record = useRecordContext(); | 
|---|
|  |  |  | const handleEditClick = () => { | 
|---|
|  |  |  | const handleEditClick = (btn) => { | 
|---|
|  |  |  | btn.stopPropagation(); | 
|---|
|  |  |  | const id = record.id; | 
|---|
|  |  |  | setmodalType(id); | 
|---|
|  |  |  | setCreateDialog(true); | 
|---|
|  |  |  | 
|---|
|  |  |  | <Button | 
|---|
|  |  |  | color="primary" | 
|---|
|  |  |  | startIcon={<EditIcon />} | 
|---|
|  |  |  | onClick={() => handleEditClick()} | 
|---|
|  |  |  | onClick={(btn) => handleEditClick(btn)} | 
|---|
|  |  |  | sx={{ ml: 1 }} | 
|---|
|  |  |  | label={'ra.action.edit'} | 
|---|
|  |  |  | > | 
|---|
|  |  |  | 
|---|
|  |  |  | const record = useRecordContext(); | 
|---|
|  |  |  | const notify = useNotify(); | 
|---|
|  |  |  | const refresh = useRefresh(); | 
|---|
|  |  |  | const inspection = () => { | 
|---|
|  |  |  | const inspection = (btn) => { | 
|---|
|  |  |  | btn.stopPropagation(); | 
|---|
|  |  |  | requestInspect([record]) | 
|---|
|  |  |  | }; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | const { selectedIds, onUnselectItems, data } = useListContext(); | 
|---|
|  |  |  | const notify = useNotify(); | 
|---|
|  |  |  | const refresh = useRefresh(); | 
|---|
|  |  |  | const inspection = () => { | 
|---|
|  |  |  | const inspection = (btn) => { | 
|---|
|  |  |  | btn.stopPropagation(); | 
|---|
|  |  |  | if (selectedIds.length === 0) { | 
|---|
|  |  |  | notify('请选择通知单'); | 
|---|
|  |  |  | return; | 
|---|