Merge pull request 'bug:审批列表相似度展示模式和终审问题' (#87) from fix/shenpi into test

Reviewed-on: #87
pull/88/head
shenhailong 1 year ago
commit 218c56c5d3

@ -38,7 +38,7 @@ const routes: Array<RouteRecordRaw> = [
path: 'final-detail',
name: 'final-detail',
meta: {
title: '任务终审详情',
title: '任务详情',
},
component: () => import('@/views/task/content/Content.vue'),
},

@ -68,6 +68,9 @@ const columns: DataTableColumns<RowData> = [
ellipsis: {
tooltip: true,
},
render(row: any) {
return row.fromtaskname
},
},
{
title: '任务名称',
@ -356,6 +359,7 @@ function showModal() {
function reload() {
selectionIds.value = []
checkedRowKeys.value = []
query(pagination.page, pagination.pageSize)
}
function goDetail(row) {

File diff suppressed because it is too large Load Diff

@ -1,32 +1,32 @@
<script lang="ts" setup>
import { reactive, ref, toRefs } from "vue";
import { format } from "date-fns";
import { useRoute, useRouter } from "vue-router";
import { getMessageList, readAllMsg, readMsg } from "@/api/message/message";
import iconApproveActive from "@/assets/images/message/approve-active.png";
import iconApprove from "@/assets/images/message/approve.png";
import iconSystemActive from "@/assets/images/message/system-active.png";
import iconSystem from "@/assets/images/message/system.png";
import iconArrowActive from "@/assets/images/message/arrow-active.png";
import iconArrow from "@/assets/images/message/arrow.png";
import iconClear from "@/assets/images/message/clear.png";
import iconArrowDown from "@/assets/images/message/arrow-down.png";
const emit = defineEmits(["goDetail"]);
const router = useRouter();
const route = useRoute();
const hasNextPage = ref(false);
import { reactive, ref, toRefs } from 'vue'
import { format } from 'date-fns'
import { useRoute, useRouter } from 'vue-router'
import { getMessageList, readAllMsg, readMsg } from '@/api/message/message'
import iconApproveActive from '@/assets/images/message/approve-active.png'
import iconApprove from '@/assets/images/message/approve.png'
import iconSystemActive from '@/assets/images/message/system-active.png'
import iconSystem from '@/assets/images/message/system.png'
import iconArrowActive from '@/assets/images/message/arrow-active.png'
import iconArrow from '@/assets/images/message/arrow.png'
import iconClear from '@/assets/images/message/clear.png'
import iconArrowDown from '@/assets/images/message/arrow-down.png'
const emit = defineEmits(['goDetail'])
const router = useRouter()
const route = useRoute()
const hasNextPage = ref(false)
const state = reactive({
tabList: [
{
name: "审批通知",
name: '审批通知',
icon: iconApprove,
activeIcon: iconApproveActive,
value: 1,
},
{
name: "系统消息",
name: '系统消息',
icon: iconSystem,
activeIcon: iconSystemActive,
value: 2,
@ -34,102 +34,105 @@ const state = reactive({
],
list: [] as any,
pageNo: 1,
});
})
const { list, tabList } = toRefs(state);
const { list, tabList } = toRefs(state)
const tab = ref(1);
const tab = ref(1)
async function getList(type = "") {
async function getList(type = '') {
let res = await getMessageList({
pageNo: state.pageNo,
pageSize: "7",
pageSize: '7',
msgCategory: tab.value,
});
if (type == "more") {
})
if (type == 'more') {
while (res.data.endRow > 0) {
if (res.code == "OK") {
if (res.code == 'OK') {
if (tab.value === 1) {
res.data.list.forEach((item) => {
item.tag = JSON.parse(item.busJson);
});
item.tag = JSON.parse(item.busJson)
})
}
state.list = state.list.concat(res.data.list);
state.pageNo++;
state.list = state.list.concat(res.data.list)
state.pageNo++
res = await getMessageList({
pageNo: state.pageNo,
pageSize: "7",
pageSize: '7',
msgCategory: tab.value,
});
})
}
}
hasNextPage.value = res.data.hasNextPage;
} else {
if (res.code === "OK") {
hasNextPage.value = res.data.hasNextPage;
hasNextPage.value = res.data.hasNextPage
}
else {
if (res.code === 'OK') {
hasNextPage.value = res.data.hasNextPage
if (tab.value === 1) {
res.data.list.forEach((item) => {
item.tag = JSON.parse(item.busJson);
});
item.tag = JSON.parse(item.busJson)
})
}
state.list = state.list.concat(res.data.list);
state.list = state.list.concat(res.data.list)
}
}
}
getList();
getList()
async function clearMsg() {
const res = await readAllMsg({ msgCategory: tab.value });
if (res.code === "OK") {
state.list = [];
state.pageNo = 1;
getList();
const res = await readAllMsg({ msgCategory: tab.value })
if (res.code === 'OK') {
state.list = []
state.pageNo = 1
getList()
}
}
function switchTab(type: number) {
tab.value = type;
state.list = [];
state.pageNo = 1;
getList();
tab.value = type
state.list = []
state.pageNo = 1
getList()
}
function goFinalDetail(row) {
console.log(row);
console.log(row)
router.push({
name: "final-detail",
query: { id: row.tag.taskId, packageid: row.packageid },
});
name: 'final-detail',
query: { id: row.tag.fromId, packageid: row.packageid },
})
}
function goDetail(item) {
if (tab.value === 1) {
clearMsgOne(item.id);
goFinalDetail(item);
clearMsgOne(item.id)
goFinalDetail(item)
}
// emit('goDetail', item.id)
else {
router.push({ name: "message-detail", query: { id: item.id } });
router.push({ name: 'message-detail', query: { id: item.id } })
}
}
async function clearMsgOne(id) {
const res = await readMsg({ msgid: id });
const res = await readMsg({ msgid: id })
}
function getMore() {
state.pageNo += 1;
getList("more");
state.pageNo += 1
getList('more')
}
</script>
<template>
<div class="wrapper-message">
<div class="flex justify-between header">
<div class="header-title">消息通知</div>
<div class="header-title">
消息通知
</div>
<div class="clear" @click="clearMsg">
<img class="icon-clear" :src="iconClear" alt="" />
<img class="icon-clear" :src="iconClear" alt="">
清除未读
</div>
</div>
@ -147,7 +150,7 @@ function getMore() {
class="icon"
:src="tab === item.value ? item.activeIcon : item.icon"
alt=""
/>
>
<div :class="{ 'text-active': tab === item.value }" class="text">
{{ item.name }}
</div>
@ -156,7 +159,7 @@ function getMore() {
class="icon-arrow"
:src="tab === item.value ? iconArrowActive : iconArrow"
alt=""
/>
>
<div v-if="tab === item.value" class="line" />
</div>
</div>
@ -164,7 +167,7 @@ function getMore() {
<div
v-for="(item, index) in list"
:key="item.id"
:class="{ pt0: index === 0, 'item-disabled': item.readFlag }"
:class="{ 'pt0': index === 0, 'item-disabled': item.readFlag }"
class="item"
@click="goDetail(item)"
>
@ -185,7 +188,9 @@ function getMore() {
{{ item.titile }}
</div>
<div v-if="tab === 1" class="status">
<div class="tag tag-blue">审批节点{{ item.tag.nodeName }}</div>
<div class="tag tag-blue">
审批节点{{ item.tag.nodeName }}
</div>
<div :class="item.tag.states === 5 ? 'tag-red' : 'tag-green'" class="tag">
审批状态{{ item.tag.states }}
</div>
@ -199,11 +204,13 @@ function getMore() {
<span class="time">{{ format(item.sendTime, "yyyy-MM-dd HH:mm:ss") }}</span>
</div>
</div>
<div class="look">查看</div>
<div class="look">
查看
</div>
</div>
<div v-if="hasNextPage" class="more" @click="getMore">
查看更多<img class="icon-more" :src="iconArrowDown" alt="" />
查看更多<img class="icon-more" :src="iconArrowDown" alt="">
</div>
</div>
</div>

@ -581,7 +581,7 @@ function switchBatch() {
<div
draggable="true"
class="img-wrapper"
:style="{ 'background-image': `url(${item.imgUrl})` }"
:style="{ 'background-image': `url(${item.serverThumbnailUrl})` }"
@dragend="
(event) => {
handleDragEnd(event, item);

@ -5,8 +5,10 @@ import { useInfiniteScroll } from '@vueuse/core'
import { debounce } from 'lodash-es'
import imagesloaded from 'imagesloaded'
import { useMessage } from 'naive-ui'
import { useWindowSizeFn } from '@/hooks/event/useWindowSizeFn'
import { getViewportOffset, off, on } from '@/utils/domUtils'
import { timeOptions, viewOptions } from '@/config/home'
import { off, on } from '@/utils/domUtils'
import { useTask } from '@/store/modules/task'
import { TASK_STATUS_OBJ } from '@/enums/index'
import { formatToDateHMS } from '@/utils/dateUtil'
@ -43,6 +45,7 @@ const viewLabel = computed(() => {
return item?.label
})
const deviceHeight = ref(600)
const taskStore = useTask()
const masonryRef = ref<ComponentRef>(null)
@ -64,6 +67,14 @@ const sortBy: any = {
const batch = ref(false)
let _imagesload: any
const message = useMessage()
async function computeListHeight() {
const headEl = document.querySelector('.wrapper-content')!
const { bottomIncludeBody } = getViewportOffset(headEl)
const height = bottomIncludeBody
deviceHeight.value = height - 40 - 16 - 24
}
useWindowSizeFn(computeListHeight)
const layout = debounce(() => {
if (!show.value)
@ -74,6 +85,7 @@ const layout = debounce(() => {
_masonry = new Masonry(masonryRef.value as any, {
itemSelector: '.grid-item',
gutter: 17,
columnWidth: 214,
percentPosition: true,
stagger: 10,
@ -208,9 +220,9 @@ function upHandler(event: MouseEvent) {
start = null
}
const gridHeight = computed(() => {
return viewMode.value !== 'masonry' ? '157px' : ''
})
// const gridHeight = computed(() => {
// return viewMode.value !== 'masonry' ? '157px' : ''
// })
function addListeners() {
selectionBox = document.querySelector('.selection-box') as HTMLDivElement
@ -346,6 +358,12 @@ watch(() => taskStore.activeId, async (newValue, oldValue) => {
refreshHandler()
})
const listStyle = computed(() => {
return {
height: `${deviceHeight.value}px`,
}
})
function switchBatch() {
setBatch(!batch.value)
}
@ -363,19 +381,19 @@ function sortHandler(orderby: 'similarityScore' | 'createdate') {
refreshHandler()
}
// const gridHeight = computed(() => {
// let height = ''
// if (viewMode.value === 'masonry')
// height = ''
// else if (viewMode.value === 'horizontalVersion')
// height = '145px'
// else if (viewMode.value === 'verticalVersion')
// height = '300px'
// else if (viewMode.value === '3:4')
// height = '240px'
// return height
// })
const gridHeight = computed(() => {
let height = ''
if (viewMode.value === 'masonry')
height = ''
else if (viewMode.value === 'horizontalVersion')
height = '122px'
else if (viewMode.value === 'verticalVersion')
height = '300px'
else if (viewMode.value === '3:4')
height = '240px'
return height
})
defineExpose({
showModal,
@ -505,51 +523,57 @@ defineExpose({
</div>
</div>
<div ref="el" class="scroll">
<!-- <n-scrollbar :on-scroll="scrollHandler"> -->
<div ref="masonryRef" class="grid">
<div
v-for="(item, index) in listData" :key="index" :data-id="item.id" :style="{ height: gridHeight }"
class="grid-item"
>
<div class="img-wrap">
<!-- <img
class="wrapper-content-item-img"
:class="{ 'wrapper-content-item-img-fit': viewMode !== 'masonry' }" :src="item.imgUrl"
> -->
<n-image
ref="imageRef"
class="img"
:class="{ 'img-fit': viewMode === 'horizontalVersion', 'img-full': viewMode === '3:4' || viewMode === 'verticalVersion' }" :src="item.serverThumbnailUrl || item.imgUrl"
/>
<div class="small-mark" />
<div class="time">
<div v-if="item.photoDateTimestamp" class="time-item">
<SvgIcon class="svg-time" color="#FFF" size="14" name="camera-time" />
<span>{{ formatToDateHMS(Number(item.photoDateTimestamp) || 0) }}</span>
<n-spin :show="loading">
<div ref="el" class="scroll" :style="listStyle">
<!-- <n-scrollbar :on-scroll="scrollHandler"> -->
<div ref="masonryRef" class="grid">
<div
v-for="(item, index) in listData"
:key="index"
:style="{ height: gridHeight }"
class="grid-item"
>
<div>
<n-image
ref="imageRef"
class="img"
:class="{
'img-fit': viewMode === 'horizontalVersion',
'img-full': viewMode === '3:4' || viewMode === 'verticalVersion',
}"
:src="item.serverThumbnailUrl"
/>
<div class="small-mark" />
<div class="time">
<div v-if="item.photoDateTimestamp" class="time-item">
<SvgIcon class="svg-time" color="#FFF" size="14" name="camera-time" />
<span>{{ formatToDateHMS(Number(item.photoDateTimestamp) || 0) }}</span>
</div>
<div v-if="item.submitDateTimestamp" class="time-item time-item2">
<SvgIcon class="svg-time" color="#FFF" size="14" name="submit-time" />
<span>{{ formatToDateHMS(Number(item.submitDateTimestamp) || 0) }}</span>
</div>
</div>
<div v-if="item.submitDateTimestamp" class="time-item time-item2">
<SvgIcon class="svg-time" color="#FFF" size="14" name="submit-time" />
<span>{{ formatToDateHMS(Number(item.submitDateTimestamp) || 0) }}</span>
<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="check">
<n-checkbox
v-show="batch && item.historyStates === 1"
v-model:checked="item.checked" @click.prevent
@update:checked="onCheckChange($event, item)"
/>
</div>
<div :class="{ 'percent-red': item.similarityScore === 100 }" class="percent">
{{ item.similarityScore }}<span class="percent-unit">%</span>
</div>
</div>
<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="check">
<n-checkbox
v-show="batch && item.historyStates === 1"
v-model:checked="item.checked" @click.prevent
@update:checked="onCheckChange($event, item)"
/>
</div>
<div :class="{ 'percent-red': item.similarityScore === 100 }" class="percent">
{{ item.similarityScore }}<span class="percent-unit">%</span>
</div>
</div>
</div>
<!-- </n-scrollbar> -->
</div>
<!-- </n-scrollbar> -->
</div>
</n-spin>
</div>
<div class="close" @pointerdown="closeModal">
@ -728,7 +752,7 @@ defineExpose({
}
&-m32 {
margin-left: 19px;
// margin-left: 19px;
}
&-content {
@ -778,17 +802,20 @@ defineExpose({
display: block;
height: 100%;
}
}
&-img-fit {
width: 100%;
object-fit: cover;
}
.img-fit {
width: 100%;
object-fit: cover;
overflow: hidden;
}
.img {
border-radius: 7px;
display: block;
height: calc(100% - 25px);
// height: calc(100% - 25px);
height: 100%;
width: 100%;
}
.img-full {
@ -804,8 +831,11 @@ defineExpose({
.grid-item {
width: 214px;
padding: 16px;
// padding: 16px;
// width: 182px;
position: relative;
margin-bottom: 32px;
transition: 0.5s;
.check{
position: absolute;
@ -851,4 +881,7 @@ defineExpose({
}
}
}
::v-deep(.n-image img) {
width: 100%!important;
}
</style>

Loading…
Cancel
Save