fix: 修复保存Results时的文件名称不正确问题,Compare和Strip增加本地直接选择文件功能
This commit is contained in:
parent
c1d3129441
commit
b936995317
|
@ -55,6 +55,7 @@
|
||||||
"vxe-table": "2.9.13",
|
"vxe-table": "2.9.13",
|
||||||
"vxe-table-plugin-antd": "1.8.10",
|
"vxe-table-plugin-antd": "1.8.10",
|
||||||
"xe-utils": "2.4.8",
|
"xe-utils": "2.4.8",
|
||||||
|
"xlsx": "^0.18.5",
|
||||||
"xss": "^1.0.13"
|
"xss": "^1.0.13"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
|
@ -104,21 +104,28 @@ export function getFileNameByHeaderContentDisposition(contentDisposition) {
|
||||||
return fileName
|
return fileName
|
||||||
}
|
}
|
||||||
|
|
||||||
export const fetchAndDownload = async (url, data) => {
|
export const fetchAndDownload = async (url, data, method='post') => {
|
||||||
const apiBaseUrl = window._CONFIG['domianURL'] || '/jeecg-boot'
|
const apiBaseUrl = window._CONFIG['domianURL'] || '/jeecg-boot'
|
||||||
const sign = signMd5Utils.getSign(url, data)
|
const sign = signMd5Utils.getSign(url, data)
|
||||||
const response = await Axios({
|
|
||||||
|
const config = {
|
||||||
baseURL: apiBaseUrl,
|
baseURL: apiBaseUrl,
|
||||||
method: 'post',
|
method,
|
||||||
url,
|
url,
|
||||||
data: data,
|
data,
|
||||||
|
|
||||||
headers: {
|
headers: {
|
||||||
'X-Sign': sign,
|
'X-Sign': sign,
|
||||||
'X-TIMESTAMP': signMd5Utils.getTimestamp(),
|
'X-TIMESTAMP': signMd5Utils.getTimestamp(),
|
||||||
'X-Access-Token': Vue.ls.get(ACCESS_TOKEN),
|
'X-Access-Token': Vue.ls.get(ACCESS_TOKEN),
|
||||||
'tenant-id': Vue.ls.get(TENANT_ID)
|
'tenant-id': Vue.ls.get(TENANT_ID)
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
if(method == 'get') {
|
||||||
|
config.params = data
|
||||||
|
}
|
||||||
|
|
||||||
|
const response = await Axios(config)
|
||||||
const { status, headers, data: responseData } = response
|
const { status, headers, data: responseData } = response
|
||||||
if (status == 200) {
|
if (status == 200) {
|
||||||
if (typeof responseData == 'object') {
|
if (typeof responseData == 'object') {
|
||||||
|
|
|
@ -80,7 +80,7 @@ export default {
|
||||||
|
|
||||||
const params = this.getQueryParams() //查询条件
|
const params = this.getQueryParams() //查询条件
|
||||||
const searchName = this.queryParam.searchName
|
const searchName = this.queryParam.searchName
|
||||||
params.name = `${searchName ? `${searchName},` : ''}_S_`
|
params.name = searchName
|
||||||
this.loading = true
|
this.loading = true
|
||||||
getAction('/spectrumFile/get', params)
|
getAction('/spectrumFile/get', params)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
|
|
|
@ -138,6 +138,8 @@ import store from '@/store/'
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import { ACCESS_TOKEN } from '@/store/mutation-types'
|
import { ACCESS_TOKEN } from '@/store/mutation-types'
|
||||||
import StripModal from './components/Modals/StripModal.vue'
|
import StripModal from './components/Modals/StripModal.vue'
|
||||||
|
import { FilePicker } from '@/utils/FilePicker'
|
||||||
|
import { zipFile } from '@/utils/file'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
|
@ -470,21 +472,21 @@ export default {
|
||||||
// 推入BaseLine
|
// 推入BaseLine
|
||||||
series.push(
|
series.push(
|
||||||
buildLineSeries('BaseLine', this.transformPointListData(channelBaseLine.pointlist), channelBaseLine.color, {
|
buildLineSeries('BaseLine', this.transformPointListData(channelBaseLine.pointlist), channelBaseLine.color, {
|
||||||
zlevel: 2,
|
z: 2,
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
// 推入LcLine线
|
// 推入LcLine线
|
||||||
series.push(
|
series.push(
|
||||||
buildLineSeries('LcLine', this.transformPointListData(channelLcLine.pointlist), channelLcLine.color, {
|
buildLineSeries('LcLine', this.transformPointListData(channelLcLine.pointlist), channelLcLine.color, {
|
||||||
zlevel: 3,
|
z: 3,
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
// 推入Scac线
|
// 推入Scac线
|
||||||
series.push(
|
series.push(
|
||||||
buildLineSeries('ScacLine', this.transformPointListData(channelScacLine.pointlist), channelScacLine.color, {
|
buildLineSeries('ScacLine', this.transformPointListData(channelScacLine.pointlist), channelScacLine.color, {
|
||||||
zlevel: 4,
|
z: 4,
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -506,7 +508,7 @@ export default {
|
||||||
disabled: true,
|
disabled: true,
|
||||||
},
|
},
|
||||||
animation: false,
|
animation: false,
|
||||||
zlevel: 5,
|
z: 5,
|
||||||
})
|
})
|
||||||
|
|
||||||
// 推入Peak Line
|
// 推入Peak Line
|
||||||
|
@ -514,7 +516,7 @@ export default {
|
||||||
channelPeakGroup.forEach((item, index) => {
|
channelPeakGroup.forEach((item, index) => {
|
||||||
peakLines.push(
|
peakLines.push(
|
||||||
buildLineSeries(`Peak_${index}`, this.transformPointListData(item.pointlist), item.color, {
|
buildLineSeries(`Peak_${index}`, this.transformPointListData(item.pointlist), item.color, {
|
||||||
zlevel: 6,
|
z: 6,
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -524,12 +526,13 @@ export default {
|
||||||
series.push(
|
series.push(
|
||||||
buildLineSeries('Compare', [], '#fff', {
|
buildLineSeries('Compare', [], '#fff', {
|
||||||
symbolSize: 2,
|
symbolSize: 2,
|
||||||
|
z: 7,
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
this.opts.notMerge = true
|
this.opts.notMerge = true
|
||||||
this.option.series = series
|
this.option.series = series
|
||||||
|
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.resetChartOpts()
|
this.resetChartOpts()
|
||||||
})
|
})
|
||||||
|
@ -576,6 +579,11 @@ export default {
|
||||||
break
|
break
|
||||||
case 'Channel':
|
case 'Channel':
|
||||||
case 'Energy':
|
case 'Energy':
|
||||||
|
// 如果Energy没有值,则不进行切换
|
||||||
|
if (!this.energyData.all.pointlist) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
this.graphAssistance.axisType = label
|
this.graphAssistance.axisType = label
|
||||||
this.option.xAxis.name = label
|
this.option.xAxis.name = label
|
||||||
|
|
||||||
|
@ -713,7 +721,7 @@ export default {
|
||||||
data.forEach((item, index) => {
|
data.forEach((item, index) => {
|
||||||
peakLines.push(
|
peakLines.push(
|
||||||
buildLineSeries(`Peak_${index}`, this.transformPointListData(item.pointlist), item.color, {
|
buildLineSeries(`Peak_${index}`, this.transformPointListData(item.pointlist), item.color, {
|
||||||
zlevel: 6,
|
z: 6,
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -1219,15 +1227,42 @@ export default {
|
||||||
}
|
}
|
||||||
this.handleResetChart()
|
this.handleResetChart()
|
||||||
this.clearCompareLine()
|
this.clearCompareLine()
|
||||||
this.compareFileListModalVisible = true
|
|
||||||
|
|
||||||
this.isStrip = isStrip
|
this.isStrip = isStrip
|
||||||
|
if (FilePicker.canUse()) {
|
||||||
|
this.chooseFileFromFS()
|
||||||
|
} else {
|
||||||
|
this.compareFileListModalVisible = true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// 从文件系统中选择文件
|
||||||
|
async chooseFileFromFS() {
|
||||||
|
try {
|
||||||
|
const [fileHandle] = await FilePicker.chooseFile(false, [{ accept: { 'text/phd': ['.phd'] } }])
|
||||||
|
const file = await fileHandle.getFile()
|
||||||
|
const zipedFiles = await zipFile([file], 'test.zip')
|
||||||
|
try {
|
||||||
|
const formData = new FormData()
|
||||||
|
formData.append('file', zipedFiles)
|
||||||
|
const { success, message } = await postAction('/spectrumFile/upload', formData)
|
||||||
|
if (success) {
|
||||||
|
this.handleFileSelect(file.name)
|
||||||
|
} else {
|
||||||
|
this.$message.error(message)
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// 文件之间对比
|
// 文件之间对比
|
||||||
async handleFileSelect(selectedFileName) {
|
async handleFileSelect(selectedFileName) {
|
||||||
const { inputFileName: fileName } = this.sample
|
const { inputFileName: fileName } = this.sample
|
||||||
|
|
||||||
|
const hide = this.$message.loading(this.isStrip ? 'Stripping...' : 'Comparing...', 0)
|
||||||
try {
|
try {
|
||||||
let param = {
|
let param = {
|
||||||
fileName,
|
fileName,
|
||||||
|
@ -1246,7 +1281,6 @@ export default {
|
||||||
url = '/gamma/Strip'
|
url = '/gamma/Strip'
|
||||||
}
|
}
|
||||||
|
|
||||||
this.isLoading = true
|
|
||||||
const { success, result, message } = await getAction(url, param)
|
const { success, result, message } = await getAction(url, param)
|
||||||
if (success) {
|
if (success) {
|
||||||
const [channelData, energyData] = result
|
const [channelData, energyData] = result
|
||||||
|
@ -1254,10 +1288,6 @@ export default {
|
||||||
this.energyCompareLine = energyData
|
this.energyCompareLine = energyData
|
||||||
this.redrawLineBySeriesName('Compare', energyData, channelData, true, channelData.color)
|
this.redrawLineBySeriesName('Compare', energyData, channelData, true, channelData.color)
|
||||||
|
|
||||||
if (this.isScatter()) {
|
|
||||||
lineSeries.type = 'scatterGL'
|
|
||||||
}
|
|
||||||
|
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.thumbnailOption.yAxis.max = getAxisMax(this.getChart(), 'yAxis')
|
this.thumbnailOption.yAxis.max = getAxisMax(this.getChart(), 'yAxis')
|
||||||
})
|
})
|
||||||
|
@ -1267,7 +1297,7 @@ export default {
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
} finally {
|
} finally {
|
||||||
this.isLoading = false
|
hide()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1305,7 +1335,7 @@ export default {
|
||||||
this.dataProcess(result)
|
this.dataProcess(result)
|
||||||
} else {
|
} else {
|
||||||
this.isLoading = false
|
this.isLoading = false
|
||||||
if(showMessage) {
|
if (showMessage) {
|
||||||
const arr = message.split('\n')
|
const arr = message.split('\n')
|
||||||
this.$warning({
|
this.$warning({
|
||||||
title: 'Warning',
|
title: 'Warning',
|
||||||
|
|
|
@ -198,7 +198,7 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { downloadFile, postAction } from '@/api/manage'
|
import { 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'
|
||||||
|
@ -237,6 +237,7 @@ import AutomaticAnalysisLogModal from './components/Modals/BetaGammaModals/Autom
|
||||||
import BetaGammaExtrapolationModal from './components/Modals/BetaGammaModals/BetaGammaExtrapolationModal.vue'
|
import BetaGammaExtrapolationModal from './components/Modals/BetaGammaModals/BetaGammaExtrapolationModal.vue'
|
||||||
import { getAction } from '@/api/manage'
|
import { getAction } from '@/api/manage'
|
||||||
import { clearSampleCache } from './clearSampleCache'
|
import { clearSampleCache } from './clearSampleCache'
|
||||||
|
import { fetchAndDownload } from '@/utils/file'
|
||||||
|
|
||||||
// 分析类型
|
// 分析类型
|
||||||
const ANALYZE_TYPE = {
|
const ANALYZE_TYPE = {
|
||||||
|
@ -494,7 +495,7 @@ export default {
|
||||||
let params = {
|
let params = {
|
||||||
fileName: this.newSampleData.inputFileName,
|
fileName: this.newSampleData.inputFileName,
|
||||||
}
|
}
|
||||||
downloadFile(url, `result.${saveFormat}`, params, 'get')
|
fetchAndDownload(url, params, 'get')
|
||||||
}
|
}
|
||||||
if (this.isBetaGamma) {
|
if (this.isBetaGamma) {
|
||||||
const url =
|
const url =
|
||||||
|
@ -520,7 +521,7 @@ export default {
|
||||||
this.params_toDB.qcFileName = this.newSampleData.qcFileName
|
this.params_toDB.qcFileName = this.newSampleData.qcFileName
|
||||||
this.params_toDB.dbName = this.newSampleData.dbName
|
this.params_toDB.dbName = this.newSampleData.dbName
|
||||||
|
|
||||||
downloadFile(url, `result.${saveFormat}`, this.params_toDB, 'post')
|
fetchAndDownload(url, this.params_toDB)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -594,7 +595,7 @@ export default {
|
||||||
let params = {
|
let params = {
|
||||||
fileName: this.newSampleData.inputFileName,
|
fileName: this.newSampleData.inputFileName,
|
||||||
}
|
}
|
||||||
downloadFile(url, `result.PHD`, params, 'get')
|
fetchAndDownload(url, params, 'get')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user