From 22f5cee4b4f9a717df573456f3b149be697b17d1 Mon Sep 17 00:00:00 2001
From: zhoushihao <zsh19950802@163.com>
Date: 星期三, 03 七月 2024 08:36:10 +0800
Subject: [PATCH] 下片优化出片逻辑 大理片出片:出片线路调整

---
 UI-Project/src/views/GlassStorage/MaterialRackManagement.vue |  207 +++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 180 insertions(+), 27 deletions(-)

diff --git a/UI-Project/src/views/GlassStorage/MaterialRackManagement.vue b/UI-Project/src/views/GlassStorage/MaterialRackManagement.vue
index b97b5c7..b36c181 100644
--- a/UI-Project/src/views/GlassStorage/MaterialRackManagement.vue
+++ b/UI-Project/src/views/GlassStorage/MaterialRackManagement.vue
@@ -6,8 +6,8 @@
 <!-- 宸︿晶鎸夐挳缁� -->
 <div >
   <el-button type="success" size="mini" @click="handleInbound()">鍏ュ簱</el-button>
-  <el-button type="success" size="mini" @click="handleInbound()">鍚婅浣嶅叆搴�</el-button>
-  <el-button type="success" size="mini" @click="addglass()">娣诲姞鍘熺墖</el-button>
+  <el-button type="success" size="mini" >鍚婅浣嶅叆搴�</el-button>
+ 
 </div>
 
 <!-- 鍙充晶閫夋嫨妗� -->
@@ -47,20 +47,20 @@
   min-width="80"
   prop="shelf_status"
 >
-  <template #default="scope">
-    <el-tag :type="getTagType(scope.row.shelf_status)">
-      {{ scope.row.shelf_status === 1 ? '鍚敤' : '鏈惎鐢�' }}
-    </el-tag>
-  </template>
+<template #default="scope">
+        <el-tag :type="getTagType(scope.row.shelf_status)" @click="toggleStatus(scope.row)">
+          {{ scope.row.shelf_status === 1 ? '鍚敤' : '鏈惎鐢�' }}
+        </el-tag>
+      </template>
 </el-table-column>
 
         <!-- 鎿嶄綔鍒� -->
-        <el-table-column label="鎿嶄綔" width="300">
+        <el-table-column label="鎿嶄綔" width="350">
           <template #default="{ row }">
-            <el-button type="primary" size="mini" @click="handleEdit(row)">淇敼</el-button>
+            <el-button type="primary" size="mini" @click="edithandleRowClick(row)">淇敼</el-button>
             <el-button type="danger" size="mini" @click="handleDelete(row)">鍒犻櫎</el-button>
             <el-button type="warning" size="mini" @click="handleCheckout(row)">鍑哄簱</el-button>
-           
+            <el-button type="success" size="mini" @click="addglass()">娣诲姞鍘熺墖</el-button>
           </template>
         </el-table-column>
       </el-table>
@@ -104,7 +104,7 @@
     <el-table-column label="鎿嶄綔" width="350">
       <template #default="{ row }">
         <el-button type="primary" size="mini" @click="handleRestart(row)">閲嶆柊寮�濮�</el-button>
-        <el-button type="danger" size="mini" @click="handleDelete(row)">鍒犻櫎浠诲姟</el-button>
+        <el-button type="danger" size="mini" @click="handleDeletetask(row)">鍒犻櫎浠诲姟</el-button>
         <el-button type="success" size="mini" @click="handleComplete(row)">浠诲姟瀹屾垚</el-button>
       </template>
     </el-table-column>
@@ -197,7 +197,21 @@
     </span>
   </el-dialog>
 
+  <el-dialog title="缂栬緫" v-model="editdialogVisible" width="30%" @close="edithandleDialogClose">
+      <el-form :model="editForm" ref="editFormRef" label-width="80px">
+        <el-form-item label="鏁伴噺">
+          <el-input v-model="editForm.quantity"></el-input>
+        </el-form-item>
+        <el-form-item label="鎵规鍙�">
+          <el-input v-model="editForm.batchnumber"></el-input>
+        </el-form-item>
+      </el-form>
 
+      <div  class="dialog-footer">
+        <el-button @click="editdialogVisible = false">鍙栨秷</el-button>
+        <el-button type="primary" @click="editsaveEdit">淇濆瓨</el-button>
+      </div>
+    </el-dialog>
 
 
     <!-- <div ref="chart" id="chart" style="width: 100%; height: 400px;"></div> -->
@@ -210,6 +224,7 @@
 <script setup>
 import { ref, onMounted, onBeforeUnmount } from 'vue'; // 瀵煎叆 Vue 3 鐨勬ā鍧�
 import * as echarts from 'echarts';
