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: '',
}, },
......
...@@ -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-17 17:25:54 * @Last Modified time: 2022-11-18 17:29:28
*/ */
import * as React from 'react'; import * as React from 'react';
...@@ -12,9 +12,10 @@ import AutoTable from '@/components/AutoTable'; ...@@ -12,9 +12,10 @@ 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 { doFetch } from '@/utils/doFetch';
import { message, Dropdown, Menu, Layout, Button, Space } from 'antd'; import { message, Dropdown, Menu, Layout, Button, Space, Divider, Tabs } from 'antd';
import TreeRender from '@/components/TreeRender'; import TreeRender from '@/components/TreeRender';
import { ProDescriptions } from '@ant-design/pro-components'; import { ProDescriptions } from '@ant-design/pro-components';
import InitForm from '@/components/InitForm';
const { Sider, Content } = Layout; const { Sider, Content } = Layout;
function Model(props) { function Model(props) {
...@@ -145,28 +146,27 @@ function Model(props) { ...@@ -145,28 +146,27 @@ function Model(props) {
item: { item: {
id: row.id, id: row.id,
}, },
title: '详情',
val: 'only', val: 'only',
title: '编辑子设备', title: '编辑子设备',
onFinish: async (vals) => { // onFinish: async (vals) => {
console.log(1); // console.log(1);
let params = { // let params = {
...vals, // ...vals,
id: row.id, // id: row.id,
}; // };
let res = await doFetch({ // let res = await doFetch({
url: urlParams.save, // url: urlParams.save,
params, // params,
}); // });
if (res.code === '0000') { // if (res.code === '0000') {
message.success('新增成功!'); // message.success('新增成功!');
setDrawer((s) => ({ // setDrawer((s) => ({
...s, // ...s,
visible: false, // visible: false,
})); // }));
actionRef.current.reload(); // actionRef.current.reload();
} // }
}, // },
})); }));
}} }}
> >
...@@ -176,7 +176,43 @@ function Model(props) { ...@@ -176,7 +176,43 @@ function Model(props) {
key: '0', key: '0',
}, },
{ {
label: <a>履历登记</a>, label: (
<a
onClick={() => {
setDrawer((s) => ({
...s,
visible: true,
type: 'resume',
item: {
id: row.id,
},
val: 'only',
title: '履历登记',
// 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();
// }
// },
}));
}}
>
履历登记
</a>
),
key: '1', key: '1',
}, },
{ {
...@@ -202,6 +238,7 @@ function Model(props) { ...@@ -202,6 +238,7 @@ function Model(props) {
); );
}; };
// 子设备
const EditChildEquipment = () => { const EditChildEquipment = () => {
const [selectArr, setSelectArr] = useState([]); const [selectArr, setSelectArr] = useState([]);
useEffect(() => { useEffect(() => {
...@@ -407,12 +444,15 @@ function Model(props) { ...@@ -407,12 +444,15 @@ function Model(props) {
<Space style={{ marginTop: 16 }}> <Space style={{ marginTop: 16 }}>
<Button <Button
onClick={() => { onClick={() => {
console.log(drawer);
setDrawer((s) => ({ setDrawer((s) => ({
...s, ...s,
visible: false, visible: false,
item: null, item: null,
detailpath: null, detailpath: null,
params: null, params: null,
val: null,
onFinish: null,
})); }));
setSelectArr([]); setSelectArr([]);
}} }}
...@@ -449,6 +489,180 @@ function Model(props) { ...@@ -449,6 +489,180 @@ function Model(props) {
); );
}; };
// 履历登记
const Resume = () => {
const [selectArr, setSelectArr] = useState([]);
const [activeTab, setactiveTab] = useState(1);
useEffect(() => {
const fun = async () => {
const result = await doFetch({
url: '/asset/equipment/children/selected/queryList',
params: { id: drawer?.item?.id },
});
// console.log(result);
if (!result?.data?.dataList.length == 0) {
setSelectArr(result?.data?.dataList.map((it) => it.id));
}
};
fun();
}, []);
const fields = {
1: [
{
title: '设备',
dataIndex: 'equipmentId',
key: 'equipment',
},
],
2: [
{
title: '设备1',
dataIndex: 'equipmentId',
key: 'equipment',
},
],
};
return (
<>
<ProDescriptions
request={async () => {
const { data } = await doFetch({
url: urlParams.detail,
params: { id: drawer?.item?.id },
});
return {
success: true,
data: data?.data,
};
}}
columns={[
{
title: '设备编号',
dataIndex: 'equipmentNo',
key: 'equipmentNo',
},
{
title: '设备名称',
dataIndex: 'equipmentName',
key: 'equipmentName',
},
{
title: '位置号',
dataIndex: 'positionNo',
key: 'positionNo',
},
{
title: '公司名称',
dataIndex: 'organizationName',
key: 'organizationId',
},
{
title: '部门名称',
dataIndex: 'departmentName',
key: 'departmentId',
},
{
title: '工厂名称',
dataIndex: 'factoryName',
key: 'factoryId',
},
{
title: '车间名称',
dataIndex: 'shopName',
key: 'shopId',
},
{
title: '工段名称',
dataIndex: 'sectionName',
key: 'sectionId',
},
{
title: '产线名称',
dataIndex: 'productLineName',
key: 'productLineName',
},
{
title: '供应商',
dataIndex: 'supplierName',
key: 'supplierId',
},
{
title: '安装投产日期',
dataIndex: 'productDate',
key: 'productDate',
},
]}
/>
<Divider />
<Tabs
activeKey={activeTab}
onChange={setactiveTab}
items={[
{
label: '改造',
key: 1,
children: <InitForm fields={fields[activeTab]} />,
}, // remember to pass the key prop
{
label: 'Tab 2',
key: 2,
children: <InitForm fields={fields[activeTab]} />,
},
]}
/>
{/* <Space style={{ marginTop: 16 }}>
<Button
onClick={() => {
console.log(drawer);
setDrawer((s) => ({
...s,
visible: false,
item: null,
detailpath: null,
params: null,
val: null,
onFinish: null,
}));
setSelectArr([]);
}}
>
取消
</Button>
<Button
type="primary"
onClick={async () => {
console.log(selectArr);
let res = await doFetch({
url: urlParams_childEquipment.save,
params: {
equipmentId: drawer?.item?.id,
childrenIdList: selectArr,
},
});
if (res.code === '0000') {
message.success('新增成功!');
setDrawer((s) => ({
...s,
visible: false,
item: null,
}));
setSelectArr([]);
actionRef.current.reload();
}
}}
>
提交
</Button>
</Space> */}
</>
);
};
const columns = useMemo(() => { const columns = useMemo(() => {
let defcolumn = getcolumns(setDrawer); let defcolumn = getcolumns(setDrawer);
defcolumn[1].render = (text, row) => { defcolumn[1].render = (text, row) => {
...@@ -489,17 +703,27 @@ function Model(props) { ...@@ -489,17 +703,27 @@ function Model(props) {
let params = { let params = {
treeNodeType: e.node.type, treeNodeType: e.node.type,
treeNodeKey: e.node.key, treeNodeKey: e.node.key,
pageSize: '15', pageSize: 15,
pageIndex: '1', pageIndex: 1,
}; };
const res = await doFetch({ url: urlParams.list, params }); const res = await doFetch({ url: urlParams.list, params });
if (res.code === '0000') { if (res.code === '0000') {
message.success('新增成功!'); message.success('查询成功!');
setDrawer((s) => ({ setDrawer((s) => ({
...s, ...s,
visible: false, visible: false,
})); }));
actionRef.current.reload(); }
};
const selectMoreDrawerType = (type) => {
switch (type) {
case 'editChildEquipment':
return <EditChildEquipment />;
case 'resume':
return <Resume />;
default:
return null;
} }
}; };
...@@ -579,7 +803,7 @@ function Model(props) { ...@@ -579,7 +803,7 @@ function Model(props) {
}} }}
{...drawer} {...drawer}
> >
{drawer?.type == 'editChildEquipment' ? <EditChildEquipment /> : null} {selectMoreDrawerType(drawer?.type)}
</DrawerPro> </DrawerPro>
</div> </div>
); );
......
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) {
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, </PremButton>
search: false, );
render: (text, row) => { };
return (
<a const edit = (text, row, _, action) => {
onClick={() => { return (
setdrawer?.((s) => ({ <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, ...s,
visible: true, visible: true,
item: null, item: 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();
}
},
})); }));
}} },
>
{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,
}, <DrawerPro
{ fields={columns}
title: '邮箱', // detailpath={urlParams.detail}
dataIndex: 'mailNo', // params={{ id: drawer?.item?.id }}
formItemProps: { defaultFormValue={drawer?.item ?? {}}
rules: [ formRef={formRef}
{ placement="right"
required: false, onClose={() => {
message: '此项为必填项', setDrawer((s) => ({
}, ...s,
], visible: false,
}, }));
search: false, }}
}, {...drawer}
{ />
title: '备注', </div>
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: '此项为必填项',
},
],
},
},
];
} }
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: '此项为必填项',
},
],
},
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: 'fullName',
key: 'userId', key: 'fullName',
hideInForm: { formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
accountName: { },
reverse: ['1', '2', '5'], { 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: '额外信息', 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