Procházet zdrojové kódy

质量月报 - 新增批量删除指定功能,可指定采样点、时间范围

wangggziwen před 1 rokem
rodič
revize
51ed2c8957

+ 9 - 0
master/src/main/java/com/ruoyi/project/production/controller/TMonthlyQualityReportController.java

@@ -116,6 +116,15 @@ public class TMonthlyQualityReportController extends BaseController
     @Autowired
     private ITMonthlyQualityCommentService tMonthlyQualityCommentService;
 
+    /**
+     * 批量删除
+     */
+    @PostMapping("/remove")
+    public AjaxResult remove(MonthlyQualityRemoveVO vo) {
+        tMonthlyQualityReportS0501Service.deleteTMonthlyQualityReportBranch(vo);
+        return AjaxResult.success();
+    }
+
     /**
      * 碳二反应器性能指标趋势图
      */

+ 40 - 0
master/src/main/java/com/ruoyi/project/production/controller/vo/MonthlyQualityRemoveVO.java

@@ -0,0 +1,40 @@
+package com.ruoyi.project.production.controller.vo;
+
+import java.util.Date;
+
+/**
+ * @author Wang Zi Wen
+ * @email wangggziwen@163.com
+ * @date 2024/01/03 15:26:39
+ */
+public class MonthlyQualityRemoveVO {
+    private String samplePoint;
+
+    private Date startDate;
+
+    private Date endDate;
+
+    public String getSamplePoint() {
+        return samplePoint;
+    }
+
+    public void setSamplePoint(String samplePoint) {
+        this.samplePoint = samplePoint;
+    }
+
+    public Date getStartDate() {
+        return startDate;
+    }
+
+    public void setStartDate(Date startDate) {
+        this.startDate = startDate;
+    }
+
+    public Date getEndDate() {
+        return endDate;
+    }
+
+    public void setEndDate(Date endDate) {
+        this.endDate = endDate;
+    }
+}

+ 3 - 0
master/src/main/java/com/ruoyi/project/production/mapper/TMonthlyQualityReportS0501Mapper.java

@@ -2,6 +2,7 @@ package com.ruoyi.project.production.mapper;
 
 import java.util.List;
 import com.ruoyi.framework.aspectj.lang.annotation.DataScope;
+import com.ruoyi.project.production.controller.vo.MonthlyQualityRemoveVO;
 import com.ruoyi.project.production.domain.TMonthlyQualityReportS0501;
 
 /**
@@ -62,4 +63,6 @@ public interface TMonthlyQualityReportS0501Mapper
      * @return 结果
      */
     public int deleteTMonthlyQualityReportS0501ByIds(Long[] ids);
+
+    public void deleteTMonthlyQualityReportBranch(MonthlyQualityRemoveVO vo);
 }

+ 4 - 0
master/src/main/java/com/ruoyi/project/production/service/ITMonthlyQualityReportS0501Service.java

@@ -1,6 +1,8 @@
 package com.ruoyi.project.production.service;
 
 import java.util.List;
+
+import com.ruoyi.project.production.controller.vo.MonthlyQualityRemoveVO;
 import com.ruoyi.project.production.domain.TMonthlyQualityReportS0501;
 
 /**
@@ -60,4 +62,6 @@ public interface ITMonthlyQualityReportS0501Service
      * @return 结果
      */
     public int deleteTMonthlyQualityReportS0501ById(Long id);
+
+    public void deleteTMonthlyQualityReportBranch(MonthlyQualityRemoveVO vo);
 }

+ 5 - 0
master/src/main/java/com/ruoyi/project/production/service/impl/TMonthlyQualityReportS0501ServiceImpl.java

@@ -2,6 +2,7 @@ package com.ruoyi.project.production.service.impl;
 
 import java.util.List;
 import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.project.production.controller.vo.MonthlyQualityRemoveVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.ruoyi.project.production.mapper.TMonthlyQualityReportS0501Mapper;
@@ -98,4 +99,8 @@ public class TMonthlyQualityReportS0501ServiceImpl implements ITMonthlyQualityRe
     {
         return tMonthlyQualityReportS0501Mapper.deleteTMonthlyQualityReportS0501ById(id);
     }
+
+    public void deleteTMonthlyQualityReportBranch(MonthlyQualityRemoveVO vo) {
+        tMonthlyQualityReportS0501Mapper.deleteTMonthlyQualityReportBranch(vo);
+    }
 }

+ 27 - 0
master/src/main/resources/mybatis/production/TMonthlyQualityReportS0501Mapper.xml

@@ -211,5 +211,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             #{id}
         </foreach>
     </update>
