From d8085c81987d5819d7f270bcf0bd68d879f28d2b Mon Sep 17 00:00:00 2001
From: guoyuji <guoyujie@ng.com>
Date: 星期三, 13 三月 2024 10:30:47 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/ERP_override

---
 north-glass-erp/northglass-erp/src/views/pp/processCard/ProductionScheduling.vue |  270 +++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 208 insertions(+), 62 deletions(-)

diff --git a/north-glass-erp/northglass-erp/src/views/pp/processCard/ProductionScheduling.vue b/north-glass-erp/northglass-erp/src/views/pp/processCard/ProductionScheduling.vue
index eb198e6..899f725 100644
--- a/north-glass-erp/northglass-erp/src/views/pp/processCard/ProductionScheduling.vue
+++ b/north-glass-erp/northglass-erp/src/views/pp/processCard/ProductionScheduling.vue
@@ -12,7 +12,11 @@
 import BasicTable from '@/components/basic/BasicTable.vue'
 import {VXETable} from "vxe-table";
 import useUserInfoStore from "@/stores/userInfo";
-import {changeFilterEvent,filterChanged} from "@/hook"
+import {changeFilterEvent, filterChanged} from "@/hook"
+import {addListener,toolbarButtonClickEvent} from "@/hook/mouseMove";
+import { useI18n } from 'vue-i18n'
+//璇█鑾峰彇
+const { t } = useI18n()
 
 let router = useRouter()
 const userStore = useUserInfoStore()
@@ -32,8 +36,9 @@
   }
 }
 
+
 //宸ュ簭
-const value = ref('')
+const value = ref('cutting')
 
 
 //鎺掍骇鐘舵��
@@ -41,11 +46,11 @@
 const stateOptions = [
   {
     value: '2',
-    label: '宸叉帓浜�',
+    label: t('processCard.ProductionSchedulingOk'),
   },
   {
     value: '1',
-    label: '鏈帓浜�',
+    label: t('processCard.ProductionSchedulingNo'),
   },
 ]
 
@@ -119,21 +124,32 @@
   return [start, end]
 }
 
+onMounted(()=>{
+  //鍚敤琛ㄦ牸鎷栧姩閫変腑
+  addListener(xGrid.value,gridOptions)
+})
+
 //绗竴娆″姞杞借幏鍙栬繎涓冨ぉ鏃堕棿鍜岄粯璁ょ姸鎬�
 form.date1 = getNowTime()
 let startTime = form.date1[0]
 let endTime = form.date1[1]
+let selectProcesses = value.value
+let inputVal = form.orderId
+if (inputVal == '') {
+  inputVal = null
+}
+if (selectProcesses == '') {
+  selectProcesses = null
+}
 //绗竴娆″姞杞芥暟鎹�
