Compare commits
No commits in common. "6b8dec160b11199541f62026ee8b2e69bd1fb938" and "e29a67c096fa1125888322bef781c3b3fe1b2173" have entirely different histories.
6b8dec160b
...
e29a67c096
@ -688,30 +688,6 @@ const remainingRouter: AppRouteRecordRaw[] = [
|
|||||||
activeMenu: '/Home/clgl/Clglflow'
|
activeMenu: '/Home/clgl/Clglflow'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
path: 'bgyp/BgypCreate',
|
|
||||||
component: () => import('@/views/Home/bgyp/BgypCreate.vue'),
|
|
||||||
name: 'BgypCreate',
|
|
||||||
meta: {
|
|
||||||
noCache: true,
|
|
||||||
hidden: true,
|
|
||||||
canTo: true,
|
|
||||||
title: '发起办公用品流程',
|
|
||||||
activeMenu: '/Home/bgyp/Bgypflow'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: 'bgyp/BgypDetail',
|
|
||||||
component: () => import('@/views/Home/bgyp/BgypDetail.vue'),
|
|
||||||
name: 'BgypDetail',
|
|
||||||
meta: {
|
|
||||||
noCache: true,
|
|
||||||
hidden: true,
|
|
||||||
canTo: true,
|
|
||||||
title: '查看办公用品流程',
|
|
||||||
activeMenu: '/Home/bgyp/Bgypflow'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
@ -1,206 +0,0 @@
|
|||||||
<template>
|
|
||||||
<ContentWrap>
|
|
||||||
<el-form
|
|
||||||
ref="formRef"
|
|
||||||
:model="formData"
|
|
||||||
:rules="formRules"
|
|
||||||
label-width="100px"
|
|
||||||
v-loading="formLoading"
|
|
||||||
>
|
|
||||||
<el-row>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="申请人" prop="userName">
|
|
||||||
<div class="pull-left" v-show="true" v-if="userInfo">{{ userInfo}} </div>
|
|
||||||
<div class="pull-left" v-show="true" v-if="!userInfo">获取失败 </div>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="申请部门" prop="deptName">
|
|
||||||
<div class="pull-left" v-show="true" v-if="deptInfo">{{ deptInfo }} </div>
|
|
||||||
<div class="pull-left" v-show="true" v-if="!deptInfo">获取失败 </div>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
<el-row>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="标题" prop="title">
|
|
||||||
<el-input v-model="formData.title" placeholder="请输入申请标题" />
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="申请时间" prop="usageDate">
|
|
||||||
<el-date-picker
|
|
||||||
v-model="formData.usageDate"
|
|
||||||
type="date"
|
|
||||||
value-format="x"
|
|
||||||
placeholder="选择申请时间"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
<el-row>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="物品名字" prop="usageName">
|
|
||||||
<el-input v-model="formData.usageName" placeholder="请输入申请物品名字" />
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="物品数量" prop="usageQuantity">
|
|
||||||
<el-input v-model.number="formData.usageQuantity" placeholder="请输入申请物品数量" />
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
<el-row>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="申请物品" prop="usageId">
|
|
||||||
<el-select v-model="formData.usageId" placeholder="请选择申请物品">
|
|
||||||
<el-option
|
|
||||||
v-for="dict in getIntDictOptions(DICT_TYPE.BGYP_USAGE_NAME)"
|
|
||||||
:key="dict.value"
|
|
||||||
:label="dict.label"
|
|
||||||
:value="dict.value"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="物品分类" prop="unit">
|
|
||||||
<el-select v-model="formData.unit" placeholder="请选择申请物品分类">
|
|
||||||
<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-col>
|
|
||||||
</el-row>
|
|
||||||
<el-form-item label="用途" prop="usagePurpose">
|
|
||||||
<el-input v-model="formData.usagePurpose" type="textarea" placeholder="请输入申请用途" />
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
|
||||||
</ContentWrap>
|
|
||||||
</template>
|
|
||||||
<script setup lang="ts">
|
|
||||||
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
|
|
||||||
import { BgypApi, BgypVO } from '@/api/home/bgyp'
|
|
||||||
import {useTagsViewStore} from "@/store/modules/tagsView";
|
|
||||||
import * as DefinitionApi from '@/api/bpm/definition'
|
|
||||||
import * as UserApi from '@/api/system/user'
|
|
||||||
import {getUserProfile} from "@/api/system/user/profile";
|
|
||||||
|
|
||||||
|
|
||||||
/** 办公用品管理 表单 */
|
|
||||||
defineOptions({ name: 'BgypCreate' })
|
|
||||||
|
|
||||||
const { t } = useI18n() // 国际化
|
|
||||||
const message = useMessage() // 消息弹窗
|
|
||||||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
|
||||||
const formData = ref({
|
|
||||||
id: undefined,
|
|
||||||
title: undefined,
|
|
||||||
userName: '',
|
|
||||||
deptName: undefined,
|
|
||||||
deptId: undefined,
|
|
||||||
usageName: undefined,
|
|
||||||
usageId: undefined,
|
|
||||||
usageQuantity: undefined,
|
|
||||||
unit: undefined,
|
|
||||||
usagePurpose: undefined,
|
|
||||||
usageDate: undefined,
|
|
||||||
status: undefined,
|
|
||||||
userId: undefined,
|
|
||||||
processInstanceId: undefined,
|
|
||||||
})
|
|
||||||
const formRef = ref() // 表单 Ref
|
|
||||||
|
|
||||||
// 获取用户部门
|
|
||||||
const getUserInfo = async () => {
|
|
||||||
const user = await getUserProfile();
|
|
||||||
|
|
||||||
formData.value.deptId = formData.value.deptId || user.dept.id;
|
|
||||||
formData.value.deptName = formData.value.deptName || user.dept.name;
|
|
||||||
formData.value.userName = formData.value.userName || user.nickname;
|
|
||||||
|
|
||||||
deptInfo.value = formData.value.deptName ?? '';
|
|
||||||
userInfo.value = formData.value.userName ?? '';
|
|
||||||
};
|
|
||||||
|
|
||||||
// 指定审批人
|
|
||||||
const { delView } = useTagsViewStore()//视图操作
|
|
||||||
const { push, currentRoute } = useRouter()
|
|
||||||
const processDefineKey = 'bgyp-001' // 流程定义 Key
|
|
||||||
const startUserSelectTasks = ref([]) // 发起人需要选择审批人的用户任务列表
|
|
||||||
const startUserSelectAssignees = ref({}) // 发起人选择审批人的数据
|
|
||||||
const startUserSelectAssigneesFormRef = ref() // 发起人选择审批人的表单 Ref
|
|
||||||
const startUserSelectAssigneesFormRules = ref({}) // 发起人选择审批人的表单 Rules
|
|
||||||
const userList = ref<any[]>([]) // 用户列表
|
|
||||||
const deptInfo = ref('') // 部门信息
|
|
||||||
const userInfo = ref('') // 用户名字
|
|
||||||
|
|
||||||
|
|
||||||
/** 提交表单 */
|
|
||||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
|
||||||
const submitForm = async () => {
|
|
||||||
// 校验表单
|
|
||||||
await formRef.value.validate()
|
|
||||||
// 提交请求
|
|
||||||
formLoading.value = true
|
|
||||||
// 校验指定审批人++
|
|
||||||
if(startUserSelectTasks.value?.length > 0){
|
|
||||||
await startUserSelectAssigneesFormRef.value.validate()
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
const data = formData.value as unknown as BgypVO
|
|
||||||
|
|
||||||
if(startUserSelectTasks.value?.length > 0){
|
|
||||||
data.startUserSelectAssignees = startUserSelectAssignees.value
|
|
||||||
}
|
|
||||||
|
|
||||||
await BgypApi.createBgyp(data)
|
|
||||||
message.success(t('common.createSuccess'))
|
|
||||||
delView(unref(currentRoute))
|
|
||||||
await push({name: 'Bgyp'})
|
|
||||||
} finally {
|
|
||||||
formLoading.value = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const formRules = reactive({
|
|
||||||
title: [{ required: true, message: '标题不能为空', trigger: 'blur' }],
|
|
||||||
userName: [{ required: true, message: '申请人不能为空', trigger: 'blur' }],
|
|
||||||
deptName: [{ required: true, message: '申请部门不能为空', trigger: 'blur' }],
|
|
||||||
deptId: [{ required: true, message: '申请部门id不能为空', trigger: 'blur' }],
|
|
||||||
usageId: [{ required: true, message: '申请物品不能为空', trigger: 'change' }],
|
|
||||||
usageQuantity: [{ required: true, type: 'number', message: '申请物品数量不能为空且是数字', trigger: 'blur' }],
|
|
||||||
usageDate: [{ required: true, message: '申请时间不能为空', trigger: 'blur' }],
|
|
||||||
})
|
|
||||||
/** 初始化 */
|
|
||||||
onMounted(async () => {
|
|
||||||
await getUserInfo()
|
|
||||||
const processDefinitionDetail = await DefinitionApi.getProcessDefinition(
|
|
||||||
undefined,
|
|
||||||
processDefineKey
|
|
||||||
)
|
|
||||||
if (!processDefinitionDetail) {
|
|
||||||
message.error('办公用品流程模型未配置,请检查!')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
startUserSelectTasks.value = processDefinitionDetail.startUserSelectTasks
|
|
||||||
// 设置指定审批人
|
|
||||||
if (startUserSelectTasks.value?.length > 0) {
|
|
||||||
// 设置校验规则
|
|
||||||
for (const userTask of startUserSelectTasks.value) {
|
|
||||||
startUserSelectAssignees.value[userTask.id] = []
|
|
||||||
startUserSelectAssigneesFormRules.value[userTask.id] = [
|
|
||||||
{ required: true, message: '请选择审批人', trigger: 'blur' }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
// 加载用户列表
|
|
||||||
userList.value = await UserApi.getSimpleUserList()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
</script>
|
|
@ -1,151 +0,0 @@
|
|||||||
<template>
|
|
||||||
<ContentWrap>
|
|
||||||
<el-form
|
|
||||||
ref="formRef"
|
|
||||||
:model="formData"
|
|
||||||
label-width="100px"
|
|
||||||
v-loading="formLoading"
|
|
||||||
>
|
|
||||||
<el-row>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="申请人" prop="userName">
|
|
||||||
<div class="pull-left" v-show="true" v-if="userInfo">{{ userInfo}} </div>
|
|
||||||
<div class="pull-left" v-show="true" v-if="!userInfo">获取失败 </div>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="申请部门" prop="deptName">
|
|
||||||
<div class="pull-left" v-show="true" v-if="deptInfo">{{ deptInfo }} </div>
|
|
||||||
<div class="pull-left" v-show="true" v-if="!deptInfo">获取失败 </div>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
<el-row>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="标题" prop="title">
|
|
||||||
<el-input v-model="formData.title" placeholder="请输入申请标题" disabled/>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="申请时间" prop="usageDate" >
|
|
||||||
<el-date-picker
|
|
||||||
v-model="formData.usageDate"
|
|
||||||
type="date"
|
|
||||||
value-format="x"
|
|
||||||
placeholder="选择申请时间"
|
|
||||||
disabled
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
<el-row>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="物品名字" prop="usageName">
|
|
||||||
<el-input v-model="formData.usageName" placeholder="请输入申请物品名字" disabled />
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="物品数量" prop="usageQuantity">
|
|
||||||
<el-input v-model="formData.usageQuantity" placeholder="请输入申请物品数量" disabled/>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
<el-row>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="申请物品" prop="usageId">
|
|
||||||
<el-select v-model="formData.usageId" placeholder="请选择申请物品id" disabled>
|
|
||||||
<el-option
|
|
||||||
v-for="dict in getIntDictOptions(DICT_TYPE.BGYP_USAGE_NAME)"
|
|
||||||
:key="dict.value"
|
|
||||||
:label="dict.label"
|
|
||||||
:value="dict.value"
|
|
||||||
disabled
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="物品分类" prop="unit">
|
|
||||||
<el-select v-model="formData.unit" placeholder="请选择申请物品分类" disabled>
|
|
||||||
<el-option
|
|
||||||
v-for="dict in getIntDictOptions(DICT_TYPE.BGYP_UNIT)"
|
|
||||||
:key="dict.value"
|
|
||||||
:label="dict.label"
|
|
||||||
:value="dict.value"
|
|
||||||
disabled
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
<el-form-item label="用途" prop="usagePurpose">
|
|
||||||
<el-input v-model="formData.usagePurpose" type="textarea" placeholder="请输入申请用途" disabled />
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
</ContentWrap>
|
|
||||||
</template>
|
|
||||||
<script setup lang="ts">
|
|
||||||
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
|
|
||||||
import { BgypApi } from '@/api/home/bgyp'
|
|
||||||
import {propTypes} from "@/utils/propTypes";
|
|
||||||
import {getUserProfile} from "@/api/system/user/profile";
|
|
||||||
|
|
||||||
/** 办公用品管理 表单 */
|
|
||||||
defineOptions({ name: 'BgypDetail' })
|
|
||||||
|
|
||||||
const { t } = useI18n() // 国际化
|
|
||||||
const message = useMessage() // 消息弹窗
|
|
||||||
|
|
||||||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
|
||||||
const formData = ref({
|
|
||||||
id: undefined,
|
|
||||||
title: undefined,
|
|
||||||
userName: undefined,
|
|
||||||
deptName: undefined,
|
|
||||||
deptId: undefined,
|
|
||||||
usageName: undefined,
|
|
||||||
usageId: undefined,
|
|
||||||
usageQuantity: undefined,
|
|
||||||
unit: undefined,
|
|
||||||
usagePurpose: undefined,
|
|
||||||
usageDate: undefined,
|
|
||||||
status: undefined,
|
|
||||||
userId: undefined,
|
|
||||||
processInstanceId: undefined,
|
|
||||||
})
|
|
||||||
const formRef = ref() // 表单 Ref
|
|
||||||
const deptInfo = ref('') // 部门信息
|
|
||||||
const userInfo = ref('') // 用户名字
|
|
||||||
// 获取用户部门
|
|
||||||
const getUserInfo = async () => {
|
|
||||||
const user = await getUserProfile();
|
|
||||||
|
|
||||||
formData.value.deptId = formData.value.deptId || user.dept.id;
|
|
||||||
formData.value.deptName = formData.value.deptName || user.dept.name;
|
|
||||||
formData.value.userName = formData.value.userName || user.nickname;
|
|
||||||
|
|
||||||
deptInfo.value = formData.value.deptName ?? '';
|
|
||||||
userInfo.value = formData.value.userName ?? '';
|
|
||||||
};
|
|
||||||
//流程
|
|
||||||
const { query } = useRoute() // 查询参数
|
|
||||||
const props = defineProps({
|
|
||||||
id: propTypes.number.def(undefined)
|
|
||||||
})
|
|
||||||
const detailLoading = ref(false) // 表单的加载中
|
|
||||||
const queryId = query.id as unknown as number // 从 URL 传递过来的 id 编号
|
|
||||||
/** 获得数据 */
|
|
||||||
const getInfo = async () => {
|
|
||||||
detailLoading.value = true
|
|
||||||
try {
|
|
||||||
formData.value = await BgypApi.getBgyp(props.id || queryId)
|
|
||||||
//这里可能会收到两种方式传过来的数据
|
|
||||||
} finally {
|
|
||||||
detailLoading.value = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
onMounted(()=> {
|
|
||||||
getUserInfo()
|
|
||||||
getInfo()
|
|
||||||
})
|
|
||||||
</script>
|
|
@ -1,204 +0,0 @@
|
|||||||
<template>
|
|
||||||
<Dialog :title="dialogTitle" v-model="dialogVisible">
|
|
||||||
<el-form
|
|
||||||
ref="formRef"
|
|
||||||
:model="formData"
|
|
||||||
:rules="formRules"
|
|
||||||
label-width="100px"
|
|
||||||
v-loading="formLoading"
|
|
||||||
>
|
|
||||||
<el-row>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="标题" prop="title">
|
|
||||||
<el-input v-model="formData.title" placeholder="请输入申请标题" />
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="时间" prop="usageDate">
|
|
||||||
<el-date-picker
|
|
||||||
v-model="formData.usageDate"
|
|
||||||
type="date"
|
|
||||||
value-format="x"
|
|
||||||
placeholder="选择申请时间"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
<el-row>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="用户" prop="userName">
|
|
||||||
<el-input v-model="formData.userName" placeholder="请输入申请用户名称" />
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="部门" prop="deptName">
|
|
||||||
<el-input v-model="formData.deptName" placeholder="请输入申请部门名称" />
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
<el-row>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="物品名字" prop="usageName">
|
|
||||||
<el-input v-model="formData.usageName" placeholder="请输入申请物品名字" />
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="申请物品" prop="usageId">
|
|
||||||
<el-select v-model="formData.usageId" placeholder="请选择申请物品id">
|
|
||||||
<el-option
|
|
||||||
v-for="dict in getIntDictOptions(DICT_TYPE.BGYP_USAGE_NAME)"
|
|
||||||
:key="dict.value"
|
|
||||||
:label="dict.label"
|
|
||||||
:value="dict.value"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
<el-row>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="物品数量" prop="usageQuantity">
|
|
||||||
<el-input v-model="formData.usageQuantity" placeholder="请输入申请物品数量" />
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="物品分类" prop="unit">
|
|
||||||
<el-select v-model="formData.unit" placeholder="请选择申请物品分类">
|
|
||||||
<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-col>
|
|
||||||
</el-row>
|
|
||||||
<!-- <el-form-item label="申请部门id" prop="deptId">-->
|
|
||||||
<!-- <el-input v-model="formData.deptId" placeholder="请输入申请部门id" />-->
|
|
||||||
<!-- </el-form-item>-->
|
|
||||||
<el-form-item label="用途" prop="usagePurpose">
|
|
||||||
<el-input v-model="formData.usagePurpose" type="textarea" placeholder="请输入申请用途" />
|
|
||||||
</el-form-item>
|
|
||||||
<!-- <el-form-item label="审批状态" prop="status">-->
|
|
||||||
<!-- <el-radio-group v-model="formData.status">-->
|
|
||||||
<!-- <el-radio label="1">请选择字典生成</el-radio>-->
|
|
||||||
<!-- </el-radio-group>-->
|
|
||||||
<!-- </el-form-item>-->
|
|
||||||
<!-- <el-form-item label="申请人的用户编号" prop="userId">-->
|
|
||||||
<!-- <el-input v-model="formData.userId" placeholder="请输入申请人的用户编号" />-->
|
|
||||||
<!-- </el-form-item>-->
|
|
||||||
<!-- <el-form-item label="流程实例的编号" prop="processInstanceId">-->
|
|
||||||
<!-- <el-input v-model="formData.processInstanceId" placeholder="请输入流程实例的编号" />-->
|
|
||||||
<!-- </el-form-item>-->
|
|
||||||
</el-form>
|
|
||||||
<template #footer>
|
|
||||||
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
|
||||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
|
||||||
</template>
|
|
||||||
</Dialog>
|
|
||||||
</template>
|
|
||||||
<script setup lang="ts">
|
|
||||||
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
|
|
||||||
import { BgypApi, BgypVO } from '@/api/home/bgyp'
|
|
||||||
|
|
||||||
/** 办公用品管理 表单 */
|
|
||||||
defineOptions({ name: 'BgypForm' })
|
|
||||||
|
|
||||||
const { t } = useI18n() // 国际化
|
|
||||||
const message = useMessage() // 消息弹窗
|
|
||||||
|
|
||||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
|
||||||
const dialogTitle = ref('') // 弹窗的标题
|
|
||||||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
|
||||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
|
||||||
const formData = ref({
|
|
||||||
id: undefined,
|
|
||||||
title: undefined,
|
|
||||||
userName: undefined,
|
|
||||||
deptName: undefined,
|
|
||||||
deptId: undefined,
|
|
||||||
usageName: undefined,
|
|
||||||
usageId: undefined,
|
|
||||||
usageQuantity: undefined,
|
|
||||||
unit: undefined,
|
|
||||||
usagePurpose: undefined,
|
|
||||||
usageDate: undefined,
|
|
||||||
status: undefined,
|
|
||||||
userId: undefined,
|
|
||||||
processInstanceId: undefined,
|
|
||||||
})
|
|
||||||
const formRules = reactive({
|
|
||||||
title: [{ required: true, message: '申请标题不能为空', trigger: 'blur' }],
|
|
||||||
userName: [{ required: true, message: '申请用户名称不能为空', trigger: 'blur' }],
|
|
||||||
deptName: [{ required: true, message: '申请部门名称不能为空', trigger: 'blur' }],
|
|
||||||
deptId: [{ required: true, message: '申请部门id不能为空', trigger: 'blur' }],
|
|
||||||
usageId: [{ required: true, message: '申请物品id不能为空', trigger: 'change' }],
|
|
||||||
usageQuantity: [{ required: true, message: '申请物品数量不能为空', trigger: 'blur' }],
|
|
||||||
usageDate: [{ required: true, message: '申请时间不能为空', trigger: 'blur' }],
|
|
||||||
})
|
|
||||||
const formRef = ref() // 表单 Ref
|
|
||||||
|
|
||||||
/** 打开弹窗 */
|
|
||||||
const open = async (type: string, id?: number) => {
|
|
||||||
dialogVisible.value = true
|
|
||||||
dialogTitle.value = t('action.' + type)
|
|
||||||
formType.value = type
|
|
||||||
resetForm()
|
|
||||||
// 修改时,设置数据
|
|
||||||
if (id) {
|
|
||||||
formLoading.value = true
|
|
||||||
try {
|
|
||||||
formData.value = await BgypApi.getBgyp(id)
|
|
||||||
} finally {
|
|
||||||
formLoading.value = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
|
||||||
|
|
||||||
/** 提交表单 */
|
|
||||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
|
||||||
const submitForm = async () => {
|
|
||||||
// 校验表单
|
|
||||||
await formRef.value.validate()
|
|
||||||
// 提交请求
|
|
||||||
formLoading.value = true
|
|
||||||
try {
|
|
||||||
const data = formData.value as unknown as BgypVO
|
|
||||||
if (formType.value === 'create') {
|
|
||||||
await BgypApi.createBgyp(data)
|
|
||||||
message.success(t('common.createSuccess'))
|
|
||||||
} else {
|
|
||||||
await BgypApi.updateBgyp(data)
|
|
||||||
message.success(t('common.updateSuccess'))
|
|
||||||
}
|
|
||||||
dialogVisible.value = false
|
|
||||||
// 发送操作成功的事件
|
|
||||||
emit('success')
|
|
||||||
} finally {
|
|
||||||
formLoading.value = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 重置表单 */
|
|
||||||
const resetForm = () => {
|
|
||||||
formData.value = {
|
|
||||||
id: undefined,
|
|
||||||
title: undefined,
|
|
||||||
userName: undefined,
|
|
||||||
deptName: undefined,
|
|
||||||
deptId: undefined,
|
|
||||||
usageName: undefined,
|
|
||||||
usageId: undefined,
|
|
||||||
usageQuantity: undefined,
|
|
||||||
unit: undefined,
|
|
||||||
usagePurpose: undefined,
|
|
||||||
usageDate: undefined,
|
|
||||||
status: undefined,
|
|
||||||
userId: undefined,
|
|
||||||
processInstanceId: undefined,
|
|
||||||
}
|
|
||||||
formRef.value?.resetFields()
|
|
||||||
}
|
|
||||||
</script>
|
|
@ -1,239 +0,0 @@
|
|||||||
<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="primary"
|
|
||||||
plain
|
|
||||||
@click="handleCreate()"
|
|
||||||
:loading="exportLoading"
|
|
||||||
v-hasPermi="['home:clgl:export']"
|
|
||||||
>
|
|
||||||
<Icon icon="ep:plus" 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="userName" />-->
|
|
||||||
<el-table-column label="部门名称" align="center" prop="deptName" />
|
|
||||||
<!-- <el-table-column label="申请部门id" align="center" prop="deptId" />-->
|
|
||||||
<!-- <el-table-column label="申请物品名字" align="center" prop="usageName" />-->
|
|
||||||
<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="usageQuantity" />-->
|
|
||||||
<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="usagePurpose" />-->
|
|
||||||
<el-table-column
|
|
||||||
label="申请时间"
|
|
||||||
align="center"
|
|
||||||
prop="usageDate"
|
|
||||||
:formatter="dateFormatter2"
|
|
||||||
width="180px"
|
|
||||||
/>
|
|
||||||
<el-table-column label="审批状态" align="center" prop="status" >
|
|
||||||
<template #default="scope">
|
|
||||||
<dict-tag :type="DICT_TYPE.BPM_PROCESS_INSTANCE_STATUS" :value="scope.row.status" />
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<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>
|
|
||||||
<el-button
|
|
||||||
v-hasPermi="['home:clgl:update']"
|
|
||||||
link
|
|
||||||
type="danger"
|
|
||||||
@click="handleProcessDetail(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 router from "@/router";
|
|
||||||
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.getBgypPage(queryParams)
|
|
||||||
list.value = data.list
|
|
||||||
total.value = data.total
|
|
||||||
} finally {
|
|
||||||
loading.value = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**发起操作 */
|
|
||||||
const handleCreate = () => {
|
|
||||||
router.push({ name: 'BgypCreate' })
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 审批进度 */
|
|
||||||
const handleProcessDetail = (row) => {
|
|
||||||
router.push({
|
|
||||||
name: 'BpmProcessInstanceDetail',
|
|
||||||
query: {
|
|
||||||
id: row.processInstanceId
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 详情操作 */
|
|
||||||
const handleDetail = (row: LeaveApi.LeaveVO) => {
|
|
||||||
router.push({
|
|
||||||
name: 'BgypDetail',
|
|
||||||
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(() => {
|
|
||||||
getList()
|
|
||||||
})
|
|
||||||
</script>
|
|
Loading…
Reference in New Issue
Block a user