+
+    <update id="deleteTMonthlyQualityReportBranch" parameterType="com.ruoyi.project.production.controller.vo.MonthlyQualityRemoveVO">
+        <if test="samplePoint == 1">update t_monthly_quality_report_s0501 set del_flag = 2 where sample_date &gt;= #{startDate} and sample_date &lt;= #{endDate}</if>
+        <if test="samplePoint == 2">update t_monthly_quality_report_s1301 set del_flag = 2 where sample_date &gt;= #{startDate} and sample_date &lt;= #{endDate}</if>
+        <if test="samplePoint == 3">update t_monthly_quality_report_s2002 set del_flag = 2 where sample_date &gt;= #{startDate} and sample_date &lt;= #{endDate}</if>
+        <if test="samplePoint == 4">update t_monthly_quality_report_s2005 set del_flag = 2 where sample_date &gt;= #{startDate} and sample_date &lt;= #{endDate}</if>
+        <if test="samplePoint == 5">update t_monthly_quality_report_s2007 set del_flag = 2 where sample_date &gt;= #{startDate} and sample_date &lt;= #{endDate}</if>
+        <if test="samplePoint == 6">update t_monthly_quality_report_s2011 set del_flag = 2 where sample_date &gt;= #{startDate} and sample_date &lt;= #{endDate}</if>
+        <if test="samplePoint == 7">update t_monthly_quality_report_s2400 set del_flag = 2 where sample_date &gt;= #{startDate} and sample_date &lt;= #{endDate}</if>
+        <if test="samplePoint == 8">update t_monthly_quality_report_s3004 set del_flag = 2 where sample_date &gt;= #{startDate} and sample_date &lt;= #{endDate}</if>
+        <if test="samplePoint == 9">update t_monthly_quality_report_s3009 set del_flag = 2 where sample_date &gt;= #{startDate} and sample_date &lt;= #{endDate}</if>
+        <if test="samplePoint == 10">update t_monthly_quality_report_s3010 set del_flag = 2 where sample_date &gt;= #{startDate} and sample_date &lt;= #{endDate}</if>
+        <if test="samplePoint == 11">update t_monthly_quality_report_s3011 set del_flag = 2 where sample_date &gt;= #{startDate} and sample_date &lt;= #{endDate}</if>
+        <if test="samplePoint == 12">update t_monthly_quality_report_s3012 set del_flag = 2 where sample_date &gt;= #{startDate} and sample_date &lt;= #{endDate}</if>
+        <if test="samplePoint == 13">update t_monthly_quality_report_s3022 set del_flag = 2 where sample_date &gt;= #{startDate} and sample_date &lt;= #{endDate}</if>
+        <if test="samplePoint == 14">update t_monthly_quality_report_s4012 set del_flag = 2 where sample_date &gt;= #{startDate} and sample_date &lt;= #{endDate}</if>
+        <if test="samplePoint == 15">update t_monthly_quality_report_s4013 set del_flag = 2 where sample_date &gt;= #{startDate} and sample_date &lt;= #{endDate}</if>
+        <if test="samplePoint == 16">update t_monthly_quality_report_s4501 set del_flag = 2 where sample_date &gt;= #{startDate} and sample_date &lt;= #{endDate}</if>
+        <if test="samplePoint == 17">update t_monthly_quality_report_s5001 set del_flag = 2 where sample_date &gt;= #{startDate} and sample_date &lt;= #{endDate}</if>
+        <if test="samplePoint == 18">update t_monthly_quality_report_s5003 set del_flag = 2 where sample_date &gt;= #{startDate} and sample_date &lt;= #{endDate}</if>
+        <if test="samplePoint == 19">update t_monthly_quality_report_s5010 set del_flag = 2 where sample_date &gt;= #{startDate} and sample_date &lt;= #{endDate}</if>
+        <if test="samplePoint == 20">update t_monthly_quality_report_s5012 set del_flag = 2 where sample_date &gt;= #{startDate} and sample_date &lt;= #{endDate}</if>
+        <if test="samplePoint == 21">update t_monthly_quality_report_s6101 set del_flag = 2 where sample_date &gt;= #{startDate} and sample_date &lt;= #{endDate}</if>
+        <if test="samplePoint == 22">update t_monthly_quality_report_s6107 set del_flag = 2 where sample_date &gt;= #{startDate} and sample_date &lt;= #{endDate}</if>
+        <if test="samplePoint == 23">update t_monthly_quality_report_s6301 set del_flag = 2 where sample_date &gt;= #{startDate} and sample_date &lt;= #{endDate}</if>
+        <if test="samplePoint == 24">update t_monthly_quality_report_z404 set del_flag = 2 where sample_date &gt;= #{startDate} and sample_date &lt;= #{endDate}</if>
+    </update>
     
 </mapper>

+ 9 - 0
ui/src/api/production/quality.js

@@ -1,5 +1,14 @@
 import request from '@/utils/request'
 
