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 @@
</el-dropdown> </el-dropdown>
</div> </div>
</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> </div>
</template> </template>
@ -121,14 +114,9 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.new-breadcrumb {
height: 50px;
display: flex;
//background: rgba(20, 123, 227, 0.3);
}
.navbar { .navbar {
height: 100px; height: 50px;
overflow: hidden; overflow: hidden;
position: relative; position: relative;
background: #fff; background: #fff;

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

@ -1,6 +1,17 @@
<template> <template>
<div class="app-container rtudatacls"> <div class="app-container rtudatacls">
<el-tabs v-model="queryParams.itemCode" @tab-click="handleClick" type="border-card"> <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-tab-pane v-for="data in tabsList" :label="data.item" :name="data.itemCode">
<el-table v-loading="loading" :data="rtudataList" border> <el-table v-loading="loading" :data="rtudataList" border>
<el-table-column label="序号" align="center"> <el-table-column label="序号" align="center">
@ -40,6 +51,8 @@
</template> </template>
<script> <script>
import {formatDate} from "@/utils/common";
export default { export default {
name: "Rtudata", name: "Rtudata",
data() { data() {
@ -59,6 +72,33 @@ export default {
// //
rtudataList: [], rtudataList: [],
tabsList: [], 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: "", title: "",
// //
@ -68,6 +108,8 @@ export default {
page: 1, page: 1,
limit: 10, limit: 10,
itemCode: null, itemCode: null,
startTime: null,
endTime: null,
}, },
// //
form: {}, form: {},
@ -77,10 +119,16 @@ export default {
}; };
}, },
created() { created() {
this.getTime();
this.getTabsList(); this.getTabsList();
}, },
methods: { methods: {
handleClick() { handleClick() {
if(this.timeStage == null || this.timeStage.length == 0 ){
this.$modal.msg("请选择时间");
return;
}
this.queryParams.page = 1;
this.getList(); this.getList();
}, },
/** 查询标签列表 */ /** 查询标签列表 */
@ -95,6 +143,10 @@ export default {
/** 查询数据列表列表 */ /** 查询数据列表列表 */
async getList() { async getList() {
if(this.timeStage == null || this.timeStage.length == 0 ){
this.$modal.msg("请选择时间");
return;
}
this.loading = true; this.loading = true;
let res = await this.$axiosGet('/rtudata/rtudata/list',this.queryParams); let res = await this.$axiosGet('/rtudata/rtudata/list',this.queryParams);
if(res.code === 0){ if(res.code === 0){
@ -103,12 +155,41 @@ export default {
} }
this.loading = false; 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() { handleQuery() {
this.queryParams.page = 1; this.queryParams.page = 1;
this.getList(); this.handleClick();
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */

Loading…
Cancel
Save