Commit e5762547 authored by TZW's avatar TZW

1124

parent 52a98657
{ {
"editor.formatOnSave": true, "editor.formatOnSave": true,
"prettier.requireConfig": true, "prettier.requireConfig": true,
"editor.defaultFormatter": "esbenp.prettier-vscode" "editor.defaultFormatter": "esbenp.prettier-vscode",
"cSpell.words": ["onselecte", "setdrawer"]
} }
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: Li Hanlin * @Author: Li Hanlin
* @Date: 2022-11-10 09:39:56 * @Date: 2022-11-10 09:39:56
* @Last Modified by: Li Hanlin * @Last Modified by: Li Hanlin
* @Last Modified time: 2022-11-22 15:20:40 * @Last Modified time: 2022-11-23 16:29:59
*/ */
import * as React from 'react'; import * as React from 'react';
...@@ -25,6 +25,7 @@ function Model(props) { ...@@ -25,6 +25,7 @@ function Model(props) {
[drawer, setDrawer] = useState({ [drawer, setDrawer] = useState({
visible: false, visible: false,
}), }),
[extraparams, setextraparams] = useState({}),
[currDrawer, setCurrDrawer] = useState({ [currDrawer, setCurrDrawer] = useState({
visible: false, visible: false,
}), }),
...@@ -487,7 +488,7 @@ function Model(props) { ...@@ -487,7 +488,7 @@ function Model(props) {
params, params,
}); });
if (res.code === '0000') { if (res.code === '0000') {
message.success('新增成功!'); message.success('编辑成功!');
setDrawer((s) => ({ setDrawer((s) => ({
...s, ...s,
visible: false, visible: false,
...@@ -2014,21 +2015,11 @@ function Model(props) { ...@@ -2014,21 +2015,11 @@ function Model(props) {
}, []); }, []);
const onselecteTree = async (selectedKeys, e, alldata) => { const onselecteTree = async (selectedKeys, e, alldata) => {
console.log(e.node);
let params = { let params = {
treeNodeType: e.node.type, treeNodeType: e.node.type,
treeNodeKey: e.node.key, treeNodeKey: e.node.key,
pageSize: 15,
pageIndex: 1,
}; };
const res = await doFetch({ url: urlParams.list, params }); setextraparams(params);
if (res.code === '0000') {
message.success('查询成功!');
setDrawer((s) => ({
...s,
visible: false,
}));
}
}; };
const selectMoreDrawerType = (type) => { const selectMoreDrawerType = (type) => {
...@@ -2100,6 +2091,7 @@ function Model(props) { ...@@ -2100,6 +2091,7 @@ function Model(props) {
}, },
}} }}
x={1500} x={1500}
extraparams={extraparams}
/> />
</Content> </Content>
</Layout> </Layout>
......
...@@ -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-11-14 10:39:38 * @Last Modified time: 2022-11-23 15:43:57
*/ */
import * as React from 'react'; import * as React from 'react';
...@@ -208,6 +208,7 @@ function Supplier(props) { ...@@ -208,6 +208,7 @@ function Supplier(props) {
...s, ...s,
visible: false, visible: false,
})); }));
actionRef.current.reload();
}} }}
{...drawer} {...drawer}
/> />
......
function getcolumns(setdrawer) { function getcolumns(setdrawer) {
return [ return [
{ {
title: '基础信息', title: '组织名称',
valueType: 'split', dataIndex: 'title',
}, key: 'departmentName',
{
title: '用户名',
dataIndex: 'accountName',
formItemProps: { formItemProps: {
rules: [ rules: [
{ {
...@@ -16,45 +13,22 @@ function getcolumns(setdrawer) { ...@@ -16,45 +13,22 @@ function getcolumns(setdrawer) {
], ],
}, },
initialValue: '默认值', initialValue: '默认值',
hideInForm: false,
search: 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: 'departmentTypeName',
key: 'userId', key: 'departmentTypeName',
hideInForm: { valueType: 'input',
accountName: {
reverse: ['1', '2', '5'],
},
remark: ['3'],
},
search: false, search: false,
fieldProps: {
disabled: true,
},
}, },
{ {
title: '额外信息', title: '组织代码',
valueType: 'split', dataIndex: 'departmentCode',
}, key: 'departmentCode',
{
title: '联系电话',
dataIndex: 'telephone',
formItemProps: { formItemProps: {
rules: [ rules: [
{ {
...@@ -66,8 +40,9 @@ function getcolumns(setdrawer) { ...@@ -66,8 +40,9 @@ function getcolumns(setdrawer) {
search: false, search: false,
}, },
{ {
title: '邮箱', title: '上级组织',
dataIndex: 'mailNo', dataIndex: 'parentKey',
key: 'parentKey',
formItemProps: { formItemProps: {
rules: [ rules: [
{ {
...@@ -76,32 +51,11 @@ function getcolumns(setdrawer) { ...@@ -76,32 +51,11 @@ function getcolumns(setdrawer) {
}, },
], ],
}, },
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: { fieldProps: {
limit: 2, placeholder: '请输入',
}, disabled: true,
formItemProps: {
rules: [
{
required: false,
message: '此项为必填项',
},
],
}, },
search: false,
}, },
]; ];
} }
......
/* 组织管理
* @Author: Li Hanlin
* @Date: 2022-11-24 11:16:02
* @Last Modified by: Li Hanlin
* @Last Modified time: 2022-11-24 14:44:11
*/
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 Organization(props) { function Type(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/sysDepartment/save',
remove: '/auth/sysDepartment/deleteById',
list: '/auth/sysDepartment/query/tree',
detail: '/asset/equipmentType/queryById',
};
const detail = (text, row, _, action) => { const detail = (text, row, _, action) => {
return ( return (
<PremButton <PremButton
...@@ -19,7 +34,7 @@ function Organization(props) { ...@@ -19,7 +34,7 @@ function Organization(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 +56,40 @@ function Organization(props) { ...@@ -41,12 +56,40 @@ function Organization(props) {
btn={{ btn={{
size: 'small', size: 'small',
onClick: () => { onClick: () => {
setdrawer((s) => ({ setDrawer((s) => ({
...s, ...s,
visible: true, visible: true,
item: row, // detailpath: urlParams.detail,
// params: { id: row.key },
item: {
...row,
departmentName: row.title,
},
title: '编辑', title: '编辑',
val: 'edit', val: 'edit',
onFinish: async (vals) => {
console.log(vals);
let params = {
...vals,
id: row.key,
parentId: row.parentKey,
departmentType: row.departmentType,
};
console.log(params);
delete params.title;
let res = await doFetch({
url: urlParams.save,
params,
});
if (res.code === '0000') {
message.success('编辑成功!');
setDrawer((s) => ({
...s,
visible: false,
}));
actionRef.current.reload();
}
},
})); }));
}, },
}} }}
...@@ -56,15 +99,71 @@ function Organization(props) { ...@@ -56,15 +99,71 @@ function Organization(props) {
); );
}; };
const addChild = (text, row, _, action) => {
return (
<PremButton
btn={{
size: 'small',
onClick: () => {
setDrawer((s) => ({
...s,
visible: true,
detailpath: null,
item: {
parentKey: row.title,
departmentTypeName: '部门类型',
},
title: '新增子级',
val: 'addChild',
onFinish: async (vals) => {
let params = {
...vals,
parentId: row.key,
equipmentTypeName: vals.title,
departmentType: '1',
};
delete params.title;
delete params.parentKey;
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) => { const remove = (text, row, _, action) => {
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.key } });
if (res.code === '0000') {
message.success('删除成功!');
setDrawer((s) => ({
...s,
visible: false,
}));
actionRef.current.reload();
}
}, },
}} }}
btn={{ btn={{
...@@ -78,55 +177,80 @@ function Organization(props) { ...@@ -78,55 +177,80 @@ function Organization(props) {
}; };
const columns = useMemo(() => { const columns = useMemo(() => {
let defcolumn = getcolumns(setdrawer); let defcolumn = getcolumns(setDrawer);
if (drawer?.val == 'add' || drawer?.val == 'edit') {
defcolumn[3].hideInForm = true;
} else {
defcolumn[3].hideInForm = false;
}
return defcolumn.concat({ return defcolumn.concat({
title: '操作', title: '操作',
valueType: 'option', valueType: 'option',
width: 150, width: 150,
render: (text, row, _, action) => [ render: (text, row, _, action) => [
detail(text, row, _, action), addChild(text, row, _, action),
edit(text, row, _, action), edit(text, row, _, action),
remove(text, row, _, action), remove(text, row, _, action),
], ],
}); });
}, []); }, [drawer.val]);
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',
disabled: false, disabled: false,
type: 'primary',
onClick: () => { onClick: () => {
setdrawer((s) => ({ setDrawer((s) => ({
...s, ...s,
visible: true, visible: true,
item: null, item: {
detailpath: null, departmentTypeName: '公司类型',
},
title: '新增', title: '新增',
detailpath: null,
val: 'add', val: 'add',
onFinish: async (vals) => {
let params = {
...vals,
departmentType: 0,
};
let res = await doFetch({
url: urlParams.save,
params,
});
if (res.code === '0000') {
message.success('新增成功!');
setDrawer((s) => ({
...s,
visible: false,
}));
actionRef.current.reload();
}
},
})); }));
}, },
}, },
}} }}
pagination={false}
/> />
<DrawerPro <DrawerPro
fields={columns} fields={columns}
detailpath="/ngic-auth/sysUser/query/detail" defaultFormValue={drawer?.item ?? {}}
params={{ id: drawer?.item?.id }}
formRef={formRef} formRef={formRef}
placement="right" placement="right"
onClose={() => { onClose={() => {
setdrawer((s) => ({ setDrawer((s) => ({
...s, ...s,
visible: false, visible: false,
})); }));
...@@ -137,4 +261,4 @@ function Organization(props) { ...@@ -137,4 +261,4 @@ function Organization(props) {
); );
} }
export default Organization; export default Type;
...@@ -3,11 +3,10 @@ function getcolumns(setdrawer) { ...@@ -3,11 +3,10 @@ function getcolumns(setdrawer) {
{ {
title: '角色名称', title: '角色名称',
dataIndex: 'roleName', dataIndex: 'roleName',
width: 120,
key: 'roleName', key: 'roleName',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] }, formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
}, },
{ title: '备注', hideInTable: true, dataIndex: 'remark', key: 'remarks' }, { title: '备注', dataIndex: 'remark', key: 'remark', search: false },
]; ];
} }
......
...@@ -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-11-22 17:21:24 * @Last Modified time: 2022-11-24 15:39:28
*/ */
import * as React from 'react'; import * as React from 'react';
...@@ -16,7 +16,7 @@ import { message } from 'antd'; ...@@ -16,7 +16,7 @@ import { message } from 'antd';
import { Drawer } from 'antd'; import { Drawer } from 'antd';
import PermissionTree from '@/components/PermissionTree/Permissiontree'; import PermissionTree from '@/components/PermissionTree/Permissiontree';
function User(props) { function Role(props) {
const actionRef = useRef(), const actionRef = useRef(),
formRef = useRef(); formRef = useRef();
const [drawer, setDrawer] = useState({ const [drawer, setDrawer] = useState({
...@@ -25,31 +25,33 @@ function User(props) { ...@@ -25,31 +25,33 @@ function User(props) {
}); });
const urlParams = { const urlParams = {
save: '/auth/sysFactory/saveOrUpdate', save: '/auth/sysRole/save',
remove: '/auth/sysFactory/delete', remove: '/auth/sysRole/deleteById',
list: '/auth/sysUser/queryList', list: '/auth/sysRole/queryList',
detail: '/auth/sysFactory/getById', detail: '/auth/sysFactory/getById',
person: '/auth/sysUser/queryPageByRoleId',
}; };
const detail = (text, row, _, action) => { const detailPerson = (text, row, _, action) => {
return ( return (
<PremButton <PremButton
btn={{ btn={{
size: 'small', size: 'small',
type: 'link', // type: 'link',
onClick: () => { onClick: () => {
setDrawer((s) => ({ setDrawer((s) => ({
...s, ...s,
visible: true, visible: true,
item: row, item: row,
title: '详情', title: '详情',
val: 'detail', val: 'only',
title: row.userName + '的详细信息', type: 'person',
title: row.roleName + ' - 人员列表',
})); }));
}, },
}} }}
> >
详情 查看人员
</PremButton> </PremButton>
); );
}; };
...@@ -67,7 +69,6 @@ function User(props) { ...@@ -67,7 +69,6 @@ function User(props) {
title: '编辑', title: '编辑',
val: 'edit', val: 'edit',
onFinish: async (vals) => { onFinish: async (vals) => {
console.log(1);
let params = { let params = {
...vals, ...vals,
id: row.id, id: row.id,
...@@ -77,7 +78,7 @@ function User(props) { ...@@ -77,7 +78,7 @@ function User(props) {
params, params,
}); });
if (res.code === '0000') { if (res.code === '0000') {
message.success('新增成功!'); message.success('编辑成功!');
setDrawer((s) => ({ setDrawer((s) => ({
...s, ...s,
visible: false, visible: false,
...@@ -165,6 +166,66 @@ function User(props) { ...@@ -165,6 +166,66 @@ function User(props) {
); );
}; };
const PersonTable = () => {
return (
<>
<AutoTable
pagetitle={false}
columns={[
{
title: '用户名',
dataIndex: 'username',
key: 'username',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '姓名',
dataIndex: 'fullName',
key: 'fullName',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '公司名称',
dataIndex: 'organizationName',
key: 'organizationId',
valueType: 'select',
options: { path: '/auth/sysDepartment/query/organization/selectbox', params: {} },
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '部门名称',
dataIndex: 'departmentName',
valueType: 'select',
key: 'departmentId',
options: {
path: '/auth/sysDepartment/query/depart/selectbox',
linkParams: {
organizationId: 'parentId',
},
},
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '工厂名称',
dataIndex: 'factoryNames',
key: 'factoryNames',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '负责车间',
dataIndex: 'shopNames',
key: 'shopNames',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
]}
path={urlParams.person}
params={{ roleId: drawer?.item?.id }}
actionRef={actionRef}
resizeable={false}
/>
</>
);
};
// 数据分权 // 数据分权
const distribution = (text, row, _, action) => {}; const distribution = (text, row, _, action) => {};
...@@ -174,14 +235,18 @@ function User(props) { ...@@ -174,14 +235,18 @@ function User(props) {
title: '操作', title: '操作',
valueType: 'option', valueType: 'option',
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),
detailPerson(text, row, _, action),
],
}); });
}, []); }, []);
return ( return (
<div style={{ position: 'relative' }}> <div style={{ position: 'relative' }}>
<AutoTable <AutoTable
pagetitle={<h3 className="page-title">用户管理</h3>} pagetitle={<h3 className="page-title">角色管理</h3>}
columns={columns} columns={columns}
path={urlParams.list} path={urlParams.list}
actionRef={actionRef} actionRef={actionRef}
...@@ -238,7 +303,9 @@ function User(props) { ...@@ -238,7 +303,9 @@ function User(props) {
})); }));
}} }}
{...drawer} {...drawer}
/> >
{drawer.type == 'person' ? <PersonTable /> : null}
</DrawerPro>
<Drawer <Drawer
title="角色权限" title="角色权限"
...@@ -267,4 +334,4 @@ function User(props) { ...@@ -267,4 +334,4 @@ function User(props) {
); );
} }
export default User; export default Role;
import { doFetch } from '@/utils/doFetch';
import { Image } from 'antd';
function getcolumns(setdrawer) { function getcolumns(setdrawer) {
return [ return [
{ {
...@@ -13,6 +15,26 @@ function getcolumns(setdrawer) { ...@@ -13,6 +15,26 @@ function getcolumns(setdrawer) {
width: 100, width: 100,
key: 'fullName', key: 'fullName',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] }, formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
render: (text, row) => {
return (
<a
onClick={() => {
setdrawer((s) => ({
...s,
visible: true,
item: row,
title: '详情',
detailpath: '/auth/sysUser/detail',
params: { id: row.id },
val: 'detail',
title: row.fullName + '的详细信息',
}));
}}
>
{row.fullName}
</a>
);
},
}, },
{ title: '手机号', hideInTable: true, dataIndex: 'telephone', key: 'telephone' }, { title: '手机号', hideInTable: true, dataIndex: 'telephone', key: 'telephone' },
{ title: '邮箱', dataIndex: 'mailNo', key: 'mailNo', hideInTable: true, search: false }, { title: '邮箱', dataIndex: 'mailNo', key: 'mailNo', hideInTable: true, search: false },
...@@ -24,7 +46,6 @@ function getcolumns(setdrawer) { ...@@ -24,7 +46,6 @@ function getcolumns(setdrawer) {
key: 'organizationId', key: 'organizationId',
valueType: 'select', valueType: 'select',
options: { path: '/auth/sysDepartment/query/organization/selectbox', params: {} }, options: { path: '/auth/sysDepartment/query/organization/selectbox', params: {} },
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
}, },
{ {
title: '部门名称', title: '部门名称',
...@@ -40,26 +61,62 @@ function getcolumns(setdrawer) { ...@@ -40,26 +61,62 @@ function getcolumns(setdrawer) {
}, },
}, },
}, },
{
title: '负责工厂',
dataIndex: 'factoryNames',
align: 'center',
key: 'factoryNames',
hideInTable: true,
hideInForm: true,
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '负责车间',
dataIndex: 'shopNames',
key: 'shopNames',
align: 'center',
hideInTable: true,
hideInForm: true,
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '角色名称',
dataIndex: 'roleNames',
key: 'roleNames',
hideInForm: true,
hideInTable: true,
},
{ {
title: '负责工厂', title: '负责工厂',
dataIndex: 'factoryNames', dataIndex: 'factoryNames',
key: 'factoryNames', key: 'factoryNames',
search: false,
fieldProps: {
placeholder: '请选择',
showSearch: true,
mode: 'multiple',
},
width: 120, width: 120,
align: 'center', align: 'center',
valueType: 'select', valueType: 'select',
options: { path: '/auth/sysFactory/getAllFactorySelection', params: {} }, options: { path: '/auth/sysFactory/getAllFactorySelection', params: {} },
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
}, },
{ {
title: '负责车间', title: '负责车间',
dataIndex: 'shopNames', dataIndex: 'shopNames',
search: false,
align: 'center', align: 'center',
fieldProps: {
placeholder: '请选择',
showSearch: true,
mode: 'multiple',
},
width: 120, width: 120,
valueType: 'select', valueType: 'select',
options: { options: {
path: '/auth/sysShop/getShopSelectionByFactory', path: '/auth/sysShop/getShopSelectionByFactoryIdList',
linkParams: { linkParams: {
factoryId: '', factoryNames: 'factoryIdList',
}, },
}, },
key: 'shopId', key: 'shopId',
...@@ -70,36 +127,130 @@ function getcolumns(setdrawer) { ...@@ -70,36 +127,130 @@ function getcolumns(setdrawer) {
width: 120, width: 120,
dataIndex: 'sectionName', dataIndex: 'sectionName',
align: 'center', align: 'center',
search: false,
key: 'sectionId', key: 'sectionId',
fieldProps: {
placeholder: '请选择',
showSearch: true,
mode: 'multiple',
},
valueType: 'select', valueType: 'select',
options: { options: {
path: '/auth/sysSection/getAllSectionSelectionByShop', path: '/auth/sysSection/getAllSectionSelectionByShopIdList',
linkParams: { linkParams: {
shopId: '', shopId: 'shopIdList',
}, },
}, },
}, },
{ {
title: '负责产线', title: '负责产线',
search: false,
width: 120, width: 120,
dataIndex: 'productionLines', dataIndex: 'productionLines',
valueType: 'select', valueType: 'select',
fieldProps: {
placeholder: '请选择',
showSearch: true,
mode: 'multiple',
},
search: false, search: false,
key: 'productLineName', key: 'productLineName',
align: 'center', align: 'center',
options: { options: {
path: '/auth/sysProductionLine/getAllProductLineSelectionByShop', path: '/auth/sysProductionLine/getAllProductLineSelectionByShopIdList',
linkParams: { linkParams: {
shopId: '', shopId: 'shopIdList',
}, },
}, },
}, },
{ title: '角色配置', dataIndex: 'roleNames', key: 'roleNames' }, {
{ title: '直属领导', dataIndex: 'parentName', key: 'parentId' }, title: '角色配置',
{ title: '状态', hideInTable: true, dataIndex: 'status', key: 'status' }, dataIndex: 'roleNames',
{ title: '状态', dataIndex: 'statusName', key: 'status', search: false }, key: 'roleNames',
{ title: '备注', hideInTable: true, dataIndex: 'remarks', key: 'remarks' }, valueType: 'select',
{ title: '个人图片', hideInTable: true, dataIndex: 'userImgList', key: 'userImgList' }, search: false,
fieldProps: {
placeholder: '请选择',
showSearch: true,
mode: 'multiple',
},
options: {
path: '/auth/sysRole/selection',
},
},
{
title: '直属领导',
valueType: 'select',
dataIndex: 'parentName',
key: 'parentId',
options: {
path: '/auth/sysUser/selection',
},
fieldProps: {
placeholder: '请选择',
showSearch: true,
},
},
{
title: '状态',
hideInTable: true,
dataIndex: 'statusName',
key: 'status',
valueType: 'radio',
options: [
{
label: '启用',
value: 1,
},
{
label: '禁用',
value: 0,
},
],
},
// {
// title: '状态',
// width: 50,
// hideInForm: true,
// dataIndex: 'statusName',
// key: 'status',
// search: false,
// },
{
title: '备注',
hideInTable: true,
dataIndex: 'remarks',
valueType: 'textarea',
key: 'remarks',
search: false,
},
// { title: '个人图片', hideInTable: true, dataIndex: 'userImgList', key: 'userImgList' },
{
title: '个人图片',
search: false,
dataIndex: 'userImgList',
key: 'userImgList',
valueType: 'uploadImage',
hideInTable: true,
fieldProps: {
limit: 2,
},
formItemProps: {
rules: [
{
required: true,
message: '此项为必填项',
},
],
},
render: (text, row) => {
if (row?.pictureUrl == null) {
return '暂无图片';
} else {
return <Image width={70} src={row.pictureUrl} />;
}
},
},
]; ];
} }
......
...@@ -2,17 +2,18 @@ ...@@ -2,17 +2,18 @@
* @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-11-22 15:50:02 * @Last Modified time: 2022-11-24 15:02:31
*/ */
import * as React from 'react'; import * as React from 'react';
import { useState, useMemo, useRef } from 'react'; import { useState, useMemo, useRef, useCallback } 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 InitForm from '@/components/InitForm';
import getcolumns from './columns'; import getcolumns from './columns';
import { doFetch } from '@/utils/doFetch'; import { doFetch } from '@/utils/doFetch';
import { message } from 'antd'; import { message, AutoComplete } from 'antd';
function User(props) { function User(props) {
const actionRef = useRef(), const actionRef = useRef(),
...@@ -22,10 +23,10 @@ function User(props) { ...@@ -22,10 +23,10 @@ function User(props) {
}); });
const urlParams = { const urlParams = {
save: '/auth/sysFactory/saveOrUpdate', save: '/auth/sysUser/save',
remove: '/auth/sysFactory/delete', remove: '/auth/sysUser/deleteById',
list: '/auth/sysUser/queryList', list: '/auth/sysUser/queryList',
detail: '/auth/sysFactory/getById', detail: '/auth/sysUser/detail',
}; };
const detail = (text, row, _, action) => { const detail = (text, row, _, action) => {
...@@ -60,7 +61,9 @@ function User(props) { ...@@ -60,7 +61,9 @@ function User(props) {
setDrawer((s) => ({ setDrawer((s) => ({
...s, ...s,
visible: true, visible: true,
item: row, // item: row,
detailpath: urlParams.detail,
params: { id: row.id },
title: '编辑', title: '编辑',
val: 'edit', val: 'edit',
onFinish: async (vals) => { onFinish: async (vals) => {
...@@ -74,7 +77,7 @@ function User(props) { ...@@ -74,7 +77,7 @@ function User(props) {
params, params,
}); });
if (res.code === '0000') { if (res.code === '0000') {
message.success('新增成功!'); message.success('编辑成功!');
setDrawer((s) => ({ setDrawer((s) => ({
...s, ...s,
visible: false, visible: false,
...@@ -95,7 +98,7 @@ function User(props) { ...@@ -95,7 +98,7 @@ function User(props) {
return ( return (
<PremButton <PremButton
pop={{ pop={{
title: '是否删除该工厂?', title: '是否删除该用户?',
okText: '确认', okText: '确认',
cancelText: '取消', cancelText: '取消',
onConfirm: async () => { onConfirm: async () => {
...@@ -120,6 +123,56 @@ function User(props) { ...@@ -120,6 +123,56 @@ function User(props) {
); );
}; };
// const Adduser = () => {
// const [value, setValue] = useState('');
// const [options, setOptions] = useState([]);
// const debounce = lodash.debounce;
// const serchHandle = useCallback(
// debounce(async (val) => {
// console.log(val + '!!');
// if (val) {
// let res = await doFetch({
// url: '/auth/sysUser/queryLikeIotUsername',
// params: { username: val },
// });
// console.log(res);
// }
// }, 800),
// [],
// );
// const onSearch = (val) => {
// serchHandle(val);
// };
// const onSelect = (data) => {
// console.log('onSelect', data);
// };
// const onChange = (data) => {
// setValue(data);
// };
// return (
// <>
// <div style={{ marginBottom: 22 }}>
// <div style={{ marginBottom: 8 }}>用户名</div>
// <AutoComplete
// options={options}
// style={{
// width: '50%',
// }}
// onSelect={onSelect}
// onSearch={onSearch}
// placeholder="请输入用户名"
// />
// </div>
// <InitForm
// fields={columns}
// onFinish={() => {
// console.log(1);
// }}
// />
// </>
// );
// };
const columns = useMemo(() => { const columns = useMemo(() => {
let defcolumn = getcolumns(setDrawer); let defcolumn = getcolumns(setDrawer);
return defcolumn.concat({ return defcolumn.concat({
...@@ -148,15 +201,30 @@ function User(props) { ...@@ -148,15 +201,30 @@ function User(props) {
setDrawer((s) => ({ setDrawer((s) => ({
...s, ...s,
visible: true, visible: true,
item: null, item: {
status: 1,
},
detailpath: null, detailpath: null,
title: '新增', title: '新增',
// type: 'add',
val: 'add', val: 'add',
onFinish: async (vals) => { onFinish: async (vals) => {
console.log(1); console.log(vals);
let params = { let params = {
...vals, ...vals,
factoryIdList: vals.factoryNames,
shopIdList: vals.shopId,
sectionIdList: vals.sectionId,
productionLineIdList: vals.productLineName,
roleIdList: vals.roleNames,
userCharReqList: [],
}; };
delete params.factoryNames;
delete params.shopId;
delete params.sectionId;
delete params.productLineName;
delete params.roleNames;
console.log(params, '!!!!');
let res = await doFetch({ let res = await doFetch({
url: urlParams.save, url: urlParams.save,
params, params,
...@@ -190,7 +258,9 @@ function User(props) { ...@@ -190,7 +258,9 @@ function User(props) {
})); }));
}} }}
{...drawer} {...drawer}
/> >
{/* {drawer?.type == 'add' ? <Adduser /> : null} */}
</DrawerPro>
</div> </div>
); );
} }
......
...@@ -9391,7 +9391,7 @@ lodash.zip@^4.2.0: ...@@ -9391,7 +9391,7 @@ lodash.zip@^4.2.0:
resolved "https://registry.npmmirror.com/lodash.zip/-/lodash.zip-4.2.0.tgz#ec6662e4896408ed4ab6c542a3990b72cc080020" resolved "https://registry.npmmirror.com/lodash.zip/-/lodash.zip-4.2.0.tgz#ec6662e4896408ed4ab6c542a3990b72cc080020"
integrity sha512-C7IOaBBK/0gMORRBd8OETNx3kmOkgIWIPvyDpZSCTwUrpYmgZwJkjZeOD8ww4xbOUOs4/attY+pciKvadNfFbg== integrity sha512-C7IOaBBK/0gMORRBd8OETNx3kmOkgIWIPvyDpZSCTwUrpYmgZwJkjZeOD8ww4xbOUOs4/attY+pciKvadNfFbg==
lodash@^4.0.1, lodash@^4.17.0, lodash@^4.17.11, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.20, lodash@^4.17.21, lodash@^4.17.4: lodash@^4.0.1, lodash@^4.17.11, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.20, lodash@^4.17.21, lodash@^4.17.4:
version "4.17.21" version "4.17.21"
resolved "https://registry.npmmirror.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" resolved "https://registry.npmmirror.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
......
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