From 85fd67441f91dc48673324f6a4bd1198280dc585 Mon Sep 17 00:00:00 2001
From: 廖井涛 <2265517004@qq.com>
Date: 星期四, 11 四月 2024 09:26:13 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/ERP_override

---
 north-glass-erp/northglass-erp/src/components/BasicTable.vue |   69 +++++++++++++++++++++++-----------
 1 files changed, 47 insertions(+), 22 deletions(-)

diff --git a/north-glass-erp/northglass-erp/src/components/BasicTable.vue b/north-glass-erp/northglass-erp/src/components/BasicTable.vue
index 880f902..98c3d57 100644
--- a/north-glass-erp/northglass-erp/src/components/BasicTable.vue
+++ b/north-glass-erp/northglass-erp/src/components/BasicTable.vue
@@ -65,6 +65,21 @@
   }
 
 })
+
+
+const props = defineProps({
+  childrenData:{
+    Object,
+    default: ''
+  }
+})
+const basicProp = ref({
+  pageSize : 100,//椤甸潰鏄剧ず鏁伴噺
+  pageNum:1,//褰撳墠椤�
+  selectDate:['',''],//鏌ヨ鐨勬棩鏈�
+  pageTotal : 0,//鎬婚〉鏁�
+  dataTotal : 0,//鏁版嵁鎬绘潯鏁�
+})
 const sumNum = (list, field) => {
   let count = 0
   list.forEach(item => {
@@ -73,22 +88,18 @@
   return count.toFixed(2)
 }
 
-const props = defineProps({
-  childrenData:{
-    Object,
-    default: ''
-  }
-})
+
+
 watch(props, (newVal) => {
-  gridOptions.loading = true
   xGrid.value.loadData(props.childrenData.data)
   gridOptions.loading = false
 })
 onMounted(() => {
   gridOptions.columns = props.childrenData.columns
+  getReportData()
+
 
 })
-const emit = defineEmits(['getData'])
 function filterChanged(column){
   //gridOptions.loading=true
   //绛涢�夋潯浠跺彂鐢熷彉鍖栨潯浠跺彂鐢熷彉鍖�
@@ -103,32 +114,46 @@
   }else{
     filterData.value[column.property] = value
   }
-  const gaveParentData = {
-    selectDate:props.childrenData.selectDate,
-    filterData:filterData.value
-  }
-  emit('getData',filterData.value)
+
+  gridOptions.loading = true
+  getReportData()
 
 }
 
 const handlePageChange = ({ currentPage, pageSize }) => {
-  props.childrenData.pageNum = currentPage
-  props.childrenData.pageTotal = pageSize
-  emit('getData',filterData.value)
+  basicProp.value.pageNum = currentPage
+  basicProp.value.pageTotal = pageSize
+  gridOptions.loading = true
+  getReportData()
 }
 const dateChanged = () => {
-  emit('getData',filterData.value)
+  gridOptions.loading = true
+  getReportData()
 }
+
+const  getReportData = () => {
+  request.post(`${props.childrenData.url}/${basicProp.value.pageNum}/${basicProp.value.pageSize}/${basicProp.value.selectDate}`,filterData.value).then(res => {
+    if(res.code === '200'){
+      props.childrenData.data = res.data.data
+      basicProp.value.pageTotal = res.data.total.pageTotal
+      basicProp.value.dataTotal = res.data.total.total
+      basicProp.value.selectDate = res.data.selectDate
+    }
+  })
+}
+
 
 </script>
 
 <template>
   <div class="main-div">
     <el-date-picker
-        v-model="props.childrenData.selectDate"
+        v-model="basicProp.selectDate"
         type="daterange"
         start-placeholder="寮�濮嬫椂闂�"
         end-placeholder="缁撴潫鏃堕棿"
+        format="YYYY-MM-DD"
+        value-format="YYYY-MM-DD"
     />
     <el-button
         @click="dateChanged"
@@ -157,10 +182,10 @@
           <vxe-pager
               @page-change="handlePageChange"
               :layouts="[  'PrevPage', 'Jump','PageCount', 'NextPage',  'Total']"
-              v-model:current-page="props.childrenData.pageNum"
-              v-model:page-size="props.childrenData.pageSize"
-              v-model:pager-count="props.childrenData.pageTotal"
-              :total="props.childrenData.dataTotal"
+              v-model:current-page="basicProp.pageNum"
+              v-model:page-size="basicProp.pageSize"
+              v-model:pager-count="basicProp.pageTotal"
+              :total="basicProp.dataTotal"
           >
           </vxe-pager>
         </template>

--
Gitblit v1.8.0