xiaohaizhao преди 1 година
родител
ревизия
3dd23b9d56

+ 245 - 0
control/components/prodnum-MT03/modules/division.vue

@@ -0,0 +1,245 @@
+<template>
+    <view class="control">
+        <view class="control-title">
+            分时控制
+        </view>
+        <view class="item" hover-class="navigator-hover" v-for="item in list" :key="item.index" @click="onClick(item)">
+            <view class="title">
+                {{ item.funcname }}
+            </view>
+            <view class="row">
+                <view class="box">
+                    <view class="">
+                        开始时间
+                    </view>
+                    <view class="content">
+                        <view class="value">{{ item.showValue.begin || '--' }}</view>
+                    </view>
+                </view>
+                <view class="box">
+                    <view class="">
+                        结束时间
+                    </view>
+                    <view class="content">
+                        <view class="value">{{ item.showValue.end || '--' }}</view>
+                    </view>
+                </view>
+                <view class="box">
+                    <view class="">
+                        流量设定
+                    </view>
+                    <view class="content">
+                        <view class="value">{{ item.showValue.value || '--' }}</view>
+                        <view class="unit">{{ item.params[item.funcname + "流量设定"].unit || '' }}</view>
+                    </view>
+                </view>
+            </view>
+            <view v-if="item.isfeedback" class="dot" />
+        </view>
+        <My_input ref="MyInput" @customMethod="customMethod">
+            <view class="change-item" v-if="changeItem.funcname">
+                <picker mode="time" :value="changeItem.showValue.begin" :end="changeItem.showValue.end" data-name="begin"
+                    @change="timeChange">
+                    <view class="row">
+                        <view class="label">
+                            开始时间:
+                        </view>
+                        <view class="value">{{ changeItem.showValue.begin || ' --' }}
+                        </view>
+                    </view>
+                </picker>
+                <picker class="row" mode="time" :start="changeItem.showValue.begin" :value="changeItem.showValue.end"
+                    data-name="end" @change="timeChange">
+                    <view class="row">
+                        <view class="label">
+                            结束时间:
+                        </view>
+                        <view class="value">{{ changeItem.showValue.end || ' --' }}</view>
+                    </view>
+                </picker>
+                <view class="row">
+                    <view class="label">
+                        流量设定:
+                    </view>
+                    <view class="value">
+                        <u-input :placeholder="changeItem.showValue.value || '流量设定'" v-model="changeItem.showValue.value"
+                            :type="changeItem.params[changeItem.funcname + '流量设定'].num_scale == 0 ? 'number' : 'digit'">
+                            <template slot="suffix">
+                                {{ changeItem.params[changeItem.funcname + "流量设定"].unit || '' }}
+                            </template>
+                        </u-input>
+                    </view>
+                </view>
+            </view>
+        </My_input>
+    </view>
+</template>
+
+<script>
+let model = null;
+export default {
+    name: "division",
+    data() {
+        return {
+            list: [],
+            changeItem: {}
+        }
+    },
+    methods: {
+        loadData(newVal) {
+            let reg = /^时段\d{1,5}$/,
+                count = 0,
+                list = [];
+            for (const key in newVal.function) {
+                if (reg.test(key)) count++
+            }
+            for (let i = 1; i <= count; i++) {
+                let obj = newVal.function[`时段${i}`],
+                    keyList = [
+                        `时段${i}分钟开始`,//0
+                        `时段${i}分钟结束`,//1
+                        `时段${i}小时开始`,//2
+                        `时段${i}小时结束`,//3
+                        `时段${i}流量设定`,//4
+                        `时间段${i}置位`,//5
+                    ],
+                    item = {
+                        keyList,
+                        index: i,
+                        inputType: "slot",
+                        paramValue: {
+                            begin: newVal.paramcmdvalues[keyList[2]] ? newVal.paramcmdvalues[keyList[2]] + ":" + newVal.paramcmdvalues[keyList[0]] : "",
+                            end: newVal.paramcmdvalues[keyList[3]] ? newVal.paramcmdvalues[keyList[3]] + ":" + newVal.paramcmdvalues[keyList[1]] : "",
+                            value: newVal.paramcmdvalues[keyList[4]]
+                        },
+                        showValue: {
+                            begin: newVal.paramvalues[keyList[2]] ? newVal.paramvalues[keyList[2]] + ":" + newVal.paramvalues[keyList[0]] : "",
+                            end: newVal.paramvalues[keyList[3]] ? newVal.paramvalues[keyList[3]] + ":" + newVal.paramvalues[keyList[1]] : "",
+                            value: newVal.paramvalues[keyList[4]]
+                        },
+                        params: {}
+                    };
+
+                keyList.forEach(key => {
+                    item.params[key] = newVal.params[key];
+                });
+                item.isfeedback = (newVal.isfeedback && (obj.paramValue.begin || obj.paramValue.end || obj.paramValue.value)) ? true : false;
+                list.push(Object.assign(obj, item))
+            }
+            this.list = list;
+        },
+        onClick(item) {
+            if (!model) model = this.$refs.MyInput;
+            model.openInput(item, true)
+            if (this.changeItem.funcname != item.funcname) this.changeItem = JSON.parse(JSON.stringify(item));
+            let toBeUpdated = [];
+            if (item.paramValue.begin) toBeUpdated.push(`开始时间:${item.paramValue.begin}`);
+            if (item.paramValue.end) toBeUpdated.push(`结束时间:${item.paramValue.begin}`);
+            if (item.paramValue.value) toBeUpdated.push(`流量设定:${item.paramValue.value}`);
+            if (toBeUpdated.length) {
+                model.toBeUpdated = '待更新记录:' + toBeUpdated.join(",")
+            }
+        },
+        timeChange(e) {
+            const name = e.currentTarget.dataset.name;
+            this.changeItem.showValue[name] = e.detail.value;
+        },
+        customMethod() {
+            const {
+                showValue,
+                w_functionid,
+                params,
+                index,
+                funcname
+            } = this.changeItem,
+                MyInput = this.$refs.MyInput;
+            if (!showValue.begin) return MyInput.submitBreak("还未填写开始时间")
+            if (!showValue.end) return MyInput.submitBreak("还未填写结束时间")
+            if ((showValue.value + '').length == 0) return MyInput.submitBreak("还未设定流量")
+            showValue.value = (showValue.value - 0).toFixed(params[funcname + '流量设定'].num_scale)
+            MyInput.submit(w_functionid, {
+                "时段1分钟开始": showValue.begin.split(":")[1],
+                "时段1小时开始": showValue.begin.split(":")[0],
+                "时段1分钟结束": showValue.end.split(":")[1],
+                "时段1小时结束": showValue.end.split(":")[0],
+                "时段1流量设定": showValue.value,
+                [`时间段${index}置位`]: params[`时间段${index}置位`].lastvalue
+            })
+        }
+    }
+}
+</script>
+
+<style lang="scss" scoped>
+.item {
+    position: relative;
+    padding: 4px 6px 6px;
+    box-sizing: border-box;
+    background: #fff;
+    border-radius: 4px;
+    margin-bottom: 5px;
+
+    .title {
+        margin-bottom: 6px;
+        font-weight: bold;
+    }
+
+    .row {
+        display: flex;
+
+        .box {
+            width: 33.33%;
+
+            .content {
+                display: flex;
+                margin-top: 6px;
+                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;
+                }
+            }
+        }
+
+
+    }
+
+    .dot {
+        position: absolute;
+        right: 2px;
+        top: 2px;
+        width: 10px;
+        height: 10px;
+        background: #D9001B;
+        border-radius: 50%;
+    }
+}
+
+.change-item {
+
+    .row {
+        display: flex;
+        align-items: center;
+        line-height: 35px;
+        width: 100%;
+
+        .label {
+            width: 80px;
+            flex-shrink: 0;
+        }
+    }
+
+}
+</style>

