소스 검색

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

sunyadv 5 년 전
부모
커밋
87a7ed31e6

+ 33 - 5
cloud-model/src/main/java/com/hssx/cloudmodel/controller/MouldController.java

@@ -1,21 +1,49 @@
 package com.hssx.cloudmodel.controller;
 
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.hssx.cloudmodel.entity.Mould;
+import com.hssx.cloudmodel.entity.MouldEquipment;
+import com.hssx.cloudmodel.entity.User;
+import com.hssx.cloudmodel.service.MouldService;
+import com.hssx.cloudmodel.util.HttpRespMsg;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
 
+import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.bind.annotation.RestController;
 
 /**
- * <p>
- *  前端控制器
- * </p>
- *
  * @author 吴涛涛
  * @since 2019-07-30
  */
-@RestController
+@Controller
 @RequestMapping("/mould")
 public class MouldController {
+    @Autowired
+    private MouldService mouldService;
+    /**
+     * 添加/修改模具设备
+     * 添加参数:modelName ,useLife 使用年限, equipmentNo 设备编号 ,
+     * belongCompanyId 所属公司id ,equipmentName 设备名称
+     * 修改时需多传的参数 id 设备id
+     * @return
+     */
+    @ApiOperation("添加/修改模具")
+    @RequestMapping("/addOrUpdate")
+    @ResponseBody
+    public HttpRespMsg addOrUpdate(Mould mould, String token) {
+        HttpRespMsg msg = new HttpRespMsg();
+//        QueryWrapper<User> qw = new QueryWrapper<>();
+//        qw.eq("head_imgurl",token);
+//        User user = userService.getOne(qw);
+//        msg = mouldEquipmentService.addAndUpdateMouldEquipment(mouldEquipment,user);
+        return msg;
+    }
+
+
 
 }
 

+ 17 - 6
cloud-model/src/main/java/com/hssx/cloudmodel/controller/MouldEquipmentController.java

@@ -3,7 +3,6 @@ package com.hssx.cloudmodel.controller;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.hssx.cloudmodel.entity.MouldEquipment;
-import com.hssx.cloudmodel.entity.Project;
 import com.hssx.cloudmodel.entity.User;
 import com.hssx.cloudmodel.service.MouldEquipmentService;
 import com.hssx.cloudmodel.service.UserService;
@@ -12,12 +11,8 @@ import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
-
-import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.ResponseBody;
-import org.springframework.web.bind.annotation.RestController;
 
-import javax.servlet.http.HttpServletRequest;
 
 /**
  *
@@ -35,7 +30,7 @@ public class MouldEquipmentController {
      * 添加/修改模具设备
      * 添加参数:equipmentName 设备名称,useLife 使用年限, equipmentNo 设备编号 ,
      * belongCompanyId 所属公司id ,equipmentName 设备名称
-     * 修改时需多传的参数 id 设备id ,isUse 是否启用 0-不启用 1-启用
+     * 修改时需多传的参数 id 设备id
      * @return
      */
     @ApiOperation("添加/修改模具设备")
@@ -50,5 +45,21 @@ public class MouldEquipmentController {
         return msg;
     }
 
+    /**
+     * 启用设备
+     * 传参 id 设备id ,isUse 启用传 1
+     * @return
+     */
+    @ApiOperation("启用设备")
+    @RequestMapping("/use")
+    @ResponseBody
+    public HttpRespMsg use(MouldEquipment mouldEquipment,String token) {
+        HttpRespMsg msg = new HttpRespMsg();
+        QueryWrapper<User> qw = new QueryWrapper<>();
+        qw.eq("head_imgurl",token);
+        User user = userService.getOne(qw);
+        msg = mouldEquipmentService.isUse(mouldEquipment,user);
+        return msg;
+    }
 }
 

+ 1 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/controller/ProjectController.java

