From b97e00dae4fa017c8273e41fb0f24cf7c7c69a33 Mon Sep 17 00:00:00 2001
From: chenlu <1320612696@qq.com>
Date: 星期一, 25 十一月 2024 13:28:35 +0800
Subject: [PATCH] 工程打印标签调整

---
 north-glass-erp/northglass-erp/src/views/pp/processCard/ProductionScheduling.vue |  153 ++++++++++++++++++++++++++++++++++----------------
 1 files changed, 104 insertions(+), 49 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 424b032..bd40171 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
@@ -15,12 +15,16 @@
 import {addListener, toolbarButtonClickEvent} from "@/hook/mouseMove";
 import {useI18n} from 'vue-i18n'
 import footSum from "@/hook/footSum"
+import useOrderInfoStore from "@/stores/sd/order/orderInfo"
+
 //璇█鑾峰彇
 const {t} = useI18n()
 
 let router = useRouter()
 const userStore = useUserInfoStore()
 const username = userStore.user.userName
+const orderInfo = useOrderInfoStore()
+
 const getTableRow = (row, type) => {
   switch (type) {
     case 'edit' : {
@@ -90,11 +94,11 @@
 
 //鑾峰彇涓冨ぉ鍓嶅埌褰撳墠鏃堕棿
 function getNowTime() {
-  const start = new Date(new Date().getTime() - 3600 * 1000 * 24 * 3)
+  const start = new Date(new Date().getTime() - 3600 * 1000 * 24 * 15)
       .toISOString()
       .replace('T', ' ')
       .slice(0, 10) //榛樿寮�濮嬫椂闂�3澶╁墠
-  const end = new Date(new Date().getTime() + 3600 * 1000 * 24)
+  const end = new Date(new Date().getTime())
       .toISOString()
       .replace('T', ' ')
       .slice(0, 10)//榛樿缁撴潫鏃堕棿褰撳墠鏃堕棿
@@ -107,9 +111,11 @@
 })
 
 //绗竴娆″姞杞借幏鍙栬繎3澶╂椂闂村拰榛樿鐘舵��
-form.date1 = getNowTime()
-let startTime = form.date1[0]
-let endTime = form.date1[1]
+if (orderInfo.workOrderDate[0]=="" && orderInfo.workOrderDate[1]==""){
+  orderInfo.workOrderDate=getNowTime()
+}
+let startTime = orderInfo.workOrderDate[0]
+let endTime = orderInfo.workOrderDate[1]
 let selectProcesses = processVal.value
 let inputVal = form.orderId
 if (inputVal == '') {
@@ -127,9 +133,10 @@
     titleSelectJson.value.processType = res.data.process
 
     gridOptions.loading = false
-    //绂佺敤鍒犻櫎銆佷繚瀛樻寜閽�
+    //绂佺敤鍒犻櫎銆佸鏍告寜閽�
     gridOptions.toolbarConfig.buttons[0].disabled = true
     gridOptions.toolbarConfig.buttons[1].disabled = true
+    gridOptions.toolbarConfig.buttons[2].disabled = true
   } else {
     ElMessage.warning(res.msg)
   }
@@ -137,8 +144,8 @@
 
 //鐐瑰嚮鏃舵煡璇�
 const getWorkOrder = () => {
-  let startTime = form.date1[0]
-  let endTime = form.date1[1]
+  let startTime = orderInfo.workOrderDate[0]
+  let endTime = orderInfo.workOrderDate[1]
   let selectProcesses = processVal.value
   let selectState = stateValue.value
   let inputVal = form.orderId
@@ -155,20 +162,21 @@
       total.pageTotal = res.data.total.pageTotal
       pageTotal.value = res.data.total
       xGrid.value.loadData(res.data.data)
-      console.log(res.data.data)
       gridOptions.loading = false
       if (selectState==1){
         //绂佺敤鍒犻櫎銆佸鏍告寜閽�
         gridOptions.toolbarConfig.buttons[0].disabled = true
         gridOptions.toolbarConfig.buttons[1].disabled = true
+        gridOptions.toolbarConfig.buttons[2].disabled = true
         //鍚敤淇濆瓨
-        gridOptions.toolbarConfig.buttons[2].disabled = false
+        gridOptions.toolbarConfig.buttons[3].disabled = false
       }else{
-        //绂佺敤鍒犻櫎銆佸鏍告寜閽�
+        //鍚敤鍒犻櫎銆佸鏍告寜閽�
         gridOptions.toolbarConfig.buttons[0].disabled = false
         gridOptions.toolbarConfig.buttons[1].disabled = false
-        //鍚敤淇濆瓨
         gridOptions.toolbarConfig.buttons[2].disabled = false
+        //绂佺敤淇濆瓨
+        gridOptions.toolbarConfig.buttons[3].disabled = true
 
       }
     } else {
@@ -201,8 +209,8 @@
   }
 
 //鑾峰彇閫変腑鏃堕棿
-  let startTime = form.date1[0]
-  let endTime = form.date1[1]
+  let startTime = orderInfo.workOrderDate[0]
+  let endTime = orderInfo.workOrderDate[1]
   let selectProcesses = processVal.value
   let selectState = stateValue.value
   let inputVal = form.orderId
@@ -240,8 +248,8 @@
   keepSource: true,//淇濇寔婧愭暟鎹�
   align: 'center',//鏂囧瓧灞呬腑
   stripe: true,//鏂戦┈绾�
-  rowConfig: {isCurrent: true, isHover: true, height: 50},//榧犳爣绉诲姩鎴栭�夋嫨楂樹寒
-  id: 'CustomerList',
+  rowConfig: {isCurrent: true, isHover: true, height: 30},//榧犳爣绉诲姩鎴栭�夋嫨楂樹寒
+  id: 'productionScheduling',
   showFooter: true,//鏄剧ず鑴�
   printConfig: {},
   importConfig: {},
@@ -259,7 +267,7 @@
     storage: true
   },
   editConfig: {
-    trigger: 'click',
+    trigger: 'dblclick',
     mode: 'row',
     showStatus: true
   },
@@ -309,9 +317,18 @@
       editRender: {name: 'input', attrs: {placeholder: '', type: 'date'}},
       title: t('processCard.planEndTime')
     },
+    {
+      field: 'schedulingQuantity',
+      width: 120,
+      editRender: {name: 'input', attrs: {placeholder: ''}},
+      title: t('processCard.productionSchedulingQuantity'),
+      sortable: true
+    },
+    {field: 'notes', title: t('processCard.notes'), editRender: {name: 'input', attrs: {placeholder: ''}}, width: 120},
+
     // {field: '鎺掍骇缂栧彿', title: '鎺掍骇缂栧彿',  width: 120 },
     {
-      field: 'orderGlassDetail.orderId',
+      field: 'order.orderId',
       title: t('order.orderId'),
       filters: [{data: ''}],
       slots: {filter: 'num1_filter'},
@@ -357,13 +374,7 @@
     },
     {field: 'orderDetail.quantity', title: t('processCard.orderQuantity'), width: 90},
     {field: 'orderGlassDetail.area', title: t('processCard.orderArea'), width: 90},
-    {
-      field: 'schedulingQuantity',
-      width: 120,
-      editRender: {name: 'input', attrs: {placeholder: ''}},
-      title: t('processCard.productionSchedulingQuantity'),
-      sortable: true
-    },
+
     {field: 'pendingProductionQuantity', title: t('processCard.quantityToScheduled'), width: 100},
     {field: 'pendingProductionArea', title: t('processCard.areaToScheduled'), width: 100},
     {field: 'productionScheduledQuantity', title: t('processCard.plannedProductionQuantity'), width: 100},
@@ -372,7 +383,6 @@
     {field: 'reviewer', title: t('processCard.reviewed'), width: 80},
     {field: 'orderDetail.productName', title: t('order.product'), width: 140},
     {field: 'orderDetail.shape', title: t('order.shape'), width: 80},
-    {field: 'notes', title: t('processCard.notes'), editRender: {name: 'input', attrs: {placeholder: ''}}, width: 120},
     {field: 'schedulingId', title: t('processCard.schedulingId'), width: 120},
   ],//琛ㄥご鎸夐挳
 
@@ -380,6 +390,7 @@
     buttons: [
       {code: 'delete', name: t('basicData.delete'), status: 'primary'},
       {code: 'review', name: t('basicData.review'), status: 'primary'},
+      {code: 'cancelReview', name: t('basicData.cancelReview'), status: 'primary'},
       {code: 'save', name: t('processCard.scheduling'), status: 'primary', icon: 'vxe-icon-save'},
     ],
     import: false,
@@ -420,7 +431,7 @@
           if ($table) {
             const selectRecords = $table.getCheckboxRecords()
             if (selectRecords.length == 0) {
-              ElMessage.warning("璇峰嬀閫夋帓浜ф暟鎹�")
+              ElMessage.warning(t('processCard.checkProductionScheduling'))
               return;
             }
             for (let i = 0; i < selectRecords.length; i++) {
@@ -429,13 +440,13 @@
               let number = selectRecords[i].schedulingQuantity
               //璁″垝寮�濮嬨�佺粨鏉熸椂闂达紝鎺掍骇鏁伴噺涓嶈兘涓虹┖
               if (start == null || end == null || number == null) {
-                ElMessage.warning("璇峰~鍏ュ搴旂殑鍊煎啀杩涜淇濆瓨")
+                ElMessage.warning(t('processCard.saveCorrespondingValues'))
                 return;
               }
             }
             let selectProcesses = processVal.value
             if (selectProcesses == null || selectProcesses == "") {
-              ElMessage.warning("璇烽�夋嫨鎺掍骇宸ュ簭")
+              ElMessage.warning(t('processCard.selectProductionSchedulingProcess'))
               return;
             }
 
@@ -449,7 +460,7 @@
             //淇濆瓨鎺掍骇鏁版嵁
             request.post("/productionScheduling/addScheduling", schedulingData.value).then((res) => {
               if (res.code == 200) {
-                ElMessage.success("淇濆瓨鎴愬姛")
+                ElMessage.success(t('basicData.msg.saveSuccess'))
                 // 鍚敤淇濆瓨
                 gridOptions.toolbarConfig.buttons[2].disabled = false
                 router.push({
@@ -474,10 +485,11 @@
           const selectRecords = $table.getCheckboxRecords()
           if ($table) {
             if (selectRecords.length == 0) {
-              ElMessage.warning("璇峰嬀閫夋帓浜ф暟鎹�")
+              ElMessage.warning(t('processCard.checkProductionScheduling'))
               return;
             }
-            const type = await VXETable.modal.confirm('鎮ㄧ‘瀹氳鍒犻櫎璇ユ暟鎹�?')
+
+            const type = await VXETable.modal.confirm(t('processCard.deleteThisData'))
             if (type === 'confirm') {
               let schedulingData = ref({
                 scheduling: selectRecords,
@@ -485,7 +497,7 @@
 
               request.post("/productionScheduling/deleteScheduling", schedulingData.value).then((res) => {
                 if (res.code == 200) {
-                  ElMessage.success("鍒犻櫎鎴愬姛")
+                  ElMessage.success(t('basicData.msg.deleteSuccess'))
                   location.reload();
                 } else {
                   ElMessage.warning(res.msg)
@@ -499,9 +511,13 @@
         case 'review': {
           const $table = xGrid.value
           const selectRecords = $table.getCheckboxRecords()
+          let date = form.date1
+          let selectProcesses = processVal.value
+          let selectState = stateValue.value
+          let inputVal = form.orderId
           if ($table) {
             if (selectRecords.length == 0) {
-              ElMessage.warning("璇峰嬀閫夋帓浜ф暟鎹�")
+              ElMessage.warning(t('processCard.checkProductionScheduling'))
               return;
             }
             let schedulingData = ref({
@@ -510,7 +526,35 @@
             })
             request.post("/productionScheduling/examineScheduling", schedulingData.value).then((res) => {
               if (res.code == 200) {
-                ElMessage.success("瀹℃牳鎴愬姛")
+                ElMessage.success(t('basicData.msg.ReviewSuccess'))
+                router.push({
+                  path: '/main/processCard/ProductionScheduling',
+                  query: {random: Math.random()}
+                })
+              } else {
+                ElMessage.warning(res.msg)
+
+              }
+            })
+
+          }
+          return;
+        }
+        case 'cancelReview': {
+          const $table = xGrid.value
+          const selectRecords = $table.getCheckboxRecords()
+          if ($table) {
+            if (selectRecords.length == 0) {
+              ElMessage.warning(t('processCard.checkProductionScheduling'))
+              return;
+            }
+            let schedulingData = ref({
+              scheduling: selectRecords,
+              userName: username//瀹℃牳浜�
+            })
+            request.post("/productionScheduling/cancelReviewScheduling", schedulingData.value).then((res) => {
+              if (res.code == 200) {
+                ElMessage.success(t('basicData.msg.cancelReviewSuccess'))
                 location.reload();
               } else {
                 ElMessage.warning(res.msg)
@@ -583,17 +627,26 @@
   const table = $grid.getTableData().fullData
   const selectRecords = $grid.getCheckboxRecords()
   let selectState = stateValue.value
-  table.forEach((selectRecords) => {
-    if (selectRecords.scheduling_quantity > selectRecords.pendingProductionQuantity && selectState == 1) {
-      ElMessage.warning("鎺掍骇鏁伴噺涓嶈兘澶т簬寰呮帓浜ф暟閲�")
+  selectRecords.forEach((selectRecords) => {
+    if (selectRecords.schedulingQuantity > selectRecords.pendingProductionQuantity) {
+      ElMessage.warning(ElMessage.warning(t('processCard.schedulingQuantityNoQuantityScheduled')))
       //绂佺敤淇濆瓨鎸夐挳
       //gridOptions.toolbarConfig.buttons[2].disabled = true
     }
-
-
   })
 }
+const checkBoxConfig = {
+  checkMethod: ({ row }) => {
+    if (row['reviewStatus']==="宸插鏍�"){
+      return row.disable
+    }else{
+      return !row.disable
+    }
 
+  },
+  reserve:true
+
+}
 
 </script>
 
@@ -602,11 +655,11 @@
     <div id="selectForm">
       <el-row :gutter="0">
         <el-date-picker
-            v-model="form.date1"
+            v-model="orderInfo.workOrderDate"
             :default-time="defaultTime"
-            end-placeholder="缁撴潫鏃堕棿"
+            :start-placeholder="$t('basicData.startDate')"
+            :end-placeholder="$t('basicData.endDate')"
             format="YYYY/MM/DD"
-            start-placeholder="寮�濮嬫椂闂�"
             type="daterange"
             value-format="YYYY-MM-DD"
 
@@ -623,7 +676,7 @@
           />
         </el-select>
         &nbsp;
-        <el-select v-model="stateValue" class="m-2" placeholder="鏄惁鎺掍骇" style="width: 120px">
+        <el-select v-model="stateValue" class="m-2" :placeholder="$t('processCard.whetherToScheduleProduction')" style="width: 120px">
           <el-option
               v-for="item in stateOptions"
               :key="item.value"
@@ -643,14 +696,14 @@
     <vxe-grid
         ref="xGrid"
         class="mytable-scrollbar"
-        height="500px"
-        max-height="100%"
+        height="95%"
         v-bind="gridOptions"
         v-on="gridEvents"
         @filter-change="filterChanged"
-        @checkbox-change="determineNum"
+
+
     >
-      <!--      @toolbar-button-click="toolbarButtonClickEvent"-->
+      <!--      :checkbox-config="checkBoxConfig"  @checkbox-change="determineNum"-->
       <!--      涓嬫媺鏄剧ず鎵�鏈変俊鎭彃妲�-->
       <template #content="{ row }">
         <ul class="expand-wrapper">
@@ -665,7 +718,9 @@
       <template #num1_filter="{ column, $panel }">
         <div>
           <div v-for="(option, index) in column.filters" :key="index">
-            <input v-model="option.data" type="type" @input="changeFilterEvent($event, option, $panel)"/>
+            <input v-model="option.data" type="type"
+                   @keyup.enter.native="$panel.confirmFilter()"
+                   @input="changeFilterEvent($event, option, $panel)"/>
           </div>
         </div>
       </template>

--
Gitblit v1.8.0