Merge branch 'main' into shen

pull/1/head
Dragon 1 year ago
commit e3693937df

@ -30,10 +30,11 @@ export async function getFinalList(params: FinalParam) {
params: notEmptyParams, params: notEmptyParams,
}) })
const { data: { list, totalPage } } = res const { data: { list, totalPage,totalCount } } = res
return { return {
pageCount: totalPage, pageCount: totalPage,
data: list, data: list,
totalCount
} }
} }

@ -17,10 +17,11 @@ export async function getConditionList(page: PageParam, searchParam: FilterSearc
}, },
}) })
const { data: { records, pages } } = res const { data: { records, pages,total } } = res
return { return {
pageCount: pages, pageCount: pages,
data: records, data: records,
total
} }
} }

@ -1,127 +1,143 @@
<script lang="ts" setup> <script lang="ts" setup>
import { computed, inject, onMounted, ref } from 'vue' import { computed, inject, onMounted, ref } from "vue";
import { useRoute, useRouter } from 'vue-router' import { useRoute, useRouter } from "vue-router";
import { useUser } from '@/store/modules/user' import { useUser } from "@/store/modules/user";
import { getImgUrl } from '@/utils/urlUtils' import { getImgUrl } from "@/utils/urlUtils";
const emit = defineEmits<{ const emit = defineEmits<{
(e: 'logout'): void (e: "logout"): void;
}>() }>();
const router = useRouter() const router = useRouter();
const userStore = useUser() const userStore = useUser();
const useInfo = userStore.getUserInfo const useInfo = userStore.getUserInfo;
const aiDisabled = ref(false) const aiDisabled = ref(false);
function handleSelect(row) { function handleSelect(row) {
userStore.updateTenantId(row.key) userStore.updateTenantId(row.key);
location.reload() location.reload();
} }
function logIt(e) { function logIt(e) {
return false return false;
} }
// //
function goHome(e) { function goHome(e) {
router.push({ name: 'home' }) router.push({ name: "home" });
} }
// //
function goTask(e) { function goTask(e) {
router.push({ name: 'task-main' }) router.push({ name: "task-main" });
} }
// AI // AI
function goWorksheet(e) { function goWorksheet(e) {
router.push({ name: 'worksheet-main' }) router.push({ name: "worksheet-main" });
} }
// //
function goFinal(e) { function goFinal(e) {
router.push({ name: 'final-main' }) router.push({ name: "final-main" });
} }
const mousetrap = inject('mousetrap') as any const mousetrap = inject("mousetrap") as any;
onMounted(() => { onMounted(() => {
mousetrap.bind('g h', goHome) mousetrap.bind("g h", goHome);
mousetrap.bind('g t', goTask) mousetrap.bind("g t", goTask);
mousetrap.bind('g a', goWorksheet) mousetrap.bind("g a", goWorksheet);
mousetrap.bind('g e', goFinal) mousetrap.bind("g e", goFinal);
}) });
const showPopover = ref(false) const showPopover = ref(false);
const popRef = ref(null) const popRef = ref(null);
const changeFlag = ref(false) const changeFlag = ref(false);
const iconName = computed(() => { const iconName = computed(() => {
return showPopover.value ? 'expand' : 'collapse' return showPopover.value ? "expand" : "collapse";
}) });
function handleUpdateShow(show: boolean) { function handleUpdateShow(show: boolean) {
showPopover.value = show showPopover.value = show;
} }
function logOut() { function logOut() {
(popRef.value as any).setShow(false) (popRef.value as any).setShow(false);
emit('logout') emit("logout");
} }
const currentCompanyName = computed(() => { const currentCompanyName = computed(() => {
const tenantList = useInfo.tenantList const tenantList = useInfo.tenantList;
const currentId = userStore.getTenantId const currentId = userStore.getTenantId;
const current = tenantList.find(item => item.id === currentId) const current = tenantList.find((item) => item.id === currentId);
return current.name || 'name' return current.name || "name";
}) });
const options = computed(() => { const options = computed(() => {
const tenantList = useInfo.tenantList const tenantList = useInfo.tenantList;
return tenantList.map((item) => { return tenantList.map((item) => {
return { return {
label: item.name, label: item.name,
key: item.id, key: item.id,
} };
}) });
}) });
</script> </script>
<template> <template>
<n-popover ref="popRef" style="border-radius: 10px" placement="bottom-end" raw :show-arrow="false" trigger="click" <n-popover
@update:show="handleUpdateShow"> ref="popRef"
style="border-radius: 10px"
placement="bottom-end"
raw
:show-arrow="false"
trigger="click"
@update:show="handleUpdateShow"
>
<template #trigger> <template #trigger>
<div class="setting"> <div class="setting">
<span>{{ useInfo.username }}</span> <span>{{ useInfo.username }}</span>
<SvgIcon style="margin-left: 6px;" :name="iconName" size="14" /> <SvgIcon style="margin-left: 6px" :name="iconName" size="14" />
</div> </div>
</template> </template>
<div class="container"> <div class="container">
<div class="header"> <div class="header">
<n-avatar :src="getImgUrl(useInfo.usericon)" round style="width:53px; height:53px" /> <n-avatar
:src="getImgUrl(useInfo.usericon)"
round
style="width: 53px; height: 53px"
/>
<div style="margin-left: 12px"> <div style="margin-left: 12px">
<span style="display: block;" class="user-name">{{ useInfo.username }}</span> <span style="display: block" class="user-name">{{ useInfo.username }}</span>
<span style="display: block;" class="depart-name">{{ useInfo.departname }}</span> <span style="display: block" class="depart-name">{{ useInfo.departname }}</span>
</div> </div>
</div> </div>
<div class="trigger"> <div class="trigger">
<span>{{ currentCompanyName }}</span> <span>{{ currentCompanyName }}</span>
<span @click="changeFlag = !changeFlag" style="cursor: pointer;">icon</span> <span @click="changeFlag = !changeFlag" style="cursor: pointer">icon</span>
</div> </div>
<div class="item"> <div class="item">
<span>AI设置开关</span> <span>AI设置开关</span>
<n-switch v-model:value="aiDisabled" /> <n-switch v-model:value="aiDisabled" />
</div> </div>
<div class="trigger"> <div class="trigger">联系我们</div>
联系我们 <n-divider style="margin-top: 0px; margin-bottom: 10px; padding: 0 22px" />
</div> <div class="trigger" @click="logOut">退</div>
<n-divider style="margin-top: 0px; margin-bottom: 10px;padding: 0 22px;" /> <div
<div class="trigger" @click="logOut"> class="container sub-container"
退出登录 v-show="changeFlag"
</div> style="position: absolute; right: 17vw; width: 11.5vw; padding: 24px 0"
<div class="container sub-container" v-show="changeFlag" style="position: absolute;right:17vw;width: 11.5vw;padding:24px 0"> >
<div class="trigger" v-for="option in options" :key="option.key" @click="handleSelect(option)"> <div
class="trigger"
v-for="option in options"
:key="option.key"
@click="handleSelect(option)"
>
{{ option.label }} {{ option.label }}
</div> </div>
</div> </div>
@ -130,15 +146,13 @@ const options = computed(() => {
</template> </template>
<style lang="less" scoped> <style lang="less" scoped>
@media screen and (min-width: 1920px) { .container {
.container { .header {
.header{ .user-name {
.user-name{ font-size: 16px;
font-size: 16px; }
} .depart-name {
.depart-name{ font-size: 12px;
font-size: 12px;
}
} }
} }
} }

@ -119,8 +119,8 @@ async function query(page: number, pageSize: number) {
search_searchname: { value: keyword.value, op: "like", type: "string" }, search_searchname: { value: keyword.value, op: "like", type: "string" },
}; };
const result = await getConditionList({ pageNo: page, pageSize }, searchParam, 1); const result = await getConditionList({ pageNo: page, pageSize }, searchParam, 1);
const { data, pageCount } = result; const { data, pageCount,total } = result;
total.value = data.total; total.value = total;
tableData.value = data; tableData.value = data;
pagination.page = page; pagination.page = page;
pagination.pageCount = pageCount; pagination.pageCount = pageCount;

@ -139,7 +139,7 @@ async function query(page: number, pageSize: number) {
sortname: "", sortname: "",
}); });
const { data, pageCount } = result; const { data, pageCount } = result;
total.value = data.totalCount; total.value = totalCount;
tableData.value = data; tableData.value = data;
pagination.page = page; pagination.page = page;
pagination.pageCount = pageCount; pagination.pageCount = pageCount;

