bpm:增加 OA 请假的详情

pull/2/head
YunaiV 2023-01-21 20:54:33 +08:00
parent b4e86430a3
commit fb06bc8357
4 changed files with 58 additions and 59 deletions

View File

@ -135,7 +135,15 @@ VXETable.setup({
}) })
// 自定义全局的格式化处理函数 // 自定义全局的格式化处理函数
VXETable.formats.mixin({ VXETable.formats.mixin({
// 格式日期,默认 yyyy-MM-dd HH:mm:ss // 格式精简日期,默认 yyyy-MM-dd HH:mm:ss
formatDay({ cellValue }, format) {
if (cellValue != null) {
return XEUtils.toDateString(cellValue, format || 'yyyy-MM-dd')
} else {
return ''
}
},
// 格式完整日期,默认 yyyy-MM-dd HH:mm:ss
formatDate({ cellValue }, format) { formatDate({ cellValue }, format) {
if (cellValue != null) { if (cellValue != null) {
return XEUtils.toDateString(cellValue, format || 'yyyy-MM-dd HH:mm:ss') return XEUtils.toDateString(cellValue, format || 'yyyy-MM-dd HH:mm:ss')

View File

@ -1,54 +1,37 @@
<template> <template>
<div class="app-container"> <ContentWrap>
<!-- 对话框(添加 / 修改) --> <!-- 详情 -->
<el-form ref="form" :model="form" label-width="100px"> <Descriptions :schema="allSchemas.detailSchema" :data="formData" />
<el-form-item label="开始时间:" prop="startTime"> </ContentWrap>
{{ formatDate(form.startTime, '{y}-{m}-{d}') }}
</el-form-item>
<el-form-item label="结束时间:" prop="endTime">
{{ formatDate(form.endTime, '{y}-{m}-{d}') }}
</el-form-item>
<el-form-item label="请假类型:" prop="type">
<dict-tag :type="DICT_TYPE.BPM_OA_LEAVE_TYPE" :value="form.type" />
</el-form-item>
<el-form-item label="原因:" prop="reason"> {{ form.reason }}</el-form-item>
</el-form>
</div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, ref } from 'vue' import { onMounted, ref } from 'vue'
import { ElMessage } from 'element-plus' // import
import * as LeaveApi from '@/api/bpm/leave'
import { allSchemas } from '@/views/bpm/oa/leave/leave.data'
import { getLeaveApi } from '@/api/bpm/leave' const { query } = useRoute() //
import { DICT_TYPE } from '@/utils/dict' const message = useMessage() //
import { formatDate } from '@/utils/formatTime'
import { useRouter } from 'vue-router' const id = ref() //
const router = useRouter()
//
const id = ref()
// //
const form = ref({ const formData = ref({
startTime: undefined, startTime: undefined,
endTime: undefined, endTime: undefined,
type: undefined, type: undefined,
reason: undefined reason: undefined
}) })
/** 获得请假信息 */
const getDetail = () => {
getLeaveApi(id.value).then((response) => {
form.value = response.data
})
}
onMounted(() => { onMounted(() => {
id.value = router.currentRoute.value.query.id id.value = query.id
if (!id.value) { if (!id.value) {
ElMessage({ message.error('未传递 id 参数,无法查看 OA 请假信息')
type: 'error',
message: '未传递 id 参数,无法查看 OA 请假信息'
})
return return
} }
getDetail() //
LeaveApi.getLeaveApi(id.value).then((data) => {
formData.value = data
})
}) })
</script> </script>

View File

@ -1,24 +1,26 @@
<template> <template>
<XTable @register="registerTable"> <ContentWrap>
<template #toolbar_buttons> <XTable @register="registerTable">
<!-- 操作发起请假 --> <template #toolbar_buttons>
<XButton type="primary" preIcon="ep:plus" title="发起请假" @click="handleCreate()" /> <!-- 操作发起请假 -->
</template> <XButton type="primary" preIcon="ep:plus" title="发起请假" @click="handleCreate()" />
<template #actionbtns_default="{ row }"> </template>
<!-- 操作: 取消请假 --> <template #actionbtns_default="{ row }">
<XTextButton <!-- 操作: 取消请假 -->
preIcon="ep:delete" <XTextButton
title="取消请假" preIcon="ep:delete"
v-hasPermi="['bpm:oa-leave:create']" title="取消请假"
v-if="row.result === 1" v-hasPermi="['bpm:oa-leave:create']"
@click="cancelLeave(row)" v-if="row.result === 1"
/> @click="cancelLeave(row)"
<!-- 操作: 详情 --> />
<XTextButton preIcon="ep:delete" :title="t('action.detail')" @click="handleDetail(row)" /> <!-- 操作: 详情 -->
<!-- 操作: 审批进度 --> <XTextButton preIcon="ep:delete" :title="t('action.detail')" @click="handleDetail(row)" />
<XTextButton preIcon="ep:edit-pen" title="审批进度" @click="handleProcessDetail(row)" /> <!-- 操作: 审批进度 -->
</template> <XTextButton preIcon="ep:edit-pen" title="审批进度" @click="handleProcessDetail(row)" />
</XTable> </template>
</XTable>
</ContentWrap>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">

View File

@ -29,17 +29,23 @@ const crudSchemas = reactive<VxeCrudSchema>({
{ {
title: t('common.startTimeText'), title: t('common.startTimeText'),
field: 'startTime', field: 'startTime',
formatter: 'formatDate', formatter: 'formatDay',
table: { table: {
width: 180 width: 180
},
detail: {
dateFormat: 'YYYY-MM-DD'
} }
}, },
{ {
title: t('common.endTimeText'), title: t('common.endTimeText'),
field: 'endTime', field: 'endTime',
formatter: 'formatDate', formatter: 'formatDay',
table: { table: {
width: 180 width: 180
},
detail: {
dateFormat: 'YYYY-MM-DD'
} }
}, },
{ {