案件撤回优化时间范围取值

dianlixunjian
刘妍 2024-10-10 11:08:00 +08:00
parent 101e97d189
commit 430a14359f
1 changed files with 134 additions and 48 deletions

View File

@ -1,24 +1,29 @@
<template> <template>
<div style="width: 100%"> <div style="width: 100%">
<BasicTable @register="registerTable" :searchInfo="searchInfo"> <div class="search-box">
<template #bodyCell="{ column, record }"> <BasicForm @register="registerForm" :labelWidth="100" :actionColOptions="{ span: 24 }" />
<template v-if="column.key === 'action'"> </div>
<TableAction <div class="table-box">
:actions="[ <BasicTable @register="registerTable" :searchInfo="searchInfo" @change="handleChange">
{ <template #bodyCell="{ column, record }">
label: '详情', <template v-if="column.key === 'action'">
onClick: handleDetail.bind(null, record), <TableAction
}, :actions="[
{ {
label: '撤回', label: '详情',
color: 'error', onClick: handleDetail.bind(null, record),
onClick: revokeBtnClick.bind(null, record), },
}, {
]" label: '撤回',
/> color: 'error',
onClick: revokeBtnClick.bind(null, record),
},
]"
/>
</template>
</template> </template>
</template> </BasicTable>
</BasicTable> </div>
<a-modal <a-modal
width="100%" width="100%"
wrap-class-name="full-modal" wrap-class-name="full-modal"
@ -39,16 +44,17 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { reactive, h, ref, watch, onMounted } from 'vue'; import { reactive, ref, watch, onMounted } from 'vue';
import { BasicTable, useTable, TableAction } from '@/components/Table'; import { BasicTable, useTable, TableAction } from '@/components/Table';
import { getRetractPageList } from '@/api/sys/WFTask'; import { getRetractPageList } from '@/api/sys/WFTask';
import { getDetail } from '@/api/sys/WFSchemeInfo'; import { getDetail } from '@/api/sys/WFSchemeInfo';
import { Tag } from 'ant-design-vue';
import { flowStore } from '@/store/modules/flow'; import { flowStore } from '@/store/modules/flow';
import { useRoute, useRouter } from 'vue-router'; import { useRoute } from 'vue-router';
import { retract } from '@/api/sys/WFProcess'; import { retract } from '@/api/sys/WFProcess';
import { useMessage } from '@/hooks/web/useMessage'; import { useMessage } from '@/hooks/web/useMessage';
import { Look } from '@/views/demo/workflow/task/process/page'; import { Look } from '@/views/demo/workflow/task/process/page';
import { BasicForm, useForm } from '@/components/Form';
import dayjs from 'dayjs';
const { createConfirm, createMessage } = useMessage(); const { createConfirm, createMessage } = useMessage();
const props = defineProps({ const props = defineProps({
@ -72,8 +78,92 @@
const route: any = useRoute(); const route: any = useRoute();
const code = ref(route.params.id); const code = ref(route.params.id);
searchInfo.Code = code.value; searchInfo.Code = code.value;
const [registerTable, { reload }] = useTable({ const tableData = ref([]);
api: getRetractPageList, const searchParams = ref({
page: 1,
limit: 10,
Code: code.value,
});
const tablePaginationRight = ref({
current: 1,
pageSize: 10,
size: 'small',
defaultPageSize: 10,
showSizeChanger: true,
pageSizeOptions: ['10', '50', '80', '100'],
showQuickJumper: true,
total: 0,
});
const [registerForm, { validate, getFieldsValue }] = useForm({
schemas: [
{
field: '[StartDate, EndDate]',
label: '日期范围',
component: 'RangePicker',
colProps: { span: 8 },
componentProps: {
format: 'YYYY-MM-DD',
placeholder: ['开始日期', '结束日期'],
},
},
{
field: 'CaseNo',
label: '图斑编号',
component: 'Input',
colProps: { span: 6 },
},
],
labelWidth: 100,
baseColProps: { span: 6 },
actionColOptions: { span: 24 },
autoSubmitOnEnter: true,
submitFunc: handleSubmit,
resetFunc: handleReset,
autoSubmitOnEnter: handleSubmit,
});
function handleSubmit() {
searchParams.value = getFieldsValue();
searchParams.value.page = 1;
searchParams.value.Code = code.value;
tablePaginationRight.value.current = 1;
searchParams.value.limit = tablePaginationRight.value.pageSize;
getTableData(searchParams.value);
}
async function getTableData(querys) {
if (querys.StartDate && querys.EndDate) {
querys.StartDate = dayjs(querys.StartDate).format('YYYY-MM-DD');
querys.EndDate = dayjs(querys.EndDate).endOf('day').format('YYYY-MM-DD HH:mm:ss');
}
setLoading(true);
await getRetractPageList(querys).then((res) => {
tableData.value = res.items;
tablePaginationRight.value.total = res.total;
setTableData(tableData.value);
setPagination(tablePaginationRight.value);
setLoading(false);
});
}
function handleReset() {
searchParams.value = {
page: 1,
limit: 10,
Code: code.value,
};
tablePaginationRight.value.current = 1;
getTableData(searchParams.value);
}
function handleChange(data) {
searchParams.value.page = data.current;
searchParams.value.limit = data.pageSize;
tablePaginationRight.value = data;
getTableData(searchParams.value);
}
onMounted(() => {
getTableData(searchParams.value);
});
const [registerTable, { setTableData, reload, setPagination, setLoading }] = useTable({
// api: getRetractPageList,
dataSource: tableData.value,
columns: [ columns: [
{ {
title: '图斑编号', title: '图斑编号',
@ -106,32 +196,12 @@
}, },
], ],
rowKey: 'id', rowKey: 'id',
formConfig: { useSearchForm: false,
labelWidth: 120,
showAdvancedButton: false,
autoSubmitOnEnter: true,
schemas: [
{
field: '[StartDate, EndDate]',
label: '日期范围',
component: 'RangePicker',
componentProps: {
format: 'YYYY-MM-DD',
placeholder: ['开始日期', '结束日期'],
},
},
{
field: 'CaseNo',
label: '图斑编号',
component: 'Input',
colProps: { span: 8 },
},
],
},
useSearchForm: true,
showTableSetting: true, showTableSetting: true,
bordered: true, bordered: true,
//
handleSearchInfoFn(info) { handleSearchInfoFn(info) {
searchParams.value = info;
return info; return info;
}, },
actionColumn: { actionColumn: {
@ -140,10 +210,11 @@
dataIndex: 'action', dataIndex: 'action',
// slots: { customRender: 'action' }, // slots: { customRender: 'action' },
}, },
pagination: tablePaginationRight.value,
}); });
function closeMolder() { function closeMolder() {
auditOpen.value = false; auditOpen.value = false;
reload(); getTableData(searchParams.value);
} }
// //
async function handleDetail(record) { async function handleDetail(record) {
@ -170,7 +241,7 @@
des: '', des: '',
}); });
if (data) { if (data) {
reload(); getTableData(searchParams.value);
return createMessage.success('成功'); return createMessage.success('成功');
} else { } else {
return createMessage.error('失败'); return createMessage.error('失败');
@ -199,3 +270,18 @@
height: 95% !important; height: 95% !important;
} }
</style> </style>
<style lang="less" scoped>
.search-box {
background: @component-background;
margin: 16px;
padding: 16px;
}
::v-deep .search-box .ant-col-24 {
display: inline-block;
max-width: fit-content;
margin-left: 20px;
}
.table-box {
margin: 16px;
}
</style>