houyaf 3 éve
szülő
commit
c0657de4cc
1 módosított fájl, 11 hozzáadás és 3 törlés
  1. 11 3
      src/views/system/group/index.vue

+ 11 - 3
src/views/system/group/index.vue

@@ -135,8 +135,7 @@ const onPasswordReset = (data?: any) => {
 }
 
 // 修改状态
-const onChangeStatus = async (row: any) => {
-  const status = row.status === 1 ? 0 : 1
+const onChangeStatus = async (status: number, row: any) => {
   await updateUserStatus(row.accountId, status)
   ElMessage.success({
     message: '修改成功',
@@ -296,7 +295,16 @@ const onCommand = (command: string, row: any) => {
             <el-table-column align="center" label="状态" width="80">
               <template #default="scope">
                 <div v-if="scope.row.isFixed !== 1">
-                  <el-switch v-model="scope.row.status" :loading="scope.row.loading" inline-prompt active-text="启用" inactive-text="禁用" @before-change="() => onChangeStatus(scope.row)" />
+                  <el-switch
+                    v-model="scope.row.status"
+                    :active-value="1"
+                    :inactive-value="2"
+                    :loading="scope.row.loading"
+                    inline-prompt
+                    active-text="启用"
+                    inactive-text="禁用"
+                    @change="(status) => onChangeStatus(status, scope.row)"
+                  />
                 </div>
               </template>
             </el-table-column>