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,
})
const { data: { list, totalPage } } = res
const { data: { list, totalPage,totalCount } } = res
return {
pageCount: totalPage,
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 {
pageCount: pages,
data: records,
total
}
}

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

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

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

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

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

Loading…
Cancel
Save