AnalysisSystemForRadionucli.../src/views/spectrumAnalysis/components/ResultDisplay.vue

235 lines
4.9 KiB
Vue
Raw Normal View History

2023-06-28 19:25:11 +08:00
<template>
<div class="result-display-content">
<a-table :data-source="source1" rowKey="id" :columns="columns" :pagination="false">
<template slot="flag" slot-scope="text, record">
<a-checkbox :checked="text == 1 ? true : false" @change="(e) => handleCheckboxChange(e, record)"></a-checkbox>
2023-06-28 19:25:11 +08:00
</template>
<template slot="concentration" slot-scope="text, record">
<div class="concentration color-box" :class="record.className">
2023-06-28 19:25:11 +08:00
{{ text }}
</div>
</template>
<template slot="uncertainty" slot-scope="text">
<div class="uncertainty color-box">+/-{{ text }}</div>
2023-06-28 19:25:11 +08:00
</template>
<template slot="mdc" slot-scope="text">
<div class="mdc color-box">
{{ text }}
</div>
</template>
<template slot="operator">
<div class="search"></div>
</template>
</a-table>
<a-table :data-source="source2" rowKey="id" :columns="columns" :pagination="false">
<template slot="flag" slot-scope="text, record">
<a-checkbox :checked="text == 1 ? true : false" @change="(e) => handleCheckboxChange(e, record)"></a-checkbox>
2023-06-28 19:25:11 +08:00
</template>
<template slot="concentration" slot-scope="text, record">
<div class="concentration color-box" :class="record.className">
2023-06-28 19:25:11 +08:00
{{ text }}
</div>
</template>
<template slot="uncertainty" slot-scope="text">
<div class="uncertainty color-box">+/-{{ text }}</div>
2023-06-28 19:25:11 +08:00
</template>
<template slot="mdc" slot-scope="text">
<div class="mdc color-box">
{{ text }}
</div>
</template>
<template slot="operator">
<div class="search"></div>
</template>
</a-table>
</div>
</template>
<script>
const columns = [
{
title: 'Flag',
align: 'center',
dataIndex: 'nidFlag',
2023-06-28 19:25:11 +08:00
scopedSlots: {
customRender: 'flag',
2023-06-28 19:25:11 +08:00
},
width: 40,
2023-06-28 19:25:11 +08:00
},
{
title: 'Isotope',
dataIndex: 'nuclideName',
2023-06-28 19:25:11 +08:00
ellipsis: true,
width: 76,
2023-06-28 19:25:11 +08:00
},
{
title: 'Concentration',
dataIndex: 'conc',
2023-06-28 19:25:11 +08:00
scopedSlots: {
customRender: 'concentration',
2023-06-28 19:25:11 +08:00
},
width: 128,
2023-06-28 19:25:11 +08:00
},
{
title: 'Uncertainty',
dataIndex: 'concErr',
2023-06-28 19:25:11 +08:00
scopedSlots: {
customRender: 'uncertainty',
2023-06-28 19:25:11 +08:00
},
width: 118,
2023-06-28 19:25:11 +08:00
},
{
title: 'MDC[mBq/m3]',
dataIndex: 'mdc',
scopedSlots: {
customRender: 'mdc',
2023-06-28 19:25:11 +08:00
},
width: 133,
2023-06-28 19:25:11 +08:00
},
{
title: '',
scopedSlots: {
customRender: 'operator',
2023-06-28 19:25:11 +08:00
},
width: 34,
},
2023-06-28 19:25:11 +08:00
]
export default {
props: {
data: {
type: Array,
default: () => [],
},
2023-06-28 19:25:11 +08:00
},
data() {
this.columns = columns
return {
source1: [],
source2: [],
2023-06-28 19:25:11 +08:00
}
},
methods: {
handleCheckboxChange(e, obj) {
this.$emit('sendFlag', e.target.checked, obj)
},
},
2023-06-28 19:25:11 +08:00
watch: {
data: {
handler(val) {
if (val && Array.isArray(val)) {
val.forEach((item) => {
if (item.conc < 0) {
item.className = 'error'
} else if (item.conc > 0 && item.conc < item.mdc) {
item.className = 'warning'
} else {
item.className = 'success'
}
})
this.source1 = val.slice(0, 2)
this.source2 = val.slice(2, 4)
}
2023-06-28 19:25:11 +08:00
},
immediate: true,
},
},
2023-06-28 19:25:11 +08:00
}
</script>
<style lang="less" scoped>
.result-display-content {
display: flex;
.ant-table-wrapper {
flex: 1;
&:first-child {
margin-right: 20px;
}
::v-deep {
2023-07-11 09:10:34 +08:00
.ant-table {
border: none;
}
2023-06-28 19:25:11 +08:00
.ant-table-thead > tr th {
color: #00e9fe;
font-family: MicrosoftYaHei;
font-size: 16px;
background-color: transparent !important;
&:first-child {
padding-left: 0 !important;
}
&:last-child {
padding-right: 0 !important;
}
}
.ant-table-tbody {
tr {
background-color: transparent;
td {
&:first-child {
padding-left: 0 !important;
}
&:last-child {
padding-right: 0 !important;
}
}
&:hover {
td {
background-color: transparent !important;
}
}
}
}
}
}
.color-box {
height: 36px;
line-height: 36px;
text-align: center;
color: #fff;
}
.concentration {
background-color: #ad8815;
&.error {
background-color: red;
}
&.warning {
background-color: #ffcc30;
}
&.success {
background-color: #0f0;
2023-06-28 19:25:11 +08:00
}
}
.uncertainty {
background-color: rgba(57, 184, 222, 0.4);
}
.mdc {
background-color: rgba(57, 184, 222, 0.4);
}
.search {
width: 24px;
height: 24px;
cursor: pointer;
background: url(~@/assets/images/spectrum/search.png) center no-repeat;
&:hover {
background: url(~@/assets/images/spectrum/search-hover.png) center no-repeat;
}
}
}
</style>