123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278 |
- <template>
- <div class="draught-fan-list">
- <div class="query mg-b-8">
- <div class="query-items">
- <div class="query-item">
- <div class="lable">维度:</div>
- <div class="search-input">
- <el-select
- v-model="typeId"
- clearable
- placeholder="请选择"
- popper-class="select"
- @change="renderWprray"
- >
- <el-option
- v-for="item in typeArray"
- :key="item.id"
- :value="item.id"
- :label="item.name"
- />
- </el-select>
- </div>
- </div>
- <div class="query-item">
- <div class="lable">开始日期:</div>
- <div class="search-input">
- <el-date-picker
- v-model="beginDate"
- 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="endDate"
- type="date"
- value-format="YYYY-MM-DD"
- placeholder="选择日期"
- popper-class="date-select"
- >
- </el-date-picker>
- </div>
- </div>
- </div>
- <div class="query-actions">
- <button class="btn green" @click="search()">搜索</button>
- </div>
- </div>
- <div class="df-table">
- <ComTable height="100vh" :data="tableData"></ComTable>
- </div>
- <!-- <Mlc height="650px" :list="chartData" :units="chartUnit" :showLegend="true" /> -->
- <Lbc
- height="650px"
- :list="chartData"
- :units="chartUnit"
- :showLegend="true"
- :barMaxWidth="'4%'"
- :barGap="'150%'"
- />
- </div>
- </template>
- <script>
- import ComTable from "@com/coms/table/table.vue";
- import Lbc from "@com/chart/bar/multiple-bar-chart.vue";
- import api from "@api/economic/index.js";
- export default {
- // 名称
- name: "cutAnalyse",
- // 使用组件
- components: {
- ComTable,
- Lbc,
- },
- // 数据
- data() {
- const that = this;
- return {
- isAsc: "asc",
- typeArray: [
- {
- id: "1",
- name: "按报警统计",
- },
- {
- id: "2",
- name: "按报警分类统计",
- },
- {
- id: "3",
- name: "按厂家统",
- },
- ],
- typeId: "1",
- wpArray: [],
- wpId: "",
- beginDate: new Date(new Date().getTime() - 3600 * 1000 * 24).formatDate(
- "yyyy-MM-dd"
- ),
- endDate: new Date().formatDate("yyyy-MM-dd"),
- dialogShow: false,
- tableData: {
- column: [
- {
- name: "序号",
- field: "index",
- is_num: false,
- is_light: false,
- sortable: true,
- },
- {
- name: "名称",
- field: "name",
- is_num: false,
- is_light: false,
- sortable: true,
- },
- {
- name: "频率(次)",
- field: "frequencyday",
- is_num: false,
- is_light: false,
- sortable: true,
- },
- ],
- data: [],
- },
- chartData: [
- {
- title: "",
- yAxisIndex: 0,
- value: [],
- },
- ],
- chartUnit: ["(次)"],
- };
- },
- // 函数
- methods: {
- // 请求服务
- requestData() {
- let that = this;
- if (!that.typeId || !that.beginDate || !that.endDate) {
- that.BASE.showMsg({
- msg: "维度与日期不可为空",
- });
- } else {
- api.leaderboardQuerywarningStatistical({
- type: this.typeId,
- isAsc: this.isAsc,
- beginDate: this.beginDate,
- endDate: this.endDate,
- orderByColumn: "",
- }).then((res) => {
- let chartData = [];
- res.data.forEach((ele, index) => {
- if(ele.name != null){
- ele.index = i++;
- data.push(ele)
- chartData.push({
- title: ele.name,
- yAxisIndex: 0,
- value: [
- {
- text: ele.name,
- value: ele.frequencyday,
- },
- ],
- });
- }
- });
- this.chartData = chartData;
- this.tableData.data = res.data;
- });
- // that.API.requestData({
- // method: "POST",
- // subUrl: "leaderboard/querywarningStatistical",
- // data: {
- // type: that.typeId,
- // isAsc: that.isAsc,
- // beginDate: that.beginDate,
- // endDate: that.endDate,
- // orderByColumn: "",
- // },
- // success(res) {
- // let chartData = [];
- // res.data.forEach((ele, index) => {
- // ele.index = index + 1;
- // chartData.push({
- // title: ele.name,
- // yAxisIndex: 0,
- // value: [
- // {
- // text: ele.name,
- // value: ele.frequencyday,
- // },
- // ],
- // });
- // });
- // that.chartData = chartData;
- // that.tableData.data = res.data;
- // },
- // });
- }
- },
- search() {
- this.requestData();
- },
- },
- created() {
- this.requestData();
- },
- mounted() {},
- unmounted() {},
- };
- </script>
- <style lang="less" scoped>
- .draught-fan-list {
- width: 100%;
- height: 100%;
- display: flex;
- flex-direction: column;
- .btn-group-tabs {
- display: flex;
- flex-direction: row;
- .photovoltaic {
- margin-left: 1.481vh;
- }
- }
- .df-table {
- border: 0.093vh solid fade(@darkgray, 50%);
- position: relative;
- overflow: hidden;
- flex-grow: 1;
- margin-top: 1.481vh;
- height: 80vh;
- &:before {
- content: "";
- width: 0.37vh;
- height: 0.37vh;
- background: @write;
- position: absolute;
- left: 0.278vh;
- top: 0.278vh;
- }
- tbody {
- height: calc(100vh - 166px);
- }
- }
- }
- </style>
|