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() { async handleLoad() {
if (!this.selectedRowKeys.length) { if (!this.selectedRowKeys.length) {
this.$message.warn('Please Select Databases To Load') this.$message.warn('Please Select Sample To Load')
return return
} }
this.selectedRowKeys = [] this.selectedRowKeys = []

View File

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

View File

@ -74,7 +74,7 @@
<!-- Nuclide Activity and MDC 弹窗结束 --> <!-- Nuclide Activity and MDC 弹窗结束 -->
<!-- Save Setting 弹窗开始 --> <!-- Save Setting 弹窗开始 -->
<save-setting-modal v-model="saveSettingModalVisible" /> <save-setting-modal v-model="saveSettingModalVisible" @save="handleSaveResultsToFile" />
<!-- Save Setting 弹窗结束 --> <!-- Save Setting 弹窗结束 -->
<!-- 分析-设置弹窗开始 --> <!-- 分析-设置弹窗开始 -->
@ -156,10 +156,7 @@
<!-- Beta-Gamma 的Comments 结束 --> <!-- Beta-Gamma 的Comments 结束 -->
<!-- Beta-Gamma 的Energy Calibration开始 --> <!-- Beta-Gamma 的Energy Calibration开始 -->
<beta-gamma-energy-calibration-modal <beta-gamma-energy-calibration-modal v-model="betaGammaEnergyCalibrationModalVisible" @sendInfo="getCheckFlag" />
v-model="betaGammaEnergyCalibrationModalVisible"
@sendInfo="getCheckFlag"
/>
<!-- Beta-Gamma 的Energy Calibration结束 --> <!-- Beta-Gamma 的Energy Calibration结束 -->
<!-- Beta-Gamma Extrapolation 弹窗开始 --> <!-- Beta-Gamma Extrapolation 弹窗开始 -->
@ -191,7 +188,7 @@
</div> </div>
</template> </template>
<script> <script>
import { postAction } from '@/api/manage' import { downloadFile, postAction } from '@/api/manage'
import GammaAnalysis from './gamma-analysis.vue' import GammaAnalysis from './gamma-analysis.vue'
import BetaGammaAnalysis from './beta-gamma-analysis.vue' import BetaGammaAnalysis from './beta-gamma-analysis.vue'
import SpectraListInMenu from './components/SpectraListInMenu.vue' import SpectraListInMenu from './components/SpectraListInMenu.vue'
@ -460,8 +457,31 @@ export default {
}, },
// //
handleSaveResultsToFile() { async handleSaveResultsToFile(saveFormat) {
this.saveSettingModalVisible = true 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) const hideLoading = this.$message.loading('Saving...', 0)
try { try {
const { success, message } = await getAction('/gamma/saveToDB', { const { success, message } = await getAction('/gamma/saveToDB', {
fileName: this.sampleData.inputFileName fileName: this.sampleData.inputFileName,
}) })
if (success) { if (success) {
this.$message.success('Save Success') this.$message.success('Save Success')
@ -727,7 +747,7 @@ export default {
}, },
on: { on: {
menuClick: () => { menuClick: () => {
this.handleSaveResultsToFile() this.saveSettingModalVisible = true
}, },
submenuClick: ({ item, child }) => { submenuClick: ({ item, child }) => {
if (item.title == 'Save Results to DB') { if (item.title == 'Save Results to DB') {