Commit 7219878d authored by TZW's avatar TZW

11.9下午

parent 2e168ae0
...@@ -25,12 +25,31 @@ export default [ ...@@ -25,12 +25,31 @@ export default [
path: '/setting/factory', path: '/setting/factory',
component: './setting/factory', component: './setting/factory',
}, },
{ {
name: '车间管理', name: '车间管理',
path: '/setting/workshop', path: '/setting/workshop',
component: './setting/workshop', component: './setting/workshop',
}, },
{
name: '工段管理',
path: '/setting/section',
component: './setting/section',
},
{
name: '产线管理',
path: '/setting/production',
component: './setting/production',
},
], ],
}, },
{
name: "设备管理",
icon: 'BulbOutlined',
path: '/device',
routes: [{
name: '设备台账',
path: '/setting/account',
component: './setting/account',
}]
}
]; ];
/* 工厂管理
* @Author: Li Hanlin
* @Date: 2022-11-09 14:44:44
* @Last Modified by: Li Hanlin
* @Last Modified time: 2022-11-09 14:44:44
*/
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';
...@@ -95,7 +102,7 @@ function Factory(props) { ...@@ -95,7 +102,7 @@ function Factory(props) {
let res = await doFetch({ url: urlParams.remove, params: { id: row.id } }); let res = await doFetch({ url: urlParams.remove, params: { id: row.id } });
if (res.code === '0000') { if (res.code === '0000') {
message.success('删除成功!'); message.success('删除成功!');
setDraw((s) => ({ setDrawer((s) => ({
...s, ...s,
visible: false, visible: false,
})); }));
......
function getcolumns(setdrawer) { function getcolumns(setdrawer) {
return [ return [
{ title: '产线代码', dataIndex: 'productionLineCode', key: 'productionLineCode' },
{ {
title: '基础信息', title: '产线名称',
valueType: 'split', dataIndex: 'productionLineName',
key: 'productionLineName',
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: '姓名',
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: '备注', title: '所属车间',
dataIndex: 'remark', dataIndex: 'shopName',
valueType: 'editor', key: 'shopName',
search: false, formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
colProps: { span: 24 }, valueType: 'select',
initialValue: '<p>Hello <b>World!</b></p>', options: { path: '/auth/sysShop/getShopSelectionByFactory', params: {} },
},
{
title: '上传样式-图片',
dataIndex: 'uploadImage',
key: 'uploadImage',
valueType: 'uploadImage',
fieldProps: {
limit: 2,
},
formItemProps: {
rules: [
{
required: false,
message: '此项为必填项',
},
],
},
}, },
]; ];
} }
......
/* 产线管理
* @Author: Li Hanlin
* @Date: 2022-11-09 14:43:54
* @Last Modified by: Li Hanlin
* @Last Modified time: 2022-11-09 16:47:41
*/
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 Production(props) { function Section(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/sysProductionLine/saveOrUpdate',
remove: '/auth/sysProductionLine/delete',
list: '/auth/sysProductionLine/queryPage',
detail: '/auth/sysProductionLine/getById',
};
const detail = (text, row, _, action) => { const detail = (text, row, _, action) => {
return ( return (
<PremButton <PremButton
...@@ -44,9 +60,28 @@ function Production(props) { ...@@ -44,9 +60,28 @@ function Production(props) {
setdrawer((s) => ({ setdrawer((s) => ({
...s, ...s,
visible: true, visible: true,
item: row,
title: '编辑', title: '编辑',
params: { id: row.id },
detailpath: urlParams.detail,
val: 'edit', val: 'edit',
onFinish: async (vals) => {
let params = {
...vals,
};
let res = await doFetch({
url: urlParams.save,
params,
id: row.id,
});
if (res.code === '0000') {
message.success('新增成功!');
setdrawer((s) => ({
...s,
visible: false,
}));
actionRef.current.reload();
}
},
})); }));
}, },
}} }}
...@@ -63,8 +98,16 @@ function Production(props) { ...@@ -63,8 +98,16 @@ function Production(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('删除成功!');
setdrawer((s) => ({
...s,
visible: false,
}));
actionRef.current.reload();
}
}, },
}} }}
btn={{ btn={{
...@@ -83,23 +126,19 @@ function Production(props) { ...@@ -83,23 +126,19 @@ function Production(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 +150,23 @@ function Production(props) { ...@@ -111,6 +150,23 @@ function Production(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 +175,9 @@ function Production(props) { ...@@ -119,8 +175,9 @@ function Production(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={() => {
...@@ -135,4 +192,4 @@ function Production(props) { ...@@ -135,4 +192,4 @@ function Production(props) {
); );
} }
export default Production; export default Section;
\ No newline at end of file
...@@ -18,10 +18,15 @@ function getcolumns(setdrawer) { ...@@ -18,10 +18,15 @@ function getcolumns(setdrawer) {
{ {
title: '所属车间', title: '所属车间',
dataIndex: 'shopName', dataIndex: 'shopName',
key: 'shopName', key: 'shopId',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] }, formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
valueType: 'select', valueType: 'select',
options: { path: '/auth/sysShop/getShopSelectionByFactory', params: {} }, options: {
path: '/auth/sysShop/getShopSelectionByFactory',
linkParams: {
factoryId: 'factoryId', //key 后面如果存在value 则该value会在调用接口时format
},
},
}, },
]; ];
} }
......
/* 工段管理
* @Author: Li Hanlin
* @Date: 2022-11-09 14:43:54
* @Last Modified by: Li Hanlin
* @Last Modified time: 2022-11-09 16:48:08
*/
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 Factory(props) { function Section(props) {
const actionRef = useRef(), const actionRef = useRef(),
formRef = useRef(); formRef = useRef();
const [drawer, setdrawer] = useState({ const [drawer, setdrawer] = useState({
...@@ -13,10 +22,10 @@ function Factory(props) { ...@@ -13,10 +22,10 @@ function Factory(props) {
}); });
const urlParams = { const urlParams = {
save: '/auth/sysShop/saveOrUpdate', save: '/auth/sysSection/saveOrUpdate',
remove: '/auth/sysShop/delete', remove: '/auth/sysSection/delete',
list: '/auth/sysShop/queryPage', list: '/auth/sysSection/queryPage',
detail: '/auth/sysShop/getById', detail: '/auth/sysSection/getById',
}; };
const detail = (text, row, _, action) => { const detail = (text, row, _, action) => {
...@@ -51,9 +60,28 @@ function Factory(props) { ...@@ -51,9 +60,28 @@ function Factory(props) {
setdrawer((s) => ({ setdrawer((s) => ({
...s, ...s,
visible: true, visible: true,
item: row,
title: '编辑', title: '编辑',
params: { id: row.id },
detailpath: '/auth/sysSection/getById',
val: 'edit', val: 'edit',
onFinish: async (vals) => {
let params = {
...vals,
};
let res = await doFetch({
url: urlParams.save,
params,
id: row.id,
});
if (res.code === '0000') {
message.success('新增成功!');
setdrawer((s) => ({
...s,
visible: false,
}));
actionRef.current.reload();
}
},
})); }));
}, },
}} }}
...@@ -74,7 +102,7 @@ function Factory(props) { ...@@ -74,7 +102,7 @@ function Factory(props) {
let res = await doFetch({ url: urlParams.remove, params: { id: row.id } }); let res = await doFetch({ url: urlParams.remove, params: { id: row.id } });
if (res.code === '0000') { if (res.code === '0000') {
message.success('删除成功!'); message.success('删除成功!');
setDraw((s) => ({ setdrawer((s) => ({
...s, ...s,
visible: false, visible: false,
})); }));
...@@ -105,7 +133,7 @@ function Factory(props) { ...@@ -105,7 +133,7 @@ function Factory(props) {
return ( return (
<div style={{ position: 'relative' }}> <div style={{ position: 'relative' }}>
<AutoTable <AutoTable
pagetitle="车间管理" pagetitle={<h3 className="page-title">工段管理</h3>}
columns={columns} columns={columns}
path={urlParams.list} path={urlParams.list}
actionRef={actionRef} actionRef={actionRef}
...@@ -147,8 +175,9 @@ function Factory(props) { ...@@ -147,8 +175,9 @@ function Factory(props) {
<DrawerPro <DrawerPro
fields={columns} fields={columns}
detailpath={urlParams.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={() => {
...@@ -163,4 +192,4 @@ function Factory(props) { ...@@ -163,4 +192,4 @@ function Factory(props) {
); );
} }
export default Factory; export default Section;
...@@ -15,9 +15,9 @@ function getcolumns(setdrawer) { ...@@ -15,9 +15,9 @@ function getcolumns(setdrawer) {
{ {
title: '所属工厂名称', title: '所属工厂名称',
dataIndex: 'factoryName', dataIndex: 'factoryName',
key: 'factoryCode', key: 'factoryId',
valueType: 'select', valueType: 'select',
options: { path: '/auth/sysShop/queryPage', params: {} }, options: { path: '/auth/sysFactory/getAllFactorySelection', params: {} },
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] }, formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
}, },
]; ];
......
/* 车间管理
* @Author: Li Hanlin
* @Date: 2022-11-09 14:44:18
* @Last Modified by: Li Hanlin
* @Last Modified time: 2022-11-09 14:44:18
*/
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';
...@@ -56,6 +63,24 @@ function Factory(props) { ...@@ -56,6 +63,24 @@ function Factory(props) {
item: row, item: row,
title: '编辑', title: '编辑',
val: 'edit', val: 'edit',
onFinish: async (vals) => {
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();
}
},
})); }));
}, },
}} }}
...@@ -69,14 +94,14 @@ function Factory(props) { ...@@ -69,14 +94,14 @@ function Factory(props) {
return ( return (
<PremButton <PremButton
pop={{ pop={{
title: '是否删除该用户?', title: '是否删除该车间?',
okText: '确认', okText: '确认',
cancelText: '取消', cancelText: '取消',
onConfirm: async () => { onConfirm: async () => {
let res = await doFetch({ url: urlParams.remove, params: { id: row.id } }); let res = await doFetch({ url: urlParams.remove, params: { id: row.id } });
if (res.code === '0000') { if (res.code === '0000') {
message.success('删除成功!'); message.success('删除成功!');
setDraw((s) => ({ setdrawer((s) => ({
...s, ...s,
visible: false, visible: false,
})); }));
...@@ -151,6 +176,7 @@ function Factory(props) { ...@@ -151,6 +176,7 @@ function Factory(props) {
fields={columns} fields={columns}
// detailpath={urlParams.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={() => {
......
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