From 97c3f97a11524d8bacc6d36cf2ec4e3b93b5c277 Mon Sep 17 00:00:00 2001
From: NNowhZzU <1539353356@qq.com>
Date: 星期三, 27 十二月 2023 10:36:19 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 north-glass-erp/northglass-erp/src/views/sd/product/SelectProduct.vue |  240 ++++++++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 178 insertions(+), 62 deletions(-)

diff --git a/north-glass-erp/northglass-erp/src/views/sd/product/SelectProduct.vue b/north-glass-erp/northglass-erp/src/views/sd/product/SelectProduct.vue
index f0b1d2c..47be59c 100644
--- a/north-glass-erp/northglass-erp/src/views/sd/product/SelectProduct.vue
+++ b/north-glass-erp/northglass-erp/src/views/sd/product/SelectProduct.vue
@@ -2,25 +2,57 @@
 import request from "@/utils/request"
 import deepClone from "@/utils/deepClone"
 import {ElDatePicker, ElMessage} from "element-plus"
-import useProductGlassTypeStore from "@/stores/productGlassType"
-import {watch} from "vue"
+import useProductGlassTypeStore from "@/stores/sd/product/productGlassType"
+import useProductStore from "@/stores/sd/product/prduct"
+import {onMounted, reactive, ref, watch} from "vue"
 import {Search} from "@element-plus/icons-vue"
 import GlassType from "@/components/sd/product/GlassType.vue"
 import {useRouter} from  'vue-router'
 import BasicTable from '@/components/basic/BasicTable.vue'
+import scrollEvnt from "@/hook";
 let productGlassTypeStore = useProductGlassTypeStore()
+let productStore = useProductStore()
 let router=useRouter()
+//鐩戝惉鐜荤拑绫诲瀷鏀瑰彉
 watch(productGlassTypeStore,(newVal,oldVal) => {
   let list = productList.filter( product=>{
     return  product.glassType==newVal.GlassType
   })
 })
 
-//let productList=$ref([])
+let pageNum=$ref(1)
+watch(productStore,(newVal,oldVal) => {
+  if(newVal.flag===true){
+    pageNum=pageNum+1
+    //鍚庣鑾峰彇鏈夊灏戦〉锛岃秴杩囧灏戦〉涓嶅啀璇锋眰
+    /*if(pageNum>5){
+      console.log(newVal.pageNum)
+      return
+    }*/
+    request.get(`/product/${pageNum}/100`).then((res) => {
+      gridOptions.loading=true
+      try{
+        if(res.code==200){
+          gridOptions.data=  gridOptions.data.concat(res.data)
+          newVal.flag=false
+          setTimeout(()=>{
+            gridOptions.loading=false
+          },1000)
+        }else{
+          ElMessage.warning(res.msg)
+        }
+      }finally {
+
+      }
+    })
+  }
+
+})
+
 let flag = $ref(false)
