Merge branch 'main' into shen

bak
Dragon 1 year ago
commit c6e71a100b

@ -145,7 +145,7 @@ function editFilter(filter: any) {
watch(asideValue, (newVal) => {
configStore.setAsideValue(newVal)
})
}, { deep: true })
</script>
<template>

@ -35,6 +35,7 @@ const LoginSuccessModalRef = ref(null)
const loading = ref(false)
const message = useMessage()
const totalCount = ref(0)
const sortBy = ref<'asc' | 'desc'>('desc')
let canloadMore = true
let filterId = null
@ -74,10 +75,6 @@ const layout = debounce(() => {
(_masonry as any).layout()
if (!el.value)
return
// const scrollHeight = el.value!.scrollHeight
// const clientHeight = el.value!.clientHeight
// const top = scrollHeight - clientHeight - 100
// el.value!.scrollTo({ top, behavior: 'instant' })
loading.value = false
})
@ -130,7 +127,7 @@ async function featchList() {
const asideParams = unref(configStore.getAsideValue)
const params = filterId ? { userSearchId: filterId } : asideParams
const result = await getPictureList({ ...pagination, ...contentParams, ...params })
const result = await getPictureList({ ...pagination, ...contentParams, ...params, ordertype: sortBy.value })
const { data, pageCount, total } = result
totalCount.value = total
canloadMore = pageCount >= pagination.pageNo && pageCount > 0
@ -142,6 +139,7 @@ async function featchList() {
upname: item.upname,
ocrPictureclass: item.ocrPictureclass,
uphead: item.uphead,
similar: item.similarityscore || 0,
}
})
@ -224,6 +222,7 @@ function reset() {
loading.value = false
canloadMore = true
filterId = null
layout()
}
@ -234,6 +233,7 @@ async function refreshHandler(filtersearchId?: any) {
filterId = filtersearchId
nextTick(() => {
setTimeout(() => {
useInfiniteScroll(
el as any,
() => {
@ -241,12 +241,18 @@ async function refreshHandler(filtersearchId?: any) {
},
{ distance: 10, canLoadMore: () => canloadMore },
)
}, 500)
})
}
function getAvatar(url: string): string {
return url ? getImgUrl(url) : avatar
}
function sortHandler() {
sortBy.value = sortBy.value === 'asc' ? 'desc' : 'asc'
refreshHandler()
}
</script>
<template>
@ -273,6 +279,10 @@ function getAvatar(url: string): string {
<SvgIcon class="gap" name="arrow-botton" size="14" />
</div>
</n-popselect>
<div style="margin-left: 15px;cursor: pointer" @click="sortHandler()">
<span>相似度排序</span>
<SvgIcon style="margin-left: 8px;" name="sort" size="12" />
</div>
</div>
<span>{{ totalCount }}</span>
</div>
@ -290,6 +300,12 @@ function getAvatar(url: string): string {
class="img" :img-props="{ onClick: hideDownload }" :class="{ 'img-fit': viewMode !== 'masonry' }"
:src="item.thumburl"
/>
<div class="percent">
<SvgIcon size="42" name="tag" />
<div class="val">
{{ `${item.similar}%` }}
</div>
</div>
<div class="info">
<div class="left">
<n-avatar :src="getAvatar(item.uphead)" class="avatar" round />
@ -411,6 +427,28 @@ function getAvatar(url: string): string {
border-radius: 7px;
margin-bottom: 10px;
overflow: hidden;
position: relative;
}
.percent {
position: absolute;
text-align: center;
z-index: 3;
right: 0px;
top: -6px;
color: #FFF;
.val {
position: absolute;
left: 0;
top: 0;
display: block;
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}
}
.scroll {

@ -1,8 +1,8 @@
<script lang="ts" setup>
import { format } from 'date-fns';
import { computed } from 'vue';
import { format } from "date-fns";
import { computed } from "vue";
defineOptions({ name: 'ListItem' })
defineOptions({ name: "ListItem" });
const props = defineProps({
selected: {
@ -13,30 +13,46 @@ const props = defineProps({
type: Object as PropType<any>,
required: true,
},
})
});
const svgName = computed(() => {
return props.selected ? 'task-select' : 'task'
})
return props.selected ? "task-select" : "task";
});
</script>
<template>
<div class="list-item" :class="{ 'list-item-selected': selected }">
<div class="list-item-header">
<div style="display: flex;">
<div style="display: flex">
<SvgIcon :name="svgName" size="28" />
<span class="list-item-header-name" :class="{ 'list-item-header-selected': selected }">
<span
class="list-item-header-name"
:class="{ 'list-item-header-selected': selected }"
>
任务ID:{{ listItem.fromtaskname }}
</span>
</div>
<SvgIcon v-show="selected" size="14" name="more-ver" />
</div>
<ul class="list-item-detail">
<li>审批状态<span class="list-item-status">{{ listItem.statshisText }}</span></li>
<li>
审批状态<span
class="list-item-status"
:class="
listItem.statshisText == '通过'
? 'list-item-success'
: listItem.statshisText == '不通过'
? 'list-item-error'
: 'list-item-watting'
"
>{{ listItem.statshisText }}</span
>
</li>
<li>审批节点{{ listItem.tasknamehis }}</li>
<li>提交时间{{ format(new Date(), 'yyyy-MM-dd HH:mm:ss') }}</li>
<li>
提交时间{{ format(listItem.createdate, "yyyy-MM-dd HH:mm:ss") }}
</li>
<li>提报人{{ listItem.fromUserName }}</li>
</ul>
<div class="list-item-divider" />
</div>
@ -60,7 +76,7 @@ const svgName = computed(() => {
}
&-selected {
color: #507AFD;
color: #507afd;
}
}
@ -72,12 +88,37 @@ const svgName = computed(() => {
display: inline-block;
display: flex;
align-items: center;
}
&-error {
&:before {
content: "";
width: 6px;
height: 6px;
background: #e45656;
border-radius: 50%;
display: inline-block;
margin-left: 8px;
margin-right: 4px;
}
}
&-success {
&:before {
content: '';
content: "";
width: 6px;
height: 6px;
background: #fe9800;
background: #53c21d;
border-radius: 50%;
display: inline-block;
margin-left: 8px;
margin-right: 4px;
}
}
&-watting {
&:before {
content: "";
width: 6px;
height: 6px;
background: #398ade;
border-radius: 50%;
display: inline-block;
margin-left: 8px;
@ -104,7 +145,6 @@ const svgName = computed(() => {
position: absolute;
bottom: 0px;
}
}
</style>
../types

@ -1,9 +1,9 @@
<script lang="ts" setup>
import { useTaskStore } from '@/store/modules/task'
import emitter from '@/utils/mitt'
import { useInfiniteScroll } from '@vueuse/core'
import { onMounted, onUnmounted, reactive, ref, watch } 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[]>([])
@ -14,7 +14,7 @@ const canloadMore = ref(true)
const pagination = reactive({
pageNo: 0,
pageSize: 30,
pageSize: 100,
})
function selectHandler(id: string, index: number) {
@ -26,7 +26,7 @@ const { isLoading } = useInfiniteScroll(
() => {
loadMore()
},
{ distance: 10, interval: 300, canLoadMore: () => canloadMore.value },
{ distance: 10, interval: 1500, canLoadMore: () => canloadMore.value },
)
async function loadMore() {
@ -57,7 +57,7 @@ watch(() => taskStore.activeId, (newVal) => {
function reset() {
pagination.pageNo = 0
pagination.pageSize = 30
pagination.pageSize = 100
canloadMore.value = true
data.value.length = 0

@ -5,10 +5,10 @@ import { getTaskDetailInfo, getTaskDetailPictureList } from '@/api/work/work'
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'
import emitter from '@/utils/mitt'
import _ from 'lodash'
import { clone } from 'lodash-es'
import { chunk, clone } from 'lodash-es'
import { useDialog, useMessage } from 'naive-ui'
import { computed, onUnmounted, reactive, ref, unref, watch } from 'vue'
import BatchModal from '../modal/BatchModal.vue'
@ -16,17 +16,7 @@ import ConfrimModal from '../modal/ConfrimModal.vue'
import CustomSettingModal from '../modal/CustomSettingModal.vue'
import PictureTable from './PictureTable.vue'
import TaskTable from './TaskTable.vue'
import { getAllfieldList } from '@/api/home/filter'
import { audit } from '@/api/task/task'
import { getTaskDetailInfo, getTaskDetailPictureList } from '@/api/work/work'
import { useTask } from '@/store/modules/task'
import { useUser } from '@/store/modules/user'
import { isEmpty } from '@/utils'
import { hideDownload } from '@/utils/image'
import emitter from '@/utils/mitt'
import type { ApprovalParam, PictureSortParam } from '/#/api'
import { formatToDateHMS } from '@/utils/dateUtil'
const batch = ref(false)
const selectItems = ref<any[]>([])
@ -39,47 +29,54 @@ const CustomSettingModalRef = ref(null)
const taskTableData = ref<any[]>([])
const sortBy: PictureSortParam = {
orderbyname: "asc",
orderbyvalue: "fromuptime",
};
orderbyname: 'desc',
orderbyvalue: 'pictureResult',
}
function setBatch(value: boolean) {
if (totalCount.value === 0) return;
if (totalCount.value === 0)
return
batch.value = value
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
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);
console.log(selectItems.value.map(item => item.id))
}
const showActions = computed(() => {
return selectItems.value.length > 0 && batch;
});
return selectItems.value.length > 0 && batch
})
const taskpagination = reactive({
pageNo: 1,
pageSize: 10,
});
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 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[] = []
// states:1234
function validate(items: any[]) {
if (items.length === 0) return "至少选中一个任务";
if (items.length === 0)
return '至少选中一个任务'
// const useInfo = userStore.getUserInfo
// const username = useInfo.loginname
@ -96,115 +93,140 @@ 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
}
dialog.info({
title: "确认提示",
content: "确认给该任务审批为【通过】吗?",
positiveText: "确定",
negativeText: "取消",
title: '确认提示',
content: '确认给该任务审批为【通过】吗?',
positiveText: '确定',
negativeText: '取消',
onPositiveClick: () => {
approval();
approval()
},
onNegativeClick: () => {},
});
})
}
function rejectHandler(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
}
const modal = unref(confrimModalRef)! as any;
modal.showModal();
const modal = unref(confrimModalRef)! as any
modal.showModal()
}
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 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",
taskComment: 'approval',
taskname: tasknames,
};
}
doAudit(param);
doAudit(param)
}
function doAudit(param: any) {
audit(param).then((res) => {
const { code } = res;
processItems.length = 0;
if (code === "OK") emitter.emit("refresh");
else message.error(res.message);
});
const { code } = res
setBatch(false)
if (code === 'OK')
emitter.emit('refresh')
else message.error(res.message)
})
}
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 showModal(modalRef: any) {
const modal = unref(modalRef)! as any;
modal.showModal();
const modal = unref(modalRef)! as any
modal.showModal()
}
function forwardHandler() {
taskStore.forward();
taskStore.forward()
}
function backHandler() {
taskStore.back();
taskStore.back()
}
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
console.log(userFieldList, 'userFieldList')
fieldList.map((v) => {
if (userFieldList.includes(v.name)) {
const item = {
label: v.fieldDesc,
value: taskDetailInfo.value.ocrPicture[v.name],
key: v.name,
}
listData.push(item)
}
})
taskTableData.value = chunk(listData, 2)
}
watch(
@ -213,27 +235,10 @@ watch(
const packageid = taskStore.getPackageid
const taskId = taskStore.getActiveId
if (isEmpty(taskId)) return;
const useInfo = userStore.getUserInfo;
let listData = [];
taskDetailInfo.value = await getTaskDetailInfo(taskId, packageid);
const reviewType = 3; //
let res = await getAllfieldList(reviewType);
let fieldList = (res as any)?.data;
res = await getfieldList(reviewType, useInfo.id);
let userFieldList = (res as any)?.data.userFieldFixed;
console.log(userFieldList,'userFieldList')
fieldList.map((v) => {
if (userFieldList.indexOf(v.name) > -1) {
let item = {
label: v.fieldDesc,
value: taskDetailInfo.value.ocrPicture[v.name],
key: v.name,
};
listData.push(item);
}
});
if (isEmpty(taskId))
return
taskDetailInfo.value = await getTaskDetailInfo(taskId, packageid)
getTableData()
// TODO mock
// let showFieldData = taskDetailInfo.value.ocrPicture;
// let showFieldKeys = Object.keys(showFieldData);
@ -254,7 +259,6 @@ watch(
// }
// }
// }
taskTableData.value = _.chunk(listData, 2);
if (!isEmpty(packageid)) {
const { data, total } = await getTaskDetailPictureList(
packageid,
@ -264,56 +268,57 @@ watch(
taskDetailPictureList.value = data
totalCount.value = total
}
}
);
},
)
const currentTaskId = computed(() => {
const index = taskStore.getCurrentIndex;
return taskStore.getApprovalList[index]?.formid || "";
});
const index = taskStore.getCurrentIndex
return taskStore.getApprovalList[index]?.formid || ''
})
function overTaskHandle() {
const item = taskDetailInfo.value;
const item = taskDetailInfo.value
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();
});
taskStore.reset()
})
const mark = computed(() => {
return taskDetailInfo.value.iztrueorfalse === null ? "未标记" : "已标记";
});
return taskDetailInfo.value.iztrueorfalse === null ? '未标记' : '已标记'
})
function immersionHandler() {
taskStore.updateImmersion();
taskStore.updateImmersion()
}
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()
}
function getPercent(pictureid: string) {
const { ocpictureid, pictureresult } = taskDetailInfo.value;
const index = ocpictureid.split(",").indexOf(String(pictureid));
const results = pictureresult.split(",");
const percent = results[index] || "0";
const val = Number.parseFloat(percent);
return `${val}%`;
const { ocpictureid, pictureresult } = taskDetailInfo.value
const index = ocpictureid.split(',').indexOf(String(pictureid))
const results = pictureresult.split(',')
const percent = results[index] || '0'
const val = Number.parseFloat(percent)
return `${val}%`
}
</script>
@ -501,7 +506,9 @@ function getPercent(pictureid: string) {
<div class="info-header">
<div class="left_box">
<div class="title">填报信息</div>
<div class="title">
填报信息
</div>
<SvgIcon size="12" name="collapse" />
</div>
<div class="right_box" @click="showActionsModal">
@ -511,7 +518,7 @@ function getPercent(pictureid: string) {
</div>
<n-tabs type="line" animated>
<n-tab-pane name="task-info" tab="任务信息">
<TaskTable :data="taskDetailInfo" :taskTableData="taskTableData" />
<TaskTable :data="taskDetailInfo" :task-table-data="taskTableData" />
</n-tab-pane>
<n-tab-pane name="picture-info" tab="图片信息">
<PictureTable :data="taskDetailInfo" />
@ -524,7 +531,7 @@ function getPercent(pictureid: string) {
@reject="rejectHandler"
@approval="approvalHandler"
/>
<CustomSettingModal ref="CustomSettingModalRef" :review-type="3" />
<CustomSettingModal ref="CustomSettingModalRef" :review-type="3" @on-ok="getTableData" />
</div>
</template>

@ -2,7 +2,7 @@
import { getAllfieldList, getfieldList, savefield } from "@/api/home/filter";
import { ReportInfoConfig } from "@/config/workorder";
import { useUser } from "@/store/modules/user";
import { defineProps, onMounted, ref } from "vue";
import { defineEmits, defineProps, onMounted, ref } from "vue";
const props = defineProps({
reviewType: {
@ -95,6 +95,7 @@ function showModal() {
function closeModal() {
show.value = false;
}
const emit = defineEmits(['onOk'])
async function handleSumbit(e: MouseEvent) {
const userStore = useUser();
@ -109,9 +110,8 @@ async function handleSumbit(e: MouseEvent) {
savefield(props.reviewType, userInfo.id, userField);
e.preventDefault();
closeModal();
setTimeout(()=>{
window.location.reload();
},3000)
emit('onOk')
}
defineExpose({

Loading…
Cancel
Save