747575620@qq.com преди 1 година
родител
ревизия
bdb2451948
променени са 7 файла, в които са добавени 169 реда и са изтрити 102 реда
  1. +3
    -0
      frontend/config/config.ts
  2. +1
    -1
      frontend/config/proxy.ts
  3. +5
    -5
      frontend/config/routes.ts
  4. +143
    -83
      frontend/src/pages/deviceInfo/index.tsx
  5. +12
    -8
      frontend/src/pages/materials/index.tsx
  6. +4
    -4
      frontend/src/pages/recipe/index.tsx
  7. +1
    -1
      frontend/src/pages/system/user/index.tsx

+ 3
- 0
frontend/config/config.ts Целия файл

@@ -14,6 +14,9 @@ export default defineConfig({
* @doc https://umijs.org/docs/api/config#hash
*/
history:{type:'hash'},
// 更改为history模式
// history:{type:'browser'}
hash: true,

/**


+ 1
- 1
frontend/config/proxy.ts Целия файл

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


+ 5
- 5
frontend/config/routes.ts Целия файл

@@ -17,17 +17,17 @@
{
path: '/base', icon: 'SettingOutlined', name: '基础数据管理',
routes: [{ path: '/base/deviceinfo', name: '设备管理', component: './deviceInfo/index' },
{ path: '/base/lc', name: '料仓管理', component: './logs/index' },
{ path: '/base/stock', name: '料仓管理', component: './stock/index' },
{ path: '/base/materials', name: '原料管理', component: './materials/index' },
{ path: '/base/tong', name: '桶管理', component: './logs/index' },
{ path: '/base/recipe', name: '成品管理', component: './recipe/index' },
{ path: '/base/bucket', name: '桶管理', component: './bucket/index' },
{ path: '/base/final', name: '成品管理', component: './final/index' },
]
},
{
path: '/line', icon: 'SettingOutlined', name: '产线管理',
routes: [
{ path: '/line/log1', name: '产线设备管理', component: './logs/index' },
{ path: '/line/log2', name: '分组', component: './logs/index' }
{ path: '/line/manufacturing', name: '产线设备管理', component: './manufacturing/index' },
{ path: '/line/group', name: '分组', component: './group/index' }
]
},
{


+ 143
- 83
frontend/src/pages/deviceInfo/index.tsx Целия файл

@@ -5,85 +5,115 @@
*/
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 { Button, Modal, Form, Input, message, Popconfirm, Tag } 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';
// import RecipeAPI from '@/api/recipeService'
// import { TransferDirection } from 'antd/es/transfer';


interface RecordType {
key: string;
title: string;
description: string;
chosen: boolean;
}
let selectRecordId :string;
// 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 [materialData,setMaterialData] = useState<RecordType[]>();
//穿梭框选择数据
const [targetKeys,setTargetKeys] = useState<string[]>();
const filterOption = (inputValue: string, option: RecordType) =>
option.description.indexOf(inputValue) > -1;
// const [targetKeys,setTargetKeys] = useState<string[]>();
// const filterOption = (inputValue: string, option: RecordType) =>
// option.description.indexOf(inputValue) > -1;

const handleChange = (newTargetKeys: string[]) => {
setTargetKeys(newTargetKeys);
};
// 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 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 [isMaterialModalOpen, setIsMaterialModalOpen] = useState(false);
const [modelTitle, setModelTitle] = useState<string>();
//编辑/新增弹窗
const [isModalOpen, setIsModalOpen] = useState(false);
const actionRef = useRef<ActionType>();
const columns: ProColumns<DeviceTypes.Info>[] = [
{
title: 'id',
dataIndex: 'id',
tip: '规则名称是唯一的 key',
hideInSearch: true,
hideInTable: true,
},
{
title: '设备名称',
dataIndex: 'name',
ellipsis: true,
},
// {
// title: '设备型号',
// dataIndex: 'code',
// ellipsis: true,
// hideInSearch: true,
// },
{
title: '设备编码',
title: '设备编',
dataIndex: 'code',
hideInSearch: true,
ellipsis: true,
},
{
title: '设备描述',
dataIndex: 'des',
ellipsis: true,
hideInSearch: true,
},
{
title: '设备类型',
dataIndex: 'type',
ellipsis: true,
hideInSearch: true,
},
{
title: '设备维保日期',
dataIndex: 'data',
ellipsis: true,
hideInSearch: true,
},
{
title: '操作',
@@ -92,41 +122,55 @@ export default () => {
render: (_, record) => [
<Button
key="edit"
type="primary" ghost
type="primary" ghost
onClick={async () => {
setIsModalOpen(true);
setModelTitle('编辑信息');
const copyFormData = JSON.parse(JSON.stringify(record));
copyFormData.state = copyFormData.state === '0' ? true : false;
copyFormData.state = copyFormData.state === '0';
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>,
// <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 delData: MaterialsTypes.MaterialsInfo = {
// id: record.id,
// name: '',
// code: '',
// unit: ''
// };
// MaterialsInfoAPI.Del(delData).then((r) => {
// if (r.statusCode === 200) {
// message.success(r.statusCode === 200 ? '删除成功' : r.message);
// actionRef.current?.reload();
// }
// });
// }}
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);
@@ -140,7 +184,7 @@ export default () => {
okText="确认"
cancelText="关闭"
>
<Button type="primary" danger ghost>删除</Button>
<Button type="primary" danger ghost>删除</Button>
</Popconfirm>,
],
},
@@ -152,15 +196,15 @@ export default () => {
useEffect(() => {
// 下拉列表信息
const RegionDataList = () => {
};
RegionDataList();
}, []);

/*
*表单提交
*/
const OnSubmit = async (values: DeviceTypes.Info) => {

if (values.id) {
const response = await DeviceInfoAPI.Update(values);
if (response.statusCode === 200) {
@@ -168,7 +212,7 @@ export default () => {
actionRef.current?.reload();
setIsModalOpen(false);
} else {
message.error(response.errors || '修改失败');
message.error(JSON.stringify(response.errors) || '修改失败');
}
} else {
const response = await DeviceInfoAPI.Add(values);
@@ -178,7 +222,7 @@ export default () => {
actionRef.current?.reload();
setIsModalOpen(false);
} else {
message.error(response.errors || '添加失败');
message.error(JSON.stringify(response.errors) || '添加失败');
}
}
};
@@ -258,7 +302,8 @@ export default () => {
form={typeForm}
name="basic"
id="myForm"
labelCol={{ span: 4 }}
lCol={{ span: 4 }}
wrapperCol={{ span: 12 }}
onFinish={OnSubmit}
autoComplete="off"
@@ -266,6 +311,7 @@ export default () => {
<Form.Item label="id" name="id" hidden>
<Input />
</Form.Item>

<Form.Item
label="设备名称"
name="name"
@@ -273,14 +319,28 @@ export default () => {
>
<Input />
</Form.Item>
<Form.Item label="设备编" name="code" rules={[{ required: true, message: '此项为必填项!' }]} >
<Input />
<Form.Item label="设备编" name="code" rules={[{ required: true, message: '此项为必填项!' }]} >
<Input />
</Form.Item>

{/* <Form.Item label="设备型号" name="code2" rules={[{ required: true, message: '此项为必填项!' }]} >
<Input />
</Form.Item> */}

<Form.Item label="设备描述" name="des" >
<Input />
</Form.Item>
<Form.Item label="设备类型" name="type" rules={[{ required: true, message: '此项为必填项!' }]} >
<Input />
</Form.Item>
<Form.Item label="设备维保日期" name="data" rules={[{ required: true, message: '此项为必填项!' }]} >
<Input />
</Form.Item>

</Form>
</Modal>

<Modal
{/* <Modal
key="02"
width={800}
@@ -339,7 +399,7 @@ export default () => {
></Transfer>
</Modal>

*/}
</>
);
};

+ 12
- 8
frontend/src/pages/materials/index.tsx Целия файл

@@ -54,7 +54,7 @@ const Index =()=> {
hideInSearch:true
},
{
title: '每秒出水量(wos)',
title: '分组',
dataIndex: 'wos',
hideInSearch:true
},
@@ -84,7 +84,8 @@ const Index =()=> {
id: record.id,
name: '',
code: '',
unit: ''
unit: '',
wos: ''
};
MaterialsInfoAPI.Del(delData).then((r) => {
if (r.statusCode === 200) {
@@ -117,9 +118,9 @@ const Index =()=> {
pageSize: params.pageSize || 10,
name: params.name || '',
id: params.id,
code:params.code,
unit: params.unit,
wos:'',
code: params.code,
unit: '',
wos: ''
};
const response = await MaterialsInfoAPI.PagedList(jsonData);
if (response.statusCode === 200) {
@@ -148,8 +149,9 @@ const Index =()=> {
type="primary"
onClick={() => {
typeForm.resetFields();
setIsModalOpen(true);
setModalText('新增信息');
setIsModalOpen(true);
}}
>
添加物料
@@ -191,6 +193,7 @@ const Index =()=> {
<Form.Item label="id" name="id" hidden>
<Input />
</Form.Item>

<Form.Item
label="物料名称"
name="name"
@@ -213,11 +216,12 @@ const Index =()=> {
<Input />
</Form.Item>
<Form.Item
label="每秒出水量"
label="分组"
name="wos"
rules={[{ required: true, message: '此项必填!' }]}
>
<Input suffix='g' />
{/* <Input suffix='g' /> */}
<Input />
</Form.Item>
</Form>
</Modal>


+ 4
- 4
frontend/src/pages/recipe/index.tsx Целия файл

@@ -321,7 +321,7 @@ const Index = () => {
}
return myData;
},
formItemProps: (form, { rowIndex }) => {
formItemProps: (_form, { rowIndex }) => {
return {
rules: [{ required: true, message: '此项为必填项' }]
};
@@ -334,7 +334,7 @@ const Index = () => {
tooltip: "设备出料口编号",
valueType: 'text',
ellipsis: true,
formItemProps: (form, { rowIndex }) => {
formItemProps: (_form, { rowIndex }) => {
return {
rules: [{ required: true, message: '此项为必填项' }] ,
};
@@ -345,7 +345,7 @@ const Index = () => {
dataIndex: 'time',
valueType: 'text',
ellipsis: true,
formItemProps: (form, { rowIndex }) => {
formItemProps: (_form, { rowIndex }) => {
return {
rules: [{ required: true, message: '此项为必填项' }] ,
};
@@ -357,7 +357,7 @@ const Index = () => {
valueType: 'text',
tooltip: "步骤不可重复",
ellipsis: true,
formItemProps: (form, { rowIndex }) => {
formItemProps: (_form, { rowIndex }) => {
return {
rules: [{ required: true, message: '此项为必填项' }]
// ,


+ 1
- 1
frontend/src/pages/system/user/index.tsx Целия файл

@@ -197,7 +197,7 @@ const User: React.FC = () => {
<a onClick={async () => {
const response = await userAPI.RestoreAccount(record.id!);
if (response.data === true) {
message.success('重置成功!');
message.success('成功!');
} else {
message.error(response.msg || '重置失败');
}


Зареждане…
Отказ
Запис