wzyyy пре 3 година
родитељ
комит
b88dc11cdc

+ 4 - 4
config/proxy.ts

@@ -15,10 +15,10 @@ export default {
       // target: 'http://120.79.18.123:8844/',
       // ws: 'ws://120.79.18.123:8844/',
       // 测试环境
-      target: 'http://120.77.179.54:8844/',
-      ws: 'ws://120.77.179.54:8844/',
-      // target: 'http://192.168.32.65:8850/',
-      // ws: 'ws://192.168.32.65:8850/',
+      // target: 'http://120.77.179.54:8844/',
+      // ws: 'ws://120.77.179.54:8844/',
+      target: 'http://192.168.32.65:8844/',
+      ws: 'ws://192.168.32.65:8844/',
       //v2环境
       // ws: 'ws://47.109.52.230:8844',
       // target: 'http://47.109.52.230:8844',

+ 31 - 0
src/pages/iot-card/Recharge/detail.tsx

@@ -0,0 +1,31 @@
+import { Modal, Descriptions } from 'antd';
+
+interface Props {
+  data: any;
+  close: any;
+}
+
+const Detail = (props: Props) => {
+  return (
+    <Modal
+      title={'充值'}
+      maskClosable={false}
+      visible
+      onCancel={props.close}
+      onOk={props.close}
+      width="35vw"
+    >
+      <Descriptions title="User Info">
+        <Descriptions.Item label="UserName">Zhou Maomao</Descriptions.Item>
+        <Descriptions.Item label="Telephone">1810000000</Descriptions.Item>
+        <Descriptions.Item label="Live">Hangzhou, Zhejiang</Descriptions.Item>
+        <Descriptions.Item label="Remark">empty</Descriptions.Item>
+        <Descriptions.Item label="Address">
+          No. 18, Wantang Road, Xihu District, Hangzhou, Zhejiang, China
+        </Descriptions.Item>
+      </Descriptions>
+    </Modal>
+  );
+};
+
+export default Detail;

+ 15 - 3
src/pages/iot-card/Recharge/index.tsx

@@ -8,15 +8,18 @@ import { Tooltip } from 'antd';
 import moment from 'moment';
 import { useRef, useState } from 'react';
 import Service from '../CardManagement/service';
+import Detail from './detail';
 import TopUp from './topUp';
 
-export const service = new Service('');
+export const service = new Service('network/card');
 
 const Recharge = () => {
   const { minHeight } = useDomFullHeight(`.record`, 24);
   const actionRef = useRef<ActionType>();
   const [param, setParam] = useState({});
   const [visible, setVisible] = useState<boolean>(false);
+  const [detail, setDetail] = useState<boolean>(false);
+  const [current, setCurrent] = useState<any>({});
 
   const columns: ProColumns<any>[] = [
     // {
@@ -66,9 +69,10 @@ const Recharge = () => {
         <a
           key="editable"
           onClick={() => {
-            console.log(record);
+            // console.log(record);
+            setDetail(true);
             // setVisible(true);
-            // setCurrent(record);
+            setCurrent(record);
           }}
         >
           <Tooltip title="查看">
@@ -137,6 +141,14 @@ const Recharge = () => {
           }}
         />
       )}
+      {detail && (
+        <Detail
+          data={current}
+          close={() => {
+            setDetail(false);
+          }}
+        />
+      )}
     </PageContainer>
   );
 };

+ 39 - 3
src/pages/iot-card/Recharge/topUp.tsx

@@ -1,10 +1,12 @@
-import { createForm } from '@formily/core';
+import { createForm, Field } from '@formily/core';
 import { createSchemaField } from '@formily/react';
 import { Form, FormGrid, FormItem, Input, Select, NumberPicker } from '@formily/antd';
 import type { ISchema } from '@formily/json-schema';
 import { Modal } from '@/components';
 // import { onlyMessage } from '@/utils/util';
 import { ExclamationCircleOutlined } from '@ant-design/icons';
+import { action } from '@formily/reactive';
+import { service } from '.';
 
 interface Props {
   data: any;
@@ -23,7 +25,40 @@ const TopUp = (props: Props) => {
       NumberPicker,
     },
   });
+  const useAsyncDataSource = (ser: (arg0: any) => Promise<any>) => (field: Field) => {
+    field.loading = true;
+    ser(field).then(
+      action.bound?.((data) => {
+        field.dataSource = (data.result || []).map((item: any) => ({
+          label: item.name,
+          value: item.id,
+        }));
+        field.loading = false;
+      }),
+    );
+  };
 
+  const queryProvidersList = () =>
+    service.queryPlatformNoPage({
+      paging: false,
+      terms: [
+        {
+          terms: [
+            {
+              column: 'operatorName',
+              termType: 'eq',
+              value: 'onelink',
+            },
+            {
+              column: 'state',
+              termType: 'eq',
+              value: 'enabled',
+              type: 'and',
+            },
+          ],
+        },
+      ],
+    });
   const schema: ISchema = {
     type: 'object',
     properties: {
@@ -47,7 +82,7 @@ const TopUp = (props: Props) => {
             'x-component-props': {
               placeholder: '请输入平台对接',
             },
-
+            'x-reactions': '{{useAsyncDataSource(queryProvidersList)}}',
             'x-validator': [
               {
                 max: 64,
@@ -127,6 +162,7 @@ const TopUp = (props: Props) => {
                 message: '请选择支付方式',
               },
             ],
+            enum: [],
           },
         },
       },
@@ -162,7 +198,7 @@ const TopUp = (props: Props) => {
         暂只支持移动OneLink平台
       </div>
       <Form form={form} layout="vertical">
-        <SchemaField schema={schema} scope={{}} />
+        <SchemaField schema={schema} scope={{ useAsyncDataSource, queryProvidersList }} />
       </Form>
     </Modal>
   );