Pārlūkot izejas kodu

批量删除按钮禁用

hlp 1 gadu atpakaļ
vecāks
revīzija
4251d1b871

+ 5 - 4
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/tasks/index.vue

@@ -53,7 +53,7 @@
       <div class="bg-white w-full h-full p-3 shadow-md rounded-md flex flex-col">
         <div class="ml-auto p-3">
           <el-button type="primary" @click="createTasks()">创建任务</el-Button>
-          <el-button type="primary" :loading="btnLoading" @click="deleteTasks()">批量删除</el-Button>
+          <el-button type="primary" :disabled="len == 0" :loading="btnLoading" @click="deleteTasks()">批量删除</el-Button>
           <el-button type="primary" @click="openImportModal()">导入</el-Button>
           <el-button type="primary" :loading="btnLoading" @click="exportTasks()">导出</el-Button>
         </div>
@@ -155,7 +155,7 @@
 </template>
 
 <script lang="ts" setup>
-import { inject, onBeforeMount, onMounted, ref, } from 'vue';
+import { computed, inject, onBeforeMount, onMounted, ref, } from 'vue';
 import { useRouter } from 'vue-router';
 import { useStore } from '@/store';
 import { MOD, PRIORITY, STATUS, defaultSearchForm, PAGE_LIST, ADD_TASK, DELETE_TASKS, UPDATE_TASK, UPDATE_TASK_STATUS, IMPORT_DATA, EXPORT_DATA, EXPORT_DATA_BY_TASK_ID } from './api';
@@ -173,7 +173,9 @@ const pagePermission = ref<any[]>();
 const taskModalVisible = ref(false);
 const taskForm = ref<any>();
 const isEdit = ref(false);
-
+const len = computed(() => {
+  return tableRef.value?.getSelectionRows().length
+})
 const taskLoading = ref<saveLoadingType>("1");
 function closeTaskModal() {
   taskModalVisible.value = false;
@@ -215,7 +217,6 @@ const loading = ref<boolean>(false);
 const totalCount = ref<number>(0);
 const tableData = ref<any[]>([])
 function search() {
-  console.log("pageP", pagePermission.value);
   loading.value = true;
   const { startDate, endDate } = searchForm.value;
   let params = {