Commit 082a85f4 authored by 张牧越's avatar 张牧越

接口对接

parent f3b2627f
NODE_ENV = "development"
Mock: true
VUE_APP_API_URL = "http://qjwl.ythplan.io/"
VUE_APP_RESOURCE_URL= "http://qjwl.ythplan.io/"
\ No newline at end of file
NODE_ENV = "production"
Mock: false
VUE_APP_API_URL = "http://qjwl.ythplan.io/"
VUE_APP_RESOURCE_URL= "http://qjwl.ythplan.io/"
\ No newline at end of file
File added
......@@ -5,15 +5,23 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<!-- <link rel="icon" href="<%= BASE_URL %>favicon.ico"> -->
<title>
绍兴二院兰亭院区(康复医院)工程
</title>
<style>
.el-icon-loading {
font-size: 40px !important;
}
.el-loading-text {
font-size: 24px !important;
}
</style>
</head>
<body style="min-width: 1300px;">
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled.
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly wi thout JavaScript enabled.
Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
......
......@@ -20,6 +20,9 @@ export default {
},
},
mounted() {
if (this.$route.query.token) {
localStorage.setItem("token", this.$route.query.token);
}
this.$nextTick(() => {
this.bodyScale();
});
......
......@@ -2,54 +2,71 @@ import request from "@/utils/request"
export function getBaseData() {
return request({
url: '/api/project/basedata',
url: '/pweb/s/project/basedata',
method: 'get',
})
}
export function getDeviceStatus() {
return request({
url: '/pweb/s/project/device/statis',
method: 'get',
})
}
export function getProgressDetail() {
return request({
url: '/pweb/s/project/progress',
method: 'get',
})
}
// real-name
export function getRealNameStatus() {
return request({
url: '/api/personel/basedata',
url: '/pweb/s/personel/basedata',
method: 'get',
})
}
export function getInOutData() {
return request({
url: '/api/personel/latestweek/workinout',
url: '/pweb/s/personel/latestweek/workinout',
method: 'get',
})
}
export function getCurrentAttendance() {
return request({
url: '/api/personel/attendance',
url: '/pweb/s/personel/attendance',
method: 'get',
})
}
export function getPersonAreaStatus() {
return request({
url: '/api/personel/area',
url: '/pweb/s/personel/area',
method: 'get',
})
}
export function getLastWeekAttendance() {
return request({
url: '/api/personel/latestweek/attendance',
url: '/pweb/s/personel/latestweek/attendance',
method: 'get',
})
}
export function getLastWeekWorkType() {
return request({
url: '/api/personel/latestweek/worktype/attendance',
url: '/pweb/s/personel/latestweek/worktype/attendance',
method: 'get',
})
}
export function getWorkTypeList() {
return request({
url: '/api/personel/worktype/statis',
url: '/pweb/s/personel/worktype/statis',
method: 'get',
})
}
......@@ -59,21 +76,40 @@ export function getWorkTypeList() {
// early-warning
export function getAIdata() {
return request({
url: '/api/aiwarning/basedata',
url: '/pweb/s/aiwarning/basedata',
method: 'get',
})
}
export function getWarningList() {
return request({
url: '/api/aiwarning/list',
url: '/pweb/s/aiwarning/list',
method: 'get',
})
}
export function getMonthWarningStatis() {
return request({
url: '/api/aiwarning/month/statis',
url: '/pweb/s/aiwarning/month/statis',
method: 'get',
})
}
//noise
export function getDeviceTotalStatus(params) {
return request({
url: '/pweb/s/device/basedata',
method: 'get',
params
})
}
export function getNoiseDeviceList(params) {
return request({
url: '/pweb/s/device/list',
method: 'get',
params
})
}
\ No newline at end of file
......@@ -131,14 +131,14 @@
<img class="rt" src="@/assets/rt.png" alt="" />
<img class="rb" src="@/assets/rb.png" alt="" />
<img class="lb" src="@/assets/lb.png" alt="" />
<img
class="container-img"
:src="
screenDetail.plane_image_arr[0] &&
screenDetail.plane_image_arr[0].url
"
alt=""
/>
<el-carousel :interval="5000" arrow="always" height="48vh">
<el-carousel-item
v-for="(item, index) in screenDetail.plane_image_arr"
:key="index"
>
<img class="container-img" :src="item.url" alt="" />
</el-carousel-item>
</el-carousel>
</div>
</ShadowContainer>
<Title text="工程进度" type="long"></Title>
......@@ -148,70 +148,31 @@
<img src="@/assets/progress.png" alt="" />
<div class="progress-container">
<div class="progress-day">
<div class="progress-count">342</div>
<div class="progress-count">{{ progressDetail.zgq_num }}</div>
<div class="progress-text">总工期(天)</div>
</div>
<div class="progress-day">
<div class="progress-count" style="color: #ffaf51">288</div>
<div class="progress-count" style="color: #ffaf51">
{{ progressDetail.sg_num }}
</div>
<div class="progress-text">已施工(天)</div>
</div>
</div>
</div>
<div class="steps">
<el-steps :active="active" finish-status="success">
<el-step>
<template #title>
<div class="step-title">
2022-02-19
<div class="step-status">已完成</div>
</div>
</template>
<template #description>
<div class="step-description">开工</div>
</template>
</el-step>
<el-step>
<template #title>
<div class="step-title">
2022-02-19
<div class="step-status">已完成</div>
</div>
</template>
<template #description>
<div class="step-description">工程一</div>
</template>
</el-step>
<el-step>
<template #title>
<div class="step-title">
2022-02-19
<div class="step-status">已完成</div>
</div>
</template>
<template #description>
<div class="step-description">工程二</div>
</template>
</el-step>
<el-step>
<template #title>
<div class="step-title">
2022-02-19
<div class="step-status">已完成</div>
</div>
</template>
<template #description>
<div class="step-description">工程二</div>
</template>
</el-step>
<el-step>
<el-steps :active="progressDetail.step" finish-status="success">
<el-step
v-for="(progress, index) in progressDetail.progress_data"
:key="index"
>
<template #title>
<div class="step-title">
2022-02-19
<div class="step-status">进行中</div>
{{ progress.over_date }}
<div class="step-status">{{ progress.status_text }}</div>
</div>
</template>
<template #description>
<div class="step-description">工程二</div>
<div class="step-description">{{ progress.name }}</div>
</template>
</el-step>
</el-steps>
......@@ -228,13 +189,13 @@
v-for="(status, index) in deviceStatus"
:key="index"
>
<img class="status-img" :src="status.img" alt="" />
<img class="status-img" :src="status.icon_path" alt="" />
<div class="status-detail">
<div class="status-text">
{{ status.text }}
{{ status.name }}
</div>
<div class="status-number">
{{ status.counts }}
{{ status.total }}
<span></span>
</div>
</div>
......@@ -252,7 +213,7 @@
</div>
</template>
<script>
import { getBaseData } from "@/api/index";
import { getBaseData, getDeviceStatus, getProgressDetail } from "@/api/index";
export default {
name: "Construction",
data() {
......@@ -342,6 +303,12 @@ export default {
manageList: [],
plane_image_arr: [],
},
progressDetail: {
progress_data: [],
sg_num: 0,
zgq_num: 0,
step: 0,
},
};
},
methods: {
......@@ -511,11 +478,24 @@ export default {
},
getBaseData() {
getBaseData().then((res) => {
console.log(res);
if (res.status == 200) {
this.screenDetail = res.data;
}
});
getDeviceStatus().then((res) => {
if (res.status == 200) {
this.deviceStatus = res.data.map((item) => {
return {
...item,
icon_path:
process.env.VUE_APP_RESOURCE_URL + "/" + item.icon_path,
};
});
}
});
getProgressDetail().then((res) => {
this.progressDetail = res.data;
});
},
},
mounted() {
......@@ -737,7 +717,7 @@ export default {
position: relative;
.container-img {
width: 100%;
height: 46vh;
height: 48vh;
vertical-align: top;
}
.lt,
......
......@@ -180,7 +180,7 @@
:key="index"
>
<img src="@/assets/noise/icon_e_qi@2x.png" alt="" />
{{ monitor.text }}
{{ monitor.device_name }}
</div>
</div>
</ShadowContainer>
......@@ -188,14 +188,12 @@
</div>
</template>
<script>
import { getDeviceTotalStatus, getNoiseDeviceList } from "@/api/index";
export default {
name: "Noise",
data() {
return {
pieChartData: [
{ value: 4, name: "在线总数" },
{ value: 2, name: "离线总数" },
],
pieChartData: {},
noiseData: [
{ value: 4, name: "达标" },
{ value: 3, name: "超标" },
......@@ -234,18 +232,7 @@ export default {
{ text: "报警标题:报警内容123123123", time: "2023-02-12 09:12" },
{ text: "报警标题:报警内容123123123", time: "2023-02-12 09:12" },
],
noiseMonitors: [
{ text: "料仓扬尘监测" },
{ text: "料仓扬尘监测" },
{ text: "料仓扬尘监测" },
{ text: "料仓扬尘监测" },
{ text: "料仓扬尘监测" },
{ text: "料仓扬尘监测" },
{ text: "料仓扬尘监测" },
{ text: "料仓扬尘监测" },
{ text: "料仓扬尘监测" },
{ text: "料仓扬尘监测" },
],
noiseMonitors: [],
classOption: {
singleHeight: 36,
},
......@@ -253,12 +240,21 @@ export default {
},
methods: {
renderDeviceChart() {
const pieData = [
{ value: this.pieChartData.zxCount, name: "在线设备数量" },
{ value: this.pieChartData.lxCount, name: "离线设备数量" },
{ value: this.pieChartData.bjCount, name: "报警设备数量" },
];
const chart = this.$echarts.init(this.$refs.deviceChart);
let total = 0;
pieData.map((item) => {
total += item.value;
});
const option = {
title: {
x: "27%", //X坐标
y: "35%",
text: "6",
text: total,
subtext: "总数",
textAlign: "center",
textStyle: {
......@@ -282,9 +278,9 @@ export default {
itemWidth: 12,
icon: "rect",
right: "10%",
top: "30%",
top: "20%",
orient: "vertical",
itemGap: 40,
itemGap: 20,
textStyle: {
color: "inherit",
rich: {
......@@ -300,7 +296,7 @@ export default {
},
},
formatter: (name) => {
let data = this.pieChartData;
let data = pieData;
let target;
for (let i = 0, l = data.length; i < l; i++) {
if (data[i].name == name) {
......@@ -326,11 +322,20 @@ export default {
position: "center",
},
data: this.pieChartData,
data: pieData,
},
],
};
chart.setOption(option);
this.$nextTick(() => {
// 解决echarts图表放大溢出父容器
const resizeOb = new ResizeObserver((entries) => {
for (const entry of entries) {
this.$echarts.getInstanceByDom(entry.target).resize();
}
});
resizeOb.observe(document.getElementById("device-chart"));
});
},
renderNoiseChart() {
const chart = this.$echarts.init(this.$refs.noiseChart);
......@@ -546,9 +551,18 @@ export default {
};
chart.setOption(option);
},
getNoiseData() {
getDeviceTotalStatus({ top_cat: 9 }).then((res) => {
this.pieChartData = res.data;
this.renderDeviceChart();
});
getNoiseDeviceList({ top_cat: 9 }).then((res) => {
this.noiseMonitors = res.data;
});
},
},
mounted() {
this.renderDeviceChart();
this.getNoiseData();
this.renderNoiseChart();
this.renderAQIChart();
this.renderAqiQualityChart();
......@@ -559,7 +573,6 @@ export default {
this.$echarts.getInstanceByDom(entry.target).resize();
}
});
resizeOb.observe(document.getElementById("device-chart"));
resizeOb.observe(document.getElementById("noise-chart"));
resizeOb.observe(document.getElementById("aqi-chart"));
resizeOb.observe(document.getElementById("aqi-quality-chart"));
......
......@@ -126,26 +126,32 @@
</div>
</template>
<script>
import { getDeviceTotalStatus } from "@/api/index";
export default {
name: "Tower",
data() {
return {
pieChartData: [
{ value: 4, name: "在线总数" },
{ value: 3, name: "报警总数" },
{ value: 2, name: "离线总数" },
],
pieChartData: {},
active: 3,
};
},
methods: {
renderDeviceChart() {
const pieData = [
{ value: this.pieChartData.zxCount, name: "在线设备数量" },
{ value: this.pieChartData.lxCount, name: "离线设备数量" },
{ value: this.pieChartData.bjCount, name: "报警设备数量" },
];
const chart = this.$echarts.init(this.$refs.deviceChart);
let total = 0;
pieData.map((item) => {
total += item.value;
});
const option = {
title: {
x: "27%", //X坐标
y: "35%",
text: "9",
text: total,
subtext: "总数",
textAlign: "center",
textStyle: {
......@@ -187,7 +193,7 @@ export default {
},
},
formatter: (name) => {
let data = this.pieChartData;
let data = pieData;
let target;
for (let i = 0, l = data.length; i < l; i++) {
if (data[i].name == name) {
......@@ -212,12 +218,20 @@ export default {
show: false,
position: "center",
},
data: this.pieChartData,
data: pieData,
},
],
};
chart.setOption(option);
this.$nextTick(() => {
// 解决echarts图表放大溢出父容器
const resizeOb = new ResizeObserver((entries) => {
for (const entry of entries) {
this.$echarts.getInstanceByDom(entry.target).resize();
}
});
resizeOb.observe(document.getElementById("device-chart"));
});
},
renderForceChart() {
const chart = this.$echarts.init(this.$refs.forceChart);
......@@ -383,9 +397,15 @@ export default {
};
chart.setOption(option);
},
getTowerData() {
getDeviceTotalStatus({ top_cat: 1, child_cat: 1 }).then((res) => {
this.pieChartData = res.data;
this.renderDeviceChart();
});
},
},
mounted() {
this.renderDeviceChart();
this.getTowerData();
this.renderForceChart();
this.renderDipChart();
this.$nextTick(() => {
......
import axios from 'axios'
import Vue from 'vue'
import { Message, Loading } from 'element-ui';
import _ from 'lodash';
// loading框设置局部刷新,且所有请求完成后关闭loading框
let loadingInstance; //loading 实例
let needLoadingRequestCount = 0; //当前正在请求的数量
function showLoading() {
let main = document.querySelector('#app') //获取dom节点
if (main) {
if (needLoadingRequestCount === 0 && !loadingInstance) {
loadingInstance = Loading.service({
target: main, text: '正在加载...', background: 'rgba(0,0,0,0.6)', spinner: 'el-icon-loading'
});
}
needLoadingRequestCount++;
}
}
function closeLoading() {
Vue.nextTick(() => { // 以服务的方式调用的 Loading 需要异步关闭
needLoadingRequestCount--;
needLoadingRequestCount = Math.max(needLoadingRequestCount, 0); // 保证大于等于0
if (needLoadingRequestCount === 0) {
if (loadingInstance) {
hideLoading()
}
}
});
}
//防抖
var hideLoading = _.debounce(() => {
loadingInstance.close();
loadingInstance = null;
}, 10);
const request = axios.create({
withCredentials: false
withCredentials: false,
baseURL: process.env.VUE_APP_BASE_API,
})
request.interceptors.request.use(
config => {
const token = localStorage.getItem('token')
if (token) {
config.headers['X-Access-Token'] = token
config.headers['token'] = token
}
showLoading()
return config
},
error => {
console.log('error', error)
closeLoading()
return Promise.reject(new Error(error).message)
}
)
request.interceptors.response.use(
response => {
console.log('.....', response)
closeLoading()
if (response.data.status != 200) {
Message({
message: response.data.msg,
type: 'error'
})
}
if (response.data.status == 401) {
window.location.href = process.env.VUE_APP_RESOURCE_URL + 'pweb/m/login'
}
return response.data
},
error => {
console.log('error', error)
console.log(error)
closeLoading()
return Promise.reject(new Error(error).message)
}
)
......
......@@ -22,13 +22,10 @@ module.exports = defineConfig({
devServer: {
port: 3000,
proxy: {
'/api': {
target: 'http://zezcje.natappfree.cc/pweb/s',
'^/pweb/s/': {
target: process.env.VUE_APP_API_URL,
ws: false,
changeOrigin: true,
pathRewrite: {
'/api': ''
}
},
}
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment