落日与鲸
2025-02-28 573193bb8ba686b06b5132cd233f953cc06d310d
management/src/pages/work-order/banner/index.jsx
@@ -4,7 +4,7 @@
import { useRef, useState } from 'react';
import { Access, history, useAccess } from 'umi';
import AddAndEdit from './components/index';
import { getList, updateStatus, deleteBanner } from './service'
import { getList, updateStatus, deleteBanner, add, Edit } from './service'
const Banner = () => {
  const actionRef = useRef();
@@ -27,7 +27,9 @@
              <Button
                type="link"
                onClick={() => {
                  history.push(`/marketing/banner/add?id=${record.id}&edit=true`);
                  addViewRef.current.clean();
                  addViewRef.current.refreshData({ ...record, type: 'edit' });
                  handleModalVisible(true);
                }}
              >
                编辑
@@ -55,7 +57,9 @@
  ]
  return <div>
    <PageContainer title='banner管理'>
    <PageContainer title='banner管理' header={{
        breadcrumb: {},
      }}>
      <ProTable
        rowKey='id'
        actionRef={actionRef}
@@ -74,6 +78,7 @@
              <Button
                type="primary"
                onClick={() => {
                  addViewRef.current.clean();
                  addViewRef.current.refreshData({});
                  handleModalVisible(true);
                }}
@@ -85,24 +90,24 @@
        ]}
      />
      <AddAndEdit
                ref={addViewRef}
                visible={modalVisible}
                onCancel={() => handleModalVisible(false)}
                onSave={async (fileds) => {
                  const success = await sendRequest(add, fileds);
                  if (success) {
                    handleModalVisible(false);
                    actionRef.current.reload();
                  }
                }}
                onUpdate={async (fileds) => {
                  const success = await sendRequest(Edit, fileds);
                  if (success) {
                    handleModalVisible(false);
                    actionRef.current.reload();
                  }
                }}
              />
        ref={addViewRef}
        visible={modalVisible}
        onCancel={() => handleModalVisible(false)}
        onSave={async (fileds) => {
          const success = await sendRequest(add, fileds);
          if (success) {
            handleModalVisible(false);
            actionRef.current.reload();
          }
        }}
        onUpdate={async (fileds) => {
          const success = await sendRequest(Edit, fileds);
          if (success) {
            handleModalVisible(false);
            actionRef.current.reload();
          }
        }}
      />
    </PageContainer>
  </div>;
};