Commit e8807339 authored by TZW's avatar TZW

1216

parent 2a4a0ab0
...@@ -13,7 +13,7 @@ export default { ...@@ -13,7 +13,7 @@ export default {
dev: { dev: {
[defaultSetting.proxypath]: { [defaultSetting.proxypath]: {
// 要代理的地址 // 要代理的地址
target: 'http://ems-test.nangaoyun.com/', //jf哥 target: 'http://192.168.40.64:28001', //jf哥
// target: 'http://192.168.40.203:8000', //dj哥 // target: 'http://192.168.40.203:8000', //dj哥
changeOrigin: true, changeOrigin: true,
}, },
......
...@@ -26,7 +26,8 @@ function strToHump(str) { ...@@ -26,7 +26,8 @@ function strToHump(str) {
} }
export async function getInitialState() { export async function getInitialState() {
let token = true; console.log(history);
let token = localStorage.getItem('TOKENES');
const fetchUserInfo = async () => { const fetchUserInfo = async () => {
try { try {
const msg = await queryCurrentUser(); const msg = await queryCurrentUser();
...@@ -48,6 +49,7 @@ export async function getInitialState() { ...@@ -48,6 +49,7 @@ export async function getInitialState() {
}; // 如果是登录页面,不执行 }; // 如果是登录页面,不执行
if (history.location.pathname !== loginPath && token) { if (history.location.pathname !== loginPath && token) {
console.log(3);
const currentUserData = await fetchUserInfo(); const currentUserData = await fetchUserInfo();
let menuData; let menuData;
if (currentUserData?.data?.username) { if (currentUserData?.data?.username) {
...@@ -73,7 +75,7 @@ export async function getInitialState() { ...@@ -73,7 +75,7 @@ export async function getInitialState() {
// ProLayout 支持的api https://procomponents.ant.design/components/layout // ProLayout 支持的api https://procomponents.ant.design/components/layout
export const layout = ({ initialState, setInitialState }) => { export const layout = ({ initialState, setInitialState }) => {
let token = true; let token = localStorage.getItem('TOKENES');
return { return {
disableContentMargin: false, disableContentMargin: false,
waterMarkProps: { waterMarkProps: {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: Li Hanlin * @Author: Li Hanlin
* @Date: 2022-11-29 14:03:07 * @Date: 2022-11-29 14:03:07
* @Last Modified by: Li Hanlin * @Last Modified by: Li Hanlin
* @Last Modified time: 2022-12-14 14:08:31 * @Last Modified time: 2022-12-16 11:38:33
*/ */
import { doFetch } from '@/utils/doFetch'; import { doFetch } from '@/utils/doFetch';
...@@ -22,7 +22,6 @@ const App = ({ ...@@ -22,7 +22,6 @@ const App = ({
}) => { }) => {
const [value, setValue] = useState(''); const [value, setValue] = useState('');
const [fieldscolumns, setfieldscolumns] = useState(columns); const [fieldscolumns, setfieldscolumns] = useState(columns);
console.log(123123);
const selectValueType = (type, options) => { const selectValueType = (type, options) => {
switch (type) { switch (type) {
case 1: case 1:
......
...@@ -77,8 +77,8 @@ const Login = () => { ...@@ -77,8 +77,8 @@ const Login = () => {
password: values.password, password: values.password,
}; };
try { try {
history.push('/'); // history.push('/');
return; // return;
// 登录 // 登录
const res = await doFetch({ const res = await doFetch({
url: `/token/oauth/token?grant_type=password&client_id=NGEMS3&client_secret=ems_Nangao@2022&username=${values?.userName}&password=${values?.password}`, url: `/token/oauth/token?grant_type=password&client_id=NGEMS3&client_secret=ems_Nangao@2022&username=${values?.userName}&password=${values?.password}`,
......
...@@ -2,12 +2,12 @@ import { doFetch } from '@/utils/doFetch'; ...@@ -2,12 +2,12 @@ import { doFetch } from '@/utils/doFetch';
import { Image } from 'antd'; import { Image } from 'antd';
import fieldsDetail from '@/utils/fieldsDetail'; import fieldsDetail from '@/utils/fieldsDetail';
import { useState, useEffect } from 'react'; import { useState, useEffect } from 'react';
function getcolumns(setdrawer, usermsg) { function getcolumns(setDrawer, usermsg) {
console.log(usermsg);
const options = usermsg?.map((it) => ({ const options = usermsg?.map((it) => ({
label: `${it?.username}-${it?.fullName}`, label: `${it?.username}-${it?.fullName}`,
value: it?.id, value: it?.id,
})); }));
console.log(options);
return [ return [
{ {
title: '用户名', title: '用户名',
...@@ -19,7 +19,20 @@ function getcolumns(setdrawer, usermsg) { ...@@ -19,7 +19,20 @@ function getcolumns(setdrawer, usermsg) {
options, options,
fieldProps: { fieldProps: {
onChange: (e) => { onChange: (e) => {
console.log(e); let item = usermsg?.filter((it) => {
return it?.id == e;
});
console.log(item);
setDrawer((s) => ({
...s,
item: {
mailNo: item?.mailbox,
telephone: item?.phone,
status: item?.enabled,
fullName: item?.fullName,
username: item?.username,
},
}));
}, },
}, },
}, },
...@@ -98,7 +111,7 @@ function getcolumns(setdrawer, usermsg) { ...@@ -98,7 +111,7 @@ function getcolumns(setdrawer, usermsg) {
key: 'status', key: 'status',
}, },
], ],
setdrawer, setDrawer,
row, row,
'1', '1',
'/auth/sysUser/detail', '/auth/sysUser/detail',
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: Li Hanlin * @Author: Li Hanlin
* @Date: 2022-11-09 14:44:44 * @Date: 2022-11-09 14:44:44
* @Last Modified by: Li Hanlin * @Last Modified by: Li Hanlin
* @Last Modified time: 2022-12-16 11:18:33 * @Last Modified time: 2022-12-16 14:09:32
*/ */
import * as React from 'react'; import * as React from 'react';
...@@ -20,7 +20,15 @@ import { useRequest } from 'ahooks'; ...@@ -20,7 +20,15 @@ import { useRequest } from 'ahooks';
function User(props) { function User(props) {
const { initialState, loading, error, refresh, setInitialState } = useModel('@@initialState'); const { initialState, loading, error, refresh, setInitialState } = useModel('@@initialState');
console.log('usermsg:', initialState); const [username, setusername] = useState(null);
const { data } = useRequest(async () => {
let res = await doFetch({
url: '/auth/sysUser/queryLikeIotUsername',
params: { username: initialState?.currentUser?.username },
});
return res?.data?.dataList;
});
console.log(data);
const actionRef = useRef(), const actionRef = useRef(),
formRef = useRef(); formRef = useRef();
const [drawer, setDrawer] = useState({ const [drawer, setDrawer] = useState({
...@@ -140,17 +148,6 @@ function User(props) { ...@@ -140,17 +148,6 @@ function User(props) {
); );
}; };
const [username, setusername] = useState(null);
const { data } = useRequest(async () => {
let res = await doFetch({
url: '/auth/sysUser/queryLikeIotUsername',
params: { username: initialState?.currentUser?.username },
});
return res?.data?.dataList;
});
console.log(data);
const columns = useMemo(() => { const columns = useMemo(() => {
let defcolumn = getcolumns(setDrawer, data); let defcolumn = getcolumns(setDrawer, data);
return defcolumn.concat({ return defcolumn.concat({
...@@ -159,7 +156,7 @@ function User(props) { ...@@ -159,7 +156,7 @@ function User(props) {
width: 150, width: 150,
render: (text, row, _, action) => [edit(text, row, _, action), remove(text, row, _, action)], render: (text, row, _, action) => [edit(text, row, _, action), remove(text, row, _, action)],
}); });
}, []); }, [data, drawer?.item]);
function selectType(type) { function selectType(type) {
switch (type) { switch (type) {
......
...@@ -31,7 +31,6 @@ function getcolumns(setdrawer) { ...@@ -31,7 +31,6 @@ function getcolumns(setdrawer) {
title: '数据类型', title: '数据类型',
dataIndex: 'dataTypeName', dataIndex: 'dataTypeName',
key: 'dataType', key: 'dataType',
valueType: 'input',
hideInForm: false, hideInForm: false,
fieldProps: { fieldProps: {
disabled: true, disabled: true,
...@@ -45,6 +44,17 @@ function getcolumns(setdrawer) { ...@@ -45,6 +44,17 @@ function getcolumns(setdrawer) {
valueType: 'input', valueType: 'input',
hideInForm: true, hideInForm: true,
hideInTable: true, hideInTable: true,
valueType: 'select',
options: [
{
label: '初始化',
value: '1',
},
{
label: '自定义',
value: '2',
},
],
}, },
{ {
title: '描述', title: '描述',
......
...@@ -26,6 +26,7 @@ function getcolumns(setdrawer) { ...@@ -26,6 +26,7 @@ function getcolumns(setdrawer) {
title: '规则配置', title: '规则配置',
dataIndex: 'nrList', dataIndex: 'nrList',
hideInTable: true, hideInTable: true,
search: true,
valueType: 'diyrules', valueType: 'diyrules',
colProps: { colProps: {
span: 24, span: 24,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment