Merge pull request 'fix:图片时间区域加蒙层' (#112) from fix/changeimgback into test

Reviewed-on: #112
pull/114/head^2
lihui_ocr 1 year ago
commit b4cb862d5f

@ -1,105 +1,110 @@
<script lang="ts" setup>
import { computed, onMounted, onUnmounted, reactive, ref, unref, watch } from 'vue'
import { chunk, clone } from 'lodash-es'
import { useDialog, useMessage } from 'naive-ui'
import { useRoute, useRouter } from 'vue-router'
import BatchModal from '../modal/BatchModal.vue'
import CustomSettingModal from '../modal/CustomSettingModal.vue'
import PictureTable from './PictureTable.vue'
import TaskTable from './TaskTable.vue'
import History from './History.vue'
import NotPassed from '@/components/Approval/NotPassed.vue'
import { getAllfieldList, getfieldList } from '@/api/home/filter'
import { TASK_STATUS_OBJ } from '@/enums/index'
import { useFinal } from '@/store/modules/final'
import {
computed,
onMounted,
onUnmounted,
reactive,
ref,
unref,
watch,
} from "vue";
import { chunk, clone } from "lodash-es";
import { useDialog, useMessage } from "naive-ui";
import { useRoute, useRouter } from "vue-router";
import BatchModal from "../modal/BatchModal.vue";
import CustomSettingModal from "../modal/CustomSettingModal.vue";
import PictureTable from "./PictureTable.vue";
import TaskTable from "./TaskTable.vue";
import History from "./History.vue";
import NotPassed from "@/components/Approval/NotPassed.vue";
import { getAllfieldList, getfieldList } from "@/api/home/filter";
import { TASK_STATUS_OBJ } from "@/enums/index";
import { useFinal } from "@/store/modules/final";
import {
audit,
dubiousfileyd,
getSimilarityList,
getTaskDetailInfo,
} from '@/api/task/task'
import { useTask } from '@/store/modules/task'
import { useUser } from '@/store/modules/user'
import { isEmpty } from '@/utils'
import { formatToDateHMS } from '@/utils/dateUtil'
import { hideDownload } from '@/utils/image'
const emit = defineEmits(['setAsideItemName'])
const router = useRouter()
const batch = ref(false)
const selectItems = ref<any[]>([])
const message = useMessage()
const dialog = useDialog()
const notPassModalRef = ref(null)
const batchModalRef: any = ref(null)
const totalCount = ref(0)
const taskId: any = ref('') // id
const packageId: any = ref('') // id
const CustomSettingModalRef = ref(null)
const taskTableData = ref<any[]>([])
const route = useRoute()
const isDetail = ref(false) //
const finalStore = useFinal()
} from "@/api/task/task";
import { useTask } from "@/store/modules/task";
import { useUser } from "@/store/modules/user";
import { isEmpty } from "@/utils";
import { formatToDateHMS } from "@/utils/dateUtil";
import { hideDownload } from "@/utils/image";
const emit = defineEmits(["setAsideItemName"]);
const router = useRouter();
const batch = ref(false);
const selectItems = ref<any[]>([]);
const message = useMessage();
const dialog = useDialog();
const notPassModalRef = ref(null);
const batchModalRef: any = ref(null);
const totalCount = ref(0);
const taskId: any = ref(""); // id
const packageId: any = ref(""); // id
const CustomSettingModalRef = ref(null);
const taskTableData = ref<any[]>([]);
const route = useRoute();
const isDetail = ref(false); //
const finalStore = useFinal();
const sortBy: any = {
orderType: 'desc',
orderName: 'similarityScore',
}
orderType: "desc",
orderName: "similarityScore",
};
function onCheckChange(checked: any, item: any) {
const index = selectItems.value.indexOf(item)
item.checked = checked
const index = selectItems.value.indexOf(item);
item.checked = checked;
if (index === -1 && checked)
selectItems.value.push(item)
else selectItems.value.splice(index, 1)
if (index === -1 && checked) selectItems.value.push(item);
else selectItems.value.splice(index, 1);
}
const showActions = computed(() => {
return selectItems.value.length > 0 && batch
})
return selectItems.value.length > 0 && batch;
});
const taskpagination = reactive({
pageNo: 1,
pageSize: 30,
})
const taskStore = useTask()
const overTask = ref<any>(null)
const taskDetailInfo = ref<any>({})
const taskDetailPictureList = ref<any[]>([])
const userStore = useUser()
const imageRef = ref<ComponentElRef | null>()
let processItems: any[] = []
const isFullScreen = ref(false)
});
const taskStore = useTask();
const overTask = ref<any>(null);
const taskDetailInfo = ref<any>({});
const taskDetailPictureList = ref<any[]>([]);
const userStore = useUser();
const imageRef = ref<ComponentElRef | null>();
let processItems: any[] = [];
const isFullScreen = ref(false);
const fullscreenStyles = computed<any>(() => ({
width: isFullScreen.value ? '100vw' : '',
height: isFullScreen.value ? '100vh' : '',
position: isFullScreen.value ? 'fixed' : '',
top: isFullScreen.value ? '0' : '',
left: isFullScreen.value ? '0' : '',
zIndex: isFullScreen.value ? '100' : '',
}))
width: isFullScreen.value ? "100vw" : "",
height: isFullScreen.value ? "100vh" : "",
position: isFullScreen.value ? "fixed" : "",
top: isFullScreen.value ? "0" : "",
left: isFullScreen.value ? "0" : "",
zIndex: isFullScreen.value ? "100" : "",
}));
onMounted(() => {
window.addEventListener('keydown', handleKeydown)
window.addEventListener("keydown", handleKeydown);
if (route.query.id) {
taskId.value = route.query.id
packageId.value = route.query.packageid
isDetail.value = true
getDetail()
taskId.value = route.query.id;
packageId.value = route.query.packageid;
isDetail.value = true;
getDetail();
}
})
});
//
function handleKeydown(event) {
if (event.key === 'ArrowLeft')
backHandler()
if (event.key === "ArrowLeft") backHandler();
//
else if (event.key === 'ArrowRight')
forwardHandler()
else if (event.key === "ArrowRight") forwardHandler();
//
}
@ -107,27 +112,26 @@ function setBatch(value: boolean) {
// if (totalCount.value === 0)
// return
batch.value = value
batch.value = value;
if (value === false) {
taskDetailInfo.value.checked = false
selectItems.value = []
taskDetailInfo.value.checked = false;
selectItems.value = [];
taskDetailPictureList.value.forEach((item) => {
item.checked = false
})
item.checked = false;
});
}
}
// storeid
function currentTaskId() {
const index = taskStore.getCurrentIndex
return taskStore.getApprovalList[index]?.id || ''
const index = taskStore.getCurrentIndex;
return taskStore.getApprovalList[index]?.id || "";
}
// states:1234
function validate(items: any[]) {
if (items.length === 0)
return '至少选中一个任务'
if (items.length === 0) return "至少选中一个任务";
// const useInfo = userStore.getUserInfo
// const username = useInfo.loginname
@ -144,131 +148,129 @@ function validate(items: any[]) {
// return ''
// }
return null
return null;
}
function approvalHandler(items?: any) {
let cloneItem: any
let cloneItem: any;
if (batch.value) {
processItems = selectItems.value
}
else if (overTask.value) {
cloneItem = clone(overTask.value)
processItems = [cloneItem]
processItems = selectItems.value;
} else if (overTask.value) {
cloneItem = clone(overTask.value);
processItems = [cloneItem];
}
if (items !== undefined && !(items instanceof PointerEvent))
processItems = items
processItems = items;
const msg = validate(processItems)
const msg = validate(processItems);
if (msg !== null) {
message.error(msg)
return
message.error(msg);
return;
}
console.log(processItems)
console.log(processItems);
const list: any = []
const list: any = [];
processItems.forEach((item) => {
list.push({
formId: item.id,
taskId: item.taskId,
taskName: item.fromTaskName,
})
})
});
});
const param = {
result: true,
comment: '',
disposeType: '',
disposeTypeId: '',
failCauseId: '',
failCauseName: '',
comment: "",
disposeType: "",
disposeTypeId: "",
failCauseId: "",
failCauseName: "",
flowTaskInfoList: list,
}
};
dialog.info({
title: '确认提示',
content: '确认给该任务审批为【通过】吗?',
positiveText: '确定',
negativeText: '取消',
title: "确认提示",
content: "确认给该任务审批为【通过】吗?",
positiveText: "确定",
negativeText: "取消",
onPositiveClick: () => {
doAudit(param)
doAudit(param);
},
onNegativeClick: () => {},
})
});
}
function rejectHandler(items?: any) {
const modal = unref(notPassModalRef)! as any
modal.showModal(items)
const modal = unref(notPassModalRef)! as any;
modal.showModal(items);
}
function singleRejectHandler() {
const modal = unref(notPassModalRef)! as any
modal.showModal([taskDetailInfo.value])
const modal = unref(notPassModalRef)! as any;
modal.showModal([taskDetailInfo.value]);
}
function doAudit(param: any) {
audit(param).then((res) => {
const { code } = res
if (code === 'OK') {
message.success(res.message)
setBatch(false)
reloadList(param, '通过')
batchModalRef.value.reload()
const { code } = res;
if (code === "OK") {
message.success(res.message);
setBatch(false);
reloadList(param, "通过");
batchModalRef.value.reload();
}
})
});
}
function showModal(modalRef: any) {
const modal = unref(modalRef)! as any
modal.showModal(taskId.value)
const modal = unref(modalRef)! as any;
modal.showModal(taskId.value);
}
function forwardHandler() {
taskStore.forward()
taskStore.forward();
}
function backHandler() {
taskStore.back()
taskStore.back();
}
async function handleDragEnd(event, item) {
//
const flag = taskStore.getInFile
const flag = taskStore.getInFile;
if (flag) {
const res = await dubiousfileyd({ pictureid: item.pictureId })
if (res.code === 'OK') {
message.success('加入成功')
setBatch(false)
getTableData()
getImgList()
}
else {
message.error(res.message)
const res = await dubiousfileyd({ pictureid: item.pictureId });
if (res.code === "OK") {
message.success("加入成功");
setBatch(false);
getTableData();
getImgList();
} else {
message.error(res.message);
}
taskStore.setInFile(false)
taskStore.setInFile(false);
}
}
async function getTableData() {
const useInfo = userStore.getUserInfo
const listData = []
const reviewType = 3 //
let res = await getAllfieldList(reviewType)
const fieldList = (res as any)?.data
res = await getfieldList(reviewType, useInfo.id)
const userFieldList = (res as any)?.data.userFieldFixed
const useInfo = userStore.getUserInfo;
const listData = [];
const reviewType = 3; //
let res = await getAllfieldList(reviewType);
const fieldList = (res as any)?.data;
res = await getfieldList(reviewType, useInfo.id);
const userFieldList = (res as any)?.data.userFieldFixed;
const blueList = [
'拜访终端名称',
'定位信息',
'拜访日期',
'定位距离',
'拜访小结',
'拜访项目类别',
]
"拜访终端名称",
"定位信息",
"拜访日期",
"定位距离",
"拜访小结",
"拜访项目类别",
];
fieldList.map((v) => {
if (userFieldList.includes(v.name)) {
const item = {
@ -276,11 +278,11 @@ async function getTableData() {
value: taskDetailInfo.value.ocrPicture[v.name],
key: v.name,
blue: blueList.includes(v.fieldDesc),
};
listData.push(item);
}
listData.push(item)
}
})
taskTableData.value = chunk(listData, 2)
});
taskTableData.value = chunk(listData, 2);
}
async function getImgList() {
@ -289,98 +291,97 @@ async function getImgList() {
...taskpagination,
...sortBy,
pictureId: taskDetailInfo.value.ocrPicture.id,
})
taskDetailPictureList.value = data
totalCount.value = total
}
else {
taskDetailPictureList.value.length = 0
totalCount.value = 0
});
taskDetailPictureList.value = data;
totalCount.value = total;
} else {
taskDetailPictureList.value.length = 0;
totalCount.value = 0;
}
}
function overTaskHandle() {
const item = taskDetailInfo.value
const item = taskDetailInfo.value;
if (item?.userapprove?.statshis === 2 || item?.userapprove?.statshis == 3) {
overTask.value = null
return
overTask.value = null;
return;
}
if (validate([item]) == null && batch.value === false)
overTask.value = item
if (validate([item]) == null && batch.value === false) overTask.value = item;
}
function leaveTaskHandler() {
overTask.value = null
overTask.value = null;
}
function showActionsModal() {
const modal = unref(CustomSettingModalRef)! as any
modal.showModal()
const modal = unref(CustomSettingModalRef)! as any;
modal.showModal();
}
onUnmounted(() => {
taskStore.reset()
window.removeEventListener('keydown', handleKeydown)
})
taskStore.reset();
window.removeEventListener("keydown", handleKeydown);
});
function immersionHandler() {
// taskStore.updateImmersion()
toggleFullScreen()
toggleFullScreen();
}
//
function toggleFullScreen() {
isFullScreen.value = !isFullScreen.value
isFullScreen.value = !isFullScreen.value;
}
function previewHandler(event: MouseEvent) {
event.stopImmediatePropagation()
event.stopPropagation()
event.stopImmediatePropagation();
event.stopPropagation();
if (imageRef.value && (imageRef.value as any).src)
(imageRef.value as any).mergedOnClick()
(imageRef.value as any).mergedOnClick();
}
watch(
() => [taskStore.activeId],
() => {
if (!isEmpty(taskStore.getActiveId)) {
packageId.value = taskStore.getPackageid
taskId.value = taskStore.getActiveId
getDetail()
packageId.value = taskStore.getPackageid;
taskId.value = taskStore.getActiveId;
getDetail();
}
},
)
}
);
//
async function getDetail() {
taskDetailInfo.value = await getTaskDetailInfo(taskId.value, packageId.value)
setBatch(false)
getTableData()
getImgList()
taskDetailInfo.value = await getTaskDetailInfo(taskId.value, packageId.value);
setBatch(false);
getTableData();
getImgList();
}
function notPassSuccess(param) {
batchModalRef.value.reload()
reloadList(param, '不通过')
batchModalRef.value.reload();
reloadList(param, "不通过");
}
function reloadList(param, text) {
//
const id = currentTaskId()
const hasCurrentId = param.flowTaskInfoList.find(item => item.formId === id)
finalStore.setListKey()
if (hasCurrentId)
emit('setAsideItemName', text)
const id = currentTaskId();
const hasCurrentId = param.flowTaskInfoList.find(
(item) => item.formId === id
);
finalStore.setListKey();
if (hasCurrentId) emit("setAsideItemName", text);
getDetail()
getDetail();
}
function goBack() {
router.back()
router.back();
}
function switchBatch() {
setBatch(!batch.value)
setBatch(!batch.value);
}
</script>
@ -390,8 +391,18 @@ function switchBatch() {
<div class="left">
<span class="font">任务ID{{ taskDetailInfo.fromtaskname }}</span>
<template v-if="!isDetail">
<SvgIcon size="22" class="forward" name="arrow-left" @click="backHandler" />
<SvgIcon size="22" class="back" name="arrow-right" @click="forwardHandler" />
<SvgIcon
size="22"
class="forward"
name="arrow-left"
@click="backHandler"
/>
<SvgIcon
size="22"
class="back"
name="arrow-right"
@click="forwardHandler"
/>
</template>
</div>
<div v-if="!isDetail" class="right">
@ -426,8 +437,20 @@ function switchBatch() {
</ul>
</n-popover> -->
<div class="icon-wrap">
<SvgIcon v-if="isFullScreen" size="20" name="power-off" style="cursor: pointer;" @click="immersionHandler" />
<SvgIcon v-else size="20" name="immersion-model" style="cursor: pointer;" @click="immersionHandler" />
<SvgIcon
v-if="isFullScreen"
size="20"
name="power-off"
style="cursor: pointer"
@click="immersionHandler"
/>
<SvgIcon
v-else
size="20"
name="immersion-model"
style="cursor: pointer"
@click="immersionHandler"
/>
</div>
</div>
<div v-show="showActions" class="batch">
@ -442,14 +465,14 @@ function switchBatch() {
src="@/assets/images/task/btn-not-pass.png"
alt=""
@click.stop="rejectHandler(selectItems)"
>
/>
<SvgIcon size="24" name="vs" />
<img
class="btn-approval"
src="@/assets/images/task/btn-pass.png"
alt=""
@click.stop="approvalHandler"
>
/>
</div>
</div>
<div v-else class="right">
@ -502,19 +525,27 @@ function switchBatch() {
class="img-status"
src="@/assets/images/task/pass.png"
alt=""
>
/>
<img
v-show="taskDetailInfo?.userapprove?.statshis === 3"
class="img-status"
src="@/assets/images/task/not_pass.png"
alt=""
>
/>
</div>
<div class="mark">
<SvgIcon v-show="taskDetailInfo?.iztrueorfalse === 0" size="128" name="jia" />
<SvgIcon
v-show="taskDetailInfo?.iztrueorfalse === 0"
size="128"
name="jia"
/>
</div>
<div class="mark">
<SvgIcon v-show="taskDetailInfo?.iztrueorfalse === 1" size="128" name="zhen" />
<SvgIcon
v-show="taskDetailInfo?.iztrueorfalse === 1"
size="128"
name="zhen"
/>
</div>
<div class="big-mark" />
<div class="preview" @click="previewHandler">
@ -524,7 +555,11 @@ function switchBatch() {
<n-grid x-gap="12" y-gap="10" :cols="12">
<n-gi span="4" class="gi1">
<span>
<img class="icon-status" src="@/assets/images/task/status.png" alt="">
<img
class="icon-status"
src="@/assets/images/task/status.png"
alt=""
/>
</span>
</n-gi>
<n-gi span="8" class="gi2">
@ -539,23 +574,47 @@ function switchBatch() {
class="icon-status"
src="@/assets/images/task/similarity.png"
alt=""
>
/>
</span>
</n-gi>
<n-gi span="8" class="gi2">
<span class="value num">{{ totalCount }}<span class="unit"></span> </span>
<span class="value num"
>{{ totalCount }}<span class="unit"></span>
</span>
<span class="label">相似匹配</span>
</n-gi>
</n-grid>
</div>
<div class="time">
<div class="time-item">
<SvgIcon class="svg-time" color="#FFF" size="16" name="camera-time" />
<span>{{ taskDetailInfo?.ocrPicture?.photoDateTimestamp ? formatToDateHMS(Number(taskDetailInfo.ocrPicture.photoDateTimestamp)) : '-' }}</span>
<SvgIcon
class="svg-time"
color="#FFF"
size="16"
name="camera-time"
/>
<span>{{
taskDetailInfo?.ocrPicture?.photoDateTimestamp
? formatToDateHMS(
Number(taskDetailInfo.ocrPicture.photoDateTimestamp)
)
: "-"
}}</span>
</div>
<div class="time-item time-item2">
<SvgIcon class="svg-time" color="#FFF" size="16" name="submit-time" />
<span>{{ taskDetailInfo?.ocrPicture?.submitDateTimestamp ? formatToDateHMS(Number(taskDetailInfo.ocrPicture.submitDateTimestamp)) : '-' }}</span>
<SvgIcon
class="svg-time"
color="#FFF"
size="16"
name="submit-time"
/>
<span>{{
taskDetailInfo?.ocrPicture?.submitDateTimestamp
? formatToDateHMS(
Number(taskDetailInfo.ocrPicture.submitDateTimestamp)
)
: "-"
}}</span>
</div>
</div>
<div style="display: none">
@ -579,15 +638,23 @@ function switchBatch() {
/>
</div>
<div class="list">
<div v-for="item in taskDetailPictureList" :key="item.id" class="item" draggable="true" @dragend="
<div
v-for="item in taskDetailPictureList"
:key="item.id"
class="item"
draggable="true"
@dragend="
(event) => {
handleDragEnd(event, item);
}
">
"
>
<div
draggable="true"
class="img-wrapper"
:style="{ 'background-image': `url(${item.serverThumbnailUrl})` }"
:style="{
'background-image': `url(${item.serverThumbnailUrl})`,
}"
@dragend="
(event) => {
handleDragEnd(event, item);
@ -609,21 +676,39 @@ function switchBatch() {
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 class="time-item">
<SvgIcon class="svg-time" color="#FFF" size="8" name="camera-time" />
<span>{{ item.photoDateTimestamp ? formatToDateHMS(Number(item.photoDateTimestamp)) : '-' }}</span>
<SvgIcon
class="svg-time"
color="#FFF"
size="8"
name="camera-time"
/>
<span>{{
item.photoDateTimestamp
? formatToDateHMS(Number(item.photoDateTimestamp))
: "-"
}}</span>
</div>
<div class="time-item time-item2">
<SvgIcon class="svg-time" color="#FFF" size="8" name="submit-time" />
<span>{{ item.submitDateTimestamp ? formatToDateHMS(Number(item.submitDateTimestamp)) : '-' }}</span>
<SvgIcon
class="svg-time"
color="#FFF"
size="8"
name="submit-time"
/>
<span>{{
item.submitDateTimestamp
? formatToDateHMS(Number(item.submitDateTimestamp))
: "-"
}}</span>
</div>
</div>
<div
@ -655,10 +740,7 @@ function switchBatch() {
<History :data="taskDetailInfo" />
</n-tab-pane>
</n-tabs>
<NotPassed
ref="notPassModalRef"
@success="notPassSuccess"
/>
<NotPassed ref="notPassModalRef" @success="notPassSuccess" />
<BatchModal
ref="batchModalRef"
@reject="rejectHandler"
@ -846,7 +928,7 @@ function switchBatch() {
z-index: 3;
width: 30px;
height: 30px;
background: rgba(255, 255, 255, 0.20);
background: rgba(255, 255, 255, 0.2);
border-radius: 6px;
backdrop-filter: blur(10px);
display: flex;
@ -916,7 +998,10 @@ function switchBatch() {
z-index: 3;
left: 16px;
bottom: 16px;
padding-left: 10px;
width: 195px;
background: rgba(216, 216, 216, 0.4);
border-radius: 7px;
.time-item {
display: flex;
align-items: center;
@ -1032,6 +1117,10 @@ function switchBatch() {
z-index: 3;
left: 3px;
bottom: 3px;
width: 98%;
background: rgba(216, 216, 216, 0.4);
border-radius: 7px;
.time-item {
display: flex;
align-items: center;

Loading…
Cancel
Save