提交用章

This commit is contained in:
123 2025-05-16 16:28:33 +08:00
parent e2d0c38306
commit 4ac4448649
7 changed files with 1098 additions and 1 deletions

View File

@ -0,0 +1,63 @@
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { SealVO, SealQuery, SealForm } from '@/api/workflow/seal/types';
/**
*
* @param query
* @returns {*}
*/
export const listSeal = (query?: SealQuery): AxiosPromise<SealVO[]> => {
return request({
url: '/workflow/seal/list',
method: 'get',
params: query
});
};
/**
*
* @param id
*/
export const getSeal = (id: string | number): AxiosPromise<SealVO> => {
return request({
url: '/workflow/seal/' + id,
method: 'get'
});
};
/**
*
* @param data
*/
export const addSeal = (data: SealForm): AxiosPromise<SealVO> => {
return request({
url: '/workflow/seal',
method: 'post',
data: data
});
};
/**
*
* @param data
*/
export const updateSeal = (data: SealForm): AxiosPromise<SealVO> => {
return request({
url: '/workflow/seal',
method: 'put',
data: data
});
};
/**
*
* @param id
*/
export const delSeal = (id: string | number | Array<string | number>) => {
return request({
url: '/workflow/seal/' + id,
method: 'delete'
});
};

View File

@ -0,0 +1,248 @@
export interface SealVO {
/**
* id
*/
id: string | number;
/**
*
*/
businessType: string;
/**
*
*/
sealDate: string;
/**
*
*/
takeOutFlag: string;
/**
*
*/
sealMoney: number;
/**
*
*/
remark: string;
/**
*
*/
status: string;
/**
*
*/
attachment: string;
/**
* ids
*/
sealIds: Array<string | number>;
/**
*
*/
fileName: string;
/**
*
*/
fileCode: string;
/**
*
*/
takeOutStartDate: string;
/**
*
*/
takeOutEndDate: string;
/**
*
*/
fileCount: number;
/**
*
*/
initiatorType: number;
/**
*
*/
takeOutAddress?: string;
}
export interface SealForm extends BaseEntity {
/**
* id
*/
id?: string | number;
/**
*
*/
businessType?: string;
/**
*
*/
sealDate?: string;
/**
*
*/
takeOutFlag?: string;
/**
*
*/
sealMoney?: number;
/**
*
*/
remark?: string;
/**
*
*/
status?: string;
/**
*
*/
attachment?: string;
/**
* ids
*/
sealIds: Array<string | number>;
/**
*
*/
sealName?: string | number;
/**
*
*/
fileName?: string;
/**
*
*/
fileCode?: string;
/**
*
*/
takeOutStartDate?: string;
/**
*
*/
takeOutEndDate?: string;
/**
*
*/
fileCount?: number;
/**
*
*/
initiatorType?: number;
/**
*
*/
takeOutAddress?: string;
}
export interface SealQuery extends PageQuery {
/**
*
*/
businessType?: string;
/**
*
*/
sealDate?: string;
/**
*
*/
takeOutFlag?: string;
/**
*
*/
sealMoney?: number;
/**
*
*/
status?: string;
/**
*
*/
attachment?: string;
/**
* id
*/
sealId?: string | number;
/**
*
*/
fileName?: string;
/**
*
*/
fileCode?: string;
/**
*
*/
takeOutStartDate?: string;
/**
*
*/
takeOutEndDate?: string;
/**
*
*/
fileCount?: number;
/**
*
*/
initiatorType?: number;
/**
*
*/
params?: any;
}

View File

