src/views/collaborativeApproval/approvalProcess/components/approvalDia.vue
@@ -16,7 +16,7 @@
            </el-row>
            <el-row>
               <el-col :span="24">
                  <el-form-item label="申请部门:" prop="approveDeptId">
                  <el-form-item label="申请部门:">
                     <el-select
                        disabled
                        v-model="form.approveDeptId"
@@ -178,7 +178,7 @@
</template>
<script setup>
import { computed, getCurrentInstance, reactive, ref, toRefs } from "vue";
import { computed, getCurrentInstance, nextTick, reactive, ref, toRefs } from "vue";
import {
   approveProcessDetails,
   getDept,
@@ -251,7 +251,31 @@
      userList.value = res.data;
   });
   form.value = {...row}
   getProductOptions()
   // 立即清除表单验证状态(因为字段是disabled的,不需要验证)
   nextTick(() => {
      if (formRef.value) {
         formRef.value.clearValidate();
      }
   });
   // 确保选项加载完成后再匹配值类型
   getProductOptions().then(() => {
      // 确保值类型匹配(如果选项已加载)
      if (productOptions.value.length > 0 && form.value.approveDeptId) {
         const matchedOption = productOptions.value.find(opt =>
            opt.deptId == form.value.approveDeptId ||
            String(opt.deptId) === String(form.value.approveDeptId)
         );
         if (matchedOption) {
            form.value.approveDeptId = matchedOption.deptId;
         }
      }
      // 再次清除验证,确保选项加载后值匹配正确
      nextTick(() => {
         if (formRef.value) {
            formRef.value.clearValidate();
         }
      });
   });
  // 报价审批:用审批事由字段承载的“报价单号”去查报价列表
  if (isQuotationApproval.value) {
@@ -287,17 +311,26 @@
  })
}
const getProductOptions = () => {
   getDept().then((res) => {
   return getDept().then((res) => {
      productOptions.value = res.data;
   });
};
// 提交审批
const submitForm = (status) => {
  const filteredActivities = activities.value.filter(activity => activity.isShen);
  filteredActivities[0].approveNodeStatus = status;
  if (!filteredActivities || filteredActivities.length === 0) {
    proxy.$modal.msgError("未找到待审批的节点");
    return;
  }
  const currentActivity = filteredActivities[0];
  if (!currentActivity) {
    proxy.$modal.msgError("未找到待审批的节点");
    return;
  }
  currentActivity.approveNodeStatus = status;
  // 判断是否为最后一步
  const isLast = activities.value.findIndex(a => a.isShen) === activities.value.length-1;
  updateApproveNode({ ...filteredActivities[0], isLast }).then(() => {
  updateApproveNode({ ...currentActivity, isLast }).then(() => {
    proxy.$modal.msgSuccess("提交成功");
    closeDia();
  });