Browse Source

modify point config css and getdata

haojianlong 5 years ago
parent
commit
6bc5932b20

+ 1 - 0
src/components/point/dynamicdata/applyRulesDialog.vue

@@ -155,6 +155,7 @@ export default {
         this.$message.success('执行成功');
         this.dialogVisible = false;
         this.tableData = []
+        this.$emit('refresh')
       })
     }
   },

+ 3 - 3
src/components/point/dynamicdata/delRelationDialog.vue

@@ -149,15 +149,15 @@ export default {
     toggleSelection(row) {
       if (this.ltableData.length > this.rtableData.length) {
         this.ltableData.map((t, i) => {
-          if (t.Id == row.Id) {
+          if (t.ObjectID == row.ObjectID) {
             this.$refs.ltable.toggleRowSelection(this.ltableData[i], true)
             return;
           }
         })
       } else {
         this.rtableData.map((t, i) => {
-          if (t.Id == row.Id) {
-            this.$refs.rtable.toggleRowSelection(this.ltableData[i], true)
+          if (t.ObjectID == row.ObjectID) {
+            this.$refs.rtable.toggleRowSelection(this.rtableData[i], true)
             return;
           }
         })

+ 5 - 5
src/components/point/dynamicdata/equipRules.vue

@@ -9,20 +9,20 @@
             <el-row>
               <div class="query-item">
                 <el-form-item>
-                  <el-input placeholder="请输入设备标识关键字" v-model="form.EquipmentMark" class="input-with-select">
-                    <el-button slot="append" icon="el-icon-search" @click="queryTableData"></el-button>
+                  <el-input placeholder="请输入设备标识关键字" v-model="form.EquipmentMark" @keyup.enter.native="queryTableData">
+                    <i slot="suffix" class="el-input__icon el-icon-search" @click="queryTableData"></i>
                   </el-input>
                 </el-form-item>
               </div>
               <div class="query-item">
-                <label>数据源</label>
+                <label style="padding-right:9px">数据源</label>
                 <dataSource :Related="true" @change="changeDataSource"></dataSource>
               </div>
               <div class="query-item">
-                <dictionary-device @change="changeDictionary" :Related="true"></dictionary-device>
+                <dictionary-device @change="changeDictionary" :Related="false"></dictionary-device>
               </div>
               <div class="query-item">
-                <label>位置标签</label>
+                <label style="padding-right:9px">位置标签</label>
                 <locationFlag :Related="true" @change="changeLocationFlag"></locationFlag>
               </div>
             </el-row>

+ 7 - 4
src/components/point/dynamicdata/locationCascader.vue

@@ -1,8 +1,6 @@
 <template>
-  <div>
-    <el-cascader placeholder="请选择所在位置" :options="LocationList" v-model="value" filterable size="small" @change="changeCascader" change-on-select
-      :props="props" clearable></el-cascader>
-  </div>
+  <el-cascader placeholder="请选择所在位置" :options="LocationList" v-model="value" filterable size="small" @change="changeCascader" change-on-select
+    :props="props" clearable class="location"></el-cascader>
 </template>
 <script>
 import { dynamicLocationList } from "@/api/scan/request";
@@ -51,5 +49,10 @@ export default {
 };
 </script>
 <style lang="less" scoped>
+.location{
+  /deep/ .el-input__inner{
+    vertical-align: baseline;
+  }
+}
 </style>
 

+ 60 - 20
src/views/point/dynamicdata/addRelation/equipRela/index.vue

@@ -4,14 +4,15 @@
     <el-row>
       <el-col :span="12">
         <el-button size="small" type="default" icon="el-icon-back" @click="goback"></el-button>
-        <div style="display:inline-block;width:317px;">
+        <div style="display:inline-block;width:317px;margin-left:10px;">
           <dictionary-device @change="changeDictionary" :Related="false"></dictionary-device>
         </div>
       </el-col>
       <el-col :span="12" class="text-right">
-        <el-switch @change="changeType" v-model="isSwitch"></el-switch>AI辅助
+        <el-switch @change="changeType" v-model="isSwitch"></el-switch>
+        <span style="padding:0 5px;">AI辅助</span>
         <el-button size="medium" @click="showHistory" class="ani-his-plus">
-          本次对应记录{{num}}
+          本次对应记录 {{num}}
           <span v-if="showPlus" :class="{'plusOne':true,'startAni':showPlus}">+1</span>
         </el-button>
       </el-col>
@@ -24,8 +25,8 @@
         <div class="query-box clearfix">
           <div class="query-item">
             <label>设备标识关键字</label>
-            <el-input placeholder="请输入设备标识关键字" v-model="form.EquipmentMark" class="input-with-select">
-              <el-button slot="append" icon="el-icon-search" @click="queryLeftTable"></el-button>
+            <el-input placeholder="请输入设备标识关键字" v-model="form.EquipmentMark" @keyup.enter.native="queryLeftTable">
+              <i slot="suffix" class="el-input__icon el-icon-search" @click="queryLeftTable"></i>
             </el-input>
           </div>
           <div class="query-item">
@@ -40,7 +41,7 @@
         <!-- 左侧列表 -->
         <div class="table-box">
           <div class="l-custom-table custom-table" v-loading="lTableLoading">
-            <el-table ref="lTableBody" :data="LtableData" tooltip-effect="dark" style="width: 100%" height="100%"
+            <el-table ref="lTableBody" :data="LtableData" tooltip-effect="dark" style="width: 100%" height="100%" @row-click="clickLeftRow"
               @selection-change="leftSelectionChange">
               <el-table-column label="数据源" align="right" show-overflow-tooltip>
                 <template slot-scope="scope">{{ scope.row.Datasource }}</template>
@@ -48,7 +49,7 @@
               <el-table-column prop="LocationFlag" label="位置标签" align="right" show-overflow-tooltip></el-table-column>
               <el-table-column prop="SubTypeName" label="设备类型关键字" align="right" show-overflow-tooltip></el-table-column>
               <el-table-column prop="EquipmentMark" label="设备标识" show-overflow-tooltip align="right" width="200" class-name="bgf5"></el-table-column>
-              <el-table-column type="selection" width="35" class-name="bgf5"></el-table-column>
+              <el-table-column type="selection" width="45" class-name="bgf5"></el-table-column>
             </el-table>
           </div>
           <!-- 智能推荐 -->
@@ -77,8 +78,8 @@
         <div class="query-box clearfix">
           <div class="query-item">
             <label>设备实例关键字</label>
-            <el-input placeholder="请输入设备实例关键字" v-model="form.EquipLocalName" class="input-with-select">
-              <el-button slot="append" icon="el-icon-search" @click="queryRightTable"></el-button>
+            <el-input placeholder="请输入设备实例关键字" v-model="form.EquipLocalName" @keyup.enter.native="queryRightTable">
+              <i slot="suffix" class="el-input__icon el-icon-search" @click="queryRightTable"></i>
             </el-input>
           </div>
           <div class="query-item">
@@ -89,9 +90,9 @@
         <!-- 右侧列表 -->
         <div class="table-box">
           <div class="r-custom-table custom-table" v-loading="rTableLoading">
-            <el-table ref="rTableBody" :data="RtableData" tooltip-effect="dark" style="width: 100%" height="100%"
+            <el-table ref="rTableBody" :data="RtableData" tooltip-effect="dark" style="width: 100%" height="100%" @row-click="clickRightRow"
               @selection-change="rightSelectionChange">
-              <el-table-column type="selection" width="35" class-name="bgf5"></el-table-column>
+              <el-table-column type="selection" width="45" class-name="bgf5"></el-table-column>
               <el-table-column label="设备实例名称" width="200" class-name="bgf5" show-overflow-tooltip>
                 <template slot-scope="scope">{{ scope.row.EquipLocalName }}</template>
               </el-table-column>
@@ -209,6 +210,9 @@ export default {
       if (scrollTop + windowHeight === scrollHeight) {
         if (this.lPage.pageNumber * this.lPage.pageSize < this.lPage.total) {
           this.lPage.pageNumber++;
+          if (this.LtableData.length < 50) {
+            this.lPage.pageNumber = 1
+          }
           this.getLeftData();
         }
       }
@@ -226,6 +230,9 @@ export default {
         // 获取到的不是全部数据 当滚动到底部 继续获取新的数据
         if (this.rPage.pageNumber * this.rPage.pageSize < this.rPage.total) {
           this.rPage.pageNumber++;
+          if (this.RtableData.length < 50) {
+            this.rPage.pageNumber = 1
+          }
           this.getRightData();
         }
       }
@@ -239,8 +246,8 @@ export default {
   },
   methods: {
     init() {
-      this.getLeftData();
-      this.getRightData();
+      this.queryLeftTable();
+      this.queryRightTable();
     },
     //切换AI辅助
     changeType() { },
@@ -263,6 +270,8 @@ export default {
     },
     //重新获取数据
     reGetData() {
+      //删除选中项
+      this.delSelectedRows(this.lArray, this.rArray);
       let history = { leftList: this.lArray, rightList: this.rArray };
       this.historyList.push(history); //保存本次操作记录
       this.lArray = []; //清空选中list
@@ -272,9 +281,31 @@ export default {
       setTimeout(() => {
         this.showPlus = false;
       }, 800);
-      //重新获取数据
-      this.queryLeftTable();
-      this.queryRightTable();
+    },
+    //少于20条请求数据-否则删除选中项
+    delSelectedRows(lArray, rArray) {
+      for (let i = this.LtableData.length - 1; i >= 0; i--) {
+        for (let j = 0; j < lArray.length; j++) {
+          if (this.LtableData[i].EquipmentMark == lArray[j].EquipmentMark && this.LtableData[i].SubTypeCode == lArray[j].SubTypeCode) {
+            this.LtableData.splice(i, 1)
+            continue; //结束当前本轮循环,开始新的一轮循环
+          }
+        }
+      }
+      for (let i = this.RtableData.length - 1; i >= 0; i--) {
+        for (let j = 0; j < rArray.length; j++) {
+          if (this.RtableData[i].ObjectID == rArray[j].ObjectID && this.RtableData[i].SubTypeCode == rArray[j].SubTypeCode) {
+            this.RtableData.splice(i, 1)
+            continue; //结束当前本轮循环,开始新的一轮循环
+          }
+        }
+      }
+      if (this.LtableData.length < 20) {
+        this.queryLeftTable()
+      }
+      if (this.RtableData.length < 20) {
+        this.queryRightTable()
+      }
     },
     //表格中的选中事件
     leftSelectionChange(selection) {
@@ -319,7 +350,7 @@ export default {
         if (this.lPage.pageNumber == 1) {
           this.LtableData = res.Content;
         } else {
-          this.LtableData.push(res.Content);
+          this.LtableData = this.LtableData.concat(res.Content);
         }
         this.lTableLoading = false;
       });
@@ -356,7 +387,7 @@ export default {
         if (this.rPage.pageNumber == 1) {
           this.RtableData = res.Content;
         } else {
-          this.RtableData.push(res.Content);
+          this.RtableData = this.RtableData.concat(res.Content);
         }
         this.rTableLoading = false;
       });
@@ -391,7 +422,15 @@ export default {
     //返回
     goback() {
       this.$router.push({ path: '/point/dynamicdata', query: { typeName: this.typeName } })
-    }
+    },
+    //点击行
+    clickLeftRow(row, column, event) {
+      this.$refs.lTableBody.toggleRowSelection(row);
+    },
+    //点击行
+    clickRightRow(row, column, event) {
+      this.$refs.rTableBody.toggleRowSelection(row);
+    },
   },
   watch: {
     projectId(n, o) {
@@ -487,9 +526,10 @@ export default {
         .query-item {
           float: left;
           width: 30%;
-          margin: 0 5px;
+          margin: 5px;
           label {
             display: block;
+            margin-bottom: 5px;
           }
           .el-select {
             width: 100%;

+ 48 - 21
src/views/point/dynamicdata/index.vue

@@ -1,27 +1,35 @@
 <template>
   <div id="dynamicdata">
     <!-- tab分页 -->
-    <el-row>
-      <el-col :span="17">
-        <el-tabs v-model="curType">
-          <el-tab-pane v-for="(item) in typeList" :key="item.Name" :label="item.Name+'('+item.Sum+'/'+item.Rcount+')'" :name="item.Name">
-          </el-tab-pane>
-        </el-tabs>
-      </el-col>
-      <el-col :span="7" style="text-align:right;">
-        <span style="margin-right:10px;" v-if="lastUpdateTime">最后配置时间:{{lastUpdateTime}}</span>
-        <el-tooltip class="item" effect="dark" :content="tipCon" placement="left">
-          <el-button size="small" type="primary" @click="apply" icon="el-icon-refresh" style="float:right;">配置</el-button>
+    <el-row class="top-tab">
+      <el-tabs v-model="curType">
+        <el-tab-pane v-for="(item) in typeList" :key="item.Name" :label="item.Name+'('+item.Sum+'/'+item.Rcount+')'" :name="item.Name">
+        </el-tab-pane>
+      </el-tabs>
+      <div class="pos-right">
+        <span style="margin-right:10px;" v-show="lastUpdateTime">最后配置时间:{{lastUpdateTime}}</span>
+        <span v-if="tipsType==2" class="tips">
+          原始点位变化,部分标识受到影响,请重新执行对应规则
+          <i class="el-icon-right"></i>
+        </span>
+        <span v-if="tipsType==3" class="tips">
+          对应规则有更新,记得执行哦
+          <i class="el-icon-right"></i>
+        </span>
+        <el-tooltip class="item" effect="dark" :content="'按对应规则自动设定实例动态参数信息点'" placement="left">
+          <el-badge :is-dot="tipsType>1" class="item">
+            <el-button size="small" type="primary" @click="apply" icon="el-icon-refresh" style="float:right;">配置</el-button>
+          </el-badge>
         </el-tooltip>
-      </el-col>
+      </div>
     </el-row>
     <equip-rules v-if="curType=='设备'" ref="equip" :typeName="curType" @refresh="equipRefresh"></equip-rules>
     <!-- <parts-rules v-if="!curType=='设备'" ref="parts" :typeName="'设备'"></parts-rules> -->
     <!-- 应用规则弹窗 -->
-    <apply-rules-dialog ref="apply"></apply-rules-dialog>
+    <apply-rules-dialog ref="apply" @refresh="getPrompt"></apply-rules-dialog>
     <!-- 规则更新提示 -->
     <el-dialog title="提示" :visible.sync="ruleDialogShow" width="25%" @close="rulesClose">
-      <span>{{ruleDialogStr}}</span>
+      <span>{{tipCon}}</span>
       <span slot="footer" class="dialog-footer">
         <el-button size="small" @click="rulesClose">稍后处理</el-button>
         <el-button size="small" type="primary" @click="apply">现在执行</el-button>
@@ -51,8 +59,7 @@ export default {
       lastUpdateTime: "", //最后更新时间
       tipsType: 1, //提示信息种类
       ruleDialogShow: false, //规则提示执行弹窗
-      ruleDialogStr: "", //规则提示执行弹窗文字
-      tipCon: '按对应规则自动设定实例动态参数信息点', //配置按钮提示文字
+      tipCon: '', //配置按钮提示文字-规则提示执行弹窗文字
     };
   },
   components: {
@@ -62,7 +69,7 @@ export default {
   },
   created() {
     let typeName = this.$route.query.typeName;
-    if(typeName){
+    if (typeName) {
       this.curType = typeName
     }
     this.init();
@@ -75,6 +82,10 @@ export default {
       //对象类型
       this.getTypeNames();
       //获取提示信息
+      this.getPrompt();
+    },
+    //获取提示消息
+    getPrompt() {
       dynamicPromptmessage({}, res => {
         if (res.Result == "success") {
           if (res.Content.length) {
@@ -85,13 +96,12 @@ export default {
               }
               if (res.Content[i].Type == "原始点位增删") {
                 this.tipsType = 2;
-                this.ruleDialogStr =
-                  "原始点位变化,部分标识受到影响,请重新执行对应规则";
+                this.tipCon = "原始点位变化,部分标识受到影响,请重新执行对应规则";
                 this.ruleDialogShow = true;
               }
               if (res.Content[i].Type == "未执行对应规则") {
                 this.tipsType = 3;
-                this.ruleDialogStr = "对应规则更新,是否现在执行?";
+                this.tipCon = "对应规则更新,是否现在执行?";
                 this.ruleDialogShow = true;
               }
             }
@@ -125,7 +135,7 @@ export default {
       this.ruleDialogShow = false;
     },
     //刷新设备类表
-    equipRefresh(val){
+    equipRefresh(val) {
       this.curType = val;
       this.getTypeNames()
     }
@@ -144,6 +154,23 @@ export default {
   background-color: #fff;
   padding: 10px;
   position: relative;
+  .top-tab {
+    position: relative;
+    .pos-right {
+      position: absolute;
+      right: 0;
+      top: 0;
+      .tips {
+        color: red;
+        position: absolute;
+        right: 73px;
+        width: 390px;
+        text-align: right;
+        padding-right: 10px;
+        background-color: #fff;
+      }
+    }
+  }
 }
 </style>