소스 검색

Merge branch 'master' of http://47.100.37.243:10080/ZHOU/yunsu

5 년 전
부모
커밋
960b1db272
3개의 변경된 파일87개의 추가작업 그리고 27개의 파일을 삭제
  1. 2 1
      ys_vue/src/port.js
  2. 31 5
      ys_vue/src/views/Home.vue
  3. 54 21
      ys_vue/src/views/detection/maintenance.vue

+ 2 - 1
ys_vue/src/port.js

@@ -59,7 +59,8 @@ export default {
         partUpload: '/mouldfile/uploadPartFileList', //零件文档的批量上传
 
         moldMaintain: '/mouldmaintain/maintain', //维护
-        moldMaintainList: '/mouldmaintain/list' //获取列表
+        moldMaintainList: '/mouldmaintain/list', //获取列表
+        moldMaintainListGet: '/mould/maintainMouldList' //主页获取模具列表*
     },
     //基础管理
     base: {

+ 31 - 5
ys_vue/src/views/Home.vue

@@ -332,19 +332,45 @@ export default {
         this.$router.push("/detection/" + id);
       }
     },
+    //检查是否要进行提示
+    checkNotice() {
+      this.http.post(
+        this.port.mold.moldMaintainListGet,
+        {},
+        res => {
+          if (res.code == "ok") {
+            res.data.forEach(item => {
+              this.notify(item.modelName);
+            });
+          } else {
+            this.$message({
+              message: res.msg,
+              type: "error"
+            });
+          }
+        },
+        error => {
+          this.editLoading = false;
+          this.$message({
+            message: error,
+            type: "error"
+          });
+        }
+      );
+    },
     //右上角弹窗警告
-    notify() {
+    notify(name) {
       this.$notify({
-        title: "警告",
-        message: "这是一条烦人的警告提示消息",
+        title: "需要保养",
+        message: name + "需要保养,请到消息列表中查看",
         type: "warning",
         duration: 0
       });
     }
   },
   mounted() {
-    // this.notify();
-
+    //检查是否需要进行提示
+    this.checkNotice();
     if (this.user) {
       var user = JSON.parse(this.user);
       this.user = user;

+ 54 - 21
ys_vue/src/views/detection/maintenance.vue

@@ -7,13 +7,11 @@
           <el-button type="text" @click="backToDetection" icon="el-icon-back" class="back">返回</el-button>
         </el-form-item>
         <el-form-item class="divLine"></el-form-item>
-        <el-form-item>
-          {{mouldName}}
-        </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>-->
         <el-form-item style="float: right">
           当前保养状态:
           <span style="color: #ff4949; margin-right: 16px;">需要</span>
@@ -78,9 +76,9 @@
           </el-select>
         </el-form-item>
         <!-- 保养类型为1时 选择易损件ID -->
-        <el-form-item v-if="type.value == 1" label="选择易损件" prop="action">
+        <el-form-item v-if="type.value == 1" label="选择易损件" prop="vulnerable">
           <el-select
-            v-model="action.value"
+            v-model="vulnerable.value"
             clearable
             filterable
             placeholder="请选择易损件"
@@ -97,7 +95,7 @@
         <!-- 保养类型为0时 选择保养动作 -->
         <el-form-item v-else label="选择动作" prop="action">
           <el-select
-            v-model="maintenanceForm.action"
+            v-model="action.value"
             filterable
             placeholder="请选择动作"
             style="width:202px"
@@ -110,10 +108,21 @@
             ></el-option>
           </el-select>
         </el-form-item>
+        <el-form-item label="选择照片">
+          <el-upload
+            ref="upload"
+            action="customize"
+            :http-request="maintain"
+            :limit="1"
+            :auto-upload="false"
+          >
+            <el-button size="small" type="primary">上传</el-button>
+          </el-upload>
+        </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="maintain" :loading="maintenanceLoading">立即处理</el-button>
+        <el-button type="primary" @click.native="maintainConfirm" :loading="maintenanceLoading">立即处理</el-button>
       </div>
     </el-dialog>
   </section>
@@ -167,7 +176,8 @@ export default {
         companyId: "",
         roleType: "",
         flag: 0
-      }
+      },
+      imageUrl: ""
     };
   },
   methods: {
@@ -186,6 +196,17 @@ export default {
     backToDetection() {
       this.$router.go(-1);
     },
+    beforeUpload(file) {
+      const isJPG = file.type === "image/png";
+      const isLt2M = file.size / 1024 / 1024 < 2;
+      if (!isJPG) {
+        this.$message.error("上传头像图片只能是 PNG 格式!");
+      }
+      if (!isLt2M) {
+        this.$message.error("上传头像图片大小不能超过 2MB!");
+      }
+      return isJPG && isLt2M;
+    },
     //显示新增界面
     showMaintenance: function() {
       this.maintenanceFormVisible = true;
@@ -241,21 +262,33 @@ export default {
         }
       );
     },
-    //模具保养 N/A
-    maintain() {
-      var param = {
-        mouldId: this.mouldId,
-        maintainType: this.type.value,
-        ways: null
-      };
-      if (param.maintainType == 0) {
-        param.ways = this.action.value;
+    //模具保养的按钮按下之后(关闭之后也要清理文件但是还没写)
+    maintainConfirm() {
+      if (this.$refs.upload.uploadFiles.length == 1) {
+        this.$refs.upload.submit();
+        this.$refs.upload.clearFiles();
       } else {
-        param.ways = null; //后面应该换成易损件的ID
+        this.$message({
+          message: "必须上传照片",
+          type: "error"
+        });
       }
-      this.http.post(
+    },
+    //模具保养
+    maintain(params) {
+      var fileObj = params.file;
+      var form = new FormData();
+      form.append("file", fileObj);
+      form.append("mouldId", this.mouldId);
+      form.append("maintainType", this.type.value);
+      if (this.type.value == 0) {
+        form.append("ways", this.action.value);
+      } else {
+        form.append("ways", this.vulnerable.value); //后面应该换成易损件的ID
+      }
+      this.http.uploadFile(
         this.port.mold.moldMaintain,
-        param,
+        form,
         res => {
           if (res.code == "ok") {
             this.$message({