liubp
2025-12-01 4fbdc442a847b3cd2254af2c4b5f6dab651e5b8b
添加编辑界面取值,添加组织编码展示
1个文件已修改
1个文件已添加
107 ■■■■■ 已修改文件
kill-port-3000.ps1 78 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
public/components/frame/orgTree/orgTree.js 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
kill-port-3000.ps1
New file
@@ -0,0 +1,78 @@
# Kill process using port 3000
$port = 3000
Write-Host "========================================" -ForegroundColor Cyan
Write-Host "Port ${port} Cleanup Script" -ForegroundColor Cyan
Write-Host "========================================`n" -ForegroundColor Cyan
# Method 1: Check using Get-NetTCPConnection
Write-Host "Method 1: Checking with Get-NetTCPConnection..." -ForegroundColor Yellow
$connections = Get-NetTCPConnection -LocalPort $port -State Listen -ErrorAction SilentlyContinue
if ($connections) {
    Write-Host "Found processes listening on port ${port}:" -ForegroundColor Green
    $connections | ForEach-Object {
        $pid = $_.OwningProcess
        $process = Get-Process -Id $pid -ErrorAction SilentlyContinue
        if ($process) {
            Write-Host "  - PID: $pid, Name: $($process.ProcessName), Path: $($process.Path)" -ForegroundColor White
            Write-Host "    Killing process..." -ForegroundColor Yellow
            try {
                Stop-Process -Id $pid -Force
                Write-Host "    ✓ Successfully killed PID $pid" -ForegroundColor Green
            } catch {
                Write-Host "    ✗ Failed to kill PID $pid : $_" -ForegroundColor Red
            }
        }
    }
} else {
    Write-Host "No processes found listening on port ${port}" -ForegroundColor Yellow
}
# Method 2: Check using netstat (more reliable on some systems)
Write-Host "`nMethod 2: Checking with netstat..." -ForegroundColor Yellow
$portPattern = ":${port}" + ".*LISTENING"
$netstatLines = netstat -ano | Select-String $portPattern
if ($netstatLines) {
    Write-Host "Found processes via netstat:" -ForegroundColor Green
    $netstatLines | ForEach-Object {
        if ($_.Line -match '\s+(\d+)\s*$') {
            $pid = $matches[1]
            $process = Get-Process -Id $pid -ErrorAction SilentlyContinue
            if ($process) {
                Write-Host "  - PID: $pid, Name: $($process.ProcessName)" -ForegroundColor White
                Write-Host "    Killing process..." -ForegroundColor Yellow
                try {
                    Stop-Process -Id $pid -Force
                    Write-Host "    ✓ Successfully killed PID $pid" -ForegroundColor Green
                } catch {
                    Write-Host "    ✗ Failed to kill PID $pid : $_" -ForegroundColor Red
                }
            }
        }
    }
} else {
    Write-Host "No processes found via netstat" -ForegroundColor Yellow
}
# Final check
Write-Host "`nFinal check..." -ForegroundColor Yellow
Start-Sleep -Seconds 1
$finalCheck = Get-NetTCPConnection -LocalPort $port -State Listen -ErrorAction SilentlyContinue
if ($finalCheck) {
    Write-Host "Warning: Port ${port} is still in use!" -ForegroundColor Red
    Write-Host "You may need to:" -ForegroundColor Yellow
    Write-Host "  1. Run this script as Administrator" -ForegroundColor White
    Write-Host "  2. Manually kill the process using Task Manager" -ForegroundColor White
    Write-Host "  3. Change the port in bin/www or set PORT environment variable" -ForegroundColor White
} else {
    Write-Host "Port ${port} is now free!" -ForegroundColor Green
}
Write-Host "`n========================================" -ForegroundColor Cyan
Write-Host "You can now run: npm run dev" -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan
public/components/frame/orgTree/orgTree.js
@@ -32,13 +32,38 @@
                vc.http.apiGet('/org.listOrgTree',
                    param,
                    function (json) {
                        let _orgs = JSON.parse(json).data;
                        let _orgs = JSON.parse(json).data || [];
                        if (Array.isArray(_orgs)) {
                            _orgs = _orgs.map(_org => {
                                return $that._appendOrgCode(_org);
                            });
                        } else {
                            _orgs = [$that._appendOrgCode(_orgs)];
                        }
                        $that.orgTreeInfo.orgs = _orgs;
                        $that._initJsTreeFloorUnit();
                    },
                    function () {
                        console.log('请求失败处理');
                    });
            },
            _appendOrgCode: function (_org) {
                if (!_org || !_org.text) {
                    return _org;
                }
                if (_org.text) {
                    let _code = (!_org.orgCode || _org.orgCode === 'CODE') ? '- -' : _org.orgCode;
                    let _suffix = ' (' + _code + ')';
                    if (_org.text.indexOf(_suffix) === -1) {
                        _org.text = _org.text + _suffix;
                    }
                }
                if (Array.isArray(_org.children) && _org.children.length > 0) {
                    _org.children = _org.children.map(item => {
                        return $that._appendOrgCode(item);
                    });
                }
                return _org;
            },
            _initJsTreeFloorUnit: function () {
                let _data = $that.orgTreeInfo.orgs;
@@ -66,6 +91,8 @@
                    }
                    $that.orgTreeInfo.curOrg = data.node.original;
                    $that.orgTreeInfo.curOrg.orgId = $that.orgTreeInfo.curOrg.id;
                    $that.orgTreeInfo.curOrg.orgName = $that.orgTreeInfo.curOrg.text;
                    $that.orgTreeInfo.curOrg.description = $that.orgTreeInfo.curOrg.description || '';
                    vc.emit($props.callBackListener, 'switchOrg', {
                        orgId: data.node.original.id,
                        orgName: $that.orgTreeInfo.curOrg.text