Explorar el Código

fix: 远程升级编辑页

wzyyy hace 3 años
padre
commit
6d88a22689

+ 4 - 4
config/proxy.ts

@@ -15,13 +15,13 @@ 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://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',
+      ws: 'ws://47.109.52.230:8844',
+      target: 'http://47.109.52.230:8844',
       changeOrigin: true,
       pathRewrite: { '^/api': '' },
     },

+ 5 - 1
src/components/FUpload/index.tsx

@@ -1,7 +1,7 @@
 import { DeleteOutlined, UploadOutlined } from '@ant-design/icons';
 import SystemConst from '@/utils/const';
 import Token from '@/utils/token';
-import { useState } from 'react';
+import { useEffect, useState } from 'react';
 import { connect } from '@formily/react';
 import { Input, Upload } from 'antd';
 import type { UploadChangeParam } from 'antd/lib/upload/interface';
@@ -30,6 +30,10 @@ const FUpload = connect((props: Props) => {
     }
   };
 
+  useEffect(() => {
+    setUrl(props.value?.url);
+  }, [props.value]);
+
   return (
     <Upload
       beforeUpload={props.beforeUpload}

+ 23 - 2
src/pages/device/Firmware/Save/index.tsx

@@ -34,9 +34,17 @@ const Save = (props: Props) => {
         if (!data?.id) return;
         form1.setInitialValues({ ...data, upload: { url: data?.url } });
       });
-      onFieldValueChange('signMethod', (field) => {
+      onFieldValueChange('signMethod', (field, f) => {
         const value = (field as Field).value;
         signMethod.current = value;
+        if (field.modified) {
+          f.setFieldState('sign', (state) => {
+            state.value = undefined;
+          });
+          f.setFieldState('upload', (state1) => {
+            state1.value = undefined;
+          });
+        }
       });
       onFieldValueChange('upload', (field) => {
         const value = (field as Field).value;
@@ -410,7 +418,20 @@ const Save = (props: Props) => {
       width="50vw"
       title={data?.id ? '编辑' : '新增'}
       onCancel={() => close()}
-      onOk={() => save()}
+      onOk={async () => {
+        if (data?.id) {
+          const res: any = await service.task({
+            terms: [{ terms: [{ column: 'firmwareId', value: data.id }] }],
+          });
+          if (res.status === 200 && res.result.data && res.result.data.length !== 0) {
+            onlyMessage('该固件有升级任务,不可编辑', 'warning');
+          } else {
+            save();
+          }
+        } else {
+          save();
+        }
+      }}
       visible={visible}
     >
       <Form form={form} labelCol={5} wrapperCol={16} layout="vertical">

+ 1 - 1
src/pages/iframe/index.tsx

@@ -28,7 +28,7 @@ const Iframe = () => {
   useEffect(() => {
     const params = location.pathname.split('/')?.[1];
     const url = location.pathname.split('/').slice(2).join('/');
-    console.log(params, url);
+    // console.log(params, url);
     handle(params, url);
   }, [location, iframeUrl]);
 

+ 1 - 1
src/pages/notice/Template/Detail/index.tsx

@@ -953,7 +953,7 @@ const Detail = observer(() => {
                     properties: {
                       ttsCode: {
                         title: '模版ID',
-                        'x-component': 'Select',
+                        'x-component': 'Input',
                         'x-decorator': 'FormItem',
                         'x-decorator-props': {
                           tooltip: '阿里云内部分配的唯一ID标识',