287 lines
7.4 KiB
Vue
287 lines
7.4 KiB
Vue
<template>
|
|
<div style="height: 100%;">
|
|
<a-card v-if="!isFileDetail" :bordered="false" style="margin-left: 20px">
|
|
<search-form :items="formItems" v-model="queryParam" @search="searchQueryData">
|
|
<a-space style="float: right" class="btn-group" slot="additional">
|
|
<a-button @click="handleExcel" type="primary">
|
|
<img class="icon-edit" src="@/assets/images/global/edit.png" alt="" />
|
|
Excel
|
|
</a-button>
|
|
</a-space>
|
|
</search-form>
|
|
<custom-table
|
|
size="middle"
|
|
rowKey="sampleId"
|
|
:columns="columns"
|
|
:list="dataSource"
|
|
:pagination="ipagination"
|
|
:loading="loading"
|
|
@change="handleTableChange"
|
|
@detail="handleDetail"
|
|
>
|
|
<template slot="index" slot-scope="{ index }">
|
|
{{ index + 1 }}
|
|
</template>
|
|
</custom-table>
|
|
</a-card>
|
|
<FileDetail v-if="isFileDetail" type="soh" :sampleId="currSampleId" @back="handleBack"></FileDetail>
|
|
</div>
|
|
</template>
|
|
<script>
|
|
const columns = [
|
|
{
|
|
title: 'NO',
|
|
align: 'left',
|
|
scopedSlots: {
|
|
customRender: 'index',
|
|
},
|
|
customHeaderCell: () => {
|
|
return {
|
|
style: {
|
|
'padding-left': '26px !important',
|
|
},
|
|
}
|
|
},
|
|
customCell: () => {
|
|
return {
|
|
style: {
|
|
'padding-left': '26px !important',
|
|
},
|
|
}
|
|
},
|
|
},
|
|
{
|
|
title: 'STATION',
|
|
align: 'left',
|
|
dataIndex: 'stationCode',
|
|
},
|
|
{
|
|
title: 'START TIME',
|
|
align: 'left',
|
|
dataIndex: 'startTime',
|
|
},
|
|
{
|
|
title: 'END TIME',
|
|
align: 'left',
|
|
dataIndex: 'endTime',
|
|
},
|
|
{
|
|
title: 'SID',
|
|
align: 'left',
|
|
dataIndex: 'sohId',
|
|
}
|
|
]
|
|
import { compareDate } from "../../commom"
|
|
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
|
|
import { getAction, getFileAction } from '../../../../api/manage'
|
|
import dateFormat from '../../../../components/jeecg/JEasyCron/format-date'
|
|
import FileDetail from "../../fileDetail.vue"
|
|
export default {
|
|
name: 'menuTree',
|
|
mixins: [JeecgListMixin],
|
|
components: {
|
|
FileDetail,
|
|
},
|
|
data() {
|
|
return {
|
|
isImmediate:true,
|
|
columns,
|
|
queryParam: {
|
|
startTime: dateFormat(new Date(), 'yyyy-MM-dd'),
|
|
endTime: dateFormat(new Date(), 'yyyy-MM-dd'),
|
|
stationIds: []
|
|
},
|
|
url: {
|
|
list: '/webStatistics/findSohPage',
|
|
delete: '/gardsSampleData/deleteById',
|
|
findStationList: '/webStatistics/findStationList',
|
|
findParticulatePage: '/jeecg-web-statistics/webStatistics/findParticulatePage',
|
|
},
|
|
stationList: [],
|
|
dataSource: [],
|
|
strIds: "",
|
|
allChecked: false,
|
|
isFileDetail: false,
|
|
currSampleId:""
|
|
}
|
|
},
|
|
created() {
|
|
this.findStationList()
|
|
},
|
|
methods: {
|
|
handleExcel() {
|
|
if (this.dataSource.length>0) {
|
|
let params = {
|
|
...this.queryParam,
|
|
}
|
|
getFileAction("/webStatistics/sohExport", params).then(res => {
|
|
if (res.code && res.code == 500) {
|
|
this.$message.warning("This operation fails. Contact your system administrator")
|
|
} else {
|
|
const blob = new Blob([res], { type: "application/vnd.ms-excel" })
|
|
let link = document.createElement('a')
|
|
link.href = window.URL.createObjectURL(blob)
|
|
link.download = "RMSSOH"
|
|
document.body.appendChild(link)
|
|
link.click()
|
|
URL.revokeObjectURL(link.href)
|
|
document.body.removeChild(link)
|
|
}
|
|
})
|
|
} else {
|
|
this.$message.warning("No downloadable data")
|
|
}
|
|
},
|
|
handleBack(flag) {
|
|
this.isFileDetail = flag
|
|
},
|
|
handleDetail(record) {
|
|
console.log(record);
|
|
this.currSampleId = record.sohId
|
|
this.isFileDetail = true
|
|
},
|
|
searchQueryData() {
|
|
this.loading = true
|
|
let days = compareDate(this.queryParam.startTime, this.queryParam.endTime)
|
|
if (days <= 10) {
|
|
this.isImmediate = false
|
|
// this.queryParam = {
|
|
// startTime: "2023-01-01",
|
|
// endTime: "2023-07-10",
|
|
// stationIds: [209, 210]
|
|
// }
|
|
let params = {
|
|
...this.queryParam,
|
|
pageNo: 1,
|
|
pageSize: 10
|
|
}
|
|
getAction(this.url.list, params).then((res) => {
|
|
this.loading = false
|
|
if (res.success) {
|
|
this.ipagination.current = res.result.current
|
|
this.ipagination.pageSize = res.result.size
|
|
this.ipagination.total = res.result.total
|
|
this.dataSource = res.result.records
|
|
} else {
|
|
this.$message.warning("This operation fails. Contact your system administrator")
|
|
}
|
|
})
|
|
} else {
|
|
this.$message.info("Maximum timespan duration is 10 days. Please, change start or end date.")
|
|
}
|
|
},
|
|
findStationList() {
|
|
getAction(this.url.findStationList, { menuName: '' }).then((res) => {
|
|
if (res.success) {
|
|
if (res.result.length>0) {
|
|
this.stationList = res.result.map((res) => ({ label: res.stationCode, value: res.stationId }))
|
|
} else {
|
|
this.stationList=[]
|
|
}
|
|
} else {
|
|
this.$message.warning("This operation fails. Contact your system administrator")
|
|
}
|
|
})
|
|
},
|
|
handleSelectChange(val) {
|
|
console.log(val);
|
|
let length = this.stationList.length
|
|
if (val.length === length) {
|
|
this.allChecked = true
|
|
} else {
|
|
this.allChecked = false
|
|
}
|
|
},
|
|
handleSelectChangeAll(val) {
|
|
this.allChecked = val
|
|
if (val) {
|
|
this.queryParam.stationIds = this.stationList.map(item => item.value)
|
|
} else {
|
|
this.queryParam.stationIds =[]
|
|
}
|
|
}
|
|
},
|
|
computed: {
|
|
formItems() {
|
|
return [
|
|
{
|
|
type: 'a-input',
|
|
label: '',
|
|
name: 'search',
|
|
props: {
|
|
placeholder: 'search...',
|
|
style: {
|
|
width: '166px',
|
|
},
|
|
},
|
|
style: {
|
|
width: 'auto',
|
|
},
|
|
},
|
|
{
|
|
type: 'custom-all-select',
|
|
label: 'Stations',
|
|
name: 'stationIds',
|
|
props: {
|
|
allChecked:this.allChecked,
|
|
placeholder: 'select stations',
|
|
mode: 'multiple',
|
|
maxTagCount: 1,
|
|
options: [
|
|
...this.stationList,
|
|
],
|
|
style: {
|
|
width: '200px',
|
|
},
|
|
},
|
|
on: {
|
|
change: this.handleSelectChange,
|
|
changeAll: this.handleSelectChangeAll
|
|
},
|
|
style: {
|
|
width: 'auto',
|
|
},
|
|
},
|
|
{
|
|
label: 'Start date',
|
|
type: 'custom-date-picker',
|
|
name: 'startTime',
|
|
props: {
|
|
format: 'YYYY-MM-DD',
|
|
valueFormat: 'YYYY-MM-DD',
|
|
style: {
|
|
minWidth: 'auto',
|
|
width: '200px',
|
|
},
|
|
},
|
|
style: {
|
|
width: 'auto',
|
|
},
|
|
},
|
|
{
|
|
label: 'End date',
|
|
type: 'custom-date-picker',
|
|
name: 'endTime',
|
|
props: {
|
|
format: 'YYYY-MM-DD',
|
|
valueFormat: 'YYYY-MM-DD',
|
|
style: {
|
|
minWidth: 'auto',
|
|
width: '200px',
|
|
},
|
|
},
|
|
style: {
|
|
width: 'auto',
|
|
},
|
|
},
|
|
]
|
|
},
|
|
},
|
|
}
|
|
</script>
|
|
<style lang="less" scoped>
|
|
.icon-edit{
|
|
margin-right: 10px;
|
|
}
|
|
</style>
|
|
|