From 540f0fe70b23ddad3ad87cff2be0a29b2eb7115f Mon Sep 17 00:00:00 2001
From: 王震 <10952869+daywangzhen@user.noreply.gitee.com>
Date: 星期一, 20 十一月 2023 09:48:00 +0800
Subject: [PATCH] Merge branch 'master' of http://114.132.189.42:9002/r/mes-ocea-before

---
 src/views/product/workbench/operation-task-pane.vue      |  266 ++++++++++++++++++++++++-------------------
 src/views/product/workbench/batchproductout-form-new.vue |   46 ++++++-
 src/api/product/personboard.js                           |    8 +
 3 files changed, 195 insertions(+), 125 deletions(-)

diff --git a/src/api/product/personboard.js b/src/api/product/personboard.js
index d8c1f37..f20b0c6 100644
--- a/src/api/product/personboard.js
+++ b/src/api/product/personboard.js
@@ -260,6 +260,14 @@
   })
 }
 
+export function submitProductMain(obj) {
+  return request({
+    url: '/mes/product/submitProductMain',
+    method: 'post',
+    data: obj
+  })
+}
+
 export function batchSaveProductOutput(obj) {
   return request({
     url: '/mes/product/batchSaveProductOutput',
diff --git a/src/views/product/workbench/batchproductout-form-new.vue b/src/views/product/workbench/batchproductout-form-new.vue
index 66bd976..56aeb54 100644
--- a/src/views/product/workbench/batchproductout-form-new.vue
+++ b/src/views/product/workbench/batchproductout-form-new.vue
@@ -12,7 +12,7 @@
     title="姹囨姤浜у嚭"
     :visible.sync="innerVisible"
     append-to-body
-    @close="$emit('update:currshowlist', false)"
+    @close="handleClose"
     :show="currshowlist"
     :close-on-click-modal="false"
     class="batch-product-out-form"
@@ -359,6 +359,7 @@
   data() {
     return {
       innerVisible: false,
+      staffNameList: [],
       personSelection: [],
       saveDisabled: false,
       currDutyInitproducts: [], // 鐢ㄤ簬缂撳瓨椤甸潰涓師鏈夌殑staff浜у嚭璁板綍锛屽苟涓旀槸灞炰簬褰撳墠鐝涓嬬殑锛岀敤浜庡嬀閫変汉鍛樻椂浣滀负鍘熸暟鎹弬鐓�
@@ -374,6 +375,35 @@
     }
   },
   methods: {
+    initProductList(){
+      let val = this.personSelection
+      //鎸変汉鍛樻姤宸�
+      if(this.groupStatus){
+        this.products = []
+        this.addProductOutForPerson()
+      }else{
+        //鎸夌粍鎶ュ伐
+        let nameList = []
+        val.forEach(obj=>{
+          nameList.push(obj.staffName)
+        })
+        let staffName = Array.from(new Set(nameList)).join(",")
+        if(staffName!=''){
+          this.products = this.productList
+          this.products.forEach(item=>{
+            item.staffName = staffName
+          })
+        }else{
+          this.products = []
+        }
+      }
+    },
+    handleClose(){
+      this.$emit('update:currshowlist', false)
+      this.$nextTick(()=>{
+        this.$refs.productOutPersonList.clearSelection()
+      })
+    },
     isNumber(value) {
       var reg = /^[0-9]+(.[0-9]{1,4})?$/
       if (
@@ -419,6 +449,9 @@
       // 鍐嶅幓涓巔roducts(姝や负椤甸潰鐨勫疄鏃舵暟鎹紝鐢ㄦ埛鏈夋敼鍔ㄥ嵆鏇存柊)瀵规瘮锛屽皢鍏朵腑瀛樺湪鐨勭浉鍚屼汉鍛樼殑鐢熶骇鏁伴噺鍜岀敓浜ф壒娆″悓姝ヨ繃鏉ワ紝鑻roducts涓敓浜ф暟閲忔垨鐢熶骇鎵规涓嶅瓨鍦ㄥ�硷紝鍒欎笉杩涜鍚屾锛屾部鐢ㄥ師鏉ョ殑銆�
       // 鏈�鍚庯紝灏嗙粍瑁呭ソ鐨勯�変腑浜哄憳淇℃伅锛屾洿鏂板埌products(鎸夌収鐝杩涜)锛屾敞鎰忔洿鏂颁箣鍚庨�変腑浜哄憳淇℃伅鍦╬roducts浣嶇疆椤哄簭
       this.personSelection = val
+      if(this.currshowlist){
+        this.initProductList()
+      }
     },
     // 鏍规嵁閫変腑鐨勪汉鍛橈紝鐢熸垚浜哄憳浜у嚭淇℃伅锛屽苟涓旀斁鍦ㄥ彸杈瑰垪琛ㄧ殑鏈�鍓嶉潰
     addProductOutForPerson() {
@@ -502,20 +535,21 @@
 		saveProductOuts2() {
 			this.clickDateArr.push(new Date().getTime())
 			var productOutputList = []
-			this.productList.forEach(a=>{
+			this.products.forEach(a=>{
 				productOutputList.push({
 					partId: a.partId,
 					productQty: a.outNum,
 					outBatchNo: a.outBatchNo,
 					scrapQty: a.scrapQty,
 					remark: a.remark,
-          wdr: a.wdr,
+				  wdr: a.wdr,
 					staffNo: a.staffNo,
 					staffName: a.staffName,
 					status: a.status,
 					dutyRecordId: a.dutyRecordId,
 					productStaffIds: a.productStaffIds,
-					productStaffs: a.productStaffs
+					productStaffs: a.productStaffs,
+					sortNo: a.sortNo
 				})
 			})
 			var productMains = {
@@ -1055,14 +1089,14 @@
             this.products.push(this.productList[i])
           }
           this.$nextTick(() => {
-            this.$refs.productOutPersonList.clearSelection()
+            this.$refs.productOutPersonList.toggleAllSelection()
           })
         } else {
           for (let i = 0; i < this.productList.length; i++) {
             this.products.push(this.productList[i])
           }
           this.$nextTick(() => {
-            this.$refs.productOutPersonList.clearSelection()
+            this.$refs.productOutPersonList.toggleAllSelection()
           })
         }
       }
diff --git a/src/views/product/workbench/operation-task-pane.vue b/src/views/product/workbench/operation-task-pane.vue
index e0a5772..d559810 100644
--- a/src/views/product/workbench/operation-task-pane.vue
+++ b/src/views/product/workbench/operation-task-pane.vue
@@ -1,6 +1,6 @@
 <template>
   <div>
-    <el-alert 
+    <el-alert
       v-if="!operationTasks || operationTasks.length == 0"
       title="杩樻病鏈夊伐鍗曚笅鍙戝埌姝ゆ満鍙帮紒"
       type="warning"
@@ -9,76 +9,79 @@
     </el-alert>
     <el-card
   v-for="(item, index) in operationTasks"
-    @click.native="setCheckFlag(item)"
+  @click.native="setCheckFlag(item)"
   shadow="hover"
   :key="index"
   :class="['task-item', item.checkFlag ? 'card-checked' : 'card-unchecked']"
-  :style="{ backgroundColor: getBackgroundColor(item.planFinishDay) }"
->
-  <!-- <img class="selectedImg" /> -->
-  <div class="header" >
-    <div>宸ュ崟鍙凤細{{ item.taskNo }}</div>
-    <!-- <div>璁″垝鍙凤細{{ item.mpsNo }}</div> -->
-    <div  
-      :class="[
-        'status-change-div',
-        item.checkFlag ? 'card-checked-status' : 'card-status'
-      ]"
-    >
-      <el-select
-        v-if="permissions.product_operationTask_state"
-        v-model="item.statusAction"
-        placeholder="鍔熻兘鑿滃崟"
-        @change="
-          changeTaskState(item.statusAction, item.status, item.id, item)
-        "
-      >
-        <el-option
-          v-for="ele in statusActions"
-          :key="ele.value"
-          :label="ele.label"
-          :value="ele.value"
-          :disabled="ele.disabled"
-        >
-        </el-option>
-      </el-select>
-    </div>
-  </div>
-  <div class="body">
-    <div class="row">
-      <div class="l">闆朵欢鍚嶇О锛�</div>
-      <div class="r">{{ item.partName }}</div>
-    </div>
-    <div class="row">
-      <div class="l">闆朵欢鍙凤細</div>
-      <div class="r">{{ item.partNo }}</div>
-    </div>
-    <!-- <div class="row">
-      <div class="l">鎴愬搧锛�</div>
-      <div class="r">{{ item.productName }}</div>
-    </div> -->
-    <div class="row">
-      <div class="l">璁″垝瀹屾垚鏃堕棿锛�</div>
-      <div class="r">{{ item.planFinishDay }}</div>
-    </div>
-  </div>
 
-  <el-progress
-    class="task-progress"
-    :text-inside="true"
-    :stroke-width="20"
-    :percentage="
-      Number((item.completedQuantity / item.plannedQuantity).toFixed(2)) *
-        100 >
-      100
-        ? 100
-        : Number(
-            (item.completedQuantity / item.plannedQuantity).toFixed(2)
-          ) * 100
-    "
-    :format="formatPercentage(item.completedQuantity, item.plannedQuantity)"
-  ></el-progress>
-</el-card>
+>
+      <img class="selectedImg" src="/img/workbench/icon_selected.png" />
+      <div class="header">
+        <div>宸ュ崟鍙凤細{{ item.taskNo }}</div>
+        <div class="tag" :style="{ backgroundColor: getTagColor(item.planFinishDay) }">
+    {{ getTagText(item.planFinishDay) }}
+        </div>
+        <!-- <div>璁″垝鍙凤細{{ item.mpsNo }}</div> -->
+        <div
+          :class="[
+            'status-change-div',
+            item.checkFlag ? 'card-checked-status' : 'card-status'
+          ]"
+        >
+          <el-select
+            v-if="permissions.product_operationTask_state"
+            v-model="item.statusAction"
+            placeholder="鍔熻兘鑿滃崟"
+            @change="
+              changeTaskState(item.statusAction, item.status, item.id, item)
+            "
+          >
+            <el-option
+              v-for="ele in statusActions"
+              :key="ele.value"
+              :label="ele.label"
+              :value="ele.value"
+              :disabled="ele.disabled"
+            >
+            </el-option>
+          </el-select>
+        </div>
+      </div>
+      <div class="body">
+        <div class="row">
+          <div class="l">闆朵欢鍚嶇О锛�</div>
+          <div class="r">{{ item.partName }}</div>
+        </div>
+        <div class="row">
+          <div class="l">闆朵欢鍙凤細</div>
+          <div class="r">{{ item.partNo }}</div>
+        </div>
+        <!-- <div class="row">
+          <div class="l">鎴愬搧锛�</div>
+          <div class="r">{{ item.productName }}</div>
+        </div> -->
+        <div class="row">
+          <div class="l">璁″垝瀹屾垚鏃堕棿锛�</div>
+          <div class="r">{{ item.planFinishDay }}</div>
+        </div>
+      </div>
+
+      <el-progress
+        class="task-progress"
+        :text-inside="true"
+        :stroke-width="20"
+        :percentage="
+          Number((item.completedQuantity / item.plannedQuantity).toFixed(2)) *
+            100 >
+          100
+            ? 100
+            : Number(
+                (item.completedQuantity / item.plannedQuantity).toFixed(2)
+              ) * 100
+        "
+        :format="formatPercentage(item.completedQuantity, item.plannedQuantity)"
+      ></el-progress>
+    </el-card>
   </div>
 </template>
 <style lang="scss" scoped>
@@ -92,42 +95,52 @@
   flex-direction: column;
   align-items: center;
 }
+
+.tag{
+width: 80px;
+height: 30px;
+border-radius:15% ;
+text-align: center;
+text-size:8px;
+color:white;
+align-content: 30px;
+
+}
+
+
 .task-item {
   width: 100%;
   border-radius: 12px;
   cursor: pointer;
   position: relative;
-background:none;
   box-shadow: 1px 2px 24px 1px rgba(4, 0, 0, 0.14);
-   
   & + .task-item {
     margin-top: 10px;
   }
-  
   &.card-checked {
     // color: white;
-    // background-image: -webkit-linear-gradient(
-    //     90deg,
-    //     rgba(12, 149, 255, 0.7) 0%,
-    //     rgba(38, 176, 254, 0.8) 34%,
-    //     rgba(12, 149, 255, 0.8) 100%
-    //   ),
-    //   -webkit-linear-gradient(#5a97fa, #5a97fa);
-    // background-image: -moz-linear-gradient(
-    //     90deg,
-    //     rgba(12, 149, 255, 0.7) 0%,
-    //     rgba(38, 176, 254, 0.8) 34%,
-    //     rgba(12, 149, 255, 0.8) 100%
-    //   ),
-    //   -moz-linear-gradient(#5a97fa, #5a97fa);
-    // background-image: linear-gradient(
-    //     90deg,
-    //     rgba(12, 149, 255, 0.7) 0%,
-    //     rgba(38, 176, 254, 0.8) 34%,
-    //     rgba(12, 149, 255, 0.8) 100%
-    //   ),
-    //   linear-gradient(#5a97fa, #5a97fa);
-    // background-blend-mode: normal, normal;
+    background-image: -webkit-linear-gradient(
+        90deg,
+        rgba(12, 149, 255, 0.7) 0%,
+        rgba(38, 176, 254, 0.8) 34%,
+        rgba(12, 149, 255, 0.8) 100%
+      ),
+      -webkit-linear-gradient(#5a97fa, #5a97fa);
+    background-image: -moz-linear-gradient(
+        90deg,
+        rgba(12, 149, 255, 0.7) 0%,
+        rgba(38, 176, 254, 0.8) 34%,
+        rgba(12, 149, 255, 0.8) 100%
+      ),
+      -moz-linear-gradient(#5a97fa, #5a97fa);
+    background-image: linear-gradient(
+        90deg,
+        rgba(12, 149, 255, 0.7) 0%,
+        rgba(38, 176, 254, 0.8) 34%,
+        rgba(12, 149, 255, 0.8) 100%
+      ),
+      linear-gradient(#5a97fa, #5a97fa);
+    background-blend-mode: normal, normal;
   }
   .selectedImg {
     position: absolute;
@@ -349,38 +362,53 @@
   },
   methods: {
 
-    setCheckFlag(item) {
-      this.$nextTick(() => {
-        this.changeBackgroundColor(item.planFinishDay);
-      });
-    },
-    getBackgroundColor(planFinishDay) {
-    const currentDate = new Date();
-    currentDate.setHours(0, 0, 0, 0); // 璁剧疆鏃堕棿涓哄綋澶╃殑寮�濮嬶紝蹇界暐鏃跺垎绉掓绉�
-    const planFinishDayObj = new Date(planFinishDay);
-    planFinishDayObj.setHours(0, 0, 0, 0); // 鍚屾牱璁剧疆鏃堕棿涓鸿鍒掑畬鎴愭棩鐨勫紑濮�
+//     getBackgroundColor(planFinishDay) {
+//   const today = new Date();
+//   const planDate = new Date(planFinishDay);
+//   if (planDate < today) {
+//     return 'rgba( 255,0,0,1)'; // 瓒呮湡涓虹孩鑹�
+//   } else {
+//     const timeDiff = planDate.getTime() - today.getTime();
+//     const daysDiff = Math.ceil(timeDiff / (1000 * 3600 * 24));
+//     if (daysDiff <= 3) {
+//       return 'rgba(255,204,62, 1)';  // 涓存湡涓洪粍鑹� 
+//     } else {
+//       return 'rgba(86,219, 25,1)';  // 姝e父涓虹豢鑹�
+//     }
+//   }
+// },
 
-    if (planFinishDayObj < currentDate) {
-        // 濡傛灉璁″垝瀹屾垚鏃ュ湪褰撳墠鏃ヤ箣鍓嶏紝杩斿洖'rgba(0, 0, 255, 0.3)'琛ㄧず杩囨湡锛岃繖閲岀殑 0.3 鎺у埗浜嗛�忔槑搴�
-        return 'rgba(255, 0, 0, 0.5)';
+getTagColor(planFinishDay) {
+  const today = new Date();
+  const planDate = new Date(planFinishDay);
+  if (planDate < today) {
+    return 'rgba( 255,0,0,1)'; // 瓒呮湡涓虹孩鑹�
+  } else {
+    const timeDiff = planDate.getTime() - today.getTime();
+    const daysDiff = Math.ceil(timeDiff / (1000 * 3600 * 24));
+    if (daysDiff <= 3) {
+      return 'rgba(255,204,62, 1)';  // 涓存湡涓洪粍鑹� 
     } else {
-        const timeDifference = currentDate - planFinishDayObj;
-        const daysDifference = Math.ceil(timeDifference / (1000 * 60 * 60 * 24));
-
-        if (daysDifference < 0) {
-            // 濡傛灉璁″垝瀹屾垚鏃ュ湪鏈潵锛岃绠楀畠鏄惁鍦�10澶╁唴
-            const daysUntilDue = Math.abs(daysDifference);
-            if (daysUntilDue <= 10) {
-                // 濡傛灉鍦�10澶╁唴锛岃繑鍥�'rgba(255, 255, 0, 0.3)'琛ㄧず鍗冲皢鍒版湡锛岃繖閲岀殑 0.3 鎺у埗浜嗛�忔槑搴�
-                return 'rgba(219, 219, 54, 0.7)';
-            }
-            return 'rgba(28, 62, 222, 0.8)';
-        }
+      return 'rgba(86,219, 25,1)';  // 姝e父涓虹豢鑹�
     }
-    // 濡傛灉涓嶆槸鍗冲皢鍒版湡鎴栧凡杩囨湡锛岃繑鍥�'rgba(255, 0, 0, 0.3)'琛ㄧず宸插埌鏈燂紝杩欓噷鐨� 0.3 鎺у埗浜嗛�忔槑搴�
-    return 'rgba(255, 0, 0, 0.5)';
+  }
 },
 
+getTagText(planFinishDay) {
+  const today = new Date();
+  const planDate = new Date(planFinishDay);
+  if (planDate < today) {
+    return '瓒呮湡'; 
+  } else {
+    const timeDiff = planDate.getTime() - today.getTime();
+    const daysDiff = Math.ceil(timeDiff / (1000 * 3600 * 24));
+    if (daysDiff <= 3) {
+      return '涓存湡';
+    } else {
+      return '姝e父';
+    }
+  }
+},
     // 鐐瑰嚮宸ュ崟锛岄�変腑宸ュ崟
     setCheckFlag(item) {
       if (item.checkFlag) {

--
Gitblit v1.9.3