GuoYuFu123 5 anni fa
parent
commit
e584e16110

+ 1 - 1
src/components/config_point/step3_edit/enum_handle.vue

@@ -111,7 +111,7 @@ export default {
         .left {
             position: absolute;
             top: -35px;
-            left: -11px;
+            left: 23px;
         }
         .right {
             position: absolute;

+ 5 - 4
src/components/config_point/step3_edit/formula_handle.vue

@@ -98,10 +98,11 @@ export default {
                     }
                     if (this.valCountVal) {
                         if (!this.markValue) {
-                            this.$message({
-                                message: '请填写数值计算',
-                                type: 'warning'
-                            })
+                            // this.$message({
+                            //     message: '请填写数值计算',
+                            //     type: 'warning'
+                            // })
+                            cb(false)
                             return
                         } else {
                             this.form.mark = this.mark

+ 158 - 139
src/components/config_point/step3_edit/split_handle.vue

@@ -2,9 +2,14 @@
     <div class='edit-box'>
         <el-form v-if='form.devArr.length' class='form' ref='form' :model='form' label-width='140px'>
             <div class='dev-know' v-for='(item,index) in form.devArr' :key='index'>
-                <el-form-item v-if='devFlag' label='设备标识' :prop='"devArr." + index + ".EquipmentMark"' :rules='{
+                <el-form-item
+                    v-if='devFlag'
+                    label='设备标识'
+                    :prop='"devArr." + index + ".EquipmentMark"'
+                    :rules='{
           required: true, message: "设备标识不能为空", trigger: "blur"
-        }'>
+        }'
+                >
                     <el-input v-model='item.EquipmentMark'></el-input>
                 </el-form-item>
                 <p class='strsub'>
@@ -19,23 +24,31 @@
             </div>
             <p class='tranf-box'>
                 需要将截取值转换为标准值
-                <el-switch v-model='tranfVal' style="margin-left:12px" active-color='#13ce66' inactive-color='#ff4949'></el-switch>
+                <el-switch v-model='tranfVal' style='margin-left:12px' active-color='#13ce66' inactive-color='#ff4949'></el-switch>
             </p>
             <ul class='point-box'>
                 <span class='left'>如果</span>
                 <span class='right'>那么</span>
                 <li v-for='(item,index) in form.pointArr' :key='index'>
                     <p>
-                        <el-form-item label='原始点位值' :prop='"pointArr." + index + ".from"' :rules='{
+                        <el-form-item
+                            label='原始点位值'
+                            :prop='"pointArr." + index + ".from"'
+                            :rules='{
           required: tranfVal?true: false, message: "不能为空", trigger: "blur"
-        }'>
+        }'
+                        >
                             <el-input v-model='item.from' :disabled='!tranfVal'></el-input>
                         </el-form-item>
                     </p>
                     <p>
-                        <el-form-item label='转换为标准值' :prop='"pointArr." + index + ".to"' :rules='{
+                        <el-form-item
+                            label='转换为标准值'
+                            :prop='"pointArr." + index + ".to"'
+                            :rules='{
           required: tranfVal?true: false, message: "不能为空", trigger: "blur"
-        }'>
+        }'
+                        >
                             <el-input v-model='item.to' :disabled='!tranfVal'></el-input>
                         </el-form-item>
                         <i v-if='index > 0' class='el-icon-delete delete' @click='deleteRow(index)'></i>
@@ -50,161 +63,167 @@
 </template>
 
 <script>