@ -0,0 +1,148 @@
<!-- src/components/SealSearchDialog.vue -->
<template>
<el-dialog
title="选择企业公章"
v-model="dialogVisible"
width="60%"
>
<!-- 搜索条件 -->
<el-form :inline="true" :model="searchForm" class="demo-form-inline">
<el-form-item label="公章名称">
<el-input v-model="searchForm.name" placeholder="请输入公章名称" />
</el-form-item>
<el-form-item label="公章编号">
<el-input v-model="searchForm.code" placeholder="请输入公章编号" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleSearchList">查询</el-button>
<el-button @click="resetSearchForm">重置</el-button>
</el-form-item>
</el-form>
<!-- 数据表格添加勾选列 -->
<el-table
:data="tableData"
@selection-change="handleSelectionChange"
style="width: 100%; margin-top: 20px;"
ref="multipleTable"
>
<el-table-column type="selection" width="55" /> <!-- 勾选列 -->
<el-table-column prop="id" label="ID" width="80" />
<el-table-column prop="name" label="公章名称" />
<el-table-column prop="code" label="公章编号" />
<el-table-column prop="status" label="状态">
<template #default="{ row }">
<el-tag :type="row.status === '1' ? 'success' : 'danger'">
{{ row.status === '1' ? '启用' : '禁用' }}
</el-tag>
</template>
</el-table-column>
</el-table>
<!-- 分页可选 -->
<el-pagination
style="margin-top: 20px; text-align: right;"
background
layout="prev, pager, next"
:total="total"
:page-size="pageSize"
:current-page="currentPage"
@current-change="handlePageChange"
/>
<!-- 底部按钮确认/取消 -->
<template #footer>
<span class="dialog-footer">
<el-button @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="handleConfirm">确认</el-button>
</span>
</template>
</el-dialog>
</template>
<script setup name="SealDialog" lang="ts">
import { ref, computed } from 'vue';
// /
const props = defineProps({
visible: {
type: Boolean,
required: true,
},
});
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const emit = defineEmits(['update:visible', 'confirm']);
//
const dialogVisible = computed({
get: () => props.visible,
set: (val) => emit('update:visible', val),
});
//
const searchForm = ref({
name: '',
code: '',
});
//
const tableData = ref([]);
const total = ref(0);
const pageSize = ref(10);
const currentPage = ref(1);
//
const selectedRows = ref([]);
//
const handleSelectionChange = (val) => {
selectedRows.value = val;
};
// API
const fetchData = async () => {
const mockData = [
{ id: '1', name: '公章A', code: 'GA001', status: '1' },
{ id: '2', name: '公章B', code: 'GA002', status: '0' },
];
tableData.value = mockData;
total.value = mockData.length;
};
//
const handleSearchList = () => {
fetchData();
};
//
const resetSearchForm = () => {
searchForm.value = {
name: '',
code: '',
};
currentPage.value = 1;
fetchData();
};
//
const handleConfirm = () => {
if (selectedRows.value.length === 0) {
proxy?.$modal.msgError('请至少选择一项!');
return;
}
emit('confirm', selectedRows.value.map(row => row.id)); // ID
dialogVisible.value = false;
};
//
const handlePageChange = (page) => {
currentPage.value = page;
fetchData();
};
</script>
<style scoped>
.demo-form-inline {
margin-bottom: 20px;
}
</style>

View File