@@ -62,6 +62,7 @@ public class ProjectController{
     @RequestMapping("/getUserListByCompanyIds")
     @ResponseBody
     public HttpRespMsg getUserListByCompanyIds(String companyIds){
+        System.out.println("companyIds"+companyIds);
         HttpRespMsg msg = projectService.getUserListByCompanyIds(companyIds);
         return msg;
     }

+ 2 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/service/MouldEquipmentService.java

@@ -16,4 +16,6 @@ import com.hssx.cloudmodel.util.HttpRespMsg;
 public interface MouldEquipmentService extends IService<MouldEquipment> {
 
     HttpRespMsg addAndUpdateMouldEquipment(MouldEquipment mouldEquipment, User user);
+
+    HttpRespMsg isUse(MouldEquipment mouldEquipment, User user);
 }

+ 14 - 1
cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/MouldEquipmentServiceImpl.java

@@ -33,7 +33,20 @@ public class MouldEquipmentServiceImpl extends ServiceImpl<MouldEquipmentMapper,
                 mouldEquipmentMapper.updateById(mouldEquipment);
             }
         }else{
-            msg.setError("对不起,您不是管理员,不具备设备创建的权限");
+            msg.setError("对不起,您不是管理员,不具备设备创建或修改的权限");
+        }
+        return msg;
+    }
+
+    @Override
+    public HttpRespMsg isUse(MouldEquipment mouldEquipment, User user) {
+        HttpRespMsg msg = new HttpRespMsg();
+        //判断是不是超级管理员,是才可操作
+        if(user.getParentId() == 0){
+                //修改设备
+                mouldEquipmentMapper.updateById(mouldEquipment);
+        }else{
+            msg.setError("对不起,您不是管理员,不具备启用设备的权限");
         }
         return msg;
     }

+ 1 - 1
cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/ProjectServiceImpl.java

@@ -179,7 +179,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
     public HttpRespMsg getUserListByCompanyIds(String companyIds) {
         HttpRespMsg msg = new HttpRespMsg();
         if(!"".equals(companyIds) && companyIds != null){
-            List<Integer> ids = ListUtil.convertIntegerIdsArrayToList("companyIds");
+            List<Integer> ids = ListUtil.convertIntegerIdsArrayToList(companyIds);
             msg.data = userMapper.selectList(new QueryWrapper<User>().in("company_id",ids));
         }
         return msg;

+ 1 - 1
cloud-model/src/main/java/com/hssx/cloudmodel/util/ListUtil.java

@@ -53,7 +53,7 @@ public class ListUtil {
 		List<Integer> ids = new ArrayList<Integer>();
 		for (String a : array) {
 			if (a != null && a.length() > 0) {
-				ids.add(Integer.valueOf(a));
+				ids.add(Integer.parseInt(a));
 			}
 		}
 		return ids;

+ 17 - 6
ys_vue/src/views/base/allocation.vue

@@ -34,14 +34,21 @@
       <el-table-column prop="assets" label="资产方" width="120" sortable></el-table-column>
       <el-table-column prop="state" label="模具状态" width="100" sortable>
         <template slot-scope="scope">
-          <span v-if="scope.row.state == true">运行</span>
-          <span v-else>停止</span>
-          <el-switch v-model="scope.row.state"></el-switch>
+          <span v-if="scope.row.state == false">未启用</span>
+          <span v-else>已启用</span>
         </template>
       </el-table-column>
-      <el-table-column label="操作" width="160" sortable>
-        <el-button size="small">修改</el-button>
-        <el-button type="danger" size="small">删除</el-button>
+      <el-table-column label="操作" width="220" sortable>
+        <template slot-scope="scope">
+          <el-button
+            size="small"
+            type="primary"
+            @click="enable(scope.$index)"
+            :disabled="scope.row.state == true"
+          >启用</el-button>
+          <el-button size="small">修改</el-button>
+          <el-button type="danger" size="small">删除</el-button>
+        </template>
       </el-table-column>
     </el-table>
 
@@ -148,6 +155,10 @@ export default {
         deviceNumber: "",
         company: ""
       };
+    },
+    //启用设备
+    enable(index) {
+      this.allocations[index].state = true;
     }
   },
   created() {