销假草稿
This commit is contained in:
parent
236af43e26
commit
5fb9b29fec
@ -57,4 +57,12 @@ export const XjglApi = {
|
||||
exportXjgl: async (params) => {
|
||||
return await request.download({ url: `/home/xjgl/export-excel`, params })
|
||||
},
|
||||
// 保存为草稿
|
||||
saveDraft: async (data: XjglVO) => {
|
||||
return await request.post({ url: `/home/xjgl/saveDraft`, data })
|
||||
},
|
||||
// 查询草稿
|
||||
getDraft: async (params: any) => {
|
||||
return await request.get({ url: `/home/xjgl/draft`, params })
|
||||
},
|
||||
}
|
||||
|
@ -785,27 +785,27 @@ const remainingRouter: AppRouteRecordRaw[] = [
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'xjgl/XjglCreate',
|
||||
component: () => import('@/views/Home/xjgl/XjglCreate.vue'),
|
||||
path: 'xjnr/xjgl/XjglCreate',
|
||||
component: () => import('@/views/Home/xjnr/xjgl/XjglCreate.vue'),
|
||||
name: 'XjglCreate',
|
||||
meta: {
|
||||
noCache: true,
|
||||
hidden: true,
|
||||
canTo: true,
|
||||
title: '发起销假管理流程',
|
||||
activeMenu: '/Home/xjgl/Xjglflow'
|
||||
activeMenu: '/Home/xjnr/xjgl/Xjglflow'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/xjgl/KqglDetail',
|
||||
component: () => import('@/views/Home/xjgl/XjglDetail.vue'),
|
||||
path: 'xjnr/xjgl/KqglDetail',
|
||||
component: () => import('@/views/Home/xjnr/xjgl/XjglDetail.vue'),
|
||||
name: 'XjglDetail',
|
||||
meta: {
|
||||
noCache: true,
|
||||
hidden: true,
|
||||
canTo: true,
|
||||
title: '查看销假管理流程',
|
||||
activeMenu: '/Home/xjgl/Xjglflow'
|
||||
activeMenu: '/Home/xjnr/xjgl/Xjglflow'
|
||||
}
|
||||
}
|
||||
]
|
||||
|
240
src/views/Home/xjnr/draft/indexDraft.vue
Normal file
240
src/views/Home/xjnr/draft/indexDraft.vue
Normal file
@ -0,0 +1,240 @@
|
||||
<template>
|
||||
<ContentWrap>
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form
|
||||
class="-mb-15px"
|
||||
:model="queryParams"
|
||||
ref="queryFormRef"
|
||||
:inline="true"
|
||||
label-width="80px"
|
||||
>
|
||||
<el-form-item label="标题" prop="title">
|
||||
<el-input
|
||||
v-model="queryParams.title"
|
||||
placeholder="请输入申请标题"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="申请人" prop="userName">
|
||||
<el-input
|
||||
v-model="queryParams.userName"
|
||||
placeholder="请输入申请人名字"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="申请部门" prop="deptName">
|
||||
<el-input
|
||||
v-model="queryParams.deptName"
|
||||
placeholder="请输入申请部门名字"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="请假类型" prop="qjglType">
|
||||
<el-select
|
||||
v-model="queryParams.qjglType"
|
||||
placeholder="请选择请假类型"
|
||||
clearable
|
||||
class="!w-240px"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.BPM_OA_LEAVE_TYPE)"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="销假天数" prop="day">
|
||||
<el-input
|
||||
v-model="queryParams.day"
|
||||
placeholder="请输入销假天数"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
||||
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
@click="handleExport"
|
||||
:loading="exportLoading"
|
||||
v-hasPermi="['home:xjgl:export']"
|
||||
>
|
||||
<Icon icon="ep:download" class="mr-5px" /> 导出
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</ContentWrap>
|
||||
|
||||
<!-- 列表 -->
|
||||
<ContentWrap>
|
||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
||||
<el-table-column label="序号" align="center" type="index" width="70" />
|
||||
<el-table-column label="标题" align="center" prop="title" />
|
||||
<el-table-column label="申请人" align="center" prop="userName" />
|
||||
<el-table-column label="申请部门" align="center" prop="deptName" />
|
||||
<el-table-column label="请假类型" align="center" prop="qjglType">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.BPM_OA_LEAVE_TYPE" :value="scope.row.qjglType" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="开始时间"
|
||||
align="center"
|
||||
prop="startTime"
|
||||
:formatter="dateFormatter2"
|
||||
width="100px"
|
||||
/>
|
||||
<el-table-column
|
||||
label="结束时间"
|
||||
align="center"
|
||||
prop="endTime"
|
||||
:formatter="dateFormatter2"
|
||||
width="100px"
|
||||
/>
|
||||
<el-table-column label="销假天数" align="center" prop="day" />
|
||||
<el-table-column label="销假原因" align="center" prop="cancelReason" />
|
||||
<el-table-column
|
||||
label="创建时间"
|
||||
align="center"
|
||||
prop="createTime"
|
||||
:formatter="dateFormatter2"
|
||||
width="100px"
|
||||
/>
|
||||
<el-table-column label="操作" align="center">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
@click="handleDetail(scope.row)"
|
||||
v-hasPermi="['home:xjgl:update']"
|
||||
>
|
||||
详情
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页 -->
|
||||
<Pagination
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNo"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</ContentWrap>
|
||||
|
||||
<!-- 表单弹窗:添加/修改 -->
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||
import {dateFormatter2} from '@/utils/formatTime'
|
||||
import download from '@/utils/download'
|
||||
import { XjglApi, XjglVO } from '@/api/home/xjgl'
|
||||
|
||||
/** 销假管理 列表 */
|
||||
defineOptions({ name: 'Xjgl' })
|
||||
const router = useRouter() // 路由
|
||||
const message = useMessage() // 消息弹窗
|
||||
|
||||
const loading = ref(true) // 列表的加载中
|
||||
const list = ref<XjglVO[]>([]) // 列表的数据
|
||||
const total = ref(0) // 列表的总页数
|
||||
const queryParams = reactive({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
id: undefined,
|
||||
title: undefined,
|
||||
userName: undefined,
|
||||
userId: undefined,
|
||||
deptName: undefined,
|
||||
deptId: undefined,
|
||||
qjglId: undefined,
|
||||
qjglType: undefined,
|
||||
startTime: [],
|
||||
endTime: [],
|
||||
day: undefined,
|
||||
cancelReason: undefined,
|
||||
remarks: undefined,
|
||||
status: undefined,
|
||||
processInstanceId: undefined,
|
||||
createTime: [],
|
||||
test1: undefined,
|
||||
test2: undefined,
|
||||
test3: undefined,
|
||||
test4: undefined,
|
||||
})
|
||||
const queryFormRef = ref() // 搜索的表单
|
||||
const exportLoading = ref(false) // 导出的加载中
|
||||
|
||||
/** 查询列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await XjglApi.getDraft(queryParams)
|
||||
list.value = data.list
|
||||
total.value = data.total
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.pageNo = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value.resetFields()
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
/** 详情操作 */
|
||||
const handleDetail = (row: XjglVO) => {
|
||||
router.push({
|
||||
name: 'XjglCreate',
|
||||
query: {
|
||||
id: row.id
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// fix: 列表不刷新的问题。
|
||||
watch(
|
||||
() => router.currentRoute.value,
|
||||
() => {
|
||||
getList()
|
||||
}
|
||||
)
|
||||
// flowOver++++++++++++++++++
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = async () => {
|
||||
try {
|
||||
// 导出的二次确认
|
||||
await message.exportConfirm()
|
||||
// 发起导出
|
||||
exportLoading.value = true
|
||||
const data = await XjglApi.exportXjgl(queryParams)
|
||||
download.excel(data, '销假管理.xls')
|
||||
} catch {
|
||||
} finally {
|
||||
exportLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 初始化 **/
|
||||
onMounted(() => {
|
||||
getList()
|
||||
})
|
||||
</script>
|
@ -100,6 +100,7 @@
|
||||
<template #footer>
|
||||
<el-row justify="end">
|
||||
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
||||
<el-button @click="saveDraft" type="warning" :disabled="draftButton">存为草稿</el-button>
|
||||
</el-row>
|
||||
</template>
|
||||
</el-card>
|
||||
@ -122,7 +123,7 @@ import {CalendarApi} from "@/api/home/calendar";
|
||||
import {Edit} from "@element-plus/icons-vue";
|
||||
|
||||
/** 销假管理 表单 */
|
||||
defineOptions({ name: 'XjglForm' })
|
||||
defineOptions({ name: 'XjglCreate' })
|
||||
|
||||
const { t } = useI18n() // 国际化
|
||||
const message = useMessage() // 消息弹窗
|
||||
@ -275,10 +276,13 @@ const submitForm = async () => {
|
||||
data.startUserSelectAssignees = startUserSelectAssignees.value
|
||||
}
|
||||
|
||||
const curFullPath = currentRoute.value.fullPath
|
||||
let curFullPath = currentRoute.value.fullPath
|
||||
if( curFullPath ) {
|
||||
data.curfullpath = curFullPath
|
||||
}
|
||||
if (curFullPath.includes("?")) {
|
||||
curFullPath = curFullPath.split("?")[0];
|
||||
}
|
||||
const processKey = await FormProcessMappingApi.selectProcessKey( curFullPath )
|
||||
if ( processKey) {
|
||||
data.processDefinitionKey = processKey
|
||||
@ -294,10 +298,40 @@ const submitForm = async () => {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const draftButton = ref(false)
|
||||
const saveDraft = async () => {
|
||||
// 校验表单
|
||||
await formRef.value.validate()
|
||||
// 提交请求
|
||||
formLoading.value = true
|
||||
try {
|
||||
const data = formData.value as unknown as XjglVO
|
||||
await XjglApi.saveDraft(data)
|
||||
message.success(t('存为草稿成功!'))
|
||||
// 关闭当前 Tab
|
||||
delView(unref(currentRoute))
|
||||
await push({ name: 'Xjgl' })
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 打开弹窗 */
|
||||
onMounted(async () => {
|
||||
await getUserInfo()
|
||||
const curFullPath = currentRoute.value.fullPath
|
||||
let curFullPath = currentRoute.value.fullPath
|
||||
if (curFullPath.includes("?")) {
|
||||
// 使用 URLSearchParams 提取查询参数
|
||||
const params = new URLSearchParams(curFullPath.split("?")[1]);
|
||||
const id = params.get("id") ;
|
||||
// 获取路径部分
|
||||
curFullPath = curFullPath.split("?")[0];
|
||||
if ( id != "") {
|
||||
formData.value = await XjglApi.getXjgl(Number( id) )
|
||||
draftButton.value= true
|
||||
}
|
||||
}
|
||||
const processKey = await FormProcessMappingApi.selectProcessKey( curFullPath )
|
||||
|
||||
if ( !processKey ) {
|
Loading…
Reference in New Issue
Block a user