diff --git a/frontend/config/config.ts b/frontend/config/config.ts index 3a27d43..26f1218 100644 --- a/frontend/config/config.ts +++ b/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, /** diff --git a/frontend/config/proxy.ts b/frontend/config/proxy.ts index f6eb85b..0f3ba6a 100644 --- a/frontend/config/proxy.ts +++ b/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' }, diff --git a/frontend/config/routes.ts b/frontend/config/routes.ts index 63d482f..7cea312 100644 --- a/frontend/config/routes.ts +++ b/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' } ] }, { diff --git a/frontend/src/pages/deviceInfo/index.tsx b/frontend/src/pages/deviceInfo/index.tsx index b05d34f..e75aeb9 100644 --- a/frontend/src/pages/deviceInfo/index.tsx +++ b/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(); + // const [materialData,setMaterialData] = useState(); //穿梭框选择数据 - const [targetKeys,setTargetKeys] = useState(); - - const filterOption = (inputValue: string, option: RecordType) => - option.description.indexOf(inputValue) > -1; + // const [targetKeys,setTargetKeys] = useState(); + // 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(); //编辑/新增弹窗 const [isModalOpen, setIsModalOpen] = useState(false); const actionRef = useRef(); const columns: ProColumns[] = [ + { + 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) => [ , - , + // , { + // 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="关闭" > - + , ], }, @@ -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 () => { + { > - - + + - + + {/* + + */} + + + + + + + + + + + - { > - + */} ); }; diff --git a/frontend/src/pages/materials/index.tsx b/frontend/src/pages/materials/index.tsx index 0b77600..2d1cf1a 100644 --- a/frontend/src/pages/materials/index.tsx +++ b/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 =()=> { + { - + {/* */} + diff --git a/frontend/src/pages/recipe/index.tsx b/frontend/src/pages/recipe/index.tsx index 14bff77..1b7f514 100644 --- a/frontend/src/pages/recipe/index.tsx +++ b/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: '此项为必填项' }] // , diff --git a/frontend/src/pages/system/user/index.tsx b/frontend/src/pages/system/user/index.tsx index d0e5d46..b16fbea 100644 --- a/frontend/src/pages/system/user/index.tsx +++ b/frontend/src/pages/system/user/index.tsx @@ -197,7 +197,7 @@ const User: React.FC = () => { { const response = await userAPI.RestoreAccount(record.id!); if (response.data === true) { - message.success('重置成功!'); + message.success('成功!'); } else { message.error(response.msg || '重置失败'); }