hear 3 лет назад
Родитель
Сommit
15ddba6e64

+ 15 - 0
src/pages/rule-engine/Scene/Save/action/DeviceOutput/actions/TypeModel.tsx

@@ -80,6 +80,10 @@ export default (props: Props) => {
     }
   }, [source]);
 
+  useEffect(() => {
+    setValue(props.value);
+  }, [props.value]);
+
   const renderNode = (type: string) => {
     switch (type) {
       case 'int':
@@ -178,6 +182,17 @@ export default (props: Props) => {
             }}
           />
         );
+      case 'password':
+        return (
+          <Input.Password
+            value={value}
+            style={{ width: '100%', textAlign: 'left' }}
+            placeholder={'请输入'}
+            onChange={(e) => {
+              onChange(e.target.value);
+            }}
+          />
+        );
       default:
         return (
           <Input

+ 1 - 0
src/pages/rule-engine/Scene/Save/action/DeviceOutput/actions/WriteProperty.tsx

@@ -83,6 +83,7 @@ export default (props: Props) => {
             setPropertiesType(option.valueType.type);
             textRef.current = option.name;
             console.log(option);
+            setPropertiesValue(undefined);
           }}
         ></Select>
       </Col>

+ 3 - 3
src/pages/rule-engine/Scene/Save/action/DeviceOutput/index.less

@@ -93,10 +93,10 @@
 }
 
 .device-title {
-  top: 5px;
-  left: 0;
-  width: 760px;
+  width: 720px;
   height: 38px;
+  margin-top: 5px;
+  margin-bottom: 10px;
   padding: 8px 16px 8px 16px;
   background: rgba(250, 178, 71, 0.1);
   border: 1px solid rgba(250, 178, 71, 0.4);

+ 12 - 3
src/pages/rule-engine/Scene/Save/action/DeviceOutput/index.tsx

@@ -64,6 +64,15 @@ export default observer((props: Props) => {
     DeviceModel.current -= 1;
   };
 
+  const init = () => {
+    DeviceModel.selector = 'fixed';
+    DeviceModel.source = 'fixed';
+    DeviceModel.selectorValues = [];
+    DeviceModel.productId = '';
+    DeviceModel.message = {};
+    DeviceModel.current = 0;
+  };
+
   const save = async () => {
     const value = await formRef.current?.validateFields();
     const item = {
@@ -111,14 +120,14 @@ export default observer((props: Props) => {
       }));
       // console.log(_options.taglist, 'taglist')
     }
-    console.log(item);
+    // console.log(item);
     props.save(item, _options);
-    DeviceModel.current = 0;
+
+    init();
   };
 
   useEffect(() => {
     if (props.value) {
-      console.log('----------', props.value);
       DeviceModel.selector = props.value.selector;
       DeviceModel.productId = props.value.productId;
       DeviceModel.selector = props.value.selector;