|
|
@@ -1685,50 +1685,139 @@
|
|
|
|
|
|
case 'equipmentInfo':
|
|
|
pageTitle.textContent = '设备信息';
|
|
|
- breadcrumb.textContent = '首页 > 设备管理 > 设信息';
|
|
|
+ breadcrumb.textContent = '首页 > 设备管理 > 设备信息';
|
|
|
mainContent.innerHTML = `
|
|
|
<div style="background: white; padding: 20px; box-shadow: 0 2px 10px rgba(0,0,0,0.1);">
|
|
|
- <div style="margin-bottom: 20px; display: flex; justify-content: space-between;">
|
|
|
- <div>
|
|
|
- <button class="btn btn-success" onclick="showAddEquipmentForm()">新增设备</button>
|
|
|
- <button class="btn btn-primary" onclick="loadContent('equipmentQuery')">查询</button>
|
|
|
- <button class="btn btn-warning" onclick="loadContent('equipmentEdit')">编辑</button>
|
|
|
- <button class="btn btn-danger" onclick="loadContent('equipmentDelete')">删除</button>
|
|
|
+ <div style="margin-bottom: 20px;">
|
|
|
+ <div style="display: flex; flex-wrap: wrap; gap: 15px; margin-bottom: 15px; align-items: center;">
|
|
|
+ <div>
|
|
|
+ <label>设备名称:</label>
|
|
|
+ <input type="text" id="equipmentName" placeholder="设备名称" style="padding: 6px; border: 1px solid #ddd; border-radius: 4px; width: 120px;">
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <label>设备类型:</label>
|
|
|
+ <select id="equipmentType" style="padding: 6px; border: 1px solid #ddd; border-radius: 4px; width: 120px;">
|
|
|
+ <option value="">全部</option>
|
|
|
+ <option value="监护设备">监护设备</option>
|
|
|
+ <option value="治疗设备">治疗设备</option>
|
|
|
+ <option value="检验设备">检验设备</option>
|
|
|
+ </select>
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <label>所属科室:</label>
|
|
|
+ <select id="equipmentDepartment" style="padding: 6px; border: 1px solid #ddd; border-radius: 4px; width: 120px;">
|
|
|
+ <option value="">全部</option>
|
|
|
+ <option value="内科">内科</option>
|
|
|
+ <option value="外科">外科</option>
|
|
|
+ </select>
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <label>所属病区:</label>
|
|
|
+ <select id="equipmentWard" style="padding: 6px; border: 1px solid #ddd; border-radius: 4px; width: 120px;">
|
|
|
+ <option value="">全部</option>
|
|
|
+ <option value="第一病区">第一病区</option>
|
|
|
+ <option value="第二病区">第二病区</option>
|
|
|
+ </select>
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <label>在线状态:</label>
|
|
|
+ <select id="equipmentStatus" style="padding: 6px; border: 1px solid #ddd; border-radius: 4px; width: 120px;">
|
|
|
+ <option value="">全部</option>
|
|
|
+ <option value="在线">在线</option>
|
|
|
+ <option value="离线">离线</option>
|
|
|
+ <option value="故障">故障</option>
|
|
|
+ </select>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- <div>
|
|
|
- <input type="text" placeholder="搜索设备..." style="padding: 8px; border: 1px solid #ddd; border-radius: 4px;">
|
|
|
+ <div style="display: flex; gap: 10px;">
|
|
|
+ <button class="btn btn-primary" onclick="searchEquipment()">查询</button>
|
|
|
+ <button class="btn btn-secondary" onclick="clearEquipmentSearch()">重置</button>
|
|
|
+ <button class="btn btn-success" onclick="showAddEquipmentForm()">新增</button>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <table class="data-table">
|
|
|
+ <table class="data-table" id="equipmentTable">
|
|
|
<thead>
|
|
|
<tr>
|
|
|
- <th>设备编号</th>
|
|
|
- <th>设备名称</th>
|
|
|
<th>设备类型</th>
|
|
|
- <th>所在科室</th>
|
|
|
- <th>状态</th>
|
|
|
- <th>购买日期</th>
|
|
|
+ <th>设备编码</th>
|
|
|
+ <th>设备名称</th>
|
|
|
+ <th>所属科室</th>
|
|
|
+ <th>所属病区</th>
|
|
|
+ <th>IP地址</th>
|
|
|
+ <th>子网掩码</th>
|
|
|
+ <th>默认网关</th>
|
|
|
+ <th>Mac地址</th>
|
|
|
+ <th>在线状态</th>
|
|
|
<th>操作</th>
|
|
|
</tr>
|
|
|
</thead>
|
|
|
- <tbody>
|
|
|
- <tr>
|
|
|
- <td>E001</td>
|
|
|
- <td>心电监护仪</td>
|
|
|
- <td>监护设备</td>
|
|
|
- <td>内科</td>
|
|
|
- <td>正常</td>
|
|
|
- <td>2023-01-15</td>
|
|
|
- <td>
|
|
|
- <button class="btn btn-primary">详情</button>
|
|
|
- <button class="btn btn-warning">编辑</button>
|
|
|
- <button class="btn btn-danger">删除</button>
|
|
|
- </td>
|
|
|
- </tr>
|
|
|
+ <tbody id="equipmentTableBody">
|
|
|
+ <!-- 数据将通过JS动态加载 -->
|
|
|
</tbody>
|
|
|
</table>
|
|
|
</div>
|
|
|
+
|
|
|
+ <!-- 设备详情模态框 -->
|
|
|
+ <div id="equipmentModal" style="display:none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.4); overflow: auto; padding: 50px 0;">
|
|
|
+ <div style="background-color: #fff; margin: 0 auto; padding: 0; border: 1px solid #888; width: 80%; max-width: 600px; border-radius: 5px; max-height: 80%; display: flex; flex-direction: column;">
|
|
|
+ <div style="padding: 20px; border-bottom: 1px solid #eee;">
|
|
|
+ <h2 style="margin-top: 0;" id="modalTitle">设备详情</h2>
|
|
|
+ </div>
|
|
|
+ <div style="overflow-y: auto; flex: 1; padding: 15px;">
|
|
|
+ <input type="hidden" id="modalTerminalNumber">
|
|
|
+ <div class="form-group">
|
|
|
+ <label>设备类型:</label>
|
|
|
+ <input type="text" id="modalTerminalType" style="width: 100%; padding: 6px;">
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label>设备编码:</label>
|
|
|
+ <input type="text" id="modalTerminalNumberDisplay" readonly style="width: 100%; padding: 6px;">
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label>设备名称:</label>
|
|
|
+ <input type="text" id="modalTerminalDesc" style="width: 100%; padding: 6px;">
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label>所属科室:</label>
|
|
|
+ <input type="text" id="modalDeptCode" style="width: 100%; padding: 6px;">
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label>所属病区:</label>
|
|
|
+ <input type="text" id="modalWardCode" style="width: 100%; padding: 6px;">
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label>IP地址:</label>
|
|
|
+ <input type="text" id="modalIpAddress" style="width: 100%; padding: 6px;">
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label>子网掩码:</label>
|
|
|
+ <input type="text" id="modalSubnetMask" style="width: 100%; padding: 6px;">
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label>默认网关:</label>
|
|
|
+ <input type="text" id="modalGatewayAddress" style="width: 100%; padding: 6px;">
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label>Mac地址:</label>
|
|
|
+ <input type="text" id="modalMacAddress" style="width: 100%; padding: 6px;">
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label>在线状态:</label>
|
|
|
+ <select id="modalIsOnline" style="width: 100%; padding: 6px;">
|
|
|
+ <option value="true">在线</option>
|
|
|
+ <option value="false">离线</option>
|
|
|
+ </select>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div style="padding: 20px; border-top: 1px solid #eee; text-align: right;">
|
|
|
+ <button class="btn btn-success" onclick="saveEquipment()" id="saveEquipmentBtn" style="display: none;">保存</button>
|
|
|
+ <button class="btn btn-secondary" onclick="closeEquipmentModal()">关闭</button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
`;
|
|
|
+ // 加载设备数据
|
|
|
+ loadEquipmentData();
|
|
|
break;
|
|
|
|
|
|
case 'equipmentQuery':
|
|
|
@@ -2265,6 +2354,12 @@
|
|
|
document.getElementById('enabled').value = '';
|
|
|
loadDepartmentData();
|
|
|
}
|
|
|
+
|
|
|
+ // 清空设备查询条件
|
|
|
+ function clearEquipmentSearch() {
|
|
|
+ // 在这里添加清空设备查询条件的逻辑
|
|
|
+ alert('重置查询条件');
|
|
|
+ }
|
|
|
// 查看科室详情
|
|
|
function viewDepartment(code) {
|
|
|
// 获取科室数据
|
|
|
@@ -2638,6 +2733,373 @@
|
|
|
});
|
|
|
|
|
|
// 点击弹窗外部关闭弹窗
|
|
|
+ window.onclick = function(event) {
|
|
|
+ const wardModal = document.getElementById('wardModal');
|
|
|
+ const wardCodeSettingModal = document.getElementById('wardCodeSettingModal');
|
|
|
+ const departmentModal = document.getElementById('departmentModal');
|
|
|
+ const roomModal = document.getElementById('roomModal');
|
|
|
+ const roomCodeSettingModal = document.getElementById('roomCodeSettingModal');
|
|
|
+ const bedModal = document.getElementById('bedModal');
|
|
|
+ const patientModal = document.getElementById('patientModal');
|
|
|
+
|
|
|
+ if (event.target === wardModal) {
|
|
|
+ wardModal.style.display = 'none';
|
|
|
+ } else if (event.target === wardCodeSettingModal) {
|
|
|
+ wardCodeSettingModal.style.display = 'none';
|
|
|
+ } else if (event.target === departmentModal) {
|
|
|
+ departmentModal.style.display = 'none';
|
|
|
+ } else if (event.target === roomModal) {
|
|
|
+ roomModal.style.display = 'none';
|
|
|
+ } else if (event.target === roomCodeSettingModal) {
|
|
|
+ roomCodeSettingModal.style.display = 'none';
|
|
|
+ } else if (event.target === bedModal) {
|
|
|
+ bedModal.style.display = 'none';
|
|
|
+ } else if (event.target === patientModal) {
|
|
|
+ patientModal.style.display = 'none';
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ // 加载设备数据
|
|
|
+ function loadEquipmentData() {
|
|
|
+ fetch('/shixian/api/terminals')
|
|
|
+ .then(response => response.json())
|
|
|
+ .then(data => {
|
|
|
+ const tbody = document.getElementById('equipmentTableBody');
|
|
|
+ tbody.innerHTML = '';
|
|
|
+
|
|
|
+ data.forEach(terminal => {
|
|
|
+ const row = document.createElement('tr');
|
|
|
+ const statusText = terminal.isOnline ? '在线' : '离线';
|
|
|
+
|
|
|
+ row.innerHTML = `
|
|
|
+ <td>${terminal.terminalType || ''}</td>
|
|
|
+ <td>${terminal.terminalNumber || ''}</td>
|
|
|
+ <td>${terminal.terminalDesc || ''}</td>
|
|
|
+ <td>${terminal.deptCode || ''}</td>
|
|
|
+ <td>${terminal.wardCode || ''}</td>
|
|
|
+ <td>${terminal.ipAddress || ''}</td>
|
|
|
+ <td>${terminal.subnetMask || ''}</td>
|
|
|
+ <td>${terminal.gatewayAddress || ''}</td>
|
|
|
+ <td>${terminal.macAddress || ''}</td>
|
|
|
+ <td>${statusText}</td>
|
|
|
+ <td>
|
|
|
+ <button class="btn btn-primary" onclick="viewEquipment('${terminal.terminalNumber}')">详情</button>
|
|
|
+ <button class="btn btn-warning" onclick="editEquipment('${terminal.terminalNumber}')">编辑</button>
|
|
|
+ <button class="btn btn-danger" onclick="deleteEquipment('${terminal.terminalNumber}')">删除</button>
|
|
|
+ </td>
|
|
|
+ `;
|
|
|
+ tbody.appendChild(row);
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ console.error('加载设备数据失败:', error);
|
|
|
+ alert('加载设备数据失败');
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ // 查询设备
|
|
|
+ function searchEquipment() {
|
|
|
+ const terminalDesc = document.getElementById('equipmentName').value;
|
|
|
+ const terminalType = document.getElementById('equipmentType').value;
|
|
|
+ const deptCode = document.getElementById('equipmentDepartment').value;
|
|
|
+ const wardCode = document.getElementById('equipmentWard').value;
|
|
|
+ const isOnline = document.getElementById('equipmentStatus').value;
|
|
|
+
|
|
|
+ let url = '/shixian/api/terminals?';
|
|
|
+ const params = [];
|
|
|
+
|
|
|
+ if (terminalDesc) params.push(`terminalDesc=${encodeURIComponent(terminalDesc)}`);
|
|
|
+ if (terminalType) params.push(`terminalType=${encodeURIComponent(terminalType)}`);
|
|
|
+ if (deptCode) params.push(`deptCode=${encodeURIComponent(deptCode)}`);
|
|
|
+ if (wardCode) params.push(`wardCode=${encodeURIComponent(wardCode)}`);
|
|
|
+ if (isOnline !== '') {
|
|
|
+ // 将中文状态转换为布尔值
|
|
|
+ const isOnlineValue = isOnline === '在线' ? 'true' : 'false';
|
|
|
+ params.push(`isOnline=${isOnlineValue}`);
|
|
|
+ }
|
|
|
+
|
|
|
+ url += params.join('&');
|
|
|
+
|
|
|
+ fetch(url)
|
|
|
+ .then(response => response.json())
|
|
|
+ .then(data => {
|
|
|
+ const tbody = document.getElementById('equipmentTableBody');
|
|
|
+ tbody.innerHTML = '';
|
|
|
+
|
|
|
+ // 确保处理后端返回的不同格式
|
|
|
+ const terminals = Array.isArray(data) ? data : (data.content || data);
|
|
|
+
|
|
|
+ terminals.forEach(terminal => {
|
|
|
+ const row = document.createElement('tr');
|
|
|
+ const statusText = terminal.isOnline ? '在线' : '离线';
|
|
|
+
|
|
|
+ row.innerHTML = `
|
|
|
+ <td>${terminal.terminalType || ''}</td>
|
|
|
+ <td>${terminal.terminalNumber || ''}</td>
|
|
|
+ <td>${terminal.terminalDesc || ''}</td>
|
|
|
+ <td>${terminal.deptCode || ''}</td>
|
|
|
+ <td>${terminal.wardCode || ''}</td>
|
|
|
+ <td>${terminal.ipAddress || ''}</td>
|
|
|
+ <td>${terminal.subnetMask || ''}</td>
|
|
|
+ <td>${terminal.gatewayAddress || ''}</td>
|
|
|
+ <td>${terminal.macAddress || ''}</td>
|
|
|
+ <td>${statusText}</td>
|
|
|
+ <td>
|
|
|
+ <button class="btn btn-primary" onclick="viewEquipment('${terminal.terminalNumber}')">详情</button>
|
|
|
+ <button class="btn btn-warning" onclick="editEquipment('${terminal.terminalNumber}')">编辑</button>
|
|
|
+ <button class="btn btn-danger" onclick="deleteEquipment('${terminal.terminalNumber}')">删除</button>
|
|
|
+ </td>
|
|
|
+ `;
|
|
|
+ tbody.appendChild(row);
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ console.error('查询设备数据失败:', error);
|
|
|
+ alert('查询失败,请稍后重试');
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ // 清空设备查询条件
|
|
|
+ function clearEquipmentSearch() {
|
|
|
+ document.getElementById('equipmentName').value = '';
|
|
|
+ document.getElementById('equipmentType').value = '';
|
|
|
+ document.getElementById('equipmentDepartment').value = '';
|
|
|
+ document.getElementById('equipmentWard').value = '';
|
|
|
+ document.getElementById('equipmentStatus').value = '';
|
|
|
+ loadEquipmentData();
|
|
|
+ }
|
|
|
+
|
|
|
+ // 查看设备详情
|
|
|
+ function viewEquipment(terminalNumber) {
|
|
|
+ fetch(`/shixian/api/terminals/${terminalNumber}`)
|
|
|
+ .then(response => response.json())
|
|
|
+ .then(data => {
|
|
|
+ if (data.success) {
|
|
|
+ const terminal = data.data;
|
|
|
+
|
|
|
+ // 填充弹窗内容
|
|
|
+ document.getElementById('modalTitle').textContent = '设备详情';
|
|
|
+ document.getElementById('modalTerminalNumber').value = terminal.terminalNumber || '';
|
|
|
+ document.getElementById('modalTerminalNumberDisplay').value = terminal.terminalNumber || '';
|
|
|
+ document.getElementById('modalTerminalType').value = terminal.terminalType || '';
|
|
|
+ document.getElementById('modalTerminalDesc').value = terminal.terminalDesc || '';
|
|
|
+ document.getElementById('modalDeptCode').value = terminal.deptCode || '';
|
|
|
+ document.getElementById('modalWardCode').value = terminal.wardCode || '';
|
|
|
+ document.getElementById('modalIpAddress').value = terminal.ipAddress || '';
|
|
|
+ document.getElementById('modalSubnetMask').value = terminal.subnetMask || '';
|
|
|
+ document.getElementById('modalGatewayAddress').value = terminal.gatewayAddress || '';
|
|
|
+ document.getElementById('modalMacAddress').value = terminal.macAddress || '';
|
|
|
+ document.getElementById('modalIsOnline').value = terminal.isOnline ? 'true' : 'false';
|
|
|
+
|
|
|
+ // 设置为只读模式
|
|
|
+ document.getElementById('modalTerminalType').readOnly = true;
|
|
|
+ document.getElementById('modalTerminalDesc').readOnly = true;
|
|
|
+ document.getElementById('modalDeptCode').readOnly = true;
|
|
|
+ document.getElementById('modalWardCode').readOnly = true;
|
|
|
+ document.getElementById('modalIpAddress').readOnly = true;
|
|
|
+ document.getElementById('modalSubnetMask').readOnly = true;
|
|
|
+ document.getElementById('modalGatewayAddress').readOnly = true;
|
|
|
+ document.getElementById('modalMacAddress').readOnly = true;
|
|
|
+ document.getElementById('modalIsOnline').disabled = true;
|
|
|
+ document.getElementById('saveEquipmentBtn').style.display = 'none';
|
|
|
+
|
|
|
+ // 显示弹窗
|
|
|
+ document.getElementById('equipmentModal').style.display = 'block';
|
|
|
+ } else {
|
|
|
+ alert('获取设备信息失败: ' + data.message);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ console.error('获取设备信息失败:', error);
|
|
|
+ alert('获取设备信息失败,请稍后重试');
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ // 编辑设备
|
|
|
+ function editEquipment(terminalNumber) {
|
|
|
+ fetch(`/shixian/api/terminals/${terminalNumber}`)
|
|
|
+ .then(response => response.json())
|
|
|
+ .then(data => {
|
|
|
+ if (data.success) {
|
|
|
+ const terminal = data.data;
|
|
|
+
|
|
|
+ // 填充弹窗内容
|
|
|
+ document.getElementById('modalTitle').textContent = '编辑设备';
|
|
|
+ document.getElementById('modalTerminalNumber').value = terminal.terminalNumber || '';
|
|
|
+ document.getElementById('modalTerminalNumberDisplay').value = terminal.terminalNumber || '';
|
|
|
+ document.getElementById('modalTerminalType').value = terminal.terminalType || '';
|
|
|
+ document.getElementById('modalTerminalDesc').value = terminal.terminalDesc || '';
|
|
|
+ document.getElementById('modalDeptCode').value = terminal.deptCode || '';
|
|
|
+ document.getElementById('modalWardCode').value = terminal.wardCode || '';
|
|
|
+ document.getElementById('modalIpAddress').value = terminal.ipAddress || '';
|
|
|
+ document.getElementById('modalSubnetMask').value = terminal.subnetMask || '';
|
|
|
+ document.getElementById('modalGatewayAddress').value = terminal.gatewayAddress || '';
|
|
|
+ document.getElementById('modalMacAddress').value = terminal.macAddress || '';
|
|
|
+ document.getElementById('modalIsOnline').value = terminal.isOnline ? 'true' : 'false';
|
|
|
+
|
|
|
+ // 设置为可编辑模式
|
|
|
+ document.getElementById('modalTerminalType').readOnly = false;
|
|
|
+ document.getElementById('modalTerminalDesc').readOnly = false;
|
|
|
+ document.getElementById('modalDeptCode').readOnly = false;
|
|
|
+ document.getElementById('modalWardCode').readOnly = false;
|
|
|
+ document.getElementById('modalIpAddress').readOnly = false;
|
|
|
+ document.getElementById('modalSubnetMask').readOnly = false;
|
|
|
+ document.getElementById('modalGatewayAddress').readOnly = false;
|
|
|
+ document.getElementById('modalMacAddress').readOnly = false;
|
|
|
+ document.getElementById('modalIsOnline').disabled = false;
|
|
|
+ document.getElementById('saveEquipmentBtn').style.display = 'inline-block';
|
|
|
+
|
|
|
+ // 显示弹窗
|
|
|
+ document.getElementById('equipmentModal').style.display = 'block';
|
|
|
+ } else {
|
|
|
+ alert('获取设备信息失败: ' + data.message);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ console.error('获取设备信息失败:', error);
|
|
|
+ alert('获取设备信息失败,请稍后重试');
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ // 新增设备
|
|
|
+ function showAddEquipmentForm() {
|
|
|
+ // 清空弹窗内容
|
|
|
+ document.getElementById('modalTitle').textContent = '新增设备';
|
|
|
+ document.getElementById('modalTerminalNumber').value = '';
|
|
|
+ document.getElementById('modalTerminalNumberDisplay').value = '';
|
|
|
+ document.getElementById('modalTerminalType').value = '';
|
|
|
+ document.getElementById('modalTerminalDesc').value = '';
|
|
|
+ document.getElementById('modalDeptCode').value = '';
|
|
|
+ document.getElementById('modalWardCode').value = '';
|
|
|
+ document.getElementById('modalIpAddress').value = '';
|
|
|
+ document.getElementById('modalSubnetMask').value = '';
|
|
|
+ document.getElementById('modalGatewayAddress').value = '';
|
|
|
+ document.getElementById('modalMacAddress').value = '';
|
|
|
+ document.getElementById('modalIsOnline').value = 'true';
|
|
|
+
|
|
|
+ // 设置为可编辑模式
|
|
|
+ document.getElementById('modalTerminalType').readOnly = false;
|
|
|
+ document.getElementById('modalTerminalDesc').readOnly = false;
|
|
|
+ document.getElementById('modalDeptCode').readOnly = false;
|
|
|
+ document.getElementById('modalWardCode').readOnly = false;
|
|
|
+ document.getElementById('modalIpAddress').readOnly = false;
|
|
|
+ document.getElementById('modalSubnetMask').readOnly = false;
|
|
|
+ document.getElementById('modalGatewayAddress').readOnly = false;
|
|
|
+ document.getElementById('modalMacAddress').readOnly = false;
|
|
|
+ document.getElementById('modalIsOnline').disabled = false;
|
|
|
+ document.getElementById('saveEquipmentBtn').style.display = 'inline-block';
|
|
|
+
|
|
|
+ // 显示弹窗
|
|
|
+ document.getElementById('equipmentModal').style.display = 'block';
|
|
|
+ }
|
|
|
+
|
|
|
+ // 保存设备(新增或更新)
|
|
|
+ function saveEquipment() {
|
|
|
+ const terminalNumber = document.getElementById('modalTerminalNumber').value;
|
|
|
+ const terminalData = {
|
|
|
+ terminalType: document.getElementById('modalTerminalType').value,
|
|
|
+ terminalNumber: document.getElementById('modalTerminalNumberDisplay').value,
|
|
|
+ terminalDesc: document.getElementById('modalTerminalDesc').value,
|
|
|
+ deptCode: document.getElementById('modalDeptCode').value,
|
|
|
+ wardCode: document.getElementById('modalWardCode').value,
|
|
|
+ ipAddress: document.getElementById('modalIpAddress').value,
|
|
|
+ subnetMask: document.getElementById('modalSubnetMask').value,
|
|
|
+ gatewayAddress: document.getElementById('modalGatewayAddress').value,
|
|
|
+ macAddress: document.getElementById('modalMacAddress').value,
|
|
|
+ isOnline: document.getElementById('modalIsOnline').value === 'true'
|
|
|
+ };
|
|
|
+
|
|
|
+ let url, method;
|
|
|
+ if (terminalNumber) {
|
|
|
+ // 更新设备
|
|
|
+ url = `/shixian/api/terminals/${terminalNumber}`;
|
|
|
+ method = 'PUT';
|
|
|
+ } else {
|
|
|
+ // 新增设备
|
|
|
+ url = '/shixian/api/terminals';
|
|
|
+ method = 'POST';
|
|
|
+ }
|
|
|
+
|
|
|
+ fetch(url, {
|
|
|
+ method: method,
|
|
|
+ headers: {
|
|
|
+ 'Content-Type': 'application/json'
|
|
|
+ },
|
|
|
+ body: JSON.stringify(terminalData)
|
|
|
+ })
|
|
|
+ .then(response => response.json())
|
|
|
+ .then(data => {
|
|
|
+ if (data.success) {
|
|
|
+ alert(terminalNumber ? '设备更新成功' : '设备新增成功');
|
|
|
+ closeEquipmentModal();
|
|
|
+ loadEquipmentData(); // 重新加载数据
|
|
|
+ } else {
|
|
|
+ alert(terminalNumber ? '设备更新失败: ' + data.message : '设备新增失败: ' + data.message);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ console.error('保存设备失败:', error);
|
|
|
+ alert('保存设备失败,请稍后重试');
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ // 删除设备
|
|
|
+ function deleteEquipment(terminalNumber) {
|
|
|
+ if (confirm('确定要删除该设备吗?')) {
|
|
|
+ fetch(`/shixian/api/terminals/${terminalNumber}`, {
|
|
|
+ method: 'DELETE'
|
|
|
+ })
|
|
|
+ .then(response => response.json())
|
|
|
+ .then(data => {
|
|
|
+ if (data.success) {
|
|
|
+ alert('删除成功');
|
|
|
+ loadEquipmentData(); // 重新加载数据
|
|
|
+ } else {
|
|
|
+ alert('删除失败: ' + data.message);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ console.error('删除设备失败:', error);
|
|
|
+ alert('删除失败,请稍后重试');
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 关闭设备详情弹窗
|
|
|
+ function closeEquipmentModal() {
|
|
|
+ document.getElementById('equipmentModal').style.display = 'none';
|
|
|
+ }
|
|
|
+
|
|
|
+ // 点击弹窗外部关闭弹窗
|
|
|
+ window.onclick = function(event) {
|
|
|
+ const wardModal = document.getElementById('wardModal');
|
|
|
+ const wardCodeSettingModal = document.getElementById('wardCodeSettingModal');
|
|
|
+ const departmentModal = document.getElementById('departmentModal');
|
|
|
+ const roomModal = document.getElementById('roomModal');
|
|
|
+ const roomCodeSettingModal = document.getElementById('roomCodeSettingModal');
|
|
|
+ const bedModal = document.getElementById('bedModal');
|
|
|
+ const patientModal = document.getElementById('patientModal');
|
|
|
+ const equipmentModal = document.getElementById('equipmentModal');
|
|
|
+
|
|
|
+ if (event.target === wardModal) {
|
|
|
+ wardModal.style.display = 'none';
|
|
|
+ } else if (event.target === wardCodeSettingModal) {
|
|
|
+ wardCodeSettingModal.style.display = 'none';
|
|
|
+ } else if (event.target === departmentModal) {
|
|
|
+ departmentModal.style.display = 'none';
|
|
|
+ } else if (event.target === roomModal) {
|
|
|
+ roomModal.style.display = 'none';
|
|
|
+ } else if (event.target === roomCodeSettingModal) {
|
|
|
+ roomCodeSettingModal.style.display = 'none';
|
|
|
+ } else if (event.target === bedModal) {
|
|
|
+ bedModal.style.display = 'none';
|
|
|
+ } else if (event.target === patientModal) {
|
|
|
+ patientModal.style.display = 'none';
|
|
|
+ } else if (event.target === equipmentModal) {
|
|
|
+ equipmentModal.style.display = 'none';
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
window.onclick = function(event) {
|
|
|
const departmentModal = document.getElementById('departmentModal');
|
|
|
const wardModal = document.getElementById('wardModal');
|
|
|
@@ -4266,6 +4728,43 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // 设备查询功能
|
|
|
+ /*
|
|
|
+ function searchEquipment() {
|
|
|
+ const equipmentName = document.getElementById('equipmentName').value;
|
|
|
+ const equipmentType = document.getElementById('equipmentType').value;
|
|
|
+ const equipmentDepartment = document.getElementById('equipmentDepartment').value;
|
|
|
+ const equipmentWard = document.getElementById('equipmentWard').value;
|
|
|
+ const equipmentStatus = document.getElementById('equipmentStatus').value;
|
|
|
+
|
|
|
+ // 这里应该发送请求到后端查询设备数据
|
|
|
+ // 示例代码:
|
|
|
+ // fetch(`/api/equipment?name=${equipmentName}&type=${equipmentType}&department=${equipmentDepartment}&ward=${equipmentWard}&status=${equipmentStatus}`)
|
|
|
+ // .then(response => response.json())
|
|
|
+ // .then(data => {
|
|
|
+ // // 更新表格数据
|
|
|
+ // })
|
|
|
+
|
|
|
+ alert(`查询条件:
|
|
|
+设备名称: ${equipmentName}
|
|
|
+设备类型: ${equipmentType}
|
|
|
+所属科室: ${equipmentDepartment}
|
|
|
+所属病区: ${equipmentWard}
|
|
|
+在线状态: ${equipmentStatus}`);
|
|
|
+ }
|
|
|
+ */
|
|
|
+
|
|
|
+ // 清空设备查询条件
|
|
|
+ /*
|
|
|
+ function clearEquipmentSearch() {
|
|
|
+ document.getElementById('equipmentName').value = '';
|
|
|
+ document.getElementById('equipmentType').value = '';
|
|
|
+ document.getElementById('equipmentDepartment').value = '';
|
|
|
+ document.getElementById('equipmentWard').value = '';
|
|
|
+ document.getElementById('equipmentStatus').value = '';
|
|
|
+ }
|
|
|
+ */
|
|
|
+
|
|
|
</script>
|
|
|
</body>
|
|
|
</html>
|