From cb2a256130549f45a3ffd3464b84f1cf2f2589c9 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期二, 13 二月 2024 17:35:20 +0800
Subject: [PATCH] #
---
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/sys/controller/RoleController.java | 26 ++
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/sys/controller/param/PageParam.java | 13 +
zy-asrs-flow/src/pages/system/role/index.jsx | 562 ++++++++++++++++++++++++++------------------------
zy-asrs-flow/src/utils/http.js | 1
zy-asrs-flow/src/services/system/role.js | 0
5 files changed, 330 insertions(+), 272 deletions(-)
diff --git a/zy-asrs-flow/src/pages/system/role/index.jsx b/zy-asrs-flow/src/pages/system/role/index.jsx
index 52d09c5..2419489 100644
--- a/zy-asrs-flow/src/pages/system/role/index.jsx
+++ b/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('姝e湪鍒犻櫎');
- 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('姝e湪鍒犻櫎');
+ 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('姝e湪瑙i攣');
- try {
- const resp = await unlockLogininfor(userName);
- hide();
- if (resp.code === 200) {
- message.success('瑙i攣鎴愬姛锛屽嵆灏嗗埛鏂�');
- } else {
- message.error(resp.msg);
+ const hide = message.loading('姝e湪瑙i攣');
+ try {
+ const resp = await unlockLogininfor(userName);
+ hide();
+ if (resp.code === 200) {
+ message.success('瑙i攣鎴愬姛锛屽嵆灏嗗埛鏂�');
+ } else {
+ message.error(resp.msg);
+ }
+ return true;
+ } catch (error) {
+ hide();
+ message.error('瑙i攣澶辫触锛岃閲嶈瘯');
+ return false;
}
- return true;
- } catch (error) {
- hide();
- message.error('瑙i攣澶辫触锛岃閲嶈瘯');
- return false;
- }
};
/**
@@ -74,246 +77,261 @@
* @param id
*/
const handleExport = async () => {
- const hide = message.loading('姝e湪瀵煎嚭');
- try {
- await exportLogininfor();
- hide();
- message.success('瀵煎嚭鎴愬姛');
- return true;
- } catch (error) {
- hide();
- message.error('瀵煎嚭澶辫触锛岃閲嶈瘯');
- return false;
- }
+ const hide = message.loading('姝e湪瀵煎嚭');
+ 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: '鏄惁纭瑙i攣璇ョ敤鎴风殑鏁版嵁椤�?',
- 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="瑙i攣" />
- </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: '鏄惁纭瑙i攣璇ョ敤鎴风殑鏁版嵁椤�?',
+ 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="瑙i攣" />
+ </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;
diff --git a/zy-asrs-flow/src/services/system/role.js b/zy-asrs-flow/src/services/system/role.js
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/zy-asrs-flow/src/services/system/role.js
diff --git a/zy-asrs-flow/src/utils/http.js b/zy-asrs-flow/src/utils/http.js
new file mode 100644
index 0000000..b988b19
--- /dev/null
+++ b/zy-asrs-flow/src/utils/http.js
@@ -0,0 +1 @@
+import { request } from '@umijs/max';
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/sys/controller/RoleController.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/sys/controller/RoleController.java
new file mode 100644
index 0000000..244ef07
--- /dev/null
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/sys/controller/RoleController.java
@@ -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();
+ }
+
+}
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/sys/controller/param/PageParam.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/sys/controller/param/PageParam.java
new file mode 100644
index 0000000..70e78f6
--- /dev/null
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/sys/controller/param/PageParam.java
@@ -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 {
+
+
+
+}
--
Gitblit v1.9.1