Explorar el Código

冒烟警告页面-添加点击图片放大功能,添加删除单条记录功能

xiaoxin hace 4 años
padre
commit
479d912900
Se han modificado 2 ficheros con 61 adiciones y 5 borrados
  1. 2 2
      config/index.js
  2. 59 3
      src/components/smokeWarn/index.vue

+ 2 - 2
config/index.js

@@ -21,8 +21,8 @@ module.exports = {
       },
       '/diseaseRight': {
         // target: 'http://192.168.161.230:8089/disease-command',
-        target: 'http://58.17.42.179:90/diseaseRight',
-        // target: 'http://chuanghai-dev.natapp1.cc/disease-command',
+        // target: 'http://58.17.42.179:90/diseaseRight',
+        target: 'http://chuanghai-dev.natapp1.cc/disease-command',
         changeOrigin: true,
         pathRewrite: {
           '^/diseaseRight': ''

+ 59 - 3
src/components/smokeWarn/index.vue

@@ -56,6 +56,7 @@
           highlight-current-row
           height="450"
         >
+
           <el-table-column
             prop="publishTime"
             label="发现时间"
@@ -90,18 +91,25 @@
               <img
                 style="width: 82px; height: 60px"
                 :src="row.images"
+                @click="handleImg"
               />
+              <el-dialog :visible.sync="dialogVisibleImg">
+                <img
+                  width="100%"
+                  :src="row.images"
+                >
+              </el-dialog>
             </template>
           </el-table-column>
 
           <el-table-column
-            label="操作详情"
+            label="处置详情"
             align="center"
           >
             <template slot-scope="{ row }">
               <div v-if="row.handleStatus==='1'">
                 <el-button
-                  type="danger"
+                  type="warning"
                   @click="handleWarn(row.id)"
                 >未处理</el-button>
               </div>
@@ -110,6 +118,18 @@
               </div>
             </template>
           </el-table-column>
+
+          <el-table-column
+            label="操作"
+            align="center"
+          >
+            <template slot-scope="{ row }">
+              <el-button
+                type="danger"
+                @click="deleteWarn(row.id)"
+              >删除</el-button>
+            </template>
+          </el-table-column>
         </el-table>
       </el-col>
     </el-row>
@@ -205,6 +225,7 @@ export default {
       dialogVisible: false,
       textarea: "", // 处理内容
       warningId: "",
+      dialogVisibleImg: false,
     };
   },
   mounted() {
@@ -240,7 +261,6 @@ export default {
       });
       return peopleArr;
     },
-
     // 获取 冒烟警告记录列表
     async getSmokeRecord() {
       let params = {
@@ -302,6 +322,42 @@ export default {
       }
       this.handleCurrentChange(this.curPage);
     },
+    // 放大图片
+    handleImg() {
+      this.dialogVisibleImg = true;
+    },
+    // 删除冒烟告警记录
+    deleteWarn(id) {
+      this.$confirm("此操作将永久删除该记录, 是否继续?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(async () => {
+          let res = await this.$axios({
+            url: "/diseaseRight/warningOfSmokeRecord/delete",
+            method: "delete",
+            data: [id],
+            headers: {
+              "Admin-Token": sessionStorage.getItem("token"),
+            },
+          });
+          // console.log(res);
+          if (res.data.success) {
+            this.$message.success("删除成功");
+            let totalPage = Math.ceil((this.totalCount - 1) / this.pageSize);
+            let currentPage =
+              this.curPage > totalPage ? totalPage : this.curPage;
+            this.curPage = currentPage < 1 ? 1 : currentPage;
+            this.getSmokeRecord();
+          } else {
+            this.$message.error("删除失败!");
+          }
+        })
+        .catch(() => {
+          this.$message.info("已取消删除");
+        });
+    },
   },
 };
 </script>