From 47063a700dfbf67a59f24ad4a50a431fd335ec4c Mon Sep 17 00:00:00 2001
From: 张含笑 <zhx18749296735@163.com>
Date: Mon, 26 Jan 2026 17:36:34 +0800
Subject: [PATCH] feat:禁用/启用

---
 applications/task-work-order/src/views/orderView/organizationalMessage/agenciesManagement/index.vue |   26 +++++++++++++++++++++++++-
 1 files changed, 25 insertions(+), 1 deletions(-)

diff --git a/applications/task-work-order/src/views/orderView/organizationalMessage/agenciesManagement/index.vue b/applications/task-work-order/src/views/orderView/organizationalMessage/agenciesManagement/index.vue
index 902b300..e863da8 100644
--- a/applications/task-work-order/src/views/orderView/organizationalMessage/agenciesManagement/index.vue
+++ b/applications/task-work-order/src/views/orderView/organizationalMessage/agenciesManagement/index.vue
@@ -63,11 +63,12 @@
              {{ getDictLabel(row.status, dictObj.institutionStatus) }}
             </template>
           </el-table-column>
-          <el-table-column label="操作" class-name="operation-btns" width="240">
+          <el-table-column label="操作" class-name="operation-btns" width="310">
             <template v-slot="{ row }">
               <el-link type="primary" @click="openForm('view', row)">查看</el-link>
               <el-link type="primary"  @click="openForm('edit', row)">编辑</el-link>
               <el-link type="primary" @click="handleDelete(row)">删除</el-link>
+              <el-link type="primary" @click="toggleStatus(row)">{{row.status === 1 ? '禁用' : '启用'}}</el-link>
             </template>
           </el-table-column>
         </el-table>
@@ -134,6 +135,7 @@
   agenciesImportApi,
   agenciesExportApi,
   regionLazyTreeApi,
+  agenciesSubmitApi
 } from './agenciesApi'
 import { getDictionaryByCode } from '@/api/system/dictbiz'
 import { getDictLabel } from '@ztzf/utils'
@@ -234,6 +236,28 @@
   getList()
 }
 
+// 切换机构状态
+async function toggleStatus(row) {
+  // 计算目标状态:当前为1则切换为0,当前为0则切换为1
+  const targetStatus = row.status === 1 ? 0 : 1
+  const actionText = targetStatus === 0 ? '禁用' : '启用'
+  
+  await ElMessageBox.confirm(`确认${actionText}该机构吗?`, '提示', {
+    type: 'warning',
+    customClass: 'gd-confirm-custom',
+    confirmButtonClass: 'gd-confirm-button',
+    cancelButtonClass: 'gd-confirm-cancel-button',
+  })
+  
+  try {
+    await agenciesSubmitApi({ ...row, status: targetStatus })
+    ElMessage.success(`${actionText}成功`)
+    getList()
+  } catch (error) {
+    ElMessage.error(`${actionText}失败`)
+  }
+}
+
 // 导入机构
 function handleImport() {
   isShowImportView.value = true

--
Gitblit v1.9.3