xiaohaizhao 1 anno fa
parent
commit
c88b1c61d0
1 ha cambiato i file con 57 aggiunte e 2 eliminazioni
  1. 57 2
      control/modules/My_input.vue

+ 57 - 2
control/modules/My_input.vue

@@ -70,6 +70,25 @@
                         </view>
                     </view>
                 </block>
+                <!-- 选择 -->
+                <block v-else-if="item.inputType == 'radio'">
+                    <view class="title u-line-1">
+                        {{ item.funcname }}{{ item.params[item.key + 'P'].unit || '' }}
+                    </view>
+                    <view class="select-box">
+                        <view class="item" @click="onSelected(op, item.inputType)"
+                            :class="op.value == item.params.lastvalue ? 'active' : ''" v-for="op in item.params.options"
+                            :key="op.value" hover-class="navigator-hover">
+                            {{ op.label }}
+                        </view>
+                    </view>
+                    <view class="tips" v-if="toBeUpdated">
+                        <u-icon name="info-circle-fill" color="#E2201A" />
+                        <text style="margin-left: 4px;">
+                            {{ toBeUpdated }}
+                        </text>
+                    </view>
+                </block>
                 <!-- 其他类型 -->
                 <block v-else>
                     其他类型
@@ -79,6 +98,7 @@
     </view>
 </template>
 <script>
+let model = null;
 export default {
     name: "My_input",
     data() {
@@ -99,9 +119,10 @@ export default {
          * @param item.inputType int:数字 step:步进器 radio:单选 switch:开关 dayParting:分时段
          */
         openInput(item) {
-            this.item = item;
+            this.item = JSON.parse(JSON.stringify(item))
             this.show = true
             let tips = "";
+            this.toBeUpdated = '';
             let params = item.params;
             this.confirmText = '确定'
             if (item.inputType == 'int') {
@@ -126,7 +147,6 @@ export default {
             } else if (item.inputType == "dayParting") {
                 this.value = item.params[item.key + 'p'];
                 this.dayPartingFocus = false;
-                this.item = JSON.parse(JSON.stringify(item))
                 this.toBeUpdated = item.paramValue.time || item.paramValue.value ? `查询到一条待更新指令,更新内容为:时间${item.paramValue.time.split("_").join(":")},压力${item.paramValue.value}MPA` : ""
                 let p = item.params[item.key + 'P'];
                 if (p.num_minvalue || p.num_maxvalue) tips += `输入范围:${p.num_minvalue || 0} ~ ${p.num_maxvalue || '∞'}`
@@ -136,9 +156,20 @@ export default {
                 setTimeout(() => {
                     this.dayPartingFocus = true
                 }, 300);
+            } else if (item.inputType == "radio") {
+                let paramValue = item.paramValue + "";
+                if (paramValue.length && paramValue != item.params.lastvalue) {
+                    this.toBeUpdated = `查询到“${item.funcname}”有待更新记录,待更新值为“${params.options.find(v => v.value == item.paramValue).label}”`
+                }
             }
             this.tips = tips;
         },
+        onSelected(option, mode) {
+            console.log(option, mode)
+            if (mode == "radio") {
+                this.item.params.lastvalue = option.value;
+            }
+        },
         /* 时段修改 */
         changeT_T(e) {
             this.item.params[this.item.key + 'T'].lastvalue = e.detail.value;
@@ -178,6 +209,8 @@ export default {
                     [item.key + 'P']: value,
                     [item.key + 'T']: params[item.key + 'T'].lastvalue.split(":").join("_")
                 })
+            } else if (item.inputType == "radio") {
+                value = params.lastvalue;
             }
             this.submit(item.w_functionid, {
                 [item.paramName]: value
@@ -226,6 +259,7 @@ export default {
         }
     }
 
+    /* 分时控制 */
     .day-parting {
 
         .row {
@@ -240,6 +274,27 @@ export default {
 
     }
 
+    /* 选择样式 */
+    .select-box {
+        display: flex;
+        flex-wrap: wrap;
+
+        .item {
+            font-size: 12px;
+            padding: 2px 6px;
+            border-radius: 4px;
+            border: 1px solid #333;
+            margin-right: 5px;
+            margin-bottom: 5px;
+        }
+
+        .active {
+            // font-weight: bold;
+            color: #fff;
+            background: #052E5D;
+        }
+    }
+
     /deep/.u-input {
         .uni-input-input {
             font-size: 12px;