Browse Source

代码优化

LXXXY 5 years ago
parent
commit
9e3d76e552

+ 32 - 42
src/components/point/report/addTabFunNum.vue

@@ -23,7 +23,7 @@
 </template>
 
 <script>
-import { mapGetters, mapActions } from 'vuex'
+import { Message } from 'element-ui';
 import {
   addTabFunNum
 } from '@/api/scan/request'
@@ -57,8 +57,6 @@ export default {
       }
     }
   },
-  computed: {
-  },
   methods: {
     //添加
     add() {
@@ -67,26 +65,20 @@ export default {
         if (valid) {
           this.form.Unit = this.form.Unit.toString();
           addTabFunNum(this.form, res => {
-            if (res.Result && res.Result == "success") {
-              //成功提示
-              this.$message({
-                showClose: true,
-                message: '添加成功',
-                type: 'success'
-              });
-              //清楚当前表单数据,500ms后关闭
-              let that = this;
-              that.$emit('reloadData');
-              setTimeout(() => {
-                that.$emit('closeDrawer');
-                that.form = {
-                  MeterFunc: '',
-                  CollectInterval: '',
-                  DataRuleContent: '',
-                  Unit: '',
-                }
-              }, 500);
-            }
+            //成功提示
+            Message.success('添加成功');
+            //清楚当前表单数据,500ms后关闭
+            let that = this;
+            that.$emit('reloadData');
+            setTimeout(() => {
+              that.$emit('closeDrawer');
+              that.form = {
+                MeterFunc: '',
+                CollectInterval: '',
+                DataRuleContent: '',
+                Unit: '',
+              }
+            }, 500);
           });
         } else {
           return false;
@@ -96,27 +88,25 @@ export default {
     //加载下拉框
     initSelect() {
       batchQueryUnit({}, res => {
-        if (res.Result == 'success') {
-          let data = res.Content
-          let arr = []
-          data.forEach(item => {
-            let first = {
-              value: item.Type,
-              label: item.Type,
-              children: []
+        let data = res.Content
+        let arr = []
+        data.forEach(item => {
+          let first = {
+            value: item.Type,
+            label: item.Type,
+            children: []
+          }
+          item.Units.forEach(ele => {
+            let second = {}
+            second = {
+              value: ele.Name,
+              label: ele.Name
             }
-            item.Units.forEach(ele => {
-              let second = {}
-              second = {
-                value: ele.Name,
-                label: ele.Name
-              }
-              first.children.push(second)
-            })
-            arr.push(first)
+            first.children.push(second)
           })
-          this.options = arr
-        }
+          arr.push(first)
+        })
+        this.options = arr
       })
     }
   },

+ 0 - 5
src/components/point/report/dataSource.vue

@@ -27,12 +27,9 @@
 </template>
 
 <script>
-import { mapGetters, mapActions } from 'vuex'
-
 import {
   getTabFunNumSourceData
 } from '@/api/scan/request'
-
 export default {
   data() {
     return {
@@ -57,8 +54,6 @@ export default {
   props: {
     tabFunNum: String
   },
-  computed: {
-  },
   mounted() {
     this.loadDataSource();
   },

+ 1 - 2
src/components/point/report/historyChart.vue

@@ -16,8 +16,7 @@
 </template>
 
 <script>
-import { mapGetters, mapActions } from 'vuex'
-
+import { mapGetters } from 'vuex'
 import {
   getHistoryData
 } from '@/api/scan/request'

+ 1 - 8
src/components/point/report/integrateStatistics.vue

@@ -28,8 +28,6 @@
 </template>
 
 <script>
-import { mapGetters, mapActions } from "vuex";
-
 //echarts
 import echarts from "echarts";
 import "echarts/lib/chart/bar";
@@ -64,8 +62,6 @@ export default {
       originalPoint: null
     };
   },
-  computed: {
-  },
   methods: {
     //加载图表数据
     loadChart() {
@@ -168,10 +164,7 @@ export default {
 
       //获取条形图数据
       getIntegrateStatisticsToBar({}, res => {
-        if (res.Result && res.Result == "success") {
-          this.barChartData = res.Content;
-        }
-
+        this.barChartData = res.Content;
         this.originalPoint = (() => {
           let sum = 0;
           this.barChartData.map(item => {

+ 3 - 8
src/components/point/report/objectInstance.vue

@@ -32,11 +32,10 @@
 </template>
 
 <script>
-import { mapGetters, mapActions } from 'vuex'
-
+import { mapGetters } from 'vuex'
 import { SGraphyView } from "@sybotan-web/graphy/lib";
 import { LocationPointScene, DivideFloorScene } from "cad-engine"
-import { SColor, SPoint } from "@sybotan-web/draw/lib";
+import { SColor } from "@sybotan-web/draw/lib";
 
 import {
   getTabFunNumObjInstance, getEquipByEqID, getFloorMsgByFloorID, queryZone
@@ -49,7 +48,6 @@ export default {
       views: [],//canvas view
       scenes: [],//canvas scene
       loading: true,
-      BSPRelaISPLists: [[]],
       refreshCanvas: '',//重载canvas组件
       drawCanvas: true//是否画canvas
     }
@@ -165,9 +163,6 @@ export default {
             else if (typecode == 'Sp') {
               that.scenes[key].addZone(options);
             }
-            else {
-
-            }
             that.views[key].fitSceneToView();
           })
         }
@@ -182,7 +177,7 @@ export default {
     reValue: String//对应值
   },
   computed: {
-    ...mapGetters('layout', ['projectId', 'userId'])
+    ...mapGetters('layout', ['projectId'])
   },
   watch: {
     //切换时更新数据

+ 0 - 6
src/components/point/report/tabFunNumOverview.vue

@@ -68,16 +68,13 @@
 </template>
 
 <script>
-import { mapGetters, mapActions } from 'vuex'
 import {
   getTabFunNumOverview
 } from '@/api/scan/request'
-
 import historyChart from './historyChart'
 import dataSource from './dataSource'
 import objectInstance from './objectInstance'
 import addTabFunNum from './addTabFunNum'
-
 export default {
   data() {
     return {
@@ -100,7 +97,6 @@ export default {
         { drawer: false, direction: 'rtl', objId: '', value: '' },
         { drawer: false, direction: 'rtl', objId: '' }
       ]
-
     }
   },
   methods: {
@@ -124,10 +120,8 @@ export default {
     getOverViewList() {
       this.loading = true;
       getTabFunNumOverview({ MeterFunc: this.tabFunNum }, res => {
-        if (res.Result && res.Result == "success") {
           this.allTableData = res.Content;
           this.loading = false;
-        }
       });
     },
     //刷新当前行数据

+ 1 - 2
src/views/point/report/index.vue

@@ -19,7 +19,6 @@
 
 <script>
 import { mapGetters } from 'vuex'
-import { batchQueryUnit } from '@/fetch/point_http'
 import integrateStatistics from '@/components/point/report/integrateStatistics'
 import tabFunNumOverview from '@/components/point/report/tabFunNumOverview'
 
@@ -29,7 +28,7 @@ export default {
     tabFunNumOverview
   },
   computed: {
-    ...mapGetters('layout', ['projectId', 'secret']),
+    ...mapGetters('layout', ['projectId']),
   },
   data() {
     return {