From 6146ab970705d0233a12b9fe475f9756e3271aa1 Mon Sep 17 00:00:00 2001
From: 廖井涛 <2265517004@qq.com>
Date: 星期三, 02 四月 2025 08:43:16 +0800
Subject: [PATCH] Merge branch 'master' of http://bore.pub:10439/r/ERP_override

---
 north-glass-erp/northglass-erp/src/views/pp/reportingWorks/AddReportingWork.vue |  132 +++++++++++++++++++++++++++++++-------------
 1 files changed, 93 insertions(+), 39 deletions(-)

diff --git a/north-glass-erp/northglass-erp/src/views/pp/reportingWorks/AddReportingWork.vue b/north-glass-erp/northglass-erp/src/views/pp/reportingWorks/AddReportingWork.vue
index 0e8da99..7eb9d2e 100644
--- a/north-glass-erp/northglass-erp/src/views/pp/reportingWorks/AddReportingWork.vue
+++ b/north-glass-erp/northglass-erp/src/views/pp/reportingWorks/AddReportingWork.vue
@@ -23,6 +23,8 @@
 const user=userInfo()
 //瀹氫箟琛ㄥご鏁版嵁
 const titleUploadData = ref({
+  //鏄惁鍚堢墖宸ュ簭
+  laminating:'',
   reportingWorkId: null,
   //娴佺▼鍗″彿
   processId: null,
@@ -90,9 +92,19 @@
 
 
 let inputDisabled = ref(false)
-onMounted(() =>{
+onMounted(async () =>{
+  await initTiltle()
   if(route.query.processId !== undefined && route.query.processId!=='' && route.query.processId!=null ){
     titleUploadData.value.processId = route.query.processId
+    //褰撹川妫�瀹℃牳鍚庡姞杞芥槑缁嗕俊鎭�
+    if(route.query.reviewStatus === '1'){
+      if(titleUploadData.value.thisProcess !== undefined
+          && titleUploadData.value.thisProcess!==''
+          && titleUploadData.value.thisProcess!=null){
+        getWork()
+        getQuantity()
+      }
+    }
   }
    //route.query.reportingWorkId = 'BG2403150004'
   //鍒ゆ柇鏄惁浼犲叆鎶ュ伐缂栧彿
@@ -104,7 +116,7 @@
         layer= res.data.layer
 
         //娣诲姞琛ョ墖鐘舵�佸垪
-        let column = {field: 'patchStatusOther', width: 90,title: res.data.title}
+        let column = {field: 'patchStatusOther', width: 90,title: t('reportingWorks.patchCondition')}
         gridOptions.columns.push(column)
 
         const s01Values = [];
@@ -138,8 +150,6 @@
           button.name=t('basicData.review')
           titleUploadData.value.qualityInspector=user.user.userName
         }
-
-
         gridOptions.toolbarConfig.buttons.push(button)
       }
      // getQuantity()
@@ -341,6 +351,13 @@
     },
     {field: 'completed', width: 90, title:t('reportingWorks.completed'),},
     {field: 'onceBroken', width: 90, title: t('reportingWorks.onceBroken'),},
+    {
+      field: 'reviewed_state',
+      title: t('processCard.reviewedState'),
+      filters: [{data: ''}],
+      slots: {filter: 'num1_filter'},
+      filterMethod: filterChanged
+    },
 
   ],
 //琛ㄥ崟楠岃瘉
@@ -356,7 +373,7 @@
           }else if((row.completedQuantity*1+brokenNum*1)>row.quantity*1){
             return new Error((`${row.completedQuantity}+${brokenNum}>${row.quantity}`))
           }else  if(row.quantity_card<row.completedQuantity){
-            return new Error("瀹屽伐鏁颁笉鑳藉ぇ浜庢祦绋嬪崱鏁伴噺")
+            return new Error(t('reportingWorks.pleaseNumber10'))
           }
           const completedNum =
               (row.completedQuantity === undefined || row.completedQuantity===null || row.completedQuantity==='') ? 0 : row.completedQuantity
@@ -415,7 +432,7 @@
     const $grid = xGrid.value
     if ($grid) {
       switch (code) {
-        case 'saveReportingWork':  {
+        case 'saveReportingWork':  {//淇濆瓨
           const errMap = await $grid.validate(true)
           if (errMap) {
             ElMessage.error(t('basicData.msg.checkoutLose'))
@@ -433,7 +450,7 @@
           saveReportingWork(1,'save')
           break
         }
-        case 'update':  {
+        case 'update':  {//淇敼
           //鏍规嵁琛ョ墖鐘舵�佸垽鏂槸鍚﹁兘淇敼
           // request.post(`/reportingWork/getPatchCondition/${route.query.reportingWorkId}`).then(async (res) => {
           //   if (res.code == 200) {
@@ -475,7 +492,7 @@
       }
     }
   },
-  menuClick({menu, row, column}) {
+  menuClick({menu, row, column}) {//鍙抽敭鑿滃崟
     const $grid = xGrid.value
     if ($grid) {
       switch (menu.code) {
@@ -781,11 +798,11 @@
   })
   const maxQuantity =  Math.max(...equalByOrderNum.map(item =>item.breakageQuantity || 0))
   let process = titleUploadData.value.thisProcess
+  let laminating = titleUploadData.value.laminating
   equalByOrderNum.forEach((row) =>{
-    if (process=='澶硅兌' || process=='涓┖' || process=='鍖呰' ||process=='鎵撹兌鍜岀矘妗�'){
+    if (laminating == 'laminating'){
       row.completedQuantity= brokenRow.value.quantity*1-maxQuantity
     }
-
   })
 
 
@@ -797,23 +814,26 @@
 
 //绗竴娆″姞杞芥暟鎹�
 let groupChangeProcess = ref(false)//鐢ㄤ簬鏈彮缁勬樉绀洪棶棰�
-request.post(`/reportingWork/selectProcess/${user.user.userId}`).then((res) => {
-  if (res.code == 200) {
-    titleSelectJson.value.processType = res.data.process
-    if(user.user.address!==null && user.user.address!==''){
-      titleUploadData.value.thisProcess = user.user.address
-      titleUploadData.value.teamsGroupsName = user.user.userName
-      groupChangeProcess.value = true
-      if (user.user.address==='鎶�鏈儴澶氭洸' || user.user.address==='澶硅兌'){
-        groupChangeProcess.value = false
+const initTiltle = async () => {
+  await request.post(`/reportingWork/selectProcess/${user.user.userId}`).then((res) => {
+    if (res.code == 200) {
+      titleSelectJson.value.processType = res.data.process
+      if(user.user.address!==null && user.user.address!==''){
+        titleUploadData.value.thisProcess = user.user.address
+        titleUploadData.value.teamsGroupsName = user.user.userName
+        groupChangeProcess.value = true
+        if (user.user.address==='鎶�鏈儴澶氭洸' || user.user.address==='澶硅兌'){
+          groupChangeProcess.value = false
+        }
+        gridOptions.toolbarConfig.buttons[1].visible=false
       }
-      gridOptions.toolbarConfig.buttons[1].visible=false
-    }
 
-  } else {
-    ElMessage.warning(res.msg)
-  }
-})
+    } else {
+      ElMessage.warning(res.msg)
+    }
+  })
+}
+
 
 function checkSameNumForId(data, targetId) {
   // 鍒濆鍖栦竴涓璞℃潵瀛樺偍閬囧埌鐨刬d鍙婂叾瀵瑰簲鐨刵um鍊�
@@ -874,6 +894,7 @@
     return item.saveFlag === 0
   })
   let process = titleUploadData.value.thisProcess
+  //鏆傛椂鍙栨秷
   for(let item of uniqueByOrderNum){
     if(!checkSameNumForId(notFinishList,item.order_number ) && (process=='澶硅兌' || process=='涓┖' || process=='鍖呰' ||process=='鎵撹兌鍜岀矘妗�')){
       ElMessage.error(`${t('reportingWorks.pleaseCheckTheOrderNumber1')}':'
@@ -945,13 +966,15 @@
     reviewState = 'review'
   }
   request.post(`/reportingWork/updateReportingWork/${reviewState}`,requestData).then(res =>{
-    if (res.code == 200){
+    if (res.code == 200 && res.data===true){
       ElMessage.success(t('reportingWorks.successfulModificationOfWorkApplication'))
       router.push({path:'/main/reportingWorks/AddReportingWork',
         query:{
           processId:titleUploadData.value.processId,
           random:Math.random()}
       })
+    } else {
+      ElMessage.warning(t('reportingWorks.changeFailed'))
     }
   })
 }
@@ -1030,6 +1053,7 @@
       router.push({path:'/main/reportingWorks/AddReportingWork',
         query:{
           processId:titleUploadData.value.processId,
+          reviewStatus:1,
           random:Math.random()
         }
       })
@@ -1095,6 +1119,7 @@
       titleUploadData.value = res.data.data
       titleUploadData.value.processId = processId
       titleUploadData.value.teamsGroupsName = user.user.userName
+      titleUploadData.value.laminating = res.data.laminating
       //璁惧涓嬫媺妗�
       titleSelectJson.value.deviceType = res.data.device
       //鐝粍涓嬫媺妗�
@@ -1149,7 +1174,20 @@
 
       //缁戝畾涓嬫柟琛ㄦ牸
       detail.value = res.data.Detail
-      xGrid.value.reloadData(detail.value)
+      // 浣跨敤map鏂规硶鏉ュ鐞嗘瘡涓璞�
+      let modifiedCollection = detail.value.map(item => {
+        if (item.reviewed_state === 1) {
+          return { ...item, reviewed_state: "宸插鏍�" };
+        }
+        else if (item.reviewed_state === 0) {
+          return { ...item, reviewed_state: "鏈鏍�" };
+        }
+        else {
+          // 鍏朵粬鎯呭喌淇濇寔涓嶅彉
+          return item;
+        }
+      });
+      xGrid.value.reloadData(modifiedCollection)
     } else {
       ElMessage.warning(res.msg)
     }
@@ -1202,9 +1240,10 @@
 
 const editClosedEvent = ({ row, column }) => {
   let process = titleUploadData.value.thisProcess
+  let laminating = titleUploadData.value.laminating
   if (column.property==='completedQuantity') {
     xGrid.value.getTableData().fullData.forEach((item, index) =>{
-      if(item.order_number===row.order_number && (process=='澶硅兌' || process=='涓┖' || process=='鍖呰' ||process=='鎵撹兌鍜岀矘妗�')){
+      if(item.order_number===row.order_number && laminating == 'laminating'){
         item.completedQuantity=row.completedQuantity
       }
     })
@@ -1214,12 +1253,15 @@
 const  getQuantity = () => {
   titleUploadData.value.thisCompletedQuantity = 0
   titleUploadData.value.thisWornQuantity = 0
+  let laminating = titleUploadData.value.laminating
   const arr = xGrid.value.getTableData().fullData
-  const returnArr =  arr.filter((obj, index, self) =>
-      self.findIndex((t) => t.order_number === obj.order_number) === index
-  )
-
-
+  //鏍规嵁鏄惁鍚堢墖宸ュ簭杩囨护
+  const returnArr =
+      laminating === "laminating"
+          ? arr.filter((obj, index, self) =>
+              self.findIndex((t) => t.order_number === obj.order_number) === index
+          )
+          : arr;
   let sumBreak = 0
   let sumQuantity = 0
   returnArr.forEach((item)=>{
@@ -1317,8 +1359,8 @@
 </script>
 
 <template>
-  <div style="height: 100%;width: 100%">
-    <div id="head" style="height: 5%;width: 100%;margin-bottom: 5px">
+  <div  style="width: 100%;height: 100%">
+    <div class="head">
       <el-input :disabled="inputDisabled" v-if="titleUploadData.reportingWorkId" v-model="titleUploadData.reportingWorkId" :placeholder="$t('reportingWorks.reportingWorkId')" style="width: 200px" />
       <el-input :disabled="inputDisabled" v-model="titleUploadData.processId" :placeholder="$t('processCard.processId')" style="width: 200px" @keyup.enter.native="getWork();getQuantity()"/>
       &nbsp;
@@ -1342,7 +1384,7 @@
       &nbsp;
       <label>{{technologicalProcess}}</label>
     </div>
-    <div style="background-color: white;margin-bottom: 5px;height: 17%;width: 100%">
+    <div class="head1">
       <el-row>
         <el-col :span="2">
           <el-text>{{$t('order.orderId')}}锛�</el-text>
@@ -1478,12 +1520,11 @@
 
       </el-row>
     </div>
-    <div class="main-div-customer" style="width: 100%;height: 70%">
+    <div class="main-table">
       <vxe-grid
           ref="xGrid"
           class="mytable-scrollbar"
           :row-class-name="changeRowClass"
-          max-height="100%"
           height="100%"
           size="small"
           v-bind="gridOptions"
@@ -1507,6 +1548,7 @@
 
 
       </vxe-grid>
+    </div>
       <el-dialog
           @opened="openedBrokenTable"
           :before-close="checkClose"
@@ -1610,12 +1652,24 @@
 
         </vxe-grid>
       </el-dialog>
-    </div>
   </div>
 </template>
 
 <style scoped>
+.head{
+  width: 100%;
+  height: 35px;
+}
+.head1{
+  width: 100%;
+  height: 105px;
+  background-color: white;
+}
 
+.main-table{
+  width: 100%;
+  height: calc(100% - 135px);
+}
 
 .processCard {
   width: 140px;

--
Gitblit v1.8.0