Explorar o código

调试部分接口

chuwu %!s(int64=6) %!d(string=hai) anos
pai
achega
6018e24694

+ 4 - 2
src/components/common/handsontable.vue

@@ -217,6 +217,8 @@
         }
     }
 </script>
-<style lang="scss" scoped>
-
+<style lang="scss">
+    .htDropdownMenu:not(.htGhostTable){
+        z-index: 4060;
+    }
 </style>

+ 5 - 2
src/components/config_point/data_origin.vue

@@ -21,7 +21,10 @@
         },
         props: {
             id: {
-                type: String
+                type: String,
+                default: function createRandomId() {
+                    return (Math.random() * 10000000).toString(16).substr(0, 4) + '-' + (new Date()).getTime() + '-' + Math.random().toString().substr(2, 5);
+                }
             },
             renderData: {
                 type: Object,
@@ -61,7 +64,7 @@
         watch:{
             renderData: {
                 deep: true,
-                handle: function(){
+                handler: function(){
                     this.changeData()
                 }
             }

+ 208 - 8
src/components/config_point/examine_main.vue

@@ -1,23 +1,223 @@
 <template>
     <div>
-        <select-one :name="'原始点位描述中识别的设备类型'"></select-one>
-        <select-one :name="'已标准化的设备标识'"></select-one>
+        <select-one @check="typeCheck" :renderData="typeArr" infosKey="EquipmentType" name="原始点位描述中的设备类型关键字"></select-one>
+        <select-one @check="paramCheck" :renderData="identifyArr" infosKey="ownMess" name="原始点位描述中设备参数关键字"></select-one>
+        <div class="handson-view saga-border">
+            <div v-if="hotData.length" class="h100">
+                <div class="title-view">
+                    <el-input v-model="inputValue" placeholder="批量填充空白的值/单位说明" style="width:200px;"></el-input>
+                    <span class="w10"></span>
+                    <el-button @click="fullValue">批量填充值/单位说明</el-button>
+                </div>
+                <div class="handson-main">
+                    <handsontable-component ref="handsontable"></handsontable-component>
+                </div>
+                <div class="center">
+                    <el-button @click="saveData">保存修改</el-button>
+                </div>
+            </div>
+            <div v-else class="center">
+                暂无数据
+            </div>
+        </div>
     </div>
 </template>
 <script>
+    import {
+        mapGetters,
+        mapActions
+    } from "vuex";
+    import {
+        queryAllEqTypeList,
+        queryAllEqParamList,
+        queryPoint,
+        updatePoint
+    } from "fetch/point_http"
     import selectOne from "components/config_point/select_one"
+    import handsontableComponent from "components/common/handsontable"
     export default {
-        components:{
-            selectOne
+        components: {
+            selectOne,
+            handsontableComponent
+        },
+        computed: {
+            ...mapGetters("project", [
+                "projectId",
+                "datasourceId",
+                "protocolType"
+            ])
         },
         data() {
-            return {}
+            return {
+                typeArr: [],
+                identifyArr: [],
+                EquipmentType: "",
+                EquipmentParameter: "",
+                inputValue: "",
+                header: ['原始点位描述', '值/单位说明', '*识别的设备类型关键字', '*识别的设备参数关键字'],
+                type: [{
+                        data: 'RoutingKey',
+                        readOnly: true
+                    },
+                    {
+                        data: 'ValueDescription'
+                    },
+                    {
+                        data: 'KeyEquipmentType'
+                    },
+                    {
+                        data: 'KeyEquipmentParameter'
+                    }
+                ],
+                hot: "",
+                hotData: []
+            }
+        },
+        created() {
+            this.getTypes()
         },
-        created() {},
         mounted() {},
-        methods: {}
+        methods: {
+            //保存数据
+            saveData(){
+                let param = this.hot.getSourceData().map(item => {
+                    return {
+                        ValueDescription: item.ValueDescription || null,
+                        KeyEquipmentType: item.KeyEquipmentType || null,
+                        KeyEquipmentParameter: item.KeyEquipmentParameter || null,
+                        Id: item.Id,
+                        DatasourceId: item.DatasourceId
+                    }
+                })
+                console.log(param)
+                updatePoint({
+                    data: {Content: param},
+                    type: this.protocolType
+                },res => {
+                    console.log(res)
+                    this.typeCheck()
+                })
+            },
+            //填充值被点击
+            fullValue(){
+                if(!this.inputValue){
+                    return false
+                }
+                this.hotData.map(item => {
+                    //如果没有值
+                    if(!item.ValueDescription){
+                        item.ValueDescription = this.inputValue
+                    }
+                })
+            },
+            //设备类型被点击
+            typeCheck(item) {
+                this.EquipmentType = item.EquipmentType == "空" ? "" : item.EquipmentType
+                this.getParam()
+            },
+            //设备参数被点击
+            paramCheck(item) {
+                console.log(item, "设备参数")
+                this.inputValue = ""
+                if (!!item) {
+                    this.EquipmentParameter = (item.EquipmentParameter == "空" || !item.EquipmentParameter) ? null : item.EquipmentParameter
+                    this.queryPoint()
+                } else {
+                    this.hotData = []
+                    return false
+                }
+            },
+            //获取点位列表
+            queryPoint() {
+                console.log(this.EquipmentType, this.EquipmentParameter, "EquipmentParameter")
+                let param = {
+                        data: {
+                            Filters: {
+                                DataSourceId: this.datasourceId,
+                                ProjectId: this.projectId,
+                                KeyEquipmentParameter: this.EquipmentParameter,
+                                KeyEquipmentType: this.EquipmentType
+                            }
+                        },
+                        type: this.protocolType
+                    },
+                    width, settings
+                console.log(param.data)
+                queryPoint(param, res => {
+                    this.hotData = res.Content
+                    console.log(res)
+                    if (!!this.hot) {
+                        this.hot.destroy()
+                    }
+                    settings = {
+                        data: this.hotData,
+                        colHeaders: this.header,
+                        columns: this.type,
+                        rowHeights: 30,
+                        maxRows: res.Content.length
+                    }
+                    this.$nextTick(() => {
+                        this.hot = this.$refs.handsontable.init(settings)
+                    })
+                    console.log(this.hot)
+                })
+            },
+            //获取原始点位描述中设备参数关键字
+            getParam() {
+                queryAllEqParamList({
+                    type: this.protocolType,
+                    data: {
+                        DataSourceId: this.datasourceId,
+                        ProjectId: this.projectId,
+                        KeyEquipmentType: this.EquipmentType
+                    }
+                }, res => {
+                    this.identifyArr = res.Content.map(item => {
+                        if (!!item.EquipmentParameter) {
+                            item.ownMess = item.EquipmentParameter + "(涉及原始点位:" + item.PointCount + ")"
+                        } else {
+                            item.ownMess = "空" + "(涉及原始点位:" + item.PointCount + ")"
+                        }
+                        return item
+                    })
+                    console.log(this.identifyArr, "res")
+                })
+            },
+            //获取原始点位描述中的设备类型关键字
+            getTypes() {
+                queryAllEqTypeList({
+                    type: this.protocolType,
+                    data: {
+                        DataSourceId: this.datasourceId,
+                        ProjectId: this.projectId
+                    }
+                }, res => {
+                    // res.Content.unshift({EquipmentType: "空"})
+                    this.typeArr = res.Content
+                    console.log(this.typeArr)
+                })
+            },
+        }
     }
 </script>
 <style lang="scss" scoped>
-
+    .handson-view {
+        height: 340px;
+        width: 480px;
+        float: right;
+        overflow-y: auto;
+    }
+    .title-view {
+        height: 50px;
+        line-height: 50px;
+        padding-left: 10px;
+    }
+    .w10 {
+        width: 10px;
+        display: inline-block;
+    }
+    .handson-main {
+        height: calc(100% - 90px);
+        width: 100%;
+    }
 </style>

+ 89 - 35
src/components/config_point/find_keyword.vue

@@ -1,18 +1,31 @@
 <template>
-    <div>
-        <p class="center">请从下面的原始点位描述中选择"{{title == 'type' ? "设备类型" : "设备参数"}}"关键字</p>
-        <div class="h10"></div>
-        <cut-string :string="Description" ref="cutString"></cut-string>
-        <div class="h10"></div>
-        <el-button @click="getCutString">此条无法识别</el-button>
-        <el-button @click="getCutString">继续发现关键字</el-button>
+    <div class="view-find-word">
+        <div>
+            <p class="center">请从下面的原始点位描述中选择"{{title == 'type' ? "设备类型" : "设备参数"}}"关键字</p>
+            <div class="h10"></div>
+            <cut-string :string="Description" ref="cutString"></cut-string>
+            <div class="h10"></div>
+            <el-button @click="getCutString">此条无法识别</el-button>
+            <el-button @click="getCutString">继续发现关键字</el-button>
+        </div>
+        <div class="find-data">
+            <div class="left-view">
+                <doughnut v-if="!!sum" width="200" height="200" :renderData="echartsData"></doughnut>
+                <div v-else class="center">暂无数据</div>
+            </div>
+            <div class="right-view saga-border">
+
+            </div>
+        </div>
     </div>
 </template>
 <script>
     import cutString from "components/config_point/cut_string"
+    import doughnut from "components/echarts/doughnut"
     import {
         findKeysWord,
-        findKeysWordType
+        findKeysWordType,
+        queryDataSourceCount
     } from "fetch/point_http"
     import {
         mapGetters,
@@ -31,12 +44,15 @@
             ])
         },
         components: {
-            cutString
+            cutString,
+            doughnut
         },
         data() {
             return {
                 title: "",
-                Description: ""
+                Description: "",
+                echartsData: [],
+                sum: 0
             }
         },
         created() {},
@@ -46,35 +62,73 @@
                 console.log(this.$refs.cutString.getData())
             },
             changeType() {
-                if(this.type == "type"){
-                    findKeysWordType({
-                        data: {
-                            DataSourceId: this.datasourceId,
-                            ProjectId: this.projectId
-                        },
-                        type: this.protocolType
-                    },res => {
-                        console.log(res)
-                        this.Description = res.Content.Description
-                    })
-                }else{
-                    findKeysWord({
-                        data: {
-                            DataSourceId: this.datasourceId,
-                            ProjectId: this.projectId
-                        },
-                        type: this.protocolType
-                    },res => {
-                        this.Description = res.Content.Description
-                        console.log(res)
-                    })
+                let queryFun
+                if (this.type == "type") {
+                    queryFun = findKeysWordType
+                } else {
+                    queryFun = findKeysWord
                 }
-            }
+                queryFun({
+                    data: {
+                        DataSourceId: this.datasourceId,
+                        ProjectId: this.projectId
+                    },
+                    type: this.protocolType
+                }, res => {
+                    this.Description = res.Content.Description
+                    console.log(res)
+                })
+                this.findDataForSource()
+            },
+            //查询数据源数据
+            findDataForSource() {
+                queryDataSourceCount({
+                    Filters: {
+                        projectId: this.projectId,
+                        Id: this.datasourceId
+                    }
+                }, res => {
+                    console.log(res, "res")
+                    let data = res.Content[0]
+                    this.echartsData = [
+                        {
+                        name: "无法识别-" + data.Ignorestandard,
+                        value: data.Ignorestandard
+                    },
+                    {
+                        name: "未识别-" + data.Notstandard,
+                        value: data.Notstandard
+                    },
+                    {
+                        name: "已识别-" + data.Notrelated,
+                        value: data.Notrelated
+                    }
+                    ]
+                    this.sum = data.Sum
+                })
+            },
+            
         }
     }
 </script>
 <style lang="scss" scoped>
