Commit 2e168ae0 authored by TZW's avatar TZW

2022.11.9

parent b3a18d30
export default [ export default [
{ "path": "/welcome", "name": "欢迎", "icon": "smile", "component": "./Welcome" }, { path: '/welcome', name: '欢迎', icon: 'smile', component: './Welcome' },
{ "name": "表格", "icon": "table", "path": "/system",
"routes": [{ "name": "表格列表", "path": "/system/staff", "unkeepalive": true, "component": "./Welcome" },
{ "name": "测试", "path": "/system/jiagou", "component": "./Test" }, { "component": "./404" }] },
{ "name": "左玲玲", "path": "/zll", "icon": "eye", "component": "./zll" },
{ {
"name": "基础设置", name: '基础设置',
"icon": "setting", icon: 'setting',
"path": "/setting", path: '/setting',
"routes": [ routes: [
{ {
"name": "工厂管理", name: '用户管理',
"path": "/setting/factory", path: '/setting/users',
"component": "./setting/factory" component: './setting/users',
} },
] {
} name: '角色管理',
path: '/setting/role',
component: './setting/role',
},
{
name: '组织管理',
path: '/setting/organization',
component: './setting/organization',
},
{
name: '工厂管理',
path: '/setting/factory',
component: './setting/factory',
},
{
name: '车间管理',
path: '/setting/workshop',
component: './setting/workshop',
},
],
},
]; ];
const Settings = { const Settings = {
title: 'basepro', title: '设备管理系统',
name: 'basepro', name: '设备管理系统',
navTheme: 'light', navTheme: 'dark',
primaryColor: '#1890ff', primaryColor: '#1890ff',
layout: 'side', layout: 'side',
contentWidth: 'Fluid', contentWidth: 'Fluid',
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
let allauth = authRoutes; // .map((it) => ({ ...it, wrappers: ['@/wrappers/auth'] })); let allauth = authRoutes; // .map((it) => ({ ...it, wrappers: ['@/wrappers/auth'] }));
console.log(allauth);
export default [ export default [
{ {
path: '/user', path: '/user',
......
...@@ -12,6 +12,8 @@ import routes from '../config/authRoutes'; ...@@ -12,6 +12,8 @@ import routes from '../config/authRoutes';
const { LinkOutlined } = Ant4Icons; const { LinkOutlined } = Ant4Icons;
const isDev = process.env.NODE_ENV === 'development'; const isDev = process.env.NODE_ENV === 'development';
// const isDev = false
console.log(isDev);
const loginPath = '/user/login'; const loginPath = '/user/login';
/** /**
...@@ -47,14 +49,12 @@ export async function getInitialState() { ...@@ -47,14 +49,12 @@ export async function getInitialState() {
} }
return undefined; return undefined;
}; // 如果是登录页面,不执行 }; // 如果是登录页面,不执行
if (history.location.pathname !== loginPath && token) { if (history.location.pathname !== loginPath && token) {
const currentUserData = await fetchUserInfo(); const currentUserData = await fetchUserInfo();
let menuData; let menuData;
if (currentUserData?.data?.userName) { if (currentUserData?.data?.userName) {
menuData = await getmenuData(); menuData = await getmenuData();
} }
/* isdev */ /* isdev */
if (isDev) { if (isDev) {
menuData = { menuData = {
...@@ -73,12 +73,23 @@ export async function getInitialState() { ...@@ -73,12 +73,23 @@ export async function getInitialState() {
collapsed: false, collapsed: false,
}; };
} }
let menuData = {};
if (isDev) {
menuData = {
recentUsePermList: [],
collectPerm: [],
userHavePermList: routes,
};
}
return { return {
fetchUserInfo, fetchUserInfo,
settings: defaultSettings, settings: defaultSettings,
getmenuData, getmenuData,
collapsed: false, collapsed: false,
tagList: [], tagList: [],
newMenu: menuData,
}; };
} }
...@@ -130,6 +141,7 @@ export const layout = ({ initialState, setInitialState }) => { ...@@ -130,6 +141,7 @@ export const layout = ({ initialState, setInitialState }) => {
userId: initialState?.currentUser?.id, userId: initialState?.currentUser?.id,
}, },
request: (params, defaultMenuData) => { request: (params, defaultMenuData) => {
console.log(initialState);
let lastArr = initialState?.newMenu?.userHavePermList let lastArr = initialState?.newMenu?.userHavePermList
? JSON.parse(JSON.stringify(initialState?.newMenu?.userHavePermList)) ? JSON.parse(JSON.stringify(initialState?.newMenu?.userHavePermList))
: [], : [],
......
...@@ -58,13 +58,14 @@ ol { ...@@ -58,13 +58,14 @@ ol {
width: 100%; width: 100%;
overflow-x: auto; overflow-x: auto;
&-thead > tr, &-thead>tr,
&-tbody > tr { &-tbody>tr {
> th,
> td { >th,
>td {
white-space: pre; white-space: pre;
> span { >span {
display: block; display: block;
} }
} }
...@@ -196,6 +197,7 @@ ol { ...@@ -196,6 +197,7 @@ ol {
display: flex !important; display: flex !important;
flex-wrap: nowrap !important; flex-wrap: nowrap !important;
} }
.ant-pro { .ant-pro {
display: flex; display: flex;
align-items: center; align-items: center;
...@@ -311,7 +313,7 @@ ol { ...@@ -311,7 +313,7 @@ ol {
} }
.lightblue { .lightblue {
> td:first-child { >td:first-child {
position: relative; position: relative;
&::before { &::before {
...@@ -333,14 +335,14 @@ ol { ...@@ -333,14 +335,14 @@ ol {
width: 100%; width: 100%;
padding-left: 0 !important; padding-left: 0 !important;
> span:first-child { >span:first-child {
flex: 1; flex: 1;
> span:first-child { >span:first-child {
display: none !important; display: none !important;
} }
> .ant-spin-nested-loading { >.ant-spin-nested-loading {
width: 100%; width: 100%;
} }
} }
...@@ -367,23 +369,45 @@ ol { ...@@ -367,23 +369,45 @@ ol {
padding-top: 0 !important; padding-top: 0 !important;
} }
} }
//editor fixed //editor fixed
.bf-link-editor .buttons { .bf-link-editor .buttons {
box-sizing: content-box !important; box-sizing: content-box !important;
} }
.bf-container { .bf-container {
display: flex !important; display: flex !important;
flex-direction: column !important; flex-direction: column !important;
.bf-content { .bf-content {
flex: 1 !important; flex: 1 !important;
} }
} }
.container, .container,
.diycard { .diycard {
height: 100% !important; height: 100% !important;
} }
.runtime-keep-alive-layout { .runtime-keep-alive-layout {
> div { >div {
height: 100% !important; height: 100% !important;
} }
} }
.page-title {
margin-bottom: 0;
font-weight: 700;
}
.page-title::before {
content: '|';
width: 4px;
position: relative;
top: 2px;
left: 2px;
color: #1890FF;
background-color: #1890FF;
margin-right: 10px;
}
\ No newline at end of file
import React, { useState, useMemo } from 'react';
import { Divider } from 'antd';
import AutoTable from '@/components/AutoTable';
import PremButton from '@/components/PremButton';
export default () => {
const [activeTabKey, onTabChange] = useState('0');
//配置式table
const columns = useMemo(() => {
return [
{
title: '用户名',
dataIndex: 'accountName',
key: 'accountName',
search: false,
},
{
title: '姓名',
dataIndex: 'userName',
key: 'userName',
},
{
title: '组织',
dataIndex: 'departmentName',
key: 'departmentName',
},
{
title: '工厂',
dataIndex: 'factoryName',
key: 'factoryName',
},
{
title: '负责仓库',
dataIndex: 'chargeStoreName',
key: 'chargeStoreName',
},
{
title: '角色',
dataIndex: 'roleName',
key: 'roleName',
},
{
title: '联系电话',
dataIndex: 'telephone',
key: 'telephone',
},
{
title: '操作',
valueType: 'option',
width: 150,
render: (text, row, _, action) => [
edit(text, row, _, action),
remove(text, row, _, action),
],
},
];
}, []);
const edit = (text, row, _, action) => {
return (
<PremButton
btn={{
size: 'small',
onClick: () => { },
}}
>
编辑
</PremButton>
);
};
const remove = (text, row, _, action) => {
return (
<PremButton
pop={{
title: '是否删除该用户?',
okText: '确认',
cancelText: '取消',
onConfirm: () => {
alert(0);
},
}}
btn={{
size: 'small',
type: 'danger',
}}
>
删除
</PremButton>
);
};
const tableprops = {
pagetitle: '左001号',
addconfig: {
access: 'sysDepartment_save',
btn: {
disabled: true,
onClick: () => {
alert(0);
},
},
},
exportconfig: {
access: 'havePrem',
btn: {
disabled: false,
onClick: () => {
alert(1);
},
},
},
pageextra: activeTabKey == '0' ? 'none' : activeTabKey == '1' ? 'add' : 'export',
tabList: [
{
tab: '全部',
key: '0',
},
{
tab: '未完成',
key: '1',
},
{
tab: '已完成',
key: '2',
},
],
activeTabKey,
onTabChange,
columns,
path: '/ngic-auth/sysUser/query/page',
resizeable: false
};
return (
<div>
<h3>配置式按钮</h3>
<AutoTable {...tableprops} />
<h3 style={{ margin: '12px 0' }}>自定义按钮</h3>
<AutoTable
pagetitle={'左玲玲'}
pageextra={
<PremButton
btn={{
key: 'add',
disabled: false,
type: 'primary',
onClick: () => {
alert(1);
},
}}
access="havePrem"
>
炸了哦
</PremButton>
}
columns={columns}
path="/ngic-auth/sysUser/query/page"
/>
</div>
);
};
This diff is collapsed.
function getcolumns(setdrawer) { function getcolumns(setdrawer) {
return [ return [
{ title: '工厂编码', dataIndex: 'factoryCode', key: 'factoryCode' }, { title: '工厂编码', dataIndex: 'factoryCode', key: 'factoryCode' },
{ title: '工厂名称', dataIndex: 'factoryName', key: 'factoryName' }, {
title: '工厂名称',
dataIndex: 'factoryName',
key: 'factoryName',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
]; ];
} }
......
...@@ -4,14 +4,23 @@ import DrawerPro from '@/components/DrawerPro'; ...@@ -4,14 +4,23 @@ import DrawerPro from '@/components/DrawerPro';
import AutoTable from '@/components/AutoTable'; import AutoTable from '@/components/AutoTable';
import PremButton from '@/components/PremButton'; import PremButton from '@/components/PremButton';
import getcolumns from './columns'; import getcolumns from './columns';
import { doFetch } from '@/utils/doFetch';
import { message } from 'antd';
function Factory(props) { function Factory(props) {
const actionRef = useRef(), const actionRef = useRef(),
formRef = useRef(); formRef = useRef();
const [drawer, setdrawer] = useState({ const [drawer, setDrawer] = useState({
visible: false, visible: false,
}); });
const urlParams = {
save: '/auth/sysFactory/saveOrUpdate',
remove: '/auth/sysFactory/delete',
list: '/auth/sysFactory/queryPage',
detail: '/auth/sysFactory/getById',
};
const detail = (text, row, _, action) => { const detail = (text, row, _, action) => {
return ( return (
<PremButton <PremButton
...@@ -19,7 +28,7 @@ function Factory(props) { ...@@ -19,7 +28,7 @@ function Factory(props) {
size: 'small', size: 'small',
type: 'link', type: 'link',
onClick: () => { onClick: () => {
setdrawer((s) => ({ setDrawer((s) => ({
...s, ...s,
visible: true, visible: true,
item: row, item: row,
...@@ -41,12 +50,31 @@ function Factory(props) { ...@@ -41,12 +50,31 @@ function Factory(props) {
btn={{ btn={{
size: 'small', size: 'small',
onClick: () => { onClick: () => {
setdrawer((s) => ({ setDrawer((s) => ({
...s, ...s,
visible: true, visible: true,
item: row, item: row,
title: '编辑', title: '编辑',
val: 'edit', val: 'edit',
onFinish: async (vals) => {
console.log(1);
let params = {
...vals,
id: row.id,
};
let res = await doFetch({
url: urlParams.save,
params,
});
if (res.code === '0000') {
message.success('新增成功!');
setDrawer((s) => ({
...s,
visible: false,
}));
actionRef.current.reload();
}
},
})); }));
}, },
}} }}
...@@ -63,8 +91,16 @@ function Factory(props) { ...@@ -63,8 +91,16 @@ function Factory(props) {
title: '是否删除该用户?', title: '是否删除该用户?',
okText: '确认', okText: '确认',
cancelText: '取消', cancelText: '取消',
onConfirm: () => { onConfirm: async () => {
alert(0); let res = await doFetch({ url: urlParams.remove, params: { id: row.id } });
if (res.code === '0000') {
message.success('删除成功!');
setDraw((s) => ({
...s,
visible: false,
}));
actionRef.current.reload();
}
}, },
}} }}
btn={{ btn={{
...@@ -78,25 +114,21 @@ function Factory(props) { ...@@ -78,25 +114,21 @@ function Factory(props) {
}; };
const columns = useMemo(() => { const columns = useMemo(() => {
let defcolumn = getcolumns(setdrawer); let defcolumn = getcolumns(setDrawer);
return defcolumn.concat({ return defcolumn.concat({
title: '操作', title: '操作',
valueType: 'option', valueType: 'option',
width: 150, width: 150,
render: (text, row, _, action) => [ render: (text, row, _, action) => [edit(text, row, _, action), remove(text, row, _, action)],
detail(text, row, _, action),
edit(text, row, _, action),
remove(text, row, _, action),
],
}); });
}, []); }, []);
return ( return (
<div style={{ position: 'relative' }}> <div style={{ position: 'relative' }}>
<AutoTable <AutoTable
pagetitle="工厂管理" pagetitle={<h3 className="page-title">工厂管理</h3>}
columns={columns} columns={columns}
path="/auth/sysFactory/queryPage" path={urlParams.list}
actionRef={actionRef} actionRef={actionRef}
pageextra={'add'} pageextra={'add'}
resizeable={false} resizeable={false}
...@@ -105,12 +137,30 @@ function Factory(props) { ...@@ -105,12 +137,30 @@ function Factory(props) {
btn: { btn: {
disabled: false, disabled: false,
onClick: () => { onClick: () => {
setdrawer((s) => ({ setDrawer((s) => ({
...s, ...s,
visible: true, visible: true,
item: null, item: null,
title: '新增', title: '新增',
val: 'add', val: 'add',
onFinish: async (vals) => {
console.log(1);
let params = {
...vals,
};
let res = await doFetch({
url: urlParams.save,
params,
});
if (res.code === '0000') {
message.success('新增成功!');
setDrawer((s) => ({
...s,
visible: false,
}));
actionRef.current.reload();
}
},
})); }));
}, },
}, },
...@@ -119,12 +169,13 @@ function Factory(props) { ...@@ -119,12 +169,13 @@ function Factory(props) {
<DrawerPro <DrawerPro
fields={columns} fields={columns}
detailpath="/ngic-auth/sysUser/query/detail" // detailpath={urlParams.detail}
params={{ id: drawer?.item?.id }} // params={{ id: drawer?.item?.id }}
defaultFormValue={drawer?.item ?? {}}
formRef={formRef} formRef={formRef}
placement="right" placement="right"
onClose={() => { onClose={() => {
setdrawer((s) => ({ setDrawer((s) => ({
...s, ...s,
visible: false, visible: false,
})); }));
......
function getcolumns(setdrawer) { function getcolumns(setdrawer) {
return [ return [
{ title: '工段代码', dataIndex: 'sectionCode', key: 'sectionCode' },
{ {
title: '基础信息', title: '工段名称',
valueType: 'split', dataIndex: 'sectionName',
key: 'sectionName',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
}, },
{ {
title: '用户名', title: '所属工厂',
dataIndex: 'accountName', dataIndex: 'factoryName',
formItemProps: { key: 'factoryId',
rules: [ formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
{ valueType: 'select',
required: false, options: { path: '/auth/sysFactory/getAllFactorySelection', params: {} },
message: '此项为必填项',
},
],
},
initialValue: '默认值',
hideInForm: false,
search: false,
render: (text, row) => {
return (
<a
onClick={() => {
setdrawer?.((s) => ({
...s,
visible: true,
item: null,
title: '新增',
val: 'add',
}));
}}
>
{text}
</a>
);
},
}, },
{ {
title: '姓名', title: '所属车间',
dataIndex: 'userName', dataIndex: 'shopName',
key: 'userId', key: 'shopName',
hideInForm: { formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
accountName: { valueType: 'select',
reverse: ['1', '2', '5'], options: { path: '/auth/sysShop/getShopSelectionByFactory', params: {} },
},
remark: ['3'],
},
search: false,
},
{
title: '额外信息',
valueType: 'split',
},
{
title: '联系电话',
dataIndex: 'telephone',
formItemProps: {
rules: [
{
required: false,
message: '此项为必填项',
},
],
},
search: false,
},
{
title: '邮箱',
dataIndex: 'mailNo',
formItemProps: {
rules: [
{
required: false,
message: '此项为必填项',
},
],
},
search: false,
},
{
title: '备注',
dataIndex: 'remark',
valueType: 'editor',
search: false,
colProps: { span: 24 },
initialValue: '<p>Hello <b>World!</b></p>',
},
{
title: '上传样式-图片',
dataIndex: 'uploadImage',
key: 'uploadImage',
valueType: 'uploadImage',
fieldProps: {
limit: 2,
},
formItemProps: {
rules: [
{
required: false,
message: '此项为必填项',
},
],
},
}, },
]; ];
} }
......
...@@ -5,13 +5,20 @@ import AutoTable from '@/components/AutoTable'; ...@@ -5,13 +5,20 @@ import AutoTable from '@/components/AutoTable';
import PremButton from '@/components/PremButton'; import PremButton from '@/components/PremButton';
import getcolumns from './columns'; import getcolumns from './columns';
function Section(props) { function Factory(props) {
const actionRef = useRef(), const actionRef = useRef(),
formRef = useRef(); formRef = useRef();
const [drawer, setdrawer] = useState({ const [drawer, setdrawer] = useState({
visible: false, visible: false,
}); });
const urlParams = {
save: '/auth/sysShop/saveOrUpdate',
remove: '/auth/sysShop/delete',
list: '/auth/sysShop/queryPage',
detail: '/auth/sysShop/getById',
};
const detail = (text, row, _, action) => { const detail = (text, row, _, action) => {
return ( return (
<PremButton <PremButton
...@@ -63,8 +70,16 @@ function Section(props) { ...@@ -63,8 +70,16 @@ function Section(props) {
title: '是否删除该用户?', title: '是否删除该用户?',
okText: '确认', okText: '确认',
cancelText: '取消', cancelText: '取消',
onConfirm: () => { onConfirm: async () => {
alert(0); let res = await doFetch({ url: urlParams.remove, params: { id: row.id } });
if (res.code === '0000') {
message.success('删除成功!');
setDraw((s) => ({
...s,
visible: false,
}));
actionRef.current.reload();
}
}, },
}} }}
btn={{ btn={{
...@@ -83,23 +98,19 @@ function Section(props) { ...@@ -83,23 +98,19 @@ function Section(props) {
title: '操作', title: '操作',
valueType: 'option', valueType: 'option',
width: 150, width: 150,
render: (text, row, _, action) => [ render: (text, row, _, action) => [edit(text, row, _, action), remove(text, row, _, action)],
detail(text, row, _, action),
edit(text, row, _, action),
remove(text, row, _, action),
],
}); });
}, []); }, []);
return ( return (
<div style={{ position: 'relative' }}> <div style={{ position: 'relative' }}>
<AutoTable <AutoTable
pagetitle=" 工段管理" pagetitle="车间管理"
columns={columns} columns={columns}
path="/ngic-auth/sysUser/query/page" path={urlParams.list}
actionRef={actionRef} actionRef={actionRef}
pageextra={'add'} pageextra={'add'}
resizeable={true} resizeable={false}
addconfig={{ addconfig={{
// access: 'sysDepartment_save', // access: 'sysDepartment_save',
btn: { btn: {
...@@ -111,6 +122,23 @@ function Section(props) { ...@@ -111,6 +122,23 @@ function Section(props) {
item: null, item: null,
title: '新增', title: '新增',
val: 'add', val: 'add',
onFinish: async (vals) => {
let params = {
...vals,
};
let res = await doFetch({
url: urlParams.save,
params,
});
if (res.code === '0000') {
message.success('新增成功!');
setDraw((s) => ({
...s,
visible: false,
}));
actionRef.current.reload();
}
},
})); }));
}, },
}, },
...@@ -119,7 +147,7 @@ function Section(props) { ...@@ -119,7 +147,7 @@ function Section(props) {
<DrawerPro <DrawerPro
fields={columns} fields={columns}
detailpath="/ngic-auth/sysUser/query/detail" detailpath={urlParams.detail}
params={{ id: drawer?.item?.id }} params={{ id: drawer?.item?.id }}
formRef={formRef} formRef={formRef}
placement="right" placement="right"
...@@ -135,4 +163,4 @@ function Section(props) { ...@@ -135,4 +163,4 @@ function Section(props) {
); );
} }
export default Section; export default Factory;
\ No newline at end of file
function getcolumns(setdrawer) { function getcolumns(setdrawer) {
return [ return [
{ {
title: '基础信息', title: '车间代码',
valueType: 'split', dataIndex: 'shopCode',
key: 'shopCode',
formItemProps: { rules: [{ required: false, message: '此项为必填项' }] },
}, },
{ {
title: '用户名', title: '车间名称',
dataIndex: 'accountName', dataIndex: 'shopName',
formItemProps: { key: 'shopName',
rules: [ formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
{
required: false,
message: '此项为必填项',
},
],
},
initialValue: '默认值',
hideInForm: false,
search: false,
render: (text, row) => {
return (
<a
onClick={() => {
setdrawer?.((s) => ({
...s,
visible: true,
item: null,
title: '新增',
val: 'add',
}));
}}
>
{text}
</a>
);
},
}, },
{ {
title: '姓名', title: '所属工厂名称',
dataIndex: 'userName', dataIndex: 'factoryName',
key: 'userId', key: 'factoryCode',
hideInForm: { valueType: 'select',
accountName: { options: { path: '/auth/sysShop/queryPage', params: {} },
reverse: ['1', '2', '5'], formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
remark: ['3'],
},
search: false,
},
{
title: '额外信息',
valueType: 'split',
},
{
title: '联系电话',
dataIndex: 'telephone',
formItemProps: {
rules: [
{
required: false,
message: '此项为必填项',
},
],
},
search: false,
},
{
title: '邮箱',
dataIndex: 'mailNo',
formItemProps: {
rules: [
{
required: false,
message: '此项为必填项',
},
],
},
search: false,
},
{
title: '备注',
dataIndex: 'remark',
valueType: 'editor',
search: false,
colProps: { span: 24 },
initialValue: '<p>Hello <b>World!</b></p>',
},
{
title: '上传样式-图片',
dataIndex: 'uploadImage',
key: 'uploadImage',
valueType: 'uploadImage',
fieldProps: {
limit: 2,
},
formItemProps: {
rules: [
{
required: false,
message: '此项为必填项',
},
],
},
}, },
]; ];
} }
......
...@@ -4,14 +4,23 @@ import DrawerPro from '@/components/DrawerPro'; ...@@ -4,14 +4,23 @@ import DrawerPro from '@/components/DrawerPro';
import AutoTable from '@/components/AutoTable'; import AutoTable from '@/components/AutoTable';
import PremButton from '@/components/PremButton'; import PremButton from '@/components/PremButton';
import getcolumns from './columns'; import getcolumns from './columns';
import { message } from 'antd';
import { doFetch } from '@/utils/doFetch';
function Workshop(props) { function Factory(props) {
const actionRef = useRef(), const actionRef = useRef(),
formRef = useRef(); formRef = useRef();
const [drawer, setdrawer] = useState({ const [drawer, setdrawer] = useState({
visible: false, visible: false,
}); });
const urlParams = {
save: '/auth/sysShop/saveOrUpdate',
remove: '/auth/sysShop/delete',
list: '/auth/sysShop/queryPage',
detail: '/auth/sysShop/getById',
};
const detail = (text, row, _, action) => { const detail = (text, row, _, action) => {
return ( return (
<PremButton <PremButton
...@@ -63,8 +72,16 @@ function Workshop(props) { ...@@ -63,8 +72,16 @@ function Workshop(props) {
title: '是否删除该用户?', title: '是否删除该用户?',
okText: '确认', okText: '确认',
cancelText: '取消', cancelText: '取消',
onConfirm: () => { onConfirm: async () => {
alert(0); let res = await doFetch({ url: urlParams.remove, params: { id: row.id } });
if (res.code === '0000') {
message.success('删除成功!');
setDraw((s) => ({
...s,
visible: false,
}));
actionRef.current.reload();
}
}, },
}} }}
btn={{ btn={{
...@@ -83,23 +100,19 @@ function Workshop(props) { ...@@ -83,23 +100,19 @@ function Workshop(props) {
title: '操作', title: '操作',
valueType: 'option', valueType: 'option',
width: 150, width: 150,
render: (text, row, _, action) => [ render: (text, row, _, action) => [edit(text, row, _, action), remove(text, row, _, action)],
detail(text, row, _, action),
edit(text, row, _, action),
remove(text, row, _, action),
],
}); });
}, []); }, []);
return ( return (
<div style={{ position: 'relative' }}> <div style={{ position: 'relative' }}>
<AutoTable <AutoTable
pagetitle="车间管理" pagetitle={<h3 className="page-title">车间管理</h3>}
columns={columns} columns={columns}
path="/ngic-auth/sysUser/query/page" path={urlParams.list}
actionRef={actionRef} actionRef={actionRef}
pageextra={'add'} pageextra={'add'}
resizeable={true} resizeable={false}
addconfig={{ addconfig={{
// access: 'sysDepartment_save', // access: 'sysDepartment_save',
btn: { btn: {
...@@ -111,6 +124,23 @@ function Workshop(props) { ...@@ -111,6 +124,23 @@ function Workshop(props) {
item: null, item: null,
title: '新增', title: '新增',
val: 'add', val: 'add',
onFinish: async (vals) => {
let params = {
...vals,
};
let res = await doFetch({
url: urlParams.save,
params,
});
if (res.code === '0000') {
message.success('新增成功!');
setDraw((s) => ({
...s,
visible: false,
}));
actionRef.current.reload();
}
},
})); }));
}, },
}, },
...@@ -119,8 +149,8 @@ function Workshop(props) { ...@@ -119,8 +149,8 @@ function Workshop(props) {
<DrawerPro <DrawerPro
fields={columns} fields={columns}
detailpath="/ngic-auth/sysUser/query/detail" // detailpath={urlParams.detail}
params={{ id: drawer?.item?.id }} // params={{ id: drawer?.item?.id }}
formRef={formRef} formRef={formRef}
placement="right" placement="right"
onClose={() => { onClose={() => {
...@@ -135,4 +165,4 @@ function Workshop(props) { ...@@ -135,4 +165,4 @@ function Workshop(props) {
); );
} }
export default Workshop; export default Factory;
\ No newline at end of file
function getcolumns(setdrawer) {
return [
{ title: '创建时间', dataIndex: 'createTime', key: 'createTime', valueType: 'dateYear' },
{
title: '修改人',
dataIndex: 'updateUserName',
key: 'updateUserId',
valueType: 'select',
mode: 'tags',
options: [
{ label: '123', value: '1' },
{ label: '123', value: '12' },
{ label: '123', value: '123' },
{ label: '123', value: '1231' },
],
formItemProps: { rules: [{ required: false, message: '此项为必填项' }] },
},
{ title: '创建人', dataIndex: 'createUserName', key: 'createUserName' },
{ title: '更新时间', dataIndex: 'updateTime', key: 'updateTime' },
{
title: '用户名',
dataIndex: 'userName',
key: 'userName',
valueType: 'uploadImage',
mode: 'tags',
},
{ title: '姓名', dataIndex: 'fullName', key: 'fullName' },
{ title: '电话', dataIndex: 'telephone', key: 'telephone' },
];
}
export default getcolumns;
import * as React from 'react';
import { useState, useMemo, useRef } from 'react';
import DrawerPro from '@/components/DrawerPro';
import AutoTable from '@/components/AutoTable';
import PremButton from '@/components/PremButton';
import getcolumns from './columns';
import tabList from './tablist';
function Zll(props) {
const actionRef = useRef(),
formRef = useRef();
const [drawer, setdrawer] = useState({
visible: false,
}),
[activeTabKey, setactiveTabKey] = useState("1");
const detail = (text, row, _, action) => {
return (
<PremButton
btn={{
size: 'small',
type: 'link',
onClick: () => {
setdrawer((s) => ({
...s,
visible: true,
item: row,
title: '详情',
val: 'detail',
title: row.userName + '的详细信息',
}));
},
}}
>
详情
</PremButton>
);
};
const edit = (text, row, _, action) => {
return (
<PremButton
btn={{
size: 'small',
onClick: () => {
setdrawer((s) => ({
...s,
visible: true,
item: row,
title: '编辑',
val: 'edit',
}));
},
}}
>
编辑
</PremButton>
);
};
const remove = (text, row, _, action) => {
return (
<PremButton
pop={{
title: '是否删除该用户?',
okText: '确认',
cancelText: '取消',
onConfirm: () => {
alert(0);
},
}}
btn={{
size: 'small',
type: 'danger',
}}
>
删除
</PremButton>
);
};
const columns = useMemo(() => {
let defcolumn = getcolumns(setdrawer, activeTabKey);
return activeTabKey == "1" ? defcolumn.concat({
title: '操作',
valueType: 'option',
width: 150,
render: (text, row, _, action) => [
detail(text, row, _, action),
edit(text, row, _, action),
remove(text, row, _, action),
],
}) :
defcolumn;
}, [activeTabKey]);
return (
<div style={{ position: 'relative' }}>
<AutoTable
pagetitle="左玲玲"
columns={columns}
path="/ngic-auth/sysUser/query/page"
actionRef={actionRef}
pageextra={activeTabKey == "1" ? 'add' : 'none'}
resizeable={true}
addconfig={{
// access: 'sysDepartment_save',
btn: {
disabled: false,
onClick: () => {
setdrawer((s) => ({
...s,
visible: true,
item: null,
title: '新增',
val: 'add',
}));
},
},
}}
tabList={tabList}
activeTabKey={activeTabKey}
onTabChange={(key) => {
setactiveTabKey(key)
}}
/>
<DrawerPro
fields={columns}
detailpath="/ngic-auth/sysUser/query/detail"
params={{ id: drawer?.item?.id }}
formRef={formRef}
placement="right"
onClose={() => {
setdrawer((s) => ({
...s,
visible: false,
}));
}}
{...drawer}
/>
</div>
);
}
export default Zll;
\ No newline at end of file
export default [
{
key: "1",
tab: '未完成'
},
{
key: "2",
tab: '已完成'
}
]
\ No newline at end of file
...@@ -32,7 +32,7 @@ const errorHandler = (error) => { ...@@ -32,7 +32,7 @@ const errorHandler = (error) => {
const errorText = codeMessage[response.status] || response.statusText; const errorText = codeMessage[response.status] || response.statusText;
const { status, url } = response; const { status, url } = response;
if (status == '401' || status == '302') { if (status == '401' || status == '302') {
window.location.href = 'http://idp.nangaoyun.com:8080/login'; // window.location.href = 'http://idp.nangaoyun.com:8080/login';
} }
} else if (!response) { } else if (!response) {
notification.error({ notification.error({
......
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