Przeglądaj źródła

更新代码,添加活跃状态,添加获取当前原始点位值

chuwu 5 lat temu
rodzic
commit
4fd5e75dd4

+ 6 - 0
src/fetch/point_http.js

@@ -290,6 +290,12 @@ export function queryAllPointRela(param, success) {
     return post(`${point}/relation/check-original`, data, success)
 }
 
+//获取当前值
+export function getPointValue(param, success) {
+    let data = param.data
+    return post(`${point}/point/${param.type}/original-present`, data, success)
+}
+
 /******************数据字典-单位接口***************************************************** */
 
 export function batchQueryUnit(param, success) {

+ 4 - 4
src/utils/point_edit/handson_header.js

@@ -164,15 +164,15 @@ let common = [{
     },
     {
         InfoPointName: "原始数值",
-        InfoPointCode: "",
-        InputMode: "B1",
+        InfoPointCode: "pointValue",
+        InputMode: "X",
         Visible: true,
         FirstTag: ""
     },
     {
         InfoPointName: "采集时间",
-        InfoPointCode: "",
-        InputMode: "B1",
+        InfoPointCode: "pointDate",
+        InputMode: "X",
         Visible: true,
         FirstTag: ""
     },

+ 35 - 19
src/views/point/config_point/steps/index.vue

@@ -3,18 +3,21 @@
         <!-- <bread class="bread-view"></bread> -->
         <div class="saga-btns-view">
             <template v-for="(item,index) in jsonTitle">
-                <div
-                    :key="index"
-                    @click="changeStep(index)"
-                    class="saga-steps-btn pointer saga-size3"
-                >
-                    <div class="border-view">
-                        <div class="point-step">{{index + 1}}</div>
-                        <div class="jiao"></div>
-                        <div class="point-title">{{item}}</div>
+                    <div
+                        :key="index"
+                        @click="changeStep(index)"
+                        class="saga-steps-btn pointer saga-size3"
+                        :class="{
+                            'active-steps': activeStep == index + 1
+                        }"
+                    >
+                        <div class="border-view">
+                            <div class="point-step">{{index + 1}}</div>
+                            <div class="jiao"></div>
+                            <div class="point-title">{{item}}</div>
+                        </div>
                     </div>
-                </div>
-            </template>
+</template>
         </div>
         <div class="main-view">
         <step1 ref="step" v-if="activeStep == 1"></step1>
@@ -99,14 +102,12 @@
             flex-flow: column;
         }
         .saga-btns-view {
-            background-color: #fff;
-            // display: flex;
+            background-color: #fff; // display: flex;
             // justify-content: space-around;
             padding: 20px 0;
             box-sizing: border-box;
             height: 80px;
             text-align: center;
-
             .saga-steps-btn {
                 display: inline-block;
                 width: 250px;
@@ -129,14 +130,14 @@
                     box-sizing: border-box;
                     position: relative;
                     flex: 1;
-                    .jiao{
+                    .jiao {
                         display: inline-block;
                         border-top: 17px solid transparent;
                         border-left: 17px solid #C2CEDB;
                         border-bottom: 17px solid transparent;
                         position: relative;
                         float: left;
-                        &::after{
+                        &::after {
                             content: '';
                             position: absolute;
                             top: -17px;
@@ -151,9 +152,8 @@
                         padding: 0 9px;
                         float: left;
                     }
-                    .point-title{
-                        float: left;
-                        // padding-left: 10px;
+                    .point-title {
+                        float: left; // padding-left: 10px;
                         // padding-right: 22px;
                         width: 168px;
                     }
@@ -164,6 +164,22 @@
                 // vertical-align: middle;
                 // padding: 0 30px;
             }
+            .active-steps {
+                background-color: rgb(179, 216, 255);
+                .border-view {
+                    border-color: #5BA7FF;
+                    .point-step {
+                        background-color: #5BA7FF;
+                        color: #fff;
+                    }
+                    .jiao {
+                        border-left-color: #5BA7FF;
+                        &::after {
+                            border-left-color: #5BA7FF;
+                        }
+                    }
+                }
+            }
         }
     }
 </style>

+ 39 - 38
src/views/point/config_point/steps/step1.vue

@@ -7,7 +7,7 @@
             <el-button style="float:right;margin-top:4px;" @click="updateExcel = true">导入Excel</el-button>
             <el-button style="float:right;margin-top:4px;" @click="downloadExcel = true">导出Excel模板</el-button>
             <el-checkbox style="float:right;line-height:40px;" @change="getData" v-model="checked">只显示使用的原始点位</el-checkbox>
-            <el-button>获取原始点位当前值</el-button>
+            <el-button @click="clickPointVal">获取原始点位当前值</el-button>
         </div>
         <div id="handsontableSteps1" v-loading="isLoading">
             <handsontable-component v-if="!!allData.length" @delete="delePoint" ref="handsontable" @mouseDown="clickTable" @change="changeHand"></handsontable-component>
@@ -58,7 +58,8 @@
         createPoint,
         downloadTemplete,
         uploadPointFile,
-        deletePoint
+        deletePoint,
+        getPointValue
     } from "@/fetch/point_http"
     import uploadFile from "@/components/common/uploadFile"
     import axios from 'axios'
@@ -120,8 +121,37 @@
             closeFalg() {
                 this.localtionDialog = false
             },
+            clickPointVal(){
+                let data = this.hot.getSourceData()
+                if(!data || !data.length){
+                    return false
+                }
+                console.log(data,'data')
+                let param = {
+                    data: {
+                        DataSourceId: this.datasourceId,
+                        PointIds: data.map(item => {
+                            return item.Id
+                        })
+                    },
+                    type: this.protocolType
+                }
+                getPointValue(param,res => {
+                    console.log(res,'res')
+                    if(!!res.Content && res.Content.length){
+                        data.map(item => {
+                            res.Content.map(child => {
+                                if(item.Id == child.PointId){
+                                    item.pointValue = child.Data.Data
+                                    item.pointDate = child.Data.Time
+                                }
+                            })
+                            return item
+                        })
+                    }
+                })
+            },
             changeLoc(val) {
-                console.log(val, 'val')
                 this.renderData.LocationFlag = val
                 this.changeFlag = false
             },
@@ -218,33 +248,6 @@
                 }).catch(function(err) {
                     console.dirxml(err);
                 })
