Commit 5842a2df authored by 刘怀志's avatar 刘怀志

feat(审批详情): 审批详情接口对接1

parent 7e9c6402
import request from '@/utils/request'
const ProcessGroupEnum = {
/**
* 单据类型 AE
*/
AE:'1',
/**
* 单据类型 MC
*/
MC: '2',
/**
* 单据类型 DC
*/
DC: '3'
}
/**
* Ae流程实例 - 分页查询
* @param query
......@@ -24,3 +39,48 @@ export function queryInstanceByPage(params) {
params
})
}
/**
* 流程实例 - 获取详情
* @param instanceId
* @returns {*}
*/
export function getProcessNodeByInstanceId(instanceId) {
return request({
url: `/sysprocessbasic/getProcessNode/${instanceId}`,
method: 'get'
})
}
/**
* 管理员审批
* @param query
* @returns {*}
*/
export function approveByAdmin(query) {
// 需要根据传回的url判断是哪个接口
const { url } = query
if (query.processGroup === ProcessGroupEnum.MC) {
return MCService({
url: url,
method: 'post',
params: query
})
} else if (query.processGroup === ProcessGroupEnum.DC) {
return DCService({
url: url,
method: 'post',
params: query
})
} else {
return request({
url: url,
method: 'post',
params: query
})
}
}
export function getProcessInstanceStatus(instanceId) {
return request({
url: `/sysprocessbasic/getProcessInstanceStatus/${instanceId}`,
method: 'get'
})
}
\ No newline at end of file
......@@ -7,7 +7,7 @@
:scroll-with-animation="true">
<view v-for="(item,key) in noticeList" :key="key" style="display: flex;background-color: #ffffff">
<!-- 原消息卡片模板 -->
<view class="noticeCard" @click="goDetail">
<view class="noticeCard" @click="goDetail(item.businessId,item.processType,item.status === '10' && item.allowApprove)">
<view class="noticeTop">
<view class="titleClass">
<img :src="leftIconTwo" />
......@@ -115,6 +115,7 @@ export default {
rows: 10,
mesType: '1',
processGroup: '1',
completeStatus: false
},
defaultPageSize: 10,
// 底部加载
......@@ -145,9 +146,9 @@ export default {
},
},
methods: {
goDetail () {
goDetail (processId,processType,status) {
uni.navigateTo({
url: '/pages/approval_detail/baseDetail?id=1'
url: `/pages/approval_detail/baseDetail?processId=${processId}&isView=0&status=${status}&processType=${processType}&label=${this.getLabelByValue(this.tableUserFormList, processType)}`
})
},
/**
......
......@@ -7,7 +7,7 @@
:scroll-with-animation="true">
<view v-for="(item,key) in noticeList" :key="key" style="display: flex;background-color: #ffffff">
<!-- 原消息卡片模板 -->
<view class="noticeCard" @click="goDetail">
<view class="noticeCard" @click="goDetail(item.businessId,item.processType,item.status === '10' && item.allowApprove)">
<view class="noticeTop">
<view class="titleClass">
<img :src="leftIconOne" />
......@@ -145,9 +145,9 @@ export default {
},
},
methods: {
goDetail () {
goDetail (processId,processType,status) {
uni.navigateTo({
url: '/pages/approval_detail/baseDetail?id=1'
url: `/pages/approval_detail/baseDetail?processId=${processId}&isView=1&status=${status}&processType=${processType}&label=${this.getLabelByValue(this.tableUserFormList, processType)}`
})
},
/**
......
......@@ -4,51 +4,77 @@
:title-style="'color: #fff;font-weight: 500;font-size: 35rpx;'" />
<view class="container">
<view class="title">
基础数据变更(生产角色管理
基础数据变更({{ label }}
</view>
<!-- 步骤图区 -->
<view class="step-container">
<vertical-steps :steps="steps" :current-step="1">
<!-- 自定义第二步内容 -->
<!-- 自定义内容 -->
<template v-for="(step, index) in steps" #[`content-${index}`]>
<!-- 发起人 -->
<template v-if="index === 0">
<view class="custom-table">
<view class="subTitleClass">
<view class="subRow">
<view class="subTitle">
发起时间
员工姓名
</view>
<view class="subContent">
{{ step.subtitle }}
{{ step.content.userName }}
</view>
</view>
<view class="subRow">
<view class="subTitle">
发起人
员工职级
</view>
<view class="subContent">
{{ step.subtitle }}
{{ getLabelByValue(jobLevelList, step.content.rank) }}
</view>
</view>
<view class="subRow">
<view class="subTitle">
审批人
创建日期
</view>
<view class="subContent">
{{ step.subtitle }}
{{ parseTimeA(step.content.createTime, 'YYYY/MM/DD HH:mm') }}
</view>
</view>
</view>
</view>
</template>
<!-- 审批人 -->
<template v-else>
<view class="custom-table">
<view class="subTitleClass">
<view class="subRow">
<view class="subTitle">
结束时间
部门
</view>
<view class="subContent">
{{ step.subtitle }}
{{ step.content.approveDeptName }}
</view>
</view>
<view class="subRow">
<view class="subTitle">
生产角色
</view>
<view class="subContent">
{{ step.content.approveRoleName || '无' }}
</view>
</view>
<view class="subRow">
<view class="subTitle">
员工姓名
</view>
<view class="subContent">
{{ step.content.approveUser || '无' }}
</view>
</view>
</view>
</view>
</template>
</template>
</vertical-steps>
</view>
<!-- 步骤图完成 -->
......@@ -57,9 +83,9 @@
备注信息
</view>
<view class="remark-container">
<u-form :model="formData">
<u-form-item label="访问内容" prop="remark" labelPosition="top" labelWidth="80">
<u-textarea v-model="formData.remark" placeholder="请输入备注信息内容" show-word-limit :maxlength="200"></u-textarea>
<u-form :model="instanceDetail">
<u-form-item label="访问区域" prop="remark" labelPosition="top" labelWidth="80">
<u-textarea disabled v-model="instanceDetail.remarks" placeholder="-"></u-textarea>
</u-form-item>
</u-form>
</view>
......@@ -75,11 +101,11 @@
</view>
<!-- 按钮区域 -->
<view class="btns-container">
<view class="btn reject-btn" @click="handleReject">
<view v-if="isView === '0' && status === 'true'" class="btns-container">
<view class="btn reject-btn" @click="approveByAdmin('REJECT')">
驳回
</view>
<view class="btn approve-btn" @click="handleApprove">
<view class="btn approve-btn" @click="approveByAdmin('CONSENT')">
通过
</view>
</view>
......@@ -89,24 +115,219 @@
<script>
import VerticalSteps from '@/components/vertical-steps/vertical-steps'
import { getProcessNodeByInstanceId, approveByAdmin, getProcessInstanceStatus } from '../../api/system/approve'
import { parseTime } from '../../api/utils/ruoyi'
import { getDicts } from "../../api/system/baseConfig";
import { toast } from '../../utils/common'
export default {
name: "baseDetail",
onLoad: function (option) { //option为object类型,会序列化上个页面传递的参数
console.log('id', option.id); //打印出上个页面传递的参数。
console.log('processType', option.processType); //打印出上个页面传递的参数。
console.log('processId', option.processId); //打印出上个页面传递的参数。
this.processId = option.processId;
this.processType = option.processType;
this.label = option.label;
this.isView = option.isView;
this.status = option.status;
this.getList();
this.getInstanceDetail();
},
components: { VerticalSteps },
data() {
return {
processId: '',
processType: '',
label: '',
instanceDetail: {},
formData: {
remark: ''
},
steps: [
{ title: '申请提交', subtitle: '2023-08-01 14:00' },
{ title: '部门审批', subtitle: '进行中' },
{ title: '最终审核', subtitle: '待处理' }
steps: [],
jobLevelList: [],
isView: '',
status: '',
// url
urlList: [
{
value: '0001',
url: '/staff/processApproval'
},
{
value: '1001',
url: '/aeclassesinfo/processApproval'
},
{
value: '1002',
url: '/accreditpostvalidity/processPostApproval'
},
{
value: '0002',
url: '/sysRoleMamager/processApproval'
},
{
value: '0004',
url: '/sysRoleMamager/non_processApproval'
},
{
value: '0003',
url: '/organization/processApproval'
},
{
value: '1020',
url: '/aeequipmenttype/processApproval'
},
{
value: '1030',
url: '/aeenginemodel/processApproval'
},
{
value: '1031',
url: '/aeenginemodelextend/processApproval'
},
{
value: '1032',
url: '/aemodelgx/processApproval'
},
{
value: '1043',
url: '/aeunit/processApproval'
},
{
value: '1042',
url: '/aepartinformation/processApproval'
},
{
value: '1040',
url: '/aetool/processApproval'
},
{
value: '1004',
url: '/aeprolineinfo/processApproval'
},
{
value: '1005',
url: '/aeprolinesegment/processApproval'
},
{
value: '1006',
url: '/aeprolinegx/processGxApproval'
},
{
value: '1041',
url: '/aeauxiliarymaterial/processApproval'
},
{
value: '1009',
url: '/aeprolinetray/processApproval'
},
{
value: '1007',
url: '/aetechequipment/processApproval'
},
{
value: '1008',
url: '/aetechassembly/processApproval'
},
{
value: '1010',
url: '/aetechequipment/all/processApproval'
},
{
value: '1011',
url: '/aetechassembly/all/processApproval'
},
{
value: '1021',
url: '/aeequipmentinfo/processApproval'
},
{
value: '1044',
url: '/aegroupproject/processApproval'
}
]
}
},
computed: {
// 计算属性
parseTimeA() {
return (time, format) => {
return parseTime(time, format || '{m}-{d} {h}:{i}:{s}')
}
},
},
methods: {
/**
* 获取审批url
* @returns {string}
*/
getUrl() {
const type = this.instanceDetail.processType
let url = ''
this.urlList.forEach(item => {
if (item.value === type) {
url = item.url
}
})
return url
},
async approveByAdmin(type) {
this.btnLoading = true
// 审批
await approveByAdmin({
instanceId: this.processId,
approveId: this.instanceDetail.currentApprove.businessId,
approveControl: type,
url: this.getUrl(),
processGroup: '1'
}).catch(() => {
this.isView = ''
})
// 回调获取流程实例的状态
const { data } = await getProcessInstanceStatus(this.processId)
// 异常结束
if (data === '6') {
toast('流程异常结束,请检查对应流程')
} else {
toast('审批成功')
this.$tab.reLaunch('/pages/index')
}
},
/** 查询字典数据列表 */
getList() {
getDicts('sys_job_level').then(response => {
// console.log("查询数据字段狗",response)
const jobLevelForm = response.data
for (const item of jobLevelForm) {
const result = {
value: item.dictValue,
label: item.dictLabel
}
this.jobLevelList.push(result)
}
})
},
/**
* 指定列表,根据值,取label
*/
getLabelByValue(list, value, key = 'value', label = 'label') {
const item = list.find(item => item[key] === value)
return item ? item[label] : '-'
},
/**
* 获取审批节点详情
*/
getInstanceDetail() {
getProcessNodeByInstanceId(this.processId).then(res => {
console.log('getProcessNodeByInstanceId', res);
this.instanceDetail = res.data
this.steps.push({ title: '发起人', content: res.data.startUserInfo })
this.instanceDetail.processInstanceApproveList.forEach((item, index) => {
this.steps.push({ title: `审批人${index + 1}`, content: item })
})
console.log('steps', this.steps);
})
}
}
}
</script>
......@@ -164,6 +385,7 @@ export default {
text-align: left;
font-style: normal;
text-transform: none;
min-width: 120rpx;
}
.subContent {
......@@ -171,7 +393,7 @@ export default {
font-weight: 400;
font-size: 28rpx;
color: #222222;
text-align: center;
text-align: right;
font-style: normal;
text-transform: none;
}
......
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