Browse Source

告警处理大致完成

Reiskuchen 5 years ago
parent
commit
9a07791d43

+ 2 - 1
ys_vue/src/port.js

@@ -72,7 +72,8 @@ export default {
         moldMaintain: '/mouldmaintain/maintain', //维护
         moldMaintainList: '/mouldmaintain/list', //获取列表
         moldMaintainListGet: '/mould/maintainMouldList', //主页获取保养模具列表
-        moldDiscardListGet: '/mould/scrapMouldList' //主页获取报废模具列表
+        moldDiscardListGet: '/mould/scrapMouldList', //主页获取报废模具列表
+        moldChange: '/mould/changeMouldEquipment' //处理告警
     },
     //基础管理
     base: {

+ 169 - 64
ys_vue/src/views/detection/maintenance.vue

@@ -8,11 +8,6 @@
         </el-form-item>
         <el-form-item class="divLine"></el-form-item>
         <el-form-item>{{mouldName}}</el-form-item>
-        <!-- <el-form-item style="float:right;">
-          保养提醒:
-          <el-switch v-model="prompt" active-color="#ff4949"></el-switch>
-        </el-form-item>-->
-
         <el-form-item class="state" style="float: right;">
           当前状态:
           <span v-if="mouldState == 0">静止</span>
@@ -37,9 +32,15 @@
         style="margin-left: 16px;"
       >立即处理</el-button>
     </el-col>
-    <el-col :span="4" :offset="2" style="line-height: 32px;">
-      云模盒告警:{{warning}}
-      <el-button size="small" v-if="!(user.parentId == 1 && user.subordinateType == 1)" type="primary" style="margin-left: 16px;">立即处理</el-button>
+    <el-col :span="8" :offset="2" style="line-height: 32px;">
+      云模盒告警:{{warningInfo}}
+      <el-button
+        size="small"
+        v-if="!(user.parentId == 1 && user.subordinateType == 1)"
+        @click="warningFormVisible = true"
+        type="primary"
+        style="margin-left: 16px;"
+      >立即处理</el-button>
     </el-col>
 
     <!-- 操作记录 -->
@@ -156,6 +157,42 @@
         <el-button type="primary" @click.native="maintainConfirm" :loading="maintenanceLoading">立即处理</el-button>
       </div>
     </el-dialog>
+
+    <!--告警处理界面-->
+    <el-dialog
+      title="告警处理"
+      v-if="warningFormVisible"
+      :visible.sync="warningFormVisible"
+      :close-on-click-modal="false"
+      customClass="customWidth"
+    >
+      <el-form
+        :model="warningForm"
+        label-width="100px"
+        :rules="formRules"
+        ref="addForm"
+        :inline="true"
+        class="demo-form-inline"
+      >
+        <el-form-item label="报警类型">
+          <el-input placeholder="报警类型" v-model="warningInfo" :disabled="true"></el-input>
+        </el-form-item>
+        <el-form-item label="云模盒设置" prop="action">
+          <el-select v-model="warningForm.equipmentId" filterable placeholder="请选择云模盒" style="width:202px">
+            <el-option
+              v-for="item in equipments"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click.native="maintenanceFormVisible = false">取消</el-button>
+        <el-button type="primary" @click.native="warningArrangement" :loading="warningLoading">立即处理</el-button>
+      </div>
+    </el-dialog>
   </section>
 </template>
 
@@ -164,58 +201,72 @@ import util from "../../common/js/util";
 export default {
   data() {
     return {
-        user: JSON.parse(sessionStorage.getItem('user')),
-        //本页模具ID
+      user: JSON.parse(sessionStorage.getItem("user")),
+      //本页模具ID
+      mouldId: null,
+      //模具名字
+      mouldName: null,
+      //模具状态
+      mouldState: 0,
+      options: [{ value: "aaa", label: "123" }, { value: "bbb", label: "456" }],
+      //记录
+      records: [],
+      //警告信息
+      warningInfo: "低电量、过热",
+      //告警时需要更换的设备的列表
+      equipments: [
+        { value: 1, label: "临时设备1" },
+        { value: 2, label: "临时设备2" },
+        { value: 3, label: "临时设备3" }
+      ],
+      //标题栏过滤器
+      filters: {
+        name: "",
+        value: ""
+      },
+      listLoading: false,
+      page: 1,
+      size: 20,
+      total: 0,
+      tableHeight: 0,
+      //活跃页面
+      activePage: 0,
+      formRules: {},
+      //保养界面 种类
+      type: [{ label: "动作", value: 0 }, { label: "易损件", value: 1 }],
+      //保养界面 动作
+      action: [{ label: "喷漆", value: 0 }, { label: "检查", value: 1 }],
+      //易损件 假数据
+      vulnerable: [
+        { label: "易损件1", value: 0 },
+        { label: "易损件12450", value: 1 },
+        { label: "易损件114514", value: 2 }
+      ],
+      //是否需要保养 提示
+      requirement: false,
+      prompt: true,
+      //保养详情界面显示
+      maintenanceFormVisible: false,
+      maintenanceLoading: false,
+      //告警详情界面显示
+      warningFormVisible: false,
+      warningLoading: false,
+      //保养详情界面数据
+      maintenanceForm: {
+        username: "",
+        account: "",
+        mobile: "",
+        teamName: "",
+        companyId: "",
+        roleType: "",
+        flag: 0
+      },
+      //告警处理截面数据
+      warningForm: {
         mouldId: null,
-        //模具名字
-        mouldName: null,
-        //模具状态
-        mouldState: 0,
-        options: [{ value: "aaa", label: "123" }, { value: "bbb", label: "456" }],
-        //记录
-        records: [],
-        //警告信息
-        warning: "低电量、过热",
-        //标题栏过滤器
-        filters: {
-            name: "",
-            value: ""
-        },
-        listLoading: false,
-        page: 1,
-        size: 20,
-        total: 0,
-        tableHeight: 0,
-        //活跃页面
-        activePage: 0,
-        formRules: {},
-        //保养界面 种类
-        type: [{ label: "动作", value: 0 }, { label: "易损件", value: 1 }],
-        //保养界面 动作
-        action: [{ label: "喷漆", value: 0 }, { label: "检查", value: 1 }],
-        //易损件
-        vulnerable: [
-            { label: "易损件1", value: 0 },
-            { label: "易损件12450", value: 1 },
-            { label: "易损件114514", value: 2 }
-        ],
-        //是否需要保养 提示
-        requirement: false,
-        prompt: true,
-        //保养详情界面显示
-        maintenanceFormVisible: false,
-        maintenanceLoading: false,
-        //保养详情界面数据
-        maintenanceForm: {
-            username: "",
-            account: "",
-            mobile: "",
-            teamName: "",
-            companyId: "",
-            roleType: "",
-            flag: 0
-        },
-        imageUrl: ""
+        equipmentId: null
+      },
+      imageUrl: ""
     };
   },
   methods: {
@@ -231,7 +282,7 @@ export default {
     //标签页面切换时
     handleClick(tab, event) {
       this.activeTab = tab.name;
-      //应该是取得对应的消息
+      //应该是取得对应的消息 目前还没写
     },
     selsChange: function(sels) {
       this.sels = sels;
@@ -254,7 +305,7 @@ export default {
       }
       return rightType && isLt5M;
     },
-    //显示新增界面
+    //显示保养界面
     showMaintenance: function() {
       this.maintenanceFormVisible = true;
     },
@@ -325,7 +376,6 @@ export default {
     //模具保养
     maintain(params) {
       if (this.type.value != null) {
-        console.log("啦啦啦");
         var fileObj = params.file;
         var form = new FormData();
         form.append("file", fileObj);
@@ -371,16 +421,71 @@ export default {
           }
         );
       }
+    },
+    //获取告警时可以更换的设备列表
+    getAlternativeEquipment() {
+      this.http.post(
+        this.port.base.moulds,
+        {
+          belongCompanyId: this.user.companyId
+        },
+        res => {
+          if (res.code == "ok") {
+            //顺便把相关的告警中的模具ID赋值一下
+            this.warningForm.mouldId = this.mouldId;
+          } else {
+            this.$message({
+              message: res.msg,
+              type: "error"
+            });
+          }
+        },
+        error => {
+          this.$message({
+            message: error,
+            type: "error"
+          });
+        }
+      );
+    },
+    //告警处理
+    warningArrangement() {
+        console.log(this.warningForm);
+    //   this.http.post(
+    //     this.port.mold.moldChange,
+    //     this.warningForm,
+    //     res => {
+    //       if (res.code == "ok") {
+    //         this.$message({
+    //           message: "告警处理完毕",
+    //           type: "success"
+    //         });
+    //         this.warningFormVisible = false;
+    //       } else {
+    //         this.$message({
+    //           message: res.msg,
+    //           type: "error"
+    //         });
+    //       }
+    //     },
+    //     error => {
+    //       this.$message({
+    //         message: error,
+    //         type: "error"
+    //       });
+    //     }
+    //   );
     }
   },
   created() {
-    // let height = window.innerHeight;
-    // this.tableHeight = height - 260;
+    let height = window.innerHeight;
+    this.tableHeight = height - 260;
   },
   mounted() {
     this.mouldId = this.$route.params.id; //传到当前页面的模具编号
     this.getList();
     this.getDetail();
+    this.getAlternativeEquipment();
   }
 };
 </script>

+ 6 - 2
ys_vue/src/views/mold/moldDetail.vue

@@ -721,11 +721,15 @@
             },
 
             toAnotherMould(id){
-                var currentRoute = this.$route.path.split("/");                
-                this.$router.push('/mould/' + id);
+                //简单粗暴的方法到另一个模具详情
+                var currentRoute = this.$route.path.split("/");
                 if (currentRoute.length == 3 && currentRoute[1] == "moldList") {
                     this.$router.go(0);
                 }
+                this.$router.replace('/moldList/' + id);
+                //更加简单粗暴地方法
+                // this.detailId = id;
+                // this.getDetail();
             },
 
             //标签页面切换时

+ 0 - 20
ys_vue/src/views/mold/moldDownload.vue

@@ -205,26 +205,6 @@ export default {
       if (this.selectedArray.length == 0) {
         this.$message("请选择要下载的文档");
       } else {
-        // switch (type) {
-        //   case 0:
-        //     this.downloadPost();
-        //     break;
-        //   case 1:
-        //     console.log("点击了下载模具3D图档,但是什么都没发生");
-        //     break;
-        //   case 2:
-        //     console.log("点击了下载模具2D图档,但是什么都没发生");
-        //     break;
-        //   case 3:
-        //     console.log("点击了下载零件3D图档,但是什么都没发生");
-        //     break;
-        //   case 4:
-        //     console.log("点击了下载零件2D图档,但是什么都没发生");
-        //     break;
-        //   case 5:
-        //     console.log("点击了下载保养方案,但是什么都没发生");
-        //     break;
-        // }
         this.downloadPost(type);
       }
     },