From ea3c33c8561df39d4f123d1424fda99dd0f0c51d Mon Sep 17 00:00:00 2001
From: wujian <14790700720@163.com>
Date: 星期四, 14 十一月 2024 08:15:41 +0800
Subject: [PATCH] add - panel

---
 jcdm-ui/src/views/main/da/paramCollection/index.vue |   57 +++++++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 49 insertions(+), 8 deletions(-)

diff --git a/jcdm-ui/src/views/main/da/paramCollection/index.vue b/jcdm-ui/src/views/main/da/paramCollection/index.vue
index 3dbd098..0f2c5bb 100644
--- a/jcdm-ui/src/views/main/da/paramCollection/index.vue
+++ b/jcdm-ui/src/views/main/da/paramCollection/index.vue
@@ -18,6 +18,19 @@
           @keyup.enter.native="handleQuery"
         />
       </el-form-item>
+      <el-form-item label="鏃ユ湡鑼冨洿" prop="dateConditions">
+        <el-date-picker
+          v-model="queryParams.dateConditions"
+          type="daterange"
+          align="right"
+          unlink-panels
+          range-separator="鑷�"
+          start-placeholder="寮�濮嬫棩鏈�"
+          end-placeholder="缁撴潫鏃ユ湡"
+          value-format="yyyy-MM-dd"
+          @change="handleDateChange">
+        </el-date-picker>
+      </el-form-item>
       <el-form-item style="float: right">
         <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button>
         <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button>
@@ -77,10 +90,10 @@
       <el-table-column label="鍙戝姩鏈虹紪鐮�" align="center" width="160" prop="sfcCode" ></el-table-column>
 <!--      <el-table-column label="浜у搧缂栧彿" align="center" prop="productCode"></el-table-column>-->
 <!--      <el-table-column label="浜х嚎缂栧彿" align="center" prop="productionLine"></el-table-column>-->
-      <el-table-column label="宸ヤ綅缂栧彿" align="center" prop="locationCode"></el-table-column>
 <!--      <el-table-column label="璁惧缂栧彿" align="center" prop="equipmentNo"></el-table-column>-->
-      <el-table-column label="鍙傛暟缂栫爜" align="center" prop="paramCode"></el-table-column>
+      <el-table-column label="鍙傛暟鍚嶇О" align="center" prop="paramName" width="150" ></el-table-column>
       <el-table-column label="鍙傛暟鍊�" align="center" prop="paramValue"></el-table-column>
+      <el-table-column label="宸ヤ綅缂栧彿" align="center" prop="locationCode"></el-table-column>
       <el-table-column label="鍙傛暟涓婇檺" align="center" prop="paramUpper"></el-table-column>
       <el-table-column label="鍙傛暟涓嬮檺" align="center" prop="paramLower"></el-table-column>
       <el-table-column label="閲囬泦鏃堕棿" align="center" prop="collectionTime" width="160">
@@ -89,7 +102,7 @@
         </template>
       </el-table-column>
       <el-table-column label="鐘舵��" align="center" prop="state"></el-table-column>
-      <el-table-column label="鍙傛暟鍚嶇О" align="center" prop="paramName" width="150" ></el-table-column>
+      <el-table-column label="鍙傛暟缂栫爜" align="center" prop="paramCode"></el-table-column>
       <el-table-column label="鍗曚綅" align="center" prop="unit"></el-table-column>
       <el-table-column label="绫诲瀷" align="center" prop="type"></el-table-column>
       <el-table-column fixed="right" width="200" label="鎿嶄綔" align="center" class-name="small-padding fixed-width" >
@@ -188,11 +201,13 @@
 
 <script>
 import { listParamCollection, getParamCollection, delParamCollection, addParamCollection, updateParamCollection } from "@/api/main/da/paramCollection/paramCollection";
+import {queryDaParamCollectionListForSearch} from "../../../../api/main/da/paramCollection/paramCollection";
 
 export default {
   name: "ParamCollection",
   data() {
     return {
+      maxDate: '',
       // 閬僵灞�
       loading: true,
       // 閫変腑鏁扮粍
@@ -213,6 +228,7 @@
       open: false,
       // 鏌ヨ鍙傛暟
       queryParams: {
+        dateConditions: [],
         pageNum: 1,
         pageSize: 10,
         workOrderNo: null,
@@ -258,14 +274,39 @@
     // this.getList();
   },
   methods: {
+    handleDateChange(value) {
+      if (value && value.length === 2) {
+        const startDate = value[0];
+        const endDate = value[1];
+        const dayCount = this.daysBetween(startDate, endDate);
+        if (dayCount + 1 > 3) {
+          this.$message.error('璇烽�夋嫨杩炵画鐨�3澶╋紒');
+          this.queryParams.dateConditions = []; // 閲嶇疆鏃ユ湡鑼冨洿
+        }
+      }
+    },
+    daysBetween(startDate, endDate) {
+      const oneDay = 24 * 60 * 60 * 1000; // 姣忓ぉ鐨勬绉掓暟
+      const startTime = new Date(startDate).getTime();
+      const endTime = new Date(endDate).getTime();
+      return Math.round(Math.abs((startTime - endTime) / oneDay));
+    },
     /** 鏌ヨ璁惧浜у搧杩囩▼鍙傛暟閲囬泦鍒楄〃 */
     getList() {
       this.loading = true;
-      listParamCollection(this.queryParams).then(response => {
-        this.paramCollectionList = response.rows;
-        this.total = response.total;
-        this.loading = false;
-      });
+      if ((this.queryParams.sfcCode == null || this.queryParams.sfcCode === '') && this.queryParams.dateConditions.length === 0){
+        this.$message({
+          message: '璇疯緭鍏ュ彂鍔ㄦ満鍙风爜鎴栬�呴�夋嫨鏌ヨ鏃ユ湡',
+          type: 'info'
+        });
+      } else {
+        queryDaParamCollectionListForSearch(this.queryParams).then(response => {
+          this.paramCollectionList = response.rows;
+          this.total = response.total;
+          this.loading = false;
+        });
+      }
+
     },
     // 鍙栨秷鎸夐挳
     cancel() {

--
Gitblit v1.9.3