From e9f8d23f55f64903d834308f9f167aaf3195c20d Mon Sep 17 00:00:00 2001
From: chenlu <1320612696@qq.com>
Date: 星期三, 30 七月 2025 09:10:26 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10105/r/ERP_override

---
 north-glass-erp/northglass-erp/src/views/pp/processCard/AddProcessCard.vue |  279 ++++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 194 insertions(+), 85 deletions(-)

diff --git a/north-glass-erp/northglass-erp/src/views/pp/processCard/AddProcessCard.vue b/north-glass-erp/northglass-erp/src/views/pp/processCard/AddProcessCard.vue
index 98a9ca4..2472063 100644
--- a/north-glass-erp/northglass-erp/src/views/pp/processCard/AddProcessCard.vue
+++ b/north-glass-erp/northglass-erp/src/views/pp/processCard/AddProcessCard.vue
@@ -2,7 +2,7 @@
 
 import request from "@/utils/request"
 import deepClone from "@/utils/deepClone"
-import {ElDatePicker, ElMessage} from "element-plus"
+import {ElCheckbox, ElDatePicker, ElMessage} from "element-plus"
 import useProductGlassTypeStore from "@/stores/sd/product/productGlassType"
 import {nextTick, onMounted, onUnmounted, reactive, ref, watch} from "vue"
 import {ArrowLeftBold, Search} from "@element-plus/icons-vue"
@@ -33,6 +33,22 @@
   }
   flag = !flag
 }
+
+//鍊掑彊
+let  flashback = ref(1)
+
+//瀹氫箟鎺掑簭瑙勫垯
+const optionVal = ref(0)
+const options = [
+  {
+    value: 0,
+    label: t('processCard.mainWidth'),
+  },
+  {
+    value: 1,
+    label: t('processCard.mainHeight'),
+  },
+]
 
 //瀹氫箟鏃堕棿
 const form = reactive({
@@ -101,6 +117,10 @@
 
     })
     produceList = produceList.value.concat(deepClone(res.data.data))