+ 88 - 0
control/components/prodnum-MT03/modules/mpattern.vue

@@ -0,0 +1,88 @@
+<template>
+    <view class="control">
+        <view class="update-line">
+            <view class="label" :style="{ color: fColor }">
+                {{ ctrlModel.funcname }}
+            </view>
+            <view class="content" :style="{ color: fColor }">
+                {{ ctrlModel.showValue || '暂未设置' }}
+                <view class="control-updata-but" hover-class="navigator-hover" @click="onClick(ctrlModel)">{{
+                    ctrlModel.isfeedback ? '待更新' : '更新' }}</view>
+            </view>
+        </view>
+        <My_input ref="MyInput" />
+    </view>
+</template>
+
+<script>
+let model = null;
+export default {
+    name: "mpattern",
+    props: {
+        fColor: {
+            type: String,
+            value: "#FFF"
+        }
+    },
+    data() {
+        return {
+            ctrlModel: {}
+        }
+    },
+    methods: {
+        onClick(item) {
+            if (!model) model = this.$refs.MyInput;
+            model.openInput(item)
+        }
+    }
+}
+</script>
+
+<style lang="scss" scoped>
+.row {
+    position: relative;
+    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;
+            }
+        }
+    }
+
+    .dot {
+        position: absolute;
+        right: 2px;
+        top: 2px;
+        width: 10px;
+        height: 10px;
+        background: #D9001B;
+        border-radius: 50%;
+    }
+}
+</style>

+ 73 - 0
control/components/prodnum-MT03/modules/pilotLamp.vue

@@ -0,0 +1,73 @@
+<template>
+    <view class="pilotLamp">
+        <view class="item" v-for="item in list" :key="item.name">
+            <view class="image">
+                <image style="height: 100%;" src="/static/img/pilot-lamp.png" mode="heightFix" />
+                <view v-if="item.value" class="bg" />
+            </view>
+            <view class="name">
+                {{ item.name }}
+            </view>
+        </view>
+    </view>
+</template>
+
+<script>
+export default {
+    name: 'pilotLamp',
+    data() {
+        return {
+            list: []
+        }
+    },
+}
+</script>
+
+<style lang="scss" scoped>
+.pilotLamp {
+    display: flex;
+    flex-wrap: wrap;
+
+    .item {
+        display: flex;
+        flex-direction: column;
+        align-items: center;
+        width: 20%;
+
+        .image {
+            position: relative;
+            height: 20px;
+
+            .bg {
+                width: 14px;
+                height: 14px;
+                border-radius: 50%;
+                background: #cccccc;
+                position: absolute;
+                top: 3px;
+                left: 3px;
+                z-index: 9;
+                animation: lampBackground .5s infinite alternate ease-in-out;
+            }
+
+            @keyframes lampBackground {
+                from {
+                    background-color: #FF8F4A;
+                }
+
+                to {
+                    background-color: red;
+                }
+            }
+        }
+
+        .name {
+            font-size: 12px;
+            color: #fff;
+            margin-top: 6px;
+        }
+
+
+    }
+}
+</style>

+ 219 - 0
control/components/prodnum-MT03/modules/tabs.vue

