yby 2 ماه پیش
والد
کامیت
00ae75bf47
1فایلهای تغییر یافته به همراه15 افزوده شده و 11 حذف شده
  1. 15 11
      src/views/enterprise/createProject.vue

+ 15 - 11
src/views/enterprise/createProject.vue

@@ -21,7 +21,7 @@
     </div>
     <!-- 对象表详情部分 -->
     <div style="margin-left: 20px;width: 30%;">
-      <div v-if="activeButtonId!== null" class="interface" style="border-radius: 10px; overflow-y: auto; max-height: 300px;">
+      <div v-if="activeButtonId!== null" class="interface" style="border-radius: 10px; overflow-y: auto; max-height: 700px;height: 700px">
         <table style="width: 100%; border-collapse: collapse; table-layout: fixed;">
           <thead>
           <tr>
@@ -86,7 +86,7 @@
       <div style="border: 1px solid #ccc; padding: 25px;border-radius: 10px;">
         <el-button style="display: block; margin-bottom: 10px;" @click="toggleAddButton">添加>></el-button>
         <el-button style="display: block; margin-bottom: 100px;"><<收回</el-button>
-        <el-button style="width: 86.36px"> 保存 </el-button>
+        <el-button style="width: 86.36px" @click="saveAndHideAddButton"> 保存 </el-button>
       </div>
     </div>
     <!-- 待转内容表 -->
@@ -103,7 +103,9 @@
                 <span style="margin-left: 5%;">项目结束日期:</span>
                 <span style="margin-left: 5%;">项目组重复
                   <select style="height: 18px; width: 50px; margin-left: 5px;">
-                    <option></option>
+                    <option value="1">1</option>
+                    <option value="2">2</option>
+                    <option value="3">3</option>
                   </select>
                 </span>
                 <span style="margin-left: 5%; border: 1px #ccc solid; padding: 5px;">实验要求</span>
@@ -136,7 +138,7 @@
                     </td>
                   </tr>
                   <tr>
-                    <td>操作</td>
+                    <td><el-button icon="el-icon-minus" @click="clearTableData(rightTableIndex)"></el-button></td>
                     <td v-for="(item, index) in rightTable.data" :key="'action-' + index">
                       <el-button icon="el-icon-minus" @click="handleMinusClick(index)"></el-button>
                     </td>
@@ -172,14 +174,12 @@ export default {
       selectedRightTable: [],
       isEditing: false,
       showAddButton: false,
-      // 添加一个新属性用于控制每行的删除按钮显示状态
       rightTableRowDeleteVisibility: [],
     };
   },
   computed: {
     filteredTableData() {
       const tableData = this.getTableData(this.activeButtonId);
-      // 过滤掉全为空值的最后一行
       while (tableData.length && Object.values(tableData[tableData.length - 1]).every(value => value === '')) {
         tableData.pop();
       }
@@ -274,7 +274,6 @@ export default {
               pronum: item.pronum,
               density: 10000,
               uniqueId: Math.random().toString(36).substring(2),
-              // 初始时不显示删除按钮
               showDeleteButton: false,
             };
             this.rightTables[selectedRightTableIndex].data.push(newItem);
@@ -292,7 +291,6 @@ export default {
           pronum: row.pronum,
           density: 10000,
           uniqueId: Math.random().toString(36).substring(2),
-          // 初始时不显示删除按钮
           showDeleteButton: false,
         };
         this.rightTables[selectedRightTableIndex].data.push(newItem);
@@ -335,18 +333,24 @@ export default {
       this.$set(this.tableDataMap, this.activeButtonId, tableData);
     },
     toggleAddButton() {
-      this.showAddButton =!this.showAddButton;
+      this.showAddButton = true;
+    },
+    saveAndHideAddButton() {
+      this.showAddButton = false;
     },
     handleMinusClick(index) {
       const selectedRightTableIndex = this.activeRightTableIndex;
       if (selectedRightTableIndex === null) return;
-      // 从当前选中的右侧表格数据中删除指定索引的行
       this.rightTables[selectedRightTableIndex].data.splice(index, 1);
-      // 重新编号
       this.rightTables[selectedRightTableIndex].data.forEach((item, newIndex) => {
         item.num = newIndex + 1;
       });
     },
+    clearTableData(index) {
+      if (index!== null) {
+        this.rightTables[index].data = [];
+      }
+    },
   },
 };
 </script>