Explorar o código

fix: 处理工艺路线刷新逻辑,确保最新搜索条件生效

xieyong hai 1 semana
pai
achega
7694582cb8
Modificáronse 1 ficheiros con 13 adicións e 8 borrados
  1. 13 8
      src/views/technology/route/index.vue

+ 13 - 8
src/views/technology/route/index.vue

@@ -2,7 +2,7 @@
   <div class="ele-body">
     <el-card shadow="never">
       <!-- 搜索表单 -->
-      <user-search @search="reload" />
+      <user-search ref="userSearchRef" @search="reload" />
       <!-- 数据表格 -->
       <ele-pro-table
         ref="table"
@@ -289,11 +289,11 @@
             slot: 'status',
             showOverflowTooltip: true,
             minWidth: 110,
-            filters: [
-              { text: '草稿', value: -1 },
-              { text: '失效', value: 0 },
-              { text: '生效', value: 1 }
-            ],
+            // filters: [
+            //   { text: '草稿', value: -1 },
+            //   { text: '失效', value: 0 },
+            //   { text: '生效', value: 1 }
+            // ],
             filterMultiple: false,
             columnKey: 'status'
           },
@@ -375,7 +375,8 @@
           ...where,
           ...order,
           pageNum: page,
-          size: limit
+          size: limit,
+          latestApprovedOnly: true
         };
         const res = await route.list({ ...this.params });
         return res;
@@ -402,6 +403,10 @@
 
       /* 刷新表格 */
       reload(where) {
+        // where 是字符串(或其他非对象)时,从搜索组件取最新的搜索条件
+        if (typeof where !== 'object' || where === null) {
+          where = this.$refs.userSearchRef?.where || {};
+        }
         this.$refs.table.reload({ page: 1, where: where });
       },
       /* 打开编辑弹窗 */
@@ -448,7 +453,7 @@
           .taskinstanceChange(param)
           .then((msg) => {
             // loading.close();
-            this.$message.success('变更' + msg);
+            msg && this.$message.success('变更' + msg);
             this.reload();
           })
           .catch((e) => {