feat: 完成Beta的Save Results to File 对接

This commit is contained in:
Xu Zhimeng 2023-10-09 14:25:39 +08:00
parent d9052d5d7e
commit a06362f23d
3 changed files with 35 additions and 16 deletions

View File

@ -197,7 +197,7 @@ export default {
*/
async handleLoad() {
if (!this.selectedRowKeys.length) {
this.$message.warn('Please Select Databases To Load')
this.$message.warn('Please Select Sample To Load')
return
}
this.selectedRowKeys = []

View File

@ -10,7 +10,8 @@
<title-over-border title="Format">
<a-radio-group v-model="saveFormat" class="format-radio-group">
<a-radio value="txt">Save as Txt</a-radio>
<a-radio value="excel">Save as Excel</a-radio>
<a-radio value="xls">Save as Excel</a-radio>
<a-radio value="html">Save as Html</a-radio>
</a-radio-group>
</title-over-border>
</div>
@ -19,7 +20,6 @@
</template>
<script>
import { downloadFile } from '../../../../api/manage'
import TitleOverBorder from '../TitleOverBorder.vue'
export default {
components: { TitleOverBorder },
@ -41,8 +41,7 @@ export default {
},
handleOk() {
console.log('%c [ save ]-22', 'font-size:13px; background:pink; color:#bf2c9f;')
downloadFile('', 'result.' + this.saveFormat, {})
this.$emit('save', this.saveFormat)
}
},
computed: {
@ -73,7 +72,7 @@ export default {
}
.format-radio-group {
.ant-radio-wrapper:first-child {
.ant-radio-wrapper:not(:last-child) {
margin-bottom: 10px;
}
}

View File

@ -74,7 +74,7 @@
<!-- Nuclide Activity and MDC 弹窗结束 -->
<!-- Save Setting 弹窗开始 -->
<save-setting-modal v-model="saveSettingModalVisible" />
<save-setting-modal v-model="saveSettingModalVisible" @save="handleSaveResultsToFile" />
<!-- Save Setting 弹窗结束 -->
<!-- 分析-设置弹窗开始 -->
@ -156,10 +156,7 @@
<!-- Beta-Gamma 的Comments 结束 -->
<!-- Beta-Gamma 的Energy Calibration开始 -->
<beta-gamma-energy-calibration-modal
v-model="betaGammaEnergyCalibrationModalVisible"
@sendInfo="getCheckFlag"
/>
<beta-gamma-energy-calibration-modal v-model="betaGammaEnergyCalibrationModalVisible" @sendInfo="getCheckFlag" />
<!-- Beta-Gamma 的Energy Calibration结束 -->
<!-- Beta-Gamma Extrapolation 弹窗开始 -->
@ -191,7 +188,7 @@
</div>
</template>
<script>
import { postAction } from '@/api/manage'
import { downloadFile, postAction } from '@/api/manage'
import GammaAnalysis from './gamma-analysis.vue'
import BetaGammaAnalysis from './beta-gamma-analysis.vue'
import SpectraListInMenu from './components/SpectraListInMenu.vue'
@ -460,8 +457,31 @@ export default {
},
//
handleSaveResultsToFile() {
this.saveSettingModalVisible = true
async handleSaveResultsToFile(saveFormat) {
const url =
saveFormat == 'xls'
? '/spectrumAnalysis/saveToExcel'
: saveFormat == 'txt'
? '/spectrumAnalysis/saveToTxt'
: saveFormat == 'html'
? '/spectrumAnalysis/saveToHTML'
: ''
if (!this.resultDisplayFlag) {
this.$message.warn('Please Analyse Spectrum First')
return
}
this.resultDisplayFlag.forEach((item) => {
this.params_toDB[`${item.nuclideName.toLowerCase()}Flag`] = item.nidFlag
})
this.params_toDB.sampleFileName = this.newSampleData.inputFileName
this.params_toDB.gasFileName = this.newSampleData.gasFileName
this.params_toDB.detFileName = this.newSampleData.detFileName
this.params_toDB.qcFileName = this.newSampleData.qcFileName
this.params_toDB.dbName = this.newSampleData.dbName
downloadFile(url, `result.${saveFormat}`, this.params_toDB, 'post')
},
/**
@ -478,7 +498,7 @@ export default {
const hideLoading = this.$message.loading('Saving...', 0)
try {
const { success, message } = await getAction('/gamma/saveToDB', {
fileName: this.sampleData.inputFileName
fileName: this.sampleData.inputFileName,
})
if (success) {
this.$message.success('Save Success')
@ -727,7 +747,7 @@ export default {
},
on: {
menuClick: () => {
this.handleSaveResultsToFile()
this.saveSettingModalVisible = true
},
submenuClick: ({ item, child }) => {
if (item.title == 'Save Results to DB') {