#
luxiaotao1123
2024-02-13 cb2a256130549f45a3ffd3464b84f1cf2f2589c9
#
4个文件已添加
1个文件已修改
602 ■■■■ 已修改文件
zy-asrs-flow/src/pages/system/role/index.jsx 562 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-flow/src/services/system/role.js 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-flow/src/utils/http.js 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/sys/controller/RoleController.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/sys/controller/param/PageParam.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-flow/src/pages/system/role/index.jsx
@@ -7,6 +7,9 @@
import { getLogininforList, removeLogininfor, exportLogininfor, unlockLogininfor, cleanLogininfor } from '@/services/monitor/logininfor';
import DictTag from '@/components/DictTag';
import { getDictValueEnum } from '@/services/system/dict';
import { request } from '@umijs/max';
/**
 * 删除节点
@@ -14,58 +17,58 @@
 * @param selectedRows
 */
const handleRemove = async (selectedRows) => {
  const hide = message.loading('正在删除');
  if (!selectedRows) return true;
  try {
    const resp = await removeLogininfor(selectedRows.map((row) => row.infoId).join(','));
    hide();
    if (resp.code === 200) {
      message.success('删除成功,即将刷新');
    } else {
      message.error(resp.msg);
    if (!selectedRows) return true;
    const hide = message.loading('正在删除');
    try {
        const resp = await removeLogininfor(selectedRows.map((row) => row.infoId).join(','));
        hide();
        if (resp.code === 200) {
            message.success('删除成功,即将刷新');
        } else {
            message.error(resp.msg);
        }
        return true;
    } catch (error) {
        hide();
        message.error('删除失败,请重试');
        return false;
    }
    return true;
  } catch (error) {
    hide();
    message.error('删除失败,请重试');
    return false;
  }
};
const handleClean = async () => {
  const hide = message.loading('请稍候');
  try {
    const resp = await cleanLogininfor();
    hide();
    if (resp.code === 200) {
      message.success('清空成功,即将刷新');
    } else {
      message.error(resp.msg);
    const hide = message.loading('请稍候');
    try {
        const resp = await cleanLogininfor();
        hide();
        if (resp.code === 200) {
            message.success('清空成功,即将刷新');
        } else {
            message.error(resp.msg);
        }
        return true;
    } catch (error) {
        hide();
        message.error('请求失败,请重试');
        return false;
    }
    return true;
  } catch (error) {
    hide();
    message.error('请求失败,请重试');
    return false;
  }
};
const handleUnlock = async (userName) => {
  const hide = message.loading('正在解锁');
  try {
    const resp = await unlockLogininfor(userName);
    hide();
    if (resp.code === 200) {
      message.success('解锁成功,即将刷新');
    } else {
      message.error(resp.msg);
    const hide = message.loading('正在解锁');
    try {
        const resp = await unlockLogininfor(userName);
        hide();
        if (resp.code === 200) {
            message.success('解锁成功,即将刷新');
        } else {
            message.error(resp.msg);
        }
        return true;
    } catch (error) {
        hide();
        message.error('解锁失败,请重试');
        return false;
    }
    return true;
  } catch (error) {
    hide();
    message.error('解锁失败,请重试');
    return false;
  }
};
/**
@@ -74,246 +77,261 @@
 * @param id
 */
const handleExport = async () => {
  const hide = message.loading('正在导出');
  try {
    await exportLogininfor();
    hide();
    message.success('导出成功');
    return true;
  } catch (error) {
    hide();
    message.error('导出失败,请重试');
    return false;
  }
    const hide = message.loading('正在导出');
    try {
        await exportLogininfor();
        hide();
        message.success('导出成功');
        return true;
    } catch (error) {
        hide();
        message.error('导出失败,请重试');
        return false;
    }
};
const LogininforTableList = () => {
  const formTableRef = useRef();
    const formTableRef = useRef();
  const actionRef = useRef();
  const [selectedRows, setSelectedRows] = useState([]);
  const [statusOptions, setStatusOptions] = useState([]);
    const actionRef = useRef();
    const [selectedRows, setSelectedRows] = useState([]);
    const [statusOptions, setStatusOptions] = useState([]);
  const access = useAccess();
    const access = useAccess();
  /** 国际化配置 */
  const intl = useIntl();
    /** 国际化配置 */
    const intl = useIntl();
  useEffect(() => {
    getDictValueEnum('sys_common_status', true).then((data) => {
      setStatusOptions(data);
    });
  }, []);
    useEffect(() => {
        getDictValueEnum('sys_common_status', true).then((data) => {
            setStatusOptions(data);
        });
    }, []);
  const columns = [
    {
      title: <FormattedMessage id="monitor.logininfor.info_id" defaultMessage="访问编号" />,
      dataIndex: 'infoId',
      valueType: 'text',
      hideInSearch: true,
    },
    {
      title: <FormattedMessage id="monitor.logininfor.user_name" defaultMessage="用户账号" />,
      dataIndex: 'userName',
      valueType: 'text',
    },
    {
      title: <FormattedMessage id="monitor.logininfor.ipaddr" defaultMessage="登录IP地址" />,
      dataIndex: 'ipaddr',
      valueType: 'text',
    },
    {
      title: <FormattedMessage id="monitor.logininfor.login_location" defaultMessage="登录地点" />,
      dataIndex: 'loginLocation',
      valueType: 'text',
      hideInSearch: true,
    },
    {
      title: <FormattedMessage id="monitor.logininfor.browser" defaultMessage="浏览器类型" />,
      dataIndex: 'browser',
      valueType: 'text',
      hideInSearch: true,
    },
    {
      title: <FormattedMessage id="monitor.logininfor.os" defaultMessage="操作系统" />,
      dataIndex: 'os',
      valueType: 'text',
      hideInSearch: true,
    },
    {
      title: <FormattedMessage id="monitor.logininfor.status" defaultMessage="登录状态" />,
      dataIndex: 'status',
      valueType: 'select',
      valueEnum: statusOptions,
      render: (_, record) => {
        return (<DictTag enums={statusOptions} value={record.status} />);
      },
    },
    {
      title: <FormattedMessage id="monitor.logininfor.msg" defaultMessage="提示消息" />,
      dataIndex: 'msg',
      valueType: 'text',
      hideInSearch: true,
    },
    {
      title: <FormattedMessage id="monitor.logininfor.login_time" defaultMessage="访问时间" />,
      dataIndex: 'loginTime',
      valueType: 'dateTime',
    },
  ];
  return (
    <PageContainer>
      <div style={{ width: '100%', float: 'right' }}>
        <ProTable
          headerTitle={intl.formatMessage({
            id: 'pages.searchTable.title',
            defaultMessage: '信息',
          })}
          actionRef={actionRef}
          formRef={formTableRef}
          rowKey="infoId"
          key="logininforList"
          search={{
            labelWidth: 120,
          }}
          toolBarRender={() => [
            <Button
              key="remove"
              danger
              hidden={selectedRows?.length === 0 || !access.hasPerms('monitor:logininfor:remove')}
              onClick={async () => {
                Modal.confirm({
                  title: '是否确认删除所选数据项?',
                  icon: <ExclamationCircleOutlined />,
                  content: '请谨慎操作',
                  async onOk() {
                    const success = await handleRemove(selectedRows);
                    if (success) {
                      setSelectedRows([]);
                      actionRef.current?.reloadAndRest?.();
                    }
                  },
                  onCancel() { },
                });
              }}
            >
              <DeleteOutlined />
              <FormattedMessage id="pages.searchTable.delete" defaultMessage="删除" />
            </Button>,
            <Button
              type="primary"
              key="clean"
              danger
              hidden={selectedRows?.length === 0 || !access.hasPerms('monitor:logininfor:remove')}
              onClick={async () => {
                Modal.confirm({
                  title: '是否确认清空所有数据项?',
                  icon: <ExclamationCircleOutlined />,
                  content: '请谨慎操作',
                  async onOk() {
                    const success = await handleClean();
                    if (success) {
                      setSelectedRows([]);
                      actionRef.current?.reloadAndRest?.();
                    }
                  },
                  onCancel() { },
                });
              }}
            >
              <DeleteOutlined />
              <FormattedMessage id="pages.searchTable.cleanAll" defaultMessage="清空" />
            </Button>,
            <Button
              type="primary"
              key="unlock"
              hidden={selectedRows?.length === 0 || !access.hasPerms('monitor:logininfor:unlock')}
              onClick={async () => {
                Modal.confirm({
                  title: '是否确认解锁该用户的数据项?',
                  icon: <ExclamationCircleOutlined />,
                  content: '请谨慎操作',
                  async onOk() {
                    const success = await handleUnlock(selectedRows[0].userName);
                    if (success) {
                      setSelectedRows([]);
                      actionRef.current?.reloadAndRest?.();
                    }
                  },
                  onCancel() { },
                });
              }}
            >
              <UnlockOutlined />
              <FormattedMessage id="monitor.logininfor.unlock" defaultMessage="解锁" />
            </Button>,
            <Button
              type="primary"
              key="export"
              hidden={!access.hasPerms('monitor:logininfor:export')}
              onClick={async () => {
                handleExport();
              }}
            >
              <PlusOutlined />
              <FormattedMessage id="pages.searchTable.export" defaultMessage="导出" />
            </Button>,
          ]}
          request={(params) =>
            getLogininforList({ ...params }).then((res) => {
              const result = {
                data: res.rows,
                total: res.total,
                success: true,
              };
              return result;
            })
          }
          columns={columns}
          rowSelection={{
            onChange: (_, selectedRows) => {
              setSelectedRows(selectedRows);
    const columns = [
        {
            title: <FormattedMessage id="monitor.logininfor.info_id" defaultMessage="访问编号" />,
            dataIndex: 'infoId',
            valueType: 'text',
            hideInSearch: true,
        },
        {
            title: <FormattedMessage id="monitor.logininfor.user_name" defaultMessage="用户账号" />,
            dataIndex: 'userName',
            valueType: 'text',
        },
        {
            title: <FormattedMessage id="monitor.logininfor.ipaddr" defaultMessage="登录IP地址" />,
            dataIndex: 'ipaddr',
            valueType: 'text',
        },
        {
            title: <FormattedMessage id="monitor.logininfor.login_location" defaultMessage="登录地点" />,
            dataIndex: 'loginLocation',
            valueType: 'text',
            hideInSearch: true,
        },
        {
            title: <FormattedMessage id="monitor.logininfor.browser" defaultMessage="浏览器类型" />,
            dataIndex: 'browser',
            valueType: 'text',
            hideInSearch: true,
        },
        {
            title: <FormattedMessage id="monitor.logininfor.os" defaultMessage="操作系统" />,
            dataIndex: 'os',
            valueType: 'text',
            hideInSearch: true,
        },
        {
            title: <FormattedMessage id="monitor.logininfor.status" defaultMessage="登录状态" />,
            dataIndex: 'status',
            valueType: 'select',
            valueEnum: statusOptions,
            render: (_, record) => {
                return (<DictTag enums={statusOptions} value={record.status} />);
            },
          }}
        />
      </div>
      {selectedRows?.length > 0 && (
        <FooterToolbar
          extra={
            <div>
              <FormattedMessage id="pages.searchTable.chosen" defaultMessage="已选择" />
              <a style={{ fontWeight: 600 }}>{selectedRows.length}</a>
              <FormattedMessage id="pages.searchTable.item" defaultMessage="项" />
        },
        {
            title: <FormattedMessage id="monitor.logininfor.msg" defaultMessage="提示消息" />,
            dataIndex: 'msg',
            valueType: 'text',
            hideInSearch: true,
        },
        {
            title: <FormattedMessage id="monitor.logininfor.login_time" defaultMessage="访问时间" />,
            dataIndex: 'loginTime',
            valueType: 'dateTime',
        },
    ];
    return (
        <PageContainer>
            <div style={{ width: '100%', float: 'right' }}>
                <ProTable
                    headerTitle={intl.formatMessage({
                        id: 'pages.searchTable.title',
                        defaultMessage: '信息',
                    })}
                    actionRef={actionRef}
                    formRef={formTableRef}
                    rowKey="infoId"
                    key="logininforList"
                    search={{
                        labelWidth: 120,
                    }}
                    toolBarRender={() => [
                        <Button
                            key="remove"
                            danger
                            hidden={selectedRows?.length === 0 || !access.hasPerms('monitor:logininfor:remove')}
                            onClick={async () => {
                                Modal.confirm({
                                    title: '是否确认删除所选数据项?',
                                    icon: <ExclamationCircleOutlined />,
                                    content: '请谨慎操作',
                                    async onOk() {
                                        const success = await handleRemove(selectedRows);
                                        if (success) {
                                            setSelectedRows([]);
                                            actionRef.current?.reloadAndRest?.();
                                        }
                                    },
                                    onCancel() { },
                                });
                            }}
                        >
                            <DeleteOutlined />
                            <FormattedMessage id="pages.searchTable.delete" defaultMessage="删除" />
                        </Button>,
                        <Button
                            type="primary"
                            key="clean"
                            danger
                            hidden={selectedRows?.length === 0 || !access.hasPerms('monitor:logininfor:remove')}
                            onClick={async () => {
                                Modal.confirm({
                                    title: '是否确认清空所有数据项?',
                                    icon: <ExclamationCircleOutlined />,
                                    content: '请谨慎操作',
                                    async onOk() {
                                        const success = await handleClean();
                                        if (success) {
                                            setSelectedRows([]);
                                            actionRef.current?.reloadAndRest?.();
                                        }
                                    },
                                    onCancel() { },
                                });
                            }}
                        >
                            <DeleteOutlined />
                            <FormattedMessage id="pages.searchTable.cleanAll" defaultMessage="清空" />
                        </Button>,
                        <Button
                            type="primary"
                            key="unlock"
                            hidden={selectedRows?.length === 0 || !access.hasPerms('monitor:logininfor:unlock')}
                            onClick={async () => {
                                Modal.confirm({
                                    title: '是否确认解锁该用户的数据项?',
                                    icon: <ExclamationCircleOutlined />,
                                    content: '请谨慎操作',
                                    async onOk() {
                                        const success = await handleUnlock(selectedRows[0].userName);
                                        if (success) {
                                            setSelectedRows([]);
                                            actionRef.current?.reloadAndRest?.();
                                        }
                                    },
                                    onCancel() { },
                                });
                            }}
                        >
                            <UnlockOutlined />
                            <FormattedMessage id="monitor.logininfor.unlock" defaultMessage="解锁" />
                        </Button>,
                        <Button
                            type="primary"
                            key="export"
                            hidden={!access.hasPerms('monitor:logininfor:export')}
                            onClick={async () => {
                                handleExport();
                            }}
                        >
                            <PlusOutlined />
                            <FormattedMessage id="pages.searchTable.export" defaultMessage="导出" />
                        </Button>,
                    ]}
                    request={(params) =>
                        request('/api/role/page', {
                            method: 'POST',
                            headers: {
                                'Content-Type': 'application/json'
                            },
                            data: { ...params }
                        }).then((res) => {
                            const result = {
                                data: res.rows,
                                total: res.total,
                                success: true,
                            };
                            return result;
                        })
                        // getLogininforList({ ...params }).then((res) => {
                        //   const result = {
                        //     data: res.rows,
                        //     total: res.total,
                        //     success: true,
                        //   };
                        //   return result;
                        // })
                    }
                    columns={columns}
                    rowSelection={{
                        onChange: (_, selectedRows) => {
                            setSelectedRows(selectedRows);
                        },
                    }}
                />
            </div>
          }
        >
          <Button
            key="remove"
            hidden={!access.hasPerms('monitor:logininfor:remove')}
            onClick={async () => {
              Modal.confirm({
                title: '删除',
                content: '确定删除该项吗?',
                okText: '确认',
                cancelText: '取消',
                onOk: async () => {
                  const success = await handleRemove(selectedRows);
                  if (success) {
                    setSelectedRows([]);
                    actionRef.current?.reloadAndRest?.();
                  }
                },
              });
            }}
          >
            <FormattedMessage id="pages.searchTable.batchDeletion" defaultMessage="批量删除" />
          </Button>
        </FooterToolbar>
      )}
    </PageContainer>
  );
            {selectedRows?.length > 0 && (
                <FooterToolbar
                    extra={
                        <div>
                            <FormattedMessage id="pages.searchTable.chosen" defaultMessage="已选择" />
                            <a style={{ fontWeight: 600 }}>{selectedRows.length}</a>
                            <FormattedMessage id="pages.searchTable.item" defaultMessage="项" />
                        </div>
                    }
                >
                    <Button
                        key="remove"
                        hidden={!access.hasPerms('monitor:logininfor:remove')}
                        onClick={async () => {
                            Modal.confirm({
                                title: '删除',
                                content: '确定删除该项吗?',
                                okText: '确认',
                                cancelText: '取消',
                                onOk: async () => {
                                    const success = await handleRemove(selectedRows);
                                    if (success) {
                                        setSelectedRows([]);
                                        actionRef.current?.reloadAndRest?.();
                                    }
                                },
                            });
                        }}
                    >
                        <FormattedMessage id="pages.searchTable.batchDeletion" defaultMessage="批量删除" />
                    </Button>
                </FooterToolbar>
            )}
        </PageContainer>
    );
};
export default LogininforTableList;
zy-asrs-flow/src/services/system/role.js
zy-asrs-flow/src/utils/http.js
New file
@@ -0,0 +1 @@
import { request } from '@umijs/max';
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/sys/controller/RoleController.java
New file
@@ -0,0 +1,26 @@
package com.zy.asrs.wcs.sys.controller;
import com.zy.asrs.framework.common.R;
import com.zy.asrs.wcs.common.annotation.OperationLog;
import com.zy.asrs.wcs.sys.entity.User;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
 * Created by vincent on 2/13/2024
 */
@RestController
@RequestMapping("/api")
public class RoleController extends BaseController {
    @PreAuthorize("hasAuthority('sys:auth:user')")
    @OperationLog
    @PutMapping("/role/page")
    public R updateInfo(@RequestBody User user) {
        return R.ok();
    }
}
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/sys/controller/param/PageParam.java
New file
@@ -0,0 +1,13 @@
package com.zy.asrs.wcs.sys.controller.param;
import lombok.Data;
/**
 * Created by vincent on 2/13/2024
 */
@Data
public class PageParam {
}