123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455 |
- <template>
- <div class="health-6">
- <div class="header-info mg-b-16">
- <div class="selections">
- <div class="item" @click="tabSelect('1')" :class="{ active: type === '1' }">
- <i class="svg-icon svg-icon-sm">
- <svg-icon :svgid="'svg-wind-site'" />
- </i>
- <span>风场</span>
- </div>
- <div class="item" @click="tabSelect('2')" :class="{ active: type === '2' }">
- <i class="svg-icon svg-icon-sm">
- <svg-icon :svgid="'svg-h-project'" />
- </i>
- <span>项目</span>
- </div>
- </div>
- <div class="state" v-if="false">
- <div class="state-item green">
- <div class="dot "></div>
- <div class="text">良好数量:</div>
- <div class="value">999</div>
- </div>
- <div class="state-item purple">
- <div class="dot "></div>
- <div class="text">正常数量:</div>
- <div class="value">999</div>
- </div>
- <div class="state-item yellow">
- <div class="dot "></div>
- <div class="text">注意数量:</div>
- <div class="value">999</div>
- </div>
- <div class="state-item orange">
- <div class="dot "></div>
- <div class="text">严重数量:</div>
- <div class="value">999</div>
- </div>
- </div>
- </div>
- <row :type="'flex'" class="mg-b-16">
- <Col :span="12">
- <panel :title="'报警统计图'" :showLine="false">
- <dual-pie-chart :innerData="healPieData" :outerData="healPieData" :height="'250px'" />
- </panel>
- </Col>
- <Col :span="12">
- <panel :title="'故障统计图'" :showLine="false">
- <dual-pie-chart :innerData="stopPieData" :outerData="stopPieData" :height="'250px'" />
- </panel>
- </Col>
- <!-- <Col :span="16">
- <panel :title="'矩阵'" :showLine="false">
- <div class="matrix">
- <div class="item green">1号</div>
- <div class="item purple">2号</div>
- <div class="item orange">3号</div>
- <div class="item" v-for="index of 150" :key="index">{{ index + 3 }}号</div>
- <div class="blank" v-for="index of 30" :key="index"></div>
- </div>
- </panel>
- </Col> -->
- </row>
- <div class="mg-b-16">
- <panel :title="'健康状态占比'" :showLine="false">
- <bar-line-chart :bardata="barData" :lineData="[]" :height="'250px'" :pageSize="6" />
- </panel>
- </div>
- <div class="mg-b-16 curStyle">
- <panel :title="'健康趋势'" :showLine="false">
- <MultipleLineChart :list="statusData" :units="['']" :height="'250px'" />
- </panel>
- <div class="selections">
- <div class="item" @click="changeStatus('1')" :class="{ green: status === '1' }">
- 良好
- </div>
- <div class="item" @click="changeStatus('2')" :class="{ green: status === '2' }">
- 注意
- </div>
- </div>
- </div>
- </div>
- </template>
- <script>
- import BarLineChart from "../../components/chart/combination/bar-line-chart.vue";
- import MultipleLineChart from "../../components/chart/line/double-line-chart.vue";
- import DualPieChart from "../../components/chart/pie/dual-pie-chart.vue";
- import Col from "../../components/coms/grid/col.vue";
- import Row from "../../components/coms/grid/row.vue";
- import SvgIcon from "../../components/coms/icon/svg-icon.vue";
- import Panel from "../../components/coms/panel/panel.vue";
- export default {
- setup() {},
- components: { SvgIcon, Panel, MultipleLineChart, BarLineChart, Row, Col, DualPieChart },
- data() {
- return {
- type: "2",
- status: "1",
- healPieData: [],
- stopPieData: [],
- statusData: [],
- barData: {
- area: [],
- legend: [],
- data: [],
- },
- };
- },
- created() {
- this.requestData();
- },
- methods: {
- requestData() {
- this.getWpwarn();
- this.getStop();
- this.getWpOrProStatus();
- this.getStatus();
- },
- // 获取健康走势图
- getWpwarn() {
- let that = this;
- that.API.requestData({
- method: "POST",
- subUrl: "healthoperation/countWpwarn",
- data: {
- type: that.type,
- },
- success(res) {
- let healPieData = [];
- res.data.forEach((ele) => {
- healPieData.push({
- value: ele.value,
- unit: "次",
- name: ele.name,
- });
- });
- that.healPieData = healPieData;
- },
- });
- },
- // 获取故障统计图
- getStop() {
- let that = this;
- that.API.requestData({
- method: "POST",
- subUrl: "healthoperation/countStop",
- data: {
- type: that.type,
- },
- success(res) {
- let stopPieData = [];
- res.data.forEach((ele) => {
- stopPieData.push({
- value: ele.value,
- unit: "次",
- name: ele.name,
- });
- });
- that.stopPieData = stopPieData;
- },
- });
- },
- // 获取健康状态占比
- getWpOrProStatus() {
- let that = this;
- that.API.requestData({
- method: "POST",
- subUrl: "healthoperation/countWpOrProStatus",
- data: {
- type: that.type,
- },
- success(res) {
- let barData = {
- area: res.data.name,
- legend: ["良好数量", "正常数量", "注意数量", "严重数量"],
- data: [],
- };
- let length = res.data.name.length;
- for (let i = 0; i < length; i++) {
- barData.data.push([]);
- }
- for (let i = 0; i < length; i++) {
- barData.data[i].push(res.data.lhList[i]);
- barData.data[i].push(res.data.hgList[i]);
- barData.data[i].push(res.data.zyList[i]);
- barData.data[i].push(res.data.yzList[i]);
- }
- that.barData = barData;
- },
- });
- },
- // 获取健康状态
- getStatus() {
- let that = this;
- that.API.requestData({
- method: "POST",
- subUrl: "healthoperation/findWpOrProStatusForHistory",
- data: {
- type: that.type,
- status: that.status,
- },
- success(res) {
- let statusData = [];
- const time = res.data.time;
- for (let key in res.data) {
- if (key !== "name" && key !== "time") {
- let item = res.data[key];
-
- let statusItem = {
- title: res.data.name[0][key],
- smooth:true,
- value: [],
- };
- time.forEach((text, index) => {
- statusItem.value.push({
- text: text,
- value: item[index],
- });
- });
- statusData.push(statusItem);
- }
- }
- that.statusData = statusData;
- },
- });
- },
- tabSelect(type) {
- this.type = type;
- this.requestData();
- },
- changeStatus(status) {
- this.status = status;
- this.getStatus();
- },
- },
- };
- </script>
- <style lang="less">
- .health-6 {
- .curStyle {
- position: relative;
- .selections {
- position: absolute;
- display: flex;
- right: 0;
- top: 0;
- width: 50%;
- justify-content: flex-end;
- color: @gray;
- .item {
- margin-right: 15px;
- cursor: pointer;
- // flex: 0 0 80px;
- // text-align: center;
- // line-height: 33px;
- // margin-right: 8px;
- // color: @font-color;
- // font-size: @fontsize-s;
- // background: fade(@gray, 20);
- // border: 1px solid fade(@gray, 20);
- // display: flex;
- // justify-content: center;
- // align-items: center;
- // cursor: pointer;
- .green{
- color: @green;
- }
- &:hover,
- &.active {
- // background: fade(@green, 20);
- // border: 1px solid @green;
- color: @green;
- // cursor: pointer;
- i svg use {
- fill: @green;
- }
- }
- }
- }
- }
- .header-info {
- display: flex;
- .selections {
- display: flex;
- flex: 0 0 200px;
- .item {
- flex: 0 0 80px;
- text-align: center;
- height: 33px;
- line-height: 33px;
- margin-right: 8px;
- color: @font-color;
- font-size: @fontsize-s;
- background: fade(@gray, 20);
- border: 1px solid fade(@gray, 20);
- display: flex;
- justify-content: center;
- align-items: center;
- i {
- margin-right: 8px;
- svg use {
- fill: @gray;
- }
- }
- &:hover,
- &.active {
- background: fade(@green, 20);
- border: 1px solid @green;
- color: @green;
- cursor: pointer;
- i svg use {
- fill: @green;
- }
- }
- }
- }
- .state {
- display: flex;
- .state-item {
- display: flex;
- height: 32px;
- align-items: center;
- .dot {
- width: 8px;
- height: 8px;
- margin-right: 8px;
- }
- .text {
- margin-left: 8px;
- }
- .value {
- height: 32px;
- line-height: 32px;
- background: fade(@gray, 20);
- padding: 0 16px;
- }
- &.green {
- .dot {
- background: @green;
- }
- }
- &.purple {
- .dot {
- background: @purple;
- }
- }
- &.yellow {
- .dot {
- background: @yellow;
- }
- }
- &.orange {
- .dot {
- background: @orange;
- }
- }
- & + .state-item {
- margin-left: 16px;
- }
- }
- }
- }
- .matrix {
- display: flex;
- flex-wrap: wrap;
- .item {
- flex: 1 0 calc(100% / 20 - 4px);
- line-height: 26px;
- background: fade(@gray, 20);
- color: @gray-l;
- font-size: 12px;
- margin-bottom: 4px;
- text-align: center;
- border: 1px solid transparent;
- & + .item {
- margin-left: 4px;
- }
- &:nth-child(20n + 1) {
- margin-left: 0px;
- }
- &.green {
- color: @green;
- background: fade(@green, 20);
- border-color: @green;
- }
- &.purple {
- color: @purple;
- background: fade(@purple, 20);
- border-color: @purple;
- }
- &.orange {
- color: @orange;
- background: fade(@orange, 20);
- border-color: @orange;
- }
- &.red {
- color: @red;
- background: fade(@red, 20);
- border-color: @red;
- }
- }
- .blank {
- flex: 1 0 calc(100% / 20 - 4px);
- margin-left: 4px;
- }
- }
- }
- </style>
|