+    produceList.forEach(item => {
+      // 濡傛灉 shape 鍙兘鏄瓧绗︿覆灏辩敤 ==锛屽鏋滀竴瀹氭槸鏁板瓧灏辩敤 ===
+      item.shape = (item.shape == 2) ? t('order.alien') : t('order.universalShape');
+    });
     xGrid.value.reloadData(produceList)
     gridOptions.loading = false
   } else {
@@ -152,10 +172,10 @@
       spacerThickness: 0,
       inWeight: 4000,
       inMaxQuantity: 20,
-      inLenMin:400,
+      inLenMin:350,
       inLenMax:3500,
       inShortMax:2500,
-      inShortMin:400
+      inShortMin:350
     },
     rules:{
       shelfThickness: [
@@ -172,14 +192,14 @@
       ]
     },
     items:[
-      { field: 'shelfThickness', title: '鏋跺瓙绾垫繁(mm)', itemRender: { name: 'VxeInput' },span:8,folding: true},
-      { field: 'inWeight', title: '鏋跺瓙鎵块噸锛圞G锛�', itemRender: { name: 'VxeInput' },span:8,folding: true },
-      { field: 'spacerThickness', title: '闂撮殧鍘氬害(mm)', itemRender: { name: 'VxeInput' } ,span:8,folding: true},
-      { field: 'inLenMax', title: '闀胯竟鏈�澶�(mm)', itemRender: { name: 'VxeInput' },span:8,folding: true },
-      { field: 'inLenMin', title: '闀胯竟鏈�鐭�(mm)', itemRender: { name: 'VxeInput' },span:8,folding: true },
-      { field: 'inMaxQuantity', title: '鏈�澶ф暟閲�', itemRender: { name: 'VxeInput' } ,span:8,folding: true},
-      { field: 'inShortMax', title: '鐭竟鏈�澶�(mm)', itemRender: { name: 'VxeInput' },span:8,folding: true },
-      { field: 'inShortMin', title: '鐭竟鏈�鐭�(mm)', itemRender: { name: 'VxeInput' },span:8,folding: true },
+      { field: 'shelfThickness', title: t('processCard.depthShelf'), itemRender: { name: 'VxeInput' },span:8,folding: true},
+      { field: 'inWeight', title:t('processCard.shelfCapacity'), itemRender: { name: 'VxeInput' },span:8,folding: true },
+      { field: 'spacerThickness', title: t('processCard.IntervalThickness'), itemRender: { name: 'VxeInput' } ,span:8,folding: true},
+      { field: 'inLenMax', title: t('processCard.LongestLargestMax'), itemRender: { name: 'VxeInput' },span:8,folding: true },
+      { field: 'inLenMin', title: t('processCard.LongestShortestMax'), itemRender: { name: 'VxeInput' },span:8,folding: true },
+      { field: 'inMaxQuantity', title: t('processCard.quantityMax'), itemRender: { name: 'VxeInput' } ,span:8,folding: true},
+      { field: 'inShortMax', title: t('processCard.shortestLongest'), itemRender: { name: 'VxeInput' },span:8,folding: true },
+      { field: 'inShortMin', title: t('processCard.shortestSide'), itemRender: { name: 'VxeInput' },span:8,folding: true },
       {
         span: 24,
         collapseNode: true,
@@ -187,8 +207,8 @@
         itemRender: {
           name: 'VxeButtonGroup',
           options: [
-            { type: 'submit', content: '鏅鸿兘鍒嗘灦', status: 'primary' },
-            { type: 'reset', content: '閲嶇疆' }
+            { type: 'submit', content: t('processCard.intelligentBranching'), status: 'primary' },
+            { type: 'reset', content: t('processCard.reset') }
           ]
         }
       }
@@ -263,9 +283,12 @@
   ],//琛ㄥご鎸夐挳
 
   toolbarConfig: {
-    // buttons: [{
-    //
-    // }],
+    slots:{
+      buttons: "toolbar_buttons"
+    },
+    buttons: [{
+
+    }],
     // import: false,
     // export: true,
     // print: true,
@@ -300,6 +323,49 @@
 
 })
 const gridEventsRight = {
+  toolbarButtonClick({code}) {
+    const $grid = xGridLeft.value
+    if ($grid) {
+      switch (code) {
+        case 'sorting': {
+          request.post(`/processCard/selectSortingCard/${orderId}/${productionId}/${flashback.value}/${optionVal.value}`, filterData.value).then((res) => {
+
+            if (res.code == 200) {
+              pageTotal.value = res.data.total
+              maxProcseeId=res.data.maxFlowCard[0].process_id
+              orderOtherMoney.value = res.data.orderOtherMoney
+              orderOtherMoney.value.forEach(item => {
+                let column = {
+                  field: `${item.column}`,
+                  width: 100,
+                  title: item.alias,
+                  filters: [{data: ''}],
+                  slots: {filter: 'num1_filter'},
+                  filterMethod: filterChanged,
+                  sortable: true
+                }
+
+                gridOptions.columns.push(column)
+
+              })
+              produceList = res.data.data
+              produceList.forEach(item => {
+                // 濡傛灉 shape 鍙兘鏄瓧绗︿覆灏辩敤 ==锛屽鏋滀竴瀹氭槸鏁板瓧灏辩敤 ===
+                item.shape = (item.shape == 2) ? t('order.alien') : t('order.universalShape');
+              });
+              xGrid.value.reloadData(produceList)
+              gridOptions.loading = false
+            } else {
+              ElMessage.warning(res.msg)
+            }
+          })
+          return;
+
+        }
+
+      }
+    }
+  },
   formSubmit () {
     let form = gridOptions.formConfig.data
     form.orderId =orderId
@@ -440,92 +506,89 @@
     ElMessage.warning(t('processCard.schedulingOk'))
     return
   }
-  //productionId
+
   const $gridLeft = xGridLeft.value
   const leftData = $gridLeft.getTableData().fullData
+
+  //钀芥灦椤哄簭
   let index = 1
   if (leftData.length !== 0) {
-    index = leftData[0].landingSequence + 1
-    //index = index.toString().padStart(2, '0')
+    index = Math.max(...leftData.map(d => d.landingSequence || 0)) + 1
   }
-  let processId= null
-  // if (leftData.length !== 0){
-  //   processId = productionId + index.toString().padStart(3, '0')
-  // }
-  // else {
-    if (maxProcseeId!== null || maxProcseeId!== undefined|| maxProcseeId!== ''){
-      if (leftData.length !== 0){
-        const str=leftData[0].processId
-        const lastThree = str.slice(-3);
-        const result =  lastThree*1 + 1;
-        processId= productionId + result.toString().padStart(3, '0')
-      }
-      else {
-        // 鎴彇鍚庝笁浣�
-        const lastThree = maxProcseeId.slice(-3);
-        const result =  lastThree*1 + 1;
-        processId= productionId + result.toString().padStart(3, '0')
-      }
 
-    }
-    else {
-      processId = productionId + index.toString().padStart(3, '0')
-    }
-  //}
+  // 娴佺▼鍗″彿
+  let processId = null
+  if (maxProcseeId) {
+    const base = leftData.length !== 0 ? leftData[0].processId : maxProcseeId
+    const lastThree = base.slice(-3)
+    const result = parseInt(lastThree) + 1
+    processId = productionId + result.toString().padStart(3, '0')
+  } else {
+    processId = productionId + index.toString().padStart(3, '0')
+  }
 
-
-  const regex = /^(\d+|)$/;
+  const regex = /^(\d+|)$/
   if (!regex.test(checkedNum.value)) {
     ElMessage.warning(t('processCard.schedulingNo'))
     return
   }
-  //鍒ゆ柇姝f暣鏁�
-  if (/^[1-9]\d*$/.test(checkedNum.value)) {
-    checkedList.forEach((item) => {
-      //瀹氫箟key鍊间繚鎸�
-      //鍒ゆ柇鍙敤鏁伴噺鏄惁澶т簬绛変簬杈撳叆鐨勬暟閲�,涓嶆弧瓒冲垯鎶涘嚭寮傚父
-      if (item.baiscQuantity * 1 < checkedNum.value * 1) throw new Error(t('processCard.schedulingQuantity'));
-      item.quantity = checkedNum.value
-      item.processId = processId
-      item.landingSequence = index
-      item.baiscQuantity = item.baiscQuantity - checkedNum.value
-      item.computeGrossArea = (item.computeGrossArea - item.width * item.height * checkedNum.value / 1000000).toFixed(2)
 
-      //鍒犻櫎key
-      let key = item._X_ROW_KEY
-      delete item._X_ROW_KEY
-      if (item.baiscQuantity === 0) {
-        $grid.remove(item)
-      }
-      $gridLeft.insertAt(item)
-      //閲嶆柊璧嬪�糼ey
-      item._X_ROW_KEY = key
-    })
+  try {
+    if (/^[1-9]\d*$/.test(checkedNum.value)) {
+      //鏈夎緭鍏ユ暟閲�
+      checkedList.forEach((item) => {
+        if (item.baiscQuantity < checkedNum.value * 1) {
+          throw new Error(t('processCard.schedulingQuantity'))
+        }
+        item.quantity = checkedNum.value * 1
+        item.processId = processId
+        item.landingSequence = index  // 鉁� 鍚屼竴鎵规锛岃惤鏋堕『搴忎竴鑷�
+        item.baiscQuantity -= checkedNum.value * 1
+        item.computeGrossArea = (
+            item.computeGrossArea - item.width * item.height * checkedNum.value / 1000000
+        ).toFixed(2)
 
-    //娓呴櫎涓よ竟澶嶉�夋
+        const key = item._X_ROW_KEY
+        delete item._X_ROW_KEY
+
+        if (item.baiscQuantity === 0) {
+          $grid.remove(item)
+        }
+
+        const currentLeft = $gridLeft.getTableData().fullData
+        $gridLeft.clearSort()
+        $gridLeft.loadData([...currentLeft, item])
+        item._X_ROW_KEY = key
+      })
+    } else if (checkedNum.value === '') {
+      //娌℃湁杈撳叆鏁伴噺
+      checkedList.forEach((item) => {
+        item.processId = processId
+        item.landingSequence = index
+        item.quantity = item.baiscQuantity
+        delete item._X_ROW_KEY
+      })
+
+      $grid.remove(checkedList)
+      const currentLeft = $gridLeft.getTableData().fullData
+      $gridLeft.clearSort()
+      $gridLeft.loadData([...currentLeft, ...checkedList])
+    }
+
     $gridLeft.clearCheckboxRow()
     $grid.clearCheckboxRow()
-  } else if (checkedNum.value === '') {//鍒ゆ柇鏁伴噺杈撳叆妗嗘棤杈撳叆鏁板瓧
+    checkedNum.value = ''
 
-    checkedList.forEach((item) => {
-      item.processId = processId
-      item.landingSequence = index
-      item.quantity = item.baiscQuantity
-    })
-    //鍒犻櫎key
-    checkedList.forEach((item) => {
-      delete item._X_ROW_KEY
-    })
-    $gridLeft.insertAt(checkedList)
-    $grid.remove(checkedList)
-    //娓呴櫎涓よ竟澶嶉�夋
-    $gridLeft.clearCheckboxRow()
-    $grid.clearCheckboxRow()
-  }
-  if (checkedNum.value){
-    checkedNum.value =''
+    // 鎻掑叆鍚庤瑙夋帓搴�
+    // $nextTick(() => {
+    //   $gridLeft.sort('landingSequence', 'asc')
+    // })
+  } catch (e) {
+    ElMessage.warning(e.message )
   }
 }
+
+
 
 
 //鎸夌紪鍙峰垱寤烘祦绋嬪崱
@@ -964,6 +1027,10 @@
   weight.value = parseFloat(weightsum.toFixed(2));
 };
 
