办公用品草稿内容
This commit is contained in:
parent
e385bafc3c
commit
a8b3cef503
@ -51,4 +51,12 @@ export const BgypApi = {
|
||||
exportBgyp: async (params) => {
|
||||
return await request.download({ url: `/home/bgyp/export-excel`, params })
|
||||
},
|
||||
// 保存为草稿
|
||||
saveDraft: async (data: BgypVO) => {
|
||||
return await request.post({ url: `/home/bgyp/saveDraft`, data })
|
||||
},
|
||||
// 查询草稿
|
||||
getDraft: async (params: any) => {
|
||||
return await request.get({ url: `/home/bgyp/draft`, params })
|
||||
},
|
||||
}
|
||||
|
@ -86,6 +86,7 @@
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
||||
<el-button @click="saveDraft" type="warning" :disabled="draftButton">存为草稿</el-button>
|
||||
</template>
|
||||
</el-card>
|
||||
<!-- 办公用品信息选择 -->
|
||||
@ -164,6 +165,23 @@ const userList = ref<any[]>([]) // 用户列表
|
||||
const deptInfo = ref('') // 部门信息
|
||||
const userInfo = ref('') // 用户名字
|
||||
|
||||
const draftButton = ref(false)
|
||||
const saveDraft = async () => {
|
||||
// 校验表单
|
||||
await formRef.value.validate()
|
||||
// 提交请求
|
||||
formLoading.value = true
|
||||
try {
|
||||
const data = formData.value as unknown as BgypVO
|
||||
await BgypApi.saveDraft(data)
|
||||
message.success(t('存为草稿成功!'))
|
||||
// 关闭当前 Tab
|
||||
delView(unref(currentRoute))
|
||||
await push({ name: 'Bgyp' })
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 提交表单 */
|
||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||
@ -183,11 +201,14 @@ 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
|
||||
@ -215,8 +236,18 @@ const formRules = reactive({
|
||||
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 BgypApi.getBgyp(Number( id) )
|
||||
draftButton.value= true
|
||||
}
|
||||
}
|
||||
const processKey = await FormProcessMappingApi.selectProcessKey( curFullPath )
|
||||
|
||||
if ( !processKey ) {
|
||||
|
212
src/views/Home/bgnr/draft/indexDraftBgyp.vue
Normal file
212
src/views/Home/bgnr/draft/indexDraftBgyp.vue
Normal file
@ -0,0 +1,212 @@
|
||||
<template>
|
||||
<ContentWrap>
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form
|
||||
class="-mb-15px"
|
||||
:model="queryParams"
|
||||
ref="queryFormRef"
|
||||
:inline="true"
|
||||
label-width="68px"
|
||||
>
|
||||
<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="unit">
|
||||
<el-select
|
||||
v-model="queryParams.unit"
|
||||
placeholder="请选择物品分类"
|
||||
clearable
|
||||
class="!w-240px"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.BGYP_UNIT)"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</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:bgyp: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="usageId">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.BGYP_USAGE_NAME" :value="scope.row.usageId" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="物品分类" align="center" prop="unit">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.BGYP_UNIT" :value="scope.row.unit" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="申请时间"
|
||||
align="center"
|
||||
prop="usageDate"
|
||||
:formatter="dateFormatter2"
|
||||
width="180px"
|
||||
/>
|
||||
<el-table-column label="操作" align="center">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
v-hasPermi="['home:clgl:update']"
|
||||
link
|
||||
type="primary"
|
||||
@click="handleDetail(scope.row)"
|
||||
>
|
||||
详情
|
||||
</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 { BgypApi, BgypVO } from '@/api/home/bgyp'
|
||||
import * as LeaveApi from '@/api/bpm/leave'
|
||||
|
||||
/** 办公用品管理 列表 */
|
||||
defineOptions({ name: 'Bgyp' })
|
||||
|
||||
const message = useMessage() // 消息弹窗
|
||||
const { t } = useI18n() // 国际化
|
||||
|
||||
const loading = ref(true) // 列表的加载中
|
||||
const list = ref<BgypVO[]>([]) // 列表的数据
|
||||
const total = ref(0) // 列表的总页数
|
||||
const queryParams = reactive({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
title: undefined,
|
||||
userName: undefined,
|
||||
deptName: undefined,
|
||||
deptId: undefined,
|
||||
usageName: undefined,
|
||||
usageId: undefined,
|
||||
usageQuantity: undefined,
|
||||
unit: undefined,
|
||||
usagePurpose: undefined,
|
||||
usageDate: [],
|
||||
status: undefined,
|
||||
userId: undefined,
|
||||
processInstanceId: undefined,
|
||||
createTime: [],
|
||||
})
|
||||
const queryFormRef = ref() // 搜索的表单
|
||||
const exportLoading = ref(false) // 导出的加载中
|
||||
|
||||
/** 查询列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await BgypApi.getDraft(queryParams)
|
||||
list.value = data.list
|
||||
total.value = data.total
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const router = useRouter() // 路由
|
||||
/**发起操作 */
|
||||
// const handleCreate =async () => {
|
||||
// await router.push({name: 'BgypCreate'})
|
||||
// }
|
||||
|
||||
/** 审批进度 */
|
||||
// const handleProcessDetail =async (row) => {
|
||||
// await router.push({
|
||||
// name: 'BpmProcessInstanceDetail',
|
||||
// query: {
|
||||
// id: row.processInstanceId
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
|
||||
/** 详情操作 */
|
||||
const handleDetail =async (row: LeaveApi.LeaveVO) => {
|
||||
await router.push({
|
||||
name: 'BgypCreate',
|
||||
query: {
|
||||
id: row.id
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// fix: 列表不刷新的问题。
|
||||
watch(
|
||||
() => router.currentRoute.value,
|
||||
() => {
|
||||
getList()
|
||||
}
|
||||
)
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.pageNo = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value.resetFields()
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = async () => {
|
||||
try {
|
||||
// 导出的二次确认
|
||||
await message.exportConfirm()
|
||||
// 发起导出
|
||||
exportLoading.value = true
|
||||
const data = await BgypApi.exportBgyp(queryParams)
|
||||
download.excel(data, '办公用品.xls')
|
||||
} catch {
|
||||
} finally {
|
||||
exportLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 初始化 **/
|
||||
onMounted(async () => {
|
||||
await getList()
|
||||
})
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user