zhangyu преди 5 години
родител
ревизия
7f5a49d747
променени са 2 файла, в които са добавени 63 реда и са изтрити 38 реда
  1. 28 8
      src/components/config_point/step3_point/3_temps.vue
  2. 35 30
      src/components/config_point/step3_point/steps3_main.vue

+ 28 - 8
src/components/config_point/step3_point/3_temps.vue

@@ -55,12 +55,15 @@
             </div>
         </div>
         <div class="collapse-item" v-if="activeName == 2">
-            <div style="height:258px;">
+            <div v-if="renderData.length" style="height:258px;">
                 <handsontable-component ref="handsontable"></handsontable-component>
             </div>
+            <div v-if="!renderData.length" class="center" style="padding: 50px 0;box-sizing:border-box;">
+                <i class="iconwushuju iconfont"></i> 暂无数据
+            </div>
             <div class="center">
                 <el-button @click="undo">上一步</el-button>
-                <el-button @click="save">保存</el-button>
+                <el-button v-show="renderData.length" @click="save">保存</el-button>
             </div>
         </div>
     </div>
@@ -82,6 +85,7 @@
         getQueryProperty
     } from '@/fetch/data_plat'
     import {
+        updatePoint,
         batchCreate,
         queryDescription
     } from '@/fetch/point_http'
@@ -233,9 +237,23 @@
                 }).catch(_ => {})
             },
             createParam(params) {
-                batchCreate(params, res => {
-                    this.$message.success("处理成功")
-                    this.$emit("changed")
+                let updateParams = {
+                    data: {
+                        Content:[]
+                    },
+                    type: this.protocolType
+                }
+                params.map((item) =>{
+                    updateParams.data.Content.push({
+                        Id: item.PointId,
+                        EquipmentMark: item.EquipmentMark
+                    })
+                })
+                updatePoint(updateParams, data => {
+                    batchCreate(params, res => {
+                        this.$message.success("处理成功")
+                        this.$emit("changed")
+                    })
                 })
             },
             undo() {
@@ -344,9 +362,11 @@
                                         }
                                     ]
                                 }
-                                this.$nextTick(_ => {
-                                    this.hot = this.$refs.handsontable.init(setting)
-                                })
+                                if (this.renderData.length) {
+                                    this.$nextTick(_ => {
+                                        this.hot = this.$refs.handsontable.init(setting)
+                                    })
+                                }
                             }
 
                         } else {

+ 35 - 30
src/components/config_point/step3_point/steps3_main.vue

@@ -123,42 +123,47 @@
                 } else {
                     //不是空的情况查询点位列表
                     console.log(param)
-                    queryPoint({
-                        data: {
-                            Filters: {
-                                KeyEquipmentParameter: param.EquipmentParameter,
-                                KeyEquipmentType: param.EquipmentType,
-                                DataSourceId: this.datasourceId,
-                                Used: true
-                                // KeyEquipmentParameter: '温度',
-                                // KeyEquipmentType: '冷机'
+                    if (param && param.EquipmentMark) {
+                        queryPoint({
+                            data: {
+                                Filters: {
+                                    KeyEquipmentParameter: param.EquipmentParameter,
+                                    KeyEquipmentType: param.EquipmentType,
+                                    DataSourceId: this.datasourceId,
+                                    Used: true
+                                    // KeyEquipmentParameter: '温度',
+                                    // KeyEquipmentType: '冷机'
+                                },
+                                PageNumber: 1,
+                                PageSize: 100
                             },
-                            PageNumber: 1,
-                            PageSize: 100
-                        },
-                        type: this.protocolType
-                    }, res => {
-                        console.log(res, "reslist")
-                        this.identDataArr = res.Content
-                        this.$refs.ident.getMain(param)
-                    })
+                            type: this.protocolType
+                        }, res => {
+                            console.log(res, "reslist")
+                            this.identDataArr = res.Content
+                            this.$refs.ident.getMain(param)
+                        })
+                    }
                 }
             },
             //通过type获取param的list
             getParamList(item) {
-                this.KeyEquipmentType = item.EquipmentType
-                groupParamRelated({
-                    data: {
-                        DataSourceId: this.datasourceId,
-                        KeyEquipmentType: item.EquipmentType
-                    },
-                    type: this.protocolType
-                }, res => {
-                    this.identifyArr = res.Content.map(item => {
-                        item.ownMess = item.EquipmentParameter
-                        return item
+                if (item && item.EquipmentType) {
+                    this.KeyEquipmentType = item.EquipmentType
+                    groupParamRelated({
+                        data: {
+                            DataSourceId: this.datasourceId,
+                            KeyEquipmentType: item.EquipmentType
+                        },
+                        type: this.protocolType
+                    }, res => {
+                        debugger
+                        this.identifyArr = res.Content.map(item => {
+                            item.ownMess = item.EquipmentParameter
+                            return item
+                        })
                     })
-                })
+                }
             }
         },
         components: {