maven
2 小时以前 1755192ff6533145a6ed82da31d9f7816bbe00f5
src/views/collaborativeApproval/approvalProcess/components/infoFormDia.vue
@@ -18,6 +18,7 @@
          <el-col :span="24">
            <el-form-item label="申请部门:" prop="approveDeptId">
                     <el-select
                        disabled
                        v-model="form.approveDeptId"
                        placeholder="选择部门"
                     >
@@ -52,7 +53,10 @@
                  :key="node.id"
                  style="margin-right: 30px; text-align: center; margin-bottom: 10px;"
                >
                  <div>节点{{ index + 1 }} →</div>
                  <div>
                    <span>审批人</span>
                    →
                  </div>
                  <el-select
                    v-model="node.userId"
                    placeholder="选择人员"
@@ -81,7 +85,17 @@
        <el-row :gutter="30">
          <el-col :span="12">
            <el-form-item label="申请人:" prop="approveUser">
              <el-input v-model="form.approveUser" placeholder="请输入" clearable/>
                     <el-select
                        v-model="form.approveUser"
                        placeholder="选择人员"
                     >
                        <el-option
                           v-for="user in userList"
                           :key="user.userId"
                           :label="user.nickName"
                           :value="user.userId"
                        />
                     </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
@@ -115,8 +129,8 @@
  approveProcessAdd, approveProcessGetInfo,
  approveProcessUpdate,
  getDept
} from "../../../../api/collaborativeApproval/approvalProcess.js";
import {userListNoPage} from "../../../../api/system/user.js";
} from "@/api/collaborativeApproval/approvalProcess.js";
import {userListNoPageByTenantId} from "@/api/system/user.js";
const { proxy } = getCurrentInstance()
const emit = defineEmits(['close'])
import useUserStore from "@/store/modules/user";
@@ -145,6 +159,7 @@
});
const { form, rules } = toRefs(data);
const productOptions = ref([]);
const currentApproveStatus = ref(0)
// 审批人节点相关
const approverNodes = ref([
@@ -163,7 +178,7 @@
const openDialog = (type, row) => {
  operationType.value = type;
  dialogFormVisible.value = true;
  userListNoPage().then((res) => {
   userListNoPageByTenantId().then((res) => {
    userList.value = res.data;
  });
  getProductOptions();
@@ -171,26 +186,27 @@
   approverNodes.value = [
      { id: 1, userId: null }
   ]
  form.value.approveUser = userStore.nickName;
  form.value.approveUser = userStore.id;
  form.value.approveTime = getCurrentDate();
  // 获取当前用户信息并设置部门ID
  form.value.approveDeptId = userStore.currentDeptId
  if (operationType.value === 'edit') {
      currentApproveStatus.value = row.approveStatus
    approveProcessGetInfo({id: row.approveId,approveReason: '1'}).then(res => {
         form.value = {...res.data}
      // 反显审批人
      // if (res.data && res.data.approverIds) {
      //   const nameArr = res.data.approverIds.split(',')
      //   approverNodes.value = nameArr.map((name, idx) => {
      //     const user = userList.value.find(u => u.name === name)
      //     return { id: idx + 1, userId: user ? user.id : null }
      //   })
      //   nextApproverId = nameArr.length + 1
      // } else if (row.approverList && Array.isArray(row.approverList) && row.approverList.length > 0) {
      //   approverNodes.value = row.approverList.map((userId, idx) => ({ id: idx + 1, userId }))
      //   nextApproverId = row.approverList.length + 1
      // } else {
      //   approverNodes.value = [{ id: 1, userId: null }]
      //   nextApproverId = 2
      // }
      if (res.data && res.data.approveUserIds) {
        const userIds = res.data.approveUserIds.split(',')
        approverNodes.value = userIds.map((userId, idx) => ({
          id: idx + 1,
          userId: parseInt(userId.trim())
        }))
        nextApproverId = userIds.length + 1
      } else {
        approverNodes.value = [{ id: 1, userId: null }]
        nextApproverId = 2
      }
    })
  }
}
@@ -216,7 +232,7 @@
// 提交产品表单
const submitForm = () => {
  // 收集所有节点的审批人id
  form.value.approverIds = approverNodes.value.map(node => node.userId).join(',')
  form.value.approveUserIds = approverNodes.value.map(node => node.userId).join(',')
  // 审批人必填校验
  const hasEmptyApprover = approverNodes.value.some(node => !node.userId)
  if (hasEmptyApprover) {
@@ -225,7 +241,7 @@
  }
  proxy.$refs.formRef.validate(valid => {
    if (valid) {
      if (operationType.value === "add") {
      if (operationType.value === "add" || currentApproveStatus.value == 3) {
        approveProcessAdd(form.value).then(res => {
          proxy.$modal.msgSuccess("提交成功");
          closeDia();