-                // downloadTemplete({
-                //     data: {
-                //         DataSourceId: this.datasourceId,
-                //     },
-                //     type: this.protocolType
-                // },{
-                //     responseType: 'blob'
-                // },res => {
-                //     var blob = new Blob([res.data], {
-                //         type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'
-                //     });
-                //     var fileName = res.headers['content-disposition'];
-                //     if (fileName)
-                //         fileName = fileName.substring(fileName.indexOf('=') + 1);
-                //     if ('download' in document.createElement('a')) { // 非IE下载
-                //         const elink = document.createElement('a')
-                //         elink.download = fileName
-                //         elink.style.display = 'none'
-                //         elink.href = URL.createObjectURL(blob)
-                //         document.body.appendChild(elink)
-                //         elink.click()
-                //         URL.revokeObjectURL(elink.href) // 释放URL 对象
-                //         document.body.removeChild(elink)
-                //     } else { // IE10+下载
-                //         navigator.msSaveBlob(blob, fileName)
-                //     }
-                // })
             },
             //点击表格
             clickTable(info, row) {
@@ -311,7 +314,6 @@
                     currentPage: this.pages.currentPage
                 }
                 queryPoint(param, res => {
-                    console.log(res)
                     this.isLoading = false
                     this.changeFlag = true
                     this.allData = res.Content || []
@@ -327,7 +329,6 @@
                     data: this.allData,
                     colHeaders: changeHeader(header),
                     columns: showTypes(header),
-                    // colWidths: width,
                     rowHeights: 30,
                     maxRows: this.allData.length,
                     contextMenu: {
@@ -363,15 +364,16 @@
                         arr1 = [],
                         createList = [];
                     data.map(item => {
-                        // console.log(item.LocationFlag,1111)
                         if (!!item.Id) {
-                            // if(!item.LocationFlag){
-                            //     item.LocationFlag = []
-                            // }
                             console.log(item)
                             delete item.CreateTime
                             delete item.LastUpdate
-                            console.log(item)
+                            if(item.hasOwnProperty('pointDate')){
+                                delete item.pointDate
+                            }
+                            if(item.hasOwnProperty('pointValue')){
+                                delete item.pointValue
+                            }
                             arr1.push(item)
                             updateList.push(item)
                         } else {
@@ -401,7 +403,6 @@
                 this.changeFlag = true
             },
             async create(obj) {
-                console.log(obj)
                 for (let key in obj) {
                     if (key == "LocationFlag" && obj[key] == "") {
                         obj[key] = []