From ea6d75ac403b6a08cf995cecd30c69c2ba66b2d9 Mon Sep 17 00:00:00 2001
From: zhoushihao <zsh19950802@163.com>
Date: 星期二, 02 七月 2024 12:51:47 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 UI-Project/src/views/GlassStorage/MaterialRackManagement.vue |  145 ++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 127 insertions(+), 18 deletions(-)

diff --git a/UI-Project/src/views/GlassStorage/MaterialRackManagement.vue b/UI-Project/src/views/GlassStorage/MaterialRackManagement.vue
index 830f6d8..b36c181 100644
--- a/UI-Project/src/views/GlassStorage/MaterialRackManagement.vue
+++ b/UI-Project/src/views/GlassStorage/MaterialRackManagement.vue
@@ -6,7 +6,7 @@
 <!-- 宸︿晶鎸夐挳缁� -->
 <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" >鍚婅浣嶅叆搴�</el-button>
  
 </div>
 
@@ -47,11 +47,11 @@
   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>
 
         <!-- 鎿嶄綔鍒� -->
@@ -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>
@@ -198,7 +198,7 @@
   </el-dialog>
 
   <el-dialog title="缂栬緫" v-model="editdialogVisible" width="30%" @close="edithandleDialogClose">
-      <el-form :model="editForm" ref="editForm" label-width="80px">
+      <el-form :model="editForm" ref="editFormRef" label-width="80px">
         <el-form-item label="鏁伴噺">
           <el-input v-model="editForm.quantity"></el-input>
         </el-form-item>
@@ -207,7 +207,7 @@
         </el-form-item>
       </el-form>
 
-      <div slot="footer" class="dialog-footer">
+      <div  class="dialog-footer">
         <el-button @click="editdialogVisible = false">鍙栨秷</el-button>
         <el-button type="primary" @click="editsaveEdit">淇濆瓨</el-button>
       </div>
@@ -224,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);
@@ -235,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
       },
@@ -246,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
       },
@@ -257,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
       },
@@ -268,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
       },
@@ -279,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
       }
@@ -305,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([
 
@@ -342,12 +349,37 @@
     });
 
    
+    const handleDelete = (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 = () => {
       // 鎵撳紑鍏ュ簱瀵硅瘽妗�
@@ -421,12 +453,13 @@
       quantity: '',
       batchnumber: ''
     });
+    const editFormRef = ref(null);
     let currentRow = ref(null);
 
     // 澶勭悊琛岀偣鍑讳簨浠�
     const edithandleRowClick = (row) => {
       currentRow.value = row;
-      editForm.value.quantity = row.quantity;
+      editForm.value.quantity = row.quantity.toString();
       editForm.value.batchnumber = row.batchnumber;
       editdialogVisible.value = true;
       console.log(editForm.value)
@@ -452,6 +485,82 @@
     };
 
 
+
+
+
+    
+
+
+    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