-    .h10 {
-        height: 10px;
+    .view-find-word {
+        .find-data {
+            height: 300px;
+            .left-view {
+                width: 300px;
+                height: 300px;
+                display: inline-block;
+            }
+            .right-view{
+                width: calc(100% - 305px);
+                height: 300px;
+                overflow-y: auto;
+                display: inline-block;
+            }
+        }
+        .h10 {
+            height: 10px;
+        }
     }
 </style>

+ 34 - 26
src/components/config_point/select_one.vue

@@ -8,12 +8,17 @@
 <template>
     <div class="select-own-one saga-border">
         <p>{{name}}</p>
-        <template v-for="item in renderData">
-            <div @click="checkItem(item)" class="select-item select-bg border-bottom pointer">
-                <span v-if="isOK"></span>
-                {{item[infosKey]}}
-            </div>
-        </template>
+        <ul v-if="renderData.length">
+            <li v-for="(item,index) in renderData">
+                <div @click="checkItem(item,index)"  :class="index == active ? 'saga-active-select': ''" class="select-item select-bg border-bottom pointer">
+                    <span v-if="isOK"></span>
+                    {{item[infosKey]}}
+                </div>
+            </li>
+        </ul>
+        <div v-else>
+            暂无数据
+        </div>
     </div>
 </template>
 <script>
@@ -32,21 +37,6 @@
                 type: Array,
                 default: function() {
                     return [
-                        {
-                            name: "222"
-                        },
-                        {
-                            name: "222"
-                        },
-                        {
-                            name: "222"
-                        },
-                        {
-                            name: "222"
-                        },
-                        {
-                            name: "222"
-                        }
                     ]
                 }
             },
