From d086af5559dba52095d23e425be87d8f11f24814 Mon Sep 17 00:00:00 2001
From: zjj <3272660260@qq.com>
Date: 星期四, 17 七月 2025 16:32:47 +0800
Subject: [PATCH] #菜单、po单

---
 rsf-admin/src/page/orders/asnOrder/AsnOrderList.jsx |  131 +++++++++++++++++++++++++++++++++----------
 1 files changed, 100 insertions(+), 31 deletions(-)

diff --git a/rsf-admin/src/page/orders/asnOrder/AsnOrderList.jsx b/rsf-admin/src/page/orders/asnOrder/AsnOrderList.jsx
index a9c7a64..43a9442 100644
--- a/rsf-admin/src/page/orders/asnOrder/AsnOrderList.jsx
+++ b/rsf-admin/src/page/orders/asnOrder/AsnOrderList.jsx
@@ -55,8 +55,11 @@
 import request from '@/utils/request';
 import DictionarySelect from "../../components/DictionarySelect";
 import ExitToAppIcon from '@mui/icons-material/ExitToApp';
-
-
+import ImportButton from "../../components/ImportButton";
+import PrintOutlinedIcon from '@mui/icons-material/PrintOutlined';
+import OrderPrintPreview from "./OrderPrintPreview";
+import CreateNewFolderOutlinedIcon from '@mui/icons-material/CreateNewFolderOutlined';
+import AsnCreateByPoModal from "./AsnCreateByPoModal";
 const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({
   '& .css-1vooibu-MuiSvgIcon-root': {
     height: '.9em'
@@ -66,14 +69,21 @@
   },
   '& .column-name': {
   },
-  '& .opt': {
-    width: 220
-  },
+  
   '& .wkType': {
     width: 110
   },
   '& .status': {
     width: 90
+  },
+  '& .MuiTableCell-root': {
+    whiteSpace: 'nowrap',
+    overflow: 'visible',
+    textOverflow: 'unset'
+  },
+  '& .opt': {
+    width: 220,
+    
   },
 }));
 
@@ -112,8 +122,13 @@
   const [createDialog, setCreateDialog] = useState(false);
   const [drawerVal, setDrawerVal] = useState(false);
   const [modalType, setmodalType] = useState(0);
-  const [select, setSelect] = useState(0);
+  const [poCreate, setPoCreate] = useState(false);
+  const [printOrder, setPrintOrder] = useState(false);
+  const [select, setSelect] = useState({});
+  const invoiceRef = useRef();
   const billReload = useRef();
+  const notify = useNotify();
+  const refresh = useRefresh();
   const dicts = JSON.parse(localStorage.getItem('sys_dicts'))?.filter(dict => (dict.dictTypeCode == 'sys_business_type')) || [];
   return (
     <Box display="flex">
@@ -128,15 +143,17 @@
           marginRight: drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0,
         }}
         title={"menu.asnOrder"}
-        empty={<EmptyData onClick={() => { setCreateDialog(true); setmodalType(0) }} />}
+        empty={false}
         filters={filters}
-        filter={{deleted: 0}}
+        filter={{ deleted: 0, type: 'in' }}
         sort={{ field: "create_time", order: "desc" }}
         actions={(
           <TopToolbar>
             <FilterButton />
             <MyCreateButton onClick={() => { setCreateDialog(true); setmodalType(0) }} />
+            <CreateByPoButton setPoCreate={setPoCreate} />
             <SelectColumnsButton preferenceKey='asnOrder' />
+            <ImportButton value={'asnOrderItem'} />
             <MyExportButton />
           </TopToolbar>
         )}
@@ -150,12 +167,10 @@
               <InspectionsButton />
               <MyExportButton />
               {/* <BtnBulkExport></BtnBulkExport> */}
-              <BulkDeleteButton mutationMode={OPERATE_MODE}
-              />
             </>}
           rowClick={false}
           expandSingle={true}
-          omit={['id', 'createTime', 'createBy', 'memo', 'poId', 'rleStatus$']}
+          omit={['id', 'createTime', 'createBy', 'memo', 'logisNo', 'poId', 'rleStatus$','createBy$']}
         >
           <NumberField source="id" />
           <TextField source="code" label="table.field.asnOrder.code" />
@@ -165,9 +180,9 @@
           <TextField cellClassName="wkType" source="wkType$" label="table.field.asnOrder.wkType" />
           <NumberField source="anfme" label="table.field.asnOrder.anfme" />
           <NumberField source="qty" label="table.field.asnOrder.qty" />
-          <TextField source="logisNo" label="table.field.asnOrder.logisNo" />
           <DateField source="arrTime" label="table.field.asnOrder.arrTime" showTime />
           <TextField source="rleStatus$" label="table.field.asnOrder.rleStatus" sortable={false} />
+          <TextField source="logisNo" label="table.field.asnOrder.logisNo" />
           <TextField source="updateBy$" label="common.field.updateBy" />
           <DateField source="updateTime" label="common.field.updateTime" showTime />
           <TextField source="createBy$" label="common.field.createBy" />
@@ -179,7 +194,9 @@
             <MyButton setCreateDialog={setCreateDialog} setmodalType={setmodalType} />
             <InspectionButton />
             <CompleteButton />
