| | |
| | | <el-card shadow="never"> |
| | | <div style="display: flex; justify-content: space-between"> |
| | | <div> |
| | | <el-button |
| | | v-if="routeParams.type === 'add' || |
| | | (routeParams.type === 'update' &&form.status && |
| | | (form.status === 'draft' || form.status === 'cancel' || form.status === 'back'))" |
| | | :loading="buttonLoading" |
| | | type="info" |
| | | @click="submitForm('draft')" |
| | | >暂存</el-button |
| | | > |
| | | <el-button |
| | | v-if="routeParams.type === 'add' || |
| | | (routeParams.type === 'update' && form.status && |
| | | (form.status === 'draft' || form.status === 'cancel' || form.status === 'back'))" |
| | | :loading="buttonLoading" |
| | | type="primary" |
| | | @click="submitForm('submit')" |
| | | >提 交</el-button |
| | | > |
| | | <el-button |
| | | v-if="routeParams.type === 'approval' && form.status && form.status === 'waiting'" |
| | | :loading="buttonLoading" |
| | | type="primary" |
| | | @click="approvalVerifyOpen" |
| | | >审批</el-button |
| | | > |
| | | <el-button v-if="processInstanceId" type="primary" @click="handleApprovalRecord">流程进度</el-button> |
| | | <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> |
| | |
| | | <el-form-item label="请假时间"> |
| | | <el-date-picker |
| | | v-model="leaveTime" |
| | | value-format="YYYY-MM-DD HH:mm:ss" |
| | | type="daterange" |
| | | range-separator="To" |
| | | start-placeholder="开始时间" |
| | | end-placeholder="结束时间" |
| | | :default-time="[new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 1, 1, 23, 59, 59)]" |
| | | @change="changeLeaveTime()" |
| | | /> |
| | | </el-form-item> |
| | |
| | | const buttonLoading = ref(false); |
| | | const loading = ref(true); |
| | | const leaveTime = ref<Array<string>>([]); |
| | | //流程实例id |
| | | const processInstanceId = ref(''); |
| | | //路由参数 |
| | | const routeParams = ref<Record<string, any>>({}); |
| | | const options = [ |
| | |
| | | endDate: undefined, |
| | | leaveDays: undefined, |
| | | remark: undefined, |
| | | processInstanceVo: {} |
| | | status: undefined |
| | | }; |
| | | const data = reactive<PageData<LeaveForm, LeaveQuery>>({ |
| | | form: { ...initFormData }, |
| | |
| | | const startDate = new Date(leaveTime.value[0]).getTime(); |
| | | const endDate = new Date(leaveTime.value[1]).getTime(); |
| | | const diffInMilliseconds = endDate - startDate; |
| | | form.value.leaveDays = Math.floor(diffInMilliseconds / (1000 * 60 * 60 * 24)); |
| | | form.value.leaveDays = Math.floor(diffInMilliseconds / (1000 * 60 * 60 * 24)) + 1; |
| | | }; |
| | | /** 获取详情 */ |
| | | const getInfo = () => { |
| | |
| | | leaveTime.value = []; |
| | | leaveTime.value.push(form.value.startDate); |
| | | leaveTime.value.push(form.value.endDate); |
| | | if (form.value.processInstanceVo) { |
| | | processInstanceId.value = form.value.processInstanceVo.id; |
| | | } |
| | | loading.value = false; |
| | | buttonLoading.value = false; |
| | | }); |
| | |
| | | taskVariables.value = { |
| | | entity: data, |
| | | leaveDays: data.leaveDays, |
| | | userList: [1, 3], |
| | | userList2: [1, 3] |
| | | userList: ['1', '3'], |
| | | userList2: ['1', '3'] |
| | | }; |
| | | submitFormData.value.variables = taskVariables.value; |
| | | const resp = await startWorkFlow(submitFormData.value); |
| | |
| | | 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'; |
| | | }); |
| | | |
| | | onMounted(() => { |
| | | nextTick(async () => { |
| | | routeParams.value = proxy.$route.query; |