@@ -0,0 +1,219 @@
+<template>
+    <view class="tabs">
+        <view class="box">
+            <u-tabs :list="tabList" @click="changeTab" lineColor="#052E5D"
+                :activeStyle="{ color: '#052E5D', fontWeight: 'bold' }" :inactiveStyle="{
+                    color: '#BBBBBB',
+                }" lineWidth="36" />
+        </view>
+        <view class="content">
+            <view class="gdsz" v-show="showPage == '关断设置'">
+                <mpattern ref="关断复位" /><!-- fColor="#000" -->
+                <mpattern ref="关断设置" /><!-- fColor="#000" -->
+                <!--      <view class="llcj" v-if="llcj.paramname">
+                    {{ llcj.paramname }}:{{ llcj.lastvalue || ' -- ' }}<text class="unit">{{ llcj.unit || '' }}</text>
+                </view> -->
+                <view class="yblc">
+                    <control-item v-show="showPage == '关断设置'" v-for="item in gdszList" :key="item.paramName" :item="item"
+                        @click.native="onClick(item)" />
+                </view>
+
+            </view>
+            <view class="yblc" v-show="showPage == '报警设置'">
+                <control-item v-show="showPage == '报警设置'" v-for="item in bjszList" :key="item.paramName" :item="item"
+                    @click.native="onClick(item)" />
+            </view>
+
+            <view class="yblc" v-show="showPage == '仪表量程'">
+                <control-item v-show="showPage == '仪表量程'" v-for="item in yclbList" :key="item.paramName" :item="item"
+                    @click.native="onClick(item)" />
+            </view>
+
+            <view class="plcsz" v-if="showPage == 'PLC时钟'">
+                <view class="label">
+                    年月日时分秒
+                </view>
+                <view class="value" v-if="plc.funcname">
+                    {{ plc.params.lastvalue || '--' }}
+                    <view class="plcsz-but" hover-class="navigator-hover" @click="datetimeShow = true">{{
+                        plc.isfeedback ? '待更新' : '更新' }}</view>
+                    <u-datetime-picker :show="datetimeShow" title="PLC时钟" v-model="plclastvalue" @cancel="onCancel"
+                        @confirm="onConfirm" mode="datetime" />
+                </view>
+            </view>
+        </view>
+        <My_input ref="MyInput" />
+    </view>
+</template>
+
+<script>
+let model = null;
+import mpattern from "./mpattern";
+import { formatTime } from "../../../../utils/getTime";
+
+export default {
+    name: "tabs",
+    components: { mpattern },
+    props: {
+        control: Object
+    },
+    data() {
+        return {
+            tabList: [],
+            showPage: '关断设置',
+            bjszList: [],
+            yclbList: [],
+            gdszList: [],
+            llcj: {},
+            plc: {},
+            datetimeShow: false,
+            plclastvalue: ""
+        }
+    },
+    watch: {
+        control: function (newVal) {
+            if (newVal) {
+                this.tabList = [{
+                    name: '关断设置',
+                }, {
+                    name: '报警设置',
+                }, {
+                    name: '仪表量程'
+                }, {
+                    name: 'PLC时钟'
+                }]
+                try {
+                    this.$refs.关断设置.ctrlModel = this.__proto__.getControlItem(['关断设置'], newVal)[0];
+                    this.$refs.关断复位.ctrlModel = this.__proto__.getControlItem(['关断复位'], newVal, { 关断复位: "switch" })[0];
+                    this.llcj = newVal.params.流量采集;
+                    let nameList = ['关断流量设置', '关断延时设置']
+                    this.gdszList = this.__proto__.getControlItem(nameList, newVal)
+                } catch (error) {
+                    console.error("关断设置", error)
+                }
+                try {
+                    this.bjszList = this.__proto__.getControlItem(["失压警告", "失压警告设定", "失压报警", "失压报警设定", "超流量警告", "超流量警告设定", "超流量报警", "超流量报警设定"], newVal)
+                } catch (error) {
+                    console.error("报警设置", error)
+                }
+                try {
+                    let nameList = ['压力量程高值', '压力量程低值', '流量量程高值', '流量量程低值',]
+                    this.yclbList = this.__proto__.getControlItem(nameList, newVal)
+                } catch (error) {
+                    console.error("仪表量程", error)
+                }
+                try {
+                    this.plc = this.__proto__.getControlItem(['PLC时钟'], newVal, { Ctrl: "datatime" })[0];
+                    this.plclastvalue = this.plc.params.lastvalue;
+                } catch (error) {
+                    console.error("PLC时钟", error)
+                }
+            }
+        }
+    },
+    methods: {
+        changeTab(e) {
+            this.showPage = e.name;
+        },
+        onClick(item) {
+            if (!model) model = this.$refs.MyInput;
+            model.openInput(item)
+        },
+        onCancel(e) {
+            this.datetimeShow = false;
+        },
+        async onConfirm(e) {
+            let date = formatTime(new Date(e.value)),
+                plc = this.plc;
+            let res = await this.$Http.setControlItem(plc.w_functionid, {
+                [`${plc.paramName}`]: date
+            });
+            this.datetimeShow = false;
+        }
+    },
+}
+</script>
+
+<style lang="scss" scoped>
+.tabs {
+    position: relative;
+    box-sizing: border-box;
+
+    .box {
+        background: #fff;
+        border: 4px;
+        border-radius: 4px;
+        box-sizing: border-box;
+    }
+
+    /deep/ .controlItem {
+        width: 160px !important;
+    }
+
+    /deep/ .uni-scroll-view,
+    /deep/.u-tabs__wrapper__nav__item {
+        height: 35px !important;
+    }
+
+    /deep/ .u-tabs__wrapper__nav__item__text {
+        font-size: 12px !important;
+    }
+
+    .content {
+        // padding: 0 10px 10px;
+        padding-bottom: 10px;
+        box-sizing: border-box;
+        width: 100%;
+
+        .gdsz {
+            padding-top: 10px;
+
+            .llcj {
+                display: flex;
+                align-items: center;
+                font-size: 3.2vw;
+
+                .unit {
+                    font-size: 3.2vw;
+                }
+            }
+        }
+
+        .yblc {
+            display: flex;
+            flex-wrap: wrap;
+            justify-content: space-between;
+        }
+
+        .plcsz {
+            font-size: 14px;
+            display: flex;
+            align-items: center;
+            justify-content: space-between;
+            box-sizing: border-box;
+            padding: 10px 10px 0;
+            line-height: 25px;
+            color: #fff;
+
+            .value {
+                display: flex;
+                color: #fff;
+
+                .plcsz-but {
+                    background-color: #004A92;
+                    font-size: 12px;
+                    padding: 0 6px !important;
+                    margin-right: 6px;
+                    border-radius: 4px;
+                    box-sizing: border-box;
+                    margin-left: 20px;
+                    color: #fff;
+                    font-size: 10px;
+                    height: 22px;
+                    line-height: 22px;
+                }
+            }
+        }
+    }
+}
+</style>