@ -1,6 +1,6 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { DataTableColumns, DataTableRowKey, PaginationProps } from 'naive-ui' import type { DataTableColumns, DataTableRowKey, PaginationProps } from "naive-ui";
import { NButton, NDataTable, useDialog, useMessage } from 'naive-ui' import { NButton, NDataTable, useDialog, useMessage } from "naive-ui";
import { import {
computed, computed,
defineEmits, defineEmits,
@ -13,9 +13,9 @@ import {
ref, ref,
unref, unref,
watch, watch,
} from 'vue' } from "vue";
import { rowPropKeys } from 'naive-ui/es/legacy-grid/src/Row' import { rowPropKeys } from "naive-ui/es/legacy-grid/src/Row";
import { useRoute, useRouter } from 'vue-router' import { useRoute, useRouter } from "vue-router";
import { import {
Action, Action,
CustomTabelModal, CustomTabelModal,
@ -24,50 +24,50 @@ import {
RepeatModal, RepeatModal,
RepeatTaskTableModal, RepeatTaskTableModal,
StatusItem, StatusItem,
} from '../comp' } from "../comp";
import { getFinalList } from '@/api/final' import { getFinalList } from "@/api/final";
import { audit } from '@/api/task/task' import { audit } from "@/api/task/task";
import SvgIcon from '@/components/Icon/SvgIcon.vue' import SvgIcon from "@/components/Icon/SvgIcon.vue";
import type { RowData } from '@/config/final' import type { RowData } from "@/config/final";
import { findKey, headRules } from '@/config/final' import { findKey, headRules } from "@/config/final";
import { useWindowSizeFn } from '@/hooks/event/useWindowSizeFn' import { useWindowSizeFn } from "@/hooks/event/useWindowSizeFn";
import { useUser } from '@/store/modules/user' import { useUser } from "@/store/modules/user";
import { useFinal } from '@/store/modules/final' import { useFinal } from "@/store/modules/final";
import { getViewportOffset } from '@/utils/domUtils' import { getViewportOffset } from "@/utils/domUtils";
import { isBoolean } from '@/utils/is' import { isBoolean } from "@/utils/is";
import { useDictionary } from '@/store/modules/dictonary' import { useDictionary } from "@/store/modules/dictonary";
import ConfrimModal from '@/views/task/modal/ConfrimModal.vue' import ConfrimModal from "@/views/task/modal/ConfrimModal.vue";
import type { ApprovalParam } from '/#/api' import type { ApprovalParam } from "/#/api";
import emitter from '@/utils/mitt' import emitter from "@/utils/mitt";
import { formatToDateHMS } from '@/utils/dateUtil' import { formatToDateHMS } from "@/utils/dateUtil";
import { getAllfieldList, getfieldList, savefield } from '@/api/home/filter' import { getAllfieldList, getfieldList, savefield } from "@/api/home/filter";
const emit = defineEmits(['changeShow']) const emit = defineEmits(["changeShow"]);
function changeContent() { function changeContent() {
emit('changeShow') emit("changeShow");
} }
const dicStore = useDictionary() const dicStore = useDictionary();
const izstatusList = ref([]) const izstatusList = ref([]);
const router = useRouter() const router = useRouter();
const route = useRoute() const route = useRoute();
const reviewType = 0 const reviewType = 0;
const actionsColumns = { const actionsColumns = {
title: '操作', title: "操作",
key: 'actions', key: "actions",
minWidth: 200, minWidth: 200,
fixed: 'right', fixed: "right",
render(row) { render(row) {
return h(ListAction, { return h(ListAction, {
id: row.id, id: row.id,
status: row.states, status: row.states,
trigger: (action) => { trigger: (action) => {
actionHandler(action, row) actionHandler(action, row);
}, },
}) });
}, },
} };
const columnsRef = ref<DataTableColumns<RowData>>([]) const columnsRef = ref<DataTableColumns<RowData>>([]);
// const columns: DataTableColumns<RowData> = [ // const columns: DataTableColumns<RowData> = [
// { // {
// type: "selection", // type: "selection",
@ -167,213 +167,204 @@ const columnsRef = ref<DataTableColumns<RowData>>([])
async function getColumns() { async function getColumns() {
columnsRef.value = [ columnsRef.value = [
{ {
type: 'selection', type: "selection",
fixed: 'left', fixed: "left",
width: 50, width: 50,
}, },
] ];
const userStore = useUser() const userStore = useUser();
const userInfo = userStore.getUserInfo const userInfo = userStore.getUserInfo;
let res let res;
res = await getAllfieldList(reviewType) // res = await getAllfieldList(reviewType); //
const allList = res.data const allList = res.data;
res = await getfieldList(reviewType, userInfo.id) // res = await getfieldList(reviewType, userInfo.id); //
const useList = res.data const useList = res.data;
const userFieldFixed = useList.userFieldFixed?.split(',') const userFieldFixed = useList.userFieldFixed?.split(",");
const userFieldUnFixed = useList.userFieldUnFixed?.split(',') const userFieldUnFixed = useList.userFieldUnFixed?.split(",");
console.log(userFieldFixed, userFieldUnFixed, 'userFieldUnFixed') console.log(userFieldFixed, userFieldUnFixed, "userFieldUnFixed");
console.log(allList, 'allList') console.log(allList, "allList");
allList?.map((v) => { allList?.map((v) => {
if (!userFieldFixed?.length && !userFieldUnFixed?.length) { if (!userFieldFixed?.length && !userFieldUnFixed?.length) {
if (v.isrequired == 2) { if (v.isrequired == 2) {
columnsRef.value.push({ columnsRef.value.push({
title: v.fieldDesc, title: v.fieldDesc,
fixed: 'left', fixed: "left",
key: v.name, key: v.name,
width: 120, width: 120,
}) });
} }
} }
if (userFieldFixed?.find(v2 => v2 == v.name)) { if (userFieldFixed?.find((v2) => v2 == v.name)) {
columnsRef.value.push({ columnsRef.value.push({
title: v.fieldDesc, title: v.fieldDesc,
key: v.name, key: v.name,
fixed: 'left', fixed: "left",
width: 120, width: 120,
}) });
} }
if (userFieldUnFixed?.find(v2 => v2 == v.name)) { if (userFieldUnFixed?.find((v2) => v2 == v.name)) {
columnsRef.value.push({ columnsRef.value.push({
title: v.fieldDesc, title: v.fieldDesc,
key: v.name, key: v.name,
width: 120, width: 120,
}) });
} }
}) });
columnsRef.value.push(actionsColumns as any) columnsRef.value.push(actionsColumns as any);
formatColumns() formatColumns();
console.log(columnsRef.value, 'columnsRef') console.log(columnsRef.value, "columnsRef");
} }
async function formatColumns() { async function formatColumns() {
// TODO // TODO
let index let index;
index = columnsRef.value.findIndex(v => v.title == '任务ID') index = columnsRef.value.findIndex((v) => v.title == "任务ID");
if (index > -1) { if (index > -1) {
columnsRef.value[index] = { columnsRef.value[index] = {
title: '任务ID', title: "任务ID",
key: columnsRef.value[index].key, // "id" key: columnsRef.value[index].key, // "id"
fixed: columnsRef.value[index].fixed || undefined, fixed: columnsRef.value[index].fixed || undefined,
width: 200, width: 200,
render(row) { render(row) {
const item: any = izstatusList.value.find( const item: any = izstatusList.value.find(
(item: any) => item.value == row.states, (item: any) => item.value == row.states
) );
return h( return h(
NButton, NButton,
{ {
'strong': true, strong: true,
'tertiary': true, tertiary: true,
'text': true, text: true,
'size': 'small', size: "small",
'text-color': '#507AFD', "text-color": "#507AFD",
'onClick': () => goDetail(row), onClick: () => goDetail(row),
}, },
{ default: () => row.id }, { default: () => row.id }
) );
}, },
} };
} }
index = columnsRef.value.findIndex(v => v.title == '任务名称') index = columnsRef.value.findIndex((v) => v.title == "任务名称");
if (index > -1) { if (index > -1) {
columnsRef.value[index] = { columnsRef.value[index] = {
title: '任务名称', title: "任务名称",
key: columnsRef.value[index].key, // "fromtaskname" key: columnsRef.value[index].key, // "fromtaskname"
fixed: columnsRef.value[index].fixed || undefined, fixed: columnsRef.value[index].fixed || undefined,
width: 200, width: 200,
ellipsis: { ellipsis: {
tooltip: true, tooltip: true,
}, },
} };
} }
index = columnsRef.value.findIndex(v => v.title == '审批状态') index = columnsRef.value.findIndex((v) => v.title == "审批状态");
if (index > -1) { if (index > -1) {
columnsRef.value[index] = { columnsRef.value[index] = {
title: '审批状态', title: "审批状态",
key: columnsRef.value[index].key, key: columnsRef.value[index].key,
fixed: columnsRef.value[index].fixed || undefined, fixed: columnsRef.value[index].fixed || undefined,
width: 120, width: 120,
sorter: 'default', sorter: "default",
renderSorterIcon: ({ order }) => { renderSorterIcon: ({ order }) => {
if (order === false) if (order === false) return h(SvgIcon, { name: "sort-2" });
return h(SvgIcon, { name: 'sort-2' }) if (order === "ascend") return h(SvgIcon, { name: "sort-1" });
if (order === 'ascend') if (order === "descend") return h(SvgIcon, { name: "sort-3" });
return h(SvgIcon, { name: 'sort-1' })
if (order === 'descend')
return h(SvgIcon, { name: 'sort-3' })
}, },
render(row) { render(row) {
const item: any = izstatusList.value.find( const item: any = izstatusList.value.find(
(item: any) => item.value == row.states, (item: any) => item.value == row.states
) );
return h(StatusItem, { return h(StatusItem, {
id: row.id, id: row.id,
status: row.states, status: row.states,
label: item ? item.label : '', label: item ? item.label : "",
}) });
}, },
} };
} }
index = columnsRef.value.findIndex(v => v.title == '图片相似度') index = columnsRef.value.findIndex((v) => v.title == "图片相似度");
if (index > -1) { if (index > -1) {
columnsRef.value[index] = { columnsRef.value[index] = {
title: '图片相似度', title: "图片相似度",
key: columnsRef.value[index].key, key: columnsRef.value[index].key,
fixed: columnsRef.value[index].fixed || undefined, fixed: columnsRef.value[index].fixed || undefined,
width: 150, width: 150,
sorter: 'default', sorter: "default",
renderSorterIcon: ({ order }) => { renderSorterIcon: ({ order }) => {
if (order === false) if (order === false) return h(SvgIcon, { name: "sort-2" });
return h(SvgIcon, { name: 'sort-2' }) if (order === "ascend") return h(SvgIcon, { name: "sort-1" });
if (order === 'ascend') if (order === "descend") return h(SvgIcon, { name: "sort-3" });
return h(SvgIcon, { name: 'sort-1' })
if (order === 'descend')
return h(SvgIcon, { name: 'sort-3' })
}, },
render(row: any) { render(row: any) {
return row.similarityscore ? `${row.similarityscore}%` : '' return row.similarityscore ? `${row.similarityscore}%` : "";
}, },
} };
} }
index = columnsRef.value.findIndex(v => v.title == '提报时间') index = columnsRef.value.findIndex((v) => v.title == "提报时间");
if (index > -1) { if (index > -1) {
columnsRef.value[index] = { columnsRef.value[index] = {
title: '提报时间', title: "提报时间",
key: columnsRef.value[index].key, key: columnsRef.value[index].key,
fixed: columnsRef.value[index].fixed || undefined, fixed: columnsRef.value[index].fixed || undefined,
width: 200, width: 200,
sorter: 'default', sorter: "default",
renderSorterIcon: ({ order }) => { renderSorterIcon: ({ order }) => {
if (order === false) if (order === false) return h(SvgIcon, { name: "sort-2" });
return h(SvgIcon, { name: 'sort-2' }) if (order === "ascend") return h(SvgIcon, { name: "sort-1" });
if (order === 'ascend') if (order === "descend") return h(SvgIcon, { name: "sort-3" });
return h(SvgIcon, { name: 'sort-1' })
if (order === 'descend')
return h(SvgIcon, { name: 'sort-3' })
}, },
render(row: any) { render(row: any) {
return formatToDateHMS(row.createdate || 0) return formatToDateHMS(row.createdate || 0);
}, },
} };
} }
index = columnsRef.value.findIndex(v => v.title == '更新时间') index = columnsRef.value.findIndex((v) => v.title == "更新时间");
if (index > -1) { if (index > -1) {
columnsRef.value[index] = { columnsRef.value[index] = {
title: '更新时间', title: "更新时间",
key: columnsRef.value[index].key, key: columnsRef.value[index].key,
fixed: columnsRef.value[index].fixed || undefined, fixed: columnsRef.value[index].fixed || undefined,
width: 200, width: 200,
render(row: any) { render(row: any) {
return row.updatetime ? formatToDateHMS(row.updatetime) : '' return row.updatetime ? formatToDateHMS(row.updatetime) : "";
}, },
} };
} }
} }
const deviceHeight = ref(600) const deviceHeight = ref(600);
onMounted(() => { onMounted(() => {
emitter.on('filter-final', refreshHandler) emitter.on("filter-final", refreshHandler);
getColumns() getColumns();
nextTick(() => { nextTick(() => {
computeListHeight() computeListHeight();
}) });
}) });
onBeforeMount(() => { onBeforeMount(() => {
dicStore.fetchizstatusListt() dicStore.fetchizstatusListt();
}) });
watch( watch(
() => dicStore.izstatusList, () => dicStore.izstatusList,
(newval) => { (newval) => {
izstatusList.value = newval izstatusList.value = newval;
}, }
) );
onUnmounted(() => { onUnmounted(() => {
emitter.off('filter-final', refreshHandler) emitter.off("filter-final", refreshHandler);
}) });
const tableRef = ref<InstanceType<typeof NDataTable>>() const tableRef = ref<InstanceType<typeof NDataTable>>();
const rowKey = (row: RowData) => row.id const rowKey = (row: RowData) => row.id;
const loading = ref(true) const loading = ref(true);
const total = ref(0); const total = ref(0);
const pagination = reactive({ const pagination = reactive({
page: 1, page: 1,
@ -382,212 +373,204 @@ const pagination = reactive({
showSizePicker: true, showSizePicker: true,
pageSizes: [ pageSizes: [
{ {
label: '10 每页', label: "10 每页",
value: 10, value: 10,
}, },
{ {
label: '15 每页', label: "15 每页",
value: 15, value: 15,
}, },
{ {
label: '30 每页', label: "30 每页",
value: 30, value: 30,
}, },
{ {
label: '50 每页', label: "50 每页",
value: 50, value: 50,
}, },
], ],
showQuickJumper: true, showQuickJumper: true,
prefix:()=>`${total.value} 条数据` prefix: () => `${total.value} 条数据`,
}) });
const tableData = ref<Array<RowData>>([]) const tableData = ref<Array<RowData>>([]);
const selectionIds = ref<DataTableRowKey[]>([]) const selectionIds = ref<DataTableRowKey[]>([]);
const dialog = useDialog() const dialog = useDialog();
const message = useMessage() const message = useMessage();
const finalStore = useFinal() const finalStore = useFinal();
async function query(page: number, pageSize: number, filterId?: any) { async function query(page: number, pageSize: number, filterId?: any) {
const asideParmas = unref(finalStore.getAsideValue) const asideParmas = unref(finalStore.getAsideValue);
// 使使 // 使使
const params = filterId ? { userSearchId: filterId } : asideParmas const params = filterId ? { userSearchId: filterId } : asideParmas;
const result = await getFinalList({ const result = await getFinalList({
sortorder: 'asc', sortorder: "asc",
pageSize, pageSize,
currPage: page, currPage: page,
sortname: '', sortname: "",
...params, ...params,
}) });
const { data, pageCount } = result const { data, pageCount, totalCount } = result;
tableData.value = data tableData.value = data;
total.value = data.totalCount; total.value = totalCount;
pagination.page = page pagination.page = page;
pagination.pageCount = pageCount pagination.pageCount = pageCount;
loading.value = false loading.value = false;
} }
async function handlePageChange(currentPage) { async function handlePageChange(currentPage) {
if (loading.value) if (loading.value) return;
return
const { pageSize } = pagination const { pageSize } = pagination;
await query(currentPage, pageSize) await query(currentPage, pageSize);
} }
async function handlePageSizeChange(currentPageSize) { async function handlePageSizeChange(currentPageSize) {
if (loading.value) if (loading.value) return;
return
const { page } = pagination const { page } = pagination;
pagination.pageSize = currentPageSize pagination.pageSize = currentPageSize;
await query(page, currentPageSize) await query(page, currentPageSize);
} }
function handleCheck(rowKeys: DataTableRowKey[]) { function handleCheck(rowKeys: DataTableRowKey[]) {
selectionIds.value = rowKeys selectionIds.value = rowKeys;
} }
async function computeListHeight() { async function computeListHeight() {
const table = unref(tableRef) const table = unref(tableRef);
if (!table) if (!table) return;
return const tableEl: any = table?.$el;
const tableEl: any = table?.$el const headEl = tableEl.querySelector(".n-data-table-thead ");
const headEl = tableEl.querySelector('.n-data-table-thead ') const { bottomIncludeBody } = getViewportOffset(headEl);
const { bottomIncludeBody } = getViewportOffset(headEl) const headerH = 64;
const headerH = 64 let paginationH = 2;
let paginationH = 2 const marginH = 60;
const marginH = 60
if (!isBoolean(unref(pagination))) { if (!isBoolean(unref(pagination))) {
const paginationEl = tableEl.querySelector( const paginationEl = tableEl.querySelector(
'.n-data-table__pagination', ".n-data-table__pagination"
) as HTMLElement ) as HTMLElement;
if (paginationEl) { if (paginationEl) {
const offsetHeight = paginationEl.offsetHeight const offsetHeight = paginationEl.offsetHeight;
paginationH += offsetHeight || 0 paginationH += offsetHeight || 0;
} } else {
else { paginationH += 28;
paginationH += 28
} }
} }
let height = bottomIncludeBody - (headerH + paginationH + marginH) let height = bottomIncludeBody - (headerH + paginationH + marginH);
const maxHeight = 800 const maxHeight = 800;
height = maxHeight && maxHeight < height ? maxHeight : height height = maxHeight && maxHeight < height ? maxHeight : height;
deviceHeight.value = height deviceHeight.value = height;
} }
useWindowSizeFn(computeListHeight) useWindowSizeFn(computeListHeight);
const maxHeight = computed(() => { const maxHeight = computed(() => {
return tableData.value.length ? `${unref(deviceHeight)}px` : 'auto' return tableData.value.length ? `${unref(deviceHeight)}px` : "auto";
}) });
query(pagination.page, pagination.pageSize) query(pagination.page, pagination.pageSize);
const customTabelRef = ref(null) const customTabelRef = ref(null);
const importExcelRef = ref(null) const importExcelRef = ref(null);
const rejectModalRef = ref(null) const rejectModalRef = ref(null);
const repeatModalRef = ref(null) const repeatModalRef = ref(null);
const repeatTaskTableModalRef = ref(null) const repeatTaskTableModalRef = ref(null);
function showModal(modalRef: any) { function showModal(modalRef: any) {
const modal = unref(modalRef)! as any const modal = unref(modalRef)! as any;
modal.showModal() modal.showModal();
} }
const popover = ref<ComponentRef | null>(null) const popover = ref<ComponentRef | null>(null);
function importHandler() { function importHandler() {
(popover.value as any).setShow(false) (popover.value as any).setShow(false);
showModal(importExcelRef) showModal(importExcelRef);
} }
function exportHandler() { function exportHandler() {
loading.value = true loading.value = true;
import('@/utils/exportExcel').then((excel) => { import("@/utils/exportExcel").then((excel) => {
const tHeader = [ const tHeader = [
'任务Id', "任务Id",
'任务名称', "任务名称",
'审批节点', "审批节点",
'审批状态', "审批状态",
'图片相似度', "图片相似度",
'提报时间', "提报时间",
'更新时间', "更新时间",
] ];
const filterVal = [ const filterVal = [
'id', "id",
'name', "name",
'approvalnode', "approvalnode",
'approvalstatus', "approvalstatus",
'similarity', "similarity",
'uptime', "uptime",
'updatetime', "updatetime",
] ];
const list = tableData.value const list = tableData.value;
const data = formatJson(filterVal, list) const data = formatJson(filterVal, list);
excel.export_json_to_excel({ excel.export_json_to_excel({
header: tHeader, header: tHeader,
data, data,
filename: 'data', filename: "data",
autoWidth: true, autoWidth: true,
bookType: 'xlsx', bookType: "xlsx",
}) });
loading.value = false loading.value = false;
}) });
} }
function formatJson(filterVal, jsonDataList) { function formatJson(filterVal, jsonDataList) {
return jsonDataList.map(v => return jsonDataList.map((v) =>
filterVal.map((j) => { filterVal.map((j) => {
return v[j] return v[j];
}), })
) );
} }
function sucessHandler(excelData) { function sucessHandler(excelData) {
const data = excelData.content.map((item) => { const data = excelData.content.map((item) => {
const obj = {} const obj = {};
Object.keys(item).forEach((key) => { Object.keys(item).forEach((key) => {
const k = findKey(columns, key) const k = findKey(columns, key);
obj[k] = item[key] obj[k] = item[key];
}) });
return obj return obj;
}) });
tableData.value = data tableData.value = data;
} }
function commitHandler(columns) { function commitHandler(columns) {
columnsRef.value = [ columnsRef.value = [...columns, actionsColumns];
...columns, formatColumns();
actionsColumns,
]
formatColumns()
} }
function actionHandler(action: any, row: any) { function actionHandler(action: any, row: any) {
const { key } = action const { key } = action;
switch (key) { switch (key) {
case 'view': case "view":
goDetail(row) goDetail(row);
break break;
case 'reset': case "reset":
resetHandler() resetHandler();
break break;
case 'approval': case "approval":
approvalHandler(row) approvalHandler(row);
break break;
case 'reject': case "reject":
rejectHandler(row) rejectHandler(row);
break break;
default: default:
break break;
} }
} }
// states:1234 // states:1234
function validate(items: any[]) { function validate(items: any[]) {
if (items.length === 0) if (items.length === 0) return "至少选中一个任务";
return '至少选中一个任务'
// const useInfo = userStore.getUserInfo // const useInfo = userStore.getUserInfo
// const username = useInfo.loginname // const username = useInfo.loginname
@ -604,152 +587,151 @@ function validate(items: any[]) {
// return '' // return ''
// } // }
return null return null;
} }
function goDetail(row) { function goDetail(row) {
router.push({ name: 'final-detail', query: { id: row.id, packageid: row.packageid } }) router.push({ name: "final-detail", query: { id: row.id, packageid: row.packageid } });
} }
function resetHandler() { function resetHandler() {
dialog.info({ dialog.info({
title: '确认提示', title: "确认提示",
content: '确认重置当前选中的任务的审批吗?', content: "确认重置当前选中的任务的审批吗?",
positiveText: '确定', positiveText: "确定",
negativeText: '取消', negativeText: "取消",
onPositiveClick: async () => { onPositiveClick: async () => {
// TODO // TODO
// const result = await resetApproval() // const result = await resetApproval()
}, },
onNegativeClick: () => {}, onNegativeClick: () => {},
}) });
} }
function getSelectItems() { function getSelectItems() {
return tableData.value.filter(item => selectionIds.value.includes(item.id)) return tableData.value.filter((item) => selectionIds.value.includes(item.id));
} }
function approvalHandler(row) { function approvalHandler(row) {
// const items = getSelectItems() // const items = getSelectItems()
const items = [row] const items = [row];
const msg = validate(items) const msg = validate(items);
if (msg !== null) { if (msg !== null) {
message.error(msg) message.error(msg);
return return;
} }
dialog.info({ dialog.info({
title: '确认提示', title: "确认提示",
content: '确认给该任务审批为【通过】吗?', content: "确认给该任务审批为【通过】吗?",
positiveText: '确定', positiveText: "确定",
negativeText: '取消', negativeText: "取消",
onPositiveClick: () => { onPositiveClick: () => {
approval(items) approval(items);
}, },
onNegativeClick: () => {}, onNegativeClick: () => {},
}) });
} }
function batchApproval() { function batchApproval() {
const items = getSelectItems() const items = getSelectItems();
const msg = validate(items) const msg = validate(items);
if (msg !== null) { if (msg !== null) {
message.error(msg) message.error(msg);
return return;
} }
dialog.info({ dialog.info({
title: '确认提示', title: "确认提示",
content: '确认给该任务审批为【通过】吗?', content: "确认给该任务审批为【通过】吗?",
positiveText: '确定', positiveText: "确定",
negativeText: '取消', negativeText: "取消",
onPositiveClick: () => { onPositiveClick: () => {
approval(items) approval(items);
}, },
onNegativeClick: () => {}, onNegativeClick: () => {},
}) });
} }
function approval(items) { function approval(items) {
const formIds: string[] = items.map(item => item.id) const formIds: string[] = items.map((item) => item.id);
const taskIds: string[] = items.map(item => item.taskId) const taskIds: string[] = items.map((item) => item.taskId);
const tasknames: string[] = items.map(item => item.taskname) const tasknames: string[] = items.map((item) => item.taskname);
const param: ApprovalParam = { const param: ApprovalParam = {
formid: formIds, formid: formIds,
taskId: taskIds, taskId: taskIds,
approvd: true, approvd: true,
taskComment: 'approval', taskComment: "approval",
taskname: tasknames, taskname: tasknames,
} };
doAudit(param) doAudit(param);
} }
function rejectHandler(row) { function rejectHandler(row) {
// const items = getSelectItems() // const items = getSelectItems()
const items = [row] const items = [row];
const msg = validate(items) const msg = validate(items);
if (msg !== null) { if (msg !== null) {
message.error(msg) message.error(msg);
return return;
} }
const modal = unref(rejectModalRef)! as any const modal = unref(rejectModalRef)! as any;
modal.showModal() modal.showModal();
} }
function reject(idOrDesc: string, backId: string, isOther: boolean) { function reject(idOrDesc: string, backId: string, isOther: boolean) {
const items = getSelectItems() const items = getSelectItems();
const formIds: string[] = items.map(item => item.id) const formIds: string[] = items.map((item) => item.id);
const taskIds: string[] = items.map(item => item.fromtaskid) const taskIds: string[] = items.map((item) => item.fromtaskid);
const tasknames: string[] = items.map(item => item.fromtaskname) const tasknames: string[] = items.map((item) => item.fromtaskname);
const param: ApprovalParam = { const param: ApprovalParam = {
formid: formIds, formid: formIds,
taskId: taskIds, taskId: taskIds,
approvd: false, approvd: false,
taskComment: idOrDesc, taskComment: idOrDesc,
taskname: isOther ? tasknames : ['其他'], taskname: isOther ? tasknames : ["其他"],
} };
doAudit(param) doAudit(param);
} }
function doAudit(param: any) { function doAudit(param: any) {
audit(param).then((res) => { audit(param).then((res) => {
const { code } = res const { code } = res;
if (code === 'OK') if (code === "OK") reload();
reload() else message.error(res.message);
else message.error(res.message) });
})
} }
function reload() { function reload() {
const { page, pageSize } = unref(tableRef.value?.pagination) as PaginationProps const { page, pageSize } = unref(tableRef.value?.pagination) as PaginationProps;
query(page!, pageSize!) query(page!, pageSize!);
} }
watch( watch(
() => finalStore.asideValue, () => finalStore.asideValue,
(newVal, oldVal) => { (newVal, oldVal) => {
refreshHandler() refreshHandler();
}, },
{ deep: true }, { deep: true }
) );
function reset() { function reset() {
pagination.page = 1 pagination.page = 1;
pagination.pageCount = 1 pagination.pageCount = 1;
pagination.pageSize = 1 pagination.pageSize = 1;
} }
async function refreshHandler(searchId?: any) { async function refreshHandler(searchId?: any) {
reset() reset();
query(pagination.page, pagination.pageSize, searchId) query(pagination.page, pagination.pageSize, searchId);
} }
</script> </script>
@ -761,9 +743,7 @@ async function refreshHandler(searchId?: any) {
<SvgIcon size="32" name="magnifying" @click="changeContent" /> <SvgIcon size="32" name="magnifying" @click="changeContent" />
</div> </div>
<div> <div>
<NButton class="xjcc" text @click="showModal(repeatModalRef)"> <NButton class="xjcc" text @click="showModal(repeatModalRef)"> </NButton>
小结查重
</NButton>
<div class="btn" @click="batchApproval"> <div class="btn" @click="batchApproval">
<SvgIcon style="margin-right: 6px" size="14" name="tf" /> <SvgIcon style="margin-right: 6px" size="14" name="tf" />
批量审批 批量审批
@ -781,13 +761,19 @@ async function refreshHandler(searchId?: any) {
</template> </template>
<ul class="wrapper-header-action"> <ul class="wrapper-header-action">
<li @click="importHandler"> <li @click="importHandler">
<SvgIcon size="20" name="download" /><span style="margin-left: 5px">批量导入数据</span> <SvgIcon size="20" name="download" /><span style="margin-left: 5px"
>批量导入数据</span
>
</li> </li>
<li @click="exportHandler"> <li @click="exportHandler">
<SvgIcon size="20" name="download" /><span style="margin-left: 5px">导出待审数据</span> <SvgIcon size="20" name="download" /><span style="margin-left: 5px"
>导出待审数据</span
>
</li> </li>
<li> <li>
<SvgIcon size="20" name="download" /><span style="margin-left: 5px">导出全部数据</span> <SvgIcon size="20" name="download" /><span style="margin-left: 5px"
>导出全部数据</span
>
</li> </li>
</ul> </ul>
</n-popover> </n-popover>
@ -993,7 +979,7 @@ async function refreshHandler(searchId?: any) {
background: #fff; background: #fff;
} }
} }
:deep(.n-data-table .n-data-table-td.n-data-table-td--fixed-right){ :deep(.n-data-table .n-data-table-td.n-data-table-td--fixed-right) {
z-index: 100 !important; z-index: 100 !important;
} }
</style> </style>

@ -63,7 +63,7 @@ const columns: DataTableColumns<RowData> = [
{ {
title: "创建时间", title: "创建时间",
key: "createtime", key: "createtime",
width: 180 width: 180,
}, },
{ {
title: "更新者", title: "更新者",
@ -72,7 +72,7 @@ const columns: DataTableColumns<RowData> = [
{ {
title: "更新时间", title: "更新时间",
key: "updatetime", key: "updatetime",
width: 180 width: 180,
}, },
]; ];
const total = ref(0); const total = ref(0);
@ -83,7 +83,6 @@ const pagination = reactive({
pageSize: 10, pageSize: 10,
showSizePicker: true, showSizePicker: true,
pageSizes: [ pageSizes: [
{ {
label: "10 每页", label: "10 每页",
value: 10, value: 10,
@ -102,7 +101,7 @@ const pagination = reactive({
}, },
], ],
showQuickJumper: true, showQuickJumper: true,
prefix:()=>`${total.value} 条数据` prefix: () => `${total.value} 条数据`,
}); });
const tableData = ref<Array<RowData>>([]); const tableData = ref<Array<RowData>>([]);
const keyword = ref(""); const keyword = ref("");
@ -112,11 +111,10 @@ async function query(page: number, pageSize: number) {
search_searchname: { value: keyword.value, op: "like", type: "string" }, search_searchname: { value: keyword.value, op: "like", type: "string" },
}; };
const result = await getConditionList({ pageNo: page, pageSize }, searchParam, 0); const result = await getConditionList({ pageNo: page, pageSize }, searchParam, 0);
const { data, pageCount } = result; const { data, pageCount, total } = result;
total.value = data.total;
tableData.value = data; tableData.value = data;
pagination.page = page; pagination.page = page;
total.value = data.total; total.value = total;
pagination.pageCount = pageCount; pagination.pageCount = pageCount;
loading.value = false; loading.value = false;
} }

Loading…
Cancel
Save