642 lines
16 KiB
Vue
642 lines
16 KiB
Vue
<template>
|
|
<custom-modal v-model="visible" :width="1280" title="Load From Database" class="load-from-db-modal">
|
|
<search-form ref="searchFormRef" :items="formItems" v-model="queryParam">
|
|
<a-space slot="additional">
|
|
<a-button @click="handleReset">Reset</a-button>
|
|
<a-button type="primary" @click="searchQuery">Search</a-button>
|
|
</a-space>
|
|
</search-form>
|
|
<custom-table
|
|
size="middle"
|
|
:rowKey="this.loadType == 'db' ? 'analysitId' : 'sampleId'"
|
|
:columns="columns"
|
|
:list="dataSource"
|
|
:pagination="ipagination"
|
|
:loading="loading"
|
|
@change="handleTableChange"
|
|
:selectedRowKeys.sync="selectedRowKeys"
|
|
:selectionRows.sync="selectionRows"
|
|
:multiple="loadType == 'db'"
|
|
:scroll="{ y: 'calc(100vh - 550px)' }"
|
|
>
|
|
</custom-table>
|
|
<!-- 底部操作栏 -->
|
|
<template slot="custom-footer">
|
|
<a-space>
|
|
<a-radio-group v-if="loadType == 'db'" v-model="queryParam.dbName">
|
|
<a-radio value="auto">From Auto DB</a-radio>
|
|
<a-radio value="man">From Interactive DB</a-radio>
|
|
</a-radio-group>
|
|
<a-button type="primary" @click="handleLoad">Load</a-button>
|
|
</a-space>
|
|
</template>
|
|
</custom-modal>
|
|
</template>
|
|
|
|
<script>
|
|
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
|
|
import { getAction } from '../../../../api/manage'
|
|
import moment from 'moment'
|
|
import { cloneDeep } from 'lodash'
|
|
import SampleDataMixin from '../../SampleDataMixin'
|
|
|
|
const columns = [
|
|
{
|
|
title: 'SampleID',
|
|
align: 'center',
|
|
dataIndex: 'sampleId',
|
|
},
|
|
{
|
|
title: 'Station',
|
|
align: 'center',
|
|
dataIndex: 'stationName',
|
|
width: 80,
|
|
},
|
|
{
|
|
title: 'Detector',
|
|
align: 'center',
|
|
dataIndex: 'detectorsName',
|
|
width: 110,
|
|
},
|
|
{
|
|
title: 'Sample',
|
|
align: 'center',
|
|
dataIndex: 'sampleType',
|
|
width: 65,
|
|
},
|
|
{
|
|
title: 'DataType',
|
|
align: 'center',
|
|
dataIndex: 'dataType',
|
|
},
|
|
{
|
|
title: 'Qualifier',
|
|
align: 'center',
|
|
dataIndex: 'spectralQualifie',
|
|
},
|
|
{
|
|
title: 'Col.Stop',
|
|
align: 'center',
|
|
dataIndex: 'collectStop',
|
|
sorter: true,
|
|
width: 170,
|
|
},
|
|
{
|
|
title: 'Acq.Start',
|
|
align: 'center',
|
|
dataIndex: 'acquisitionStart',
|
|
width: 170,
|
|
},
|
|
{
|
|
title: 'Acq.real',
|
|
align: 'center',
|
|
dataIndex: 'acquisitionRealSec',
|
|
width: 100,
|
|
},
|
|
{
|
|
title: 'Acq.live',
|
|
align: 'center',
|
|
dataIndex: 'acquisitionLiveSec',
|
|
width: 100,
|
|
},
|
|
{
|
|
title: 'Analyst',
|
|
align: 'center',
|
|
dataIndex: 'analyst',
|
|
width: 110,
|
|
},
|
|
{
|
|
title: 'Status',
|
|
align: 'center',
|
|
dataIndex: 'status',
|
|
},
|
|
]
|
|
|
|
export default {
|
|
mixins: [JeecgListMixin, SampleDataMixin],
|
|
data() {
|
|
this.columns = cloneDeep(columns)
|
|
this.disableMixinCreated = true
|
|
return {
|
|
visible: false,
|
|
loadType: 'db',
|
|
queryParam: {
|
|
menuTypes: 'G,B',
|
|
sampleType: '',
|
|
stationName: '',
|
|
startDate: moment().add(-30, 'd').format('YYYY-MM-DD'),
|
|
endDate: moment().format('YYYY-MM-DD'),
|
|
dbName: 'auto',
|
|
spectralQualifie: 'FULL',
|
|
checkboxGroup: ['AcqStartB'],
|
|
},
|
|
selectedRowKeys: [],
|
|
selectionRows: [],
|
|
|
|
stationList: [],
|
|
detectorList: [],
|
|
sampleTypeOption: [
|
|
{
|
|
label: 'P',
|
|
value: 'P',
|
|
},
|
|
{
|
|
label: 'B',
|
|
value: 'B',
|
|
},
|
|
{
|
|
label: 'G',
|
|
value: 'G',
|
|
},
|
|
],
|
|
}
|
|
},
|
|
created() {
|
|
this.getStationAndDetectorList()
|
|
},
|
|
methods: {
|
|
searchQuery() {
|
|
this.loadData(1)
|
|
this.selectedRowKeys = []
|
|
this.selectionRows = []
|
|
},
|
|
|
|
loadData(arg) {
|
|
const params = this.getQueryParams() //查询条件
|
|
const { startDate, endDate, menuTypes } = params
|
|
if (!menuTypes) {
|
|
this.$message.warn('Please Select SampleType First')
|
|
return
|
|
}
|
|
|
|
if (!startDate || !endDate) {
|
|
this.$message.warn(`'From' Date And 'To' Date Cannot Be Null`)
|
|
return
|
|
}
|
|
|
|
if (moment(startDate).isAfter(moment(endDate))) {
|
|
this.$message.warn(`'From' Date Cannot Be Late Than 'To' Date`)
|
|
return
|
|
}
|
|
|
|
//加载数据 若传入参数1则加载第一页的内容
|
|
if (arg === 1) {
|
|
this.ipagination.current = 1
|
|
}
|
|
|
|
params.AllUsers = this.allUsersValue
|
|
params.CollectStopB = this.collectStopValue
|
|
params.AcqStartB = this.acqStartValue
|
|
delete params.checkboxGroup
|
|
|
|
this.onClearSelected()
|
|
|
|
this.loading = true
|
|
getAction(this.url.list, params)
|
|
.then((res) => {
|
|
if (res.success) {
|
|
const result = res.result.records || res.result
|
|
result.forEach((item) => {
|
|
const fileName = item.inputFileName
|
|
if (fileName) {
|
|
const arr = fileName.split('/')
|
|
item.inputFileName = arr[arr.length - 1]
|
|
}
|
|
})
|
|
|
|
this.dataSource = result
|
|
|
|
if (res.result.total) {
|
|
this.ipagination.total = res.result.total
|
|
} else {
|
|
this.ipagination.total = 0
|
|
}
|
|
} else {
|
|
this.$message.warning(res.message)
|
|
}
|
|
})
|
|
.finally(() => {
|
|
this.loading = false
|
|
})
|
|
},
|
|
|
|
// 显示弹窗
|
|
show(loadType) {
|
|
if (loadType !== this.loadType) {
|
|
this.dataSource = []
|
|
this.ipagination.total = 0
|
|
}
|
|
|
|
this.loadType = loadType
|
|
this.visible = true
|
|
this.columns = cloneDeep(columns)
|
|
|
|
if (loadType != 'db') {
|
|
this.columns.splice(10, 1)
|
|
|
|
const { inputFileName, sampleType } = this.sampleData
|
|
|
|
this.queryParam.menuTypes = 'G'
|
|
if (!this.queryParam.checkboxGroup.includes('AllUsers')) {
|
|
// 选中All Users
|
|
this.queryParam.checkboxGroup.push('AllUsers')
|
|
}
|
|
|
|
this.queryParam.detectorsName = undefined
|
|
this.queryParam.sampleType = sampleType
|
|
this.queryParam.dbName = 'auto'
|
|
const index = inputFileName.indexOf('_')
|
|
setTimeout(() => {
|
|
// 防止AllUsers变化时触发getStationAndDetectorList方法导致stationName置空
|
|
this.queryParam.stationName = inputFileName.slice(0, index)
|
|
}, 100)
|
|
}
|
|
},
|
|
|
|
/**
|
|
* 加载
|
|
*/
|
|
handleLoad() {
|
|
if (!this.selectedRowKeys.length) {
|
|
this.$message.warn('Please Select Sample To Load')
|
|
return
|
|
}
|
|
this.selectedRowKeys = []
|
|
this.visible = false
|
|
this.$emit('loadSample', {
|
|
sampleList: cloneDeep(this.selectionRows),
|
|
loadType: this.loadType,
|
|
})
|
|
},
|
|
|
|
// 获取台站和探测器列表
|
|
async getStationAndDetectorList() {
|
|
try {
|
|
this.stationList = []
|
|
this.detectorList = []
|
|
this.queryParam.stationName = undefined
|
|
this.queryParam.detectorsName = undefined
|
|
|
|
const { success, result, message } = await getAction('/spectrumAnalysis/getDBSearchList', {
|
|
AllUsers: this.allUsersValue,
|
|
})
|
|
if (success) {
|
|
this.stationList = result.stationCode.map((item) => ({ label: item, value: item }))
|
|
this.allDetectorList = result.detectorCode.map((item) => ({ label: item, value: item }))
|
|
} else {
|
|
this.$message.error(message)
|
|
}
|
|
} catch (error) {
|
|
console.error(error)
|
|
}
|
|
},
|
|
|
|
// 重置搜索栏
|
|
handleReset() {
|
|
this.$refs.searchFormRef.$refs.form.resetFields()
|
|
this.getStationAndDetectorList()
|
|
},
|
|
|
|
filterOption(input, option) {
|
|
return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
|
},
|
|
},
|
|
computed: {
|
|
url() {
|
|
return {
|
|
list: this.loadType == 'db' ? '/spectrumAnalysis/getDBSpectrumList' : '/gamma/loadSampleData',
|
|
}
|
|
},
|
|
formItems() {
|
|
return [
|
|
{
|
|
label: 'SampleType',
|
|
type: 'custom-select',
|
|
name: 'menuTypes',
|
|
props: {
|
|
options: [
|
|
{
|
|
label: 'All',
|
|
value: 'G,B',
|
|
},
|
|
{
|
|
label: 'Gamma',
|
|
value: 'G',
|
|
},
|
|
{
|
|
label: 'Beta',
|
|
value: 'B',
|
|
},
|
|
],
|
|
allowClear: true,
|
|
disabled: this.loadType !== 'db',
|
|
},
|
|
style: {
|
|
width: '18%',
|
|
},
|
|
on: {
|
|
change: (event) => {
|
|
console.log('event', event)
|
|
if (!event) {
|
|
this.stationList = []
|
|
this.detectorList = []
|
|
return
|
|
}
|
|
let arr_B = [
|
|
{
|
|
label: 'B',
|
|
value: 'B',
|
|
},
|
|
]
|
|
let arr_G = [
|
|
{
|
|
label: 'P',
|
|
value: 'P',
|
|
},
|
|
{
|
|
label: 'G',
|
|
value: 'G',
|
|
},
|
|
]
|
|
let arr_A = [
|
|
{
|
|
label: 'P',
|
|
value: 'P',
|
|
},
|
|
{
|
|
label: 'B',
|
|
value: 'B',
|
|
},
|
|
{
|
|
label: 'G',
|
|
value: 'G',
|
|
},
|
|
]
|
|
if (event == 'B') {
|
|
this.sampleTypeOption = arr_B
|
|
this.$nextTick(() => {
|
|
this.queryParam.sampleType = 'B'
|
|
})
|
|
} else if (event == 'G') {
|
|
this.sampleTypeOption = arr_G
|
|
this.$nextTick(() => {
|
|
this.queryParam.sampleType = 'P'
|
|
})
|
|
} else {
|
|
this.sampleTypeOption = arr_A
|
|
this.$nextTick(() => {
|
|
this.queryParam.sampleType = ''
|
|
})
|
|
}
|
|
},
|
|
},
|
|
},
|
|
{
|
|
label: 'Station',
|
|
type: 'custom-select',
|
|
name: 'stationName',
|
|
props: {
|
|
options: this.stationList,
|
|
showSearch: true,
|
|
filterOption: this.filterOption,
|
|
allowClear: true,
|
|
disabled: this.loadType !== 'db',
|
|
},
|
|
style: {
|
|
width: '19%',
|
|
},
|
|
on: {
|
|
change: (val) => {
|
|
if (val) {
|
|
this.detectorList = this.allDetectorList.filter((item) => {
|
|
return item.label.includes(val)
|
|
})
|
|
} else {
|
|
this.detectorList = []
|
|
}
|
|
this.queryParam.detectorsName = undefined
|
|
},
|
|
},
|
|
},
|
|
{
|
|
label: 'Detector',
|
|
type: 'custom-select',
|
|
name: 'detectorsName',
|
|
props: {
|
|
options: this.detectorList,
|
|
showSearch: true,
|
|
filterOption: this.filterOption,
|
|
allowClear: true,
|
|
disabled: this.loadType !== 'db',
|
|
},
|
|
style: {
|
|
width: '19%',
|
|
},
|
|
},
|
|
{
|
|
label: 'Sample',
|
|
type: 'custom-select',
|
|
name: 'sampleType',
|
|
props: {
|
|
options: this.sampleTypeOption,
|
|
allowClear: true,
|
|
disabled: this.loadType !== 'db',
|
|
},
|
|
style: {
|
|
width: '14%',
|
|
},
|
|
},
|
|
{
|
|
label: 'DataType',
|
|
type: 'custom-select',
|
|
name: 'dataType',
|
|
props: {
|
|
options: [
|
|
{
|
|
label: 'S',
|
|
value: 'S',
|
|
},
|
|
{
|
|
label: 'G',
|
|
value: 'G',
|
|
},
|
|
{
|
|
label: 'D',
|
|
value: 'D',
|
|
},
|
|
{
|
|
label: 'Q',
|
|
value: 'Q',
|
|
},
|
|
{
|
|
label: 'B',
|
|
value: 'B',
|
|
},
|
|
{
|
|
label: 'C',
|
|
value: 'C',
|
|
},
|
|
],
|
|
allowClear: true,
|
|
},
|
|
style: {
|
|
width: '14%',
|
|
},
|
|
},
|
|
{
|
|
label: 'Qualifier',
|
|
type: 'custom-select',
|
|
name: 'spectralQualifie',
|
|
props: {
|
|
options: [
|
|
{
|
|
label: 'FULL',
|
|
value: 'FULL',
|
|
},
|
|
{
|
|
label: 'PREL',
|
|
value: 'PREL',
|
|
},
|
|
],
|
|
allowClear: true,
|
|
},
|
|
style: {
|
|
width: '16%',
|
|
paddingRight: 0,
|
|
},
|
|
},
|
|
{
|
|
label: 'SampleID',
|
|
type: 'a-input',
|
|
name: 'sampleId',
|
|
props: {
|
|
allowClear: true,
|
|
},
|
|
style: {
|
|
width: '207px',
|
|
},
|
|
},
|
|
{
|
|
label: '',
|
|
type: 'a-checkbox-group',
|
|
name: 'checkboxGroup',
|
|
props: {
|
|
options: [
|
|
{ label: 'All User', value: 'AllUsers', disabled: this.loadType !== 'db' },
|
|
{ label: 'Collect Stop', value: 'CollectStopB' },
|
|
{ label: 'Acq.Start', value: 'AcqStartB' },
|
|
],
|
|
},
|
|
style: {
|
|
width: '305px',
|
|
paddingRight: 0,
|
|
},
|
|
},
|
|
{
|
|
label: 'From',
|
|
type: 'custom-date-picker',
|
|
name: 'startDate',
|
|
props: {
|
|
format: 'YYYY-MM-DD',
|
|
valueFormat: 'YYYY-MM-DD',
|
|
style: {
|
|
minWidth: 'auto',
|
|
},
|
|
},
|
|
style: {
|
|
width: '16%',
|
|
},
|
|
},
|
|
{
|
|
label: 'To',
|
|
type: 'custom-date-picker',
|
|
name: 'endDate',
|
|
props: {
|
|
format: 'YYYY-MM-DD',
|
|
valueFormat: 'YYYY-MM-DD',
|
|
style: {
|
|
minWidth: 'auto',
|
|
},
|
|
},
|
|
style: {
|
|
paddingRight: 0,
|
|
marginRight: '8px',
|
|
width: '13%',
|
|
},
|
|
},
|
|
{
|
|
label: 'Status',
|
|
type: 'custom-select',
|
|
name: 'status',
|
|
props: {
|
|
options: [
|
|
{
|
|
label: 'U',
|
|
value: 'U',
|
|
},
|
|
{
|
|
label: 'A',
|
|
value: 'A',
|
|
},
|
|
{
|
|
label: 'P',
|
|
value: 'P',
|
|
},
|
|
{
|
|
label: 'R',
|
|
value: 'R',
|
|
},
|
|
{
|
|
label: 'F',
|
|
value: 'F',
|
|
},
|
|
],
|
|
allowClear: true,
|
|
},
|
|
style: {
|
|
width: '14%',
|
|
|
|
marginRight: '10px',
|
|
},
|
|
},
|
|
]
|
|
},
|
|
|
|
allUsersValue() {
|
|
const checkboxGroup = this.queryParam.checkboxGroup
|
|
return !!(checkboxGroup && checkboxGroup.includes('AllUsers'))
|
|
},
|
|
|
|
collectStopValue() {
|
|
const checkboxGroup = this.queryParam.checkboxGroup
|
|
return !!(checkboxGroup && checkboxGroup.includes('CollectStopB'))
|
|
},
|
|
|
|
acqStartValue() {
|
|
const checkboxGroup = this.queryParam.checkboxGroup
|
|
return !!(checkboxGroup && checkboxGroup.includes('AcqStartB'))
|
|
},
|
|
},
|
|
watch: {
|
|
// All User 变化时重新获取station 和detector
|
|
allUsersValue() {
|
|
if (this.queryParam.menuTypes) {
|
|
this.stationList = []
|
|
this.detectorList = []
|
|
this.getStationAndDetectorList(this.queryParam.menuTypes)
|
|
}
|
|
},
|
|
},
|
|
}
|
|
</script>
|
|
|
|
<style lang="less" scoped>
|
|
.load-from-db-modal {
|
|
::v-deep {
|
|
.search-btn {
|
|
display: none;
|
|
}
|
|
}
|
|
}
|
|
</style>
|