This commit is contained in:
xiaoguangbin 2023-11-01 11:04:17 +08:00
commit 9e1377d5df
2 changed files with 87 additions and 56 deletions

View File

@ -1,18 +1,18 @@
<template> <template>
<div style="height: 100%;"> <div style="height: 100%">
<List :stationList="stationList" :columns="columns" :dataType="dataType" fileName="DETBKPHD" pageType="ACQ"></List> <List :stationList="stationList" :columns="columns" :dataType="dataType" fileName="DETBKPHD" pageType="ACQ"></List>
</div> </div>
</template> </template>
<script> <script>
import List from "../../../list.vue" import List from '../../../list.vue'
import { getAction } from '../../../../../api/manage' import { getAction } from '../../../../../api/manage'
const columns = [ const columns = [
{ {
title: 'NO', title: 'NO',
align: 'left', align: 'left',
width:80, width: 80,
scopedSlots: { scopedSlots: {
customRender: 'index', customRender: 'index',
}, },
@ -68,24 +68,23 @@ export default {
}, },
stationList: [], stationList: [],
columns, columns,
dataType:"D" dataType: 'D',
} }
}, },
mounted() { mounted() {
console.log(this.dataType); this.findStationList()
this.findStationList();
}, },
methods: { methods: {
findStationList() { findStationList() {
getAction(this.url.findStationList, { menuName: 'Particulate' }).then((res) => { getAction(this.url.findStationList, { menuName: 'Particulate' }).then((res) => {
if (res.success) { if (res.success) {
if (res.result.length>0) { if (res.result.length > 0) {
this.stationList = res.result.map((res) => ({ label: res.stationCode, value: res.stationId })) this.stationList = res.result.map((res) => ({ label: res.stationCode, value: res.stationId }))
} else { } else {
this.stationList=[] this.stationList = []
} }
} else { } else {
this.$message.warning("This operation fails. Contact your system administrator") this.$message.warning('This operation fails. Contact your system administrator')
} }
}) })
}, },
@ -94,5 +93,4 @@ export default {
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
</style> </style>

View File

@ -1,5 +1,5 @@
<template> <template>
<div style="height: 100%;"> <div style="height: 100%">
<a-spin :spinning="spinning"> <a-spin :spinning="spinning">
<a-card v-if="!isDetail" :bordered="false" style="margin-left: 20px"> <a-card v-if="!isDetail" :bordered="false" style="margin-left: 20px">
<search-form :items="formItems" v-model="queryParam" @search="searchQueryData"> <search-form :items="formItems" v-model="queryParam" @search="searchQueryData">
@ -32,54 +32,67 @@
</div> </div>
</template> </template>
<script> <script>
import { JeecgListMixin } from '@/mixins/JeecgListMixin' import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import { getAction,getFileAction } from '../../api/manage' import { getAction, getFileAction } from '../../api/manage'
import dateFormat from '../../components/jeecg/JEasyCron/format-date' import dateFormat from '../../components/jeecg/JEasyCron/format-date'
import Detail from "./detail.vue" import Detail from './detail.vue'
export default { export default {
name: 'menuTree', name: 'menuTree',
props: { props: {
stationList: { stationList: {
type: Array, type: Array,
default: ()=>[] default: () => [],
}, },
columns: { columns: {
type: Array, type: Array,
default: ()=>[] default: () => [],
}, },
dataType: { dataType: {
type: String, type: String,
default:"" default: '',
}, },
fileName: { fileName: {
type: String, type: String,
default:"" default: '',
}, },
spectralQualifie: { spectralQualifie: {
type: String, type: String,
default:"" default: '',
}, },
pageType: { pageType: {
type: String, type: String,
default:"" default: '',
} },
}, },
mixins: [JeecgListMixin], mixins: [JeecgListMixin],
components: { components: {
Detail, Detail,
}, },
watch: {
fileName: {
handler: function (val) {
if (val === 'QCPHD' || val === 'SPHDF' || val === 'SPHDP') {
console.log(56, this)
console.log(this.getBeforeDate(6))
this.$nextTick(() => {
this.queryParam.startTime = this.getBeforeDate(6)
})
}
},
immediate: true,
},
},
data() { data() {
return { return {
spinning: false, spinning: false,
isImmediate:true, isImmediate: true,
isDetail:false, isDetail: false,
queryParam: { queryParam: {
dataType: this.dataType, dataType: this.dataType,
startTime: dateFormat(new Date(), 'yyyy-MM-dd'), startTime: dateFormat(new Date(), 'yyyy-MM-dd'),
endTime: dateFormat(new Date(), 'yyyy-MM-dd'), endTime: dateFormat(new Date(), 'yyyy-MM-dd'),
stationIds: [], stationIds: [],
spectralQualifie:this.spectralQualifie spectralQualifie: this.spectralQualifie,
}, },
url: { url: {
list: '/webStatistics/findParticulatePage', list: '/webStatistics/findParticulatePage',
@ -90,21 +103,21 @@ export default {
dataSource: [], dataSource: [],
detailJson: {}, detailJson: {},
allChecked: false, allChecked: false,
currSampleId:"" currSampleId: '',
} }
}, },
methods: { methods: {
handleExcel() { handleExcel() {
if (this.dataSource.length>0) { if (this.dataSource.length > 0) {
let params = { let params = {
...this.queryParam, ...this.queryParam,
pageType:this.pageType pageType: this.pageType,
} }
getFileAction("/webStatistics/radionuclideExport", params).then(res => { getFileAction('/webStatistics/radionuclideExport', params).then((res) => {
if (res.code && res.code == 500) { if (res.code && res.code == 500) {
this.$message.warning("This operation fails. Contact your system administrator") this.$message.warning('This operation fails. Contact your system administrator')
} else { } else {
const blob = new Blob([res], { type: "application/vnd.ms-excel" }) const blob = new Blob([res], { type: 'application/vnd.ms-excel' })
let link = document.createElement('a') let link = document.createElement('a')
link.href = window.URL.createObjectURL(blob) link.href = window.URL.createObjectURL(blob)
link.download = this.fileName link.download = this.fileName
@ -115,7 +128,7 @@ export default {
} }
}) })
} else { } else {
this.$message.warning("No downloadable data") this.$message.warning('No downloadable data')
} }
}, },
searchQueryData() { searchQueryData() {
@ -124,7 +137,7 @@ export default {
let params = { let params = {
...this.queryParam, ...this.queryParam,
pageNo: 1, pageNo: 1,
pageSize: 10 pageSize: 10,
} }
getAction(this.url.list, params).then((res) => { getAction(this.url.list, params).then((res) => {
this.loading = false this.loading = false
@ -134,25 +147,27 @@ export default {
this.ipagination.total = res.result.total this.ipagination.total = res.result.total
this.dataSource = res.result.records this.dataSource = res.result.records
} else { } else {
this.$message.warning("This operation fails. Contact your system administrator") this.$message.warning('This operation fails. Contact your system administrator')
} }
}) })
}, },
handleDetail(record) { handleDetail(record) {
this.spinning = true this.spinning = true
this.currSampleId = record.sampleId this.currSampleId = record.sampleId
getAction("webStatistics/findGeneratedReport", { sampleId: record.sampleId }).then(res => { getAction('webStatistics/findGeneratedReport', { sampleId: record.sampleId })
this.spinning = false .then((res) => {
if (res.success){ this.spinning = false
this.detailJson = res.result if (res.success) {
this.detailJson = JSON.parse(JSON.stringify(this.detailJson)) this.detailJson = res.result
this.isDetail = true this.detailJson = JSON.parse(JSON.stringify(this.detailJson))
} else { this.isDetail = true
this.$message.warning("This operation fails. Contact your system administrator") } else {
} this.$message.warning('This operation fails. Contact your system administrator')
}).catch(err => { }
this.spinning = false })
}) .catch((err) => {
this.spinning = false
})
}, },
handleBack(flag) { handleBack(flag) {
this.isDetail = flag this.isDetail = flag
@ -168,15 +183,35 @@ export default {
handleSelectChangeAll(val) { handleSelectChangeAll(val) {
this.allChecked = val this.allChecked = val
if (val) { if (val) {
this.queryParam.stationIds = this.stationList.map(item => item.value) this.queryParam.stationIds = this.stationList.map((item) => item.value)
} else { } else {
this.queryParam.stationIds =[] this.queryParam.stationIds = []
} }
}, },
filterOption(input, option) { filterOption(input, option) {
return ( return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0 },
); // n
getBeforeDate(n) {
var n = n
var d = new Date()
var year = d.getFullYear()
var mon = d.getMonth() + 1
var day = d.getDate()
if (day <= n) {
if (mon > 1) {
mon = mon - 1
} else {
year = year - 1
mon = 12
}
}
d.setDate(d.getDate() - n)
year = d.getFullYear()
mon = d.getMonth() + 1
day = d.getDate()
var s = year + '-' + (mon < 10 ? '0' + mon : mon) + '-' + (day < 10 ? '0' + day : day)
return s
}, },
}, },
computed: { computed: {
@ -202,20 +237,18 @@ export default {
name: 'stationIds', name: 'stationIds',
props: { props: {
allChecked: this.allChecked, allChecked: this.allChecked,
filterOption:this.filterOption, filterOption: this.filterOption,
placeholder: 'select stations', placeholder: 'select stations',
mode: 'multiple', mode: 'multiple',
maxTagCount: 1, maxTagCount: 1,
options: [ options: [...this.stationList],
...this.stationList,
],
style: { style: {
width: '200px', width: '200px',
}, },
}, },
on: { on: {
change: this.handleSelectChange, change: this.handleSelectChange,
changeAll: this.handleSelectChangeAll changeAll: this.handleSelectChangeAll,
}, },
style: { style: {
width: 'auto', width: 'auto',
@ -259,7 +292,7 @@ export default {
} }
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.icon-edit{ .icon-edit {
margin-right: 10px; margin-right: 10px;
} }
</style> </style>