Browse Source

no message

kllay 19 hours ago
parent
commit
1fc273a41c

+ 3 - 3
src/views/system/borrow/component/ClassroomBorrow/index.vue

@@ -86,7 +86,7 @@
 			<el-button type="primary" @click="addItem">添加设备</el-button>
 
 			<div style="margin: 16px 0 8px 0; font-weight: bold">配件信息</div>
-			<el-input v-model="form.accessory_info" placeholder="请输入配件信息"  :disabled="isView"/>
+			<el-input v-model="form.accessories" placeholder="请输入配件信息"  :disabled="isView"/>
 
 
 			<!-- <div style="margin: 16px 0 8px 0; font-weight: bold">附件</div>
@@ -270,7 +270,7 @@ const form = ref({
 	borrow_type:1,
 	course_input: '',
 	attachments:'',
-	accessory_info:''
+	accessories:''
 });
 const showSelectDeviceDialog = ref(false);
 const isViewMode = computed(() => props.modelValue?.mode === 'view');
@@ -353,7 +353,7 @@ function resetForm() {
     borrow_type: 1,
     course_input: '',
 	attachments:'',
-	accessory_info:''
+	accessories:''
   };
 }
 

+ 63 - 41
src/views/system/borrow/component/SpecialBorrow/index.vue

@@ -87,7 +87,7 @@
 			</el-table>
 			<el-button type="primary" @click="addItem" v-if="!isView">添加设备</el-button>
 			<div style="margin: 16px 0 8px 0; font-weight: bold">配件信息</div>
-			<el-input v-model="form.accessory_info" placeholder="请输入配件信息"  :disabled="isView"/>
+			<el-input v-model="form.accessories" placeholder="请输入配件信息"  :disabled="isView"/>
 
 			<div>
 			<el-upload
@@ -105,32 +105,17 @@
 		<!-- 审批信息流程展示 -->
 		<div v-if="isView"  style="margin-top: 24px; padding: 0 12px">
 		<div style="font-weight: bold; margin-bottom: 12px">审批流程进度</div>
-		<el-steps :active="activeStep" align-center>
+		<el-steps :active="steps.length" align-center>
 			<el-step
-			title="创建申请"
-			:description="`创建时间:${ timeline.create }`"
-			icon="CircleCheck"
-			:status="activeStep >= 1 ? 'finish' : 'wait'"
+				v-for="(step, index) in steps"
+				:key="index"
+				:title="step.title"
+				:description="step.description"
+				icon="CircleCheck"
+				:status="step.status"
 			/>
-			<el-step
-			title="待审批"
-			description="待超级管理员审批"
-			icon="CircleCheck"
-			:status="activeStep >= 2 ? 'finish' : 'wait'"
-			/>
-			<el-step
-			title="审批通过"
-			:description="`审批人:${timeline.approver},时间:${timeline.approve}`"
-			icon="CircleCheck"
-			:status="activeStep >= 3 ? 'finish' : 'wait'"
-			/>
-			<el-step
-			title="流程完成"
-			description="流程已结束"
-			icon="CircleCheck"
-			:status="activeStep >= 4 ? 'finish' : 'wait'"
-			/>
-		</el-steps>
+			</el-steps>
+
 		</div>
 
 		<template #footer>
@@ -151,10 +136,11 @@ import Cookies from 'js-cookie';
 import { request } from '/@/utils/service';
 import { Plus } from '@element-plus/icons-vue';
 
-const now = dayjs().format('YYYY-MM-DD HH:mm:ss');
 
 
 
+const now = dayjs().format('YYYY-MM-DD HH:mm:ss');
+
 
 const props = defineProps<{ visible: boolean; modelValue?: any }>();
 
@@ -174,7 +160,7 @@ const handleCustomUpload = async ({ file, onProgress, onSuccess, onError }: any)
   const token = Cookies.get('token'); 
   const formData = new FormData();
   formData.append('file', file);
-  console.log("token::::",token);
+//   console.log("token::::",token);
 
   try {
     const res = await request({
@@ -211,13 +197,54 @@ const handleCustomUpload = async ({ file, onProgress, onSuccess, onError }: any)
 };
 
 // import { ElSteps } from 'element-plus';
-
+const steps = ref<any[]>([]);
 const timeline = ref({
-  create: '',
-  approve: '',
-  approver: ''
+	setpstatus:0,
+	create: '',
+	approve: '',
+	approver: '',
+	approvemsg:''
 });
-const activeStep = ref(1);
+
+
+function buildSteps(data: any) {
+  steps.value = [
+    {
+      title: '创建申请',
+      description: `创建时间:${data.create_datetime}`,
+      status: 'finish'
+    },
+    {
+      title: '待审批',
+      description: '待超级管理员审批',
+      status: data.status >= 2 ? 'finish' : 'process'
+    }
+  ];
+
+  if (data.status === 2) {
+    steps.value.push({
+      title: '审批通过',
+      description: `审批人:${data.approver_name},时间:${data.approve_time}`,
+      status: 'finish'
+    });
+  } else if (data.status === 3) {
+    steps.value.push({
+      title: '审批拒绝',
+      description: `审批人:${data.approver_name},拒绝原因: ${data.approve_remark},时间:${data.approve_time}`,
+      status: 'error'
+    });
+  }
+
+  if (data.status >= 4) {
+    steps.value.push({
+      title: '流程完成',
+      description: '流程已结束',
+      status: 'finish'
+    });
+  }
+}
+
+// const activeStep = ref(1);
 
 
 
@@ -236,7 +263,7 @@ const form = ref({
 	applicant_remark_type: "1",
 	applicant_remark: '',
 	items: [],
-	accessory_info: '',
+	accessories: '',
 	borrow_type: 2,
 	return_location:'',
 	attachments:'',
@@ -302,14 +329,9 @@ watch(() => props.modelValue, async (val) => {
 			if (res.code === 2000 && res.data) {
 				const data = res.data;
 				Object.assign(form.value, data);
-				timeline.value.create = data.create_datetime || '';
-				timeline.value.approve = data.approve_time || '';
-				timeline.value.approver = data.approver_info?.name || '审批人';
-
-				activeStep.value = 1; // 创建
-				if (data.status >= 1) activeStep.value = 2; // 待审批
-				if (data.status >= 2) activeStep.value = 3; // 审批通过
-				if (data.status >= 3) activeStep.value = 4; // 完成
+				buildSteps(data);
+	
+
 			}
 			} catch (e) {
 			ElMessage.error('获取审批信息失败');