@ -190,6 +190,20 @@ export const dynamicRoutes: RouteRecordRaw[] = [
meta: { title: '出差申请', activeMenu: '/workflow/businessTrip', noCache: true } meta: { title: '出差申请', activeMenu: '/workflow/businessTrip', noCache: true }
} }
] ]
},
{
path: '/workflow/sealEdit',
component: Layout,
hidden: true,
permissions: ['workflow:seal:edit'],
children: [
{
path: 'index',
component: () => import('@/views/workflow/seal/sealEdit.vue'),
name: 'sealEdit',
meta: { title: '用章申请', activeMenu: '/workflow/seal', noCache: true }
}
]
}, },
{ {
path: '/workflow/design', path: '/workflow/design',

View File

@ -75,7 +75,7 @@
</div> </div>
</template> </template>
<script setup name="Leave" lang="ts"> <script setup name="Trip" lang="ts">
import { addBusinessTrip, getBusinessTrip, updateBusinessTrip } from '@/api/workflow/businessTrip'; import { addBusinessTrip, getBusinessTrip, updateBusinessTrip } from '@/api/workflow/businessTrip';
import { BusinessTripForm, BusinessTripQuery, BusinessTripVO } from '@/api/workflow/businessTrip/types'; import { BusinessTripForm, BusinessTripQuery, BusinessTripVO } from '@/api/workflow/businessTrip/types';
import { startWorkFlow } from '@/api/workflow/task'; import { startWorkFlow } from '@/api/workflow/task';

View File

@ -0,0 +1,249 @@
<template>
<div class="p-2">
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<div v-show="showSearch" class="search">
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
<el-form-item label="业务类型" prop="business_type">
<el-input v-model="queryParams.businessType" placeholder="请输入业务类型" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="公章名称" prop="business_type">
<el-input v-model="queryParams.businessType" placeholder="请输入公章名称" clearable @keyup.enter="handleQuery" />
</el-form-item>
<!-- <el-form-item prop="endSealDays"> </el-form-item> -->
<!-- <el-form-item prop="endSealDays">
<el-input v-model="queryParams.endSealDays" placeholder="请输入用章天数" clearable @keyup.enter="handleQuery" />
</el-form-item> -->
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</div>
</transition>
<el-card shadow="never">
<template #header>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button v-hasPermi="['workflow:seal:add']" type="primary" plain icon="Plus" @click="handleAdd">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button v-hasPermi="['workflow:seal:export']" type="warning" plain icon="Download" @click="handleExport">导出</el-button>
</el-col>
<right-toolbar v-model:show-search="showSearch" @query-table="getList"></right-toolbar>
</el-row>
</template>
<el-table v-loading="loading" border :data="sealList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column v-if="false" label="主键" align="center" prop="id" />
<el-table-column label="业务类型" align="center">
<template #default="scope">
<dict-tag :options="business_type" :value="scope.row.businessType" />
</template>
</el-table-column>
<el-table-column label="用章时间" align="center" prop="startDate">
<template #default="scope">
<span>{{ proxy.parseTime(scope.row.sealDate, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="是否外带" align="center" prop="takeOutFlag">
<template #default="scope">
<dict-tag :options="opr_yes_no" :value="scope.row.takeOutFlag"></dict-tag>
</template>
</el-table-column>
<!-- <el-table-column label="公章类别" align="center" prop="sealType">
<template #default="scope">
<dict-tag :options="opr_seal_type" :value="scope.row.sealType"></dict-tag>
</template>
</el-table-column>
<el-table-column label="公章名称" align="center" prop="sealName" /> -->
<el-table-column label="文件名称" align="center" prop="fileName" />
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column align="center" label="流程状态" min-width="70">
<template #default="scope">
<dict-tag :options="wf_business_status" :value="scope.row.status"></dict-tag>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="162">
<template #default="scope">
<el-row :gutter="10" class="mb8">
<el-col :span="1.5" v-if="scope.row.status === 'draft' || scope.row.status === 'cancel' || scope.row.status === 'back'">
<el-button v-hasPermi="['workflow:business:edit']" size="small" type="primary" icon="Edit" @click="handleUpdate(scope.row)"
>修改</el-button
>
</el-col>
<el-col :span="1.5" v-if="scope.row.status === 'draft' || scope.row.status === 'cancel' || scope.row.status === 'back'">
<el-button v-hasPermi="['workflow:business:remove']" size="small" type="primary" icon="Delete" @click="handleDelete(scope.row)"
>删除</el-button
>
</el-col>
</el-row>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" size="small" icon="View" @click="handleView(scope.row)">查看</el-button>
</el-col>
<el-col :span="1.5" v-if="scope.row.status === 'waiting'">
<el-button size="small" type="primary" icon="Notification" @click="handleCancelProcessApply(scope.row.id)">撤销</el-button>
</el-col>
</el-row>
</template>
</el-table-column>
</el-table>
<pagination v-show="total > 0" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" :total="total" @pagination="getList" />
</el-card>
</div>
</template>
<script setup name="Trip" lang="ts">
import { delSeal, listSeal } from '@/api/workflow/seal';
import { cancelProcessApply } from '@/api/workflow/instance';
import { SealForm, SealQuery, SealVO } from '@/api/workflow/seal/types';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { wf_business_status } = toRefs<any>(proxy?.useDict('wf_business_status'));
const sealList = ref<SealVO[]>([]);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref<Array<string | number>>([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const { business_type , opr_yes_no , opr_seal_type } = toRefs<any>(proxy?.useDict('business_type','opr_yes_no','opr_seal_type'));
// const options = [
// {
// value: '1',
// label: ''
// },
// {
// value: '2',
// label: ''
// },
// {
// value: '3',
// label: ''
// },
// {
// value: '4',
// label: ''
// }
// ];
const queryFormRef = ref<ElFormInstance>();
const data = reactive<PageData<SealForm, SealQuery>>({
form: {},
queryParams: {
pageNum: 1,
pageSize: 10
// ,
// startSealDays: undefined,
// endSealDays: undefined
},
rules: {}
});
const { queryParams } = toRefs(data);
/** 查询用章列表 */
const getList = async () => {
loading.value = true;
const res = await listSeal(queryParams.value);
sealList.value = res.rows;
total.value = res.total;
loading.value = false;
};
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.value.pageNum = 1;
getList();
};
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value?.resetFields();
handleQuery();
};
/** 多选框选中数据 */
const handleSelectionChange = (selection: SealVO[]) => {
ids.value = selection.map((item) => item.id);
single.value = selection.length != 1;
multiple.value = !selection.length;
};
/** 新增按钮操作 */
const handleAdd = () => {
proxy.$tab.closePage(proxy.$route);
proxy.$router.push({
path: `/workflow/sealEdit/index`,
query: {
type: 'add'
}
});
};
/** 修改按钮操作 */
const handleUpdate = (row?: SealVO) => {
proxy.$tab.closePage(proxy.$route);
proxy.$router.push({
path: `/workflow/sealEdit/index`,
query: {
id: row.id,
type: 'update'
}
});
};
/** 查看按钮操作 */
const handleView = (row?: SealVO) => {
proxy.$tab.closePage(proxy.$route);
proxy.$router.push({
path: `/workflow/sealEdit/index`,
query: {
id: row.id,
type: 'view'
}
});
};
/** 删除按钮操作 */
const handleDelete = async (row?: SealVO) => {
const _ids = row?.id || ids.value;
await proxy?.$modal.confirm('是否确认删除用章编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
await delSeal(_ids);
proxy?.$modal.msgSuccess('删除成功');
await getList();
};
/** 导出按钮操作 */
const handleExport = () => {
proxy?.download(
'workflow/seal/export',
{
...queryParams.value
},
`seal_${new Date().getTime()}.xlsx`
);
};
/** 撤销按钮操作 */
const handleCancelProcessApply = async (id: string) => {
await proxy?.$modal.confirm('是否确认撤销当前单据?');
loading.value = true;
let data = {
businessId: id,
message: '申请人撤销流程!'
};
await cancelProcessApply(data).finally(() => (loading.value = false));
await getList();
proxy?.$modal.msgSuccess('撤销成功');
};
onMounted(() => {
getList();
});
</script>

View File

@ -0,0 +1,375 @@
<template>
<div class="p-2">
<el-card shadow="never">
<div style="display: flex; justify-content: space-between">
<div>
<el-button v-if="submitButtonShow" :loading="buttonLoading" type="info" @click="submitForm('draft')">暂存</el-button>
<el-button v-if="submitButtonShow" :loading="buttonLoading" type="primary" @click="submitForm('submit')"> </el-button>
<el-button v-if="approvalButtonShow" :loading="buttonLoading" type="primary" @click="approvalVerifyOpen">审批</el-button>
<el-button v-if="form && form.id && form.status !== 'draft'" type="primary" @click="handleApprovalRecord">流程进度</el-button>
</div>
<div>
<el-button style="float: right" @click="goBack()">返回</el-button>
</div>
</div>
</el-card>
<el-card shadow="never" style="height: 78vh; overflow-y: auto">
<el-form ref="sealFormRef" v-loading="loading" :disabled="routeParams.type === 'view'" :model="form" :rules="rules" label-width="80px">
<el-form-item label="业务类别" prop="businessType">
<el-select v-model="form.businessType" placeholder="请选择业务类别" style="width: 100%">
<el-option v-for="item in business_type" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<!-- <el-form-item label="预算事项" prop="budgetType">
<el-select v-model="form.budgetType" placeholder="请选择预算事项" style="width: 100%">
<el-option v-for="item in opr_oa_trip_budget_type" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item> -->
<el-form-item label="用章日期" prop="sealDate">
<el-date-picker
v-model="form.sealDate"
value-format="YYYY-MM-DD"
type="date"
placeholder="选择日期"
:default-time="new Date()"
/>
</el-form-item>
<el-form-item label="企业公章" prop="sealId">
<el-input v-model="form.sealIds" type="text" placeholder="请输入企业公章" style="width: 220px;margin-right: 8px;" readonly/>
<el-button type="primary" @click="openSealDialog">搜索</el-button>
<!-- icon="el-icon-search" -->
<!-- 引入独立的 SealSearchDialog 组件 -->
<SealSearchDialog :visible="dialogVisibleSeal"
@update:visible="dialogVisibleSeal = $event"
@confirm="handleSealSelect"
/>
</el-form-item>
<el-form-item label="文件名称" prop="fileName">
<el-input v-model="form.fileName" type="textarea" :rows="3" placeholder="请输入文件名称" />
</el-form-item>
<el-form-item label="文件编号" prop="fileCode">
<el-input v-model="form.fileCode" type="textarea" :rows="3" placeholder="请输入文件编号" />
</el-form-item>
<el-form-item label="金额" prop="sealMoney">
<el-input v-model="form.sealMoney" type="number" placeholder="请输入金额" style="width: 200px;"/>
</el-form-item>
<el-form-item label="份数" prop="fileCount">
<el-input v-model="form.fileCount" type="text" @input="handleInput" placeholder="请输入份数" />
</el-form-item>
<el-form-item label="是否外带" prop="takeOutFlag">
<el-radio-group v-model="form.takeOutFlag">
<el-radio v-for="dict in opr_yes_no" :key="dict.value" :value="dict.value">{{ dict.label }}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="外带日期" v-if="form.takeOutFlag === '1'">
<el-date-picker
v-model="takeOutDate"
value-format="YYYY-MM-DD"
type="daterange"
range-separator="To"
start-placeholder="开始日期"
end-placeholder="结束日期"
:default-time="new Date()"
@change="changetakeOutDate()"
/>
</el-form-item>
<el-form-item label="外带地址" prop="takeOutAddress" v-if="form.takeOutFlag === '1'">
<el-input v-model="form.takeOutAddress" type="text" placeholder="请输入外带地址" />
</el-form-item>
<el-form-item label="附件" prop="attachment">
<imageUpload v-model="form.attachment" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" :rows="3" placeholder="请输入备注" />
</el-form-item>
</el-form>
</el-card>
<!-- 提交组件 -->
<submitVerify ref="submitVerifyRef" :task-variables="taskVariables" @submit-callback="submitCallback" />
<!-- 审批记录 -->
<approvalRecord ref="approvalRecordRef" />
<el-dialog v-model="dialogVisible.visible" :title="dialogVisible.title" :before-close="handleClose" width="500">
<el-select v-model="flowCode" placeholder="Select" style="width: 240px">
<el-option v-for="item in flowCodeOptions" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
<template #footer>
<div class="dialog-footer">
<el-button @click="handleClose">取消</el-button>
<el-button type="primary" @click="submitFlow()"> 确认 </el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script setup name="Seal" lang="ts">
import { addSeal, getSeal, updateSeal } from '@/api/workflow/seal';
import { SealForm, SealQuery, SealVO } from '@/api/workflow/seal/types';
import { startWorkFlow } from '@/api/workflow/task';
import SubmitVerify from '@/components/Process/submitVerify.vue';
import ApprovalRecord from '@/components/Process/approvalRecord.vue';
import { AxiosResponse } from 'axios';
import { StartProcessBo } from '@/api/workflow/workflowCommon/types';
import SealSearchDialog from '@/components/SealSearchDialog/index.vue';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const buttonLoading = ref(false);
const loading = ref(true);
const takeOutDate = ref<Array<string>>([]);
//
const routeParams = ref<Record<string, any>>({});
const { business_type,opr_yes_no } = toRefs<any>(proxy?.useDict('business_type','opr_yes_no'));
const dialogVisibleSeal = ref(false);
//
const openSealDialog = () => {
dialogVisibleSeal.value = true;
};
// const options = [
// {
// value: '1',
// label: ''
// },
// {
// value: '2',
// label: ''
// },
// {
// value: '3',
// label: ''
// },
// {
// value: '4',
// label: ''
// }
// ];
const flowCodeOptions = [
{
value: 'seal1',
label: '用章申请-普通'
}
// ,
// {
// value: 'leave2',
// label: '-'
// },
// {
// value: 'leave3',
// label: '-'
// },
// {
// value: 'leave4',
// label: '-'
// },
// {
// value: 'leave5',
// label: '-'
// },
// {
// value: 'leave6',
// label: '-'
// }
];
const flowCode = ref<string>('');
const dialogVisible = reactive<DialogOption>({
visible: false,
title: '流程定义'
});
//
const submitVerifyRef = ref<InstanceType<typeof SubmitVerify>>();
//
const approvalRecordRef = ref<InstanceType<typeof ApprovalRecord>>();
const sealFormRef = ref<ElFormInstance>();
const submitFormData = ref<StartProcessBo>({
businessId: '',
flowCode: '',
variables: {}
});
const taskVariables = ref<Record<string, any>>({});
const initFormData: SealForm = {
id: undefined,
// startDate: undefined,
// endDate: undefined,
// tripDays: undefined,
remark: undefined,
status: undefined
};
const data = reactive<PageData<SealForm, SealQuery>>({
form: { ...initFormData },
queryParams: {
pageNum: 1,
pageSize: 10
// ,
// startSealDays: undefined,
// endSealDays: undefined
},
rules: {
id: [{ required: true, message: '主键不能为空', trigger: 'blur' }],
businessType: [{ required: true, message: '业务类别不能为空', trigger: 'blur' }],
sealDate: [{ required: true, message: '用章时间不能为空', trigger: 'blur' }]
// tripDays: [{ required: true, message: '', trigger: 'blur' }]
}
});
const selectedSealIds = ref([]);
const handleSealSelect = (ids) => {
selectedSealIds.value = ids;
console.log('选中的公章ID:', ids);
};
const handleClose = () => {
dialogVisible.visible = false;
flowCode.value = '';
buttonLoading.value = false;
};
const { form, rules } = toRefs(data);
/** 表单重置 */
const reset = () => {
form.value = { ...initFormData };
// sealDate.value = [];
sealFormRef.value?.resetFields();
};
const changetakeOutDate = () => {
const startDate = new Date(takeOutDate.value[0]).getTime();
const endDate = new Date(takeOutDate.value[1]).getTime();
// const diffInMilliseconds = endDate - startDate;
// form.value.tripDays = Math.floor(diffInMilliseconds / (1000 * 60 * 60 * 24)) + 1;
};
/** 获取详情 */
const getInfo = () => {
loading.value = true;
buttonLoading.value = false;
nextTick(async () => {
const res = await getSeal(routeParams.value.id);
Object.assign(form.value, res.data);
takeOutDate.value = [];
takeOutDate.value.push(form.value.takeOutStartDate);
takeOutDate.value.push(form.value.takeOutEndDate);
loading.value = false;
buttonLoading.value = false;
});
};
/** 提交按钮 */
const submitForm = (status: string) => {
// if (sealDate.value.length === 0) {
// proxy?.$modal.msgError('');
// return;
// }
try {
sealFormRef.value?.validate(async (valid: boolean) => {
form.value.takeOutStartDate = takeOutDate.value[0];
form.value.takeOutEndDate = takeOutDate.value[1];
if (valid) {
buttonLoading.value = true;
let res: AxiosResponse<SealVO>;
if (form.value.id) {
res = await updateSeal(form.value);
} else {
res = await addSeal(form.value);
}
form.value = res.data;
if (status === 'draft') {
buttonLoading.value = false;
proxy?.$modal.msgSuccess('暂存成功');
proxy.$tab.closePage(proxy.$route);
proxy.$router.go(-1);
} else {
if ((form.value.status === 'draft' && (flowCode.value === '' || flowCode.value === null)) || routeParams.value.type === 'add') {
flowCode.value = flowCodeOptions[0].value;
dialogVisible.visible = true;
return;
}
//穿
if (flowCode.value === '' || flowCode.value === null) {
flowCode.value = 'xx';
}
await handleStartWorkFlow(res.data);
}
}
});
} finally {
buttonLoading.value = false;
}
};
const submitFlow = async () => {
handleStartWorkFlow(form.value);
dialogVisible.visible = false;
};
//
const handleStartWorkFlow = async (data: SealForm) => {
try {
submitFormData.value.flowCode = flowCode.value;
submitFormData.value.businessId = data.id;
//
taskVariables.value = {
// sealDays: data.tripDays,
userList: ['1', '3', '4']
};
submitFormData.value.variables = taskVariables.value;
const resp = await startWorkFlow(submitFormData.value);
if (submitVerifyRef.value) {
buttonLoading.value = false;
submitVerifyRef.value.openDialog(resp.data.taskId);
}
} finally {
buttonLoading.value = false;
}
};
//
const handleApprovalRecord = () => {
approvalRecordRef.value.init(form.value.id);
};
//
const submitCallback = async () => {
await proxy.$tab.closePage(proxy.$route);
proxy.$router.go(-1);
};
//
const goBack = () => {
proxy.$tab.closePage(proxy.$route);
proxy.$router.go(-1);
};
//
const approvalVerifyOpen = async () => {
submitVerifyRef.value.openDialog(routeParams.value.taskId);
};
//
const submitButtonShow = computed(() => {
return (
routeParams.value.type === 'add' ||
(routeParams.value.type === 'update' &&
form.value.status &&
(form.value.status === 'draft' || form.value.status === 'cancel' || form.value.status === 'back'))
);
});
//
const approvalButtonShow = computed(() => {
return routeParams.value.type === 'approval' && form.value.status && form.value.status === 'waiting';
});
//
const handleInput = (value) => {
form.value.fileCount = value.replace(/[^\d]/g, '');
};
onMounted(() => {
nextTick(async () => {
routeParams.value = proxy.$route.query;
reset();
loading.value = false;
if (routeParams.value.type === 'update' || routeParams.value.type === 'view' || routeParams.value.type === 'approval') {
getInfo();
}
});
});
</script>