Explorar el Código

分时控制优化

xiaohaizhao hace 1 año
padre
commit
4f6f84144c
Se han modificado 2 ficheros con 35 adiciones y 17 borrados
  1. 10 5
      control/components/prodnum-06/modules/division.vue
  2. 25 12
      control/modules/My_input.vue

+ 10 - 5
control/components/prodnum-06/modules/division.vue

@@ -16,14 +16,14 @@
             <view class="box">
                 <view class="label">第{{ item.index }}时段时间</view>
                 <view class="content">
-                    <view class="value">{{ item.params["T" + item.index + "_T"] || '--' }}</view>
+                    <view class="value">{{ item.params["T" + item.index + "_T"].lastvalue || '--' }}</view>
                 </view>
             </view>
             <view class="box">
                 <view class="label">第{{ item.index }}时段压力</view>
                 <view class="content">
-                    <view class="value">{{ item.params["T" + item.index + "_P"] || '--' }}</view>
-                    <view class="unit">MPA</view>
+                    <view class="value">{{ item.params["T" + item.index + "_P"].lastvalue || '--' }}</view>
+                    <view class="unit">{{ item.params["T" + item.index + "_P"].unit || '' }}</view>
                 </view>
             </view>
         </view>
@@ -52,17 +52,22 @@ export default {
             }
             for (let i = 1; i <= count; i++) {
                 let obj = funs[`T${i}`];
-                obj.params[`T${i}_T`] = obj.params[`T${i}_T`].split("_").join(":");
                 list.push(Object.assign(obj, {
                     key: `T${i}_`,
                     index: i,
                     inputType: "dayParting",
-                    toBeUpdated: {
+                    paramValue: {
                         time: values[`T${i}_T`],
                         value: values[`T${i}_P`]
+                    },
+                    params: {
+                        [`T${i}_T`]: paramsList[`T${i}_T`],
+                        [`T${i}_P`]: paramsList[`T${i}_P`],
                     }
                 }))
             }
+            console.log(paramsList)
+            console.log(list)
             this.list = list;
             this.timeControl = this.__proto__.getControlItem(["TimeControl"], funs, values, paramsList)[0]
         },

+ 25 - 12
control/modules/My_input.vue

@@ -39,24 +39,31 @@
                 <!-- 时段 -->
                 <block v-else-if="item.inputType == 'dayParting'">
                     <view class="title u-line-1">
-                        {{ item.funcname }}{{ item.params.unit || '' }}
+                        {{ item.funcname }}{{ item.params[item.key + 'P'].unit || '' }}
                     </view>
                     <view class="day-parting">
-                        <picker mode="time" :value="item.params[item.key + 'T']" @change="changeT_T">
+                        <picker mode="time" :value="item.params[item.key + 'T'].lastvalue" @change="changeT_T">
                             <view class="row">
                                 <view class="label">
                                     时间:
                                 </view>
-                                {{ item.params[item.key + 'T'] }}
+                                {{ item.params[item.key + 'T'].lastvalue }}
                             </view>
                         </picker>
+
                         <view class="row" style="margin-top: 20px">
                             <view class="label">压力:</view>
                             <u--input :focus="dayPartingFocus" v-model="value" type="digit"
-                                :placeholder="item.params[item.key + 'P']" border="surround" />
+                                :placeholder="item.params[item.key + 'P'].lastvalue" border="surround" />
                         </view>
-                        <view class="tips" v-if="tips">
+                        <view class="tips" v-if="toBeUpdated">
                             <u-icon name="info-circle-fill" color="#E2201A" />
+                            <text style="margin-left: 4px;">
+                                {{ toBeUpdated }}
+                            </text>
+                        </view>
+                        <view class="tips" v-if="tips">
+                            <u-icon name="info-circle-fill" color="#55AAFF" />
                             <text style="margin-left: 4px;">
                                 {{ tips }}
                             </text>
@@ -79,6 +86,7 @@ export default {
             show: false,
             item: {},
             tips: "",
+            toBeUpdated: "",
             intFocus: false,
             dayPartingFocus: false,
             value: "",
@@ -116,11 +124,15 @@ export default {
                     tips = `是否将“${item.funcname}”${this.confirmText}为:“${params.options.find(v => v.value != item.paramValue).label}”`
                 }
             } else if (item.inputType == "dayParting") {
-                console.log("分时段", item)
                 this.value = item.params[item.key + 'p'];
                 this.dayPartingFocus = false;
                 this.item = JSON.parse(JSON.stringify(item))
-                tips = item.toBeUpdated.time || item.toBeUpdated.value ? `查询到一条待更新指令,更新内容为时间:${item.toBeUpdated.time.split("_").join(":")},压力:${item.toBeUpdated.value}MPA` : ""
+                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 || '∞'}`
+                if (p.num_scale) tips += `,保留${p.num_scale}位小数`
+                if (p.num_step) tips += `,增量${p.num_step || 0}`
+                if (tips && p.unit) tips += `,单位${p.unit}`
                 setTimeout(() => {
                     this.dayPartingFocus = true
                 }, 300);
@@ -129,7 +141,7 @@ export default {
         },
         /* 时段修改 */
         changeT_T(e) {
-            this.item.params[this.item.key + 'T'] = e.detail.value;
+            this.item.params[this.item.key + 'T'].lastvalue = e.detail.value;
         },
         submitBreak(content) {
             uni.showToast({
@@ -158,9 +170,13 @@ export default {
                 }
             } else if (item.inputType == "dayParting") {
                 value = this.value - 0;
+                if (value == 0) return this.submitBreak("还未输入值")
+                if (params.num_scale != 0) value = value.toFixed(params.num_scale)
+                if (params.num_minvalue && value > params.num_minvalue) return this.submitBreak("输入值小于最低范围")
+                if (params.num_maxvalue && value < params.num_maxvalue) return this.submitBreak("输入值大于最大范围")
                 return this.submit(item.w_functionid, {
                     [item.key + 'P']: value,
-                    [item.key + 'T']: params[item.key + 'T'].split(":").join("_")
+                    [item.key + 'T']: params[item.key + 'T'].lastvalue.split(":").join("_")
                 })
             }
             this.submit(item.w_functionid, {
@@ -230,8 +246,5 @@ export default {
         }
 
     }
-
-
-
 }
 </style>