Forráskód Böngészése

fix: 修复三个前端数据异常问题 - enterprise_id 传参不一致 & 员工姓名变更

alphah 1 hete
szülő
commit
25290f531f

BIN
frontend/dist.zip


+ 2 - 2
frontend/src/views/module_payment/employee/components/EmployeeForm.vue

@@ -158,7 +158,7 @@ watch(
   () => props.employeeId,
   async (newVal) => {
     if (newVal && props.type === "update") {
-      const res = await EmployeeAPI.detailEmployee(newVal, props.enterpriseId || "");
+      const res = await EmployeeAPI.detailEmployee(props.enterpriseId || "", newVal);
       const data = res.data.data as EmployeeDetail;
       if (data) {
         // formData.enterprise_id = data.enterprise_id;
@@ -222,7 +222,7 @@ async function submitForm() {
 
   try {
     const submitData: Record<string, unknown> = {
-      enterprise_id: enterpriseStore.getCurrentEnterprise?.enterprise_id || "",
+      enterprise_id: props.enterpriseId || formData.enterprise_id || enterpriseStore.getCurrentEnterprise?.enterprise_id || "",
       employee_name: formData.employee_name,
       employee_no: formData.employee_no,
       identity_type: formData.identity_type,

+ 4 - 2
frontend/src/views/module_payment/employee/index.vue

@@ -313,7 +313,7 @@ const useEnterprise = useEnterpriseStore();
 
 const currentEmployeeId = ref<string>("");
 const currentDepartmentId = ref<string>("");
-const currentEnterpriseId = computed(() => useEnterprise.getCurrentEnterprise?.enterprise_id || "");
+const currentEnterpriseId = computed(() => enterpriseIdFromUrl.value || useEnterprise.getCurrentEnterprise?.enterprise_id || "");
 
 // 部门搜索配置
 const deptSearchConfig = reactive<ISearchConfig>({
@@ -404,6 +404,8 @@ const contentConfig = reactive<IContentConfig<EmployeePageQuery>>({
       page_no: params.page_no,
       page_size: params.page_size,
     };
+    const eid = enterpriseIdFromUrl.value || useEnterprise.getCurrentEnterprise?.enterprise_id;
+    if (eid) query.enterprise_id = eid;
     if (params.employee_name) query.employee_name = params.employee_name;
     if (params.employee_mobile) query.employee_mobile = params.employee_mobile;
     if (params.employee_no) query.employee_no = params.employee_no;
@@ -555,7 +557,7 @@ async function handleDeleteDepartment(departmentId: string, departmentName: stri
 // 获取员工签约激活链接
 async function handleGetInviteLink(row: any) {
   try {
-    const enterpriseId = currentEnterpriseId.value || enterpriseIdFromUrl.value;
+    const enterpriseId = row.enterprise_id || currentEnterpriseId.value || enterpriseIdFromUrl.value;
     if (!enterpriseId) {
       ElMessage.warning("请先选择企业");
       return;

+ 1 - 0
frontend/src/views/module_payment/enterprise/index.vue

@@ -360,6 +360,7 @@ function handleGoToEmployee(enterpriseId?: string) {
     ElMessage.warning("该企业暂无企业ID");
     return;
   }
+  enterpriseStore.setCurrentEnterprise(enterpriseId);
   router.push({
     path: "/module_payment/employee",
     query: { enterprise_id: enterpriseId },

+ 3 - 2
frontend/src/views/module_payment/quota/components/EmployeeQuotaDetailDialog.vue

@@ -72,6 +72,7 @@
 import { ref, watch } from "vue";
 import QuotaAPI, { STATUS_TAG_TYPE, STATUS_LABEL } from "@/api/module_payment/quota";
 import EmployeeAPI from "@/api/module_payment/employee";
+import { useEnterpriseStore } from "@/store/modules/enterprise.store";
 import AdjustAmountDialog from "./AdjustAmountDialog.vue";
 import ChangeHistoryDialog from "./ChangeHistoryDialog.vue";
 
@@ -104,9 +105,9 @@ watch(() => props.visible, async (v) => {
 watch(visible, (v) => emit("update:visible", v));
 
 async function loadEmployee() {
-  const eid = "";
+  const eid = useEnterpriseStore().getCurrentEnterprise?.enterprise_id || "";
   try {
-    const res = await EmployeeAPI.detailEmployee({ employee_id: props.employeeId } as any);
+    const res = await EmployeeAPI.detailEmployee(eid, props.employeeId);
     const emp = res?.data?.data;
     employeeInfo.value = {
       name: emp?.employee_name || props.employeeName || "-",

+ 1 - 1
frontend/src/views/module_payment/quota/components/IssueBatchForm.vue

@@ -230,7 +230,7 @@ function confirmEmployeeSelect() {
       owner_type: "ENTERPRISE_PAY_UID",
       owner_id: employee.employee_id,
       owner_open_id: employee.identity_open_id || undefined,
-      user_name: employee.employee_name || employee.name,
+      user_name: employee.employee_name || "",
     });
   }
   if (targets.length === 0) {

+ 2 - 1
frontend/src/views/module_payment/quota/index.vue

@@ -399,7 +399,8 @@ async function handleSearchEmployee() {
   if (!employeeIdSearch.value) return;
   empLoading.value = true;
   try {
-    const res = await EmployeeAPI.detailEmployee({ employee_id: employeeIdSearch.value } as any);
+    const eid = enterpriseIdFromUrl.value || useEnterpriseStore().getCurrentEnterprise?.enterprise_id || "";
+    const res = await EmployeeAPI.detailEmployee(eid, employeeIdSearch.value);
     const emp = res?.data?.data;
     if (emp) {
       // 查询该员工的额度记录总数