Selaa lähdekoodia

新增 全选/清空船舶

王智慧 3 vuotta sitten
vanhempi
commit
10077ca11a
1 muutettua tiedostoa jossa 26 lisäystä ja 0 poistoa
  1. 26 0
      src/views/shipSecurityManage/checkShip.vue

+ 26 - 0
src/views/shipSecurityManage/checkShip.vue

@@ -46,6 +46,7 @@
         multiple
         placeholder="请选择"
         style="width: 400px"
+        clearable
       >
         <el-option
           v-for="item in shipSelect"
@@ -55,6 +56,22 @@
           @click="shipIndex = ships.length - 1"
         />
       </el-select>
+      <el-button
+        @click="checkAll"
+        v-if="shipSelect.length"
+        class="ml20"
+        type="primary"
+      >
+        全选
+      </el-button>
+      <el-button
+        @click="clearAll"
+        v-if="ships.length"
+        class="ml20"
+        type="primary"
+      >
+        清空
+      </el-button>
     </div>
     <el-button-group class="mb20" v-show="ships.length">
       <el-button
@@ -207,6 +224,15 @@ async function addSecurityCheck() {
     });
   }
 }
+
+function checkAll() {
+  ships.value = _.cloneDeep(shipSelect.value);
+}
+
+function clearAll() {
+  ships.value = [];
+}
+
 onMounted(() => {
   getAddTemplateSelect();
 });