Explorar el Código

去掉offer的审批

ZGC4846 hace 5 días
padre
commit
072cb18a25
Se han modificado 1 ficheros con 82 adiciones y 78 borrados
  1. 82 78
      src/views/hiring/components/OfferLaunchDialog.vue

+ 82 - 78
src/views/hiring/components/OfferLaunchDialog.vue

@@ -241,32 +241,34 @@
       </div>
 
       <div class="drawer-footer">
-        <span
-          ><i class="el-icon-lock"></i>
-          保存走新建 Offer;提交审批会先保存再发起流程</span
-        >
+        <span><i class="el-icon-lock"></i> 保存走新建 / 更新 Offer</span>
         <div>
-          <el-button :loading="saving" :disabled="sending" @click="save"
+          <el-button @click="visibleProxy = false">取消</el-button>
+          <el-button type="primary" :loading="saving" @click="save"
             >保存</el-button
           >
+          <!-- 暂时不发送 / 不提交审批
           <el-button
             type="primary"
             :loading="sending"
             :disabled="saving"
             @click="submit"
           >
-            {{ form.online === 1 ? "提交审批" : "确认线下通知" }}
+            {{ form.online === 1 ? "发送通知" : "确认线下通知" }}
           </el-button>
+          -->
         </div>
       </div>
     </el-drawer>
 
+    <!-- 暂时不走 Offer 审批流程
     <processSubmitDialog
       :processSubmitDialogFlag.sync="processSubmitDialogFlag"
       v-if="processSubmitDialogFlag"
       ref="processSubmitDialogRef"
       @reload="onProcessSubmitReload"
     />
+    -->
   </div>
 </template>
 
@@ -275,19 +277,20 @@ import {
   adaptHiringApproval,
   getHiringApprovalById,
 } from "@/api/hr/hiringApproval";
-import processSubmitDialog from "@/BIZComponents/processSubmitDialog/processSubmitDialog.vue";
+// import processSubmitDialog from "@/BIZComponents/processSubmitDialog/processSubmitDialog.vue";
 import {
   bindOfferAttachment,
-  confirmOfflineOffer,
+  // confirmOfflineOffer,
   createOffer,
   getCandidateById,
   getHiringApprovalPage,
   getOfferById,
-  OFFER_NOTIFY_BUSINESS_KEY,
+  // OFFER_NOTIFY_BUSINESS_KEY,
+  // sendOffer,
   updateOffer,
 } from "@/api/hr/offer";
 import { showRequestError } from "@/utils/message";
