wzyyy 3 years ago
parent
commit
62639239d7

+ 1 - 1
src/pages/device/Instance/Detail/Functions/form.tsx

@@ -187,7 +187,7 @@ export default (props: FunctionProps) => {
         type: type,
         type: type,
         format: datum.valueType ? datum.valueType.format : undefined,
         format: datum.valueType ? datum.valueType.format : undefined,
         options: datum.valueType ? datum.valueType.elements : undefined,
         options: datum.valueType ? datum.valueType.elements : undefined,
-        json: type === 'object' ? datum['json']['properties'][0] : undefined,
+        json: type === 'object' ? datum['json']?.['properties'][0] : undefined,
         value: undefined,
         value: undefined,
       });
       });
     }
     }

+ 11 - 4
src/pages/device/Instance/Detail/Parsing/index.tsx

@@ -70,9 +70,11 @@ const Parsing = (props: Props) => {
     service.deviceCode(productId, deviceId).then((res) => {
     service.deviceCode(productId, deviceId).then((res) => {
       if (res.status === 200) {
       if (res.status === 200) {
         // console.log(res.result)
         // console.log(res.result)
-        setValue(res.result?.configuration?.script);
-        setData(res.result);
-        if (res.result.deviceId) {
+        if (res.result) {
+          setValue(res.result?.configuration?.script);
+          setData(res.result);
+        }
+        if (res.result?.deviceId) {
           setReadOnly(false);
           setReadOnly(false);
         } else {
         } else {
           setReadOnly(true);
           setReadOnly(true);
@@ -128,6 +130,7 @@ const Parsing = (props: Props) => {
     service.delDeviceCode(productId, deviceId).then((res) => {
     service.delDeviceCode(productId, deviceId).then((res) => {
       if (res.status === 200) {
       if (res.status === 200) {
         getDeviceCode(productId, deviceId);
         getDeviceCode(productId, deviceId);
+        onlyMessage('操作成功');
       }
       }
     });
     });
   };
   };
@@ -161,6 +164,10 @@ const Parsing = (props: Props) => {
     }
     }
   }, []);
   }, []);
 
 
+  useEffect(() => {
+    console.log(value);
+  }, [value]);
+
   return (
   return (
     <Card className="parsing" style={{ minHeight }}>
     <Card className="parsing" style={{ minHeight }}>
       <div>
       <div>
@@ -186,6 +193,7 @@ const Parsing = (props: Props) => {
                     <>
                     <>
                       当前数据解析内容继承自产品,
                       当前数据解析内容继承自产品,
                       <a
                       <a
+                        style={readOnly ? {} : { color: '#a6a6a6' }}
                         onClick={() => {
                         onClick={() => {
                           setReadOnly(false);
                           setReadOnly(false);
                         }}
                         }}
@@ -395,7 +403,6 @@ const Parsing = (props: Props) => {
         <Button
         <Button
           style={{ marginLeft: 10 }}
           style={{ marginLeft: 10 }}
           onClick={() => {
           onClick={() => {
-            console.log(typeof value, value);
             if (props.tag === 'device') {
             if (props.tag === 'device') {
               saveDeviceCode(props.data.productId, props.data.id, {
               saveDeviceCode(props.data.productId, props.data.id, {
                 provider: 'jsr223',
                 provider: 'jsr223',

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

@@ -794,7 +794,7 @@ const Detail = observer(() => {
                     properties: {
                     properties: {
                       departmentIdList: {
                       departmentIdList: {
                         title: '收信部门',
                         title: '收信部门',
-                        required: true,
+                        // required: true,
                         'x-component': 'Select',
                         'x-component': 'Select',
                         'x-decorator': 'FormItem',
                         'x-decorator': 'FormItem',
                         // 'x-decorator-props': {
                         // 'x-decorator-props': {