Browse Source

优化

master
blank 10 months ago
parent
commit
be9e3b00c4
  1. 16
      src/layout/components/Navbar.vue
  2. 85
      src/views/rtudata/rtudata/index.vue

16
src/layout/components/Navbar.vue

@ -44,14 +44,7 @@ @@ -44,14 +44,7 @@
</el-dropdown>
</div>
</div>
<!-- 自定义面包屑 -->
<div class="new-breadcrumb">
<i
class="el-icon-location-outline"
style="margin-left: 20px; margin-top: 16px"
></i>
<breadcrumb id="breadcrumb-container" class="breadcrumb-container"/>
</div>
</div>
</template>
@ -121,14 +114,9 @@ export default { @@ -121,14 +114,9 @@ export default {
</script>
<style lang="scss" scoped>
.new-breadcrumb {
height: 50px;
display: flex;
//background: rgba(20, 123, 227, 0.3);
}
.navbar {
height: 100px;
height: 50px;
overflow: hidden;
position: relative;
background: #fff;

85
src/views/rtudata/rtudata/index.vue

@ -1,6 +1,17 @@ @@ -1,6 +1,17 @@
<template>
<div class="app-container rtudatacls">
<el-tabs v-model="queryParams.itemCode" @tab-click="handleClick" type="border-card">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="68px">
<el-form-item>
<el-date-picker v-model="timeStage" type="datetimerange" range-separator="" start-placeholder="开始日期"
end-placeholder="结束日期" @change="chooseTimeRange" :picker-options="setDateRange">
</el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-tab-pane v-for="data in tabsList" :label="data.item" :name="data.itemCode">
<el-table v-loading="loading" :data="rtudataList" border>
<el-table-column label="序号" align="center">
@ -40,6 +51,8 @@ @@ -40,6 +51,8 @@
</template>
<script>
import {formatDate} from "@/utils/common";
export default {
name: "Rtudata",
data() {
@ -59,6 +72,33 @@ export default { @@ -59,6 +72,33 @@ export default {
//
rtudataList: [],
tabsList: [],
//
timeStage: [],
// *** data ***
setDateRange: {
//
onPick: ({
maxDate,
minDate
}) => {
if (minDate) { //
this.choiceDate0 = minDate.getTime();
} else { //
this.choiceDate0 = new Date();
}
if (maxDate) {
this.choiceDate0 = '';
}
},
disabledDate: (time) => {
let choiceDateTime = new Date(this.choiceDate0).getTime(); //
if (this.choiceDate0) {
//1514---
//1414*24*3600*1000=1209600000
return (time.getTime() > (choiceDateTime + 7*24*3600*1000)) || (time.getTime() < (choiceDateTime - 7*24*3600*1000));
}
},
},
//
title: "",
//
@ -68,6 +108,8 @@ export default { @@ -68,6 +108,8 @@ export default {
page: 1,
limit: 10,
itemCode: null,
startTime: null,
endTime: null,
},
//
form: {},
@ -77,10 +119,16 @@ export default { @@ -77,10 +119,16 @@ export default {
};
},
created() {
this.getTime();
this.getTabsList();
},
methods: {
handleClick() {
if(this.timeStage == null || this.timeStage.length == 0 ){
this.$modal.msg("请选择时间");
return;
}
this.queryParams.page = 1;
this.getList();
},
/** 查询标签列表 */
@ -95,6 +143,10 @@ export default { @@ -95,6 +143,10 @@ export default {
/** 查询数据列表列表 */
async getList() {
if(this.timeStage == null || this.timeStage.length == 0 ){
this.$modal.msg("请选择时间");
return;
}
this.loading = true;
let res = await this.$axiosGet('/rtudata/rtudata/list',this.queryParams);
if(res.code === 0){
@ -103,12 +155,41 @@ export default { @@ -103,12 +155,41 @@ export default {
}
this.loading = false;
},
/** 设置初始时间*/
getTime() {
var timestamp = new Date();
this.queryParams.endTime = formatDate(timestamp, 'yyyy-MM-dd hh:mm:ss')
this.queryParams.startTime = formatDate(new Date(timestamp.getTime() - 86400 * 1000), ('yyyy-MM-dd hh:mm:ss'));
this.timeStage[0]=this.queryParams.startTime
this.timeStage[1]=this.queryParams.endTime
},
chooseTimeRange() {
if (this.timeStage != null && this.timeStage.length > 0) {
this.queryParams.startTime = formatDate(this.timeStage[0], 'yyyy-MM-dd hh:mm:ss');
this.queryParams.endTime = formatDate(this.timeStage[1], 'yyyy-MM-dd hh:mm:ss');
}
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
var timestamp = new Date();
this.queryParams = {
page: 1,
limit: 10,
endTime : formatDate(timestamp, 'yyyy-MM-dd hh:mm:ss'),
startTime : formatDate(new Date(timestamp.getTime() - 86400 * 1000), ('yyyy-MM-dd hh:mm:ss')),
itemCode : this.tabsList[0].itemCode
};
this.timeStage[0]=this.queryParams.startTime
this.timeStage[1]=this.queryParams.endTime
console.log(this.timeStage)
this.handleQuery();
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.page = 1;
this.getList();
this.handleClick();
},
/** 导出按钮操作 */

Loading…
Cancel
Save