-import { getCurrentUser } from "@/utils/token-util";
+// import { getCurrentUser } from "@/utils/token-util";
 import {
   notifyTypes,
   presetRemark,
@@ -336,7 +339,7 @@ const emptyForm = () => ({
 
 export default {
   name: "OfferLaunchDialog",
-  components: { processSubmitDialog },
+  // components: { processSubmitDialog },
   props: {
     visible: { type: Boolean, default: false },
     /** 从录用审批列表带入,锁定审批单 */
@@ -350,7 +353,7 @@ export default {
       saving: false,
       sending: false,
       approvalLoading: false,
-      processSubmitDialogFlag: false,
+      // processSubmitDialogFlag: false, // 暂时不走审批
       approvalOptions: [],
       notifyTypes,
       signingMethods,
@@ -675,7 +678,7 @@ export default {
     },
     async save() {
       const valid = await this.$refs.form.validate().catch(() => false);
-      if (!valid || this.saving || this.sending) return;
+      if (!valid || this.saving) return;
       if (!this.hasOfferCandidate()) {
         this.$message.warning("录用审批未带出候选人姓名,请重新选择审批单");
         return;
@@ -684,6 +687,7 @@ export default {
       try {
         await this.persistOffer();
         this.$message.success("Offer 已保存");
+        this.visibleProxy = false;
         this.$emit("success", { action: "save", id: this.form.id });
       } catch (error) {
         showRequestError(error, "保存 Offer 失败");
@@ -691,71 +695,71 @@ export default {
         this.saving = false;
       }
     },
-    launchOfferApproval(row) {
-      if (!row?.id) {
-        this.$message.warning("请先保存 Offer 后再提交审批");
-        return;
-      }
-      this.processSubmitDialogFlag = true;
-      this.$nextTick(() => {
-        const currentUser = getCurrentUser() || {};
-        const params = {
-          businessId: row.id,
-          businessKey: OFFER_NOTIFY_BUSINESS_KEY,
-          formCreateUserId:
-            row.createUserId || currentUser.id || currentUser.userId || "",
-          variables: {
-            businessCode: row.offerNo || "",
-            businessName: row.name || row.candidateName || "",
-            businessType: "Offer通知",
-            positionName: row.positionName || "",
-            approvalId: row.approvalId || "",
-          },
-        };
-        this.$refs.processSubmitDialogRef?.init(params);
-      });
-    },
-    onProcessSubmitReload() {
-      this.visibleProxy = false;
-      this.$emit("success", { action: "submit", id: this.form.id });
-    },
-    async submit() {
-      const valid = await this.$refs.form.validate().catch(() => false);
-      if (!valid || this.sending || this.saving) return;
-      if (!this.hasOfferCandidate()) {
-        this.$message.warning("录用审批未带出候选人姓名,请重新选择审批单");
-        return;
-      }
-      this.sending = true;
-      try {
-        const offerId = await this.persistOffer();
-        if (Number(this.form.online) === 1) {
-          this.launchOfferApproval({
-            id: offerId,
-            offerNo: this.form.offerNo,
-            name: this.form.name,
-            candidateName: this.form.name,
-            positionName: this.form.positionName,
-            approvalId: this.form.approvalId,
-          });
-          return;
-        }
-        const detail = await getOfferById(offerId);
-        const code = String(detail.statusCode || "").toUpperCase();
-        if (code !== "OFFLINE_CONFIRMED") {
-          await confirmOfflineOffer(offerId);
-          this.$message.success("已确认线下 Offer 通知");
-        } else {
-          this.$message.success("线下 Offer 已确认");
-        }
-        this.visibleProxy = false;
-        this.$emit("success", { action: "offline", id: offerId });
-      } catch (error) {
-        showRequestError(error, "Offer 通知失败");
-      } finally {
-        this.sending = false;
-      }
-    },
+    // 暂时不走 Offer 审批 / 发送流程,保留便于后续恢复
+    // launchOfferApproval(row) {
+    //   if (!row?.id) {
+    //     this.$message.warning("请先保存 Offer 后再提交审批");
+    //     return;
+    //   }
+    //   this.processSubmitDialogFlag = true;
+    //   this.$nextTick(() => {
+    //     const currentUser = getCurrentUser() || {};
+    //     const params = {
+    //       businessId: row.id,
+    //       businessKey: OFFER_NOTIFY_BUSINESS_KEY,
+    //       formCreateUserId:
+    //         row.createUserId || currentUser.id || currentUser.userId || "",
+    //       variables: {
+    //         businessCode: row.offerNo || "",
+    //         businessName: row.name || row.candidateName || "",
+    //         businessType: "Offer通知",
+    //         positionName: row.positionName || "",
+    //         approvalId: row.approvalId || "",
+    //       },
+    //     };
+    //     this.$refs.processSubmitDialogRef?.init(params);
+    //   });
+    // },
+    // onProcessSubmitReload() {
+    //   this.visibleProxy = false;
+    //   this.$emit("success", { action: "submit", id: this.form.id });
+    // },
+    // async submit() {
+    //   const valid = await this.$refs.form.validate().catch(() => false);
+    //   if (!valid || this.sending || this.saving) return;
+    //   if (!this.hasOfferCandidate()) {
+    //     this.$message.warning("录用审批未带出候选人姓名,请重新选择审批单");
+    //     return;
+    //   }
+    //   this.sending = true;
+    //   try {
+    //     const offerId = await this.persistOffer();
+    //     if (Number(this.form.online) === 1) {
+    //       // this.launchOfferApproval({ ... });
+    //       await sendOffer(offerId);
+    //       this.$message.success(
+    //         `已发起 Offer 发送至 ${this.form.email || "候选人邮箱"}`,
+    //       );
+    //       this.visibleProxy = false;
+    //       this.$emit("success", { action: "send", id: offerId });
+    //       return;
+    //     }
+    //     const detail = await getOfferById(offerId);
+    //     const code = String(detail.statusCode || "").toUpperCase();
+    //     if (code !== "OFFLINE_CONFIRMED") {
+    //       await confirmOfflineOffer(offerId);
+    //       this.$message.success("已确认线下 Offer 通知");
+    //     } else {
+    //       this.$message.success("线下 Offer 已确认");
+    //     }
+    //     this.visibleProxy = false;
+    //     this.$emit("success", { action: "offline", id: offerId });
+    //   } catch (error) {
+    //     showRequestError(error, "Offer 通知失败");
+    //   } finally {
+    //     this.sending = false;
+    //   }
+    // },
     handleBeforeClose(done) {
       this.visibleProxy = false;
       if (typeof done === "function") done();