202 lines
		
	
	
		
			5.2 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
			
		
		
	
	
			202 lines
		
	
	
		
			5.2 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
| <template>
 | |
|   <div style="height: 100%;">
 | |
|     <a-card v-if="!isDetail" :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="handleEdit" type="primary">
 | |
|             <img 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"
 | |
|         :selectedRowKeys.sync="selectedRowKeys"
 | |
|         :scroll="{ x: true, y: 'calc(100vh - 410px)' }"
 | |
|       >
 | |
|         <template slot="index" slot-scope="{ index }">
 | |
|           {{ index + 1 }}
 | |
|         </template>
 | |
|       </custom-table>
 | |
|     </a-card>
 | |
|     <Detail v-if="isDetail" :allData="detailJson" @back="handleBack"></Detail>
 | |
|   </div>
 | |
| </template>
 | |
| <script>
 | |
| 
 | |
| import { JeecgListMixin } from '@/mixins/JeecgListMixin'
 | |
| import { getAction } from '../../api/manage'
 | |
| import dateFormat from '../../components/jeecg/JEasyCron/format-date'
 | |
| import Detail from "./detail.vue"
 | |
| export default {
 | |
|   name: 'menuTree',
 | |
|   props: {
 | |
|     stationList: {
 | |
|       type: Array,
 | |
|       default: ()=>[]
 | |
|     },
 | |
|     columns: {
 | |
|       type: Array,
 | |
|       default: ()=>[]
 | |
|     },
 | |
|     dataType: {
 | |
|       type: String,
 | |
|       default:""
 | |
|     }
 | |
|   },
 | |
|   mixins: [JeecgListMixin],
 | |
|   components: {
 | |
|     Detail,
 | |
|   },
 | |
|   data() {
 | |
|     return {
 | |
|       isDetail:false,
 | |
|       queryParam: {
 | |
|         dataType: this.dataType,
 | |
|         startTime: dateFormat(new Date(), 'yyyy-MM-dd'),
 | |
|         endTime: dateFormat(new Date(), 'yyyy-MM-dd'),
 | |
|       },
 | |
|       url: {
 | |
|         list: '/webStatistics/findParticulatePage',
 | |
|         delete: '/gardsSampleData/deleteById',
 | |
|         findStationList: '/webStatistics/findStationList',
 | |
|         findParticulatePage: '/jeecg-web-statistics/webStatistics/findParticulatePage',
 | |
|       },
 | |
|       dataSource: [],
 | |
|       detailJson:{}
 | |
|     }
 | |
|   },
 | |
|   methods: {
 | |
|     searchQueryData() {
 | |
|       console.log("查询数据", this.queryParam);
 | |
|       console.log(this.dataType);
 | |
|       let params = {
 | |
|         dataType: "S",
 | |
|         startTime: "2023-05-01",
 | |
|         endTime: "2023-05-07",
 | |
|         pageNo: 1,
 | |
|         pageSize: 10,
 | |
|         stationIds: ["209", "211", "213"]
 | |
|         // dataType: this.queryParam.dataType||"S",
 | |
|         // startTime: this.queryParam.startTime,
 | |
|         // endTime:this.queryParam.endTime,
 | |
|       }
 | |
|       getAction(this.url.list, params).then((res) => {
 | |
|         console.log("查询数据结果", res);
 | |
|         if (res.success) {
 | |
|           this.dataSource = res.result.records
 | |
|         }
 | |
|       })
 | |
|     },
 | |
|     handleDetail(record) {
 | |
|       // this.isDetail = true
 | |
|       console.log("点击行信息", record);
 | |
|       // 测试接口数据 record.sampleId
 | |
|       getAction("webStatistics/findGeneratedReport", { sampleId: "1523651" }).then(res => {
 | |
|         console.log(res);
 | |
|         if (res.success) {
 | |
|           this.detailJson = res.result
 | |
|           this.detailJson = JSON.parse(JSON.stringify(this.detailJson))
 | |
|           this.isDetail = true
 | |
|         } else {
 | |
|           this.$message.warning(res.message)
 | |
|         }
 | |
|       })
 | |
|     },
 | |
|     handleBack(flag) {
 | |
|       this.isDetail = flag
 | |
|     },
 | |
|     handleTableChange(pagination, filters, sorter, { currentDataSource }) {
 | |
|       console.log(pagination, filters, sorter, { currentDataSource });
 | |
|     }
 | |
|   },
 | |
|   computed: {
 | |
|     formItems() {
 | |
|       return [
 | |
|         {
 | |
|           type: 'a-input',
 | |
|           label: '',
 | |
|           name: 'search',
 | |
|           props: {
 | |
|             placeholder: 'search...',
 | |
|             style: {
 | |
|               width: '166px',
 | |
|             },
 | |
|           },
 | |
|           style: {
 | |
|             width: 'auto',
 | |
|           },
 | |
|         },
 | |
|         {
 | |
|           type: 'custom-select',
 | |
|           label: 'Stations',
 | |
|           name: 'stationIds',
 | |
|           props: {
 | |
|             placeholder: 'select stations',
 | |
|             mode: 'multiple',
 | |
|             maxTagCount: 1,
 | |
|             options: [
 | |
|               {
 | |
|                 label: 'ALL',
 | |
|                 value: '',
 | |
|               },
 | |
|               ...this.stationList,
 | |
|             ],
 | |
|             style: {
 | |
|               width: '200px',
 | |
|             },
 | |
|           },
 | |
|           style: {
 | |
|             width: 'auto',
 | |
|           },
 | |
|         },
 | |
|         {
 | |
|           label: 'Start date',
 | |
|           type: 'custom-date-picker',
 | |
|           name: 'startTime',
 | |
|           props: {
 | |
|             showTime: { format: 'HH:mm' },
 | |
|             format: 'YYYY-MM-DD',
 | |
|             valueFormat: 'YYYY-MM-DD:ss',
 | |
|             style: {
 | |
|               minWidth: 'auto',
 | |
|               width: '200px',
 | |
|             },
 | |
|           },
 | |
|           style: {
 | |
|             width: 'auto',
 | |
|           },
 | |
|         },
 | |
|         {
 | |
|           label: 'End date',
 | |
|           type: 'custom-date-picker',
 | |
|           name: 'endTime',
 | |
|           props: {
 | |
|             showTime: { format: 'HH:mm' },
 | |
|             format: 'YYYY-MM-DD',
 | |
|             valueFormat: 'YYYY-MM-DD:ss',
 | |
|             style: {
 | |
|               minWidth: 'auto',
 | |
|               width: '200px',
 | |
|             },
 | |
|           },
 | |
|           style: {
 | |
|             width: 'auto',
 | |
|           },
 | |
|         },
 | |
|       ]
 | |
|     },
 | |
|   },
 | |
| }
 | |
| </script>
 | |
| <style lang="less" scoped>
 | |
| 
 | |
| </style>
 | |
|    |