Commit 1f33056e authored by TZW's avatar TZW

1118

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