完成form file 模块的load功能

修改form file弹窗列表选择文件的逻辑
查看Gamma Viewer Log接口调整
This commit is contained in:
renpy 2023-09-07 14:48:09 +08:00
parent 44ca1bf9ed
commit 2eb703e2ac
3 changed files with 84 additions and 34 deletions

View File

@ -41,7 +41,7 @@ export default {
sampleId: this.sampleId, sampleId: this.sampleId,
fileName: this.sampleData.fileName fileName: this.sampleData.fileName
} }
getAction("/gamma/viewGammaviewerLog", params).then(res => { getAction("/gamma/viewGammaViewerLog", params).then(res => {
this.isLoading = false this.isLoading = false
if (res.success) { if (res.success) {
this.text = res.result this.text = res.result

View File

@ -1,38 +1,35 @@
<template> <template>
<div> <div>
<custom-modal v-model="visible" :width="1200" title="Load Data From File"> <custom-modal v-model="visible" :width="1200" title="Load Data From File">
<a-table :data-source="list" :columns="columns" :loading="loading_list" :pagination="false" bordered> <a-table
<template slot="sampleData" slot-scope="text"> :data-source="list"
<div class="file-name" :title="text" @click="handleFileSelect"> :columns="columns"
:loading="loading_list"
:pagination="false"
bordered
>
<template slot="sampleData" slot-scope="text, record">
<div class="file-name file-ellipsis" :title="text" @dblclick="handleFileSelect('_S_',record)">
{{ text }} {{ text }}
</div> </div>
<!-- <phd-select type="file" @change="handleFileChange(record, 'sampleData', $event)" @select="handleFileSelect" :title="text && text.name"> <!-- <phd-select type="file" @change="handleFileChange(record, 'sampleData', $event)" @select="handleFileSelect" :title="text && text.name">
{{ text }} {{ text }}
</phd-select> --> </phd-select> -->
</template> </template>
<template slot="gasBkData" slot-scope="text"> <template slot="gasBkData" slot-scope="text, record">
<div class="file-name" :title="text" @click="handleFileSelect"> <div class="file-ellipsis" :title="text" @dblclick="handleFileSelect('_G_',record)">
{{ text }} {{ text }}
</div> </div>
<!-- <phd-select type="file" @change="handleFileChange(record, 'gasBkData', $event)" @select="handleFileSelect" :title="text && text.name">
{{ text && text.name }}
</phd-select> -->
</template> </template>
<template slot="detBkData" slot-scope="text"> <template slot="detBkData" slot-scope="text, record">
<div class="file-name" :title="text" @click="handleFileSelect"> <div class="file-ellipsis" :title="text" @dblclick="handleFileSelect('_D_',record)">
{{ text }} {{ text }}
</div> </div>
<!-- <phd-select type="file" @change="handleFileChange(record, 'detBkData', $event)" @select="handleFileSelect" :title="text && text.name">
{{ text && text.name }}
</phd-select> -->
</template> </template>
<template slot="qcData" slot-scope="text"> <template slot="qcData" slot-scope="text, record">
<div class="file-name" :title="text" @click="handleFileSelect"> <div class="file-ellipsis" :title="text" @dblclick="handleFileSelect('_Q_',record)">
{{ text }} {{ text }}
</div> </div>
<!-- <phd-select type="file" @change="handleFileChange(record, 'qcData', $event)" @select="handleFileSelect" :title="text && text.name">
{{ text && text.name }}
</phd-select> -->
</template> </template>
<template slot="status" slot-scope="text,record"> <template slot="status" slot-scope="text,record">
<span :class="[record.detFileStatus&&record.gasFileStatus&&record.qcFileStatus?'status_true':'status_false','status']"></span> <span :class="[record.detFileStatus&&record.gasFileStatus&&record.qcFileStatus?'status_true':'status_false','status']"></span>
@ -57,6 +54,7 @@
<a-modal v-model="visible_file" :width="1200" title="File List" @cancel="cancelFileModale"> <a-modal v-model="visible_file" :width="1200" title="File List" @cancel="cancelFileModale">
<div style="position: relative;padding-bottom: 40px;height: 460px;overflow: hidden;"> <div style="position: relative;padding-bottom: 40px;height: 460px;overflow: hidden;">
<a-table <a-table
v-if="tableType=='multiple'"
:data-source="list_file" :data-source="list_file"
:columns="columns_file" :columns="columns_file"
:loading="loading_file" :loading="loading_file"
@ -64,6 +62,18 @@
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }" :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
> >
</a-table> </a-table>
<custom-table
v-if="tableType=='single'"
rowKey="id"
size="middle"
:columns="columns_file"
:list="list_file"
:pagination="false"
:loading="loading_file_edit"
:selectedRowKeys.sync="selectedRowKeys_edit"
:selectionRows.sync="selectionRows_edit"
>
</custom-table>
<a-pagination <a-pagination
size="small" size="small"
v-model="ipagination.current" v-model="ipagination.current"
@ -187,7 +197,13 @@ export default {
selectedFiles: [], selectedFiles: [],
fileList: [], fileList: [],
fileNum: 0, fileNum: 0,
uploading: false uploading: false,
currRowData: {},
currFileType: "_S_",
loading_file_edit: false,
selectedRowKeys_edit: [],
selectionRows_edit: [],
tableType: "multiple"
} }
}, },
methods: { methods: {
@ -204,8 +220,13 @@ export default {
handleFileChange(record, key, fileInfo) { handleFileChange(record, key, fileInfo) {
record[key] = fileInfo record[key] = fileInfo
}, },
handleFileSelect() { handleFileSelect(str, record) {
this.currRowData = record
this.currFileType = str
this.selectedRowKeys = []
this.selectedFiles = []
this.visible_file = true this.visible_file = true
this.tableType = str==="_S_"?"multiple":"single"
this.getSpectrumFile({pageNo:1,pageSize:10}) this.getSpectrumFile({pageNo:1,pageSize:10})
}, },
getSpectrumFile(params) { getSpectrumFile(params) {
@ -213,6 +234,9 @@ export default {
getAction("/spectrumFile/get", params).then(res => { getAction("/spectrumFile/get", params).then(res => {
this.loading_file = false this.loading_file = false
if (res.success) { if (res.success) {
res.result.records.forEach((item,index) => {
item.id = index
})
this.ipagination.total = res.result.total this.ipagination.total = res.result.total
this.list_file = res.result.records this.list_file = res.result.records
} else { } else {
@ -244,18 +268,26 @@ export default {
}, },
saveFileName() { saveFileName() {
this.visible_file = false this.visible_file = false
this.loading_list = true if (this.tableType ==="multiple" ) {
let params = { this.loading_list = true
fileName: this.selectedFiles.join(",") let params = {
} fileName: this.selectedFiles.join(",")
getAction("/spectrumAnalysis/getFilesBySampleFile", params).then(res => {
this.loading_list = false
if (res.success) {
this.list =res.result.length>0? res.result:this.getInitialList()
} else {
this.$message.warning("This operation fails. Contact your system administrator")
} }
}) getAction("/spectrumAnalysis/getFilesBySampleFile", params).then(res => {
this.loading_list = false
if (res.success) {
let idx = res.result.length
this.list.splice(0,idx,...res.result)
} else {
this.$message.warning("This operation fails. Contact your system administrator")
}
})
} else {
let currFileName = this.selectionRows_edit[0].name
if (currFileName.includes(this.currFileType)) {
this.currRowData.gasFileName = currFileName
}
}
}, },
cancelFileModale() { cancelFileModale() {
this.visible_file = false this.visible_file = false
@ -316,7 +348,9 @@ export default {
}, },
handleLoad() { handleLoad() {
console.log('%c [ handleLoad ]-123', 'font-size:13px; background:pink; color:#bf2c9f;', this.list) this.visible = false
this.$emit('loadFormFile', this.list)
// console.log('%c [ handleLoad ]-123', 'font-size:13px; background:pink; color:#bf2c9f;', this.list)
}, },
handleCancel() { handleCancel() {
@ -410,8 +444,11 @@ export default {
.file-name { .file-name {
height: 42px; height: 42px;
line-height: 42px; line-height: 42px;
}
.file-ellipsis{
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
} }
</style> </style>

View File

@ -48,7 +48,7 @@
<!-- 从数据库加载结束 --> <!-- 从数据库加载结束 -->
<!-- 从文件加载开始 --> <!-- 从文件加载开始 -->
<load-from-file-modal v-model="loadFromFileModalVisible" /> <load-from-file-modal v-model="loadFromFileModalVisible" @loadFormFile="handleLoadSampleFromFile" />
<!-- 从文件加载结束 --> <!-- 从文件加载结束 -->
<!-- Strip 弹窗开始 --> <!-- Strip 弹窗开始 -->
@ -386,6 +386,19 @@ export default {
const willAddList = sampleList.filter(item => !ids.includes(item.sampleId)) const willAddList = sampleList.filter(item => !ids.includes(item.sampleId))
this.sampleList = this.sampleList.concat(willAddList) this.sampleList = this.sampleList.concat(willAddList)
}, },
handleLoadSampleFromFile(sampleList) {
let arr = sampleList.filter(item => {
return Object.keys(item).length>4
})
arr.forEach(item => {
item.sampleId = ""
item.inputFileName = item.sampleFileName
item.sampleType = item.sampleSystemType
})
const names = this.sampleList.map(item => item.inputFileName) // Sampleid
const willAddList = arr.filter(item => !names.includes(item.inputFileName))
this.sampleList = this.sampleList.concat(willAddList)
},
// //
async loadSelectedSample(sample) { async loadSelectedSample(sample) {