From a2388c1b0d92fe4a6ff1bc4be628d7590fce23af Mon Sep 17 00:00:00 2001 From: bestlee Date: Thu, 25 Jun 2026 10:44:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=AF=B9=E6=8E=A5=E5=AE=8C?= =?UTF-8?q?=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/apply.js | 8 +++ src/api/request.js | 4 +- src/main.js | 2 +- src/views/applyList/detail.vue | 97 +++++++++++++++++++++++++++--- src/views/applyList/index.vue | 15 ++++- src/views/applyList/lockDetail.vue | 97 +++++++++++++++++++++++++++--- src/views/applyList/waitList.vue | 15 ++++- 7 files changed, 214 insertions(+), 24 deletions(-) diff --git a/src/api/apply.js b/src/api/apply.js index 17a5f4d..3b3228a 100644 --- a/src/api/apply.js +++ b/src/api/apply.js @@ -12,4 +12,12 @@ export function waitListApi(params) { export function detailsApi(id) { return axios.get('/api/chain-remove-applies/'+id); } +// 通过、驳回、保存 +export function approvalApi(id,params) { + return axios.post('/api/chain-remove-applies/'+id+'/audit',params); +} +// 获取待审批数量 +export function taskCountApi() { + return axios.get('/api/users/role', {}); +} diff --git a/src/api/request.js b/src/api/request.js index 9df08fc..9b2f7a7 100644 --- a/src/api/request.js +++ b/src/api/request.js @@ -37,10 +37,10 @@ axios.interceptors.response.use( }, (error) => { if (error.response.status === 401) { - showNotify({ type: 'danger', message: '账号已过期,请重新登录!' }); + showNotify({ message: '账号已过期,请重新登录!', background: '#ff7d00' }); router.push({ path: '/login' }); } else { - showNotify({ type: 'danger', message: error.response.data.message || '服务错误' }); + showNotify({ message: error.response.data.message || '服务错误', background: '#ff7d00' }); } return Promise.reject(error);; } diff --git a/src/main.js b/src/main.js index 578ddef..03060a8 100644 --- a/src/main.js +++ b/src/main.js @@ -1,10 +1,10 @@ import './assets/main.css' +import 'vant/lib/index.css' import { createApp } from 'vue' import { createPinia } from 'pinia' import App from './App.vue' import router from './router' import 'amfe-flexible' -import 'vant/lib/index.css' import '@/api/request'; const app = createApp(App) diff --git a/src/views/applyList/detail.vue b/src/views/applyList/detail.vue index c859b9b..fcf0848 100644 --- a/src/views/applyList/detail.vue +++ b/src/views/applyList/detail.vue @@ -3,12 +3,15 @@ import { ref,onMounted } from 'vue' import router from '@/router' import { useRoute } from 'vue-router' import { showNotify } from 'vant' -import { detailsApi } from '@/api/apply'; +import { detailsApi,approvalApi,taskCountApi } from '@/api/apply'; const route = useRoute() const loading = ref(false); const params = ref(null) const info = ref(null) +const showReject = ref(false) +const rejectComment = ref('') +const taskCount = ref(0); // 状态 const statusList = ref([ {text:'草稿',value:0}, @@ -45,14 +48,62 @@ const jumpTo = (val) => { if(val===2){ router.push({ path: '/lockDetail', - query: { id: params.value.id, type: params.value.type }, + query: { id: params.value.id, type: params.value.type,isMyself: params.value.isMyself }, }) } } // 同意 -const agree = () => { - showNotify({ type: 'success', message: '同意成功' }); +const agree = async () => { + loading.value = true; + try { + await approvalApi(params.value?.id,{ + action: 'approve', + comment: '', + risk_description: info.value?.risk_description, + safety_measures: info.value?.safety_measures, + cosign_item_id: info.value?.cosign_item_id,//审核人id + }); + showNotify({ message: '同意成功', background: '#00b42a' }); + jumpTo(params.value?.type==='wait'?1:0); + } finally { + loading.value = false; + } } +// 驳回 +const reject = async () => { + rejectComment.value = ''; + showReject.value = true; +} +// 驳回确认 +const rejectConfirm = (action) => new Promise(async (resolve) => { + // 取消 + if(action==='cancel'){ + showReject.value = false; + resolve(true); + } + // 确认 + if(action==='confirm'){ + if(rejectComment.value==''){ + showNotify({ message: '请输入驳回理由', background: '#ff7d00' }); + resolve(false); + return; + } + try { + await approvalApi(params.value?.id,{ + action: 'reject', + comment: rejectComment.value,//驳回理由 + risk_description: info.value?.risk_description, + safety_measures: info.value?.safety_measures, + cosign_item_id: info.value?.cosign_item_id,//审核人id + }); + showNotify({ message: '驳回成功', background: '#00b42a' }); + resolve(true); + jumpTo(params.value?.type==='wait'?1:0); + } catch (error) { + resolve(false); + } + } +}); // 获取详情 const getDetail = async () => { loading.value = true; @@ -69,12 +120,23 @@ const getDetail = async () => { }else{ info.value.steps = res.data?.apply_steps; } + console.log(info.value) } finally { loading.value = false; } } +// 获取待审批数量 +const getTaskCount = async () => { + try { + const res = await taskCountApi(); + taskCount.value = res.data?.chain_remove?.count || 0; + } catch (error) { + + } +} onMounted(() => { + getTaskCount(); if(route.query){ params.value = route.query; getDetail(); @@ -90,7 +152,7 @@ onMounted(() => {

已审批

-

待审批

+

待审批{{taskCount}}

+
+

驳回:{{info?.reject?.comment}}

+

返回列表

联锁详情

-

同意

-

驳回

+
+

同意

+

驳回

+
+ + +
+ +
+
diff --git a/src/views/applyList/waitList.vue b/src/views/applyList/waitList.vue index 3f27478..ddde309 100644 --- a/src/views/applyList/waitList.vue +++ b/src/views/applyList/waitList.vue @@ -16,6 +16,7 @@ const statusList = ref([ {text:'已撤回',value:98}, {text:'已驳回',value:99}, ]); +const taskCount = ref(0); const list = ref([]) // 匹配选项 @@ -36,7 +37,7 @@ const jumpTo = (type,item) => { if(type==='detail'){ router.push({ path: '/detail', - query: {id: item.id,type: 'wait'} + query: {id: item.id,type: 'wait',isMyself: item.type} }) } } @@ -60,8 +61,18 @@ const getList = async () => { loading.value = false; } } +// 获取待审批数量 +const getTaskCount = async () => { + try { + const res = await taskCountApi(); + taskCount.value = res.data?.chain_remove?.count || 0; + } catch (error) { + + } +} onMounted(() => { + getTaskCount(); getList(); }); @@ -74,7 +85,7 @@ onMounted(() => {

已审批

-

待审批

+

待审批{{taskCount}}