|
|
@ -7,7 +7,14 @@ |
|
|
|
:key="tubeRack.uuid" |
|
|
|
class="tube-rack-container" |
|
|
|
> |
|
|
|
<TestTubeRack :tubeRack="tubeRack" :index="index" /> |
|
|
|
<TestTubeRack |
|
|
|
:tubeRack="tubeRack" |
|
|
|
:index="index" |
|
|
|
:projects="projectsAvailable" |
|
|
|
:bloodTypes="bloodTypes" |
|
|
|
@delete:rack="deleteHandle" |
|
|
|
@clickTubeItem="updateTubeSettingsHandler" |
|
|
|
/> |
|
|
|
</div> |
|
|
|
<!-- 添加试管架按钮 --> |
|
|
|
<div class="add-tube" @click="addTubeRack"> |
|
|
@ -17,22 +24,35 @@ |
|
|
|
<div class="text">添加试管架</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="project-setting-panel"> |
|
|
|
<section class="project-select"> |
|
|
|
<div class="setting-panel"> |
|
|
|
<section class="project-area"> |
|
|
|
<h2 class="title">项目选择</h2> |
|
|
|
<ul> |
|
|
|
<li> |
|
|
|
<div v-for="proj in projectsAvailable" :key="proj.projName"> |
|
|
|
{{ proj.projName }} |
|
|
|
{{ proj.num }} |
|
|
|
<div class="project-list"> |
|
|
|
<div v-for="proj in projectsAvailable" :key="proj.projName"> |
|
|
|
<div |
|
|
|
class="project-item" |
|
|
|
:class="{ active: isElemActive(proj) }" |
|
|
|
:style="elemStyle(proj)" |
|
|
|
@click="clickProjectItem(proj)" |
|
|
|
> |
|
|
|
<span class="proj-name">{{ proj.projName }}</span> |
|
|
|
<span class="proj-num">{{ proj.num }}</span> |
|
|
|
</div> |
|
|
|
</li> |
|
|
|
</ul> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</section> |
|
|
|
<section class="blood-type"> |
|
|
|
<section class="blood-type-area"> |
|
|
|
<h2 class="title">血液类型</h2> |
|
|
|
<div v-for="type in bloodTypes" :key="type.key"> |
|
|
|
{{ type.name }} |
|
|
|
<div class="blood-list"> |
|
|
|
<div v-for="type in bloodTypes" :key="type.key"> |
|
|
|
<div |
|
|
|
class="blood-item" |
|
|
|
:class="{ active: selectedBloodTypeKey === type.key }" |
|
|
|
@click="clickBloodTypeItem(type)" |
|
|
|
> |
|
|
|
{{ type.name }} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</section> |
|
|
|
</div> |
|
|
@ -61,21 +81,68 @@ import { |
|
|
|
import { ElMessage } from 'element-plus' |
|
|
|
|
|
|
|
const router = useRouter() |
|
|
|
|
|
|
|
const testTubeStore = useTestTubeStore() |
|
|
|
const settingTestTubeStore = useSettingTestTubeStore() |
|
|
|
const consumables = useConsumablesStore() |
|
|
|
|
|
|
|
const tubeRacks = ref([]) //<DataItem[]> |
|
|
|
const bloodTypes = ref([]) |
|
|
|
const loading = ref(false) // 控制加载状态 |
|
|
|
|
|
|
|
const selectedUUID = ref('') //<string> |
|
|
|
|
|
|
|
const selectedProjIds = ref([]) // number[] |
|
|
|
const selectedBloodTypeKey = ref('WHOLE_BLOOD') |
|
|
|
|
|
|
|
// 初始化获取试管架数据 |
|
|
|
onMounted(() => { |
|
|
|
getTubeData() |
|
|
|
getBloodTypeData() |
|
|
|
}) |
|
|
|
|
|
|
|
const onClickTubeItem = (rackIdx, tubeIdx) => { |
|
|
|
console.log(rackIdx, tubeIdx) |
|
|
|
} |
|
|
|
const isElemActive = (proj) => { |
|
|
|
return selectedProjIds.value.includes(proj.projId) |
|
|
|
} |
|
|
|
|
|
|
|
const elemStyle = (proj) => { |
|
|
|
const active = isElemActive(proj) |
|
|
|
if (active) { |
|
|
|
return { |
|
|
|
border: 'solid 1px #FFF', |
|
|
|
backgroundColor: proj.color, |
|
|
|
color: '#FFF', |
|
|
|
} |
|
|
|
} else { |
|
|
|
return { |
|
|
|
border: `solid 1px ${proj.color}`, |
|
|
|
backgroundColor: '#FFF', |
|
|
|
color: proj.color, |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
const clickProjectItem = (proj) => { |
|
|
|
if (selectedProjIds.value.includes(proj.projId)) { |
|
|
|
selectedProjIds.value = selectedProjIds.value.filter( |
|
|
|
(pId) => pId !== proj.projId, |
|
|
|
) |
|
|
|
} else { |
|
|
|
selectedProjIds.value = [...selectedProjIds.value, proj.projId].sort() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
const clickBloodTypeItem = (type) => { |
|
|
|
if (selectedBloodTypeKey.value === type.key) { |
|
|
|
selectedBloodTypeKey.value = '' |
|
|
|
} else { |
|
|
|
selectedBloodTypeKey.value = type.key |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
const projectsAvailable = computed(() => { |
|
|
|
const group = R.groupBy((p) => p.projName, consumables.plates) |
|
|
|
const pNames = R.keys(group) |
|
|
@ -99,7 +166,7 @@ const getBloodTypeData = async () => { |
|
|
|
|
|
|
|
if (res.success) { |
|
|
|
bloodTypes.value = res.data |
|
|
|
console.log(res.data) |
|
|
|
// console.log(res.data) |
|
|
|
} else { |
|
|
|
ElMessage({ |
|
|
|
message: '加载血液类型失败', |
|
|
@ -144,14 +211,16 @@ const handleChangeUser = async (uuid) => { |
|
|
|
} |
|
|
|
|
|
|
|
//删除试管架 |
|
|
|
const deleteHandle = async (uuid) => { |
|
|
|
const res = await deleteTube(uuid) |
|
|
|
const deleteHandle = async (idx) => { |
|
|
|
const rack = tubeRacks.value[idx] |
|
|
|
const res = await deleteTube(rack.uuid) |
|
|
|
if (res.success) { |
|
|
|
tubeRacks.value = tubeRacks.value.filter((v, i) => i !== idx) |
|
|
|
ElMessage({ |
|
|
|
message: '删除成功', |
|
|
|
type: 'success', |
|
|
|
}) |
|
|
|
getTubeData() |
|
|
|
// getTubeData() |
|
|
|
} else { |
|
|
|
ElMessage({ |
|
|
|
message: '删除失败', |
|
|
@ -270,17 +339,36 @@ const handleUpdateSelectedSamples = ({ |
|
|
|
} |
|
|
|
|
|
|
|
// 添加更新试管设置的方法 |
|
|
|
const updateTubeSettingsHandler = async () => { |
|
|
|
const { uuid, setting } = settingTestTubeStore.currentConfig |
|
|
|
|
|
|
|
if (uuid && setting.tubeIndex >= 0) { |
|
|
|
const updateTubeSettingsHandler = async (rackIdx, tubeIdx) => { |
|
|
|
if (!selectedBloodTypeKey.value) { |
|
|
|
ElMessage.error('请选择血液类型') |
|
|
|
return |
|
|
|
} |
|
|
|
const rack = tubeRacks.value[rackIdx] |
|
|
|
if (tubeIdx < rack.tubeSettings.length) { |
|
|
|
const setting = rack.tubeSettings[tubeIdx] |
|
|
|
const updSetting = { |
|
|
|
...setting, |
|
|
|
projId: selectedProjIds.value, |
|
|
|
bloodType: selectedBloodTypeKey.value, |
|
|
|
} |
|
|
|
try { |
|
|
|
const response = await updateTubeConfig({ uuid, setting }) |
|
|
|
|
|
|
|
const response = await updateTubeConfig({ |
|
|
|
uuid: rack.uuid, |
|
|
|
setting: updSetting, |
|
|
|
}) |
|
|
|
if (response.success) { |
|
|
|
ElMessage.success('设置更新成功') |
|
|
|
console.log(tubeRacks.value) |
|
|
|
settingTestTubeStore.clearConfig() |
|
|
|
tubeRacks.value = tubeRacks.value.map((rack, idx) => { |
|
|
|
if (idx === rackIdx) { |
|
|
|
rack.tubeSettings = rack.tubeSettings.map((tube, index) => { |
|
|
|
if (index === tubeIdx) { |
|
|
|
return updSetting |
|
|
|
} |
|
|
|
return tube |
|
|
|
}) |
|
|
|
} |
|
|
|
return rack |
|
|
|
}) |
|
|
|
} else { |
|
|
|
ElMessage.error('设置更新失败') |
|
|
|
} |
|
|
@ -294,7 +382,12 @@ const updateTubeSettingsHandler = async () => { |
|
|
|
|
|
|
|
<style scoped lang="less"> |
|
|
|
#configuration-container { |
|
|
|
@active-color: rgb(82, 140, 254); |
|
|
|
@setting-panel-height: 150px; |
|
|
|
|
|
|
|
box-sizing: border-box; |
|
|
|
position: relative; |
|
|
|
height: calc(100vh - 180px); |
|
|
|
|
|
|
|
.el-message { |
|
|
|
width: 200px; |
|
|
@ -303,12 +396,11 @@ const updateTubeSettingsHandler = async () => { |
|
|
|
|
|
|
|
/* 主容器定高和滚动条样式 */ |
|
|
|
.tube-rack-list { |
|
|
|
max-height: 1200px; |
|
|
|
height: calc(100% - @setting-panel-height); |
|
|
|
/* 根据需要设置主容器的最大高度 */ |
|
|
|
overflow-y: auto; |
|
|
|
overflow-x: hidden; |
|
|
|
width: 100%; |
|
|
|
box-sizing: border-box; |
|
|
|
|
|
|
|
/* 自定义滚动条样式 */ |
|
|
|
&::-webkit-scrollbar { |
|
|
@ -329,6 +421,60 @@ const updateTubeSettingsHandler = async () => { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
.setting-panel { |
|
|
|
@line-color: rgb(200, 200, 200); |
|
|
|
|
|
|
|
position: absolute; |
|
|
|
bottom: 0; |
|
|
|
width: 100%; |
|
|
|
height: @setting-panel-height; |
|
|
|
padding: 0 40px; |
|
|
|
border-top: solid 1px @line-color; |
|
|
|
border-bottom: solid 1px @line-color; |
|
|
|
.title { |
|
|
|
font-size: 24px; |
|
|
|
font-weight: bold; |
|
|
|
margin-right: 40px; |
|
|
|
} |
|
|
|
.project-area { |
|
|
|
display: flex; |
|
|
|
align-items: center; |
|
|
|
.project-list { |
|
|
|
display: flex; |
|
|
|
.project-item { |
|
|
|
border-radius: 8px; |
|
|
|
padding: 6px 10px; |
|
|
|
margin-right: 8px; |
|
|
|
display: flex; |
|
|
|
flex-direction: column; |
|
|
|
align-items: center; |
|
|
|
min-width: 50px; |
|
|
|
.proj-name { |
|
|
|
font-weight: 600; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
.blood-type-area { |
|
|
|
display: flex; |
|
|
|
align-items: center; |
|
|
|
.blood-list { |
|
|
|
display: flex; |
|
|
|
.blood-item { |
|
|
|
border: solid 1px @active-color; |
|
|
|
border-radius: 4px; |
|
|
|
padding: 10px; |
|
|
|
margin-right: 8px; |
|
|
|
color: @active-color; |
|
|
|
&.active { |
|
|
|
color: #fff; |
|
|
|
background-color: @active-color; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
.add-tube { |
|
|
|
width: 100%; |
|
|
|
height: 100px; |
|
|
@ -338,9 +484,13 @@ const updateTubeSettingsHandler = async () => { |
|
|
|
justify-content: center; |
|
|
|
|
|
|
|
.icon { |
|
|
|
width: 60px; |
|
|
|
height: 100px; |
|
|
|
margin-right: 40px; |
|
|
|
img { |
|
|
|
width: 60px; |
|
|
|
} |
|
|
|
margin-right: 10px; |
|
|
|
display: flex; |
|
|
|
align-items: center; |
|
|
|
justify-content: center; |
|
|
|
} |
|
|
|
|
|
|
|
.text { |
|
|
|