-request.get("/product").then((res) => {
+request.get("/product/1/100").then((res) => {
   if(res.code==200){
-    tableProp.datas= deepClone(res.data)
+    gridOptions.data= deepClone(res.data)
     flag = true
   }else{
     ElMessage.warning(res.msg)
@@ -30,18 +62,6 @@
 
 //瀛愮粍浠舵帴鏀跺弬鏁�
 let tableProp = $ref({
-  title:[
-    {type:'expand',fixed:"left",slots: { content:'content' },width: 50},
-    {type: 'seq',fixed:"left", title: '鑷簭', width: 80 },
-    {title: '鎿嶄綔', width: 110, slots: { default: 'button_slot' },fixed:"left"},
-    {field: 'prodID', title: '缂栧彿',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
-    {field: 'product', title: '鍚嶇О',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
-    {field: 'typeName', title: '鎵�灞炵被鍒�',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
-    {field: 'query', title: '蹇�熸煡璇�',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
-    {field: 'remarks', title: '澶囨敞',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
-    {field: 'creator', title: '鍒涘缓浜�',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
-    {field: 'createTime', title: '鍒涘缓鏃堕棿',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true}
-  ],
   datas:null,
   footList:[],
   //绛涢�夋潯浠跺垪
@@ -51,7 +71,7 @@
 
 
 
-const getChildren = (row,type) =>{
+const getTableRow = (row,type) =>{
   switch (type) {
     case 'edit' : {
       router.push({path: '/main/product/createProduct', query: { id: row.id }})
@@ -64,10 +84,80 @@
   }
 }
 
-const getCheckList = (row) =>{
-  alert('鎴戞帴鏀跺埌瀛愮粍浠朵紶閫佺殑纭澶嶉�夋淇℃伅鍙湪鎺у埗鍙版煡鐪�')
-  console.log(row)
-}
+// const getCheckList = (row) =>{
+//   alert('鎴戞帴鏀跺埌瀛愮粍浠朵紶閫佺殑纭澶嶉�夋淇℃伅鍙湪鎺у埗鍙版煡鐪�')
+// }
+
+
+const xGrid = ref()
+const gridOptions = reactive({
+  loading: false,
+  border:  "full",//琛ㄦ牸鍔犺竟妗�
+  keepSource: true,//淇濇寔婧愭暟鎹�
+  align: 'center',//鏂囧瓧灞呬腑
+  stripe:true,//鏂戦┈绾�
+  rowConfig: {isCurrent: true, isHover: true,height: 50},//榧犳爣绉诲姩鎴栭�夋嫨楂樹寒
+  id: 'demo_1',
+  showFooter: true,//鏄剧ず鑴�
+  printConfig: {},
+  importConfig: {},
+  exportConfig: {},
+  scrollY:{ enabled: true ,gt:100},//寮�鍚櫄鎷熸粴鍔�
+  showOverflow:true,
+  columnConfig: {
+    resizable: true,
+    useKey: true
+  },
+  filterConfig: {   //绛涢�夐厤缃」
+    remote: true
+  },
+  customConfig: {
+    storage: true
+  },
+  editConfig: {
+    trigger: 'click',
+    mode: 'row',
+    showStatus: true
+  },
+  columns:[
+    {type:'expand',fixed:"left",slots: { content:'content' },width: 50},
+    {type: 'seq',fixed:"left", title: '鑷簭', width: 80 },
+    {title: '鎿嶄綔', width: 110, slots: { default: 'button_slot' },fixed:"left"},
+    {field: 'prodID', title: '缂栧彿',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
+    {field: 'product', title: '鍚嶇О',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
+    {field: 'typeName', title: '鎵�灞炵被鍒�',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
+    {field: 'query', title: '蹇�熸煡璇�',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
+    {field: 'remarks', title: '澶囨敞',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
+    {field: 'creator', title: '鍒涘缓浜�',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
+    {field: 'createTime', title: '鍒涘缓鏃堕棿',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true}
+  ],//琛ㄥご鍙傛暟
+  toolbarConfig: {
+    buttons: [],
+    import: false,
+    export: true,
+    print: true,
+    zoom: true,
+    custom: true
+  },
+  data:  null,//table body瀹為檯鏁版嵁
+  footerMethod ({ columns, data }) {//椤佃剼鍑芥暟
+    return[
+      columns.map((column, columnIndex) => {
+        if (columnIndex === 0) {
+          return '鍚堣:'
+        }
+        return ''
+      })
+    ]
+  }
+
+})
+
+
+
+
+
+
 
 </script>
 
@@ -80,53 +170,79 @@
           type="primary" :icon="Search">鏌ヨ</el-button>
 
 
-      <basic-table style="height: 97%" v-if="flag"
-                   :tableProp="tableProp"
-                   @getCheckList="getCheckList"
-                   @getChildren="getChildren"
-      ></basic-table>
 
+    <vxe-grid
+        max-height="100%"
+        class="mytable-scrollbar"
+        ref="xGrid"
+        v-bind="gridOptions"
+        v-on="gridEvents"
+        @scroll ="scrollEvnt"
 
+    >
+      <!--      @toolbar-button-click="toolbarButtonClickEvent"-->
+      <!--      涓嬫媺鏄剧ず鎵�鏈変俊鎭彃妲�-->
+      <template #content="{ row }">
+        <ul class="expand-wrapper">
+          <li  v-for="(item,key) in row">
+            <span style="font-weight: bold">{{key+':  '}}</span>
+            <span>{{ item }}</span>
+          </li>
+        </ul>
+      </template>
 
-<!--    <el-table
-        v-loading="loading"
-        :data="productList"
-        :header-cell-style="{ 'text-align': 'center' }"
-        :cell-style="{ 'text-align': 'center' }"
-        lazy
-        border
-        style="width: 100%;"
-        max-height="80vh">
+      <!--宸﹁竟鍥哄畾鏄剧ず鐨勬彃妲�-->
+      <template #button_slot="{ row }">
+        <el-button @click="getTableRow(row,'edit')" link type="primary" size="small">缂栬緫</el-button>
+        <el-button @click="getTableRow(row,'delete')" link type="primary" size="small">鍒犻櫎</el-button>
+      </template>
 
-
-      <el-table-column type="expand" fixed>
-        <template #default="props">
-          <div m="4">
-            <p m="t-0 b-2">缂栧彿: {{ props.row.prodID }}</p>
-            <p m="t-0 b-2">鍚嶇О: {{ props.row.product }}</p>
-            <p m="t-0 b-2">鎵�灞炵被鍒�: {{ props.row.glassType }}</p>
-            <p m="t-0 b-2">蹇�熸煡璇�: {{ props.row.query }}</p>
-            <p m="t-0 b-2">澶囨敞: {{ props.row.remarks }}</p>
-            <p m="t-0 b-2">鍒涘缓浜�: {{ props.row.creator }}</p>
-            <p m="t-0 b-2">鍒涘缓鏃堕棿: {{ props.row.createTime }}</p>
+      <template #num1_filter="{ column, $panel }">
+        <div>
+          <div v-for="(option, index) in column.filters" :key="index">
+            <input type="type" v-model="option.data" @input="changeFilterEvent($event, option, $panel)"/>
           </div>
-        </template>
-      </el-table-column>
-      <el-table-column label="鎿嶄綔" width="110" fixed  >
-        <el-button link type="primary" size="small">缂栬緫</el-button>
-        <el-button link type="primary" size="small">鍒犻櫎</el-button>
-      </el-table-column>
-      <el-table-column sortable prop="prodID" label="缂栧彿" width="110"  />
-      <el-table-column prop="product" label="鍚嶇О" :show-overflow-tooltip='true'  />
-      <el-table-column prop="typeName" label="鎵�灞炵被鍒�" width="175" />
-      <el-table-column prop="query" label="蹇�熸煡璇�" width="150" />
-      <el-table-column prop="remarks" label="澶囨敞" :show-overflow-tooltip='true' width="100" />
-      <el-table-column prop="creator" label="鍒涘缓浜�" width="75" />
-      <el-table-column prop="createTime" label="鍒涘缓鏃堕棿" width="100" />
-    </el-table>-->
+        </div>
+      </template>
+
+
+    </vxe-grid>
+
+
+<!--      <basic-table-->
+<!--           style="height: 97%" v-if="flag"-->
+<!--          :tableProp="tableProp"-->
+<!--          @getCheckList="getCheckList"-->
+<!--          @getChildren="getChildren"-->
+<!--      ></basic-table>-->
   </div>
 </template>
 
 <style scoped>
-
+/*婊氬姩鏉℃暣浣撻儴鍒�*/
+.mytable-scrollbar ::-webkit-scrollbar {
+  width: 10px;
+  height: 10px;
+}
+/*婊氬姩鏉$殑杞ㄩ亾*/
+.mytable-scrollbar ::-webkit-scrollbar-track {
+  background-color: #FFFFFF;
+}
+/*婊氬姩鏉¢噷闈㈢殑灏忔柟鍧楋紝鑳藉悜涓婂悜涓嬬Щ鍔�*/
+.mytable-scrollbar ::-webkit-scrollbar-thumb {
+  background-color: transparent;
+  border-radius: 5px;
+  border: 1px solid #F1F1F1;
+  box-shadow: inset 0 0 6px rgba(0,0,0,.3);
+}
+.mytable-scrollbar ::-webkit-scrollbar-thumb:hover {
+  background-color: #ffffff;
+}
+.mytable-scrollbar ::-webkit-scrollbar-thumb:active {
+  background-color: white;
+}
+/*杈硅锛屽嵆涓や釜婊氬姩鏉$殑浜ゆ眹澶�*/
+.mytable-scrollbar ::-webkit-scrollbar-corner {
+  background-color: #FFFFFF;
+}
 </style>
\ No newline at end of file

--
Gitblit v1.8.0