Browse Source

路由

shengtang
747575620@qq.com 1 year ago
parent
commit
8aefde440d
11 changed files with 425 additions and 17 deletions
  1. +2
    -1
      backend/BPA.MES.Base.Application/Services/DeviceService/Services/DevicesInfoService.cs
  2. +1
    -1
      backend/BPA.MES.Base.Web.Entry/Properties/launchSettings.json
  3. +1
    -1
      frontend/config/defaultSettings.ts
  4. +1
    -1
      frontend/config/proxy.ts
  5. +42
    -10
      frontend/config/routes.ts
  6. BIN
     
  7. +3
    -1
      frontend/src/global.less
  8. +1
    -1
      frontend/src/pages/user/login/index.tsx
  9. +1
    -1
      frontend/src/pages/welcome/index.tsx
  10. +0
    -0
     
  11. +373
    -0
      frontend/src/pages/workInfo/index.tsx

+ 2
- 1
backend/BPA.MES.Base.Application/Services/DeviceService/Services/DevicesInfoService.cs View File

@@ -104,7 +104,8 @@
[HttpPost]
public async Task<bool> Update(DevicesInfoUpdateInput input)
{
var res = await _dbContext.Updateable<DevicesInfoEntity>().ExecuteCommandHasChangeAsync();
DevicesInfoEntity entity = input.Adapt<DevicesInfoEntity>();
var res = await _dbContext.Updateable(entity).ExecuteCommandHasChangeAsync();
return res;
}
}


+ 1
- 1
backend/BPA.MES.Base.Web.Entry/Properties/launchSettings.json View File

@@ -22,7 +22,7 @@
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "",
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"applicationUrl": "http://192.168.1.243:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}


+ 1
- 1
frontend/config/defaultSettings.ts View File