-
-request.post(`/productionScheduling/selectLastScheduling/${startTime}/${endTime}`, filterData.value).then((res) => {
+request.post(`/productionScheduling/selectLastScheduling/${startTime}/${endTime}/${selectProcesses}/${inputVal}`, filterData.value).then((res) => {
 
   if (res.code == 200) {
     pageTotal.value = res.data.total
     produceList = produceList.value.concat(deepClone(res.data.data))
-    titleSelectJson.value.processType=res.data.process
+    titleSelectJson.value.processType = res.data.process
     xGrid.value.reloadData(produceList)
     gridOptions.loading = false
-    console.log(res.data)
     //绂佺敤鍒犻櫎銆佷繚瀛樻寜閽�
     gridOptions.toolbarConfig.buttons[0].disabled = true
     gridOptions.toolbarConfig.buttons[1].disabled = true
@@ -157,13 +173,13 @@
   }
   if (inputVal == null && selectState == 1) {
     //鏍规嵁鏃堕棿鏌ヨ鏈帓浜ф暟鎹�
-    request.post(`/productionScheduling/selectLastScheduling/${startTime}/${endTime}`, filterData.value).then((res) => {
+    request.post(`/productionScheduling/selectLastScheduling/${startTime}/${endTime}/${selectProcesses}/${inputVal}`, filterData.value).then((res) => {
 
       if (res.code == 200) {
         pageTotal.value = res.data.total
         xGrid.value.loadData(res.data.data)
         gridOptions.loading = false
-        //绂佺敤鍒犻櫎銆佷繚瀛樻寜閽�
+        //绂佺敤鍒犻櫎銆佸鏍告寜閽�
         gridOptions.toolbarConfig.buttons[0].disabled = true
         gridOptions.toolbarConfig.buttons[1].disabled = true
         //鍚敤淇濆瓨
@@ -172,16 +188,14 @@
         ElMessage.warning(res.msg)
       }
     })
-  } else
-    if (inputVal != null && selectState == 1) {
-
+  } else if (inputVal != null && selectState == 1) {
     //鏍规嵁宸ュ簭鏌ヨ鏈帓浜ф暟鎹�
     request.post(`/productionScheduling/selectScheduling/${startTime}/${endTime}/${inputVal}/${selectProcesses}/${selectState}`, filterData.value).then((res) => {
       if (res.code == 200) {
         pageTotal.value = res.data.total
         xGrid.value.loadData(res.data.data)
         gridOptions.loading = false
-        //绂佺敤鍒犻櫎銆佷繚瀛樻寜閽�
+        //绂佺敤鍒犻櫎銆佸鏍告寜閽�
         gridOptions.toolbarConfig.buttons[0].disabled = true
         gridOptions.toolbarConfig.buttons[1].disabled = true
         //鍚敤淇濆瓨
@@ -192,13 +206,12 @@
     })
   } else if (inputVal == null && selectState == 2) {
     //鏍规嵁鏃堕棿鏌ヨ宸叉帓浜ф暟鎹�
-    console.log(startTime, endTime, selectProcesses, selectState)
     request.post(`/productionScheduling/selectScheduling/${startTime}/${endTime}/${inputVal}/${selectProcesses}/${selectState}`, filterData.value).then((res) => {
       if (res.code == 200) {
         pageTotal.value = res.data.total
         xGrid.value.loadData(res.data.data)
         gridOptions.loading = false
-        //鍚敤鍒犻櫎銆佷繚瀛樻寜閽�
+        //鍚敤鍒犻櫎銆佸鏍告寜閽�
         gridOptions.toolbarConfig.buttons[0].disabled = false
         gridOptions.toolbarConfig.buttons[1].disabled = false
         //绂佺敤淇濆瓨
@@ -214,7 +227,7 @@
         pageTotal.value = res.data.total
         xGrid.value.loadData(res.data.data)
         gridOptions.loading = false
-        //鍚敤鍒犻櫎銆佷繚瀛樻寜閽�
+        //鍚敤鍒犻櫎銆佸鏍告寜閽�
         gridOptions.toolbarConfig.buttons[0].disabled = false
         gridOptions.toolbarConfig.buttons[1].disabled = false
         //绂佺敤淇濆瓨
@@ -228,6 +241,12 @@
 
 }
 
+/*鍚庣杩斿洖缁撴灉澶氬眰宓屽灞曠ず*/
+const hasDecimal = (value) => {
+  const regex = /\./; // 瀹氫箟姝e垯琛ㄨ揪寮忥紝鏌ユ壘灏忔暟鐐�
+  return regex.test(value); // 杩斿洖true/false
+}
+
 
 //瀛愮粍浠舵帴鏀跺弬鏁�
 const xGrid = ref()
@@ -236,7 +255,7 @@
   keepSource: true,//淇濇寔婧愭暟鎹�
   align: 'center',//鏂囧瓧灞呬腑
   stripe: true,//鏂戦┈绾�
-  rowConfig: {isCurrent: true, isHover: true, height: 50},//榧犳爣绉诲姩鎴栭�夋嫨楂樹寒
+  rowConfig: {isCurrent: true, isHover: true, height: 30},//榧犳爣绉诲姩鎴栭�夋嫨楂樹寒
   id: 'CustomerList',
   showFooter: true,//鏄剧ず鑴�
   printConfig: {},
@@ -249,66 +268,128 @@
     useKey: true
   },
   filterConfig: {   //绛涢�夐厤缃」
-    // remote: true
+                    // remote: true
   },
   customConfig: {
     storage: true
   },
-  editConfig: {
+
+    editConfig: {
     trigger: 'click',
     mode: 'row',
     showStatus: true
-  },//琛ㄥご鍙傛暟
+  },
+  menuConfig: {
+    body: {
+      options: [
+        [
+          { code: 'copyChecked', name: t('basicData.selectSame'), prefixIcon: 'vxe-icon-copy', visible: true, disabled: false },
+          { code: 'copyAll', name: t('basicData.sameAfterwards'), prefixIcon: 'vxe-icon-feedback', visible: true, disabled: false },
+          { code: 'clearChecked', name: t('basicData.clearSelection'), prefixIcon: 'vxe-icon-indicator', visible: true, disabled: false },
+        ]
+      ]
+    }
+  },
+  //琛ㄥご鍙傛暟
   columns: [
     {type: 'expand', fixed: "left", slots: {content: 'content'}, width: 50},
-    {type: 'checkbox', fixed: "left", title: '閫夋嫨', width: 80},
-    {type: 'seq', fixed: "left", title: '鑷簭', width: 50},
+    {type: 'checkbox', fixed: "left", title: t('basicData.check'), width: 80},
+    {type: 'seq', fixed: "left", title: t('basicData.Number'), width: 50},
     {
       field: 'scheduled_start_time',
       width: 120,
       editRender: {name: 'input', attrs: {placeholder: '', type: 'date'}},
-      title: '璁″垝寮�濮嬫椂闂�'
+      title: t('processCard.scheduledStartTime')
     },
     {
       field: 'plan_end_time',
       width: 120,
       editRender: {name: 'input', attrs: {placeholder: '', type: 'date'}},
-      title: '璁″垝缁撴潫鏃堕棿'
+      title: t('processCard.planEndTime')
     },
     // {field: '鎺掍骇缂栧彿', title: '鎺掍骇缂栧彿',  width: 120 },
-    {field: 'order_id', title: '閿�鍞崟鍙�', filters: [{data: ''}], slots: {filter: 'num1_filter'}, width: 100,filterMethod:filterChanged},
-    {field: 'customer_name', title: '瀹㈡埛鍚嶇О', width: 110, filters: [{data: ''}], slots: {filter: 'num1_filter'},filterMethod:filterChanged},
-    {field: 'project', title: '椤圭洰鍚嶇О', width: 100, filters: [{data: ''}], slots: {filter: 'num1_filter'},filterMethod:filterChanged},
-    {field: 'order_number', title: '搴忓彿', filters: [{data: ''}], slots: {filter: 'num1_filter'}, width: 70,filterMethod:filterChanged},
-
-    {field: 'width', title: '瀹�', width: 60,filters: [{data: ''}],slots: {filter: 'num1_filter'},filterMethod:filterChanged},
-    {field: 'height', title: '楂�', width: 60,filters: [{data: ''}],slots: {filter: 'num1_filter'},filterMethod:filterChanged},
-    {field: 'quantity', title: '璁㈠崟鏁伴噺', width: 70},
-    {field: 'area', title: '璁㈠崟闈㈢Н', width: 90},
+    {
+      field: 'order_id',
+      title: t('order.orderId'),
+      filters: [{data: ''}],
+      slots: {filter: 'num1_filter'},
+      width: 100,
+      filterMethod: filterChanged
+    },
+    {
+      field: 'customer_name',
+      title: t('processCard.customerName'),
+      width: 110,
+      filters: [{data: ''}],
+      slots: {filter: 'num1_filter'},
+      filterMethod: filterChanged
+    },
+    {
+      field: 'project',
+      title: t('order.project'),
+      width: 100,
+      filters: [{data: ''}],
+      slots: {filter: 'num1_filter'},
+      filterMethod: filterChanged
+    },
+    {
+      field: 'order_number',
+      title: t('order.OrderNum'),
+      filters: [{data: ''}],
+      slots: {filter: 'num1_filter'},
+      width: 70,
+      filterMethod: filterChanged
+    },
+    {
+      field: 'technology_number',
+      title: t('processCard.technologyNumber'),
+      filters: [{data: ''}],
+      slots: {filter: 'num1_filter'},
+      width: 70,
+      filterMethod: filterChanged
+    },
+    {
+      field: 'child_width',
+      title: t('order.width'),
+      width: 60,
+      filters: [{data: ''}],
+      slots: {filter: 'num1_filter'},
+      filterMethod: filterChanged
+    },
+    {
+      field: 'child_height',
+      title: t('order.height'),
+      width: 60,
+      filters: [{data: ''}],
+      slots: {filter: 'num1_filter'},
+      filterMethod: filterChanged
+    },
+    {field: 'quantity', title: t('processCard.orderQuantity'), width: 70},
+    {field: 'area', title: t('processCard.orderArea'), width: 90},
     {
       field: 'scheduling_quantity',
       width: 120,
       editRender: {name: 'input', attrs: {placeholder: ''}},
-      title: '鎺掍骇鏁伴噺',
+      title: t('processCard.productionSchedulingQuantity'),
       sortable: true
     },
-    {field: 'pendingProductionQuantity', title: '寰呮帓浜ф暟閲�', width: 120},
-    {field: 'pendingProductionArea', title: '寰呮帓浜ч潰绉�', width: 120},
-    {field: 'productionScheduledQuantity', title: '宸叉帓浜ф暟閲�', width: 120},
-    {field: 'productionScheduledArea', title: '宸叉帓浜ч潰绉�', width: 120},
-    {field: 'review_status', title: '瀹℃牳鐘舵��', width: 140},
-    {field: 'reviewer', title: '瀹℃牳浜�', width: 140},
-    {field: 'product_name', title: '浜у搧鍚嶇О', width: 140},
-    {field: 'shape', title: '褰㈢姸', width: 80},
-    {field: 'notes', title: '澶囨敞', editRender: {name: 'input', attrs: {placeholder: ''}}, width: 120},
-    {field: 'scheduling_id', title: '鎺掍骇缂栧彿',width: 120},
+    {field: 'pendingProductionQuantity', title: t('processCard.quantityToScheduled'), width: 120},
+    {field: 'pendingProductionArea', title: t('processCard.areaToScheduled'), width: 120},
+    {field: 'productionScheduledQuantity', title: t('processCard.plannedProductionQuantity'), width: 120},
+    {field: 'productionScheduledArea', title: t('processCard.plannedProductionArea'), width: 120},
+    {field: 'review_status', title: t('processCard.reviewedState'), width: 140},
+    {field: 'reviewer', title: t('processCard.reviewed'), width: 140},
+    {field: 'glass_child', title: t('order.product'), width: 140},
+    {field: 'shape', title: t('order.shape'), width: 80},
+    {field: 'notes', title: t('processCard.notes'), editRender: {name: 'input', attrs: {placeholder: ''}}, width: 120},
+    {field: 'scheduling_id', title: t('processCard.schedulingId'), width: 120},
   ],//琛ㄥご鎸夐挳
 
   toolbarConfig: {
     buttons: [
-      {code: 'delete', name: '鍒犻櫎', status: 'primary'},
-      {code: 'review', name: '瀹℃牳', status: 'primary'},
-      {code: 'save', name: '鎺掍骇', status: 'primary', icon: 'vxe-icon-save'},
+      {code: 'delete', name: t('basicData.delete'), status: 'primary'},
+      {code: 'review', name: t('basicData.review'), status: 'primary'},
+      {code: 'save', name: t('processCard.scheduling'), status: 'primary', icon: 'vxe-icon-save'},
     ],
     import: false,
     // export: true,
@@ -335,9 +416,7 @@
 
 })
 
-//鍒犻櫎
-
-
+//琛ㄦ牸鎸夐挳
 const gridEvents = {
   async toolbarButtonClick({code}) {
     const $grid = xGrid.value
@@ -372,12 +451,21 @@
               processes: selectProcesses,//宸ュ簭
               userName: username//瀹℃牳浜�
             })
+            //绂佺敤淇濆瓨
+            gridOptions.toolbarConfig.buttons[2].disabled = true
             //淇濆瓨鎺掍骇鏁版嵁
             request.post("/productionScheduling/addScheduling", schedulingData.value).then((res) => {
               if (res.code == 200) {
                 ElMessage.success("淇濆瓨鎴愬姛")
-                location.reload();
+                // 鍚敤淇濆瓨
+                gridOptions.toolbarConfig.buttons[2].disabled = false
+                router.push({
+                  path: '/main/processCard/ProductionScheduling',
+                  query: { random: Math.random()}
+                })
               } else {
+                // 鍚敤淇濆瓨
+                gridOptions.toolbarConfig.buttons[2].disabled = false
                 ElMessage.warning(res.msg)
 
               }
@@ -402,7 +490,7 @@
                 scheduling: selectRecords,
               })
 
-              request.post("/productionScheduling/deleteScheduling",schedulingData.value).then((res) => {
+              request.post("/productionScheduling/deleteScheduling", schedulingData.value).then((res) => {
                 if (res.code == 200) {
                   ElMessage.success("鍒犻櫎鎴愬姛")
                   location.reload();
@@ -427,7 +515,7 @@
               scheduling: selectRecords,
               userName: username//瀹℃牳浜�
             })
-            request.post("/productionScheduling/examineScheduling",schedulingData.value).then((res) => {
+            request.post("/productionScheduling/examineScheduling", schedulingData.value).then((res) => {
               if (res.code == 200) {
                 ElMessage.success("瀹℃牳鎴愬姛")
                 location.reload();
@@ -443,15 +531,63 @@
       }
     }
   },
-
+  menuClick ({ menu, row, column }) {
+    const $grid = xGrid.value
+    if ($grid) {
+      switch (menu.code) {
+        case 'copyChecked' :{
+          let result = toolbarButtonClickEvent()
+          if(result){
+            const dataList = xGrid.value.getTableData().visibleData
+            const val = dataList[result.start][result.cell]
+            dataList.forEach((item,index) =>{
+              if(index>=result.start && index<=result.end){
+                item[result.cell] = val
+              }
+            })
+          }
+          gridOptions.menuConfig.body.options[0][5].disabled=false
+          break
+        }
+        case 'copyAll' :{
+          let result = toolbarButtonClickEvent()
+          if(result){
+            const dataList = xGrid.value.getTableData().visibleData
+            const val = dataList[result.start][result.cell]
+            dataList.forEach((item,index) =>{
+              if(index>=result.start ){
+                item[result.cell] = val
+              }
+            })
+          }
+          gridOptions.menuConfig.body.options[0][5].disabled=false
+          break
+        }
+        case 'clearChecked' :{
+          let result = toolbarButtonClickEvent()
+          if(result){
+            const dataList = xGrid.value.getTableData().visibleData
+            dataList.forEach((item,index) =>{
+              if(index>=result.start && index<=result.end){
+                item[result.cell] = ''
+              }
+            })
+          }
+          gridOptions.menuConfig.body.options[0][5].disabled=false
+          break
+        }
+      }
+    }
+  },
 }
 
 const determineNum = () => {
   const $grid = xGrid.value
   const table = $grid.getTableData().fullData
   const selectRecords = $grid.getCheckboxRecords()
+  let selectState = stateValue.value
   table.forEach((selectRecords) => {
-    if (selectRecords.scheduling_quantity > selectRecords.pendingProductionQuantity) {
+    if (selectRecords.scheduling_quantity > selectRecords.pendingProductionQuantity && selectState==1) {
       ElMessage.warning("鎺掍骇鏁伴噺涓嶈兘澶т簬寰呮帓浜ф暟閲�")
       //绂佺敤淇濆瓨鎸夐挳
       //gridOptions.toolbarConfig.buttons[2].disabled = true
@@ -460,8 +596,6 @@
 
   })
 }
-
-
 
 
 </script>
@@ -481,9 +615,9 @@
 
         />
         &nbsp;&nbsp;
-        <el-input v-model="form.orderId" placeholder="閿�鍞崟鍙�" clearable style="width: 110px"></el-input>
+        <el-input v-model="form.orderId" clearable :placeholder="$t('order.orderId')" style="width: 110px"></el-input>
         &nbsp;
-        <el-select v-model="value" clearable placeholder="璇烽�夋嫨宸ュ簭" style="width: 120px">
+        <el-select v-model="value" clearable default-value="default_city" style="width: 120px">
           <el-option
               v-for="item in titleSelectJson['processType']"
               :key="item.id"
@@ -504,7 +638,7 @@
         <el-button
             id="select"
             :icon="Search"
-            type="primary" @click="getWorkOrder">鏌ヨ
+            type="primary" @click="getWorkOrder">{{$t('basicData.search')}}
         </el-button>
       </el-row>
 
@@ -512,8 +646,8 @@
     <vxe-grid
         ref="xGrid"
         class="mytable-scrollbar"
-        max-height="100%"
         height="100%"
+        max-height="100%"
         v-bind="gridOptions"
         v-on="gridEvents"
         @filter-change="filterChanged"
@@ -542,6 +676,11 @@
 
     </vxe-grid>
   </div>
+  <div class="vxe-table--cell-area" ref="cellArea" >
+    <span  class="vxe-table--cell-main-area"  ></span>
+
+    <span class="vxe-table--cell-active-area"  ></span>
+  </div>
 </template>
 
 <style scoped>
@@ -555,4 +694,11 @@
   height: 6%;
   text-align: center;
 }
+.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