From 073605b6d62363dd7d48f5ca047a1d401418574a Mon Sep 17 00:00:00 2001
From: zzw <228544128@qq.com>
Date: 星期日, 04 十月 2026 17:34:06 +0800
Subject: [PATCH] docs: record 2026-10-04 integration commit

---
 emergency-repair-web/src/views/system/OrganizationManage.vue |  127 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 127 insertions(+), 0 deletions(-)

diff --git a/emergency-repair-web/src/views/system/OrganizationManage.vue b/emergency-repair-web/src/views/system/OrganizationManage.vue
new file mode 100644
index 0000000..519eb3c
--- /dev/null
+++ b/emergency-repair-web/src/views/system/OrganizationManage.vue
@@ -0,0 +1,127 @@
+<template>
+  <div class="page">
+    <div class="page-title">
+      <div>
+        <h2>缁勭粐鏈烘瀯</h2>
+        <p>閮ㄩ棬鏍戣〃鏉ユ簮浜� SYS_DEPT锛汥EPT_TYPE 涓� cj 鐨勯儴闂ㄥ嵆鎵夸慨鍗曚綅</p>
+      </div>
+      <el-button icon="el-icon-refresh" @click="load">鍒锋柊</el-button>
+    </div>
+
+    <div class="toolbar">
+      <el-input v-model="keyword" placeholder="閮ㄩ棬鍚嶇О / 閮ㄩ棬缂栫爜 / 璐熻矗浜�" clearable style="width:280px"></el-input>
+      <el-select v-model="deptType" clearable placeholder="閮ㄩ棬绫诲瀷" style="width:160px">
+        <el-option v-for="item in typeOptions" :key="item.value" :label="item.label" :value="item.value"></el-option>
+      </el-select>
+      <el-button type="primary" icon="el-icon-search" @click="load">鏌ヨ</el-button>
+      <div class="spacer"></div>
+      <span class="summary">鍏� {{ rows.length }} 涓儴闂紝鍏朵腑鎵夸慨鍗曚綅 {{ contractorCount }} 涓�</span>
+    </div>
+
+    <div class="table-panel">
+      <el-table
+        v-loading="loading"
+        :data="filteredTree"
+        row-key="id"
+        border
+        stripe
+        default-expand-all
+        height="calc(100vh - 245px)"
+        :tree-props="{ children: 'children' }"
+      >
+        <el-table-column prop="name" label="閮ㄩ棬鍚嶇О" min-width="260"></el-table-column>
+        <el-table-column prop="deptCode" label="閮ㄩ棬缂栫爜" width="150"></el-table-column>
+        <el-table-column label="閮ㄩ棬绫诲瀷" width="130" align="center">
+          <template slot-scope="{ row }">
+            <el-tag v-if="row.deptType === 'cj'" size="mini" type="success">鎵夸慨鍗曚綅</el-tag>
+            <el-tag v-else size="mini" type="info">{{ row.deptType || '-' }}</el-tag>
+          </template>
+        </el-table-column>
+        <el-table-column prop="leader" label="璐熻矗浜�" width="120"></el-table-column>
+        <el-table-column prop="phone" label="鑱旂郴鐢佃瘽" width="150"></el-table-column>
+        <el-table-column prop="orderNum" label="鎺掑簭" width="80" align="center"></el-table-column>
+        <el-table-column label="鐘舵��" width="90" align="center">
+          <template slot-scope="{ row }">
+            <el-tag size="mini" :type="row.status === '1' ? 'info' : 'success'">{{ row.status === '1' ? '鍋滅敤' : '姝e父' }}</el-tag>
+          </template>
+        </el-table-column>
+      </el-table>
+    </div>
+  </div>
+</template>
+<script>
+import api from '@/api'
+export default {
+  name: 'OrganizationManage',
+  data() {
+    return {
+      loading: false,
+      rows: [],
+      keyword: '',
+      deptType: ''
+    }
+  },
+  computed: {
+    typeOptions() {
+      const values = Array.from(new Set(this.rows.map(item => item.deptType).filter(Boolean))).sort()
+      return values.map(value => ({ value, label: value === 'cj' ? '鎵夸慨鍗曚綅' : value }))
+    },
+    contractorCount() {
+      return this.rows.filter(item => item.deptType === 'cj').length
+    },
+    tree() {
+      return this.buildTree(this.rows)
+    },
+    filteredTree() {
+      const keyword = this.keyword.trim().toLowerCase()
+      const type = this.deptType
+      const hit = node => {
+        const textOk = !keyword || [node.name, node.deptCode, node.leader]
+          .some(value => String(value || '').toLowerCase().includes(keyword))
+        const typeOk = !type || node.deptType === type
+        return textOk && typeOk
+      }
+      const walk = nodes => nodes.reduce((result, node) => {
+        const children = walk(node.children || [])
+        if (hit(node) || children.length) {
+          result.push({ ...node, children })
+        }
+        return result
+      }, [])
+      return walk(this.tree)
+    }
+  },
+  created() { this.load() },
+  methods: {
+    load() {
+      this.loading = true
+      api.get('/system/depts').then(res => {
+        this.rows = res.data || []
+      }).finally(() => { this.loading = false })
+    },
+    buildTree(rows) {
+      const nodes = rows.map(row => ({ ...row, children: [] }))
+      const map = new Map(nodes.map(node => [String(node.id), node]))
+      const roots = []
+      nodes.forEach(node => {
+        const parentId = node.parentId == null ? null : String(node.parentId)
+        if (parentId && parentId !== String(node.id) && map.has(parentId)) {
+          map.get(parentId).children.push(node)
+        } else {
+          roots.push(node)
+        }
+      })
+      const sortNodes = list => {
+        list.sort((left, right) => (Number(left.orderNum) || 0) - (Number(right.orderNum) || 0)
+          || String(left.name || '').localeCompare(String(right.name || ''), 'zh'))
+        list.forEach(item => sortNodes(item.children || []))
+      }
+      sortNodes(roots)
+      return roots
+    }
+  }
+}
+</script>
+<style scoped>
+.summary { color: #6d7f91; font-size: 13px; }
+</style>

--
Gitblit v1.9.1