Explorar o código

修改商品档案推送的搜索

ylong hai 7 meses
pai
achega
5085079e89

+ 41 - 48
src/views/data/productPush/components/page-search.vue

@@ -11,27 +11,24 @@
 </template>
 
 <script setup>
-  import { reactive, ref, defineEmits, defineProps, computed, getCurrentInstance } from 'vue';
+  import { reactive, ref, defineEmits, computed } from 'vue';
   import ProSearch from '@/components/CommonPage/ProSearch2.vue';
 
   defineOptions({ name: 'page-search' });
 
-  const props = defineProps({
-    status: {
-      type: String,
-      default: ''
-    }
-  });
-
   const emit = defineEmits(['search']);
   const searchRef = ref(null);
 
   // 初始值
   const initKeys = reactive({
     isbn: '',
-    processor: '',
-    isPush: '',
-    pushStatus: props.status,
+    operateUser: '',
+    pushStatus: '',
+    pushRes: '',
+    createTimeStart: '',
+    createTimeEnd: '',
+    pushTimeStart: '',
+    pushTimeEnd: '',
     createTimeRange: [],
     pushTimeRange: []
   });
@@ -42,53 +39,61 @@
       {
         type: 'input',
         label: 'ISBN',
-        prop: 'isbn'
+        prop: 'bookIsbn'
       },
       {
         type: 'input',
         label: '处理人',
-        prop: 'processor'
+        prop: 'operateUser'
       },
       {
-        type: 'select',
+        type: 'dictSelect',
         label: '是否推送',
-        prop: 'isPush',
-        options: [
-          { label: '是', value: '是' },
-          { label: '否', value: '否' }
-        ]
+        prop: 'pushStatus',
+        props: {
+          code: 'book_stat_is_push'
+        }
       },
       {
-        type: 'select',
+        type: 'dictSelect',
         label: '推送状态',
-        prop: 'pushStatus',
-        options: [
-          { label: '成功', value: '成功' },
-          { label: '失败', value: '失败' },
-          { label: '系统错误', value: '系统错误' },
-          { label: '无数据', value: '无数据' }
-        ]
+        prop: 'pushRes',
+        props: {
+          code: 'book_stat_push_status'
+        }
       },
       {
-        type: 'daterange',
+        type: 'datetimerange',
         label: '创建时间',
         prop: 'createTimeRange',
         props: {
           valueFormat: 'YYYY-MM-DD HH:mm:ss',
-          rangeSeparator: '到',
+          format: 'YYYY-MM-DD HH:mm:ss',
           startPlaceholder: '开始日期',
-          endPlaceholder: '结束日期'
+          endPlaceholder: '结束日期',
+          onChange: (value) => {
+            initKeys.createTimeStart = value ? value[0] : '';
+            initKeys.createTimeEnd = value ? value[1] : '';
+            initKeys.createTimeRange = value || [];
+            searchRef.value?.setData(initKeys);
+          }
         }
       },
       {
-        type: 'daterange',
+        type: 'datetimerange',
         label: '推送时间',
         prop: 'pushTimeRange',
         props: {
           valueFormat: 'YYYY-MM-DD HH:mm:ss',
-          rangeSeparator: '到',
+          format: 'YYYY-MM-DD HH:mm:ss',
           startPlaceholder: '开始日期',
-          endPlaceholder: '结束日期'
+          endPlaceholder: '结束日期',
+          onChange: (value) => {
+            initKeys.pushTimeStart = value ? value[0] : '';
+            initKeys.pushTimeEnd = value ? value[1] : '';
+            initKeys.pushTimeRange = value || [];
+            searchRef.value?.setData(initKeys);
+          }
         }
       }
     ];
@@ -96,21 +101,9 @@
 
   // 搜索
   const search = (data) => {
-    const params = { ...data };
-
-    // 处理时间范围
-    if (params.createTimeRange && params.createTimeRange.length) {
-      params.createTimeStart = params.createTimeRange[0];
-      params.createTimeEnd = params.createTimeRange[1];
-      delete params.createTimeRange;
-    }
-
-    if (params.pushTimeRange && params.pushTimeRange.length) {
-      params.pushTimeStart = params.pushTimeRange[0];
-      params.pushTimeEnd = params.pushTimeRange[1];
-      delete params.pushTimeRange;
-    }
-
+    const params = JSON.parse(JSON.stringify(data));
+    delete params.createTimeRange;
+    delete params.pushTimeRange;
     emit('search', params);
   };
 </script>

+ 2 - 2
src/views/data/productPush/index.vue

@@ -1,6 +1,6 @@
 <template>
     <ele-page flex-table>
-        <page-search @search="reload" :status="useStatus"></page-search>
+        <page-search @search="reload"></page-search>
 
         <common-table ref="pageRef" :pageConfig="pageConfig" :columns="columns">
             <template #toolbar>
@@ -141,7 +141,7 @@
 
     // 刷新表格
     function reload(where) {
-        pageRef.value?.reload(where);
+        pageRef.value?.reload({ page: 1, ...where });
     }
 
     // 导出excel