Min 1 year ago
parent
commit
263dc7f108

+ 19 - 4
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/controller/PlanController.java

@@ -1,13 +1,12 @@
 package com.management.platform.controller;
 
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.management.platform.entity.Plan;
-import com.management.platform.entity.PlanProcedureTotal;
-import com.management.platform.entity.PlanSteelStampNumber;
-import com.management.platform.entity.ProdProcedureTeam;
+import com.management.platform.entity.*;
 import com.management.platform.service.PlanService;
 import com.management.platform.service.PlanSteelStampNumberService;
+import com.management.platform.service.ReportService;
 import com.management.platform.util.HttpRespMsg;
 import org.apache.ibatis.annotations.Param;
 import org.springframework.transaction.annotation.Transactional;
@@ -38,6 +37,8 @@ public class PlanController {
     private PlanService planService;
     @Resource
     private PlanSteelStampNumberService planSteelStampNumberService;
+    @Resource
+    private ReportService reportService;
 
     @RequestMapping("/list")
     public HttpRespMsg list(String date,String steelStampNumber,@RequestParam(defaultValue = "3") Integer planType,Integer deptId,Integer pageIndex,Integer pageSize,Integer isMob){
@@ -154,5 +155,19 @@ public class PlanController {
     public HttpRespMsg allPlanList(HttpServletRequest request){
         return planService.allPlanList(request);
     }
+
+    @RequestMapping("/deletePlan")
+    public HttpRespMsg deletePlan(Integer id){
+        HttpRespMsg msg=new HttpRespMsg();
+        Plan plan = planService.getById(id);
+        Report one = reportService.getOne(new LambdaQueryWrapper<Report>().eq(Report::getPlanId, id));
+        if(one==null){
+            plan.setIsDelete(1);
+            planService.updateById(plan);
+            return msg;
+        }
+        msg.setError("‘已有员工报工,删除失败");
+        return msg;
+    }
 }
 

+ 8 - 2
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/entity/Plan.java

@@ -22,7 +22,7 @@ import org.springframework.format.annotation.DateTimeFormat;
  * </p>
  *
  * @author Seyason
- * @since 2023-11-16
+ * @since 2023-11-27
  */
 @Data
 @EqualsAndHashCode(callSuper = false)
@@ -218,7 +218,7 @@ public class Plan extends Model<Plan> {
     private String createId;
 
     /**
-     * 0-待下发 1-已下发
+     * 0-待下发 1-已下发 2-已中止
      */
     @TableField("status")
     private Integer status;
@@ -241,6 +241,12 @@ public class Plan extends Model<Plan> {
     @TableField("hide_state")
     private Integer hideState;
 
+    /**
+     * 是否删除0-否 1-是
+     */
+    @TableField("is_delete")
+    private Integer isDelete;
+
     @TableField(exist = false)
     private String  steelStampNumber;
 

+ 1 - 0
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/service/impl/PlanServiceImpl.java

@@ -112,6 +112,7 @@ public class PlanServiceImpl extends ServiceImpl<PlanMapper, Plan> implements Pl
         format.setMinimumFractionDigits(2);
         queryWrapper.eq(Plan::getCompanyId,companyId);
         queryWrapper.ne(Plan::getStatus,2);
+        queryWrapper.eq(Plan::getIsDelete,0);
         if(planType!=2){
             queryWrapper.eq(Plan::getPlanType,0);
         }else {

+ 2 - 1
fhKeeper/formulahousekeeper/management-workshop/src/main/resources/mapper/PlanMapper.xml

@@ -37,11 +37,12 @@
         <result column="vehicle_num_start" property="vehicleNumStart" />
         <result column="vehicle_num_end" property="vehicleNumEnd" />
         <result column="hide_state" property="hideState" />
+        <result column="is_delete" property="isDelete" />
     </resultMap>
 
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
-        id, product_scheduling_num, product_id, product_name, project_code, company_id, num, main_process, station_id, station_name, foreman_id, foreman_name, plan_type, start_date, end_date, plan_total_wages, progress, task_name, task_type_id, task_type_name, check_type, task_change_notice_num, plan_man_num, plan_work_hour, money_of_job, describtion, version_number, create_time, create_id, status, vehicle_num_start, vehicle_num_end, hide_state
+        id, product_scheduling_num, product_id, product_name, project_code, company_id, num, main_process, station_id, station_name, foreman_id, foreman_name, plan_type, start_date, end_date, plan_total_wages, progress, task_name, task_type_id, task_type_name, check_type, task_change_notice_num, plan_man_num, plan_work_hour, money_of_job, describtion, version_number, create_time, create_id, status, vehicle_num_start, vehicle_num_end, hide_state, is_delete
     </sql>
 
 </mapper>

+ 1 - 1
fhKeeper/formulahousekeeper/timesheet-workshop-h5/src/views/workView/fillReport.vue

@@ -198,7 +198,7 @@ export default {
         }).catch(err => { this.$toast.clear(); });
     },
     steelNumFilter(){
-      this.reportForm.planSteelStampNumberList=this.oldPlanSteelStampNumberList.filter(item => item.includes(this.inputSteelNum));
+      this.reportForm.planSteelStampNumberList=this.oldPlanSteelStampNumberList.filter(item => item.number.includes(this.inputSteelNum));
     },
 
     //打开报工页面

+ 36 - 1
fhKeeper/formulahousekeeper/timesheet-workshop/src/views/plan/planComponent.vue

@@ -82,6 +82,7 @@
         <el-table-column label="操作" :fixed="'right'">
           <template slot-scope="scope">
             <div @click="editPlan(scope.row)" class="colorText">编辑</div>
+            <div @click="deletePlan(scope.row.id)" class="colorText">删除</div>
             <div v-if="jisuanDate(scope.row.startDate) > 30" @click="hidePlan(scope.row.id, scope.row.hideState)"
               class="colorText">{{ scope.row.hideState == 0 ? '隐藏' : '取消隐藏' }}</div>
           </template>
@@ -1014,7 +1015,41 @@ export default {
           );
         }
       });
-    }
+    },
+    //删除计划
+    deletePlan(id) {
+      this.$alert('该计划将被删除','是否删除该计划', {
+        confirmButtonText: '确定',
+        callback: action => {
+          this.http.post(
+            "/plan/deletePlan",
+            {
+              id: id,
+            },
+            (res) => {
+              if (res.code == "ok") {
+                this.$message({
+                  message: '删除成功',
+                  type: "success",
+                });
+              } else {
+                this.$message({
+                  message: res.msg,
+                  type: "error",
+                });
+              }
+              this.getTableData()
+            },
+            (error) => {
+              this.$message({
+                message: error,
+                type: "error",
+              });
+            }
+          );
+        }
+      });
+    },
   },
 };
 </script>