Commit 6e06efbf authored by qiyaxin's avatar qiyaxin

Merge remote-tracking branch 'origin/master'

parents 3efb142c 931b590d
......@@ -80,6 +80,14 @@ export function projectCostReimbursementNotPass(query) {
})
}
//出差申请-通过
export function tripApplicationApproval(query) {
return request({
url: '/expenseApproval/tripApplicationApproval',
method: 'post',
data:query
})
}
// 3.出差申请审批
//出差申请审批-通过
export function tripApplicationPass(query) {
......
......@@ -113,8 +113,8 @@
</div>
</div>
<!-- 表格数据 -->
<el-table :data="tripApplicationList" border style="width: 100%">
<el-table-column type="selection" width="40" align="right"/>
<el-table @cell-mouse-enter="handleHover" @cell-mouse-leave="handleLeave" :data="ReimbursementRequestList" border style="width: 100%" @selection-change="handleSelectionChange">
<el-table-column type="selection" align="center" :selectable="rowSelectable"></el-table-column>
<el-table-column label="申请人" align="center" prop="updateBy" fixed min-width="120"/>
<el-table-column label="项目编号" align="center" prop="projectNumber" min-width="150"/>
<el-table-column label="项目名称" align="center" prop="projectName" min-width="120" show-overflow-tooltip/>
......@@ -149,8 +149,8 @@
<!-- 操作按钮-->
<el-table-column label="操作" align="center" fixed="right" min-width="120">
<template #default="scope" >
<el-button link type="primary" size="small" style="font-size: 16px">通过</el-button>
<el-button link @click="dialogFormVisible = true" type="danger" size="small" style="font-size: 16px">驳回</el-button>
<el-button :disabled="scope.row.currentStatus !== 0" link @click="passProjectCost(scope.row)" type="primary" size="small" style="font-size: 15px">通过</el-button>
<el-button :disabled="scope.row.currentStatus !== 0" link @click="reject(scope.row)" type="danger" size="small" style="font-size: 15px">驳回</el-button>
</template>
</el-table-column>
</el-table>
......@@ -188,26 +188,23 @@
</template>
<script setup >
import {ArrowDown} from "@element-plus/icons-vue";
import {onMounted, reactive, ref} from "vue";
const { proxy } = getCurrentInstance();
import FlowChart from '@/components/FlowChart/index.vue'
import {ElMessageBox} from "element-plus";
import {useRouter} from "vue-router";
import {ref, getCurrentInstance, reactive, toRefs, onMounted} from "vue"
import {listTripApplication, projectList} from "../../../../api/costManage/cost.js";
import {ElMessage} from "element-plus";
import {
getApproveNodeList,
getProjectManagerName,
getProjectName, getRoleId
getProjectName,
getRoleId, projectCostReimbursementNotPass,
tripApplicationApproval
} from "../../../../api/examineAndApprove/examineAndApprove.js";
import {listTripApplication, projectList} from "../../../../api/costManage/cost.js";
const router = useRouter();
const { proxy } = getCurrentInstance();
const {cost_daily_status, project_status, project_type } = proxy.useDict('cost_daily_status','project_status', 'project_type');
const { project_status,cost_daily_status,project_type} = proxy.useDict('project_status', 'cost_daily_status','project_type');
const list = ref([]) // 流程图内容,只有值
const allList = ref([]) // 流程图内容,值和角色id
const loading = ref(true);
const total = ref(0);
const projectNameList = ref([]);
const projectManagerNameList = ref([]);
//当前登录用户角色组
const currentUserRoleInfoList = ref([])
......@@ -224,55 +221,40 @@ let rejectObj = reactive({
//是否一键驳回标识 false 不是
let oneClickFlag = false
// 弹出框
//弹出框
const dialogFormVisible = ref(false)
// 更多搜索框
const isExpanded = ref(false);
const changProjectNumber = ref('')
const stepActive = ref(2)
const stepActive = ref(1)
const queryParams = reactive({
pageNum: 1,
pageSize: 10,
projectNumber: null,
projectName: null,
projectType: null,
projectUserName: null,
tripStartDate: null,
status: null,
pageNum:1,
pageSize:10,
projectName:null,
projectType:null,
status:null
})
// 切换展开/折叠状态
const toggleSearch = () => {
isExpanded.value = !isExpanded.value;
}
// 搜索表单——获取所有项目名称
const getAllProjectName=()=> {
getProjectName(queryParams).then(response => {
console.log("出差-所有项目名称",response.data)
projectNameList.value = response.data;
// console.log("项目名称",projectNameList.value)
});
}
getAllProjectName()
// 搜索表单——获取所有项目名经理
const getAllProjectManagerName=()=> {
getProjectManagerName(queryParams).then(response => {
console.log("出差-所有项目经理",response.data)
projectManagerNameList.value = response.data;
});
// 重置表单
const reset = () => {
queryParams.projectName = null
queryParams.projectType = null
queryParams.status = null
// getList()
}
getAllProjectManagerName()
//获取所有流程列表,根据审批id(出差申请的流程配置id是23)
//获取所有流程列表,根据审批id
const getNodeList = ()=>{
getApproveNodeList(23).then(res=>{
console.log("出差申请审批-所有流程",res)
console.log("项目费用报销-所有流程",res.data)
allList.value = res.data.nodeList
list.value = res.data.nodeList.map(item=>{
return item.roleName
......@@ -283,43 +265,216 @@ const getNodeList = ()=>{
//获取当前用户角色信息
const getRoleInfo = ()=>{
getRoleId().then(res=>{
console.log("角色信息",res)
console.log("项目费用报销-角色信息",res.data)
currentUserRoleInfoList.value = res.data
})
}
// 出差申请 列表
const tripApplicationList = reactive([]);
// 列表
const ReimbursementRequestList = reactive([]);
const getList=()=> {
loading.value = true;
listTripApplication(queryParams).then(res => {
total.value = res.total;
Object.assign(tripApplicationList, res.rows);
loading.value = false;
// for(let i in tripApplicationList){
// tripApplicationList[i].currentStatus = approvalStatusChange(tripApplicationList[i].status,tripApplicationList[i].currentAuditRoleId)
// }
console.log("出差申请审批-列表",tripApplicationList)
// getTopApproveInfo()
listTripApplication(queryParams).then(response => {
console.log("出差申请-列表",response.rows)
total.value = response.total
Object.assign(ReimbursementRequestList, response.rows);
for(let i in ReimbursementRequestList){
console.log(ReimbursementRequestList[i])
ReimbursementRequestList[i].currentStatus = approvalStatusChange(ReimbursementRequestList[i].status,ReimbursementRequestList[i].currentAuditRoleId)
}
getTopApproveInfo()
});
}
/** 搜索按钮操作 */
function handleQuery() {
//表格多选
const handleSelectionChange = (val) => {
passObjList.length = 0
for(let item of val){
let currentAuditRoleId = item.currentAuditRoleId
//获取currentAuditRoleId的下标
let index = allList.value.findIndex(item=>item.nodeId === currentAuditRoleId)
let obj = {
//项目费用id
tripApplicationId:item.id,
//下一个节点nodeId
nextNodeId:null,
//是否终审
isEndApproval:false
}
//判断是不是最后一个下标
if((allList.value.length -1) === index){
//最后一个下标的话
obj.nextNodeId = allList.value[index].nodeId
obj.isEndApproval = true
}else{
//不是最后一个下标
obj.nextNodeId = allList.value[index + 1].nodeId
obj.isEndApproval = false
}
passObjList.push(obj)
}
};
//只有待审批的表格可选
const rowSelectable = (row) => {
return row.currentStatus === 0
};
//获取当前审批状态 返回值0表示当前用户可以审核,大于0已经审核过了,小于0表示表示还没到当前用户
const approvalStatusChange = (status,currentNodeId)=>{
//如果状态为未通过,那么这里返回-999
if(status === 1) return -999
if(status === 3) return 999
// 先根据每个节点的激活nodeid查找对应的角色id---也就是可以申请的角色
let activeRoleId = allList.value.find(item =>item.nodeId === currentNodeId).roleId
let lastCurrentRoleId = currentUserRoleInfoList.value[currentUserRoleInfoList.value.length - 1].roleId
//激活id的下标减去当前登录用户最后一个角色id的在整体审批列表差
//0表示当前用户可以审核,大于0已经审核过了,小于0表示表示还没到当前用户
return allList.value.findIndex(item =>item.roleId === activeRoleId) - allList.value.findIndex(item =>item.roleId === lastCurrentRoleId)
}
/** 重置按钮操作 */
function resetQuery() {
//获取列表第一个顶部信息
const getTopApproveInfo = ()=>{
let item2 = ReimbursementRequestList[0]
changProjectNumber.value = item2.projectNumber
let i = allList.value.findIndex((item)=>item.nodeId === item2.currentAuditRoleId)
if(i === -1) stepActive.value = 1
else stepActive.value = i+1
}
/** 查看详情按钮操作 */
function handleView(){
//表格的鼠标进入事件
let timer = null;
const handleHover = (row, column, cell, event) => {
//防抖
if (timer) {
clearTimeout(timer);
}
console.log(row)
timer = setTimeout(() => {
changProjectNumber.value = row.projectNumber
let i = allList.value.findIndex((item)=>item.nodeId === row.currentAuditRoleId)
console.log(i)
if(i === -1) stepActive.value = 1
else stepActive.value = i+1
}, 300);
}
const handleLeave = () => {
if (timer) {
clearTimeout(timer);
}
timer = setTimeout(() => {
getTopApproveInfo()
}, 300);
}
//一键通过
const oneClickPass = ()=>{
if(!passObjList.length) return ElMessage({
message: '请先选择数据项',
type: 'error'
})
tripApplicationApproval(passObjList).then(res=>{
if(res.code === 200){
getList()
}
})
}
//通过
const passProjectCost = (row)=>{
console.log(row)
let currentAuditRoleId = row.currentAuditRoleId
//获取currentAuditRoleId的下标
let index = allList.value.findIndex(item=>item.nodeId === currentAuditRoleId)
let obj = {
//项目费用id
tripApplicationId:row.id,
//下一个节点nodeId
nextNodeId:null,
//是否终审
isEndApproval:false
}
//判断是不是最后一个下标
if((allList.value.length -1) === index){
//最后一个下标的话
obj.nextNodeId = allList.value[index].nodeId
obj.isEndApproval = true
}else{
//不是最后一个下标
obj.nextNodeId = allList.value[index + 1].nodeId
obj.isEndApproval = false
}
console.log("obj",obj)
tripApplicationApproval([obj]).then(res=>{
console.log("响应",res)
if(res.code === 200){
getList()
}
})
}
//驳回
const reject = (row)=>{
oneClickFlag = false
console.log(row)
dialogFormVisible.value = true
rejectObj.tripApplicationId = row.id
}
//确定驳回
const sureReject = ()=>{
if(oneClickFlag){
//如果是一键驳回
let list = passObjList.map((item)=>{
return {
tripApplicationId:item.id,
groundsForRejection:rejectObj.groundsForRejection
}
})
projectCostReimbursementNotPass(list).then(res=>{
dialogFormVisible.value = false
cancelReject()
getList()
})
}else {
//不是一键驳回
projectCostReimbursementNotPass([rejectObj]).then(res=>{
dialogFormVisible.value = false
cancelReject()
getList()
})
}
}
//一键驳回
const oneClickNotPass = ()=>{
if(!passObjList.length) return ElMessage({
message: '请先选择数据项',
type: 'error'
})
oneClickFlag = true
dialogFormVisible.value = true
}
//取消对话框
const cancelReject = ()=>{
dialogFormVisible.value = false
rejectObj = reactive({
id :null,
groundsForRejection:null
})
}
onMounted(async ()=>{
//获取所有审批列表
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment