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 |  145 ++++++++++++++++++++++++++++++------------------
 1 files changed, 90 insertions(+), 55 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 a5ef52f..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 == '') {
@@ -130,6 +136,7 @@
     //绂佺敤鍒犻櫎銆佸鏍告寜閽�
     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
@@ -160,14 +167,16 @@
         //绂佺敤鍒犻櫎銆佸鏍告寜閽�
         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[2].disabled = true
+        gridOptions.toolbarConfig.buttons[3].disabled = true
 
       }
     } else {
@@ -200,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
@@ -319,7 +328,7 @@
 
     // {field: '鎺掍骇缂栧彿', title: '鎺掍骇缂栧彿',  width: 120 },
     {
-      field: 'orderGlassDetail.orderId',
+      field: 'order.orderId',
       title: t('order.orderId'),
       filters: [{data: ''}],
       slots: {filter: 'num1_filter'},
@@ -381,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,
@@ -421,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++) {
@@ -430,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;
             }
 
@@ -450,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({
@@ -475,41 +485,39 @@
           const selectRecords = $table.getCheckboxRecords()
           if ($table) {
             if (selectRecords.length == 0) {
-              ElMessage.warning("璇峰嬀閫夋帓浜ф暟鎹�")
+              ElMessage.warning(t('processCard.checkProductionScheduling'))
               return;
             }
-            selectRecords.forEach(item => {
-              if(item.reviewStatus=="宸插鏍�"){
-                ElMessage.warning("涓嶈兘鍒犻櫎宸插鏍告暟鎹�")
-                return;
-              }
-            });
-            alert(1111)
-            // const type = await VXETable.modal.confirm('鎮ㄧ‘瀹氳鍒犻櫎璇ユ暟鎹�?')
-            // if (type === 'confirm') {
-            //   let schedulingData = ref({
-            //     scheduling: selectRecords,
-            //   })
-            //
-            //   request.post("/productionScheduling/deleteScheduling", schedulingData.value).then((res) => {
-            //     if (res.code == 200) {
-            //       ElMessage.success("鍒犻櫎鎴愬姛")
-            //       location.reload();
-            //     } else {
-            //       ElMessage.warning(res.msg)
-            //
-            //     }
-            //   })
-            // }
+
+            const type = await VXETable.modal.confirm(t('processCard.deleteThisData'))
+            if (type === 'confirm') {
+              let schedulingData = ref({
+                scheduling: selectRecords,
+              })
+
+              request.post("/productionScheduling/deleteScheduling", schedulingData.value).then((res) => {
+                if (res.code == 200) {
+                  ElMessage.success(t('basicData.msg.deleteSuccess'))
+                  location.reload();
+                } else {
+                  ElMessage.warning(res.msg)
+
+                }
+              })
+            }
           }
           return;
         }
         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({
@@ -518,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)
@@ -592,9 +628,8 @@
   const selectRecords = $grid.getCheckboxRecords()
   let selectState = stateValue.value
   selectRecords.forEach((selectRecords) => {
-    console.log(selectRecords)
     if (selectRecords.schedulingQuantity > selectRecords.pendingProductionQuantity) {
-      ElMessage.warning("鎺掍骇鏁伴噺涓嶈兘澶т簬寰呮帓浜ф暟閲�")
+      ElMessage.warning(ElMessage.warning(t('processCard.schedulingQuantityNoQuantityScheduled')))
       //绂佺敤淇濆瓨鎸夐挳
       //gridOptions.toolbarConfig.buttons[2].disabled = true
     }
@@ -602,7 +637,6 @@
 }
 const checkBoxConfig = {
   checkMethod: ({ row }) => {
-    console.log(row)
     if (row['reviewStatus']==="宸插鏍�"){
       return row.disable
     }else{
@@ -621,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"
 
@@ -642,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"
@@ -662,15 +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"
-        :checkbox-config="checkBoxConfig"
+
+
     >
-      <!--      @toolbar-button-click="toolbarButtonClickEvent"-->
+      <!--      :checkbox-config="checkBoxConfig"  @checkbox-change="determineNum"-->
       <!--      涓嬫媺鏄剧ず鎵�鏈変俊鎭彃妲�-->
       <template #content="{ row }">
         <ul class="expand-wrapper">
@@ -685,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