feat: 审核同意和不同意接口对接

pull/1/head
lizijiee 1 year ago
parent 848f25bd84
commit 3ea601deda

@ -1,4 +1,5 @@
<script lang="ts" setup> <script lang="ts" setup>
import { audit } from '@/api/task/task';
import { import {
clearTF, getTaskDetailInfo, clearTF, getTaskDetailInfo,
getTaskDetailPictureList, getTaskDetailPictureList,
@ -10,6 +11,7 @@ import { useWorkOrder } from "@/store/modules/workOrder";
import { isEmpty } from "@/utils"; import { isEmpty } from "@/utils";
import { formatToDateHMS } from "@/utils/dateUtil"; import { formatToDateHMS } from "@/utils/dateUtil";
import { hideDownload } from "@/utils/image"; import { hideDownload } from "@/utils/image";
import emitter from '@/utils/mitt';
import { useInfiniteScroll } from "@vueuse/core"; import { useInfiniteScroll } from "@vueuse/core";
import { format } from 'date-fns'; import { format } from 'date-fns';
import imagesloaded from "imagesloaded"; import imagesloaded from "imagesloaded";
@ -17,7 +19,7 @@ import { clone, debounce, pickBy } from "lodash-es";
import { useDialog, useMessage } from "naive-ui"; import { useDialog, useMessage } from "naive-ui";
import { computed, onUnmounted, onUpdated, reactive, ref, unref, watch } from "vue"; import { computed, onUnmounted, onUpdated, reactive, ref, unref, watch } from "vue";
import ConfrimModal from "../modal/ConfrimModal.vue"; import ConfrimModal from "../modal/ConfrimModal.vue";
import type { SetTFParam, SimilarityPictureSortParam } from "/#/api"; import type { ApprovalParam, SetTFParam, SimilarityPictureSortParam } from "/#/api";
const batch = ref(false); const batch = ref(false);
const selectItems = ref<any[]>([]); const selectItems = ref<any[]>([]);
@ -399,6 +401,102 @@ function previewHandler(event: MouseEvent) {
if (imageRef.value && (imageRef.value as any).src) if (imageRef.value && (imageRef.value as any).src)
(imageRef.value as any).mergedOnClick(); (imageRef.value as any).mergedOnClick();
} }
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(confrimModalRef)! as any
modal.showModal()
}
function reject(idOrDesc: string, backId: string, isOther: boolean) {
const formIds: string[] = processItems.map(item => item.id)
const taskIds: string[] = processItems.map(item => item.taskId)
const tasknames: string[] = processItems.map(item => item.taskname)
const param: ApprovalParam = {
formid: formIds,
taskId: taskIds,
approvd: false,
taskComment: idOrDesc,
taskname: isOther ? tasknames : ['其他'],
}
doAudit(param)
}
function doAudit(param: any) {
audit(param).then((res) => {
const { code } = res
setBatch(false)
if (code === 'OK'){
emitter.emit('refresh')
refreshHandler()
}
else message.error(res.message)
})
}
function approvalHandler(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
}
dialog.info({
title: '确认提示',
content: '确认给该任务审批为【通过】吗?',
positiveText: '确定',
negativeText: '取消',
onPositiveClick: () => {
approval()
},
onNegativeClick: () => {},
})
}
function approval() {
const formIds: string[] = processItems.map(item => item.id)
const taskIds: string[] = processItems.map(item => item.taskId)
const tasknames: string[] = processItems.map(item => item.taskname)
const param: ApprovalParam = {
formid: formIds,
taskId: taskIds,
approvd: true,
taskComment: 'approval',
taskname: tasknames,
}
doAudit(param)
}
</script> </script>
<template> <template>
@ -411,15 +509,17 @@ function previewHandler(event: MouseEvent) {
</div> </div>
<div class="right"> <div class="right">
<div v-show="!showActions" style="display: flex; align-items: center"> <div v-show="!showActions" style="display: flex; align-items: center">
<n-button text @click="clearHandler">
<SvgIcon size="12" name="delete" />
清除标记
</n-button>
<div class="btn" style="margin: 0px 10px" @click="setBatch(true)"> <div class="btn" style="margin: 0px 10px" @click="setBatch(true)">
<SvgIcon style="margin-right: 6px" size="14" name="tf" /> <SvgIcon style="margin-right: 6px" size="14" name="tf" />
辨别真假 批量审批
</div>
<div class="icon-wrap">
<SvgIcon
size="20"
name="immersion-model"
@click="immersionHandler"
/>
</div> </div>
<SvgIcon style="cursor: pointer" size="20" name="immersion-model" @click="immersionHandler" />
</div> </div>
<div v-show="showActions" class="batch"> <div v-show="showActions" class="batch">
@ -429,12 +529,15 @@ function previewHandler(event: MouseEvent) {
</template> </template>
返回 返回
</n-button> </n-button>
<div style="cursor: pointer; margin-left: 16px" @click="falseHandler"> <div
<SvgIcon width="64" height="28" name="t4" /> style="cursor: pointer; margin-left: 16px"
@click.stop="rejectHandler"
>
<SvgIcon width="64" height="28" name="a1" />
</div> </div>
<SvgIcon size="24" name="vs" /> <SvgIcon size="24" name="vs" />
<div style="cursor: pointer" @click="trueHandler"> <div style="cursor: pointer" @click.stop="approvalHandler">
<SvgIcon width="64" height="28" name="t3" /> <SvgIcon width="64" height="28" name="a2" />
</div> </div>
</div> </div>
</div> </div>
@ -446,13 +549,6 @@ function previewHandler(event: MouseEvent) {
<!-- 左侧大图 图片信息 --> <!-- 左侧大图 图片信息 -->
<div class="left" :style="{ 'background-image': `url(${taskDetailInfo?.imgurl})` }" @click="showAction" <div class="left" :style="{ 'background-image': `url(${taskDetailInfo?.imgurl})` }" @click="showAction"
@mouseleave="leaveTaskHandler"> @mouseleave="leaveTaskHandler">
<!-- 真假标记 -->
<div class="mark">
<SvgIcon v-show="taskDetailInfo?.iztrueorfalse === 0" size="128" name="jia" />
</div>
<div class="mark">
<SvgIcon v-show="taskDetailInfo?.iztrueorfalse === 1" size="128" name="zhen" />
</div>
<div class="footer-times"> <div class="footer-times">
<div class="time" style="margin-bottom: 4px;"> <div class="time" style="margin-bottom: 4px;">
<SvgIcon color="#FFF" size="16" name="camera" /> <SvgIcon color="#FFF" size="16" name="camera" />
@ -507,8 +603,8 @@ function previewHandler(event: MouseEvent) {
</div> </div>
<!-- 操作 --> <!-- 操作 -->
<div v-show="overTask && overTask.id === taskDetailInfo.id" class="action" @click.stop="hideAction"> <div v-show="overTask && overTask.id === taskDetailInfo.id" class="action" @click.stop="hideAction">
<SvgIcon style="cursor: pointer" name="t1" @click.stop="trueHandler" /> <SvgIcon style="cursor: pointer" name="t1" @click.stop="approvalHandler" />
<SvgIcon style="cursor: pointer; margin-left: 30px" name="t2" @click.stop="falseHandler" /> <SvgIcon style="cursor: pointer; margin-left: 30px" name="t2" @click.stop="rejectHandler" />
</div> </div>
</div> </div>
<!-- 右侧任务 标题信息 --> <!-- 右侧任务 标题信息 -->
@ -516,8 +612,10 @@ function previewHandler(event: MouseEvent) {
<n-scrollbar style="max-height: 100%"> <n-scrollbar style="max-height: 100%">
<span class="task-name">任务ID{{ taskDetailInfo.taskname }}</span> <span class="task-name">任务ID{{ taskDetailInfo.taskname }}</span>
<div class="tags"> <div class="tags">
<div class="tag tag-approved">已审批</div> <div class="tag tag-submiting" v-if="taskDetailInfo.states==1">{{ TASK_STATUS_OBJ[taskDetailInfo.states] }}</div>
<div class="tag tag-passed">通过</div> <div class="tag tag-approve" v-else-if="taskDetailInfo.states==2">{{ TASK_STATUS_OBJ[taskDetailInfo.states] }}</div>
<div class="tag tag-passed" v-else-if="taskDetailInfo.states==3">{{ TASK_STATUS_OBJ[taskDetailInfo.states] }}</div>
<div class="tag tag-approved" v-else-if="taskDetailInfo.states==4">{{ TASK_STATUS_OBJ[taskDetailInfo.states] }}</div>
</div> </div>
<n-divider class="divider-line" /> <n-divider class="divider-line" />
<div class="property"> <div class="property">
@ -614,30 +712,27 @@ function previewHandler(event: MouseEvent) {
{{ item?.maxSimilarity && Number(item?.maxSimilarity).toFixed(0) }}% {{ item?.maxSimilarity && Number(item?.maxSimilarity).toFixed(0) }}%
</div> </div>
</div> </div>
<div class="pass-status" v-if="item.historyStates === 1">
<SvgIcon name="repeat-icon" style="width:52;height:24px" /> <div class="pass-status" v-if="item.historyStates === 2">
</div>
<div class="pass-status" v-else-if="item.historyStates === 2">
<SvgIcon name="pass-icon" style="width:52;height:24px" /> <SvgIcon name="pass-icon" style="width:52;height:24px" />
</div> </div>
<div class="pass-status" v-else-if="item.historyStates === 3"> <div class="pass-status" v-else-if="item.historyStates === 3">
<SvgIcon name="no-pass-icon" style="width:52;height:24px" /> <SvgIcon name="no-pass-icon" style="width:52;height:24px" />
</div> </div>
<!-- <div class="mark"> <!--
<SvgIcon name="jia" /> 重复标签
</div> <div class="pass-status" v-if="item.historyStates === 1">
<div class="mark"> <SvgIcon name="repeat-icon" style="width:52;height:24px" />
<SvgIcon name="zhen" />
</div> --> </div> -->
<div v-show="overTask && overTask.id === item.id" class="action"> <div v-show="overTask && overTask.id === item.id" class="action">
<SvgIcon style="cursor: pointer" name="t1" @click.stop="trueHandler" /> <SvgIcon style="cursor: pointer" name="t1" @click.stop="approvalHandler" />
<SvgIcon style="cursor: pointer;margin-left: 40px;" name="t2" @click.stop="falseHandler" /> <SvgIcon style="cursor: pointer;margin-left: 40px;" name="t2" @click.stop="rejectHandler" />
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</n-spin> </n-spin>
<ConfrimModal ref="confrimModalRef" @commit="setFalse" /> <ConfrimModal ref="confrimModalRef" @commit="reject" />
</div> </div>
</template> </template>
@ -819,6 +914,17 @@ function previewHandler(event: MouseEvent) {
padding: 16px 0 0 23px; padding: 16px 0 0 23px;
color: #fff; color: #fff;
} }
.icon-wrap{
display: flex;
align-items: center;
justify-content: center;
width: 30px;
height: 30px;
background: rgba(80,122,253,.1);
border-radius: 8px;
margin-left: 10px;
cursor: pointer;
}
.img-info { .img-info {
color: lime !important; color: lime !important;
@ -914,7 +1020,14 @@ function previewHandler(event: MouseEvent) {
font-size: 12px; font-size: 12px;
line-height: 16px; line-height: 16px;
} }
.tag-submiting{
color: #feaf2d;
border: 1px solid #feaf2d;
}
.tag-approve{
color: #398ade;
border: 1px solid #398ade;
}
.tag-passed { .tag-passed {
color: #02C984; color: #02C984;
border: 1px solid #02C984; border: 1px solid #02C984;

@ -1,9 +1,9 @@
<script lang="ts" setup> <script lang="ts" setup>
import { computed, onBeforeMount, ref } from 'vue' import { useDictionary } from '@/store/modules/dictonary';
import { useDictionary } from '@/store/modules/dictonary' import { computed, onBeforeMount, ref, unref } from 'vue';
const emit = defineEmits<{ const emit = defineEmits<{
(e: 'commit', id: any, desc: null | string) (e: 'commit', rejectId: any, backId: any, isOther: boolean)
}>() }>()
const dictonaryStore = useDictionary() const dictonaryStore = useDictionary()
@ -27,29 +27,49 @@ defineExpose({
showModal, showModal,
}) })
const options = ref<any[]>([]) const backOptions = ref<any[]>([])
const reasonOptions = ref<any[]>([])
const selectId = ref(null) const selectBackId = ref(null)
const selectRejectId = ref(null)
const selectItem = ref(null)
const otherValue = ref(null) const otherValue = ref(null)
const showOther = computed(() => { const showOther = computed(() => {
for (const item of options.value) { return (selectItem.value as any)?.label === '其他'
if (item.value === selectId.value && item.label === '其他') })
return true
}
return false const comomitValue = computed(() => {
return (selectItem.value as any)?.label === '其他' ? otherValue.value : selectRejectId.value
}) })
async function handleSumbit(e: MouseEvent) { async function handleSumbit(e: MouseEvent) {
e.preventDefault() e.preventDefault()
closeModal() closeModal()
emit('commit', selectId.value, otherValue.value) // selectRejectId.value === 'other'
emit('commit', unref(comomitValue), unref(selectBackId), showOther.value)
} }
onBeforeMount(async () => { onBeforeMount(async () => {
const tfList = await dictonaryStore.fetchTFList() const rejectList = await dictonaryStore.fetchTFList()
options.value = tfList const backList = await dictonaryStore.fetchBackList()
reasonOptions.value = rejectList
backOptions.value = backList
// TODO name=
//
// reasonOptions.value.push({
// label: '',
// value: 'other',
// })
}) })
async function selectChange(id){
console.log(id,'selectChange')
selectItem.value = reasonOptions.value.find(v=>v.id == id);
}
</script> </script>
<template> <template>
@ -57,7 +77,7 @@ onBeforeMount(async () => {
<n-card :style="cardStyle" :bordered="false" size="huge" role="dialog" aria-modal="true"> <n-card :style="cardStyle" :bordered="false" size="huge" role="dialog" aria-modal="true">
<div class="wrapper"> <div class="wrapper">
<div class="wrapper-header"> <div class="wrapper-header">
<span class="wrapper-left">选择判假原因</span> <span class="wrapper-left">选择不通过原因</span>
<div class="wrapper-right"> <div class="wrapper-right">
<div class="wrapper-right-close" @pointerdown="closeModal"> <div class="wrapper-right-close" @pointerdown="closeModal">
<div class="wrapper-right-icon" /> <div class="wrapper-right-icon" />
@ -65,10 +85,23 @@ onBeforeMount(async () => {
</div> </div>
</div> </div>
<div class="wrapper-content"> <div class="wrapper-content">
<span>判假原因</span> <span>处理方式</span>
<n-select filterable v-model:value="selectId" style="margin-top: 10px;" :options="options" /> <n-select filterable v-model:value="selectBackId" style="margin-top: 10px;" :options="backOptions" />
<n-input v-show="showOther" v-model:value="otherValue" style="margin-top: 10px;" type="textarea" /> </div>
<div class="wrapper-content">
<span>不通过原因</span>
<n-select filterable v-model:value="selectRejectId" @change="selectChange" style="margin-top: 10px;" :options="reasonOptions" />
<n-input v-show="showOther" v-model:value="otherValue" type="textarea" placeholder="备注内容" style="margin-top: 10px;" />
</div> </div>
<!-- <div class="wrapper-content">
<n-input
type="textarea"
placeholder="备注内容" v-model="showOther"></n-input>
</div> -->
</div> </div>
<template #footer> <template #footer>
<div class="wrapper-footer"> <div class="wrapper-footer">

Loading…
Cancel
Save