Explorar el Código

增加日常费用批量删除

unknown hace 1 semana
padre
commit
c963d3147c
Se han modificado 1 ficheros con 32 adiciones y 0 borrados
  1. 32 0
      src/views/elderly/fee/daily-fee/index.vue

+ 32 - 0
src/views/elderly/fee/daily-fee/index.vue

@@ -108,6 +108,9 @@
         <Icon icon="ep:plus" class="mr-5px"/>
         长者用药
       </el-button>
+      <el-button type="warning" plain v-hasPermi="['daily-fee:extend:deletes']" :disabled="!ids.length" @click="handleDeletes">
+        批量删除
+      </el-button>
     </template>
   </TabBarBtn>
 
@@ -317,6 +320,8 @@ const selectData = ref([])
 const handleSelectionChange = (val) => {
   ids.value = val.map((item) => item.id)
   selectData.value = val
+
+  console.log("AAA",ids.value,selectData.value)
 }
 
 const handleDelete = async (id: number) => {
@@ -346,6 +351,33 @@ const handleDelete = async (id: number) => {
   } catch {}
 }
 
+const handleDeletes = async () => {
+  if(!ids.value.length){
+    message.error('请选择一条数据')
+    return
+  }
+  try {
+    // 删除的二次确认
+    await ElMessageBox({
+      title: '温馨提示',
+      message: h('p', null, [
+        h('span', null, '删除选中数据可能会影响'),
+        h('span', { style: 'color: red' }, '“账单缴费”'),
+        h('span', null, ',是否删除选中数据? ')
+      ]),
+      confirmButtonText: t('common.ok'),
+      cancelButtonText: t('common.cancel'),
+      type: 'warning',
+      showCancelButton: true
+    })
+    // 发起删除
+    await delDailyExpenses(ids.value)
+    message.success(t('common.delSuccess'))
+    // 刷新列表
+    await getList()
+  } catch {}
+}
+
 // 导入
 const importRef = ref()
 const handleImport = () => {