fangmingyue 2 年 前
コミット
9bb2a5e173
共有3 個のファイルを変更した45 個の追加5 個の削除を含む
  1. 33
    0
      src/pages/Machinery/Sensing/components/FeiFangForm.jsx
  2. 3
    4
      src/pages/Machinery/Sensing/components/List.jsx
  3. 9
    1
      src/pages/Machinery/Sensing/index.jsx

+ 33
- 0
src/pages/Machinery/Sensing/components/FeiFangForm.jsx ファイルの表示

@@ -0,0 +1,33 @@
1
+import React from 'react';
2
+import { Modal, Form, Input, Button } from 'antd';
3
+
4
+const formItemLayout = { labelCol: { span: 6 }, wrapperCol: { span: 14 } };
5
+const FormItem = Form.Item;
6
+
7
+export default (props) => {
8
+  const { openfeiyang, onCancel, onFinish } = props;
9
+
10
+  const [form] = Form.useForm();
11
+  const [loading, setLoading] = React.useState(false);
12
+  return (
13
+    <Modal title="飞防" visible={openfeiyang} maskClosable={false} footer={null} onCancel={onCancel}>
14
+      <Form {...formItemLayout} onFinish={onFinish} form={form}>
15
+        <FormItem
16
+          label="设备编号"
17
+          name="deviceNo"
18
+          rules={[{ required: true, message: '请输入设备编号' }]}
19
+        >
20
+          <Input placeholder="请输入" />
21
+        </FormItem>
22
+        <FormItem label=" " colon={false}>
23
+          <Button type="default" onClick={onCancel}>
24
+            取消
25
+          </Button>
26
+          <Button type="primary" loading={loading} htmlType="Submit" style={{ marginLeft: '2em' }}>
27
+            确认
28
+          </Button>
29
+        </FormItem>
30
+      </Form>
31
+    </Modal>
32
+  );
33
+}

+ 3
- 4
src/pages/Machinery/Sensing/components/List.jsx ファイルの表示

@@ -4,7 +4,7 @@ import moment from 'moment';
4 4
 import { Button, Popconfirm, Dropdown, Menu } from 'antd';
5 5
 import PageTable from '@/components/PageTable';
6 6
 import { getDeviceList } from '@/services/device';
7
-import {} from '@/services/device';
7
+import { } from '@/services/device';
8 8
 
9 9
 const formatterTime = (val) => {
10 10
   return val && val !== '-' ? moment(val).format('YYYY-MM-DD') : '-';
@@ -18,7 +18,7 @@ const menus = (
18 18
 );
19 19
 
20 20
 const List = (props, ref) => {
21
-  const { onBindOpt, onSyncDevice } = props;
21
+  const { onBindOpt, onSyncDevice, onFeiFang } = props;
22 22
 
23 23
   const columns = [
24 24
     {
@@ -98,7 +98,6 @@ const List = (props, ref) => {
98 98
       reload: () => actionRef.current.reload(),
99 99
     };
100 100
   });
101
-
102 101
   return (
103 102
     <PageTable
104 103
       request={getDeviceList}
@@ -110,7 +109,7 @@ const List = (props, ref) => {
110 109
         <Button key={1} type="primary">
111 110
           同步深松
112 111
         </Button>,
113
-        <Button key={3} type="primary">
112
+        <Button key={3} type="primary" onClick={() => { onFeiFang() }}>
114 113
           同步飞防
115 114
         </Button>,
116 115
       ]}

+ 9
- 1
src/pages/Machinery/Sensing/index.jsx ファイルの表示

@@ -4,11 +4,13 @@ import { PageHeaderWrapper } from '@ant-design/pro-layout';
4 4
 import { addDevice, deleteDevice } from '@/services/device';
5 5
 import List from './components/List';
6 6
 import MaBind from './components/MaBind';
7
+import FeiFangForm from './components/FeiFangForm';
7 8
 
8 9
 export default (props) => {
9 10
   // 绑定表单
10 11
 
11 12
   const [open, setOpen] = useState(false);
13
+  const [openfeiyang, setOpenFeiYang] = useState(false);
12 14
   const [device, setDevice] = useState();
13 15
   const listRef = useRef();
14 16
 
@@ -48,10 +50,16 @@ export default (props) => {
48 50
     }
49 51
   };
50 52
 
53
+  //同步飞防弹窗
54
+  const onFeiFang = () => {
55
+    setOpenFeiYang(true);
56
+  }
57
+
51 58
   return (
52 59
     <PageHeaderWrapper>
53
-      <List ref={listRef} onBindOpt={onBindOpt} onSyncDevice={console.log} />
60
+      <List ref={listRef} onBindOpt={onBindOpt} onFeiFang={onFeiFang} onSyncDevice={console.log} />
54 61
       <MaBind open={open} device={device} onCancel={() => setOpen(false)} onFinish={onBind} />
62
+      <FeiFangForm openfeiyang={openfeiyang} onCancel={() => setOpenFeiYang(false)} />
55 63
     </PageHeaderWrapper>
56 64
   );
57 65
 };