-    export default {
-        name: 'step3_auto-handle',
-        data() {
-            return {
-                form: {
-                    devArr: [{
+export default {
+    name: 'step3_auto-handle',
+    data() {
+        return {
+            form: {
+                devArr: [
+                    {
                         EquipmentMark: '',
                         SplitStart: 1,
                         SplitEnd: 1
-                    }],
-                    pointArr: []
-                },
-                tranfVal: true
-            }
-        },
-        props: {
-            devFlag: {
-                default: true,
-                type: Boolean
-            },
-            splitHandleShow: {}
-        },
-        methods: {
-            getForm(cb) {
-                this.$refs['form'].validate(valid => {
-                    if (valid) {
-                        this.form.tranfVal = this.tranfVal;
-                        cb(this.form)
-                    } else {
-                        cb(false)
                     }
-                })
-            },
-            addDevs() {
-                this.form.devArr.push(this.newDevs())
+                ],
+                pointArr: []
             },
-            newDevs() {
-                return {
-                    EquipmentMark: '',
-                    SplitStart: 1,
-                    SplitEnd: 1
+            tranfVal: true
+        }
+    },
+    props: {
+        devFlag: {
+            default: true,
+            type: Boolean
+        },
+        splitHandleShow: {}
+    },
+    methods: {
+        getForm(cb) {
+            this.$refs['form'].validate(valid => {
+                if (valid) {
+                    this.form.tranfVal = this.tranfVal
+                    cb(this.form)
+                } else {
+                    cb(false)
                 }
-            },
-            delDev(index) {
-                this.form.devArr.splice(index, 1)
-            },
-            addRules() {
-                this.form.pointArr.push(this.newRules())
-            },
-            newRules() {
-                return {
+            })
+        },
+        addDevs() {
+            this.form.devArr.push(this.newDevs())
+        },
+        newDevs() {
+            return {
+                EquipmentMark: '',
+                SplitStart: 1,
+                SplitEnd: 1
+            }
+        },
+        delDev(index) {
+            this.form.devArr.splice(index, 1)
+        },
+        addRules() {
+            this.form.pointArr.push(this.newRules())
+        },
+        newRules() {
+            return {
+                from: '',
+                to: ''
+            }
+        },
+        deleteRow(index) {
+            if (!this.tranfVal) {
+                return false
+            }
+            this.form.pointArr.splice(index, 1)
+        },
+        init() {
+            this.form.pointArr = [
+                {
                     from: '',
                     to: ''
                 }
-            },
-            deleteRow(index) {
-                if (!this.tranfVal) {
-                    return false
-                }
-                this.form.pointArr.splice(index, 1)
-            },
-            init() {
-                this.form.pointArr = [{
-                    from: '',
-                    to: ''
-                }]
-            }
-        },
-        watch: {
-            splitHandleShow: {
-                immediate: true,
-                deep: true,
-                handler(val) {
-                    if (val) {
-                        this.form = val;
-                        // console.log(this.form)
-                    } else {
-                        this.init()
-                    }
+            ]
+        }
+    },
+    watch: {
+        splitHandleShow: {
+            immediate: true,
+            deep: true,
+            handler(val) {
+                if (val) {
+                    this.form = val
+                    // console.log(this.form)
+                } else {
+                    this.init()
                 }
             }
         }
     }
+}
 </script>
 
 <style scoped lang='scss'>
-    .edit-box {
-        .form {
-            .dev-know {
-                margin-top: 5px;
-                background: #e6e6e6;
-                padding: 5px 50px 5px 0;
-                width: 470px;
-                position: relative;
-                .del-sub-icon {
-                    position: absolute;
-                    right: 15px;
-                    top: 50px;
-                    cursor: pointer;
-                }
-                .strsub {
-                    padding-left: 20px;
-                }
-            }
-        }
-        .tranf-box {
-            height: 50px;
-            line-height: 80px;
-        }
-        .point-box {
-            margin-top: 45px;
+.edit-box {
+    .form {
+        .dev-know {
+            margin-top: 5px;
+            background: #e6e6e6;
+            padding: 5px 50px 5px 0;
+            width: 470px;
             position: relative;
-            width: 500px;
-            .left,
-            .right {
-                font-size: 20px;
-                 background: #fff;
-            }
-            .left {
+            .del-sub-icon {
                 position: absolute;
-                top: -25px;
-                left: -11px;
+                right: 15px;
+                top: 50px;
+                cursor: pointer;
             }
-            .right {
-                position: absolute;
-                top: -25px;
-                left: 260px;
+            .strsub {
+                padding-left: 20px;
             }
-            li {
-                display: flex;
-                justify-content: space-between;
-                margin-top: 5px;
-                position: relative;
-                p {
-                    .name {
-                        padding-left: 40px;
-                    }
-                    .value {
-                        margin-left: 10px;
-                        display: inline-block;
-                        width: 80px;
-                    }
+        }
+    }
+    .tranf-box {
+        height: 50px;
+        line-height: 80px;
+    }
+    .point-box {
+        margin-top: 45px;
+        position: relative;
+        width: 500px;
+        .left,
+        .right {
+            font-size: 20px;
+            background: #fff;
+        }
+        .left {
+            position: absolute;
+            top: -35px;
+            left: 23px;
+        }
+        .right {
+            position: absolute;
+            top: -35px;
+            left: 260px;
+            margin: 0;
+            padding: 0;
+        }
+        li {
+            display: flex;
+            justify-content: space-between;
+            margin-top: 5px;
+            position: relative;
+            p {
+                .name {
+                    padding-left: 40px;
                 }
-                .delete {
-                    top: 5px;
-                    right: -20px;
-                    cursor: pointer;
-                    position: absolute;
-                    z-index: 99999;
+                .value {
+                    margin-left: 10px;
+                    display: inline-block;
+                    width: 80px;
                 }
             }
+            .delete {
+                top: 5px;
+                right: -20px;
+                cursor: pointer;
+                position: absolute;
+                z-index: 99999;
+            }
         }
-        .add-btn-box {
-            margin-top: 20px;
-            text-align: center;
-        }
     }
+    .add-btn-box {
+        margin-top: 20px;
+        text-align: center;
+    }
+}
 </style>

+ 47 - 32
src/components/config_point/step3_point/3_temps.vue

@@ -47,7 +47,7 @@
                 <auto-handle :devFlag="false" ref='autoHandle' v-else-if='form2.DataRuleType == "需自动单位转换"' :unitObj='unitObj'></auto-handle>
                 <enum-handle :devFlag="false" ref='enumHandle' v-else-if='form2.DataRuleType == "需按设置枚举转换"'></enum-handle>
                 <formula-handle :devFlag="false" ref='formulaHandle' v-else-if='form2.DataRuleType == "需按公式转换"'></formula-handle>
-                <split-handle :devFlag="false" ref='splitHandle' v-else></split-handle>
+                <split-handle :devFlag="false" ref='splitHandle' v-else-if='form2.DataRuleType == "需按拆分枚举转换"'></split-handle>
             </el-form>
             <div class="center">
                 <el-button @click="undo">上一步</el-button>
@@ -247,26 +247,32 @@
                 })
             },
             next() {
+                console.log(this.$refs,'next')
+                var that = this;
                 if (this.activeName == 0) {
                     this.$refs.form.validate((isOk, obj) => {
-                        console.log(isOk, obj)
                         if (isOk) {
-                            console.log(this.form1)
                             this.form2 = Object.assign(this.form2, this.form1)
-                            console.log(this.form2)
                             this.activeName += 1
+                        } else {
+                            this.errMsg()
                         }
                     })
                 } else if (this.activeName == 1) {
                     this.$refs['form2'].validate(valid => {
                         if (valid) {
                             var flag = this.form2.DataRuleType
+                            var isNext = true;
+                            console.log('***************fugy******************')
+                            console.log(flag)
                             switch (flag) {
                                 case '无需处理,直接使用':
-                                    // this.$refs.noHandle.getForm(noHandle => {
-                                    //     if (noHandle) {
-                                    this.saveForm(this.form2, {})
+                                // console.log(this.$refs)
+                                //     this.$refs.noHandle.getForm(noHandle => {
+                                //         if (noHandle) {
+                                            this.saveForm(this.form2, {})
                                     //     } else {
+                                    //         isNext = false
                                     //         this.errMsg()
                                     //     }
                                     // })
@@ -276,6 +282,7 @@
                                         if (autoHandle) {
                                             this.saveForm(this.form2, autoHandle)
                                         } else {
+                                            isNext = false
                                             this.errMsg()
                                         }
                                     })
@@ -285,54 +292,62 @@
                                         if (enumHandle) {
                                             this.saveForm(this.form2, enumHandle)
                                         } else {
+                                            isNext = false
                                             this.errMsg()
                                         }
                                     })
                                     break
                                 case '需按公式转换':
+                                console.log('*(&*^&*^*^%*^&*')
                                     this.$refs.formulaHandle.getForm(formulaHandle => {
+                                        console.log(formulaHandle)
                                         if (formulaHandle) {
                                             this.saveForm(this.form2, formulaHandle)
                                         } else {
+                                            isNext = false
                                             this.errMsg()
                                         }
                                     })
                                     break
-                                case '需拆分处理':
+                                case '需按拆分枚举转换':
                                     this.$refs.splitHandle.getForm(splitHandle => {
                                         if (splitHandle) {
                                             this.saveForm(this.form2, splitHandle)
                                         } else {
+                                            isNext = false
                                             this.errMsg()
                                         }
                                     })
                                     break
                             }
-                            this.activeName += 1
-                            let setting = {
-                                data: this.renderData,
-                                maxRows: this.renderData.length,
-                                colHeaders: ['设备标识', '原始点位描述', '位置标签', '备注'],
-                                columns: [{
-                                        data: 'EquipmentMark'
-                                    },
-                                    {
-                                        data: 'Description',
-                                        readOnly: true
-                                    },
-                                    {
-                                        data: 'LocationFlag',
-                                        readOnly: true
-                                    },
-                                    {
-                                        data: 'Remarks',
-                                        readOnly: true
-                                    }
-                                ]
+                            if(isNext) {
+                                this.activeName += 1
+                                let setting = {
+                                    data: this.renderData,
+                                    maxRows: this.renderData.length,
+                                    colHeaders: ['设备标识', '原始点位描述', '位置标签', '备注'],
+                                    columns: [{
+                                            data: 'EquipmentMark'
+                                        },
+                                        {
+                                            data: 'Description',
+                                            readOnly: true
+                                        },
+                                        {
+                                            data: 'LocationFlag',
+                                            readOnly: true
+                                        },
+                                        {
+                                            data: 'Remarks',
+                                            readOnly: true
+                                        }
+                                    ]
+                                }
+                                this.$nextTick(_ => {
+                                    this.hot = this.$refs.handsontable.init(setting)
+                                })
                             }
-                            this.$nextTick(_ => {
-                                this.hot = this.$refs.handsontable.init(setting)
-                            })
+
                         } else {
                             this.errMsg()
                             return false