feat: 新增批量操作

This commit is contained in:
lonewolfyx 2026-03-05 16:33:38 +08:00
parent 2c6c56a45b
commit 7dd0b7460e

View File

@ -1,4 +1,7 @@
<template> <template>
<MBLoading
v-if="submitLoading"
style="position: absolute;display: block;z-index: 9999;background: rgb(0 0 0 / 14%);inset: 0px;overflow: hidden;margin: 0;height: 100svh;"/>
<view ref="targetRef" class="container"> <view ref="targetRef" class="container">
<MBCard> <MBCard>
<uni-forms ref="baseForm" :modelValue="queryParams"> <uni-forms ref="baseForm" :modelValue="queryParams">
@ -32,16 +35,15 @@
<text>{{ totalMoney.toFixed(2) }}</text> <text>{{ totalMoney.toFixed(2) }}</text>
</view> </view>
</view> </view>
<!-- <view :style="{--> <view :style="{
<!-- display:'flex',--> display:'flex',
<!-- marginTop:'15px',--> marginTop:'15px',
<!-- justifyContent:'space-between',--> justifyContent:'space-between',
<!-- alignItems:'center'--> alignItems:'center'
}">
<!-- }">--> <button class="mini-btn" size="mini" type="success" @click="handleBack">回退</button>
<!-- <button class="mini-btn" size="mini" type="success" @click="handleBack">回退</button>--> <button class="mini-btn" size="mini" type="primary" @click="handleSubmit">审核</button>
<!-- <button class="mini-btn" size="mini" type="primary" @click="handleSubmit">审核</button>--> </view>
<!-- </view>-->
</MBCard> </MBCard>
<ListItem v-if="tableData.length > 0" :items="tableData" @checkboxSelected="handleSelect"/> <ListItem v-if="tableData.length > 0" :items="tableData" @checkboxSelected="handleSelect"/>
<uni-load-more <uni-load-more
@ -64,13 +66,13 @@
<script setup> <script setup>
import {getCurrentInstance, onMounted, onUnmounted, ref, watch} from "vue" import {getCurrentInstance, onMounted, ref} from "vue"
import UniForms from "../../../uni_modules/uni-forms/components/uni-forms/uni-forms.vue"; import UniForms from "../../../uni_modules/uni-forms/components/uni-forms/uni-forms.vue";
import UniFormsItem from "../../../uni_modules/uni-forms/components/uni-forms-item/uni-forms-item.vue"; import UniFormsItem from "../../../uni_modules/uni-forms/components/uni-forms-item/uni-forms-item.vue";
import DictSelect from "../../../components/DictSelect/DictSelect.vue"; import DictSelect from "../../../components/DictSelect/DictSelect.vue";
import ProductionUnit from "../../../components/ProductionUnit/ProductionUnit.vue"; import ProductionUnit from "../../../components/ProductionUnit/ProductionUnit.vue";
import MBCard from "../../../components/MB/MBCard.vue"; import MBCard from "../../../components/MB/MBCard.vue";
import {mangerList} from "../../../api/BusinessApproval"; import {managerConfirm, managerRefuse, mangerList} from "../../../api/BusinessApproval";
import MBPagination from "../../../components/MB/MBPagination.vue"; import MBPagination from "../../../components/MB/MBPagination.vue";
import MBLoading from "../../../components/MB/MBLoading.vue"; import MBLoading from "../../../components/MB/MBLoading.vue";
import ListItem from "./ListItem.vue"; import ListItem from "./ListItem.vue";
@ -91,6 +93,7 @@ const paging = ref({
orderByColumn: 'adddate' orderByColumn: 'adddate'
}) })
const tableData = ref([]) const tableData = ref([])
const submitLoading = ref(false)
const handleQuery = async () => { const handleQuery = async () => {
loading.value = true loading.value = true
@ -124,5 +127,38 @@ const handleSelect = (payload) => {
onMounted(async () => { onMounted(async () => {
await handleQuery() await handleQuery()
}) })
const handleBack = async () => {
submitLoading.value = true
await Promise.allSettled(
selected.value.map(id =>
managerRefuse({
saleIds: id,
actionType: new Date().getDate() < 25 ? '1' : '0'
})
)
)
selected.value = []
totalMoney.value = 0
await handleQuery()
submitLoading.value = false
}
const handleSubmit = async () => {
submitLoading.value = true
await Promise.allSettled(
selected.value.map(id =>
managerConfirm({
saleIds: id,
actionType: new Date().getDate() < 25 ? '1' : '0'
})
)
)
selected.value = []
totalMoney.value = 0
await handleQuery()
submitLoading.value = false
}
</script> </script>