Browse Source

点位配置第二步ai识别优化,及台账bug处理

zhangyu 5 years ago
parent
commit
fbc7bcb98b

+ 36 - 16
src/components/config_point/cut_string.vue

@@ -27,12 +27,17 @@
         },
         data() {
             return {
-                stringArr: this.string.split(""),
+                // stringArr: this.string.split(""),
                 obj: {},
                 arr: [],
                 keywordIndexArr: []
             }
         },
+        computed: {
+            stringArr(){
+                return this.string.split("")
+            }
+        },
         created() {this.recursiveGetIndex(0)},
         mounted() {},
         methods: {
@@ -45,13 +50,25 @@
                 }
             },
             recursiveGetIndex(start){ //递归获取满足关键字的索引值
-                let index = this.string.indexOf(this.closedStr,start)
+                if (this.closedStr) {
+                    let index = this.string.indexOf(this.closedStr,start)
+                    if(index != -1){
+                        for(let i = 0; i < this.closedStr.length; i++){
+                            this.keywordIndexArr.push(index + i)
+                        }
+                        this.recursiveGetIndex(index + this.closedStr.length)
+                    }
+                } 
+            },
+            aiGetIndex(str){ //递归获取满足ai关键字的索引值
+                let index = this.string.indexOf(str),
+                    arr = []
                 if(index != -1){
-                    for(let i = 0; i < this.closedStr.length; i++){
-                        this.keywordIndexArr.push(index + i)
+                    for(let i = 0; i < str.length; i++){
+                        arr.push(index + i)
                     }
-                    this.recursiveGetIndex(index + this.closedStr.length)
                 }
+                return arr
             },
             checkItem(item, index) {
                 if(this.obj.hasOwnProperty(index)){
@@ -69,25 +86,28 @@
             },
             clear(str) {
                 this.obj = {}
-                this.stringArr = this.string.split("")
+                // this.stringArr = this.string.split("")
                 for(let i = 0; i < this.stringArr.length; i++){
-                    let classList = this.$refs.span[i].getAttribute('class')
-                    if(classList.indexOf('bg') > -1){
-                        classList = classList.split('bg')
+                    if (this.$refs.span && this.$refs.span[i]) {
+                        let classList = this.$refs.span[i].getAttribute('class')
+                        if(classList.indexOf('bg') > -1){
+                            classList = classList.split('bg')
+                        }
+                        this.$refs.span[i].setAttribute('class',classList)
                     }
-                    this.$refs.span[i].setAttribute('class',classList)
                 }
                 if(!!str){
-                    let strsArr = str.split("")
-                    strsArr.map((item,index) => {
-                        for(let j = 0; j < stringArr.length;j++){
-                            if(item == stringArr[j]){
-                                this.obj[j] = item
+                    let aiIndexArr = this.aiGetIndex(str)
+                    // let strsArr = str.split("")
+                    // strsArr.map((item,index) => {
+                        for(let j = 0; j < this.stringArr.length;j++){
+                            if(aiIndexArr.indexOf(j) > -1){
+                                this.obj[j] = this.stringArr[j]
                                 let classList = this.$refs.span[j].getAttribute('class') + ' bg'
                                 this.$refs.span[j].setAttribute('class',classList)
                             }
                         }
-                    })
+                    // })
                 }
             },
             getData() {

+ 1 - 1
src/components/config_point/find_keyword.vue

@@ -102,7 +102,7 @@
                 aiStr: "",//ai推荐
                 Id: "",
                 dataName: "",
-                isSwitch: false,//是否开启开关
+                isSwitch: true,//是否开启开关
                 closedStr: "",//已被选择的数据
             }
         },

+ 2 - 2
src/components/data_admin/buildData/findId.js

@@ -1,8 +1,8 @@
-import { physics } from '@/api/scan/config'
+import { venders } from '@/api/scan/config'
 import http from '@/api/scan/httpUtil'
 
 function getVenderRecommend(param, success) {
-    let url = `${physics}/venders/basic/recommend`
+    let url = `${venders}/basic/recommend`
     http.postJson(url, param, success)
 }
 

+ 18 - 4
src/components/ledger/handsontables/assets.vue

@@ -13,7 +13,7 @@
       <div style="float:right;overflow:hidden;">
         <el-button size="small" style="width: 80px;" @click="addDevice" icon="iconfont icon-tianjia">添加资产</el-button>
         <el-button size="small" style="width: 80px;" @click="reset" icon="iconfont icon-shuaxin">刷新</el-button>
-        <el-button size="small" style="width: 80px;" @click="undo" icon="iconfont icon-undo">撤销</el-button>
+        <el-button v-show="!onlyRead" size="small" style="width: 80px;" @click="undo" icon="iconfont icon-undo">撤销</el-button>
       </div>
       <div style="width:200px;color:gray;float:right;font-size:12px;">
         <span v-if="!onlyRead">隐藏自动填充的信息点:</span>
@@ -40,7 +40,7 @@
       <div
         style="width:100px;cursor: pointer;float:right; font-size:14px;margin-right:10px"
       >
-      <el-select v-model="onlyRead" @click="changeRead" size="small">
+      <el-select v-model="onlyRead" @change="changeRead" size="small">
         <el-option
           v-for="item in options"
           :key="item.value"
@@ -233,7 +233,6 @@ export default {
   mounted() { },
   methods: {
     changeRead() {
-      this.onlyRead = !this.onlyRead
       console.log(this.onlyRead)
       this.getMain()
     },
@@ -293,7 +292,13 @@ export default {
         ProjId: this.projectId
       }
       if (this.mess.buildId == "all") {
-        delete param.data.criteria.id
+        param.data.criteria.id = this.mess.ProjId
+      } else if (this.mess.buildId == "noKnow") {
+        param.data.criteria.id = this.mess.ProjId
+        param.data.directOnly = true
+      } else if (this.mess.floorId == "noKnow") {
+        param.data.criteria.id = this.mess.buildId
+        param.data.directOnly = true
       } else if (this.mess.floorId && this.mess.floorId != "all") {
         param.data.criteria.id = this.mess.floorId
       } else if (this.mess.floorId == 'all') {
@@ -301,6 +306,15 @@ export default {
       } else {
         param.data.criteria.id = this.mess.ProjId
       }
+      // if (this.mess.buildId == "all") {
+      //   delete param.data.criteria.id
+      // } else if (this.mess.floorId && this.mess.floorId != "all") {
+      //   param.data.criteria.id = this.mess.floorId
+      // } else if (this.mess.floorId == 'all') {
+      //   param.data.criteria.id = this.mess.buildId
+      // } else {
+      //   param.data.criteria.id = this.mess.ProjId
+      // }
       getBillPropList(param, res => {
         if (res.Content.length) {
           let list = []

+ 14 - 12
src/data/menus.js

@@ -22,18 +22,20 @@ export default [
                         permission: 'system:role:query'
                     }
                 ]
-            }, {
-                path: '/proj/custominfo',
-                name: '自定义信息点',
-                icon: 'el-icon-fa-user',
-                opts: [
-                    {
-                        name: '查看',
-                        basic: true,
-                        permission: 'system:role:query'
-                    }
-                ]
-            }, {
+            }, 
+            // {
+            //     path: '/proj/custominfo',
+            //     name: '自定义信息点',
+            //     icon: 'el-icon-fa-user',
+            //     opts: [
+            //         {
+            //             name: '查看',
+            //             basic: true,
+            //             permission: 'system:role:query'
+            //         }
+            //     ]
+            // }, 
+            {
                 path: '/proj/floorinfo',
                 name: '楼层信息管理',
                 icon: 'el-icon-fa-user',

+ 5 - 0
src/views/point/config_point/steps/step2.vue

@@ -165,6 +165,11 @@
                 },res => {
                     this.content = res.Content[0]
                     this.usedNum = (this.content.Current/this.content.Sum).toFixed(2)*100
+                    if (this.usedNum >= 100) {
+                        clearInterval(this.timer)
+                        this.aiDialog = false
+                        this.reset()
+                    }
                 })
             },
             changeLoc(val) {