完成form file 模块的load功能
修改form file弹窗列表选择文件的逻辑 查看Gamma Viewer Log接口调整
This commit is contained in:
		
							parent
							
								
									44ca1bf9ed
								
							
						
					
					
						commit
						2eb703e2ac
					
				| 
						 | 
				
			
			@ -41,7 +41,7 @@ export default {
 | 
			
		|||
        sampleId: this.sampleId,
 | 
			
		||||
        fileName: this.sampleData.fileName
 | 
			
		||||
      }
 | 
			
		||||
      getAction("/gamma/viewGammaviewerLog", params).then(res => {
 | 
			
		||||
      getAction("/gamma/viewGammaViewerLog", params).then(res => {
 | 
			
		||||
        this.isLoading = false
 | 
			
		||||
        if (res.success) {
 | 
			
		||||
          this.text = res.result
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,38 +1,35 @@
 | 
			
		|||
<template>
 | 
			
		||||
  <div>
 | 
			
		||||
    <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>
 | 
			
		||||
        <template slot="sampleData" slot-scope="text">
 | 
			
		||||
          <div class="file-name" :title="text" @click="handleFileSelect">
 | 
			
		||||
      <a-table 
 | 
			
		||||
        :data-source="list" 
 | 
			
		||||
        :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 }}
 | 
			
		||||
          </div>
 | 
			
		||||
          <!-- <phd-select type="file" @change="handleFileChange(record, 'sampleData', $event)" @select="handleFileSelect" :title="text && text.name">
 | 
			
		||||
            {{ text }}
 | 
			
		||||
          </phd-select> -->
 | 
			
		||||
        </template>
 | 
			
		||||
        <template slot="gasBkData" slot-scope="text">
 | 
			
		||||
          <div class="file-name" :title="text" @click="handleFileSelect">
 | 
			
		||||
        <template slot="gasBkData" slot-scope="text, record">
 | 
			
		||||
          <div class="file-ellipsis" :title="text" @dblclick="handleFileSelect('_G_',record)">
 | 
			
		||||
            {{ text }}
 | 
			
		||||
          </div>
 | 
			
		||||
          <!-- <phd-select type="file" @change="handleFileChange(record, 'gasBkData', $event)" @select="handleFileSelect" :title="text && text.name">
 | 
			
		||||
            {{ text && text.name }}
 | 
			
		||||
          </phd-select> -->
 | 
			
		||||
        </template>
 | 
			
		||||
        <template slot="detBkData" slot-scope="text">
 | 
			
		||||
          <div class="file-name" :title="text" @click="handleFileSelect">
 | 
			
		||||
        <template slot="detBkData" slot-scope="text, record">
 | 
			
		||||
          <div class="file-ellipsis" :title="text" @dblclick="handleFileSelect('_D_',record)">
 | 
			
		||||
            {{ text }}
 | 
			
		||||
          </div>
 | 
			
		||||
          <!-- <phd-select type="file" @change="handleFileChange(record, 'detBkData', $event)" @select="handleFileSelect" :title="text && text.name">
 | 
			
		||||
            {{ text && text.name }}
 | 
			
		||||
          </phd-select> -->
 | 
			
		||||
        </template>
 | 
			
		||||
        <template slot="qcData" slot-scope="text">
 | 
			
		||||
          <div class="file-name" :title="text" @click="handleFileSelect">
 | 
			
		||||
        <template slot="qcData" slot-scope="text, record">
 | 
			
		||||
          <div class="file-ellipsis" :title="text" @dblclick="handleFileSelect('_Q_',record)">
 | 
			
		||||
            {{ text }}
 | 
			
		||||
          </div>
 | 
			
		||||
          <!-- <phd-select type="file" @change="handleFileChange(record, 'qcData', $event)" @select="handleFileSelect" :title="text && text.name">
 | 
			
		||||
            {{ text && text.name }}
 | 
			
		||||
          </phd-select> -->
 | 
			
		||||
        </template>
 | 
			
		||||
        <template slot="status" slot-scope="text,record">
 | 
			
		||||
          <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">
 | 
			
		||||
      <div style="position: relative;padding-bottom: 40px;height: 460px;overflow: hidden;">
 | 
			
		||||
        <a-table 
 | 
			
		||||
          v-if="tableType=='multiple'"
 | 
			
		||||
          :data-source="list_file" 
 | 
			
		||||
          :columns="columns_file" 
 | 
			
		||||
          :loading="loading_file"
 | 
			
		||||
| 
						 | 
				
			
			@ -64,6 +62,18 @@
 | 
			
		|||
          :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
 | 
			
		||||
        >
 | 
			
		||||
        </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 
 | 
			
		||||
          size="small"
 | 
			
		||||
          v-model="ipagination.current" 
 | 
			
		||||
| 
						 | 
				
			
			@ -187,7 +197,13 @@ export default {
 | 
			
		|||
      selectedFiles: [],
 | 
			
		||||
      fileList: [],
 | 
			
		||||
      fileNum: 0,
 | 
			
		||||
      uploading: false
 | 
			
		||||
      uploading: false,
 | 
			
		||||
      currRowData: {},
 | 
			
		||||
      currFileType: "_S_",
 | 
			
		||||
      loading_file_edit: false,
 | 
			
		||||
      selectedRowKeys_edit: [],
 | 
			
		||||
      selectionRows_edit: [],
 | 
			
		||||
      tableType: "multiple"
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
| 
						 | 
				
			
			@ -204,8 +220,13 @@ export default {
 | 
			
		|||
    handleFileChange(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.tableType = str==="_S_"?"multiple":"single"
 | 
			
		||||
      this.getSpectrumFile({pageNo:1,pageSize:10})
 | 
			
		||||
    },
 | 
			
		||||
    getSpectrumFile(params) {
 | 
			
		||||
| 
						 | 
				
			
			@ -213,6 +234,9 @@ export default {
 | 
			
		|||
      getAction("/spectrumFile/get", params).then(res => {
 | 
			
		||||
        this.loading_file = false
 | 
			
		||||
        if (res.success) {
 | 
			
		||||
          res.result.records.forEach((item,index) => {
 | 
			
		||||
            item.id = index
 | 
			
		||||
          })
 | 
			
		||||
          this.ipagination.total = res.result.total
 | 
			
		||||
          this.list_file = res.result.records
 | 
			
		||||
        } else {
 | 
			
		||||
| 
						 | 
				
			
			@ -244,18 +268,26 @@ export default {
 | 
			
		|||
    },
 | 
			
		||||
    saveFileName() {
 | 
			
		||||
      this.visible_file = false
 | 
			
		||||
      this.loading_list = true
 | 
			
		||||
      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")
 | 
			
		||||
      if (this.tableType ==="multiple" ) {
 | 
			
		||||
        this.loading_list = true
 | 
			
		||||
        let params = {
 | 
			
		||||
          fileName: this.selectedFiles.join(",")
 | 
			
		||||
        }
 | 
			
		||||
      })
 | 
			
		||||
        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() {
 | 
			
		||||
      this.visible_file = false
 | 
			
		||||
| 
						 | 
				
			
			@ -316,7 +348,9 @@ export default {
 | 
			
		|||
    },
 | 
			
		||||
 | 
			
		||||
    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() {
 | 
			
		||||
| 
						 | 
				
			
			@ -410,8 +444,11 @@ export default {
 | 
			
		|||
.file-name {
 | 
			
		||||
  height: 42px;
 | 
			
		||||
  line-height: 42px;
 | 
			
		||||
}
 | 
			
		||||
.file-ellipsis{
 | 
			
		||||
  overflow: hidden;
 | 
			
		||||
  text-overflow: ellipsis;
 | 
			
		||||
  white-space: nowrap;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
</style>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -48,7 +48,7 @@
 | 
			
		|||
    <!-- 从数据库加载结束 -->
 | 
			
		||||
 | 
			
		||||
    <!-- 从文件加载开始 -->
 | 
			
		||||
    <load-from-file-modal v-model="loadFromFileModalVisible" />
 | 
			
		||||
    <load-from-file-modal v-model="loadFromFileModalVisible" @loadFormFile="handleLoadSampleFromFile" />
 | 
			
		||||
    <!-- 从文件加载结束 -->
 | 
			
		||||
 | 
			
		||||
    <!-- Strip 弹窗开始 -->
 | 
			
		||||
| 
						 | 
				
			
			@ -386,6 +386,19 @@ export default {
 | 
			
		|||
      const willAddList = sampleList.filter(item => !ids.includes(item.sampleId))
 | 
			
		||||
      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) // 当前Sample列表中的所有id
 | 
			
		||||
      const willAddList = arr.filter(item => !names.includes(item.inputFileName))
 | 
			
		||||
      this.sampleList = this.sampleList.concat(willAddList)
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    // 加载选中的样本
 | 
			
		||||
    async loadSelectedSample(sample) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user