feat: 批量审核

pull/51/head
lizijiee 1 year ago
parent cc7d6ba5ad
commit 2ccfcca958

@ -1,7 +1,7 @@
<script lang="ts" setup> <script lang="ts" setup>
import Masonry from 'masonry-layout' import Masonry from 'masonry-layout'
import { useDialog, useMessage } from 'naive-ui' import { useDialog, useMessage } from 'naive-ui'
import { computed, onBeforeMount, onMounted, onUpdated, reactive, ref, watch } from 'vue' import { computed, onBeforeMount, onMounted, onUpdated, reactive, ref, unref, watch } from 'vue'
import { dubiousfilelist, removeFiles } from '@/api/task/task' import { dubiousfilelist, removeFiles } from '@/api/task/task'
import { viewOptions } from '@/config/home' import { viewOptions } from '@/config/home'
@ -56,7 +56,7 @@ const pagination = reactive({
let loading = false let loading = false
let _masonry: null | Masonry = null let _masonry: null | Masonry = null
const show = ref(false) const show = ref(false)
const selectedApproveItems = ref<any[]>([]); //
const dialog = useDialog(); const dialog = useDialog();
let processItems: any[] = []; let processItems: any[] = [];
@ -249,6 +249,7 @@ async function onChange() {
} }
function closeModal(event: MouseEvent) { function closeModal(event: MouseEvent) {
selectedApproveItems.value = []
show.value = false show.value = false
} }
@ -277,28 +278,44 @@ function setBatch(value) {
batch.value = value; batch.value = value;
} }
if (value === false) { if (value === false) {
selectIds.value = [] // selectIds.value = []
listData.value.forEach((item) => (item.checked = false)); selectedApproveItems.value.forEach((item) => (item.checked = false));
listData.value.length = 0; selectedApproveItems.value.length = 0;
} }
} }
const showActions = computed(() => {
return listData.value.length > 0 && batch;
});
defineExpose({ defineExpose({
showModal, showModal,
}) })
const checked = ref(false) const checked = ref(false)
function onCheckChange(val: any, item: any) {
checked.value = val const notPassModalRef = ref(null)
const showActions = computed(() => {
return selectedApproveItems.value.length > 0 && batch;
});
function onCheckChange(checked: any, item: any) {
debugger
item.checked = checked
const index = selectedApproveItems.value.indexOf(item);
if (index === -1 && checked) selectedApproveItems.value.push(item);
else selectedApproveItems.value.splice(index, 1);
}
function rejectHandler() {
const modal = unref(notPassModalRef)! as any
modal.showModal(selectedApproveItems.value)
} }
function reset() { function reset() {
batch.value = false;
pagination.pageNo = 0; pagination.pageNo = 0;
pagination.pageSize = 20; pagination.pageSize = 20;
listData.value.length = 0; listData.value.length = 0;
selectedApproveItems.value.length = 0;
loading = false; loading = false;
canloadMore = true; canloadMore = true;
} }
@ -307,9 +324,8 @@ function validate(items: any[]) {
return null; return null;
} }
function approvalHandler(items?: any) { function approvalHandler(items?: any) {
let cloneItem: any
if (batch.value) { if (batch.value) {
processItems = listData.value processItems = selectedApproveItems.value
} }
// => => / // => => /
if (items !== undefined && !(items instanceof PointerEvent)) if (items !== undefined && !(items instanceof PointerEvent))
@ -360,15 +376,20 @@ function doAudit(param: any) {
if (code === 'OK') { if (code === 'OK') {
message.info(res.message) message.info(res.message)
// emitter.emit('refresh') // emitter.emit('refresh')
// refreshHandler() refreshHandler()
} }
else message.error(res.message) else message.error(res.message)
}) })
} }
function reloadList() { function reloadList() {
setBatch(false) refreshHandler()
// refreshHandler() }
function refreshHandler(){
reset()
featchList()
} }
</script> </script>
<template> <template>

Loading…
Cancel
Save