xiaohaizhao 1 éve
szülő
commit
91a650beb6

+ 29 - 10
control/components/prodnum-06/modules/mpattern.vue

@@ -13,22 +13,22 @@
                     ctrlModel.isfeedback ? '待更新' : '更新' }}</view>
             </view>
         </view>
-
-        <view class="row" v-if="preview" hover-class="navigator-hover" @click="onClick(preview.tar)">
+        <view class="row" v-for="item in list" :key="item.now.paramname" :style="{ 'opacity': item.current ? 1 : .8 }"
+            hover-class="navigator-hover" @click="onClick(item.tar)">
             <view class="box">
-                <view class="label">{{ preview.now.paramname || '' }}</view>
+                <view class="label">{{ item.now.paramname || '' }}</view>
                 <view class="content">
-                    <view class="value">{{ preview.now.lastvalue || '--' }}</view>
+                    <view class="value">{{ item.now.lastvalue || '--' }}</view>
                 </view>
             </view>
             <view class="box">
-                <view class="label">{{ preview.tar.funcname }}</view>
+                <view class="label">{{ item.tar.funcname }}</view>
                 <view class="content">
-                    <view class="value">{{ preview.tar.params.lastvalue || '--' }}</view>
-                    <view class="unit">{{ preview.tar.params.unit || '' }}</view>
+                    <view class="value">{{ item.tar.params.lastvalue || '--' }}</view>
+                    <view class="unit">{{ item.tar.params.unit || '' }}</view>
                 </view>
             </view>
-            <view class="dot" v-if="preview.tar.isfeedback" />
+            <view class="dot" v-if="item.tar.isfeedback" />
         </view>
         <My_input ref="MyInput" />
     </view>
@@ -40,12 +40,30 @@ export default {
     data() {
         return {
             ctrlModel: {},
-            preview: null
+            list: []
         }
     },
     methods: {
         onClick(item) {
-            this.$refs.MyInput.openInput(item)
+            let MyInput = this.$refs.MyInput;
+            console.log(item)
+            if (item.paramName == 'ConMode') {
+                MyInput.checkBeforeSending = (w_functionid, params) => {
+                    let tar = this.list[params.ConMode - 1].tar;
+                    let lastvalue = tar.params.lastvalue - 0;
+                    if (lastvalue == 0) {
+                        uni.showModal({
+                            title: '提示',
+                            content: `"${tar.funcname}"值为"0",不可修改为"${this.ctrlModel.params.options.find(v => v.value == params.ConMode).label}"模式`,
+                            showCancel: false,
+                        })
+                    } else {
+                        MyInput.checkBeforeSending = null;
+                        MyInput.submit(w_functionid, params)
+                    }
+                }
+            }
+            MyInput.openInput(item)
         }
     }
 }
@@ -53,6 +71,7 @@ export default {
 
 <style lang="scss" scoped>
 .row {
+
     position: relative;
     display: flex;
     padding: 4px 6px 0;

+ 14 - 29
control/components/prodnum-06/prodnum-06.vue

@@ -40,36 +40,21 @@ export default {
                 }
                 try {
                     let ctrlModel = this.__proto__.getControlItem(['Ctrl'], newVal, { Ctrl: "radio" })[0]
-                    let preview = [];
-                    switch (ctrlModel.params.lastvalue - 0) {
-                        case 0:
-                            preview = {
-                                now: newVal.params['UpP'],
-                                tar: this.__proto__.getControlItem(['Upstream'], newVal)[0]
-                            }
-                            break;
-                        case 1:
-                            preview = {
-                                now: newVal.params['DownP'],
-                                tar: this.__proto__.getControlItem(['Downstream'], newVal)[0]
-                            }
-                            break;
-                        case 2:
-                            preview = {
-                                now: newVal.params['NowFlow'],
-                                tar: this.__proto__.getControlItem(['Constantflow'], newVal)[0]
-                            }
-                            break;
-                        case 3:
-                            preview = {
-                                now: newVal.params['MostBad'],
-                                tar: this.__proto__.getControlItem(['unfavorable'], newVal)[0]
-                            }
-                            break;
-                    }
-
                     this.$refs.mpattern.ctrlModel = ctrlModel;
-                    this.$refs.mpattern.preview = preview;
+                    let lastvalue = ctrlModel.params.lastvalue - 0;
+                    this.$refs.mpattern.list = [{
+                        now: newVal.params['DownP'],
+                        tar: this.__proto__.getControlItem(['Downstream'], newVal)[0],
+                        current: lastvalue == 1
+                    }, {
+                        now: newVal.params['NowFlow'],
+                        tar: this.__proto__.getControlItem(['Constantflow'], newVal)[0],
+                        current: lastvalue == 2
+                    }, {
+                        now: newVal.params['MostBad'],
+                        tar: this.__proto__.getControlItem(['unfavorable'], newVal)[0],
+                        current: lastvalue == 3
+                    }];
                 } catch (error) {
                     console.error("06控制模式", error)
                 }

+ 14 - 3
control/modules/My_input.vue

@@ -1,7 +1,7 @@
 <template>
     <view>
-        <u-modal ref="uModal" :show="show" @confirm="confirm" :asyncClose="true" :showCancelButton="true"
-            @cancel="show = false" :confirmText="confirmText">
+        <u-modal ref="uModal" :show="show" @confirm="confirm" :asyncClose="true" :showCancelButton="true" @cancel="onCancel"
+            :confirmText="confirmText">
             <view class="content">
                 <!-- 整数类型 -->
                 <block v-if="item.inputType == 'int'">
@@ -152,7 +152,8 @@ export default {
             stepIsCalculate: false,
             stagingMethod: null,
             isSlot: false,
-            switchTips: ""
+            switchTips: "",
+            checkBeforeSending: null
         }
     },
     methods: {
@@ -305,8 +306,18 @@ export default {
                 [item.paramName]: value
             })
         },
+        onCancel() {
+            this.$refs.uModal.loading = false;
+            this.show = false;
+            this.checkBeforeSending = null;
+        },
         async submit(w_functionid, params) {
             console.log("提交", w_functionid, params)
+            if (this.checkBeforeSending) {
+                this.$refs.uModal.loading = false;
+                this.checkBeforeSending(w_functionid, params)
+                return
+            }
             if (this.stepIsCalculate) return this.stagingMethod = true;
             this.loading = true;
             let res = await this.$Http.setControlItem(w_functionid, params)