Merge pull request 'shen' (#17) from shen into test

Reviewed-on: #17
pull/18/head
shenhailong 1 year ago
commit fd1b5805a5

@ -4,9 +4,7 @@ import { useMessage } from 'naive-ui'
import { useDictionary } from '@/store/modules/dictonary'
import { audit } from '@/api/task/task'
const emit = defineEmits<{
(e: 'success')
}>()
const emit = defineEmits(['success'])
const message = useMessage()
const loading = ref(false)
@ -104,7 +102,7 @@ async function handleSumbit(e: MouseEvent) {
const { code } = res
if (code === 'OK') {
message.success('审核成功')
emit('success')
emit('success', param)
closeModal()
}
else { message.error(res.message) }

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

@ -20,7 +20,7 @@ import emitter from '@/utils/mitt'
const CustomFieldModalRef = ref(null)
const collapse = ref(false)
const taskStore = useTaskStore()
const taskListRef = ref<HTMLDivElement | null>(null)
const taskListRef: any = ref(null)
//
const showFieldList = ref<any[]>([])
@ -144,6 +144,14 @@ function editFilter(filter: any) {
modal.showModal()
modal.edit(filter)
}
function setAsideItemName(text) {
taskListRef.value.setStatusName(text)
}
defineExpose({
setAsideItemName,
})
</script>
<template>

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

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

@ -19,6 +19,7 @@ import { isEmpty } from '@/utils'
import { formatToDateHMS } from '@/utils/dateUtil'
import { hideDownload } from '@/utils/image'
const emit = defineEmits(['setAsideItemName'])
const batch = ref(false)
const selectItems = ref<any[]>([])
const message = useMessage()
@ -43,11 +44,8 @@ function setBatch(value: boolean) {
batch.value = value
if (value === false) {
selectItems.value.forEach(item => (item.checked = false))
selectItems.value.length = 0
selectItems.value.length = 0
}
if (value === false)
selectItems.value = []
}
function onCheckChange(checked: any, item: any) {
@ -94,6 +92,12 @@ function handleKeydown(event) {
//
}
// storeid
function currentTaskId() {
const index = taskStore.getCurrentIndex
return taskStore.getApprovalList[index]?.id || ''
}
// states:1234
function validate(items: any[]) {
if (items.length === 0)
@ -169,36 +173,22 @@ function approvalHandler(items?: any) {
}
function rejectHandler(items?: any) {
// let cloneItem: any
// if (batch.value) {
// processItems = selectItems.value
// }
// else if (overTask.value) {
// cloneItem = clone(overTask.value)
// processItems = [cloneItem]
// }
// if (items !== undefined && !(items instanceof PointerEvent))
// processItems = items
// const msg = validate(processItems)
// if (msg !== null) {
// message.error(msg)
// return
// }
const modal = unref(notPassModalRef)! as any
modal.showModal(selectItems.value)
}
function singleRejectHandler() {
const modal = unref(notPassModalRef)! as any
modal.showModal([taskDetailInfo.value])
}
function doAudit(param: any) {
audit(param).then((res) => {
const { code } = res
setBatch(false)
if (code === 'OK') {
message.success('审核成功')
reloadList()
setBatch(false)
reloadList(param, '通过')
}
else { message.error(res.message) }
@ -273,12 +263,6 @@ async function getImgList() {
}
}
// storeid
const currentTaskId = computed(() => {
const index = taskStore.getCurrentIndex
return taskStore.getApprovalList[index]?.id || ''
})
function overTaskHandle() {
const item = taskDetailInfo.value
if (item?.userapprove?.statshis === 2 || item?.userapprove?.statshis == 3) {
@ -333,7 +317,14 @@ async function getDetail() {
getImgList()
}
function reloadList() {
function reloadList(param, text) {
//
const id = currentTaskId()
const hasCurrentId = param.flowTaskInfoList.find(item => item.formId === id)
if (hasCurrentId)
emit('setAsideItemName', text)
getDetail()
}
</script>
@ -434,7 +425,7 @@ function reloadList() {
width="168"
height="48"
name="r7"
@click.stop="rejectHandler"
@click.stop="singleRejectHandler"
/>
</div>
<div class="check">
@ -490,13 +481,13 @@ function reloadList() {
</n-grid>
</div>
<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" />
<span>{{ formatToDateHMS(Number(taskDetailInfo.ocrPicture.photoDateTimestamp) || 0) }}</span>
<span>{{ taskDetailInfo?.ocrPicture?.photoDateTimestamp ? formatToDateHMS(Number(taskDetailInfo.ocrPicture.photoDateTimestamp)) : '-' }}</span>
</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" />
<span>{{ formatToDateHMS(Number(taskDetailInfo.ocrPicture.submitDateTimestamp) || 0) }}</span>
<span>{{ taskDetailInfo?.ocrPicture?.submitDateTimestamp ? formatToDateHMS(Number(taskDetailInfo.ocrPicture.submitDateTimestamp)) : '-' }}</span>
</div>
</div>
<div style="display: none">
@ -544,13 +535,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 === 3" class="tag-status" src="@/assets/images/task/tag-not-pass.png" alt="">
<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" />
<span>{{ formatToDateHMS(Number(item.photoDateTimestamp) || 0) }}</span>
<span>{{ item.photoDateTimestamp ? formatToDateHMS(Number(item.photoDateTimestamp)) : '-' }}</span>
</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" />
<span>{{ formatToDateHMS(Number(item.submitDateTimestamp) || 0) }}</span>
<span>{{ item.submitDateTimestamp ? formatToDateHMS(Number(item.submitDateTimestamp)) : '-' }}</span>
</div>
</div>
<div :class="{ 'percent-red': item.similarityScore === 100 }" class="percent">
@ -575,7 +566,7 @@ function reloadList() {
<History :data="taskDetailInfo" />
</n-tab-pane>
</n-tabs>
<NotPassed ref="notPassModalRef" @success="reloadList" />
<NotPassed ref="notPassModalRef" @success="(param) => reloadList(param, '不通过')" />
<BatchModal
ref="batchModalRef"
@reject="rejectHandler"

@ -1,15 +1,22 @@
<script lang="ts" setup>
import { ref } from 'vue'
import Aside from './aside/Aside.vue'
import Content from './content/Content.vue'
const asideRef: any = ref(null)
function setAsideItemName(text) {
asideRef.value.setAsideItemName(text)
}
</script>
<template>
<div class="main">
<!-- 侧边 -->
<Aside />
<Aside ref="asideRef" />
<!-- 内容 -->
<Content />
<Content @set-aside-item-name="setAsideItemName" />
</div>
</template>

Loading…
Cancel
Save