buhuazhen
2026-05-29 5c30f301d6d4a5b8fc1183e06aaea8dc366d3540
src/views/collaborativeApproval/approvalProcess/components/infoFormDia.vue
@@ -35,7 +35,7 @@
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item :label="props.approveType == 5 ? '采购说明:' : '审批事由:'" prop="approveReason">
            <el-form-item :label="props.approveType == 5 ? '采购单号:' : '审批事由:'" prop="approveReason">
              <el-input v-model="form.approveReason" placeholder="请输入" clearable type="textarea" />
            </el-form-item>
          </el-col>
@@ -298,16 +298,18 @@
   userListNoPageByTenantId().then((res) => {
    userList.value = res.data;
  });
  getProductOptions();
   form.value = {}
   approverNodes.value = [
      { id: 1, userId: null }
   ]
  form.value.approveUser = userStore.id;
  form.value.approveTime = getCurrentDate();
  // 获取当前用户信息并设置部门ID
  form.value.approveDeptId = userStore.currentDeptId
  // 加载部门选项,并在加载完成后设置部门名称
  getProductOptions();
  if (operationType.value === 'edit') {
    fileList.value = row.commonFileList
    form.value.tempFileIds = fileList.value.map(file => file.id)
@@ -318,7 +320,7 @@
      if (res.data && res.data.approveUserIds) {
        const userIds = res.data.approveUserIds.split(',')
        approverNodes.value = userIds.map((userId, idx) => ({
          id: idx + 1,
          id: idx + 1,
          userId: parseInt(userId.trim())
        }))
        nextApproverId = userIds.length + 1
@@ -330,8 +332,18 @@
  }
}
const getProductOptions = () => {
  getDept().then((res) => {
  return getDept().then((res) => {
    productOptions.value = res.data;
    // 如果已有部门ID,自动设置部门名称(用于验证)
    if (form.value.approveDeptId && productOptions.value.length > 0) {
      const matchedDept = productOptions.value.find(dept =>
        dept.deptId == form.value.approveDeptId ||
        String(dept.deptId) === String(form.value.approveDeptId)
      );
      if (matchedDept) {
        form.value.approveDeptName = matchedDept.deptName;
      }
    }
  });
};
function convertIdToValue(data) {
@@ -344,7 +356,7 @@
    if (children && children.length > 0) {
      newItem.children = convertIdToValue(children);
    }
    return newItem;
  });
}
@@ -461,4 +473,4 @@
<style scoped>
</style>
</style>