feat: 批量审核

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

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

Loading…
Cancel
Save