Browse Source

modify relation

haojianlong 5 years ago
parent
commit
0e465634c0

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

@@ -66,7 +66,7 @@ export default {
       activeName: "first", //当前所在tab页
       loading: false, //loading状态
       dialogWidth: "20%", //弹窗宽度
-      selection:[]
+      selection: []
     };
   },
   methods: {
@@ -112,7 +112,7 @@ export default {
               SubTypeName: "ATFC",
               TypeCode: "Eq",
               TypeName: "设备"
-            },
+            }
             // {
             //   BuildLocalName: "南主楼",
             //   EquipLocalName: "路演休闲大厅3333风机盘管",
@@ -137,7 +137,7 @@ export default {
               SubTypeName: "喷灌机组",
               TypeCode: "Eq",
               TypeName: "设备"
-            },
+            }
             // {
             //   Datasource: "2112",
             //   EquipmentMark: "2",
@@ -189,14 +189,14 @@ export default {
       console.log(i);
       console.log(t);
       //param.objs and param.point .length>1
-      return;
       dynamicDeleteRelation(this.param, res => {
         console.log(res);
         this.$emit("refresh");
+        this.dialogVisible = false;
       });
     },
     //表格中选择事件
-    changeSelection(){}
+    changeSelection() {}
   },
   mounted() {},
   created() {}
@@ -231,4 +231,4 @@ export default {
     text-align: right;
   }
 }
-</style>
+</style>

+ 1 - 1
src/components/point/dynamicdata/historyDialog.vue

@@ -86,7 +86,7 @@ export default {
     return {
       dialogVisible: false, //弹窗显示与隐藏
       showheader: false,
-      tableData: [], //数据list
+      tableData: [] //数据list
     };
   },
   methods: {

+ 22 - 12
src/views/point/dynamicdata/addRelation/index.vue

@@ -514,17 +514,7 @@ export default {
     init() {
       let param = { Related: false };
       //对象类型
-      dynamicPointTypeList(param, res => {
-        if (res.Result == "success") {
-          this.typeList = res.Content;
-          if (this.typeList.length) {
-            this.curType = this.typeList[0].Name;
-            this.getLeftData();
-            this.getRightData();
-          } else {
-          }
-        }
-      });
+      this.getTypeNames();
       //数据源
       dynamicDataSource(param, res => {
         if (res.Result == "success") {
@@ -550,6 +540,26 @@ export default {
         }
       });
     },
+    //获取tab页
+    getTypeNames() {
+      let param = { Related: false };
+      //对象类型
+      dynamicPointTypeList(param, res => {
+        if (res.Result == "success") {
+          this.typeList = res.Content;
+          if (this.typeList.length) {
+            //记录上次操作的tab页
+            this.curType =
+              this.curType != 0 ? this.curType : this.typeList[0].Name;
+            this.getLeftData();
+            this.getRightData();
+          } else {
+            this.LtableData = [];
+            this.RtableData = [];
+          }
+        }
+      });
+    },
     //切换AI辅助
     changeType() {},
     //推荐中的选择事件
@@ -661,7 +671,7 @@ export default {
       this.getRightData();
     },
     //清除对应关系成功
-    deleteSuc(){
+    deleteSuc() {
       this.num--;
       this.refresh();
     }

+ 32 - 23
src/views/point/dynamicdata/index.vue

@@ -121,7 +121,7 @@ export default {
   },
   data() {
     return {
-      curType: "1", //当前所在tab页
+      curType: "", //当前所在tab页
       typeList: [], //tab页list
       sourceList: [], //数据源
       DynEquipList: [], //数据字典设备类型
@@ -137,7 +137,7 @@ export default {
       lastUpdateTime: "", //最后更新时间
       tipsType: 1, //提示信息种类
       ruleDialogShow: false, //规则提示执行弹窗
-      ruleDialogStr:'',//规则提示执行弹窗文字
+      ruleDialogStr: "" //规则提示执行弹窗文字
     };
   },
   components: {
@@ -153,17 +153,7 @@ export default {
     init() {
       let param = { Related: true };
       //对象类型
-      dynamicPointTypeList(param, res => {
-        if (res.Result == "success") {
-          this.typeList = res.Content;
-          if (this.typeList.length) {
-            this.curType = this.typeList[0].Name;
-            this.getTableData();
-          } else {
-            this.tableData = [];
-          }
-        }
-      });
+      this.getTypeNames();
       //数据源
       dynamicDataSource(param, res => {
         if (res.Result == "success") {
@@ -189,13 +179,14 @@ export default {
             for (let i = 0; i < res.Content.length; i++) {
               if (res.Content[i].Type == "未执行对应规则") {
                 this.tipsType = 3;
-                this.ruleDialogStr = '对应规则更新,是否现在执行?';
+                this.ruleDialogStr = "对应规则更新,是否现在执行?";
                 this.ruleDialogShow = true;
                 return;
               }
               if (res.Content[i].Type == "原始点位增删") {
                 this.tipsType = 2;
-                this.ruleDialogStr = '原始点位变化,部分标识受到影响,请重新执行对应规则';
+                this.ruleDialogStr =
+                  "原始点位变化,部分标识受到影响,请重新执行对应规则";
                 this.ruleDialogShow = true;
                 return;
               }
@@ -210,14 +201,32 @@ export default {
         }
       });
     },
+    //获取tab页
+    getTypeNames() {
+      let param = { Related: false };
+      //对象类型
+      dynamicPointTypeList(param, res => {
+        if (res.Result == "success") {
+          this.typeList = res.Content;
+          if (this.typeList.length) {
+            //记录上次操作的tab页
+            this.curType =
+              this.curType != 0 ? this.curType : this.typeList[0].Name;
+            this.getTableData();
+          } else {
+            this.tableData = [];
+          }
+        }
+      });
+    },
     //执行对应结果
     apply() {
-      // dynamicExecute()
-      // let date = new Date();
-      // this.lastUpdateTime = `${date.getFullYear()}-${date.getMonth() +
-      //   1}-${date.getDate()}  ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`;
-      // this.$message.success("应用成功");
-      this.$refs.apply.showDialog();
+      dynamicExecute({}, res => {
+        if (res.Result == "success") {
+          this.$message.success("应用成功");
+        }
+      });
+      // this.$refs.apply.showDialog();
     },
     //清除对应关系
     handleDelete(index, row) {
@@ -268,14 +277,14 @@ export default {
     //刷新列表
     refresh() {
       this.page.pageNumber = 1;
-      this.getTableData();
+      this.getTypeNames();
     },
     //规则执行弹窗
     rulesClose() {
       this.ruleDialogShow = false;
     },
     //现在执行
-    nowDo(){}
+    nowDo() {}
   },
   watch: {
     projectId() {