-            <CloseButton />
+            <ODeleteButton />
+            <PrintButton setPrintOrder={setPrintOrder} setSelect={setSelect} />
+            {/* <CloseButton /> */}
           </WrapperField>
         </StyledDatagrid>
       </List>
@@ -188,6 +205,15 @@
         setOpen={setCreateDialog}
         asnId={modalType}
         billReload={billReload}
+      />
+      <OrderPrintPreview
+        open={printOrder}
+        setOpen={setPrintOrder}
+        record={select}
+      />
+      <AsnCreateByPoModal
+        open={poCreate}
+        setOpen={setPoCreate}
       />
       <PageDrawer
         title='AsnOrder Detail'
@@ -200,6 +226,47 @@
 }
 export default AsnOrderList;
 
+//鎸塒O鍗曟柊寤�
+const CreateByPoButton = ({ setPoCreate }) => {
+  const record = useRecordContext();
+
+  const createEvent = (event) => {
+    event.stopPropagation();
+    setPoCreate(true)
+  }
+  return (
+    <Button label={"toolbar.poCreate"} onClick={createEvent}>
+      <CreateNewFolderOutlinedIcon />
+    </Button>
+  )
+}
+
+
+//鎵撳嵃鎸夐挳
+const PrintButton = ({ setPrintOrder, setSelect }) => {
+  const record = useRecordContext();
+  const printOrder = (event) => {
+    event.stopPropagation();
+    setPrintOrder(true)
+    setSelect(record)
+  }
+
+  return (
+    <Button label={"toolbar.print"} onClick={printOrder}>
+      <PrintOutlinedIcon />
+    </Button>
+  )
+}
+
+
+const ODeleteButton = () => {
+  const record = useRecordContext();
+  return (
+    record.exceStatus === 0 ? <DeleteButton mutationMode="pessimistic" /> : <></>
+  )
+
+}
+
 const MyButton = ({ setCreateDialog, setmodalType }) => {
   const record = useRecordContext();
   const handleEditClick = (btn) => {
@@ -210,17 +277,20 @@
 
   };
   return (
-    <Button
-      color="primary"
-      startIcon={<EditIcon />}
-      onClick={(btn) => handleEditClick(btn)}
-      sx={{ ml: 1 }}
-      label={'ra.action.edit'}
-    >
-    </Button>
+    record.exceStatus === 1 || record.exceStatus === 0 ?
+      <Button
+        color="primary"
+        startIcon={<EditIcon />}
+        onClick={(btn) => handleEditClick(btn)}
+        sx={{ ml: 1 }}
+        label={'ra.action.edit'}
+      >
+      </Button>
+      : <></>
   )
 }
 
+//鎶ユ
 const InspectionButton = () => {
   const record = useRecordContext();
   const notify = useNotify();
@@ -240,11 +310,8 @@
     }
   }
 
-
   return (
-    <Button onClick={inspection} label={"toolbar.inspection"}>
-      <ConstructionIcon />
-    </Button>
+    <ConfirmButton label={"toolbar.inspection"} color="secondary" startIcon={<ConstructionIcon />} onConfirm={inspection} />
   )
 }
 
@@ -252,10 +319,11 @@
   const { selectedIds, onUnselectItems, data } = useListContext();
   const notify = useNotify();
   const refresh = useRefresh();
+  const translate = useTranslate();
   const inspection = (btn) => {
     btn.stopPropagation();
     if (selectedIds.length === 0) {
-      notify('璇烽�夋嫨閫氱煡鍗�');
+      notify(translate("request.error.select_error_order"));
       return;
     } else {
       const rows = data.filter((item) => selectedIds.includes(item.id))
@@ -327,6 +395,7 @@
   )
 }
 
+//瀹屾垚鍗曟嵁
 const CompleteButton = () => {
   const record = useRecordContext();
   const notify = useNotify();
@@ -343,10 +412,10 @@
   }
 
   return (
-    record.exceStatus === 1 && (record.anfme === record.qty ? <Button onClick={requestComplete} label={"toolbar.complete"} color="success">
-      <TaskIcon />
-    </Button> : <ConfirmButton label={"toolbar.complete"} color="success" data={'褰撳墠鏀惰揣鏁伴噺灏忎簬璁″垝鏁伴噺锛屾槸鍚︾‘璁ゅ畬鎴�'} startIcon={<TaskIcon />} onConfirm={requestComplete} />)
-
+    // record.exceStatus === 1 && (record.anfme === record.qty ? <Button onClick={requestComplete} label={"toolbar.complete"} color="secondary">
+    //   <TaskIcon />
+    // </Button> : )
+    record.exceStatus === 1 ? <ConfirmButton label={"toolbar.complete"} color="secondary" startIcon={<TaskIcon />} onConfirm={requestComplete} /> : <></>
   )
 
 
@@ -368,6 +437,6 @@
   }
 
   return (
-    <ConfirmButton label={"toolbar.close"} color="error" data={'纭鏄惁鍏抽棴锛�'} startIcon={<CloseIcon />} onConfirm={requestClose} />
+    <ConfirmButton label={"toolbar.close"} color="error" startIcon={<CloseIcon />} onConfirm={requestClose} />
   )
 }

--
Gitblit v1.9.1