+// 批量删除
+export function removeQuality(query) {
+  return request({
+    url: '/production/quality/remove',
+    method: 'post',
+    params: query
+  })
+}
+
 // 碳二反应器性能指标趋势图
 export function c2ReactorAnalysis(query) {
   return request({

+ 93 - 1
ui/src/views/production/quality/index.vue

@@ -56,6 +56,7 @@
           icon="el-icon-delete"
           size="mini"
           v-hasPermi="['production:quality:list']"
+          @click="handleRemove"
         >批量删除</el-button>
       </el-col>
 	  <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
@@ -2373,6 +2374,35 @@
         <el-button type="primary" @click="submitComment">确 定</el-button>
       </div>
     </el-dialog>
+
+    <!-- 批量删除对话框 -->
+    <el-dialog :title="remove.title" :visible.sync="remove.open" width="500px" append-to-body>
+      <el-form :rules="removeRules" :model="removeForm" ref="removeForm" label-width="68px">
+        <el-form-item label="采样点" prop="removeSamplePoint">
+          <el-select v-model="removeForm.removeSamplePoint" placeholder="请选择">
+            <el-option
+              v-for="item in samplePointOptions"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value">
+            </el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="采样日期" prop="removeSampleDate">
+          <el-date-picker
+            v-model="removeForm.removeSampleDate"
+            type="daterange"
+            value-format="yyyy-MM-dd"
+            range-separator="至"
+            start-placeholder="开始日期"
+            end-placeholder="结束日期">
+          </el-date-picker>
+        </el-form-item>
+        <el-form-item>
+          <el-button type="cyan" size="mini" @click="handleConfirmRemove">确定</el-button>
+        </el-form-item>
+      </el-form>
+    </el-dialog>
   </div>
 </template>
 
@@ -2401,7 +2431,7 @@ import { listS6101, getS6101, delS6101, addS6101, updateS6101, exportS6101 } fro
 import { listS6107, getS6107, delS6107, addS6107, updateS6107, exportS6107 } from "@/api/production/s6107";
 import { listS6301, getS6301, delS6301, addS6301, updateS6301, exportS6301 } from "@/api/production/s6301";
 import { listZ404, getZ404, delZ404, addZ404, updateZ404, exportZ404 } from "@/api/production/z404";
-import { exportQuality, c3ReactorTable, c3ReactorAnalysis, c2ReactorAnalysis, c2ReactorTable } from "@/api/production/quality";
+import { removeQuality, exportQuality, c3ReactorTable, c3ReactorAnalysis, c2ReactorAnalysis, c2ReactorTable } from "@/api/production/quality";
 import { submitComment, getCommentInfo } from "@/api/production/comment";
 import { treeselect } from "@/api/system/dept";
 import { getToken } from "@/utils/auth";
@@ -2423,6 +2453,49 @@ export default {
   components: { Treeselect },
   data() {
     return {
+      removeForm: {
+        removeSampleDate: [],
+        removeSamplePoint: '',
+      },
+      // 表单校验
+      removeRules: {
+        removeSamplePoint: [
+          {required: true, message: this.$t('采样点') + this.$t('不能为空'), trigger: "change"}
+        ],
+        removeSampleDate: [
+          {required: true, message: this.$t('采样日期') + this.$t('不能为空'), trigger: "change"}
+        ],
+      },
+      samplePointOptions: [
+        { value: '1', label: 'S-0501'},
+        { value: '2', label: 'S-1301'},
+        { value: '3', label: 'S-2002'},
+        { value: '4', label: 'S-2005'},
+        { value: '5', label: 'S-2007'},
+        { value: '6', label: 'S-2011'},
+        { value: '7', label: 'S-2400'},
+        { value: '8', label: 'S-3004'},
+        { value: '9', label: 'S-3009'},
+        { value: '10', label: 'S-3010'},
+        { value: '11', label: 'S-3011'},
+        { value: '12', label: 'S-3012'},
+        { value: '13', label: 'S-3022'},
+        { value: '14', label: 'S-4012'},
+        { value: '15', label: 'S-4013'},
+        { value: '16', label: 'S-4501'},
+        { value: '17', label: 'S-5001'},
+        { value: '18', label: 'S-5003'},
+        { value: '19', label: 'S-5010'},
+        { value: '20', label: 'S-5012'},
+        { value: '21', label: 'S-6101'},
+        { value: '22', label: 'S-6107'},
+        { value: '23', label: 'S-6301'},
+        { value: '24', label: 'Z-404'},
+      ],
+      remove: {
+        title: "批量删除",
+        open: false,
+      },
       comment: '',
       analysisDescription: null,
       c3ReactorTableData: {},
@@ -2598,6 +2671,25 @@ export default {
     });
   },
   methods: {
+    /** 确认批量删除 */
+    handleConfirmRemove() {
+      this.$refs["removeForm"].validate(valid => {
+        if (valid) {
+          removeQuality({
+            "samplePoint": this.removeForm.removeSamplePoint,
+            "startDate": this.removeForm.removeSampleDate[0],
+            "endDate": this.removeForm.removeSampleDate[1]
+          }).then(() => {
+            this.msgSuccess("批量删除成功");
+            this.remove.open = false;
+          });
+        }
+      });
+    },
+    /** 批量删除 */
+    handleRemove() {
+      this.remove.open = true;
+    },
     /** 处理评价提交 */
     submitComment() {
       submitComment({