pull/17/head
Dragon 1 year ago
parent 646f4202b4
commit 2fcde4358f

@ -248,6 +248,19 @@ async function formatColumns() {
} }
} }
index = columnsRef.value.findIndex(v => v.title == '所属项目')
if (index > -1) {
columnsRef.value[index] = {
title: '所属项目',
key: columnsRef.value[index].key, // "fromtaskname"
fixed: columnsRef.value[index].fixed || undefined,
width: 200,
ellipsis: {
tooltip: true,
},
}
}
index = columnsRef.value.findIndex(v => v.title == '任务名称') index = columnsRef.value.findIndex(v => v.title == '任务名称')
if (index > -1) { if (index > -1) {
columnsRef.value[index] = { columnsRef.value[index] = {
@ -575,10 +588,10 @@ function actionHandler(action: any, row: any) {
resetHandler() resetHandler()
break break
case 'approval': case 'approval':
approvalHandler(row) singleApproval(row)
break break
case 'reject': case 'reject':
rejectHandler(row) rejectHandler([row])
break break
default: default:
break break
@ -630,26 +643,24 @@ function getSelectItems() {
return tableData.value.filter(item => selectionIds.value.includes(item.id)) return tableData.value.filter(item => selectionIds.value.includes(item.id))
} }
function approvalHandler(row) { //
// const items = getSelectItems() function singleApproval(row) {
const items = [row] const param = {
const msg = validate(items) result: true,
comment: '',
if (msg !== null) { disposeType: '',
message.error(msg) disposeTypeId: '',
return failCauseId: '',
failCauseName: '',
flowTaskInfoList: [
{
formId: row.id,
taskId: row.taskId,
taskName: row.fromTaskName,
},
],
} }
doAudit(param)
dialog.info({
title: '确认提示',
content: '确认给该任务审批为【通过】吗?',
positiveText: '确定',
negativeText: '取消',
onPositiveClick: () => {
approval(items)
},
onNegativeClick: () => {},
})
} }
function batchApproval() { function batchApproval() {
@ -673,26 +684,25 @@ function batchApproval() {
}) })
} }
function approval(items) { // function approval(items) {
const formIds: string[] = items.map(item => item.id) // const formIds: string[] = items.map(item => item.id)
const taskIds: string[] = items.map(item => item.taskId) // const taskIds: string[] = items.map(item => item.taskId)
const tasknames: string[] = items.map(item => item.taskname) // const tasknames: string[] = items.map(item => item.taskname)
const param: ApprovalParam = { // const param: ApprovalParam = {
formid: formIds, // formid: formIds,
taskId: taskIds, // taskId: taskIds,
approvd: true, // approvd: true,
taskComment: 'approval', // taskComment: 'approval',
taskname: tasknames, // taskname: tasknames,
} // }
doAudit(param) // doAudit(param)
} // }
function rejectHandler(row) { //
// const items = getSelectItems() function rejectHandler(list) {
const items = [row] const msg = validate(list)
const msg = validate(items)
if (msg !== null) { if (msg !== null) {
message.error(msg) message.error(msg)
@ -700,7 +710,7 @@ function rejectHandler(row) {
} }
const modal = unref(notPassModalRef)! as any const modal = unref(notPassModalRef)! as any
modal.showModal() modal.showModal(list)
} }
function reject(idOrDesc: string, backId: string, isOther: boolean) { function reject(idOrDesc: string, backId: string, isOther: boolean) {
@ -720,15 +730,6 @@ function reject(idOrDesc: string, backId: string, isOther: boolean) {
doAudit(param) doAudit(param)
} }
function doAudit(param: any) {
audit(param).then((res) => {
const { code } = res
if (code === 'OK')
reload()
else message.error(res.message)
})
}
function reload() { function reload() {
const { page, pageSize } = unref(tableRef.value?.pagination) as PaginationProps const { page, pageSize } = unref(tableRef.value?.pagination) as PaginationProps
query(page!, pageSize!) query(page!, pageSize!)
@ -751,6 +752,27 @@ async function refreshHandler(searchId?: any) {
reset() reset()
query(pagination.page, pagination.pageSize, searchId) query(pagination.page, pagination.pageSize, searchId)
} }
//
function doAudit(param: any) {
dialog.info({
title: '确认提示',
content: '确认给该任务审批为【通过】吗?',
positiveText: '确定',
negativeText: '取消',
onPositiveClick: () => {
audit(param).then((res) => {
const { code } = res
if (code === 'OK') {
message.success('审核成功')
reload()
}
else { message.error(res.message) }
})
},
onNegativeClick: () => {},
})
}
</script> </script>
<template> <template>
@ -837,7 +859,7 @@ async function refreshHandler(searchId?: any) {
:on-success="sucessHandler" :on-success="sucessHandler"
:header-config="headRules" :header-config="headRules"
/> />
<NotPassed ref="notPassModalRef" @success="reloadList" /> <NotPassed ref="notPassModalRef" @success="reload" />
<RepeatModal <RepeatModal
ref="repeatModalRef" ref="repeatModalRef"

@ -53,7 +53,10 @@ const svgName = computed(() => {
" "
>{{ listItem.statshisText }}</span> >{{ listItem.statshisText }}</span>
</li> </li>
<li v-else-if="item.id === 'createdate'"> <li v-else-if="item.id === 'finishTime'">
提报时间{{ format(listItem.finishTime, "yyyy-MM-dd HH:mm:ss") }}
</li>
<li v-else-if="item.id === ''">
提交时间{{ format(listItem.createdate, "yyyy-MM-dd HH:mm:ss") }} 提交时间{{ format(listItem.createdate, "yyyy-MM-dd HH:mm:ss") }}
</li> </li>
<li v-else class="ellipsis"> <li v-else class="ellipsis">

@ -1,119 +1,121 @@
<script lang="ts" setup> <script lang="ts" setup>
import { useInfiniteScroll } from "@vueuse/core"; import { useInfiniteScroll } from '@vueuse/core'
import { onMounted, onUnmounted, reactive, ref, watch, defineProps } from "vue"; import { defineProps, onMounted, onUnmounted, reactive, ref, watch } from 'vue'
import ListItem from "./ListItem.vue"; import ListItem from './ListItem.vue'
import emitter from "@/utils/mitt"; import emitter from '@/utils/mitt'
import { useTaskStore } from "@/store/modules/task"; import { useTaskStore } from '@/store/modules/task'
const taskStore = useTaskStore();
const data = ref<any[]>([]);
const activeId = ref("");
const el = ref<HTMLDivElement | null>(null);
const keyword = ref("");
const canloadMore = ref(true);
const isLoading = ref(false);
defineProps({ defineProps({
showFieldList: { showFieldList: {
type: Array, type: Array,
default: () => [], default: () => [],
}, },
}); })
const taskStore = useTaskStore()
const data = ref<any[]>([])
const activeId = ref('')
const el = ref<HTMLDivElement | null>(null)
const keyword = ref('')
const canloadMore = ref(true)
const isLoading = ref(false)
const pagination = reactive({ const pagination = reactive({
pageNo: 0, pageNo: 0,
pageSize: 100, pageSize: 30,
}); })
function selectHandler(id: string, index: number) { function selectHandler(id: string, index: number) {
taskStore.setActive(index); taskStore.setActive(index)
} }
useInfiniteScroll( useInfiniteScroll(
el as any, el as any,
() => { () => {
loadMore(); loadMore()
}, },
{ distance: 10, interval: 1500, canLoadMore: () => canloadMore.value } { distance: 10, interval: 1500, canLoadMore: () => canloadMore.value },
); )
async function loadMore() { async function loadMore() {
if (isLoading.value || el.value == null) return; if (isLoading.value || el.value == null)
isLoading.value = true; return
isLoading.value = true
try { try {
const more = await fetchList(); const more = await fetchList()
data.value.push(...more); data.value.push(...more)
} finally { }
isLoading.value = false; finally {
isLoading.value = false
} }
} }
//
async function fetchList() { async function fetchList() {
try { try {
pagination.pageNo += 1; pagination.pageNo += 1
const result = await taskStore.fetchApprovalList(pagination); const result = await taskStore.fetchApprovalList(pagination)
const { data, pageCount } = result; const { data, pageCount } = result
canloadMore.value = pageCount >= pagination.pageNo; canloadMore.value = pageCount >= pagination.pageNo
return data || []; return data || []
} catch (error) { }
canloadMore.value = false; catch (error) {
return []; canloadMore.value = false
return []
} }
} }
watch( watch(
() => taskStore.activeId, () => taskStore.activeId,
(newVal) => { (newVal) => {
activeId.value = newVal; activeId.value = newVal
} },
); )
function reset() { function reset() {
pagination.pageNo = 0; pagination.pageNo = 0
pagination.pageSize = 100; pagination.pageSize = 100
canloadMore.value = true; canloadMore.value = true
data.value.length = 0; data.value.length = 0
taskStore.reset(); taskStore.reset()
} }
async function search(word: string) { async function search(word: string) {
keyword.value = word; keyword.value = word
reset(); reset()
useInfiniteScroll( useInfiniteScroll(
el as any, el as any,
() => { () => {
loadMore(); loadMore()
}, },
{ distance: 10, canLoadMore: () => canloadMore.value } { distance: 10, canLoadMore: () => canloadMore.value },
); )
} }
onMounted(() => { onMounted(() => {
emitter.on("refresh", refreshHandler); emitter.on('refresh', refreshHandler)
}); })
onUnmounted(() => { onUnmounted(() => {
emitter.off("refresh", refreshHandler); emitter.off('refresh', refreshHandler)
}); })
async function refreshHandler() { async function refreshHandler() {
search(""); search('')
} }
defineExpose({ defineExpose({
search, search,
}); })
</script> </script>
<template> <template>
<n-spin :show="isLoading"> <n-spin :show="isLoading">
<div ref="el" class="list"> <div ref="el" class="list">
<ListItem <ListItem
:showFieldList="showFieldList"
v-for="(item, index) in data" v-for="(item, index) in data"
:key="item.id" :key="item.id"
:show-field-list="showFieldList"
:selected="activeId === item.id" :selected="activeId === item.id"
:list-item="item" :list-item="item"
@click="selectHandler(item.id, index)" @click="selectHandler(item.id, index)"

@ -490,13 +490,13 @@ function reloadList() {
</n-grid> </n-grid>
</div> </div>
<div class="time"> <div class="time">
<div v-if="taskDetailInfo?.ocrPicture?.photoDateTimestamp" class="time-item"> <div class="time-item">
<SvgIcon class="svg-time" color="#FFF" size="16" name="camera-time" /> <SvgIcon class="svg-time" color="#FFF" size="16" name="camera-time" />
<span>{{ formatToDateHMS(Number(taskDetailInfo.ocrPicture.photoDateTimestamp) || 0) }}</span> <span>{{ taskDetailInfo?.ocrPicture?.photoDateTimestamp ? formatToDateHMS(Number(taskDetailInfo.ocrPicture.photoDateTimestamp)) : '-' }}</span>
</div> </div>
<div v-if="taskDetailInfo?.ocrPicture?.submitDateTimestamp" class="time-item time-item2"> <div class="time-item time-item2">
<SvgIcon class="svg-time" color="#FFF" size="16" name="submit-time" /> <SvgIcon class="svg-time" color="#FFF" size="16" name="submit-time" />
<span>{{ formatToDateHMS(Number(taskDetailInfo.ocrPicture.submitDateTimestamp) || 0) }}</span> <span>{{ taskDetailInfo?.ocrPicture?.submitDateTimestamp ? formatToDateHMS(Number(taskDetailInfo.ocrPicture.submitDateTimestamp)) : '-' }}</span>
</div> </div>
</div> </div>
<div style="display: none"> <div style="display: none">
@ -544,13 +544,13 @@ function reloadList() {
<img v-if="item.historyStates === 2" class="tag-status" src="@/assets/images/task/tag-pass.png" alt=""> <img v-if="item.historyStates === 2" class="tag-status" src="@/assets/images/task/tag-pass.png" alt="">
<img v-if="item.historyStates === 3" class="tag-status" src="@/assets/images/task/tag-not-pass.png" alt=""> <img v-if="item.historyStates === 3" class="tag-status" src="@/assets/images/task/tag-not-pass.png" alt="">
<div class="time"> <div class="time">
<div v-if="item.photoDateTimestamp" class="time-item"> <div class="time-item">
<SvgIcon class="svg-time" color="#FFF" size="8" name="camera-time" /> <SvgIcon class="svg-time" color="#FFF" size="8" name="camera-time" />
<span>{{ formatToDateHMS(Number(item.photoDateTimestamp) || 0) }}</span> <span>{{ item.photoDateTimestamp ? formatToDateHMS(Number(item.photoDateTimestamp)) : '-' }}</span>
</div> </div>
<div v-if="item.submitDateTimestamp" class="time-item time-item2"> <div class="time-item time-item2">
<SvgIcon class="svg-time" color="#FFF" size="8" name="submit-time" /> <SvgIcon class="svg-time" color="#FFF" size="8" name="submit-time" />
<span>{{ formatToDateHMS(Number(item.submitDateTimestamp) || 0) }}</span> <span>{{ item.submitDateTimestamp ? formatToDateHMS(Number(item.submitDateTimestamp)) : '-' }}</span>
</div> </div>
</div> </div>
<div :class="{ 'percent-red': item.similarityScore === 100 }" class="percent"> <div :class="{ 'percent-red': item.similarityScore === 100 }" class="percent">

Loading…
Cancel
Save