123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313 |
- <template>
- <div>
- <div class="query mg-b-8">
- <div class="query-items">
- <div class="query-item">
- <div class="lable">开始日期:</div>
- <div class="search-input">
- <el-date-picker
- v-model="value1"
- @change="BeginChange(value1)"
- type="date"
- value-format="YYYY-MM-DD"
- placeholder="选择日期"
- popper-class="date-select"
- >
- </el-date-picker>
- </div>
- </div>
- <div class="query-item">
- <div class="lable">结束日期:</div>
- <div class="search-input">
- <el-date-picker
- v-model="value2"
- @change="EndChange(value2)"
- type="date"
- value-format="YYYY-MM-DD"
- placeholder="选择日期"
- popper-class="date-select"
- >
- </el-date-picker>
- <div class="unit svg-icon svg-icon-gray">
- <svg-icon :svgid="''" />
- </div>
- </div>
- </div>
- <div class="query-item">
- <div class="lable">风速:</div>
- <div
- class="newspan"
- v-for="(item, index) of optionData"
- :key="index"
- :class="{ active: cur == index }"
- @click="handleOpen(item, index)"
- >
- {{ item }}
- </div>
- </div>
- </div>
- <div class="query-actions">
- <el-button class="btn green" @click="handleSubmit">计算</el-button>
- </div>
- </div>
- <div class="table-box">
- <div class="title">{{ vshows }}</div>
- <ComTable
- :data="tableData"
- :pageSize="20"
- height="84vh"
- v-loading="tableLoading"
- element-loading-text="拼命加载中"
- element-loading-background="rgba(0, 0, 0, 0.8)"
- ></ComTable>
- </div>
- </div>
- </template>
- <script>
- import ComTable from "@/components/coms/table/table.vue";
- import api from "@api/economic/index.js";
- export default {
- name: "ztzhl",
- components: { ComTable },
- data() {
- return {
- value1: "",
- value2: "",
- value3: "",
- tableLoading: true,
- optionData: ["小于3米风速", "大于3米风速", "大于4米风速"],
- cur: 0,
- vshows: "小于3米风速",
- tableData: {
- column: [
- {
- name: "单位",
- field: "wpid",
- is_num: false,
- is_light: false,
- sortable: true
- },
- {
- name: "5分钟(次)",
- field: "wfz",
- is_num: false,
- is_light: false,
- sortable: true
- },
- {
- name: "5分钟(次)",
- field: "wfzfwl",
- is_num: false,
- is_light: false,
- sortable: true
- },
- {
- name: "10分钟(次)",
- field: "sfz",
- is_num: false,
- is_light: false,
- sortable: true
- },
- {
- name: "10分钟(次)",
- field: "sfzfwl",
- is_num: false,
- is_light: false,
- sortable: true
- },
- {
- name: "15分钟(次)",
- field: "swfz",
- is_num: false,
- is_light: false,
- sortable: true
- },
- {
- name: "15分钟(次)",
- field: "swfzfwl",
- is_num: false,
- is_light: false,
- sortable: true
- },
- {
- name: "20分钟(次)",
- field: "esfz",
- is_num: false,
- is_light: false,
- sortable: true
- },
- {
- name: "20分钟(次)",
- field: "esfzfwl",
- is_num: false,
- is_light: false,
- sortable: true
- }
- ],
- data: []
- }
- };
- },
- mounted() {
- // 获取表格数据
- this.getTable();
- },
- created() {
- this.value1 = this.getTime(1);
- this.value2 = this.getTime(2);
- },
- methods: {
- // 获取表格数据
- getTable() {
- let that = this;
- that.tableLoading = true;
- api.threerateZtzhl({
- beginDate: this.value1,
- endDate: this.value2
- }).then((res) => {
- this.tableLoading = false;
- const vs = this.vshows;
- if (res.code === 200) {
- if (vs == "小于3米风速") {
- this.tableData.data = res.data.小于3米风速;
- } else if (vs == "大于3米风速") {
- this.tableData.data = res.data.大于3米风速;
- } else {
- this.tableData.data = res.data.大于4米风速;
- }
- }
- });
- // that.API.requestData({
- // method: "GET",
- // baseURL: "http://10.155.32.4:8034/",
- // subUrl: "/threerate/ztzhl",
- // data: {
- // beginDate: this.value1,
- // endDate: this.value2
- // },
- // success(res) {
- // that.tableLoading = false;
- // const vs = that.vshows;
- // if (res.code === 200) {
- // if (vs == "小于3米风速") {
- // that.tableData.data = res.data.小于3米风速;
- // } else if (vs == "大于3米风速") {
- // that.tableData.data = res.data.大于3米风速;
- // } else {
- // that.tableData.data = res.data.大于4米风速;
- // }
- // }
- // }
- // });
- },
- BeginChange(vl) {
- this.value1 = vl;
- },
- EndChange(vl) {
- this.value2 = vl;
- },
- // 计算事件
- handleSubmit() {
- this.vshows = "小于3米风速";
- this.cur = 0;
- if (this.value1 == "" || this.value1 == null) {
- this.$message.error("请选择开始时间");
- } else if (this.value2 == "" || this.value2 == null) {
- this.$message.error("请选择结束时间");
- } else {
- this.getTable();
- }
- },
- // 默认开始时间
- getTime(val) {
- //时间戳处理,val=1是默认开始时间(当前月第一天),val=2是默认结束时间(今天)
- var date = new Date();
- var year = date.getFullYear(),
- month = date.getMonth() + 1,
- day = date.getDate();
- month >= 1 && month <= 9 ? (month = "0" + month) : "";
- day >= 0 && day <= 9 ? (day = "0" + day) : "";
- var begin = year + "-" + month + "-01";
- var end = year + "-" + month + "-" + day;
- if (val == 1) {
- return begin;
- } else if (val == 2) {
- return end;
- }
- },
- handleOpen(vl, index) {
- this.vshows = "小于3米风速";
- this.$nextTick(() => {
- this.cur = index;
- this.vshows = vl;
- this.getTable();
- });
- }
- }
- };
- </script>
- <style scoped>
- .newsDiv {
- color: rgba(255, 255, 255, 0.75);
- background-color: rgba(255, 255, 255, 0.1);
- margin-bottom: 8px;
- line-height: 3.4259vh;
- padding: 0 15px;
- }
- .newspan {
- line-height: 30px;
- cursor: pointer;
- padding: 0 1vw;
- margin: 0 2px;
- color: #9ca5a8;
- transition: color 0.2s ease-in-out;
- position: relative;
- }
- .newspan:hover {
- background: linear-gradient(
- to top,
- rgba(5, 187, 76, 0.5),
- rgba(5, 187, 76, 0)
- );
- color: white;
- position: relative;
- }
- .newspan:hover::after {
- content: "";
- position: absolute;
- width: 100%;
- height: 0.463vh;
- border: 0.093vh solid #05bb4c;
- border-top: 0;
- left: 0;
- bottom: 0;
- box-sizing: border-box;
- }
- .active {
- background: linear-gradient(
- to top,
- rgba(5, 187, 76, 0.5),
- rgba(5, 187, 76, 0)
- );
- color: white;
- position: relative;
- }
- .active::after {
- content: "";
- position: absolute;
- width: 100%;
- height: 0.463vh;
- border: 0.093vh solid #05bb4c;
- border-top: 0;
- left: 0;
- bottom: 0;
- box-sizing: border-box;
- }
- .title {
- background: rgba(255, 255, 255, 0.1);
- margin-bottom: 8px;
- padding: 1vh;
- }
- </style>
|