+import { ElMessage, ElMessageBox } from 'element-plus'
 
 
     const loading = ref(false);
@@ -221,7 +236,7 @@
         height: '50',
         thickness: '10',
         quantity: '5',
-        entry_time: '2024-06-19',
+        entry_time: '2024-06-19 10:00:00',
         batchnumber:"444",
         shelf_status: 1
       },
@@ -232,7 +247,7 @@
         height: '60',
         thickness: '12',
         quantity: '10',
-        entry_time: '2024-06-18',
+        entry_time: '2024-06-19 10:00:00',
         batchnumber:"444",
         shelf_status: 0
       },
@@ -243,7 +258,7 @@
         height: '60',
         thickness: '12',
         quantity: '10',
-        entry_time: '2024-06-18',
+        entry_time: '2024-06-19 10:00:00',
         batchnumber:"444",
         shelf_status: 1
       },
@@ -254,7 +269,7 @@
         height: '60',
         thickness: '12',
         quantity: '10',
-        entry_time: '2024-06-18',
+        entry_time: '2024-06-19 10:00:00',
         batchnumber:"444",
         shelf_status: 1
       },
@@ -265,7 +280,7 @@
         height: '60',
         thickness: '12',
         quantity: '10',
-        entry_time: '2024-06-18',
+        entry_time: '2024-06-19 10:00:00',
         batchnumber:"444",
         shelf_status: 1
       }
@@ -291,6 +306,12 @@
       return status === 1 ? 'success' : 'danger';
       // 鏍规嵁鐘舵�佸�煎喅瀹氭爣绛剧被鍨嬶紝杩欓噷鍋囪鐘舵�佷负1鏃朵负鎴愬姛锛堢豢鑹诧級锛屽惁鍒欎负澶辫触锛堢孩鑹诧級
     }
+
+    const toggleStatus = (row) => {
+      // 鍒囨崲鏂欐灦鐘舵�佺殑閫昏緫
+      row.shelf_status = 1 - row.shelf_status; // Toggle between 0 and 1
+      // 姝ゅ鍙互娣诲姞淇濆瓨鐘舵�佺殑閫昏緫锛屾瘮濡傝皟鐢� API 鏇存柊鏁版嵁
+    };
 
    const tasktableData=ref([
 
@@ -327,20 +348,38 @@
      
     });
 
-    const handleEdit = (row) => {
-      // 澶勭悊淇敼鏁伴噺閫昏緫
-      console.log('Edit Quantity:', row);
-    };
-
+   
     const handleDelete = (row) => {
-      // 澶勭悊鍒犻櫎閫昏緫
-      console.log('Delete:', row);
-    };
+  // 浣跨敤 Element UI 鐨� MessageBox.confirm 鏂规硶杩涜浜屾纭
+  ElMessageBox.confirm('纭畾瑕佹墽琛屽垹闄ゆ搷浣滃悧锛�', '纭鍒犻櫎', {
+    confirmButtonText: '纭',
+    cancelButtonText: '鍙栨秷',
+    type: 'warning',
+  }).then(() => {
+    // 鐐瑰嚮纭鎸夐挳鐨勫洖璋冿紝鎵ц鍑哄簱鎿嶄綔
+    console.log('鎵ц鍒犻櫎鎿嶄綔', row);
+  }).catch(() => {
+    // 鐐瑰嚮鍙栨秷鎸夐挳鐨勫洖璋冿紝涓嶆墽琛屼换浣曟搷浣�
+    console.log('鍙栨秷鍒犻櫎鎿嶄綔');
+  });
+};
 
