xiaohaizhao vor 1 Jahr
Ursprung
Commit
320fe7a2b1

+ 3 - 2
control/components/prodnum-06/modules/basics.vue

@@ -6,7 +6,7 @@
         <view class="current">
             <view class="item" v-for="item in preview" :key="item.paramname">
                 <view class="label">{{ item.paramname }}</view>
-                <view class="value">{{ item.lastvalue }}</view>
+                <view class="value">{{ item.lastvalue }}{{ item.unit || '' }}</view>
             </view>
         </view>
         <view class="show-list">
@@ -41,7 +41,8 @@ export default {
     color: #fff;
     margin-bottom: 10px;
     font-size: 12px;
-    .label{
+
+    .label {
         margin-bottom: 5px;
     }
 }

+ 77 - 1
control/components/prodnum-06/modules/mpattern.vue

@@ -3,14 +3,90 @@
         <view class="control-title">
             控制模式
         </view>
+        <view class="update-line">
+            <view class="label">
+                {{ ctrlModel.funcname }}
+            </view>
+            <view class="content">
+                {{ ctrlModel.showValue }}
+                <view class="control-updata-but" hover-class="navigator-hover" @click="onClick(ctrlModel)">更新</view>
+            </view>
+        </view>
+
+        <view class="row" hover-class="navigator-hover" @click="onClick(preview.tar)">
+            <view class="box">
+                <view class="label">{{ preview.now.paramname }}</view>
+                <view class="content">
+                    <view class="value">{{ preview.now.lastvalue || '--' }}</view>
+                </view>
+            </view>
+            <view class="box">
+                <view class="label">{{ preview.tar.funcname }}</view>
+                <view class="content">
+                    <view class="value">{{ preview.tar.params.lastvalue || '--' }}</view>
+                    <view class="unit">{{ preview.tar.params.unit || '' }}</view>
+                </view>
+            </view>
+        </view>
+
+        <My_input ref="MyInput" />
 
     </view>
 </template>
 
 <script>
+let model = null;
 export default {
     name: "pattern",
+    data() {
+        return {
+            ctrlModel: {},
+            preview: []
+        }
+    },
+    methods: {
+        onClick(item) {
+            if (!model) model = this.$refs.MyInput;
+            model.openInput(item)
+        }
+    }
 }
 </script>
 
-<style lang="scss" scoped></style>
+<style lang="scss" scoped>
+.row {
+    display: flex;
+    padding: 4px 6px 0;
+    height: 60px;
+    box-sizing: border-box;
+    background: #fff;
+    border-radius: 4px;
+    margin-bottom: 5px;
+
+    .box {
+        width: 49%;
+
+        .content {
+            display: flex;
+            margin-top: 10px;
+            align-items: flex-end;
+
+            .value {
+                width: 0;
+                flex: 1;
+                color: #333;
+                font-size: 16px;
+                flex-shrink: 0;
+                font-weight: bold;
+            }
+
+            .unit {
+                font-size: 10px;
+                color: #666;
+                flex-shrink: 0;
+                max-width: 50px;
+            }
+        }
+    }
+}
+</style>

+ 38 - 9
control/components/prodnum-06/prodnum-06.vue

@@ -1,7 +1,7 @@
 <template>
     <view class="container">
         <!-- 控制模式 -->
-        <mpattern />
+        <mpattern ref="mpattern" />
         <!-- 基础控制 -->
         <basics ref="basics" />
         <!-- 分时开关 -->
@@ -22,31 +22,60 @@ export default {
     watch: {
         control: function (newVal) {
             if (newVal) {
-                console.log(newVal)
                 try {
                     let nameList = ['Flow control', 'pressure control', 'Config', 'Sleep time', 'Pilot valve', 'Minimum', 'MOP']
                     this.$refs.basics.itemList = this.__proto__.getControlItem(nameList, newVal.function, newVal.paramcmdvalues, newVal.params)
                     this.$refs.basics.preview = ['Batt4', 'Batt12', 'BatFlow'].map(v => {
                         return newVal.params[v]
                     })
-                    console.log(this.$refs.basics.preview)
                 } catch (error) {
-                    console.error(error)
+                    console.error("06基础控制", error)
                 }
                 try {
                     let division = this.$refs.division;
                     division && division.loadData(newVal.function, newVal.paramcmdvalues, newVal.params)
                 } catch (error) {
-                    console.error(error)
+                    console.error("06分时控制", error)
+                }
+                try {
+                    let ctrlModel = this.__proto__.getControlItem(['Ctrl'], newVal.function, newVal.paramcmdvalues, newVal.params, { Ctrl: "radio" })[0]
+                    let preview = [];
+                    switch (ctrlModel.params.lastvalue - 0) {
+                        case 0:
+                            preview = {
+                                now: newVal.params['UpP'],
+                                tar: this.__proto__.getControlItem(['Upstream'], newVal.function, newVal.paramcmdvalues, newVal.params)[0]
+                            }
+                            break;
+                        case 1:
+                            preview = {
+                                now: newVal.params['DownP'],
+                                tar: this.__proto__.getControlItem(['Downstream'], newVal.function, newVal.paramcmdvalues, newVal.params)[0]
+                            }
+                            break;
+                        case 2:
+                            preview = {
+                                now: newVal.params['NowFlow'],
+                                tar: this.__proto__.getControlItem(['Constantflow'], newVal.function, newVal.paramcmdvalues, newVal.params)[0]
+                            }
+                            break;
+                        case 3:
+                            preview = {
+                                now: newVal.params['MostBad'],
+                                tar: this.__proto__.getControlItem(['unfavorable'], newVal.function, newVal.paramcmdvalues, newVal.params)[0]
+                            }
+                            break;
+                    }
+                    this.$refs.mpattern.ctrlModel = ctrlModel;
+                    this.$refs.mpattern.preview = preview;
+                } catch (error) {
+                    console.error("06控制模式", error)
                 }
             } else {
 
             }
         }
-    },
-    modules() {
-
-    },
+    }
 }
 </script>
 

+ 2 - 0
control/modules/My_input.vue

@@ -161,6 +161,8 @@ export default {
                 if (paramValue.length && paramValue != item.params.lastvalue) {
                     this.toBeUpdated = `查询到“${item.funcname}”有待更新记录,待更新值为“${params.options.find(v => v.value == item.paramValue).label}”`
                 }
+            } else {
+                console.log(item)
             }
             this.tips = tips;
         },

+ 4 - 3
pages/facility/modules/control.vue

@@ -61,9 +61,10 @@ export default {
                     "w_deviceid": this.detail.w_deviceid,
                 }).then(res => {
                     if (res) {
-                        uni.showToast({
-                            title: "设备控制参数已更新",
-                            icon: "none"
+                        uni.showModal({
+                            title: "通知",
+                            content: '设备控制参数已更新',
+                            showCancel: false,
                         })
                         this.getControl(true);
                     }