Browse Source

修改查询管理页面

乐菲 2 weeks ago
parent
commit
71081f5575

+ 30 - 23
src/api/common/index.js

@@ -1,37 +1,44 @@
-import request from '@/utils/request'
-const baseURL = 'http://127.0.0.1:9000'
+import request from "@/utils/request";
+const baseURL = "http://127.0.0.1:9000";
 
 // 查询地理位置
-export function fetchAreaList (query) {
+export function fetchAreaList(query) {
   return request({
-    url: '/mes/factory/areainfos',
-    method: 'get',
-    params: query
-  })
+    url: "/mes/factory/areainfos",
+    method: "get",
+    params: query,
+  });
 }
 
 // 删除附件
-export function deleteFileList (id) {
+export function deleteFileList(id) {
   return request({
-    url: '/minio/files/deleteFileList/' + id,
-    method: 'delete',
-  })
+    url: "/minio/files/deleteFileList/" + id,
+    method: "delete",
+  });
 }
-export function getExportPdf (data) {
+export function getExportPdf(data) {
   return request({
-    url: 'http://192.168.1.94:48080/jmreport/exportPdf',
-    method: 'post',
+    url: "http://192.168.1.94:48080/jmreport/exportPdf",
+    method: "post",
     headers: { isToken: false },
-    data: data
-  })
+    data: data,
+  });
 }
 
-
+// 查询过滤条件
+export function getFilterListInQuery(data) {
+  return request({
+    url: "/infra/query-manage/filterList",
+    method: "post",
+    data: data,
+  });
+}
 // 标签打印-通用(bartender)
-export function printLabel (data) {
+export function printLabel(data) {
   return request({
-    method: 'post',
-    url: baseURL + '/commonPrint',
-    data
-  })
-}
+    method: "post",
+    url: baseURL + "/commonPrint",
+    data,
+  });
+}

+ 14 - 4
src/views/mes/queryManage/components/FilterColumnInQuery.vue

@@ -57,6 +57,7 @@
     <!-- 多选列表 -->
     <div v-else class="mb5" style="max-height: 350px; overflow: auto">
       <el-table
+        ref="multipleTable"
         :data="filteredList"
         size="mini"
         height="350"
@@ -162,6 +163,7 @@ export default {
   methods: {
     /* ---- 生命周期 ---- */
     async onPopoverShow() {
+      console.log("onPopoverShow被调用");
       this.$nextTick(() => this.$refs.seachRef?.focus());
       if (this.isFirstLoad || this.searchKey) {
         await this.fetchFilterListInQueryManage(true);
@@ -192,6 +194,10 @@ export default {
 
     /* ---- 数据获取 ---- */
     async fetchFilterListInQueryManage(reload) {
+      console.log(
+        "fetchFilterListInQueryManage被调用,htmlType:",
+        this.htmlType
+      );
       if (["datetime", "daterange"].includes(this.htmlType)) return;
       try {
         this.loading = true;
@@ -205,8 +211,12 @@ export default {
             params[k] = this.activeFilters[k].map((i) => i.column).join(",");
           }
         });
+        console.log("调用getFilterListInQuery,参数:", params);
         const { data } = await getFilterListInQuery(params);
         this.filterData = data || [];
+        console.log("获取筛选数据成功,filterData:", this.filterData);
+      } catch (error) {
+        console.error("获取筛选数据失败:", error);
       } finally {
         this.loading = false;
       }
@@ -269,16 +279,16 @@ export default {
     dateChange(val) {
       this.currentRows = [
         {
-          column: formatDateTimeRange(val),
+          column: this.formatDateTimeRange(val),
           isRange: true,
-          rawData: { [this.prop]: formatDateTimeRange(val) },
+          rawData: { [this.prop]: this.formatDateTimeRange(val) },
         },
       ];
     },
 
     /* ---- 按钮 ---- */
     filterConfirm() {
-      this.$emit("selectData", this.currentRows, this.prop, this.htmlType);
+      this.$emit("select-data", this.currentRows, this.prop, this.htmlType);
       this.$refs.popover.doClose();
     },
     filterCancel(flag) {
@@ -286,7 +296,7 @@ export default {
       this.dateRangeValue = "";
       this.currentRows = [];
       if (!flag) {
-        this.$emit("selectData", [], this.prop, this.htmlType);
+        this.$emit("select-data", [], this.prop, this.htmlType);
         this.$refs.popover.doClose();
         this.isFirstLoad = true;
       }

+ 2 - 2
src/views/mes/queryManage/query.vue

@@ -438,8 +438,8 @@ export default {
     // 获取显隐列列表
     this.id = this.$route.query?.id;
     this.getQueryData();
-    //昱懋的,应该用不上
-    /*QueryManageApi.queryManageExecutecomplexdropdownlist().then((res) => {
+    // 昱懋的,应该用不上
+    /* QueryManageApi.queryManageExecutecomplexdropdownlist().then((res) => {
       this.dropdownList = res;
     });*/
   },

+ 18 - 3
src/views/mes/queryManage/queryNew.vue

@@ -197,7 +197,6 @@
 </template>
 
 <script>
-/* --------------  以下为 script,仅把 ContentWrap 的 props 拿过来  -------------- */
 import * as QueryManageApi from "@/api/mes/queryManage";
 import { getQueryManageButtonPage } from "@/api/mes/queryManage/button";
 import { saveAs } from "file-saver";
@@ -306,20 +305,30 @@ export default {
     },
 
     async getList() {
+      console.log("getList被调用,queryParamList:", this.queryParamList);
       try {
+        this.loading = true;
+        console.log("调用QueryManageApi.loadTableData,参数:", {
+          pageNo: this.pageNo,
+          pageSize: this.pageSize,
+          paramList: this.queryParamList,
+          id: this.$route.query?.id,
+        });
         const data = await QueryManageApi.loadTableData({
           pageNo: this.pageNo,
           pageSize: this.pageSize,
           paramList: this.queryParamList,
           id: this.$route.query?.id,
         });
-        console.log("后端返回", data); // ← 看这里
+        console.log("后端返回", data);
         this.list = data?.data?.list || [];
         console.log("赋值后 list =", this.list);
         console.log("list.length =", this.list.length);
         console.log("list 第一条 =", this.list[0]);
         this.originalList = JSON.parse(JSON.stringify(data?.data?.list || []));
         this.total = data?.data?.total || 0;
+      } catch (error) {
+        console.error("getList错误:", error);
       } finally {
         this.loading = false;
       }
@@ -559,6 +568,7 @@ export default {
     },
 
     filterData(data, field, type, row) {
+      console.log("filterData被调用:", { data, field, type, row });
       const { dataType } = row;
       this.$set(this.customFilters, field, data);
       const isDateRange = data[0]?.isRange;
@@ -575,6 +585,10 @@ export default {
             value: valueList,
           });
         }
+        console.log(
+          "filterData - 日期范围筛选后queryParamList:",
+          this.queryParamList
+        );
         this.getList();
         return;
       }
@@ -599,6 +613,7 @@ export default {
         const idx = this.queryParamList.findIndex((item) => item.key === field);
         if (idx > -1) this.queryParamList.splice(idx, 1);
       }
+      console.log("filterData - 筛选后queryParamList:", this.queryParamList);
       this.getList();
     },
 
@@ -791,7 +806,7 @@ export default {
   margin-bottom: 3px;
 }
 
-/* ---------- 原来的表格样式 ---------- */
+/* ---------- 原来的表格样式 ---------- */
 :deep(.el-table__row) {
   height: 15px !important;
 }