|
|
|
@ -1,108 +1,105 @@
|
|
|
|
|
<script lang="ts" setup>
|
|
|
|
|
import { computed, h, reactive, ref, unref } from 'vue'
|
|
|
|
|
import { NDataTable, useDialog } from 'naive-ui'
|
|
|
|
|
import type { DataTableColumns, DataTableRowKey } from 'naive-ui'
|
|
|
|
|
import Action from '../comp/Action.vue'
|
|
|
|
|
import { RejectModal } from './index'
|
|
|
|
|
import type { RowData } from '@/config/final'
|
|
|
|
|
import { getFinalList } from '@/api/final'
|
|
|
|
|
import type { ApprovalParam } from '/#/api'
|
|
|
|
|
import { audit } from '@/api/task/task'
|
|
|
|
|
import { computed, h, reactive, ref, unref } from "vue";
|
|
|
|
|
import { NDataTable, useDialog } from "naive-ui";
|
|
|
|
|
import type { DataTableColumns, DataTableRowKey } from "naive-ui";
|
|
|
|
|
import Action from "../comp/Action.vue";
|
|
|
|
|
import { RejectModal } from "./index";
|
|
|
|
|
import type { RowData } from "@/config/final";
|
|
|
|
|
import { getFinalList } from "@/api/final";
|
|
|
|
|
import type { ApprovalParam } from "/#/api";
|
|
|
|
|
import { audit } from "@/api/task/task";
|
|
|
|
|
|
|
|
|
|
const emit = defineEmits<{
|
|
|
|
|
(e: 'commit', columns: any[])
|
|
|
|
|
}>()
|
|
|
|
|
(e: "commit", columns: any[]);
|
|
|
|
|
}>();
|
|
|
|
|
|
|
|
|
|
const show = ref(false)
|
|
|
|
|
const show = ref(false);
|
|
|
|
|
|
|
|
|
|
function showModal() {
|
|
|
|
|
show.value = true
|
|
|
|
|
show.value = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function closeModal() {
|
|
|
|
|
show.value = false
|
|
|
|
|
show.value = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function handleSumbit(e: MouseEvent) {
|
|
|
|
|
e.preventDefault()
|
|
|
|
|
closeModal()
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
closeModal();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
defineExpose({
|
|
|
|
|
showModal,
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const columns: DataTableColumns<RowData> = [
|
|
|
|
|
{
|
|
|
|
|
type: 'selection',
|
|
|
|
|
fixed: 'left',
|
|
|
|
|
type: "selection",
|
|
|
|
|
fixed: "left",
|
|
|
|
|
width: 50,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '任务Id',
|
|
|
|
|
key: 'id',
|
|
|
|
|
fixed: 'left',
|
|
|
|
|
title: "任务Id",
|
|
|
|
|
key: "id",
|
|
|
|
|
fixed: "left",
|
|
|
|
|
width: 100,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '任务名称',
|
|
|
|
|
key: 'fromtaskname',
|
|
|
|
|
fixed: 'left',
|
|
|
|
|
title: "任务名称",
|
|
|
|
|
key: "fromtaskname",
|
|
|
|
|
fixed: "left",
|
|
|
|
|
width: 200,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '审批节点',
|
|
|
|
|
key: 'approvalnode',
|
|
|
|
|
title: "审批节点",
|
|
|
|
|
key: "approvalnode",
|
|
|
|
|
width: 100,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '审批状态',
|
|
|
|
|
key: 'states',
|
|
|
|
|
title: "审批状态",
|
|
|
|
|
key: "states",
|
|
|
|
|
width: 100,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '图片相似度',
|
|
|
|
|
key: 'similarity',
|
|
|
|
|
title: "图片相似度",
|
|
|
|
|
key: "similarity",
|
|
|
|
|
width: 100,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '提报时间',
|
|
|
|
|
key: 'fromuptime',
|
|
|
|
|
title: "提报时间",
|
|
|
|
|
key: "fromuptime",
|
|
|
|
|
width: 200,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '更新时间',
|
|
|
|
|
key: 'updatetime',
|
|
|
|
|
title: "更新时间",
|
|
|
|
|
key: "updatetime",
|
|
|
|
|
width: 200,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '操作',
|
|
|
|
|
key: 'actions',
|
|
|
|
|
title: "操作",
|
|
|
|
|
key: "actions",
|
|
|
|
|
width: 200,
|
|
|
|
|
fixed: 'right',
|
|
|
|
|
fixed: "right",
|
|
|
|
|
render(row) {
|
|
|
|
|
return h(
|
|
|
|
|
Action,
|
|
|
|
|
{
|
|
|
|
|
return h(Action, {
|
|
|
|
|
id: row.id,
|
|
|
|
|
status: row.states,
|
|
|
|
|
trigger: actionHandler,
|
|
|
|
|
},
|
|
|
|
|
)
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
]
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
const rejectModalRef = ref(null)
|
|
|
|
|
const columnsRef = ref(columns)
|
|
|
|
|
const tableRef = ref<InstanceType<typeof NDataTable>>()
|
|
|
|
|
const rowKey = (row: RowData) => row.id
|
|
|
|
|
const loading = ref(true)
|
|
|
|
|
const rejectModalRef = ref(null);
|
|
|
|
|
const columnsRef = ref(columns);
|
|
|
|
|
const tableRef = ref<InstanceType<typeof NDataTable>>();
|
|
|
|
|
const rowKey = (row: RowData) => row.id;
|
|
|
|
|
const loading = ref(true);
|
|
|
|
|
const pagination = reactive({
|
|
|
|
|
page: 1,
|
|
|
|
|
pageCount: 1,
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
showSizePicker:true,
|
|
|
|
|
showSizePicker: true,
|
|
|
|
|
pageSizes: [
|
|
|
|
|
{
|
|
|
|
|
label: "10 每页",
|
|
|
|
@ -122,31 +119,36 @@ const pagination = reactive({
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
showQuickJumper: true,
|
|
|
|
|
})
|
|
|
|
|
const tableData = ref<Array<RowData>>([])
|
|
|
|
|
const selectionIds = ref<DataTableRowKey[]>([])
|
|
|
|
|
itemCount:100
|
|
|
|
|
});
|
|
|
|
|
const tableData = ref<Array<RowData>>([]);
|
|
|
|
|
const selectionIds = ref<DataTableRowKey[]>([]);
|
|
|
|
|
|
|
|
|
|
const deviceHeight = ref(600)
|
|
|
|
|
const deviceHeight = ref(600);
|
|
|
|
|
|
|
|
|
|
const maxHeight = computed(() => {
|
|
|
|
|
return tableData.value.length ? `${unref(deviceHeight)}px` : 'auto'
|
|
|
|
|
})
|
|
|
|
|
return tableData.value.length ? `${unref(deviceHeight)}px` : "auto";
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
async function query(page: number, pageSize: number) {
|
|
|
|
|
const result = await getFinalList({ sortorder: 'asc', pageSize: 10, currPage: 1, sortname: '' })
|
|
|
|
|
const { data, pageCount } = result
|
|
|
|
|
tableData.value = data
|
|
|
|
|
pagination.page = page
|
|
|
|
|
pagination.pageCount = pageCount
|
|
|
|
|
loading.value = false
|
|
|
|
|
const result = await getFinalList({
|
|
|
|
|
sortorder: "asc",
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
currPage: 1,
|
|
|
|
|
sortname: "",
|
|
|
|
|
});
|
|
|
|
|
const { data, pageCount } = result;
|
|
|
|
|
tableData.value = data;
|
|
|
|
|
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;
|
|
|
|
@ -158,56 +160,55 @@ async function handlePageSizeChange(currentPageSize) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function handleCheck(rowKeys: DataTableRowKey[]) {
|
|
|
|
|
selectionIds.value = rowKeys
|
|
|
|
|
selectionIds.value = rowKeys;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function actionHandler(action: any) {
|
|
|
|
|
const { key } = action
|
|
|
|
|
const { key } = action;
|
|
|
|
|
switch (key) {
|
|
|
|
|
case 'view':
|
|
|
|
|
|
|
|
|
|
break
|
|
|
|
|
case 'reset':
|
|
|
|
|
resetHandler()
|
|
|
|
|
break
|
|
|
|
|
case 'approval':
|
|
|
|
|
approvalHandler()
|
|
|
|
|
break
|
|
|
|
|
case 'reject':
|
|
|
|
|
(rejectModalRef.value as any).showModal()
|
|
|
|
|
break
|
|
|
|
|
case "view":
|
|
|
|
|
break;
|
|
|
|
|
case "reset":
|
|
|
|
|
resetHandler();
|
|
|
|
|
break;
|
|
|
|
|
case "approval":
|
|
|
|
|
approvalHandler();
|
|
|
|
|
break;
|
|
|
|
|
case "reject":
|
|
|
|
|
(rejectModalRef.value as any).showModal();
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const dialog = useDialog()
|
|
|
|
|
const dialog = useDialog();
|
|
|
|
|
|
|
|
|
|
function resetHandler() {
|
|
|
|
|
dialog.info({
|
|
|
|
|
title: '确认提示',
|
|
|
|
|
content: '确认重置当前选中的任务的审批吗?',
|
|
|
|
|
positiveText: '确定',
|
|
|
|
|
negativeText: '取消',
|
|
|
|
|
title: "确认提示",
|
|
|
|
|
content: "确认重置当前选中的任务的审批吗?",
|
|
|
|
|
positiveText: "确定",
|
|
|
|
|
negativeText: "取消",
|
|
|
|
|
onPositiveClick: async () => {
|
|
|
|
|
// TODO:需要支持重置
|
|
|
|
|
// const result = await resetApproval()
|
|
|
|
|
},
|
|
|
|
|
onNegativeClick: () => { },
|
|
|
|
|
})
|
|
|
|
|
onNegativeClick: () => {},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function approvalHandler() {
|
|
|
|
|
dialog.info({
|
|
|
|
|
title: '确认提示',
|
|
|
|
|
content: '确认给该任务审批为【通过】吗?',
|
|
|
|
|
positiveText: '确定',
|
|
|
|
|
negativeText: '取消',
|
|
|
|
|
title: "确认提示",
|
|
|
|
|
content: "确认给该任务审批为【通过】吗?",
|
|
|
|
|
positiveText: "确定",
|
|
|
|
|
negativeText: "取消",
|
|
|
|
|
onPositiveClick: () => {
|
|
|
|
|
// TODO:调用批量审批接口
|
|
|
|
|
},
|
|
|
|
|
onNegativeClick: () => { },
|
|
|
|
|
})
|
|
|
|
|
onNegativeClick: () => {},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function rejectHandler(idOrDesc: string, isOther: boolean) {
|
|
|
|
@ -218,22 +219,26 @@ function rejectHandler(idOrDesc: string, isOther: boolean) {
|
|
|
|
|
// approvd: false,
|
|
|
|
|
// taskComment: '',
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// if (isOther)
|
|
|
|
|
// param.taskComment = idOrDesc
|
|
|
|
|
// else
|
|
|
|
|
// param.taskComment = idOrDesc
|
|
|
|
|
|
|
|
|
|
// audit(param)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
query(pagination.page, pagination.pageSize)
|
|
|
|
|
query(pagination.page, pagination.pageSize);
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
<div>
|
|
|
|
|
<n-modal v-model:show="show" transform-origin="center">
|
|
|
|
|
<n-card class="cardstyle" :bordered="false" size="huge" role="dialog" aria-modal="true">
|
|
|
|
|
<n-card
|
|
|
|
|
class="cardstyle"
|
|
|
|
|
:bordered="false"
|
|
|
|
|
size="huge"
|
|
|
|
|
role="dialog"
|
|
|
|
|
aria-modal="true"
|
|
|
|
|
>
|
|
|
|
|
<div class="wrapper">
|
|
|
|
|
<span class="wrapper-title">重复任务</span>
|
|
|
|
|
<div class="wrapper-bar">
|
|
|
|
@ -243,19 +248,25 @@ query(pagination.page, pagination.pageSize)
|
|
|
|
|
</div>
|
|
|
|
|
<div class="wrapper-content">
|
|
|
|
|
<NDataTable
|
|
|
|
|
ref="tableRef" remote :columns="columnsRef" :scroll-x="1250" :max-height="maxHeight" :data="tableData"
|
|
|
|
|
:loading="loading" :pagination="pagination" :row-key="rowKey" @update:page="handlePageChange"
|
|
|
|
|
@update-page-size="handlePageSizeChange"
|
|
|
|
|
ref="tableRef"
|
|
|
|
|
remote
|
|
|
|
|
:columns="columnsRef"
|
|
|
|
|
:scroll-x="1250"
|
|
|
|
|
:max-height="maxHeight"
|
|
|
|
|
:data="tableData"
|
|
|
|
|
:loading="loading"
|
|
|
|
|
:pagination="pagination"
|
|
|
|
|
:row-key="rowKey"
|
|
|
|
|
@update:page="handlePageChange"
|
|
|
|
|
@update-page-size="handlePageSizeChange"
|
|
|
|
|
@update:checked-row-keys="handleCheck"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<template #footer>
|
|
|
|
|
<div class="wrapper-footer">
|
|
|
|
|
<n-button type="info" @click="handleSumbit">
|
|
|
|
|
确认
|
|
|
|
|
</n-button>
|
|
|
|
|
<n-button secondary style="margin-left:15px" @click="closeModal">
|
|
|
|
|
<n-button type="info" @click="handleSumbit"> 确认 </n-button>
|
|
|
|
|
<n-button secondary style="margin-left: 15px" @click="closeModal">
|
|
|
|
|
取消
|
|
|
|
|
</n-button>
|
|
|
|
|
</div>
|
|
|
|
@ -284,7 +295,7 @@ query(pagination.page, pagination.pageSize)
|
|
|
|
|
|
|
|
|
|
&-content {
|
|
|
|
|
flex: auto;
|
|
|
|
|
background: #FFF;
|
|
|
|
|
background: #fff;
|
|
|
|
|
margin-top: 20px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -299,7 +310,7 @@ query(pagination.page, pagination.pageSize)
|
|
|
|
|
|
|
|
|
|
&:before {
|
|
|
|
|
background-color: #1980ff;
|
|
|
|
|
content: '';
|
|
|
|
|
content: "";
|
|
|
|
|
width: 5px;
|
|
|
|
|
border-radius: 2px;
|
|
|
|
|
top: 0;
|
|
|
|
|