xiao547607 5 лет назад
Родитель
Сommit
05207be435

+ 38 - 29
src/views/base/personDeviceRelation-BoundList.vue

@@ -3,6 +3,7 @@
     :visible.sync="showDialog"
     title="查看绑定设备"
     :modal-append-to-body="false"
+    append-to-body
     :modal="true"
     style="text-align:left;"
     @close="closeDialog"
@@ -149,36 +150,45 @@ export default {
     },
     handleDelete(record) {
       var self = this;
-      if(confirm("是否解除绑定?")){
-        self.loading = true;
+      this.$confirm("是否绑定?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+        distinguishCancelAndClose: true
+      })
+        .then(() => {
+          self.loading = true;
+
+          personDeviceRelationApi.remove(record.id).then(function(response) {
+            var jsonData = response.data;
+            self.loading = false;
+            if (jsonData.result) {
+              // var index = self.tableData.indexOf(record);
+              // self.tableData.splice(index, 1);
+              self.changePage(self.pageIndex);
 
-        personDeviceRelationApi.remove(record.id).then(function(response) {
-          var jsonData = response.data;
+              self.$message({
+                type: "success",
+                message: "解绑成功!"
+              });
+            }
+          });
+        })
+        .catch(error => {
           self.loading = false;
-          if (jsonData.result) {
-            // var index = self.tableData.indexOf(record);
-            // self.tableData.splice(index, 1);
-            self.changePage(self.pageIndex);
-
-            self.$message({
-              type: "success",
-              message: "解绑成功!"
-            });
-          }
+          // self.$message.error(error + "");
         });
-      }
     },
     handleRemoveAll() {
       var self = this;
 
-      // this.$confirm("是否绑定?", "提示", {
-      //   confirmButtonText: "确定",
-      //   cancelButtonText: "取消",
-      //   type: "warning",
-      //   distinguishCancelAndClose: true
-      // })
-      //   .then(() => {
-        if(confirm("是否解除绑定?")){
+      this.$confirm("是否绑定?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+        distinguishCancelAndClose: true
+      })
+        .then(() => {
           self.loading = true;
           var formData = new FormData();
           formData.append("personId", self.personId);
@@ -202,12 +212,11 @@ export default {
                 });
               }
             });
-        }
-        // })
-        // .catch(error => {
-        //   self.loading = false;
-        //   // self.$message.error(error + "");
-        // });
+        })
+        .catch(error => {
+          self.loading = false;
+          // self.$message.error(error + "");
+        });
     },
     onDetailModalClose(refreshed) {
       //保存成功后回调

+ 25 - 28
src/views/base/personDeviceRelation-list.vue

@@ -3,6 +3,7 @@
     :visible.sync="showDialog"
     title="查看设备"
     :modal-append-to-body="false"
+    append-to-body
     :modal="true"
     style="text-align:left;"
     @close="closeDialog"
@@ -163,14 +164,13 @@ export default {
     },
     handleBound(record) {
       var self = this;
-      // this.$confirm("是否绑定?", "提示", {
-      //   confirmButtonText: "确定",
-      //   cancelButtonText: "取消",
-      //   type: "warning",
-      //   distinguishCancelAndClose: true
-      // })
-      //   .then(() => {
-      if (confirm("是否绑定?")) {
+      self.$confirm("是否绑定?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+        distinguishCancelAndClose: true
+      })
+        .then(() => {
         self.formModel.personId = self.personId;
         self.formModel.deviceId = record.id;
 
@@ -195,12 +195,11 @@ export default {
               });
             }
           });
-      }
-      // })
-      // .catch(error => {
-      //   self.loading = false;
-      //   // self.$message.error(error + "");
-      // });
+      })
+      .catch(error => {
+        self.loading = false;
+        // self.$message.error(error + "");
+      });
     },
     handleBatchBound() {
       var self = this;
@@ -208,14 +207,13 @@ export default {
         return record.id;
       });
 
-      // this.$confirm("是否绑定选中项?", "提示", {
-      //   confirmButtonText: "确定",
-      //   cancelButtonText: "取消",
-      //   type: "warning",
-      //   distinguishCancelAndClose: true
-      // })
-      //   .then(() => {
-      if (confirm("是否绑定?")) {
+      this.$confirm("是否绑定选中项?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+        distinguishCancelAndClose: true
+      })
+        .then(() => {
         self.loading = true;
         var formData = new FormData();
 
@@ -241,12 +239,11 @@ export default {
               });
             }
           });
-      }
-      // })
-      // .catch(error => {
-      //   self.loading = false;
-      //   // self.$message.error(error + "");
-      // });
+      })
+      .catch(error => {
+        self.loading = false;
+        // self.$message.error(error + "");
+      });
     },
     onDetailModalClose(refreshed) {
       //保存成功后回调