Browse Source

提交了agv

shengtang
ranyuqi 1 year ago
parent
commit
779db527c8
6 changed files with 123 additions and 148 deletions
  1. +1
    -1
      frontend/src/api/agvbasicService.ts
  2. +1
    -1
      frontend/src/api/agvlineService.ts
  3. +36
    -47
      frontend/src/pages/agvbasic/index.tsx
  4. +76
    -91
      frontend/src/pages/agvline/index.tsx
  5. +4
    -4
      frontend/src/types/agvbasicInfo.d.ts
  6. +5
    -4
      frontend/src/types/agvlineInfo.d.ts

+ 1
- 1
frontend/src/api/agvbasicService.ts View File

@@ -1,6 +1,6 @@
import { request } from '@umijs/max';

// agv点位基础数据
export default {
//创建分组
Add(parms: AgvbasicInfoTypes.Info) {


+ 1
- 1
frontend/src/api/agvlineService.ts View File

@@ -1,6 +1,6 @@
import { request } from '@umijs/max';

//
export default {
//创建分组
Add(parms: AgvlineInfoTypes.Info) {


+ 36
- 47
frontend/src/pages/agvbasic/index.tsx View File

@@ -1,9 +1,9 @@
// agv基础数据页面
import type { ActionType, ProColumns } from '@ant-design/pro-components';
import { ProTable } from '@ant-design/pro-components';
import { Button, Modal, Form, Input, message, Popconfirm, Tag, QRCode, Table } from 'antd';
import { Button, Modal, Form, Input, message, Popconfirm, Tag} from 'antd';
import { useEffect, useRef, useState } from 'react';
import type { ColumnsType } from 'antd/es/table';
import agvbasicInfoAPI from '@/api/agvbasicService'
const AgvPoint = () => {

@@ -40,9 +40,6 @@ const AgvPoint = () => {
ellipsis: true,
align: 'center'
},



{
title: '操作',
valueType: 'option',
@@ -50,15 +47,12 @@ const AgvPoint = () => {
align: 'center',
// 4.操作内有两个按钮
render: (_, record) => [

<Button
key="edit"
type="primary" ghost
onClick={async () => {

setIsModalOpen(true);
setModelTitle('编辑分组');

setModelTitle('编辑点位');
const copyFormData = JSON.parse(JSON.stringify(record));
typeForm.setFieldsValue(copyFormData);
}}
@@ -80,7 +74,7 @@ const AgvPoint = () => {
agvbasicInfoAPI.Del(EnablejsonData).then((r: MyResponse.Content) => {
if (r.statusCode === 200) {
message.success(r.statusCode === 200 ? '删除成功' : r.message);
actionRef.current?.reload();
actionRef.current?.reload()
}
});
}}
@@ -91,44 +85,43 @@ const AgvPoint = () => {
cancelText="关闭"
>
<Button type="primary" danger ghost>删除</Button>

</Popconfirm>,
]

},
];
useEffect(() => {
}, []);
// 7.定义表单提交
// 表单提交
const OnSubmit = async (values: AgvbasicInfoTypes.Info) => {
if (values.id) {
const response = await agvbasicInfoAPI.Update(values);
if (response.statusCode === 200) {
message.success('修改成功');
actionRef.current?.reload();
setIsModalOpen(false);
} else {
message.error(JSON.stringify(response.errors) || '修改失败');
}
} else {
const response = await agvbasicInfoAPI.Add(values);
console.log('response', response);
if (response.statusCode === 200) {
message.success('添加成功');
actionRef.current?.reload();
setIsModalOpen(false);
} else {
message.error(JSON.stringify(response.errors) || '添加失败');
}
}
};
}, []);
// 7.定义表单提交
// 表单提交
const OnSubmit = async (values: AgvbasicInfoTypes.Info) => {
if (values.id) {
const response = await agvbasicInfoAPI.Update(values);
if (response.statusCode === 200) {
message.success('修改成功');
actionRef.current?.reload();
setIsModalOpen(false);
} else {
message.error(JSON.stringify(response.errors) || '修改失败');
}
} else {
const response = await agvbasicInfoAPI.Add(values);
console.log('response', response);
if (response.statusCode === 200) {
message.success('添加成功');
actionRef.current?.reload();
setIsModalOpen(false);
} else {
message.error(JSON.stringify(response.errors) || '添加失败');
}
}
};
return (
<>
<ProTable<AgvbasicInfoTypes.Info>
@@ -160,7 +153,7 @@ const AgvPoint = () => {
}}
rowKey="id"
pagination={{
pageSize: 10,
pageSize: 10,
}}
dateFormatter="string"
headerTitle="点位列表"
@@ -231,10 +224,6 @@ const AgvPoint = () => {
<Form.Item label="点位编码" name="code" rules={[{ required: true, message: '此项为必填项!' }]} >
<Input />
</Form.Item>




</Form>
</Modal>
</>


+ 76
- 91
frontend/src/pages/agvline/index.tsx View File

@@ -3,13 +3,12 @@
// agv线路数据页面
import type { ActionType, ProColumns } from '@ant-design/pro-components';
import { ProTable } from '@ant-design/pro-components';
import { Button, Modal, Form, Input, message, Popconfirm, Tag, QRCode, Table } from 'antd';
import { Button, Modal, Form, Input, message, Popconfirm, Tag } from 'antd';
import { useEffect, useRef, useState } from 'react';
import type { ColumnsType } from 'antd/es/table';
import agvlineInfoAPI from '@/api/agvlineService'
import agvbasicInfoAPI from '@/api/agvbasicService';
import Select from 'antd/lib/select';
import { render } from 'react-dom';



@@ -24,7 +23,7 @@ const Agvline = () => {
// 起始点位状态
const [startoptin, setstartoptin] = useState<MySelectType.Select[]>([])
// 结束点位状态
const [endoption,setendoption] = useState<MySelectType.Select[]>([])
const [endoption, setendoption] = useState<MySelectType.Select[]>([])
const actionRef = useRef<ActionType>();
// 1.定义列

@@ -44,7 +43,7 @@ const Agvline = () => {
ellipsis: true,
align: 'center'
},
{
title: '起始点位',
dataIndex: 'startPointId',
@@ -54,6 +53,7 @@ const Agvline = () => {
render:(_,record)=>{
return <>{ startoptin.find(x=>x.key === record.startPointId)?.label}</>
}
},
{
title: '结束点位',
@@ -62,8 +62,8 @@ const Agvline = () => {
ellipsis: true,
align: 'center',
render:(_,record)=>{
return <>{ endoption.find(x=>x.key === record.endPointId)?.label}</>
}
return <>{endoption.find(x=>x.key === record.endPointId)?.label}</>
}
},
{
title: '业务描述',
@@ -79,15 +79,12 @@ const Agvline = () => {
align: 'center',
// 4.操作内有两个按钮
render: (_, record) => [

<Button
key="edit"
type="primary" ghost
onClick={async () => {

setIsModalOpen(true);
setModelTitle('编辑分组');

setModelTitle('编辑线路');
const copyFormData = JSON.parse(JSON.stringify(record));
typeForm.setFieldsValue(copyFormData);
}}
@@ -99,17 +96,19 @@ const Agvline = () => {
key="del"
title="确定要删除此条数据吗?"
onConfirm={() => {

const EnablejsonData: AgvlineInfoTypes.Info = {
id: record.id,
name: '',
code: ''
code: '',
endPointId: '',
startPointId: '',
description: ''
};

agvlineInfoAPI.Del(EnablejsonData).then((r: MyResponse.Content) => {
agvlineInfoAPI.Del(EnablejsonData).then((r:MyResponse.Content) => {
if (r.statusCode === 200) {
message.success(r.statusCode === 200 ? '删除成功' : r.message);
actionRef.current?.reload();
}
});
}}
@@ -120,7 +119,6 @@ const Agvline = () => {
cancelText="关闭"
>
<Button type="primary" danger ghost>删除</Button>

</Popconfirm>,
]

@@ -129,67 +127,58 @@ const Agvline = () => {

useEffect(() => {
const startList = async () => {
const data = await agvbasicInfoAPI.selectlist()
// console.log('data',data);
const infomation = await agvbasicInfoAPI.selectlist()
console.log('dinfomation', infomation);
// data就是点位
// eslint-disable-next-line array-callback-return
data.data.map((item: { label: any; value: any; key: any; })=>{
infomation.data.map((item: { label: any; value: any; key: any; })=>{
// console.log('222',item.label);
item.label = item.value
// item.value = item.key
})
setstartoptin(data.data)
// eslint-disable-next-line array-callback-return
setstartoptin(infomation.data)
}


startList()
const endList = async()=>{
const data1 = await agvbasicInfoAPI.selectlist()
// console.log(data1);

// eslint-disable-next-line array-callback-return
data1.data.map((item: { label: any; value: any; key: any; })=>{
item.label = item.value
// item.value = item.key
const endList = async () => {
const infomation1 = await agvbasicInfoAPI.selectlist()
console.log('infomation1',infomation1);
// eslint-disable-next-line array-callback-return, @typescript-eslint/no-unused-vars
infomation1.data.map((item:{ label: any; value: any; key: any; })=>{
// console.log(item,'222');
item.label = item.value
})
setendoption(data1.data)
setendoption(infomation1.data)
}
endList()
}, []);

// 7.定义表单提交
// 表单提交
const OnSubmit = async (values: AgvlineInfoTypes.Info) => {
console.log(values);
if (values.id) {

const response = await agvlineInfoAPI.Update(values);
if (response.statusCode === 200) {
message.success('修改成功');
actionRef.current?.reload();
setIsModalOpen(false);
} else {
message.error(JSON.stringify(response.errors) || '修改失败');
}
} else {
// 让code默认为空
values.code = '';
const response = await agvlineInfoAPI.Add(values);
actionRef.current?.reload()
if (response.statusCode === 200) {
message.success('添加成功');
actionRef.current?.reload()
setIsModalOpen(false);
} else {
message.error(JSON.stringify(response.errors) || '添加失败');
}
}
};
// 7.定义表单提交
// 表单提交
const OnSubmit = async (values: AgvlineInfoTypes.Info) => {
console.log(values);
if (values.id) {
const response = await agvlineInfoAPI.Update(values);
if (response.statusCode === 200) {
message.success('修改成功');
actionRef.current?.reload();
setIsModalOpen(false);
} else {
message.error(JSON.stringify(response.errors) || '修改失败');
}
} else {
// 让code默认为空
values.code = '';
const response = await agvlineInfoAPI.Add(values);
actionRef.current?.reload()
if (response.statusCode === 200) {
message.success('添加成功');
actionRef.current?.reload()
setIsModalOpen(false);
} else {
message.error(JSON.stringify(response.errors) || '添加失败');
}
}
};
return (
<>
<ProTable<AgvlineInfoTypes.Info>
@@ -199,8 +188,7 @@ const Agvline = () => {
pageIndex: params.current || 1,
pageSize: params.pageSize || 10,
name: params.name || '',
code: ''
code: ''
};
const response = await agvlineInfoAPI.PagedList(jsonData);
if (response.statusCode === 200) {
@@ -250,6 +238,7 @@ const Agvline = () => {
onCancel={() => {
setIsModalOpen(false);
}}

footer={[
<Button
key="back"
@@ -268,7 +257,7 @@ const Agvline = () => {
{/* 弹窗内的表单 */}
<Form
form={typeForm}
name="basic"
name="line"
id="agvlineForm"
labelAlign='right'
// lCol={{ span: 4 }}
@@ -291,34 +280,30 @@ const Agvline = () => {
<Input />
</Form.Item>
<Form.Item label="起始点位" name="startPointId" rules={[{ required: true, message: '此项为必填项!' }]} >
<Select placeholder='请选择起始点位' style={{ width: 375 }}>
{
startoptin.map((item:MySelectType.Select) =>{
return <Select.Option value={item.key} key={item.key}>
<span>{item.value}</span>
</Select.Option>
})
}
</Select>
<Select placeholder='请选择起始点位' style={{ width: 375 }}>
{
startoptin.map((item: MySelectType.Select) => {
return <Select.Option value={item.key} key={item.key}>
<span>{item.value}</span>
</Select.Option>
})
}
</Select>
</Form.Item>
<Form.Item label="结束点位" name="endPointId" rules={[{ required: true, message: '此项为必填项!' }]} >
<Select placeholder='请选择起始点位' style={{ width: 375 }}>
{
endoption.map((item:MySelectType.Select) =>{
return <Select.Option value={item.key} key={item.key}>
<span>{item.value}</span>
</Select.Option>
})
}
</Select>
<Select placeholder='请选择起始点位' style={{ width: 375 }}>
{
endoption.map((item: MySelectType.Select) => {
return <Select.Option value={item.key} key={item.key}>
<span>{item.value}</span>
</Select.Option>
})
}
</Select>
</Form.Item>
<Form.Item label="点位描述" name="description" rules={[{ required: true, message: '此项为必填项!' }]} >
<Input />
</Form.Item>




</Form>
</Modal>



+ 4
- 4
frontend/src/types/agvbasicInfo.d.ts View File

@@ -1,6 +1,6 @@
// 分组管理
//点位基础数据
declare namespace AgvbasicInfoTypes {
// 角色类型
// 类型
interface Info {
id: string,
name: string,
@@ -46,10 +46,10 @@ declare namespace AgvbasicInfoTypes {
id:string
}
/**
* 名 称 :设备基础信息
* 名 称 :点位基础信息
* 创 建 人 :ranyuqi
* 创建时间 :2022/10/28 17:19:13
* 描 述 :设备基础信息返回值
* 描 述 :点位基础信息返回值
* @export
* @interface AgvbasicInfoOutput
*/


+ 5
- 4
frontend/src/types/agvlineInfo.d.ts View File

@@ -1,6 +1,6 @@
// 分组管理
// 点位线路管理
declare namespace AgvlineInfoTypes {
// 角色类型
// 类型
interface Info {
id: string,
name: string,
@@ -50,10 +50,10 @@ declare namespace AgvlineInfoTypes {
id:string
}
/**
* 名 称 :设备基础信息
* 名 称 :点位线路基础信息
* 创 建 人 :ranyuqi
* 创建时间 :2022/10/28 17:19:13
* 描 述 :设备基础信息返回值
* 描 述 :点位线路基础信息返回值
* @export
* @interface AgvlineInfoOutput
*/
@@ -110,6 +110,7 @@ declare namespace AgvlineInfoTypes {
* @memberof AgvlineInfoUpdateInput
*/
id?: string | null;
}
}



Loading…
Cancel
Save