refactor: 重构二级操作栏

This commit is contained in:
Xu Zhimeng 2024-03-07 15:16:48 +08:00
parent 34369b0544
commit b9d8c7fb92
6 changed files with 143 additions and 87 deletions

View File

@ -7,17 +7,17 @@
Detailed-Information Detailed-Information
<beta-gamma-detailed-infomation slot="content" :data="spectrumData" /> <beta-gamma-detailed-infomation slot="content" :data="spectrumData" />
</pop-over-with-icon> </pop-over-with-icon>
<pop-over-with-icon placement="bottomLeft">
QC Flags
<beta-gamma-qc-flags slot="content" :data="qcFlags" @click="handleQcFlagClick" />
</pop-over-with-icon>
<custom-select <custom-select
v-model="spectraType" v-model="spectraType"
:options="SampleType" :options="SampleType"
@change="changeChartByType" @change="changeChartByType"
style="width: 246px" style="width: 154px"
class="sample-select" class="sample-select"
></custom-select> ></custom-select>
<pop-over-with-icon placement="right" v-model="qcFlagsVisible">
QC Flags
<beta-gamma-qc-flags slot="content" :data="qcFlags" @click="handleQcFlagClick" />
</pop-over-with-icon>
</div> </div>
<!-- 二级交互栏结束 --> <!-- 二级交互栏结束 -->
@ -228,14 +228,24 @@ export default {
statisticsType: StatisticsType['Collection Time'], statisticsType: StatisticsType['Collection Time'],
currSample: {}, currSample: {},
copyXeData: null, copyXeData: null,
qcFlagsVisible: false,
} }
}, },
created() { created() {
this.$bus.$on('ReAnalyses', this.handleReAnalyse) this.$bus.$on('ReAnalyses', this.handleReAnalyse)
}, },
mounted() {
this.qcFlagsTimer = setTimeout(() => {
this.qcFlagsVisible = true
}, 100)
},
destroyed() { destroyed() {
this.cancelLastRequest() this.cancelLastRequest()
this.$bus.$off('ReAnalyses', this.handleReAnalyse) this.$bus.$off('ReAnalyses', this.handleReAnalyse)
if (this.qcFlagsTimer) {
clearTimeout(this.qcFlagsTimer)
}
}, },
methods: { methods: {
// //
@ -441,7 +451,7 @@ export default {
: this.resultDisplay.length > 0 : this.resultDisplay.length > 0
? this.resultDisplay ? this.resultDisplay
: XeData : XeData
this.sortResultDisplay() this.sortResultDisplay()
this.$emit('sendInfo', this.resultDisplay, this.spectrumData.stationCode, savedAnalysisResult) this.$emit('sendInfo', this.resultDisplay, this.spectrumData.stationCode, savedAnalysisResult)
@ -702,6 +712,31 @@ export default {
} }
} }
//
.spectrum-analysis-sub-operators {
flex-shrink: 0;
margin-bottom: 19px;
display: flex;
gap: 11px;
flex-wrap: nowrap;
overflow: auto;
height: 46px;
align-items: center;
.pop-over-with-icon {
height: 32px;
&:nth-child(1) {
width: 224px;
}
&:nth-child(3) {
width: 125px;
}
}
}
//
.sample-select { .sample-select {
::v-deep { ::v-deep {
.ant-select-selection { .ant-select-selection {
@ -712,7 +747,7 @@ export default {
} }
&-main { &-main {
height: calc(100% - 51px); height: calc(100% - 65px);
display: flex; display: flex;
gap: 30px; gap: 30px;
overflow: auto hidden; overflow: auto hidden;

View File

@ -57,20 +57,23 @@ export default {
<style lang="less" scoped> <style lang="less" scoped>
.qc-flags { .qc-flags {
display: flex; display: flex;
max-width: calc(100vw - 685px);
overflow: auto;
&-item { &-item {
background-color: #46738e; background-color: #46738e;
display: flex; display: flex;
align-items: center; align-items: center;
width: 150px;
height: 30px; height: 30px;
cursor: pointer; cursor: pointer;
padding: 0 10px;
flex-shrink: 0;
&:not(:last-child) { &:not(:last-child) {
margin-right: 2px; margin-right: 2px;
} }
span { span {
margin-left: 20px;
margin-right: 5px; margin-right: 5px;
width: 14px; width: 14px;
height: 14px; height: 14px;

View File

@ -1,14 +1,21 @@
<template> <template>
<a-popover :placement="placement" overlayClassName="popover-with-icon" v-model="innerVisible"> <a-popover
v-bind="$attrs"
:placement="placement"
overlayClassName="popover-with-icon"
:visible="innerVisible"
:getPopupContainer="(ele) => ele"
@click="handleClick"
>
<div class="pop-over-with-icon"> <div class="pop-over-with-icon">
<span class="text"> <span class="text">
<slot /> <slot />
</span> </span>
<img src="@/assets/images/global/select-down.png" alt="" /> <img src="@/assets/images/global/select-down.png" alt="" />
</div> </div>
<template slot="content"> <div slot="content" @click.stop>
<slot name="content" /> <slot name="content" />
</template> </div>
</a-popover> </a-popover>
</template> </template>
<script> <script>
@ -16,27 +23,32 @@ export default {
props: { props: {
placement: { placement: {
type: String, type: String,
default: 'bottom' default: 'bottom',
}, },
value: { value: {
type: Boolean type: Boolean,
} },
}, },
data() { data() {
return { return {
innerVisible: false innerVisible: false,
} }
}, },
methods: {
handleClick() {
this.innerVisible = !this.innerVisible
},
},
watch: { watch: {
value: { value: {
handler(val) { handler(val) {
this.innerVisible = val this.innerVisible = val
}, },
immediate: true immediate: true,
}, },
innerVisible(val) { innerVisible(val) {
this.$emit('input', val) this.$emit('input', val)
} },
} },
} }
</script> </script>

View File

@ -15,31 +15,34 @@ export default {
props: { props: {
data: { data: {
type: Array, type: Array,
default: () => [] default: () => [],
} },
}, },
created() { created() {
this.items = items this.items = items
} },
} }
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.qc-flags { .qc-flags {
display: flex; display: flex;
max-width: calc(100vw - 1120px);
overflow: auto;
&-item { &-item {
background-color: #46738e; background-color: #46738e;
display: flex; display: flex;
align-items: center; align-items: center;
width: 150px;
height: 30px; height: 30px;
padding: 0 10px;
flex-shrink: 0;
&:not(:last-child) { &:not(:last-child) {
margin-right: 2px; margin-right: 2px;
} }
span { span {
margin-left: 20px;
margin-right: 5px; margin-right: 5px;
width: 14px; width: 14px;
height: 14px; height: 14px;
@ -58,7 +61,7 @@ export default {
} }
&.BLUE { &.BLUE {
background: radial-gradient(circle, #00E57D 0, #00E57D 100%); background: radial-gradient(circle, #00e57d 0, #00e57d 100%);
} }
&.YELLOW { &.YELLOW {

View File

@ -7,10 +7,6 @@
Detailed-Information Detailed-Information
<detailed-infomation slot="content" :data="detailedInfomation" /> <detailed-infomation slot="content" :data="detailedInfomation" />
</pop-over-with-icon> </pop-over-with-icon>
<pop-over-with-icon placement="bottomLeft">
QC Flags
<qc-flags slot="content" :data="qcFlags" />
</pop-over-with-icon>
<pop-over-with-icon> <pop-over-with-icon>
Graph Assistance Graph Assistance
<graph-assistance <graph-assistance
@ -20,24 +16,20 @@
@reset="handleResetChart" @reset="handleResetChart"
/> />
</pop-over-with-icon> </pop-over-with-icon>
<a-popover <pop-over-with-icon v-model="subOperatorsState.nuclideLibraryVisible">
overlayClassName="popover-with-icon" Nuclide Library
:visible="nuclideLibraryVisible"
@click="handleChangeNuclideVisible"
placement="bottom"
>
<div class="pop-over-with-icon">
<span class="text"> Nuclide Library </span>
<img src="@/assets/images/global/select-down.png" alt="" />
</div>
<a-spin slot="content" :spinning="isLoadingNuclide"> <a-spin slot="content" :spinning="isLoadingNuclide">
<nuclide-library :list="nuclideLibraryList" @dblclick="handleNuclideDblClick" /> <nuclide-library :list="nuclideLibraryList" @dblclick="handleNuclideDblClick" />
</a-spin> </a-spin>
</a-popover> </pop-over-with-icon>
<div class="peak-info"> <div class="peak-info">
<button-with-switch-icon @change="handlePeakInfoChange" @click="handleTogglePeak"></button-with-switch-icon> <button-with-switch-icon @change="handlePeakInfoChange" @click="handleTogglePeak"></button-with-switch-icon>
</div> </div>
<pop-over-with-icon placement="right" v-model="subOperatorsState.qcFlagsVisible">
QC Flags
<qc-flags slot="content" :data="qcFlags" />
</pop-over-with-icon>
</div> </div>
<!-- 二级交互栏结束 --> <!-- 二级交互栏结束 -->
<!-- 主体部分 --> <!-- 主体部分 -->
@ -184,7 +176,12 @@ export default {
detailedInfomation: [], detailedInfomation: [],
qcFlags: [], qcFlags: [],
graphAssistance: cloneDeep(graphAssistance), graphAssistance: cloneDeep(graphAssistance),
nuclideLibraryVisible: false,
//
subOperatorsState: {
nuclideLibraryVisible: false,
qcFlagsVisible: false,
},
channelData: { channelData: {
peakGroup: [], peakGroup: [],
@ -263,13 +260,22 @@ export default {
window.removeEventListener('keydown', this.handleKeyboardEvent) window.removeEventListener('keydown', this.handleKeyboardEvent)
window.removeEventListener('click', this.closePeakInfomationTooltip) window.removeEventListener('click', this.closePeakInfomationTooltip)
if (this.qcFlagsTimer) {
clearTimeout(this.qcFlagsTimer)
}
}, },
deactivated() { deactivated() {
this.nuclideLibraryVisible = false // Object.keys(this.subOperatorsState).forEach(k => {
// this.subOperatorsState[k] = false
// })
}, },
mounted() { mounted() {
this.option.brush = { toolbox: [] } this.option.brush = { toolbox: [] }
this.initWebSocket() this.initWebSocket()
this.qcFlagsTimer = setTimeout(() => {
this.subOperatorsState.qcFlagsVisible = true
}, 100)
}, },
methods: { methods: {
// //
@ -900,7 +906,7 @@ export default {
changeSeriesType() {}, changeSeriesType() {},
handleChangeNuclideVisible() { handleChangeNuclideVisible() {
this.nuclideLibraryVisible = !this.nuclideLibraryVisible this.subOperatorsState.nuclideLibraryVisible = !this.subOperatorsState.nuclideLibraryVisible
}, },
// seriesName线 // seriesName线
@ -1024,7 +1030,7 @@ export default {
sampleId, sampleId,
channel, channel,
fileName, fileName,
energy energy,
}) })
if (success) { if (success) {
const { possible } = result const { possible } = result
@ -1042,7 +1048,7 @@ export default {
// Nuclide Library // Nuclide Library
handleNuclideDblClick(nuclide) { handleNuclideDblClick(nuclide) {
this.nuclideLibraryVisible = false this.subOperatorsState.nuclideLibraryVisible = false
this.nuclideReview.nuclide = nuclide this.nuclideReview.nuclide = nuclide
this.nuclideReview.visible = true this.nuclideReview.visible = true
}, },
@ -2102,8 +2108,44 @@ export default {
} }
} }
//
.spectrum-analysis-sub-operators {
flex-shrink: 0;
margin-bottom: 19px;
display: flex;
gap: 11px;
flex-wrap: nowrap;
overflow: auto;
height: 46px;
align-items: center;
.pop-over-with-icon {
height: 32px;
&:nth-child(1) {
width: 216px;
}
&:nth-child(2) {
width: 182px;
}
&:nth-child(3) {
width: 170px;
}
&:nth-child(5) {
width: 156px;
}
}
.peak-info {
width: 226px;
height: 32px;
display: inline-block;
}
}
//
&-main { &-main {
height: calc(100% - 51px); height: calc(100% - 65px);
display: flex; display: flex;
overflow: auto hidden; overflow: auto hidden;
position: relative; position: relative;

View File

@ -1711,49 +1711,10 @@ export default {
} }
// //
::v-deep {
//
.spectrum-analysis-sub-operators {
flex-shrink: 0;
margin-bottom: 19px;
display: flex;
flex-wrap: nowrap;
overflow: auto;
.pop-over-with-icon {
height: 32px;
&:not(:last-child) {
margin-right: 11px;
}
&:nth-child(1) {
width: 256px;
}
&:nth-child(2) {
width: 186px;
}
&:nth-child(3) {
width: 246px;
}
&:nth-child(4) {
width: 246px;
}
}
.peak-info {
width: 306px;
height: 32px;
display: inline-block;
}
}
//
}
// //
&-main { &-main {
margin-top: 15px; padding-top: 5px;
height: calc(100% - 45px); height: calc(100% - 15px);
overflow: hidden; overflow: hidden;
} }
// //