@@ -15,7 +15,7 @@ const Settings: LayoutSettings & {
fixedHeader: false,
fixSiderbar: true,
colorWeak: false,
title: "五芳斋中控管理系统",
title: "胖子天骄中控管理系统",
menu: {
locale: false, // 禁用多语言功能
},


+ 1
- 1
frontend/config/proxy.ts View File

@@ -6,7 +6,7 @@
export default {
dev: {
'/api/': {
target: 'http://localhost:5000',
target: 'http://192.168.1.243:5000',
pathRewrite: {
'/api': '/api'
},


+ 42
- 10
frontend/config/routes.ts View File

@@ -1,20 +1,52 @@
export default [
{ path: '/user', layout: false, routes: [{ path: '/user/login', component: './user/login' }] },
{ path: '/', icon: 'SmileOutlined', component: './welcome',name:'欢迎页' },
{ path:'/logs',icon: 'SettingOutlined',name:'日志管理',
routes: [{ path: '/logs/log',name:'日志管理', component: './logs/index' }]
},
{ path: '/', icon: 'SmileOutlined', component: './welcome', name: '数据看板' },

{
icon: 'SettingOutlined',
path: '/system',
name:'系统管理',
name: '系统管理',
routes: [
{ path: '/system/account',name:'账号管理', component: './system/account' },
{ path: '/system/user',name:'人员管理', component: './system/user' },
{ path: '/system/role',name:'角色管理', component: './system/role' },
{ path: '/system/module',name:'模块管理', component: './system/module' },
{ path: '/system/authTemplate',name:'权限管理', component: './system/authTemplate' },
{ path: '/system/account', name: '账号管理', component: './system/account' },
{ path: '/system/user', name: '人员管理', component: './system/user' },
{ path: '/system/role', name: '角色管理', component: './system/role' },
{ path: '/system/module', name: '模块管理', component: './system/module' },
{ path: '/system/authTemplate', name: '权限管理', component: './system/authTemplate' },
],
},
{
path: '/base', icon: 'SettingOutlined', name: '基础数据管理',
routes: [{ path: '/base/deviceinfo', name: '设备管理', component: './deviceInfo/index' },
{ path: '/base/lc', name: '料仓管理', component: './logs/index' },
{ path: '/base/materials', name: '原料管理', component: './materials/index' },
{ path: '/base/tong', name: '桶管理', component: './logs/index' },
{ path: '/base/recipe', name: '成品管理', component: './recipe/index' },
]
},
{
path: '/line', icon: 'SettingOutlined', name: '产线管理',
routes: [
{ path: '/line/log1', name: '产线设备管理', component: './logs/index' },
{ path: '/line/log2', name: '分组', component: './logs/index' }
]
},
{
path: '/recipe', icon: 'SettingOutlined', name: '配方工艺管理',
routes: [
{ path: '/recipe/log1', name: '配方管理', component: './recipe/index' },
{ path: '/recipe/log2', name: '炒锅工艺', component: './recipe/index' },
{ path: '/recipe/log3', name: '反应釜工艺', component: './recipe/index' }
]
},
{ path: '/work', icon: 'SettingOutlined', name: '工单管理', component: './workInfo/index' },
{
path: '/data', icon: 'SettingOutlined', name: '数据服务',
routes: [
{ path: '/data/log1', name: '操作日志', component: './logs/index' },
{ path: '/data/log2', name: '运行日志', component: './logs/index' },
{ path: '/data/log3', name: '报警日志', component: './logs/index' },
{ path: '/data/log4', name: '数据采集', component: './logs/index' }
]
},
{ path: '*', layout: false, component: './404' },
];

BIN
View File


+ 3
- 1
frontend/src/global.less View File

@@ -24,7 +24,9 @@ body,
canvas {
display: block;
}

.ant-pro-global-header-logo img {
height: 53px;
}
body {
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;


+ 1
- 1
frontend/src/pages/user/login/index.tsx View File

@@ -48,7 +48,7 @@ const Login: React.FC = () => {
</div>
<div className={styles.login_input}>
<div className={styles.login_logo_name}>五芳斋中控管理系统</div>
<div className={styles.login_logo_name}>胖子天骄中控管理系统</div>
<Divider/>
<Form name="basic" onFinish={onUserLogin} >


+ 1
- 1
frontend/src/pages/welcome/index.tsx View File

@@ -9,7 +9,7 @@ const Welcome: React.FC = () => {
borderRadius: 8,
}}
>
欢迎页
数据看板
</Card>
);
};


+ 0
- 0
View File


+ 373
- 0
frontend/src/pages/workInfo/index.tsx View File

@@ -0,0 +1,373 @@
/**
* 设备基础信息管理
* @param Page
* @returns
*/
import type { ActionType, ProColumns } from '@ant-design/pro-components';
import { ProTable } from '@ant-design/pro-components';
import { Button, Modal, Form, Input, message, Popconfirm, Transfer, Tag, Col } from 'antd';
import { useRef, useState, useEffect } from 'react';
import { history } from '@umijs/max';
import DeviceInfoAPI from '@/api/DeviceInfo';
import RecipeAPI from '@/api/recipeService'
import { TransferDirection } from 'antd/es/transfer';
interface RecordType {
key: string;
title: string;
description: string;
chosen: boolean;
}
let selectRecordId :string;
export default () => {
//表单
const [typeForm] = Form.useForm();
//穿梭框数据
const [materialData,setMaterialData] = useState<RecordType[]>();
//穿梭框选择数据
const [targetKeys,setTargetKeys] = useState<string[]>();
const filterOption = (inputValue: string, option: RecordType) =>
option.description.indexOf(inputValue) > -1;
const handleChange = (newTargetKeys: string[]) => {
setTargetKeys(newTargetKeys);
};
const handleSearch = (dir: TransferDirection, value: string) => {
console.log('search:', dir, value);
};
const GetTransferData = (record: DeviceTypes.Info) => {
const tempTargetKeys:any[] = [];
const tempMockData:any[] = [];
//获取所有配方
RecipeAPI.List().then((item:MyResponse.Content)=>{
if (item.statusCode===200) {
item.data.forEach((res:MaterialsTypes.MaterialsInfo)=>{
const data = {
key: res.id,
title:res.name,
description: res.name,
};
tempMockData.push(data);
});
setMaterialData(tempMockData);
}
}).then(()=>{
DeviceInfoAPI.RecipeList(record.id).then((res:MyResponse.Content)=>{
if (res.statusCode===200) {
res.data.forEach((item:any)=>{
tempTargetKeys.push(item.recipesId)
}
)
setTargetKeys(tempTargetKeys);
}
});
});
};
//下拉列表
const [isMaterialModalOpen, setIsMaterialModalOpen] = useState(false);
const [modelTitle, setModelTitle] = useState<string>();
//编辑/新增弹窗
const [isModalOpen, setIsModalOpen] = useState(false);
const actionRef = useRef<ActionType>();
const columns: ProColumns<DeviceTypes.Info>[] = [
{
title: '工单名称',
dataIndex: 'name',
ellipsis: true,
render(dom, entity, index, action, schema) {
return "测试工单"
},
},
{
title: '工单编码',
dataIndex: 'code',
hideInSearch: true,
},
{
title: '产线名称',
dataIndex: 'code',
hideInSearch: true,
render(dom, entity, index, action, schema) {
return "line1"
},
},
{
title: '创建时间',
dataIndex: 'code',
hideInSearch: true,
render(dom, entity, index, action, schema) {
return "2023年7月11日13:59:36"
},
},
{
title: '工单状态',
dataIndex: 'code',
hideInSearch: true,
render(dom, entity, index, action, schema) {
return "测试中"
},
},
{
title: '操作',
valueType: 'option',
key: 'option',
render: (_, record) => [
<Button
key="edit"
type="primary" ghost
onClick={async () => {
setIsModalOpen(true);
setModelTitle('编辑信息');
const copyFormData = JSON.parse(JSON.stringify(record));
copyFormData.state = copyFormData.state === '0' ? true : false;
typeForm.setFieldsValue(copyFormData);
}}
>
编辑
</Button>,
<Button
key="xfa"
type="primary" ghost
onClick={async () => {
setIsMaterialModalOpen(true);
console.log('record',record);
selectRecordId = record.id
console.log('record',selectRecordId);
GetTransferData(record);
}}
>
下发
</Button>,
<Popconfirm
key="del"
title="确定要删除此条数据吗?"
onConfirm={() => {
const EnablejsonData: DeviceTypes.Info = {
id: record.id,
name: '',
code: ''
};
DeviceInfoAPI.Del(EnablejsonData).then((r) => {
if (r.statusCode === 200) {
message.success(r.statusCode === 200 ? '删除成功' : r.message);
actionRef.current?.reload();
}
});
}}
onCancel={() => {
message.info('已取消删除');
}}
okText="确认"
cancelText="关闭"
>
<Button type="primary" danger ghost>删除</Button>
</Popconfirm>,
],
},
];
/*
初始化
*/
useEffect(() => {
// 下拉列表信息
const RegionDataList = () => {
};
RegionDataList();
}, []);
/*
*表单提交
*/
const OnSubmit = async (values: DeviceTypes.Info) => {
if (values.id) {
const response = await DeviceInfoAPI.Update(values);
if (response.statusCode === 200) {
message.success('修改成功');
actionRef.current?.reload();
setIsModalOpen(false);
} else {
message.error(response.errors || '修改失败');
}
} else {
const response = await DeviceInfoAPI.Add(values);
console.log('response', response);
if (response.statusCode === 200) {
message.success('添加成功');
actionRef.current?.reload();
setIsModalOpen(false);
} else {
message.error(response.errors || '添加失败');
}
}
};
return (
<>
<ProTable<DeviceTypes.Info>
key="myTable"
columns={columns}
actionRef={actionRef}
cardBordered
request={async (params = {}) => {
const jsonData: DeviceTypes.Page = {
pageIndex: params.current || 1,
pageSize: params.pageSize || 10,
name: params.name || '',
id: '',
code: ''
};
const response = await DeviceInfoAPI.PagedList(jsonData);
if (response.statusCode === 200) {
return {
data: response.data.items,
success: true,
total: response.data.total,
};
} else {
return {
data: [],
success: false,
total: 0,
};
}
}}
rowKey="id"
pagination={{
pageSize: 10,
}}
dateFormatter="string"
headerTitle="设备列表"
toolBarRender={() => [
<Button
key="button"
type="primary"
onClick={() => {
typeForm.resetFields();
setIsModalOpen(true);
setModelTitle('新增信息');
}}
>
新建设备
</Button>,
]}
/>
<Modal
key="01"
width={800}
title={<Tag color="#cd201f">{modelTitle}</Tag>}
open={isModalOpen}
onCancel={() => {
setIsModalOpen(false);
}}
footer={[
<Button
key="back"
onClick={() => {
setIsModalOpen(false);
}}
>
返回
</Button>,
<Button key="submit" form="myForm" type="primary" htmlType="submit">
提交
</Button>,
]}
>
<Form
form={typeForm}
name="basic"
id="myForm"
labelCol={{ span: 4 }}
wrapperCol={{ span: 12 }}
onFinish={OnSubmit}
autoComplete="off"
>
<Form.Item label="id" name="id" hidden>
<Input />
</Form.Item>
<Form.Item
label="设备名称"
name="name"
rules={[{ required: true, message: '此项为必填项!' }]}
>
<Input />
</Form.Item>
<Form.Item label="设备编码" name="code" rules={[{ required: true, message: '此项为必填项!' }]} >
<Input />
</Form.Item>
</Form>
</Modal>
<Modal
key="02"
width={800}
title={<Tag color="#cd201f">配方下发</Tag>}
open={isMaterialModalOpen}
onCancel={() => {
setIsMaterialModalOpen(false);
}}
footer={[
<Button
key="back"
onClick={() => {
setIsModalOpen(false);
}}
>
返回
</Button>,
<Button key="submit" type="primary" onClick={()=>{
//提交数据
console.log('selectRecordId',selectRecordId);
const jsonData: DeviceTypes.BatchAdd = {
deviceId: selectRecordId,
recipesIds:targetKeys!
}
DeviceInfoAPI.BatchUpdate(jsonData).then((res:MyResponse.Content)=>{
if (res.statusCode===200) {
message.success("保存成功!");
setIsMaterialModalOpen(false);
}else{
message.error(res.errors);
}
});
}}>
提交
</Button>,
]}
>
<Transfer
listStyle={{
width: 400,
height: 400,
}}
// eslint-disable-next-line react/jsx-key
titles={[<Col><Tag key='a' color='#f50'>产品配方库</Tag> <Button type='link' onClick={()=>{
setIsMaterialModalOpen(false);
history.push('/store/recipe');
}}>去添加产品配方</Button></Col>, <Tag key='b' color="#3b5999">当前设备配方</Tag>]}
dataSource={materialData}
showSearch
filterOption={filterOption}
targetKeys={targetKeys}
onChange={handleChange}
onSearch={handleSearch}
render={(item) => item.title}
></Transfer>
</Modal>
</>
);
};

Loading…
Cancel
Save