pyt
2025-02-26 403da33c30fc628c1608b96d95efdc12e70c3b06
management/src/pages/work-order/banner/index.jsx
@@ -3,35 +3,20 @@
import { Button, message, Space } from 'antd';
import { useRef, useState } from 'react';
import { Access, history, useAccess } from 'umi';
import AddAndEdit from './components/index';
import { getList, updateStatus, deleteBanner } from './service'
const Banner = () => {
  const actionRef = useRef();
  const access = useAccess();
  const addViewRef = useRef();
  const [modalVisible, handleModalVisible] = useState(false);
  const columns = [
    {
      title: 'banner名称',
      dataIndex: 'bannerName'
      dataIndex: 'name'
    },
    // {
    //   title: '添加时间',
    //   dataIndex: 'createTime',
    //   hideInSearch: true,
    // },
    // {
    //   title: '排序',
    //   dataIndex: 'sortNum',
    //   hideInSearch: true,
    // },
    // {
    //   title: '状态',
    //   dataIndex: 'listingStatus',
    //   valueEnum: {
    //     '上架中': { text: '上架中' },
    //     '已下架' : { text: '已下架' },
    //   }
    // },
    {
      title: '操作',
      hideInSearch: true,
@@ -63,46 +48,6 @@
                删除
              </Button>
            </Access>
            {/* <Button
              type="link"
              onClick={() => {
                history.push( `/marketing/banner/add?id=${record.id}&detail=true`);
              }}
            >
              查看详情
            </Button>
            {
              record.listingStatus == '已下架' &&
              <Button
                type="link"
                onClick={() => {
                  showDelConfirm(async () => {
                    let status = await sendRequest(updateStatus, { id: record.id, listingStatus: '上架中' })
                    if (status) {
                      actionRef.current.reload();
                    }
                  }, '确认上架所选信息吗?');
                }}
              >
                上架
              </Button>
            }
            {
              record.listingStatus == '上架中' &&
              <Button
                type="link"
                onClick={async () => {
                  showDelConfirm(async () => {
                    let status = await sendRequest(updateStatus, { id: record.id, listingStatus: '已下架' })
                    if (status) {
                      actionRef.current.reload();
                    }
                  }, '确认下架所选信息吗?');
                }}
              >
                下架
              </Button>
            } */}
          </Space >
        );
      },
@@ -121,7 +66,6 @@
          defaultPageSize: 10,
        }}
        request={(params) => {
          params.bannerType = Number(params.bannerType)
          return buildProTableDataSource(getList, params)
        }}
        toolBarRender={(action, selectRows) => [
@@ -130,9 +74,8 @@
              <Button
                type="primary"
                onClick={() => {
                  history.push({
                    pathname: `/marketing/banner/add`,
                  });
                  addViewRef.current.refreshData({});
                  handleModalVisible(true);
                }}
              >
                添加
@@ -141,6 +84,25 @@
          </Space>
        ]}
      />
      <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();
                  }
                }}
              />
    </PageContainer>
  </div>;
};