@@ -56,22 +46,41 @@
             }
         },
         data() {
-            return {}
+            return {
+                active: 0,
+            }
         },
         created() {},
         mounted() {},
         methods: {
-            checkItem(item){
-                console.log(item)
+            checkItem(item,index){
                 this.$emit("check",item)
+                this.active = index
+            },
+            change(){
+                this.$emit("check",this.renderData[this.active])
+            }
+        },
+        watch: {
+            renderData: {
+                deep: true,
+                handler: function (){
+                    this.change()
+                    //do something
+                    console.log("change")
+                }
             }
         }
     }
 </script>
 <style lang="scss" scoped>
+.saga-active-select{
+    background-color: #9FC5F8;
+}
     .select-own-one {
         display: inline-block;
         height: 100%;
+        height: 340px;
         width: 230px;
         overflow-y: auto;
     }
@@ -83,7 +92,6 @@
         line-height: 30px;
     }
     .select-item:hover{
-        color: #fff;
-        background-color: red;
+        background-color: #9FC5F8;
     }
 </style>

+ 4 - 1
src/components/echarts/doughnut.vue

@@ -8,7 +8,10 @@
         name: "doughnut",
         props: {
             id: {
-                type: String
+                type: String,
+                default: function createRandomId() {
+                    return (Math.random() * 10000000).toString(16).substr(0, 4) + '-' + (new Date()).getTime() + '-' + Math.random().toString().substr(2, 5);
+                }
             },
             renderData: {
                 type: Array,

+ 0 - 1
src/components/el_pack/dialog.vue

@@ -67,5 +67,4 @@
     }
 </script>
 <style lang="scss" scoped>
-
 </style>

+ 18 - 0
src/fetch/point_http.js

@@ -76,4 +76,22 @@ export function findKeysWord(param, success) {
 export function findKeysWordType(param, success) {
     let data = param.data
     return post(`${point}/point/${param.type}/next-equipment-type`, data, success)
+}
+
+//查询设备类型分组列表(涉及点位数)
+export function queryEqTypeList(param, success) {
+    let data = param.data
+    return post(`${point}/point/${param.type}/group-equipment-type-statis`, data, success)
+}
+
+//查询设备类型分组列表(涉及点位数,包含空)
+export function queryAllEqTypeList(param, success) {
+    let data = param.data
+    return post(`${point}/point/${param.type}/group-equipment-type-statis-all`, data, success)
+}
+
+//查询设备参数分组列表(含空参数)
+export function queryAllEqParamList(param, success) {
+    let data = param.data
+    return post(`${point}/point/${param.type}/group-equipment-parameter-all`, data, success)
 }

+ 8 - 4
src/fetch/request.js

@@ -10,14 +10,18 @@ import router from '@/router/index.js'
  * @return {处理后的字符串}  string
  */
 function delFilters(obj) {
-    let str, key
+    let str = "",
+        key
     for (key in obj) {
-        if (typeof obj[key] == 'string') {
-            str = key + "='" + obj[key] + "';"
+        if (!obj[key] && typeof obj[key] != "undefined" && obj[key] != 0) {
+            str += key + " isNull;"
+        } else if (typeof obj[key] == 'string') {
+            str += key + "='" + obj[key] + "';"
         } else {
-            str = key + "=" + obj[key] + ";"
+            str += key + "=" + obj[key] + ";"
         }
     }
+    console.log(str, "str")
     return str.split(';').map(item => {
         return !!item ? item : undefined
 

+ 2 - 1
src/views/config_point/steps/step2.vue

@@ -14,7 +14,7 @@
         <own-dialog :width="'60%'" :title="title" :dialogVisible="isDialogShow" @cancel="close">
             <find-keyword ref="findKeyword" :type="type"></find-keyword>
         </own-dialog>
-        <own-dialog :width="'60%'" title="关键内容设别——检查&微调" :dialogVisible="examineDialog" @cancel="close">
+        <own-dialog :width="'1000px'" :index="true" title="关键内容设别——检查&微调" :dialogVisible="examineDialog" @cancel="close">
             <!-- <find-keyword ref="findKeyword" :type="type"></find-keyword> -->
             <examine-main></examine-main>
         </own-dialog>
@@ -87,6 +87,7 @@
             },
             close() {
                 this.isDialogShow = false
+                this.examineDialog = false
             },
             //点击检查按钮
             examine(){