+ 79 - 0
control/components/prodnum-MT03/prodnum-MT03.vue

@@ -0,0 +1,79 @@
+<template>
+    <view>
+        <view class="control-title">控制面板</view>
+        <pilotLamp ref="pilotLamp" />
+        <view style="height: 20px;" />
+        <mpattern ref="控制方式" />
+        <tabs :control="control" />
+        <division ref="division" />
+    </view>
+</template>
+
+<script>
+import mpattern from "./modules/mpattern"
+import tabs from "./modules/tabs"
+import pilotLamp from "./modules/pilotLamp"
+import division from "./modules/division"
+export default {
+    name: 'prodnum-MT03',
+    components: { mpattern, tabs, pilotLamp, division },
+    props: {
+        control: Object
+    },
+    watch: {
+        control: function (newVal) {
+            if (newVal) {
+                console.log('MT03', newVal)
+                try {
+                    this.$refs.pilotLamp.list = [{
+                        name: "就地",
+                        value: getBoole('自动信号', 0)
+                    }, {
+                        name: "远程",
+                        value: getBoole('自动信号')
+                    }, {
+                        name: "开到位",
+                        value: getBoole('开到位')
+                    }, {
+                        name: "关到位",
+                        value: getBoole('关到位')
+                    }, {
+                        name: "故障位",
+                        value: getBoole('故障灯')
+                    }]
+                    function getBoole(name, expect = 1) {
+                        try {
+                            return newVal.paramvalues[name].lastvalue == expect
+                        } catch (error) {
+                            console.log("getBoole取值出错项", name)
+                            return false
+                        }
+                    }
+                } catch (error) {
+                    console.error("MT03指示灯", error)
+                }
+                try {
+                    this.$refs.控制方式.ctrlModel = this.__proto__.getControlItem(['控制方式'], newVal, { Ctrl: "radio" })[0];
+                } catch (error) {
+                    console.error("MT03控制方式", error)
+                }
+                try {
+                    let division = this.$refs.division;
+                    division && division.loadData(newVal)
+                } catch (error) {
+                    console.error("MT03分时控制", error)
+                }
+            } else {
+
+            }
+        }
+    },
+    data() {
+        return {
+
+        }
+    },
+}
+</script>
+
+<style></style>

+ 137 - 70
control/modules/My_input.vue

