Browse Source

fix pointconfig apply rules

haojianlong 5 years ago
parent
commit
8f4c0ce745

+ 6 - 0
src/api/scan/request.js

@@ -1064,6 +1064,12 @@ export function dynamicExecute(param, success) {
     http.postJson(url, param, success);
 }
 
+//动态数据关联-执行对应结果反馈
+export function dynamicExecuteFeedback(param, success) {
+    let url = `${baseUrl}/pointconfig/dynamic/executeFeedback`;
+    http.postJson(url, param, success);
+}
+
 //动态数据关联-位置下拉列表(P2)
 export function dynamicLocationList(param, success) {
     let url = `${baseUrl}/pointconfig/dynamic/location-list`;

+ 10 - 3
src/components/point/dynamicdata/applyRulesDialog.vue

@@ -78,7 +78,8 @@ export default {
     };
   },
   methods: {
-    showDialog() {
+    showDialog(force) {
+      this.force = force
       if (this.tableData.length) {
         this.dialogVisible = true;
       } else {
@@ -100,7 +101,10 @@ export default {
     },
     //查询是否有冲突
     getPromptobjs() {
-      dynamicPromptobjs('', res => {
+      let param = {
+        Force: this.force
+      }
+      dynamicPromptobjs(param, res => {
         this.tableData = res.Content.map((item) => {
           item.OldMsg = {}
           item.NewMsg = {}
@@ -151,7 +155,10 @@ export default {
     },
     //执行规则
     rulesConfirm(){
-      dynamicExecute('', res => {
+      let param = {
+        Force: this.force
+      }
+      dynamicExecute(param, res => {
         this.$message.success('执行成功');
         this.dialogVisible = false;
         this.tableData = []

+ 6 - 3
src/components/point/dynamicdata/equipRules.vue

@@ -28,7 +28,7 @@
         </el-col>
         <el-col :span="1">
           <el-tooltip class="item" effect="dark" content="填充设备标识与实例对应规则" placement="left">
-            <el-button size="small" type="primary" @click="toAddRelation" icon="el-icon-edit-outline" style="float:right;"></el-button>
+            <el-button size="small" type="primary" @click="toAddRelation" icon="el-icon-edit-outline" style="float:right;" :disabled="isPending"></el-button>
           </el-tooltip>
         </el-col>
       </el-row>
@@ -64,7 +64,7 @@
         <el-table-column prop="action" label="操作" min-width="100">
           <template slot-scope="scope">
             <el-tooltip class="item" effect="dark" content="清除对应规则" placement="left">
-              <el-button size="mini" @click="handleDelete(scope.$index, scope.row)" type="danger" plain :disabled="scope.row.Related=='False'"
+              <el-button size="mini" @click="handleDelete(scope.$index, scope.row)" type="danger" plain :disabled="isPending||scope.row.Related=='False'"
                 icon="el-icon-delete"></el-button>
             </el-tooltip>
           </template>
@@ -128,7 +128,10 @@ export default {
     locationFlag
   },
   props: {
-    typeName: {}
+    typeName: {},
+    isPending: {
+      default: false
+    }
   },
   created() {
     this.init();

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

@@ -497,7 +497,7 @@ export default {
             param.push({
               Points: [item],
               Top: 3,
-              Proximity: 50
+              Proximity: 0.5
             })
           })
           dynamicQueryAI(param, res => {
@@ -521,7 +521,7 @@ export default {
             param.push({
               Objs: [item],
               Top: 3,
-              Proximity: 50
+              Proximity: 0.5
             })
           })
           dynamicQueryAI(param, res => {

+ 81 - 11
src/views/point/dynamicdata/index.vue

@@ -7,7 +7,7 @@
         </el-tab-pane>
       </el-tabs>
       <div class="pos-right">
-        <span style="margin-right:10px;" v-show="lastUpdateTime">最后配置时间:{{lastUpdateTime}}</span>
+        <span style="margin-right:10px;" v-show="lastUpdateTime">最后配置完成时间:{{lastUpdateTime}}</span>
         <span v-if="tipsType==2" class="tips">
           原始点位变化,部分标识受到影响,请重新执行对应规则
           <i class="el-icon-right"></i>
@@ -16,23 +16,46 @@
           对应规则有更新,记得执行哦
           <i class="el-icon-right"></i>
         </span>
+        <span v-if="tipsType==0" class="tips">规则执行中。。。</span>
         <el-tooltip class="item" effect="dark" :content="'按对应规则自动设定实例动态参数信息点'" placement="left">
-          <el-badge :is-dot="ruleDialogShow||tipsType>1" class="item">
-            <el-button size="small" type="primary" @click="apply" icon="el-icon-refresh" style="float:right;">配置</el-button>
+          <el-badge :is-dot="tipsType==2||tipsType==3" class="item">
+            <el-button size="small" type="primary" @click="showSelectAll" icon="el-icon-refresh" style="float:right;" :disabled="isPending">配置
+            </el-button>
+            <!-- @contextmenu.native.prevent="show" -->
           </el-badge>
         </el-tooltip>
       </div>
     </el-row>
-    <equip-rules v-if="curType=='设备'" ref="equip" :typeName="curType" @refresh="equipRefresh"></equip-rules>
+    <equip-rules v-if="curType=='设备'" ref="equip" :typeName="curType" @refresh="equipRefresh" :isPending="isPending"></equip-rules>
     <!-- <parts-rules v-if="!curType=='设备'" ref="parts" :typeName="'设备'"></parts-rules> -->
     <!-- 应用规则弹窗 -->
-    <apply-rules-dialog ref="apply" @refresh="getPrompt"></apply-rules-dialog>
+    <apply-rules-dialog ref="apply" @refresh="getExecuteFeedback"></apply-rules-dialog>
     <!-- 规则更新提示 -->
     <el-dialog title="提示" :visible.sync="ruleDialogShow" width="25%" @close="rulesClose">
       <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>
+        <el-button size="small" type="primary" @click="apply(false)">现在执行</el-button>
+      </span>
+    </el-dialog>
+    <!-- 选择增量 or 全量 执行 -->
+    <el-dialog title="提示" :visible.sync="allApplyDialog" width="50%" @close="allApplyClose">
+      <div id="applySelect">
+        <el-radio v-model="force" :label="false">增量执行:只设定对应规则or原始点位有变化的实例动态参数信息点</el-radio>
+        <p style="color:#999;">因自动判断是否变化,可能更新不够完整,但速度比较快</p>
+        <p>
+          <span class="el-dropdown-link" @click="allApplyFlag=true">
+            我要全量执行<i class="el-icon-arrow-down el-icon--right"></i>
+          </span>
+        </p>
+        <div v-show="allApplyFlag">
+          <el-radio v-model="force" :label="true">全量执行:按对应规则重新设定所有实例动态参数信息点</el-radio>
+          <p style="color:#ff0000;">全量执行时间较长,且执行过程中相关功能不可操作</p>
+        </div>
+      </div>
+      <span slot="footer" class="dialog-footer">
+        <el-button size="small" @click="allApplyClose">取消</el-button>
+        <el-button size="small" type="primary" @click="apply">确认</el-button>
       </span>
     </el-dialog>
   </div>
@@ -46,7 +69,8 @@ import partsRules from "@/components/point/dynamicdata/partsRules";
 import {
   dynamicClashConfirm,
   dynamicPromptmessage,
-  dynamicPointTypeList
+  dynamicPointTypeList,
+  dynamicExecuteFeedback
 } from "@/api/scan/request";
 export default {
   computed: {
@@ -60,6 +84,10 @@ export default {
       tipsType: 1, //提示信息种类
       ruleDialogShow: false, //规则提示执行弹窗
       tipCon: '', //配置按钮提示文字-规则提示执行弹窗文字
+      allApplyDialog: false, //全量执行弹窗
+      allApplyFlag: false, //全量执行flag
+      force: false, //默认增量执行 ----- false - 增量 true - 全量执行
+      isPending: false, //是否执行中:执行中禁用所有功能 true即为执行中
     };
   },
   components: {
@@ -81,8 +109,8 @@ export default {
       let param = { Related: true };
       //对象类型
       this.getTypeNames();
-      //获取提示信息
-      this.getPrompt();
+      //获取 执行反馈
+      this.getExecuteFeedback();
     },
     //获取提示消息
     getPrompt() {
@@ -130,20 +158,53 @@ export default {
         }
       });
     },
+    //显示选择增量or增量执行
+    showSelectAll() {
+      this.allApplyDialog = true;
+      this.force = false;
+      this.allApplyFlag = false;
+    },
     //执行对应结果
     apply() {
       this.ruleDialogShow = false;
-      this.tipsType = 1;
-      this.$refs.apply.showDialog();
+      this.tipsType = 0;
+      this.isPending = true;
+      this.allApplyClose()
+      this.$refs.apply.showDialog(this.force);
     },
     //规则执行弹窗
     rulesClose() {
       this.ruleDialogShow = false;
     },
+    //关闭选择全量-增量弹窗
+    allApplyClose() {
+      this.allApplyDialog = false;
+      this.force = false;
+    },
     //刷新设备类表
     equipRefresh(val) {
       this.curType = val;
       this.getTypeNames()
+    },
+    // show() {
+    //   console.log('右键事件')
+    // },
+    //获取执行反馈
+    getExecuteFeedback() {
+      dynamicExecuteFeedback('', res => {
+        this.allApplyClose()
+        this.isPending = false;
+        let response = res.Content[0]
+        if (response.Completed == 'Processing') {
+          this.isPending = true;
+          this.tipsType = 0;
+          setTimeout(() => {
+            this.getExecuteFeedback()
+          }, 2000)
+        } else {
+          this.getPrompt()
+        }
+      })
     }
   },
   watch: {
@@ -178,6 +239,15 @@ export default {
       }
     }
   }
+  #applySelect {
+    /deep/ .el-radio__input.is-checked + .el-radio__label {
+      color: #000;
+    }
+    p {
+      font-size: 12px;
+      padding-left: 24px;
+    }
+  }
 }
 </style>