+//鍊掑簭璧嬪��
+function onFlashbackChange(checked) {
+  flashback.value = checked ? 0 : 1
+}
 </script>
 
 <template>
@@ -1048,14 +1115,56 @@
             <vxe-grid
                 id="rightTable"
                 ref="xGrid"
-                checkbox-config="{ reserve: true, strict: true }"
+                :checkbox-config="{labelField: 'name', highlight: true, range: true,reserve: true, strict: true}"
                 class="mytable-scrollbar"
                 height="100%"
                 v-bind="gridOptions"
                 v-on="gridEventsRight"
                 @checkbox-change="handleCheckboxChange"
                 @checkbox-all="handleCheckboxChange"
+                @checkbox-range-end="handleCheckboxChange"
             >
+
+              <!-- 鑷畾涔� toolbar_buttons 鎻掓Ы -->
+              <template #toolbar_buttons="{ $grid }">
+
+
+                <!-- 鎵嬪姩鍐欏嚭鎵�鏈夋寜閽� -->
+                &nbsp;
+                <el-select
+                    :default-first-option="true"
+                    ref="getSelect" style="width: 80px"
+                    v-model="optionVal"
+                    class="m-2"
+                >
+                  <el-option
+                      v-for="item in options"
+                      :key="item.value"
+                      :label="item.label"
+                      :value="item.value"
+                  />
+                </el-select>
+                &nbsp;
+                <el-button
+                    type="primary"
+                    style="margin-right:8px;width: 50px"
+                    @click="$grid.dispatchEvent('toolbar-button-click', { code: 'sorting' })"
+                >
+                  {{ t('processCard.sorting') }}
+                </el-button>
+
+                <el-checkbox
+                    :model-value="flashback === 0"
+                    @change="onFlashbackChange"
+                >
+                  {{ t('processCard.flashback') }}
+                </el-checkbox>
+
+
+              </template>
+
+
+
               <!--      @toolbar-button-click="toolbarButtonClickEvent"-->
               <!--      涓嬫媺鏄剧ず鎵�鏈変俊鎭彃妲�-->
               <template #content="{ row }">

--
Gitblit v1.8.0