@@ -18,23 +18,35 @@
                             有一条待更新记录,待更新值为:{{ item.paramValue }}{{ item.params.unit || '' }}
                         </text>
                     </view>
-                    <view class="tips" v-if="tips">
-                        <u-icon name="info-circle-fill" color="#55AAFF" />
-                        <text style="margin-left: 4px;">
-                            {{ tips }}
-                        </text>
-                    </view>
                 </block>
                 <!-- 布尔开关 -->
                 <block v-else-if="item.inputType == 'switch'">
                     <view class="title u-line-1">
                         {{ item.funcname || '' }}{{ item.params.unit || '' }}
                     </view>
-                    {{ tips }}
+                    {{ switchTips }}
                 </block>
                 <!-- 步进器 -->
                 <block v-else-if="item.inputType == 'step'">
-                    步进器还没写
+                    <view class="title u-line-1">
+                        {{ item.funcname }}{{ item.params.unit || '' }}
+                    </view>
+                    <u-number-box :asyncChange="true" :min="item.params.num_minvalue" :max="item.params.num_maxvalue"
+                        :step="item.params.num_step" v-model="value" :decimal-length="item.params.num_scale"
+                        @change="stepChange" @focus="stepFocus" @blur="stepBlue" inputWidth="100" />
+                    <!-- </view> -->
+                    <view class="tips" v-if="item.paramValue">
+                        <u-icon name="info-circle-fill" color="#E2201A" />
+                        <text style="margin-left: 4px;">
+                            有一条待更新记录,待更新值为:{{ item.paramValue }}{{ item.params.unit || '' }}
+                        </text>
+                    </view>
+                    <view class="tips">
+                        <u-icon name="info-circle-fill" color="#E2201A" />
+                        <text style="margin-left: 4px;">
+                            受步长限制,手动输入会计算为最接近的合法值
+                        </text>
+                    </view>
                 </block>
                 <!-- 时段 -->
                 <block v-else-if="item.inputType == 'dayParting'">
@@ -56,18 +68,6 @@
                             <u--input :focus="dayPartingFocus" v-model="value" type="digit"
                                 :placeholder="item.params[item.key + 'P'].lastvalue || '请输入'" border="surround" />
                         </view>
-                        <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>
-                        </view>
                     </view>
                 </block>
                 <!-- 选择 -->
