检验项目设置-检验类型功能完成
This commit is contained in:
@@ -35,6 +35,11 @@
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
@@ -43,6 +43,11 @@
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -26,21 +26,17 @@
|
||||
新增
|
||||
</button>
|
||||
</div>
|
||||
<div class="table-container">
|
||||
<!-- 调试按钮 -->
|
||||
<div style="margin-bottom: 10px;">
|
||||
<el-button @click="debugDepartments">调试科室数据</el-button>
|
||||
</div>
|
||||
<table class="data-table">
|
||||
<div class="table-container" @click="handleTableClick">
|
||||
<table class="data-table data-table-type">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>行</th>
|
||||
<th>*大类编码</th>
|
||||
<th>*大类项目名称</th>
|
||||
<th>*执行科室</th>
|
||||
<th>序号</th>
|
||||
<th>备注</th>
|
||||
<th>操作</th>
|
||||
<th style="width: 50px;">行</th>
|
||||
<th style="width: 130px;">*大类编码</th>
|
||||
<th style="width: 200px;">*大类项目名称</th>
|
||||
<th style="width: 160px;">*执行科室</th>
|
||||
<th style="width: 120px;">序号</th>
|
||||
<th style="width: 160px;">备注</th>
|
||||
<th style="width: 200px; text-align: left; padding-left: 60px;">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -864,18 +860,6 @@ function handlePackageDepartmentChange(selectedNode) {
|
||||
}
|
||||
}
|
||||
|
||||
// 调试科室数据
|
||||
function debugDepartments() {
|
||||
console.log('当前科室数据:', departments.value);
|
||||
console.log('第一个检验项目科室:', inspectionItems.value[0]?.department);
|
||||
// 尝试模拟选择一个科室
|
||||
if (departments.value && departments.value.length > 0) {
|
||||
const firstDept = departments.value[0];
|
||||
console.log('尝试选择科室:', firstDept.name);
|
||||
inspectionItems.value[0].department = firstDept.name;
|
||||
}
|
||||
}
|
||||
|
||||
// 费用套餐数据
|
||||
const feePackages = ref([
|
||||
{ value: '肝功能12项', label: '肝功能12项', amount: 120.00 },
|
||||
@@ -1294,6 +1278,30 @@ const handleSelectPackage = (item) => {
|
||||
};
|
||||
|
||||
// 检验类型相关方法
|
||||
// 处理表格点击事件,用于自动删除空的编辑行
|
||||
const handleTableClick = (event) => {
|
||||
// 如果点击的是表格内部的元素,不处理
|
||||
if (event.target.closest('input, select, button, .action-btn')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 如果当前有正在编辑的行,检查是否为空
|
||||
if (editingRowId.value) {
|
||||
const editingRow = tableData.value.find(row => row.id === editingRowId.value);
|
||||
if (editingRow && (!editingRow.code || editingRow.code.trim() === '') &&
|
||||
(!editingRow.name || editingRow.name.trim() === '') &&
|
||||
(!editingRow.department || editingRow.department.trim() === '')) {
|
||||
// 删除空的编辑行
|
||||
const index = tableData.value.findIndex(row => row.id === editingRowId.value);
|
||||
if (index !== -1) {
|
||||
tableData.value.splice(index, 1);
|
||||
editingRowId.value = null;
|
||||
ElMessage.info('已自动删除空行');
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const addNewRow = () => {
|
||||
if (editingRowId.value) {
|
||||
ElMessage.warning('请先保存或取消当前正在编辑的行');
|
||||
@@ -1323,19 +1331,37 @@ const handleConfirm = (row) => {
|
||||
console.log('原始row数据:', row);
|
||||
console.log('提交前的submitData:', submitData);
|
||||
|
||||
// 验证必填字段
|
||||
// 验证必填字段,如果为空则删除该行
|
||||
if (!submitData.code || submitData.code.trim() === '') {
|
||||
alert('检验类型编码不能为空');
|
||||
// 删除空的编辑行
|
||||
const index = tableData.value.findIndex(r => r.id === row.id);
|
||||
if (index !== -1) {
|
||||
tableData.value.splice(index, 1);
|
||||
editingRowId.value = null;
|
||||
ElMessage.info('已删除空行');
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!submitData.name || submitData.name.trim() === '') {
|
||||
alert('检验类型名称不能为空');
|
||||
// 删除空的编辑行
|
||||
const index = tableData.value.findIndex(r => r.id === row.id);
|
||||
if (index !== -1) {
|
||||
tableData.value.splice(index, 1);
|
||||
editingRowId.value = null;
|
||||
ElMessage.info('已删除空行');
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!submitData.department || submitData.department.trim() === '') {
|
||||
alert('执行科室不能为空');
|
||||
// 删除空的编辑行
|
||||
const index = tableData.value.findIndex(r => r.id === row.id);
|
||||
if (index !== -1) {
|
||||
tableData.value.splice(index, 1);
|
||||
editingRowId.value = null;
|
||||
ElMessage.info('已删除空行');
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1886,6 +1912,11 @@ watch(packageItems, (newVal) => {
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.data-table-type .action-cell {
|
||||
justify-content: flex-start;
|
||||
padding-left: 24px;
|
||||
}
|
||||
|
||||
.action-btn {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
|
||||
Reference in New Issue
Block a user