Эх сурвалжийг харах

-修改:月度检查查询

jiangbiao 2 жил өмнө
parent
commit
a4e64e8e7b

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

@@ -14,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
 
@@ -36,7 +37,15 @@ public class TFivesMonthlyInspectionController extends BaseController {
     @GetMapping("/list")
     public TableDataInfo list(TFivesMonthlyInspection tFivesMonthlyInspection) {
         startPage();
+        Calendar cal = Calendar.getInstance();
+        if (tFivesMonthlyInspection.getYear() == null) {
+            tFivesMonthlyInspection.setYear((long) cal.get(Calendar.YEAR));
+        }
         List<TFivesMonthlyInspection> list = tFivesMonthlyInspectionService.selectTFivesMonthlyInspectionList(tFivesMonthlyInspection);
+        if (CollectionUtils.isEmpty(list)) {
+            tFivesMonthlyInspection.setYear((long) (cal.get(Calendar.YEAR) - 1));
+            list = tFivesMonthlyInspectionService.selectTFivesMonthlyInspectionList(tFivesMonthlyInspection);
+        }
         return getDataTable(list);
     }
 

+ 8 - 7
ui/src/views/production/inspection/index.vue

@@ -29,13 +29,13 @@
         />
       </el-form-item>
       <el-form-item label="年" prop="year">
-        <el-input
-          v-model="queryParams.year"
-          placeholder="请输入年"
-          clearable
-          size="small"
-          @keyup.enter.native="handleQuery"
-        />
+        <el-date-picker
+          style="width: 100%"
+          v-model="year"
+          type="year"
+          @change="handleQuery"
+          placeholder="请选择年">
+        </el-date-picker>
       </el-form-item>
       <el-form-item>
         <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
@@ -481,6 +481,7 @@ export default {
     /** 查询区域月度检查列表 */
     getList() {
       this.loading = true;
+      this.queryParams.year=this.year.getFullYear()
       listInspection(this.queryParams).then(response => {
         this.inspectionList = response.rows;
         this.total = response.total;