From a660db06773007b1be690e0674829c00a57aeb7b Mon Sep 17 00:00:00 2001
From: 廖井涛 <2265517004@qq.com>
Date: 星期三, 24 十二月 2025 16:21:23 +0800
Subject: [PATCH] 订单首页流程卡新增楼层编号显示

---
 north-glass-erp/northglass-erp/src/views/pp/report/ProcessCardProgress.vue |  146 ++++++++++++++++++++++++++++++++----------------
 1 files changed, 96 insertions(+), 50 deletions(-)

diff --git a/north-glass-erp/northglass-erp/src/views/pp/report/ProcessCardProgress.vue b/north-glass-erp/northglass-erp/src/views/pp/report/ProcessCardProgress.vue
index 26571b2..65ccd72 100644
--- a/north-glass-erp/northglass-erp/src/views/pp/report/ProcessCardProgress.vue
+++ b/north-glass-erp/northglass-erp/src/views/pp/report/ProcessCardProgress.vue
@@ -4,23 +4,36 @@
 import {ElDatePicker, ElMessage} from "element-plus"
 import {nextTick, onMounted, onUnmounted, reactive, ref, watch} from "vue"
 import {Search} from "@element-plus/icons-vue"
-import {useRouter} from 'vue-router'
+import {useRoute, useRouter} from 'vue-router'
 import {changeFilterEvent, filterChanged} from "@/hook"
-
+import {addListener} from "@/hook/mouseMove";
 import { useI18n } from 'vue-i18n'
+import footSum from "@/hook/footSum";
+import {VxeUI} from "vxe-pc-ui";
 //璇█鑾峰彇
 const { t } = useI18n()
 let router=useRouter()
+const route = useRoute()
 
 let props = defineProps({
   orderId:null
 })
 onMounted(()=>{
+  //鍚敤琛ㄦ牸鎷栧姩閫変腑
+  addListener(xGrid.value, gridOptions)
   if(props.orderId===null  || props.orderId===undefined || props.orderId===''){
-    return
+
+  }else{
+    form.orderId = props.orderId
+    getWorkOrder()
   }
-  form.orderId = props.orderId
-  getWorkOrder()
+  if(route.query.orderId===null  || route.query.orderId===undefined || route.query.orderId===''){
+
+  }else {
+    form.orderId = route.query.orderId
+    getWorkOrder()
+  }
+
 })
 
 
@@ -47,24 +60,33 @@
   }
 })
 