+    
     const handleCheckout = (row) => {
-      // 澶勭悊鍑哄簱閫昏緫
-      console.log('Checkout:', row);
-    };
+  // 浣跨敤 Element UI 鐨� MessageBox.confirm 鏂规硶杩涜浜屾纭
+  ElMessageBox.confirm('纭畾瑕佹墽琛屽嚭搴撴搷浣滃悧锛�', '纭鍑哄簱', {
+    confirmButtonText: '纭',
+    cancelButtonText: '鍙栨秷',
+    type: 'warning',
+  }).then(() => {
+    // 鐐瑰嚮纭鎸夐挳鐨勫洖璋冿紝鎵ц鍑哄簱鎿嶄綔
+    console.log('鎵ц鍑哄簱鎿嶄綔', row);
+  }).catch(() => {
+    // 鐐瑰嚮鍙栨秷鎸夐挳鐨勫洖璋冿紝涓嶆墽琛屼换浣曟搷浣�
+    console.log('鍙栨秷鍑哄簱鎿嶄綔');
+  });
+};
+
 
     const handleInbound = () => {
       // 鎵撳紑鍏ュ簱瀵硅瘽妗�
@@ -408,6 +447,120 @@
     
 
 
+
+    const editdialogVisible = ref(false);
+    const editForm = ref({
+      quantity: '',
+      batchnumber: ''
+    });
+    const editFormRef = ref(null);
+    let currentRow = ref(null);
+
+    // 澶勭悊琛岀偣鍑讳簨浠�
+    const edithandleRowClick = (row) => {
+      currentRow.value = row;
+      editForm.value.quantity = row.quantity.toString();
+      editForm.value.batchnumber = row.batchnumber;
+      editdialogVisible.value = true;
+      console.log(editForm.value)
+    };
+
+    // 娣诲姞淇濆瓨缂栬緫鍐呭
+    const editsaveEdit = () => {
+      if (!currentRow.value) return;
+
+      // 鏇存柊褰撳墠琛屾暟鎹�
+      currentRow.value.quantity = parseInt(editForm.value.quantity);
+      currentRow.value.batchnumber = editForm.value.batchnumber;
+
+      // 鍏抽棴瀵硅瘽妗�
+      editdialogVisible.value = false;
+    };
+
+    // 瀵硅瘽妗嗗叧闂椂閲嶇疆缂栬緫琛ㄥ崟鍜屽綋鍓嶈鏁版嵁
+    const edithandleDialogClose = () => {
+      editForm.value.quantity = '';
+      editForm.value.batchnumber = '';
+      currentRow.value = null;
+    };
+
+
+
+
+
+    
+
+
+    const handleRestart = (row) => {
+  // 浣跨敤 Element UI 鐨� MessageBox.confirm 鏂规硶杩涜浜屾纭
+  ElMessageBox.confirm('纭畾瑕佹墽琛岄噸鏂板紑濮嬫搷浣滃悧锛�', '纭閲嶆柊寮�濮�', {
+    confirmButtonText: '纭',
+    cancelButtonText: '鍙栨秷',
+    type: 'warning',
+  }).then(() => {
+    // 鐐瑰嚮纭鎸夐挳鐨勫洖璋�
+    console.log('鎵ц閲嶆柊寮�濮嬫搷浣�', row);
+  }).catch(() => {
+    // 鐐瑰嚮鍙栨秷鎸夐挳鐨勫洖璋冿紝涓嶆墽琛屼换浣曟搷浣�
+    console.log('鍙栨秷閲嶆柊寮�濮嬫搷浣�');
+  });
+};
+
+
+const handleDeletetask = (row) => {
+  // 浣跨敤 Element UI 鐨� MessageBox.confirm 鏂规硶杩涜浜屾纭
+  ElMessageBox.confirm('纭畾瑕佹墽琛屽垹闄や换鍔℃搷浣滃悧锛�', '纭鍒犻櫎浠诲姟', {
+    confirmButtonText: '纭',
+    cancelButtonText: '鍙栨秷',
+    type: 'warning',
+  }).then(() => {
+    // 鐐瑰嚮纭鎸夐挳鐨勫洖璋�
+    console.log('鎵ц鍒犻櫎浠诲姟鎿嶄綔', row);
+  }).catch(() => {
+    // 鐐瑰嚮鍙栨秷鎸夐挳鐨勫洖璋冿紝涓嶆墽琛屼换浣曟搷浣�
+    console.log('鍙栨秷鍒犻櫎浠诲姟鎿嶄綔');
+  });
+};
+
+
+
+const handleComplete = (row) => {
+  // 浣跨敤 Element UI 鐨� MessageBox.confirm 鏂规硶杩涜浜屾纭
+  ElMessageBox.confirm('纭畾瑕佹墽琛屼换鍔″畬鎴愭搷浣滃悧锛�', '纭浠诲姟瀹屾垚', {
+    confirmButtonText: '纭',
+    cancelButtonText: '鍙栨秷',
+    type: 'warning',
+  }).then(() => {
+    // 鐐瑰嚮纭鎸夐挳鐨勫洖璋�
+    console.log('鎵ц浠诲姟瀹屾垚鎿嶄綔', row);
+  }).catch(() => {
+    // 鐐瑰嚮鍙栨秷鎸夐挳鐨勫洖璋冿紝涓嶆墽琛屼换浣曟搷浣�
+    console.log('鍙栨秷浠诲姟瀹屾垚鎿嶄綔');
+  });
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
     let chartInstance = null;
 
 onMounted(() => {

--
Gitblit v1.8.0