Commit 1f33056e authored by TZW's avatar TZW

1118

parent 79c1e48d
...@@ -110,7 +110,7 @@ function getcolumns(setdrawer) { ...@@ -110,7 +110,7 @@ function getcolumns(setdrawer) {
key: 'productLineName', key: 'productLineName',
align: 'center', align: 'center',
options: { options: {
path: 'auth/sysProductionLine/getAllProductLineSelectionByShop', path: '/auth/sysProductionLine/getAllProductLineSelectionByShop',
linkParams: { linkParams: {
shopId: '', shopId: '',
}, },
......
This diff is collapsed.
function getcolumns(setdrawer) { /* 用户管理
return [ * @Author: Li Hanlin
{ * @Date: 2022-11-09 14:44:44
title: '基础信息', * @Last Modified by: Li Hanlin
valueType: 'split', * @Last Modified time: 2022-11-18 15:43:51
}, */
{
title: '用户名', import * as React from 'react';
dataIndex: 'accountName', import { useState, useMemo, useRef } from 'react';
formItemProps: { import DrawerPro from '@/components/DrawerPro';
rules: [ import AutoTable from '@/components/AutoTable';
{ import PremButton from '@/components/PremButton';
required: false, import getcolumns from './columns';
message: '此项为必填项', import { doFetch } from '@/utils/doFetch';
}, import { message } from 'antd';
],
}, function User(props) {
initialValue: '默认值', const actionRef = useRef(),
hideInForm: false, formRef = useRef();
search: false, const [drawer, setDrawer] = useState({
render: (text, row) => { visible: false,
});
const urlParams = {
save: '/auth/sysFactory/saveOrUpdate',
remove: '/auth/sysFactory/delete',
list: '/auth/sysUser/queryList',
detail: '/auth/sysFactory/getById',
};
const detail = (text, row, _, action) => {
return ( return (
<a <PremButton
onClick={() => { btn={{
setdrawer?.((s) => ({ size: 'small',
type: 'link',
onClick: () => {
setDrawer((s) => ({
...s, ...s,
visible: true, visible: true,
item: null, item: row,
title: '新增', title: '详情',
val: 'add', val: 'detail',
title: row.userName + '的详细信息',
})); }));
},
}} }}
> >
{text} 详情
</a> </PremButton>
); );
};
const edit = (text, row, _, action) => {
return (
<PremButton
btn={{
size: 'small',
onClick: () => {
setDrawer((s) => ({
...s,
visible: true,
item: row,
title: '编辑',
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();
}
}, },
}));
}, },
{ }}
title: '姓名', >
dataIndex: 'userName', 编辑
key: 'userId', </PremButton>
hideInForm: { );
accountName: { };
reverse: ['1', '2', '5'],
}, const remove = (text, row, _, action) => {
remark: ['3'], return (
}, <PremButton
search: false, pop={{
}, title: '是否删除该工厂?',
{ okText: '确认',
title: '额外信息', cancelText: '取消',
valueType: 'split', onConfirm: async () => {
}, let res = await doFetch({ url: urlParams.remove, params: { id: row.id } });
{ if (res.code === '0000') {
title: '联系电话', message.success('删除成功!');
dataIndex: 'telephone', setDrawer((s) => ({
formItemProps: { ...s,
rules: [ visible: false,
{ }));
required: false, actionRef.current.reload();
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: [ btn={{
{ size: 'small',
required: false, type: 'danger',
message: '此项为必填项', }}
>
删除
</PremButton>
);
};
const columns = useMemo(() => {
let defcolumn = getcolumns(setDrawer);
return defcolumn.concat({
title: '操作',
valueType: 'option',
width: 150,
render: (text, row, _, action) => [edit(text, row, _, action), remove(text, row, _, action)],
});
}, []);
return (
<div style={{ position: 'relative' }}>
<AutoTable
pagetitle={<h3 className="page-title">角色管理</h3>}
columns={columns}
path={urlParams.list}
actionRef={actionRef}
pageextra={'add'}
resizeable={false}
addconfig={{
// access: 'sysDepartment_save',
btn: {
type: 'primary',
disabled: false,
onClick: () => {
setDrawer((s) => ({
...s,
visible: true,
item: null,
detailpath: null,
title: '新增',
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();
}
}, },
], }));
}, },
}, },
]; }}
/>
<DrawerPro
fields={columns}
// detailpath={urlParams.detail}
// params={{ id: drawer?.item?.id }}
defaultFormValue={drawer?.item ?? {}}
formRef={formRef}
placement="right"
onClose={() => {
setDrawer((s) => ({
...s,
visible: false,
}));
}}
{...drawer}
/>
</div>
);
} }
export default getcolumns; export default User;
function getcolumns(setdrawer) { function getcolumns(setdrawer) {
return [ return [
{
title: '基础信息',
valueType: 'split',
},
{ {
title: '用户名', title: '用户名',
dataIndex: 'accountName', dataIndex: 'username',
formItemProps: { key: 'username',
rules: [ formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
{
required: false,
message: '此项为必填项',
}, },
], {
title: '姓名',
dataIndex: 'fullName',
key: 'fullName',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
}, },
initialValue: '默认值', { title: '手机号', dataIndex: 'telephone', key: 'telephone' },
hideInForm: false, { title: '邮箱', dataIndex: 'mailNo', key: 'mailNo' },
search: false, {
render: (text, row) => { title: '公司名称',
return ( dataIndex: 'organizationName',
<a key: 'organizationId',
onClick={() => { valueType: 'select',
setdrawer?.((s) => ({ options: { path: '/emspro', params: {} },
...s,
visible: true,
item: null,
title: '新增',
val: 'add',
}));
}}
>
{text}
</a>
);
}, },
{
title: '公司名称',
align: 'center',
dataIndex: 'organizationName',
width: 120,
key: 'organizationId',
valueType: 'select',
options: { path: '/auth/sysDepartment/query/organization/selectbox', params: {} },
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
}, },
{ {
title: '姓名', title: '部门名称',
dataIndex: 'userName', width: 120,
key: 'userId', align: 'center',
hideInForm: { valueType: 'select',
accountName: { dataIndex: 'departmentName',
reverse: ['1', '2', '5'], key: 'departmentId',
options: {
path: '/auth/sysDepartment/query/depart/selectbox',
linkParams: {
organizationId: 'parentId',
}, },
remark: ['3'],
}, },
search: false,
}, },
{ {
title: '额外信息', title: '负责工厂',
valueType: 'split', dataIndex: 'factoryName',
key: 'factoryId',
width: 120,
align: 'center',
valueType: 'select',
options: { path: '/auth/sysFactory/getAllFactorySelection', params: {} },
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
}, },
{ {
title: '联系电话', title: '负责车间',
dataIndex: 'telephone', dataIndex: 'shopName',
formItemProps: { align: 'center',
rules: [ width: 120,
{ valueType: 'select',
required: false, options: {
message: '此项为必填项', path: '/auth/sysShop/getShopSelectionByFactory',
linkParams: {
factoryId: '',
}, },
],
}, },
search: false, key: 'shopId',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
}, },
{ {
title: '邮箱', title: '负责工段',
dataIndex: 'mailNo', width: 120,
formItemProps: { dataIndex: 'sectionName',
rules: [ align: 'center',
{ key: 'sectionId',
required: false, valueType: 'select',
message: '此项为必填项', options: {
path: '/auth/sysSection/getAllSectionSelectionByShop',
linkParams: {
shopId: '',
}, },
],
}, },
search: false,
}, },
{ {
title: '备注', title: '负责产线',
dataIndex: 'remark', width: 120,
valueType: 'editor', dataIndex: 'productionLines',
valueType: 'select',
search: false, search: false,
colProps: { span: 24 }, key: 'productLineName',
initialValue: '<p>Hello <b>World!</b></p>', align: 'center',
}, options: {
{ path: '/auth/sysProductionLine/getAllProductLineSelectionByShop',
title: '上传样式-图片', linkParams: {
dataIndex: 'uploadImage', shopId: '',
key: 'uploadImage',
valueType: 'uploadImage',
fieldProps: {
limit: 2,
},
formItemProps: {
rules: [
{
required: false,
message: '此项为必填项',
}, },
],
}, },
}, },
{ title: '角色配置', dataIndex: 'roleNames', key: 'roleNames' },
{ title: '直属领导名称', dataIndex: 'parentName', key: 'parentId' },
{ title: '状态', dataIndex: 'status', key: 'status' },
{ title: '状态名', dataIndex: 'statusName', key: 'status', search: false },
{ title: '备注', dataIndex: 'remarks', key: 'remarks' },
]; ];
} }
......
/* 用户管理
* @Author: Li Hanlin
* @Date: 2022-11-09 14:44:44
* @Last Modified by: Li Hanlin
* @Last Modified time: 2022-11-18 14:23:58
*/
import * as React from 'react'; import * as React from 'react';
import { useState, useMemo, useRef } from 'react'; import { useState, useMemo, useRef } from 'react';
import DrawerPro from '@/components/DrawerPro'; 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 Users(props) { function User(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/sysUser/queryList',
detail: '/auth/sysFactory/getById',
};
const detail = (text, row, _, action) => { const detail = (text, row, _, action) => {
return ( return (
<PremButton <PremButton
...@@ -19,7 +35,7 @@ function Users(props) { ...@@ -19,7 +35,7 @@ function Users(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 +57,31 @@ function Users(props) { ...@@ -41,12 +57,31 @@ function Users(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();
}
},
})); }));
}, },
}} }}
...@@ -60,11 +95,19 @@ function Users(props) { ...@@ -60,11 +95,19 @@ function Users(props) {
return ( return (
<PremButton <PremButton
pop={{ pop={{
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('删除成功!');
setDrawer((s) => ({
...s,
visible: false,
}));
actionRef.current.reload();
}
}, },
}} }}
btn={{ btn={{
...@@ -78,41 +121,55 @@ function Users(props) { ...@@ -78,41 +121,55 @@ function Users(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="/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: {
type: 'primary', type: 'primary',
disabled: false, disabled: false,
onClick: () => { onClick: () => {
setdrawer((s) => ({ setDrawer((s) => ({
...s, ...s,
visible: true, visible: true,
item: null, item: null,
detailpath: null, detailpath: 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();
}
},
})); }));
}, },
}, },
...@@ -121,12 +178,13 @@ function Users(props) { ...@@ -121,12 +178,13 @@ function Users(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,
})); }));
...@@ -137,4 +195,4 @@ function Users(props) { ...@@ -137,4 +195,4 @@ function Users(props) {
); );
} }
export default Users; export default User;
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