+
 //闇�瑕佸悎骞剁殑鍒�
 let column = [1,3,8]
 //鐐瑰嚮鏌ヨ
 const getWorkOrder = () => {
-  request.post(`/report/processCardProgress/${form.orderId}`,column).then((res) => {
+  gridOptions.columns = gridOptions.columns.slice(0, 11); //娓呴櫎鍔ㄦ�佺敓鎴愮殑鍒楅噸鏂版煡璇�
+  request.post(`/report/processCardProgressReport/${form.orderId}`, column).then((res) => {
     if (res.code == 200) {
-      if(res.data.data.length===0){
+      if (res.data.data.length === 0) {
         ElMessage.warning(t('report.noDataFoundForThisOrder'))
         return
       }
-      //gridOptions.columns = JSON.parse(JSON.stringify(columns))
-      res.data.title.forEach(item =>{
-        let column = {slots: { default: 'quantitySum' }, width: 90,title: item.process}
+
+      // 鍔ㄦ�佹坊鍔犲垪
+      res.data.title.forEach((item, index) => {
+        let column = {
+          slots: { default: 'quantitySum' },
+          width: 150,
+          title: item.process,
+          field: `dynamicColumn${index}` // 涓哄姩鎬佸垪娣诲姞鍞竴鐨� field
+        }
         gridOptions.columns.push(column)
       })
       res.data.data.forEach(item => {
         item.reportWorkQuantity=JSON.parse(item.reportWorkQuantity)
         item.reportWorkQuantityCount=JSON.parse(item.reportWorkQuantityCount)
+        item.reportWorkQuantityShow=JSON.parse(item.reportWorkQuantityShow)
       })
       mergeCells.value = res.data.mergeCell
       xGrid.value.loadData(res.data.data)
@@ -73,18 +95,27 @@
     }
   })
 }
+
+const footSumDynamic = (data, columnTitle) => {
+  let sum = 0;
+  data.forEach(item => {
+    const value = Number(item.reportWorkQuantity[columnTitle]) || 0; // 浠� reportWorkQuantity 涓彁鍙栧�煎苟杞崲涓烘暟瀛�
+    sum += value;
+  });
+  return sum.toFixed(2);
+}
+
 const quantitySum = ( row,column )=>{
-  const reportWorkQuantity = row.reportWorkQuantity[column.title] || 0
-  const reportWorkQuantityCount = row.reportWorkQuantityCount[column.title] || 0
-  if(reportWorkQuantity===reportWorkQuantityCount){
-    return reportWorkQuantity
+  const reportWorkQuantityCount = row.reportWorkQuantityCount[column.title] || ''
+  const reportWorkQuantityShow = row.reportWorkQuantityShow[column.title] || ''
+  if(reportWorkQuantityShow === reportWorkQuantityCount ){
+    return reportWorkQuantityShow
   }
 
-  return (reportWorkQuantity
+  return (reportWorkQuantityShow
       +'('
       +reportWorkQuantityCount
       +')' )
-  //return
 }
 
 
@@ -113,7 +144,7 @@
     useKey: true
   },
   filterConfig: {   //绛涢�夐厤缃」
-    // remote: true
+                    // remote: true
   },
   customConfig: {
     storage: true
@@ -123,7 +154,7 @@
     mode: 'row',
     showStatus: true
   },//琛ㄥご鍙傛暟
-   columns : [
+  columns : [
     // {type:'expand',fixed:"left",slots: { content:'content' },width: 50},
     {field: 'product_name', width: 150,
       title: t('order.product'),
@@ -149,10 +180,11 @@
       slots: {filter: 'num1_filter'},
       filterMethod: filterChanged},
     {field: 'quantity', width: 90,title: t('order.quantity')},
+    {field: 'grossArea', width: 90,title: t('order.area')},
     {field: 'broken_num',width: 90, title: t('reportingWorks.quantityBroken')},
     // {field: 'shippedQuantity',width: 120, title: t('report.shippedQuantity')},
-    {field: 'inventory',width: 120, title: t('report.inventoryNum')},
-    {field: 'inventoryArea',width: 120, title: t('report.inventoryArea')},
+    {field: 'Storage',width: 120, title: t('report.inventoryNum')},
+    {field: 'StorageAreaShow',width: 120, title: t('report.inventoryArea')},
   ],
 
   toolbarConfig: {
@@ -161,28 +193,31 @@
     // }],
     // import: false,
     // export: true,
-     // print: true,
+    // print: true,
     zoom: true,
     custom: true
   },
   data:  [
   ],//table body瀹為檯鏁版嵁
   //鑴氶儴姹傚拰
-  // footerMethod ({ columns, data }) {//椤佃剼鍑芥暟
-  //   let footList=['7','8','9','10']
-  //   return[
-  //     columns.map((column, columnIndex) => {
-  //       if (columnIndex === 0) {
-  //         return '鍚堣:'
-  //       }
-  //       if (footList.includes(column.field)) {
-  //         return sumNum(data, column.field)
-  //       }
-  //       return ''
-  //     })
-  //   ]
-  // }
-
+  footerMethod ({ columns, data }) {
+    return [
+      columns.map((column, columnIndex) => {
+        if (columnIndex === 0) {
+          return t('basicData.total')
+        }
+        const List = ["quantity", "broken_num", "inventory", "inventoryArea","gross_area"]; // 闈欐�佸垪鐨勬眰鍜�
+        if (List.includes(column.field)) {
+          return footSum(data, column.field)
+        }
+        // 鍔ㄦ�佸垪鐨勬眰鍜�
+        if (column.field && column.field.startsWith('dynamicColumn')) {
+          return footSumDynamic(data, column.title)
+        }
+        return ''
+      })
+    ]
+  }
 })
 
 
@@ -197,26 +232,28 @@
 ])
 
 
-
+const handleCellDblClick = ({ row, column, cell, $event }) => {
+  VxeUI.clipboard.copy(row[column.property])
+}
 </script>
 
 <template>
   <div  style="width: 100%;height: 100%">
     <div class="head">
-        <el-input
-            v-model="form.orderId"
-            clearable
-            :disabled="props.orderId"
-            :placeholder="$t('order.orderId')"
-            style="width: 140px"></el-input>
-        &nbsp;&nbsp;
-        <el-button
-            :disabled="props.orderId"
-            @click="getWorkOrder"
-            id="select"
-            type="primary" :icon="Search">{{$t('basicData.search')}}
+      <el-input
+          v-model="form.orderId"
+          clearable
+          :disabled="props.orderId"
+          :placeholder="$t('order.orderId')"
+          style="width: 140px"></el-input>
+      &nbsp;&nbsp;
+      <el-button
+          :disabled="props.orderId"
+          @click="getWorkOrder"
+          id="select"
+          type="primary" :icon="Search">{{$t('basicData.search')}}
 
-        </el-button>
+      </el-button>
 
     </div>
     <div class="main-table">
@@ -226,6 +263,7 @@
           ref="xGrid"
           v-bind="gridOptions"
           :merge-cells="mergeCells"
+          @cell-dblclick="handleCellDblClick"
 
       >
         <!--      @toolbar-button-click="toolbarButtonClickEvent"-->
@@ -272,4 +310,12 @@
   width: 100%;
   height: calc(100% - 35px);
 }
+
+.vxe-grid {
+  /* 绂佺敤娴忚鍣ㄩ粯璁ら�変腑 */
+  -webkit-user-select: none;
+  -moz-user-select: none;
+  -ms-user-select: none;
+  user-select: none;
+}
 </style>
\ No newline at end of file

--
Gitblit v1.8.0