ソースを参照

人员配置 修改接口路径

qinxuyang 2 ヶ月 前
コミット
3c31976ae7

+ 6 - 2
src/api/modules/storeDecoration.ts

@@ -180,7 +180,7 @@ export const saveTag = (params: any) => {
 };
 //新建或修改人员配置
 export const createOrUpdatePersonnel = (params: any) => {
-  return httpApi.post(`/alienStorePlatform/storeStaffConfig/saveOrUpdate`, params);
+  return httpApi.post(`/alienStore/storeStaffConfig/addOrUpdateStaffConfig`, params);
 };
 //获取门店人员列表
 export const getPersonnelList = (params: any) => {
@@ -188,7 +188,7 @@ export const getPersonnelList = (params: any) => {
 };
 //删除人员
 export const deletePersonnel = (params: any) => {
-  return httpApi.get(`/alienStorePlatform/storeStaffConfig/delete`, params);
+  return httpApi.get(`/alienStore/storeStaffConfig/deleteStaffConfig`, params);
 };
 //获取人员详情
 export const getPersonnelDetail = (params: any) => {
@@ -282,6 +282,10 @@ export const getStaffConfigList = (params: any) => {
 export const setTopStatus = (params: { id: string | number; topStatus: 0 | 1 }) => {
   return httpApi.get(`/alienStore/storeStaffConfig/setTopStatus`, params);
 };
+// 设置在线状态
+export const setOnlineStatus = (params: { id: string | number; onlineStatus: 0 | 1 }) => {
+  return httpApi.get(`/alienStore/storeStaffConfig/setOnlineStatus`, params);
+};
 
 //获取人员配置详情(查看详情用)
 export const getStaffConfigDetail = (params: any) => {

+ 43 - 19
src/views/storeDecoration/personnelConfig/index.vue

@@ -35,7 +35,7 @@
         <template #operation="scope">
           <el-button type="primary" link @click="editPersonnel(scope.row, 0)"> 编辑 </el-button>
           <el-button
-            v-if="scope.row.onlineStatus === 1 || scope.row.onlineStatus === '1'"
+            v-if="scope.row.onlineStatus === 0 || scope.row.onlineStatus === '0'"
             type="primary"
             link
             @click="handleOffline(scope.row)"
@@ -43,7 +43,7 @@
             下线
           </el-button>
           <el-button
-            v-else-if="scope.row.onlineStatus === 0 || scope.row.onlineStatus === '0'"
+            v-else-if="scope.row.onlineStatus === 1 || scope.row.onlineStatus === '1'"
             type="primary"
             link
             @click="handleOnline(scope.row)"
@@ -139,8 +139,8 @@
           <div class="detail-item">
             <div class="detail-label">在线状态:</div>
             <div class="detail-value">
-              <span v-if="personnelDetail.onlineStatus === 1 || personnelDetail.onlineStatus === '1'">在线</span>
-              <span v-else-if="personnelDetail.onlineStatus === 0 || personnelDetail.onlineStatus === '0'">离线</span>
+              <span v-if="personnelDetail.onlineStatus === 0 || personnelDetail.onlineStatus === '0'">上线</span>
+              <span v-else-if="personnelDetail.onlineStatus === 1 || personnelDetail.onlineStatus === '1'">下线</span>
               <span v-else>—</span>
             </div>
           </div>
@@ -287,7 +287,8 @@ import {
   updateTitle,
   getTitleDetail,
   deleteTitle,
-  setTopStatus
+  setTopStatus,
+  setOnlineStatus
 } from "@/api/modules/storeDecoration";
 
 // 人员接口
@@ -340,10 +341,10 @@ const titleRules = reactive<FormRules>({
 // 标题弹窗标题
 const titleDialogTitle = computed(() => (titleEditId.value !== null ? "修改标题" : "创建标题"));
 
-// 在线状态枚举
+// 在线状态枚举 - 0: 上线, 1: 下线
 const onlineStatusEnum = [
-  { label: "在线", value: 1 },
-  { label: "离线", value: 0 }
+  { label: "上线", value: 0 },
+  { label: "下线", value: 1 }
 ];
 
 // 审核状态枚举
@@ -406,8 +407,8 @@ const columns = reactive<ColumnProps<any>[]>([
       order: 3
     },
     render: (scope: any) => {
-      if (scope.row.onlineStatus === 1 || scope.row.onlineStatus === "1") return "在线";
-      if (scope.row.onlineStatus === 0 || scope.row.onlineStatus === "0") return "离线";
+      if (scope.row.onlineStatus === 0 || scope.row.onlineStatus === "0") return "上线";
+      if (scope.row.onlineStatus === 1 || scope.row.onlineStatus === "1") return "下线";
       return "—";
     }
   },
@@ -1257,25 +1258,48 @@ const handleTitleSubmit = async () => {
 };
 
 // 上线
+// 上线 - onlineStatus 设置为 0
 const handleOnline = async (row: Personnel) => {
+  if (!row.id) {
+    ElMessage.warning("人员ID不存在");
+    return;
+  }
   try {
-    // TODO: 调用上线接口
-    row.onlineStatus = 1;
-    ElMessage.success("上线成功");
-    proTable.value?.getTableList();
+    const res: any = await setOnlineStatus({
+      id: row.id,
+      onlineStatus: 0
+    });
+    if (res && (res.code === 200 || res.code === "200")) {
+      ElMessage.success("上线成功");
+      proTable.value?.getTableList();
+    } else {
+      ElMessage.error(res?.msg || "上线失败");
+    }
   } catch (error: any) {
+    console.error("上线失败:", error);
     ElMessage.error(error?.msg || "上线失败,请重试");
   }
 };
 
-// 下线
+// 下线 - onlineStatus 设置为 1
 const handleOffline = async (row: Personnel) => {
+  if (!row.id) {
+    ElMessage.warning("人员ID不存在");
+    return;
+  }
   try {
-    // TODO: 调用下线接口
-    row.onlineStatus = 0;
-    ElMessage.success("下线成功");
-    proTable.value?.getTableList();
+    const res: any = await setOnlineStatus({
+      id: row.id,
+      onlineStatus: 1
+    });
+    if (res && (res.code === 200 || res.code === "200")) {
+      ElMessage.success("下线成功");
+      proTable.value?.getTableList();
+    } else {
+      ElMessage.error(res?.msg || "下线失败");
+    }
   } catch (error: any) {
+    console.error("下线失败:", error);
     ElMessage.error(error?.msg || "下线失败,请重试");
   }
 };