@@ -82,25 +82,43 @@
                             {{ 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>
+                </block>
+                <!-- slot -->
+                <block v-else-if="isSlot">
+                    <view class="title u-line-1">
+                        {{ item.funcname || '' }}
                     </view>
+                    <slot />
                 </block>
                 <!-- 其他类型 -->
                 <block v-else>
                     其他类型
                 </block>
+                <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>
+                </view>
             </view>
         </u-modal>
     </view>
 </template>
 <script>
-let model = null;
+import currency from "../../utils/currency";
 export default {
     name: "My_input",
+    props: {
+        customMethod: {
+            type: Function
+        }
+    },
     data() {
         return {
             show: false,
@@ -111,67 +129,103 @@ export default {
             dayPartingFocus: false,
             value: "",
             confirmText: '确定',
-            loading: false
+            loading: false,
+            stepIsCalculate: false,
+            isSlot: false,
+            switchTips: ""
         }
     },
     methods: {
         /**
          * @param item.inputType int:数字 step:步进器 radio:单选 switch:开关 dayParting:分时段
          */
-        openInput(item) {
-            this.item = JSON.parse(JSON.stringify(item))
-            this.show = true
-            let tips = "";
-            this.toBeUpdated = '';
-            let params = item.params;
+        openInput(item, isSlot = false) {
+            try {
+                this.item = JSON.parse(JSON.stringify(item))
+            } catch (error) {
+                console.log("item JSON.parse 失败")
+                this.item = item
+            }
+            this.switchTips = "";
+            this.show = true;
+            let tips = "",
+                toBeUpdated = '';
             this.confirmText = '确定'
-            if (item.inputType == 'int') {
-                this.value = "";
-                this.intFocus = false;
-                if (params.num_minvalue || params.num_maxvalue) tips += `输入范围:${params.num_minvalue || 0} ~ ${params.num_maxvalue || '∞'}`
-                if (params.num_scale) tips += `,保留${params.num_scale}位小数`
-                if (params.num_step) tips += `,增量${params.num_step || 0}`
-                if (tips && params.unit) tips += `,单位${params.unit}`
-                setTimeout(() => {
-                    this.intFocus = true
-                }, 300);
-            } else if (item.inputType == "switch") {
-                let paramValue = item.paramValue + "";
-                if (paramValue.length && paramValue != item.params.lastvalue) {
-                    this.confirmText = '取消修改'
-                    tips = `查询到“${item.funcname}”有待更新记录,待更新值为“${params.options.find(v => v.value == item.paramValue).label}”;您可通过“${this.confirmText}”按钮取消待更新请求`
+            if (isSlot) {
+                this.isSlot = true;
+            } else {
+                this.isSlot = false;
+                let params = item.params;
+                if (item.inputType == 'int') {
+                    this.value = "";
+                    this.intFocus = false;
+                    if (params.num_minvalue || params.num_maxvalue) tips += `输入范围:${params.num_minvalue || 0} ~ ${params.num_maxvalue || '∞'}`
+                    if (params.num_scale) tips += `,保留${params.num_scale}位小数`
+                    if (params.num_step) tips += `,增量${params.num_step || 0}`
+                    if (tips && params.unit) tips += `,单位${params.unit}`
+                    setTimeout(() => {
+                        this.intFocus = true
+                    }, 300);
+                } else if (item.inputType == "switch") {
+                    let paramValue = item.paramValue + "";
+                    if (paramValue.length && paramValue != item.params.lastvalue) {
+                        this.confirmText = '取消修改'
+                        this.switchTips = `查询到“${item.funcname}”有待更新记录,待更新值为“${params.options.find(v => v.value == item.paramValue).label}”;您可通过“${this.confirmText}”按钮取消待更新请求`
+                    } else {
+                        this.confirmText = '切换'
+                        this.switchTips = `是否将“${item.funcname}”${this.confirmText}为:“${params.options.find(v => v.value != item.paramValue).label}”`
+                    }
+                } else if (item.inputType == "dayParting") {
+                    this.value = item.params[item.key + 'p'];
+                    this.dayPartingFocus = false;
+                    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);
+                } else if (item.inputType == "radio") {
+                    let paramValue = item.paramValue + "";
+                    if (paramValue.length && paramValue != item.params.lastvalue) {
+                        toBeUpdated = `查询到“${item.funcname}”有待更新记录,待更新值为“${params.options.find(v => v.value == item.paramValue).label}”`
+                    }
+                } else if (item.inputType == "step") {
+                    this.value = params.lastvalue;
+                    if (this.value > params.num_maxvalue) this.value = params.num_maxvalue;
+                    if (this.value < params.num_minvalue) this.value = params.num_minvalue;
+                    if (params.num_minvalue || params.num_maxvalue) tips += `输入范围:${params.num_minvalue || 0} ~ ${params.num_maxvalue || '∞'}`
+                    if (params.num_scale) tips += `,保留${params.num_scale}位小数`
+                    if (params.num_step) tips += `,增量${params.num_step || 0}`
+                    if (tips && params.unit) tips += `,单位${params.unit}`
+                    setTimeout(() => {
+                        this.intFocus = true
+                    }, 300);
                 } else {
-                    this.confirmText = '切换'
-                    tips = `是否将“${item.funcname}”${this.confirmText}为:“${params.options.find(v => v.value != item.paramValue).label}”`
-                }
-            } else if (item.inputType == "dayParting") {
-                this.value = item.params[item.key + 'p'];
-                this.dayPartingFocus = false;
-                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);
-            } 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}”`
+                    console.log(item)
                 }
-            } else {
-                console.log(item)
             }
             this.tips = tips;
+            this.toBeUpdated = toBeUpdated;
         },
         onSelected(option, mode) {
-            console.log(option, mode)
             if (mode == "radio") {
                 this.item.params.lastvalue = option.value;
             }
         },
+        stepChange(e) {
+            if (!this.stepIsCalculate) this.value = e.value;
+        },
+        stepFocus(e) {
+            this.stepIsCalculate = true;
+        },
+        stepBlue(e) {
+            const { num_step, num_scale } = this.item.params;
+            this.value = currency(currency(e.value, { increment: num_step, precision: num_scale }).format()).value;
+            this.stepIsCalculate = false;
+        },
         /* 时段修改 */
         changeT_T(e) {
             this.item.params[this.item.key + 'T'].lastvalue = e.detail.value;
@@ -185,6 +239,7 @@ export default {
         },
         confirm() {
             if (this.loading) return;
+            if (this.isSlot) return this.$emit("customMethod", "confirm")
             let item = this.item,
                 params = item.params,
                 value = "";
@@ -303,5 +358,17 @@ export default {
         }
 
     }
+
+    /* 步进器样式 */
+    /deep/ .u-number-box__minus,
+    /deep/.u-number-box__plus {
+        height: 30px !important;
+        width: 40px !important;
+    }
+
+    /deep/ .u-number-box__input {
+        height: 30px !important;
+        width: 100px !important;
+    }
 }
 </style>

+ 2 - 2
control/modules/controlItem.vue

@@ -1,5 +1,5 @@
 <template>
-    <view class="box" hover-class="navigator-hover">
+    <view class="controlItem" hover-class="navigator-hover">
         <view class="funcname u-line-1" :style="{ paddingRight: item.isfeedback ? '10px' : '' }">
             {{ item.funcname }}
         </view>
@@ -21,7 +21,7 @@ export default {
 </script>
 
 <style lang="scss" scoped>
-.box {
+.controlItem {
     position: relative;
     width: 175px;
     height: 60px;

+ 0 - 1
pages/facility/detail.vue

@@ -126,7 +126,6 @@ export default {
 <style lang="scss" scoped>
 .ceiling {
     position: sticky;
-    box-shadow: rgba(0, 0, 0, 0.18) 0px 2px 4px;
     z-index: 9;
 }
 

+ 1 - 0
pages/facility/modules/horizontalDirection.vue

@@ -51,6 +51,7 @@ export default {
     border-radius: 4px;
     margin: 15px auto 0;
     height: 62px;
+    box-shadow: rgba(0, 0, 0, 0.18) 0px 2px 4px;
 
     .box {
         display: flex;

+ 1 - 0
pages/facility/modules/tabs.vue

@@ -39,6 +39,7 @@ export default {
     border-radius: 4px;
     background: #fff;
     margin: 15px auto 0;
+    box-shadow: rgba(0, 0, 0, 0.18) 0px 2px 4px;
 }
 
 /deep/ .uni-scroll-view,

+ 6 - 3
pages/index/modules/mine.vue

@@ -58,11 +58,11 @@
 		<u-button :customStyle="butStyle" @click="logOut()">退出登录</u-button>
 
 		<u-popup :show="showPopup" :customStyle="popupStyle" bgColor="#F7F7F7" :overlay="false" zIndex="9998" mode="left"
-			@close="showPopup = false">
+			@close="closePopup">
 			<view :style="{ 'height': spaceUsage }" />
 			<view class="head-p">
 				账号信息
-				<text class="cuIcon-close" @click="showPopup = false" />
+				<text class="cuIcon-close" @click="closePopup" />
 			</view>
 
 			<upload maxCount="1" @uploadCallback="uploadCallback">
@@ -129,7 +129,7 @@
 				</block>
 			</view>
 		</u-popup>
-		<u-overlay :show="showPopup" zIndex="9997" @click="showPopup = false" />
+		<u-overlay :show="showPopup" zIndex="9997" @click="closePopup" />
 		<u-modal :show="changeUser.showModal" @confirm="changeUserMsg" @cancel="onCancel" showCancelButton ref="uModal"
 			:asyncClose="true">
 			<view class="modal-content">
@@ -208,6 +208,9 @@ export default {
 				this.inputFocus = true
 			}, 100)
 		},
+		closePopup() {
+			this.showPopup = false;
+		},
 		onCancel() {
 			this.changeUser.showModal = false
 			this.inputFocus = false