feat: 任务审批自定义字段逻辑修改及图审主图ui修改 #165

Merged
liushilong merged 1 commits from feat/ui_task_update into test 1 year ago

@ -1,10 +1,12 @@
<script lang="ts" setup>
import { cloneDeep, difference } from 'lodash-es'
import { computed, defineEmits, defineProps, onMounted, ref, watch } from 'vue'
import { VueDraggable } from 'vue-draggable-plus'
import { getAllfieldList, getfieldList, savefield } from '@/api/home/filter'
import { workPackageMap } from '@/config/workorder'
import { useUser } from '@/store/modules/user'
import { cloneDeep, difference } from "lodash-es";
import { computed, defineEmits, defineProps, onMounted, ref, watch } from "vue";
import { VueDraggable } from "vue-draggable-plus";
import { getAllfieldList, getfieldList, savefield } from "@/api/home/filter";
import { workPackageMap } from "@/config/workorder";
import { useUser } from "@/store/modules/user";
import { useMessage } from "naive-ui";
const message = useMessage();
const props = defineProps({
reviewType: {
@ -12,355 +14,344 @@ const props = defineProps({
default: () => 1,
require: true,
},
})
});
const emit = defineEmits(['onOk'])
const emit = defineEmits(["onOk"]);
//
const offList = ref<any[]>([])
const offList = ref<any[]>([]);
//
const onList = ref<any[]>([])
const onList = ref<any[]>([]);
//
const fixList = ref<any[]>([])
const fixList = ref<any[]>([]);
const offShowList = ref<any[]>([])
const onShowList = ref<any[]>([])
const fixShowList = ref<any[]>([])
const offShowList = ref<any[]>([]);
const onShowList = ref<any[]>([]);
const fixShowList = ref<any[]>([]);
const allCount = computed(() => {
return `全部字段(共${offList.value.length - 1}个)`
})
return `全部字段(共${offList.value.length - 1}个)`;
});
const selectCount = computed(() => {
return `显示字段(共${onList.value.length}个)`
})
return `显示字段(共${onList.value.length}个)`;
});
function generatList() {
const keys = Object.keys(workPackageMap)
let showList: object[] = []
const hideList: object[] = []
const showStr = 'status'
const showKeys = showStr.split(',').map((key: string) => key.toLowerCase())
const keys = Object.keys(workPackageMap);
let showList: object[] = [];
const hideList: object[] = [];
const showStr = "status";
const showKeys = showStr.split(",").map((key: string) => key.toLowerCase());
for (const key of keys) {
const name = workPackageMap[key]?.label
const isDefault = workPackageMap[key]?.isDefault
const name = workPackageMap[key]?.label;
const isDefault = workPackageMap[key]?.isDefault;
// Y
if (!isDefault) {
hideList.push({
id: key,
name: name || '未配置',
name: name || "未配置",
fix: isDefault,
checked: workPackageMap[key].isDefault,
})
});
}
}
showList = showKeys.reduce((acc, key) => {
const config = {
id: key,
name: workPackageMap[key].label || '未配置',
name: workPackageMap[key].label || "未配置",
fix: workPackageMap[key].isDefault,
}
return [...acc, config]
}, [])
};
return [...acc, config];
}, []);
const fixedList = generateDefaultList()
const fixedList = generateDefaultList();
hideList.unshift(...fixedList)
showList.unshift(...fixedList)
hideList.unshift(...fixedList);
showList.unshift(...fixedList);
onList.value = showList
offList.value = hideList
return { showList, hideList }
onList.value = showList;
offList.value = hideList;
return { showList, hideList };
}
function generateDefaultList() {
return Object.keys(workPackageMap).reduce((acc, key) => {
const { label, isDefault } = workPackageMap[key]
const { label, isDefault } = workPackageMap[key];
if (isDefault) {
const config = {
id: key,
name: label || '未配置',
name: label || "未配置",
fix: true,
checked: true,
}
return [...acc, config]
}
else {
return acc
};
return [...acc, config];
} else {
return acc;
}
}, [])
}, []);
}
const show = ref(false)
const show = ref(false);
const checkAll = computed(() => {
let baseNum = 0
let baseNum = 0;
offList.value.map((v) => {
if (v.fix)
baseNum += 1
})
return onList.value.length == offList.value.length - baseNum
})
if (v.fix) baseNum += 1;
});
return onList.value.length == offList.value.length - baseNum;
});
function showModal() {
show.value = true
show.value = true;
}
function closeModal() {
show.value = false
show.value = false;
}
async function handleSumbit(e: MouseEvent) {
const userStore = useUser()
const userInfo = userStore.getUserInfo
let userFieldFixed = ''
const userStore = useUser();
const userInfo = userStore.getUserInfo;
let userFieldFixed = "";
fixList.value.map((v) => {
userFieldFixed += `${v.id},`
})
userFieldFixed += `${v.id},`;
});
onList.value.map((v) => {
userFieldFixed += `${v.id},`
})
userFieldFixed = userFieldFixed.slice(0, userFieldFixed.length - 1)
savefield(props.reviewType, userInfo.id, userFieldFixed)
e.preventDefault()
closeModal()
emit('onOk')
userFieldFixed += `${v.id},`;
});
userFieldFixed = userFieldFixed.slice(0, userFieldFixed.length - 1);
savefield(props.reviewType, userInfo.id, userFieldFixed);
e.preventDefault();
closeModal();
emit("onOk");
}
defineExpose({
showModal,
})
});
// generatList();
const selectIds = ref<string[]>([])
const selectIds = ref<string[]>([]);
function onCheckAllChange(value) {
const ids: string[] = []
const ids: string[] = [];
for (const item of offList.value) {
if (!item.fix) {
item.checked = value
ids.push(item.id)
item.checked = value;
ids.push(item.id);
}
}
for (const item of offShowList.value) {
if (!item.fix)
item.checked = value
if (!item.fix) item.checked = value;
}
selectIds.value = value ? ids : []
selectIds.value = value ? ids : [];
if (value) {
offList.value.map((v) => {
if (!v.checked)
onList.value.push(v)
})
onShowList.value = cloneDeep(onList.value)
}
else {
onList.value = []
onShowList.value = []
if (!v.checked) onList.value.push(v);
});
onShowList.value = cloneDeep(onList.value);
} else {
onList.value = [];
onShowList.value = [];
}
}
function onCheckChange(checked: any, item: any) {
const index = selectIds.value.indexOf(item.id)
item.checked = checked
const currentIndex = offList.value.findIndex(v => v.id == item.id)
offList.value[currentIndex].checked = checked
if (index === -1 && checked)
selectIds.value.push(item.id)
else
selectIds.value.splice(index, 1)
const index = selectIds.value.indexOf(item.id);
if (index == -1 && selectIds.value.length >= 6) {
item.checked = false;
message.error("自定义任务卡片字段一共勾选数量不能超过6个");
return;
}
item.checked = checked;
const currentIndex = offList.value.findIndex((v) => v.id == item.id);
offList.value[currentIndex].checked = checked;
if (index === -1 && checked) {
selectIds.value.push(item.id);
} else {
selectIds.value.splice(index, 1);
}
}
const showIds = computed(() => {
return onList.value.map((item) => {
return item.id
})
})
return item.id;
});
});
watch(
() => selectIds.value.length,
(newVal, oldVal) => {
if (newVal === oldVal)
return
if (newVal === oldVal) return;
const action = newVal > oldVal ? 'add' : 'remove'
const diff
= action === 'add'
const action = newVal > oldVal ? "add" : "remove";
const diff =
action === "add"
? difference(selectIds.value, showIds.value)
: difference(showIds.value, selectIds.value)
: difference(showIds.value, selectIds.value);
if (diff.length === 0)
return
if (diff.length === 0) return;
if (action === 'add') {
if (action === "add") {
for (const item of offList.value) {
if (!item.fix && diff.includes(item.id)) {
onList.value.push({
id: item.id,
name: item.name || '未配置',
name: item.name || "未配置",
fix: item.fix || false,
})
});
}
}
onShowList.value = cloneDeep(onList.value)
}
else {
const list = onList.value
onShowList.value = cloneDeep(onList.value);
} else {
const list = onList.value;
for (let index = 0; index < list.length; index++) {
const item = list[index]
const item = list[index];
if (!item.fix && diff.includes(item.id)) {
list.splice(index, 1)
onShowList.value.splice(index, 1)
index--
list.splice(index, 1);
onShowList.value.splice(index, 1);
index--;
}
}
console.log(onShowList.value, list, 'onShowList')
console.log(onShowList.value, list, "onShowList");
}
},
)
}
);
watch(
() => showIds.value.length,
(newVal, oldVal) => {
if (newVal === oldVal)
return
if (newVal === oldVal) return;
const diff = difference(selectIds.value, showIds.value)
const diff = difference(selectIds.value, showIds.value);
if (diff.length === 0)
return
if (diff.length === 0) return;
for (const item of offList.value) {
if (!item.fix && diff.includes(item.id)) {
const index = selectIds.value.indexOf(item.id)
item.checked = false
selectIds.value.splice(index, 1)
const index = selectIds.value.indexOf(item.id);
item.checked = false;
selectIds.value.splice(index, 1);
}
}
},
)
}
);
function clearDragSource() {
onList.value = onList.value.filter((item) => {
return item.fix === true
})
onShowList.value = cloneDeep(onList.value)
return item.fix === true;
});
onShowList.value = cloneDeep(onList.value);
}
function removeHandler(id: string) {
let index = onList.value.findIndex((item) => {
return item.id === id
})
return item.id === id;
});
if (index !== -1) {
onList.value.splice(index, 1)
onShowList.value.splice(index, 1)
onList.value.splice(index, 1);
onShowList.value.splice(index, 1);
}
index = offList.value.findIndex(v => v.id == id)
offList.value[index].checked = false
offShowList.value = cloneDeep(offList.value)
index = offList.value.findIndex((v) => v.id == id);
offList.value[index].checked = false;
offShowList.value = cloneDeep(offList.value);
}
function initData() {
offList.value = []
onList.value = []
fixList.value = []
offShowList.value = []
onShowList.value = []
fixShowList.value = []
selectIds.value = []
offList.value = [];
onList.value = [];
fixList.value = [];
offShowList.value = [];
onShowList.value = [];
fixShowList.value = [];
selectIds.value = [];
}
async function getData(type = '') {
initData()
const userStore = useUser()
const userInfo = userStore.getUserInfo
let res
res = await getAllfieldList(props.reviewType) //
const allList = res.data
res = await getfieldList(props.reviewType, userInfo.id) //
const useList = res.data
async function getData(type = "") {
initData();
const userStore = useUser();
const userInfo = userStore.getUserInfo;
let res;
res = await getAllfieldList(props.reviewType); //
const allList = res.data;
res = await getfieldList(props.reviewType, userInfo.id); //
const useList = res.data;
/**
* name 标题
* id 键值
* fix 是否默认
* checked 是否选中
*/
const userFieldFixed = useList?.userFieldFixed?.split(',')
const userFieldUnFixed = useList?.userFieldUnFixed?.split(',')
if (!type || type == 'off') {
offList.value = []
const userFieldFixed = useList?.userFieldFixed?.split(",");
const userFieldUnFixed = useList?.userFieldUnFixed?.split(",");
if (!type || type == "off") {
offList.value = [];
allList?.map((v) => {
const item = {
name: v.fieldDesc,
id: v.name,
fix: v.isrequired == 2,
checked:
v.isrequired == 2
|| Boolean(userFieldFixed?.find(v2 => v2 == v.name))
|| Boolean(userFieldUnFixed?.find(v2 => v2 == v.name)),
}
if (item.fix)
fixList.value.push(item)
else
offList.value.push(item)
})
offList.value.unshift(...fixList.value)
v.isrequired == 2 ||
Boolean(userFieldFixed?.find((v2) => v2 == v.name)) ||
Boolean(userFieldUnFixed?.find((v2) => v2 == v.name)),
};
if (item.fix) fixList.value.push(item);
else offList.value.push(item);
});
offList.value.unshift(...fixList.value);
}
if (!type || type == 'on') {
useList?.userFieldFixed?.split(',').map((v) => {
let item = allList.find(v2 => v2.name == v)
if (!type || type == "on") {
useList?.userFieldFixed?.split(",").map((v) => {
let item = allList.find((v2) => v2.name == v);
if (item) {
item = {
name: item.fieldDesc,
id: item.name,
fix: item.isrequired == 2,
checked: true,
}
selectIds.value.push(item.id)
if (!item.fix)
onList.value.push(item)
};
selectIds.value.push(item.id);
if (!item.fix) onList.value.push(item);
}
})
});
}
offShowList.value = cloneDeep(offList.value)
fixShowList.value = cloneDeep(fixList.value)
onShowList.value = cloneDeep(onList.value)
offShowList.value = cloneDeep(offList.value);
fixShowList.value = cloneDeep(fixList.value);
onShowList.value = cloneDeep(onList.value);
}
onMounted(() => getData())
onMounted(() => getData());
const indeterminate = computed(() => {
let baseNum = 0
let baseNum = 0;
offList.value.map((v) => {
if (v.fix)
baseNum += 1
})
if (v.fix) baseNum += 1;
});
return (
onShowList.value.length > 0
&& offShowList.value.length - baseNum > onShowList.value.length
)
})
onShowList.value.length > 0 &&
offShowList.value.length - baseNum > onShowList.value.length
);
});
function queryData(value, type) {
if (value) {
if (type == 'off') {
offShowList.value = offList.value.filter(item => item.name.includes(value))
if (type == "off") {
offShowList.value = offList.value.filter((item) => item.name.includes(value));
} else {
onShowList.value = onList.value.filter((item) => item.name.includes(value));
fixShowList.value = fixList.value.filter((item) => item.name.includes(value));
}
else {
onShowList.value = onList.value.filter(item => item.name.includes(value))
fixShowList.value = fixList.value.filter(item => item.name.includes(value))
}
}
else {
} else {
// getData(type);
if (type == 'off') {
offShowList.value = cloneDeep(offList.value)
}
else {
onShowList.value = cloneDeep(onList.value)
fixShowList.value = cloneDeep(fixList.value)
if (type == "off") {
offShowList.value = cloneDeep(offList.value);
} else {
onShowList.value = cloneDeep(onList.value);
fixShowList.value = cloneDeep(fixList.value);
}
}
}
@ -449,9 +440,7 @@ function queryData(value, type) {
<SvgIcon size="14px" name="magnifying-1" />
</template>
</n-input>
<div class="draggable-title">
系统默认
</div>
<div class="draggable-title">系统默认</div>
<div class="draggable-ul" style="border-bottom: none">
<div
v-for="item in fixShowList"
@ -462,9 +451,7 @@ function queryData(value, type) {
<span class="ml-2">{{ item.name }}</span>
</div>
</div>
<div class="draggable-title" style="border-top: none">
自定义配置
</div>
<div class="draggable-title" style="border-top: none">自定义配置</div>
<VueDraggable
v-model="onList"
class="draggable-ul"
@ -495,10 +482,15 @@ function queryData(value, type) {
</div>
<template #footer>
<div class="wrapper-footer">
<n-button type="info" @click="handleSumbit">
确定
</n-button>
<n-button secondary style="margin-left: 15px" @click="getData();closeModal()">
<n-button type="info" @click="handleSumbit"> </n-button>
<n-button
secondary
style="margin-left: 15px"
@click="
getData();
closeModal();
"
>
取消
</n-button>
</div>

@ -1,83 +1,88 @@
<script lang="ts" setup>
import { audit } from '@/api/task/task'
import { getPictureSimilarityList, getTaskDetailInfo } from '@/api/work/work'
import NotPassed from '@/components/Approval/NotPassed.vue'
import { TASK_STATUS_OBJ } from '@/enums/index'
import { useWorkOrder } from '@/store/modules/workOrder'
import { isEmpty } from '@/utils'
import { formatToDateHMS } from '@/utils/dateUtil'
import { hideDownload } from '@/utils/image'
import emitter from '@/utils/mitt'
import { useInfiniteScroll } from '@vueuse/core'
import { format } from 'date-fns'
import imagesloaded from 'imagesloaded'
import { clone, cloneDeep, debounce, pickBy } from 'lodash-es'
import { useDialog, useMessage } from 'naive-ui'
import { computed, onMounted, onUnmounted, onUpdated, reactive, ref, unref, watch } from 'vue'
import PictureInfo from '../components/PictureInfo.vue'
import ConfrimModal from '../modal/ConfrimModal.vue'
import type { ApprovalParam, SimilarityPictureSortParam } from '/#/api'
const batch = ref(false) //
const selectItems = ref<any[]>([])
const message = useMessage()
const dialog = useDialog()
const totalCount = ref(0)
let _imagesload: any
import { audit } from "@/api/task/task";
import { getPictureSimilarityList, getTaskDetailInfo } from "@/api/work/work";
import NotPassed from "@/components/Approval/NotPassed.vue";
import { TASK_STATUS_OBJ } from "@/enums/index";
import { useWorkOrder } from "@/store/modules/workOrder";
import { isEmpty } from "@/utils";
import { formatToDateHMS } from "@/utils/dateUtil";
import { hideDownload } from "@/utils/image";
import emitter from "@/utils/mitt";
import { useInfiniteScroll } from "@vueuse/core";
import { format } from "date-fns";
import imagesloaded from "imagesloaded";
import { clone, cloneDeep, debounce, pickBy } from "lodash-es";
import { useDialog, useMessage } from "naive-ui";
import {
computed,
onMounted,
onUnmounted,
onUpdated,
reactive,
ref,
unref,
watch,
} from "vue";
import PictureInfo from "../components/PictureInfo.vue";
import ConfrimModal from "../modal/ConfrimModal.vue";
import type { ApprovalParam, SimilarityPictureSortParam } from "/#/api";
const batch = ref(false); //
const selectItems = ref<any[]>([]);
const message = useMessage();
const dialog = useDialog();
const totalCount = ref(0);
let _imagesload: any;
function setBatch(value: boolean) {
if (value && batch.value)
batch.value = !value
else
batch.value = value
if (value && batch.value) batch.value = !value;
else batch.value = value;
if (value === false) {
selectItems.value.forEach(item => (item.checked = false))
selectItems.value.length = 0
selectItems.value.forEach((item) => (item.checked = false));
selectItems.value.length = 0;
}
}
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: 10,
})
});
const sortBy: SimilarityPictureSortParam = {
orderType: 'desc',
orderName: 'similarityScore',
}
const workStore = useWorkOrder()
const selectTask = ref<any>(null)
const overTask = ref<any>(null)
const taskDetailInfo = ref<any>({})
const confrimModalRef = ref(null)
const imageRef = ref<ComponentElRef | null>()
const listData = ref<any[]>([])
const loading = ref(false)
const el = ref<HTMLDivElement | null>(null)
const selectedSortName = ref('')
const isFullScreen = ref(false)
const notPassModalRef = ref(null)
const mainImageModalRef = ref(null)
const wrapperListRef = ref<HTMLElement | undefined>(undefined)
let canloadMore = true
let processItems: any[] = []
orderType: "desc",
orderName: "similarityScore",
};
const workStore = useWorkOrder();
const selectTask = ref<any>(null);
const overTask = ref<any>(null);
const taskDetailInfo = ref<any>({});
const confrimModalRef = ref(null);
const imageRef = ref<ComponentElRef | null>();
const listData = ref<any[]>([]);
const loading = ref(false);
const el = ref<HTMLDivElement | null>(null);
const selectedSortName = ref("");
const isFullScreen = ref(false);
const notPassModalRef = ref(null);
const mainImageModalRef = ref(null);
const wrapperListRef = ref<HTMLElement | undefined>(undefined);
let canloadMore = true;
let processItems: any[] = [];
function validate(items: any[]) {
if (items.length === 0)
return '至少选中一个任务'
if (items.length === 0) return "至少选中一个任务";
// for (const item of items) {
// const { iztrueorfalse, history, states } = item
@ -91,164 +96,160 @@ function validate(items: any[]) {
// return ''
// }
return null
return null;
}
function forwardHandler() {
workStore.forward()
workStore.forward();
}
function backHandler() {
workStore.back()
workStore.back();
}
function reset() {
taskpagination.pageNo = 0
taskpagination.pageSize = 20
listData.value.length = 0
loading.value = false
canloadMore = true
taskpagination.pageNo = 0;
taskpagination.pageSize = 20;
listData.value.length = 0;
loading.value = false;
canloadMore = true;
}
console.log(listData)
console.log(listData);
async function refreshHandler() {
reset()
reset();
useInfiniteScroll(
el as any,
() => {
loadMore()
loadMore();
},
{ distance: 10, canLoadMore: () => canloadMore },
)
{ distance: 10, canLoadMore: () => canloadMore }
);
}
async function loadMore() {
if (loading.value || el.value == null)
return
if (loading.value || el.value == null) return;
const more = await featchList()
listData.value.push(...more)
const more = await featchList();
listData.value.push(...more);
}
async function featchList() {
loading.value = true
loading.value = true;
try {
taskpagination.pageNo += 1
taskpagination.pageNo += 1;
const { data, total, pageCount } = await getPictureSimilarityList({
...taskpagination,
...sortBy,
checkDuplicateId: workStore.activeId,
pictureId: taskDetailInfo.value.id,
})
});
totalCount.value = total
canloadMore = pageCount >= taskpagination.pageNo && pageCount > 0
totalCount.value = total;
canloadMore = pageCount >= taskpagination.pageNo && pageCount > 0;
return data
}
catch (error) {
canloadMore = false
return []
return data;
} catch (error) {
canloadMore = false;
return [];
}
}
const layout = debounce(() => {
if (el.value == null)
return
if (el.value == null) return;
_imagesload = imagesloaded('.grid-item')
_imagesload = imagesloaded(".grid-item");
_imagesload.on('done', (instance) => {
if (!el.value)
return
loading.value = false
})
_imagesload.on("done", (instance) => {
if (!el.value) return;
loading.value = false;
});
_imagesload.on('fail', (instance) => {
message.error('图片错误')
loading.value = false
})
}, 300)
_imagesload.on("fail", (instance) => {
message.error("图片错误");
loading.value = false;
});
}, 300);
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" : "",
}));
//
function toggleFullScreen() {
isFullScreen.value = !isFullScreen.value
isFullScreen.value = !isFullScreen.value;
}
onUpdated(() => {
layout()
})
layout();
});
watch(
() => workStore.activeId,
async (newValue, oldValue) => {
const packageid = workStore.getActiveId
const packageid = workStore.getActiveId;
if (isEmpty(packageid)) {
listData.value.length = 0
totalCount.value = 0
taskDetailInfo.value = {}
return
listData.value.length = 0;
totalCount.value = 0;
taskDetailInfo.value = {};
return;
}
queryDetail(packageid)
queryDetail(packageid);
// const res = await getPackageTaskList(newValue, packagepagination);
// const { data } = res;
// taskList.value = data;
// if (taskList.value.length > 0) handleSelect(taskList.value[0]); //
},
)
}
);
const packageName = computed(() => {
const index = workStore.getCurrentIndex
return workStore.getOrderList[index]?.name || ''
})
const index = workStore.getCurrentIndex;
return workStore.getOrderList[index]?.name || "";
});
async function queryDetail(checkDuplicateId: any) {
taskDetailInfo.value = await getTaskDetailInfo(checkDuplicateId)
const packageid = workStore.getActiveId
taskDetailInfo.value = await getTaskDetailInfo(checkDuplicateId);
const packageid = workStore.getActiveId;
if (isEmpty(packageid)) {
listData.value.length = 0
totalCount.value = 0
return
listData.value.length = 0;
totalCount.value = 0;
return;
}
refreshHandler()
refreshHandler();
}
//
async function handleSelect(item: any) {
// taskDetailInfo.value = await getTaskDetailInfo(item.id)
const packageid = workStore.getActiveId
const packageid = workStore.getActiveId;
if (isEmpty(packageid)) {
listData.value.length = 0
totalCount.value = 0
listData.value.length = 0;
totalCount.value = 0;
}
// refreshHandler();
}
async function sortHandler(orderby: 'similarityScore' | 'createdate') {
selectedSortName.value = orderby
sortBy.orderName = orderby
sortBy.orderType = sortBy.orderType === 'asc' ? 'desc' : 'asc'
refreshHandler()
async function sortHandler(orderby: "similarityScore" | "createdate") {
selectedSortName.value = orderby;
sortBy.orderName = orderby;
sortBy.orderType = sortBy.orderType === "asc" ? "desc" : "asc";
refreshHandler();
}
const propertys = computed(() => {
const { ocrPicture } = taskDetailInfo.value
const { ocrPicture } = taskDetailInfo.value;
const v = pickBy(ocrPicture, (value, key: string) => {
return key.startsWith('field') && value !== null
})
return v
})
return key.startsWith("field") && value !== null;
});
return v;
});
function overTaskHandelr(item: any) {
// console.log(item, 'item')
// if (item?.historyStates === 2 || item?.historyStates == 3) {
@ -256,226 +257,232 @@ function overTaskHandelr(item: any) {
// 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 onEsc() {
if (isFullScreen.value && !(document.querySelector('.n-modal-container')))
isFullScreen.value = false
if (isFullScreen.value && !document.querySelector(".n-modal-container"))
isFullScreen.value = false;
}
const resizeImage = () => {
const container = document.querySelector(".image-container")!;
const containerWidth = container.offsetWidth;
const containerHeight = container.offsetHeight;
};
onUnmounted(() => {
workStore.reset()
document.removeEventListener('keydown', onEsc)
})
workStore.reset();
document.removeEventListener("keydown", onEsc);
});
onMounted(() => {
document.addEventListener('keydown', onEsc)
})
document.addEventListener("keydown", onEsc);
window.addEventListener("resize", resizeImage);
});
function immersionHandler() {
// class="wrapper"
// workStore.updateImmersion();
toggleFullScreen()
toggleFullScreen();
}
function showAction() {
const item = taskDetailInfo.value
if (item.historyStates === 2 || item.historyStates === 3)
return
const item = taskDetailInfo.value;
if (item.historyStates === 2 || item.historyStates === 3) return;
if (batch.value === false)
overTask.value = item
if (batch.value === false) overTask.value = item;
}
function hideAction() {
overTask.value = null
overTask.value = null;
}
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();
}
function rejectHandler() {
const modal = unref(notPassModalRef)! as any
modal.showModal(selectItems.value)
const modal = unref(notPassModalRef)! as any;
modal.showModal(selectItems.value);
}
function singleRejectHandler(item) {
const modal = unref(notPassModalRef)! as any
modal.showModal([item])
const modal = unref(notPassModalRef)! as any;
modal.showModal([item]);
}
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 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 : ['其他'],
}
taskname: isOther ? tasknames : ["其他"],
};
doAudit(param)
doAudit(param);
}
function handleRejectMainImage() {
const modal = unref(mainImageModalRef)! as any
const params = cloneDeep(taskDetailInfo.value)
params.id = params.taskchildpictureid
modal.showModal([params])
const modal = unref(mainImageModalRef)! as any;
const params = cloneDeep(taskDetailInfo.value);
params.id = params.taskchildpictureid;
modal.showModal([params]);
}
async function reloadDetailInfo() {
const packageid = workStore.getActiveId
taskDetailInfo.value = await getTaskDetailInfo(packageid)
const packageid = workStore.getActiveId;
taskDetailInfo.value = await getTaskDetailInfo(packageid);
}
function handleApproveMainImage(items?: any) {
let cloneItem: any
let cloneItem: any;
if (overTask.value) {
cloneItem = clone(overTask.value)
cloneItem.id = cloneItem.taskchildpictureid
processItems = [cloneItem]
cloneItem = clone(overTask.value);
cloneItem.id = cloneItem.taskchildpictureid;
processItems = [cloneItem];
}
const msg = validate(processItems)
const msg = validate(processItems);
if (msg !== null) {
message.error(msg)
return
message.error(msg);
return;
}
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: () => {
audit(param).then(async (res) => {
const { code } = res
if (code === 'OK') {
message.info(res.message)
const packageid = workStore.getActiveId
taskDetailInfo.value = await getTaskDetailInfo(packageid)
const { code } = res;
if (code === "OK") {
message.info(res.message);
const packageid = workStore.getActiveId;
taskDetailInfo.value = await getTaskDetailInfo(packageid);
} else {
message.error(res.message);
}
else { message.error(res.message) }
})
});
},
onNegativeClick: () => {},
})
});
}
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]
if (items !== undefined && !(items instanceof PointerEvent)) processItems = [items];
const msg = validate(processItems)
const msg = validate(processItems);
if (msg !== null) {
message.error(msg)
return
message.error(msg);
return;
}
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 doAudit(param: any) {
audit(param).then((res) => {
const { code } = res
setBatch(false)
if (code === 'OK') {
message.info(res.message)
emitter.emit('refresh')
refreshHandler()
const { code } = res;
setBatch(false);
if (code === "OK") {
message.info(res.message);
emitter.emit("refresh");
refreshHandler();
} else {
message.error(res.message);
}
else { message.error(res.message) }
})
});
}
function reloadList() {
setBatch(false)
refreshHandler()
setBatch(false);
refreshHandler();
}
function handleRejectdubiousfileyd() {
dialog.info({
title: '确认提示',
content: '确认将图片移入可疑文件夹吗?',
positiveText: '确定',
negativeText: '取消',
title: "确认提示",
content: "确认将图片移入可疑文件夹吗?",
positiveText: "确定",
negativeText: "取消",
onPositiveClick: () => {
audit(param).then(async (res) => {
const { code } = res
if (code === 'OK') {
const { code } = res;
if (code === "OK") {
dubiousfileyd(taskDetailInfo.value.pictureId).then(() => {
refreshHandler()
})
refreshHandler();
});
} else {
message.error(res.message);
}
else { message.error(res.message) }
})
});
},
onNegativeClick: () => { },
})
onNegativeClick: () => {},
});
}
defineExpose({
queryDetail,
})
});
</script>
<template>
@ -545,23 +552,28 @@ defineExpose({
</div>
<div class="time">
<SvgIcon color="#FFF" size="16" name="save" />
<span class="time-value">{{
taskDetailInfo?.submitDateTimestamp
? format(taskDetailInfo?.submitDateTimestamp, "yyyy-MM-dd HH:mm:ss")
: "-"
}}
<span class="time-value"
>{{
taskDetailInfo?.submitDateTimestamp
? format(taskDetailInfo?.submitDateTimestamp, "yyyy-MM-dd HH:mm:ss")
: "-"
}}
</span>
</div>
</div>
<div class="status">
<img
v-show="taskDetailInfo?.historyStates === 2" class="img-status" src="@/assets/images/task/pass.png"
v-show="taskDetailInfo?.historyStates === 2"
class="img-status"
src="@/assets/images/task/pass.png"
alt=""
>
/>
<img
v-show="taskDetailInfo?.historyStates === 3" class="img-status" src="@/assets/images/task/not_pass.png"
v-show="taskDetailInfo?.historyStates === 3"
class="img-status"
src="@/assets/images/task/not_pass.png"
alt=""
>
/>
</div>
<!-- 右下信息 -->
<div class="info img-info">
@ -572,7 +584,7 @@ defineExpose({
class="icon-status"
src="@/assets/images/task/status.png"
alt=""
>
/>
</span>
</n-gi>
<n-gi span="8" class="gi2">
@ -587,11 +599,12 @@ defineExpose({
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 class="value num"
>{{ totalCount }}<span class="unit"></span>
</span>
<span class="label">相似匹配</span>
</n-gi>
@ -610,10 +623,29 @@ defineExpose({
/>
</div>
<!-- 操作 -->
<div v-show="overTask && overTask.id === taskDetailInfo.id" class="action" @click.stop="hideAction">
<SvgIcon v-if="[1].includes(taskDetailInfo.historyStates)" style="cursor: pointer" name="t1" @click.stop="handleApproveMainImage" />
<SvgIcon v-if="[1].includes(taskDetailInfo.historyStates)" style="cursor: pointer; margin-left: 30px" name="t2" @click.stop="handleRejectMainImage" />
<SvgIcon v-if="[1, 2, 3].includes(taskDetailInfo.historyStates)" style="cursor: pointer; margin-left: 30px" name="t9" @click.stop="handleRejectdubiousfileyd" />
<div
v-show="overTask && overTask.id === taskDetailInfo.id"
class="action"
@click.stop="hideAction"
>
<SvgIcon
v-if="[1].includes(taskDetailInfo.historyStates)"
style="cursor: pointer"
name="t1"
@click.stop="handleApproveMainImage"
/>
<SvgIcon
v-if="[1].includes(taskDetailInfo.historyStates)"
style="cursor: pointer; margin-left: 30px"
name="t2"
@click.stop="handleRejectMainImage"
/>
<SvgIcon
v-if="[1, 2, 3].includes(taskDetailInfo.historyStates)"
style="cursor: pointer; margin-left: 30px"
name="t9"
@click.stop="handleRejectdubiousfileyd"
/>
</div>
</div>
<PictureInfo :task-detail-info="taskDetailInfo" />
@ -623,8 +655,14 @@ defineExpose({
>
<div>
<span
style="font-size: 18px; font-weight: Medium;color: #333333;font-family: PingFang SC, PingFang SC-Medium;"
>任务包图片</span>
style="
font-size: 18px;
font-weight: Medium;
color: #333333;
font-family: PingFang SC, PingFang SC-Medium;
"
>任务包图片</span
>
</div>
<div
style="
@ -711,7 +749,10 @@ defineExpose({
/>
</div>
<div class="percent" :class="{ 'percent-red': item?.maxSimilarity >= 100 }">
<SvgIcon size="42" :name="item.maxSimilarity == 100 ? 'error_tag' : 'tag'" />
<SvgIcon
size="42"
:name="item.maxSimilarity == 100 ? 'error_tag' : 'tag'"
/>
<div class="val">
{{ item?.maxSimilarity && Number(item?.maxSimilarity).toFixed(0)
}}<span class="percent-unit">%</span>
@ -725,25 +766,34 @@ defineExpose({
</div>
<div v-show="overTask && overTask.id === item.id" class="action">
<SvgIcon v-if="item.historyStates === 1" style="cursor: pointer" name="t1" @click.stop="approvalHandler" />
<SvgIcon
v-if="item.historyStates === 1"
style="cursor: pointer"
name="t1"
@click.stop="approvalHandler"
/>
<SvgIcon
v-if="[1, 3].includes(item.historyStates)"
style="cursor: pointer; margin-left: 40px"
name="t2"
@click.stop="singleRejectHandler(item)"
/>
<SvgIcon style="cursor: pointer; margin-left: 30px" name="t9" @click.stop="handleRejectdubiousfileyd" />
<SvgIcon
style="cursor: pointer; margin-left: 30px"
name="t9"
@click.stop="handleRejectdubiousfileyd"
/>
</div>
</div>
<n-back-top :listen-to="wrapperListRef" :bottom="220" :visibility-height="10">
<div
style="
width: 100px;
height: 40px;
line-height: 40px;
text-align: center;
font-size: 14px;
"
width: 100px;
height: 40px;
line-height: 40px;
text-align: center;
font-size: 14px;
"
>
回到顶部
</div>
@ -855,11 +905,14 @@ defineExpose({
.left {
flex: 0.6;
background-size: cover;
background-size: 632px 346px;
background-position: center;
background-repeat: no-repeat;
border-radius: 8px;
position: relative;
width: 632px;
height: 346px;
.preview {
position: absolute;
@ -1189,20 +1242,20 @@ defineExpose({
font-size: 14px;
.val {
position: absolute;
left: 0;
top: 0;
display: block;
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
font-size: 12px;
font-family: PingFang SC, PingFang SC-Semibold;
font-weight: Semibold;
text-align: left;
color: #ffffff;
line-height: 24px;
left: 0;
top: 0;
display: block;
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
font-size: 12px;
font-family: PingFang SC, PingFang SC-Semibold;
font-weight: Semibold;
text-align: left;
color: #ffffff;
line-height: 24px;
}
}

Loading…
Cancel
Save